query_id
stringlengths
32
32
query
stringlengths
7
4.32k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
a92ece1f5c8ffb3d6382c4129b2f3c63
UpdateBackendsState updates all the service(s) with the updated state of the given backends. It also persists the updated backend states to the BPF maps. Backend state transitions are validated before processing. In case of duplicated backends in the list, the state will be updated to the last duplicate entry.
[ { "docid": "dc701563bce031dba7091e70ba13333b", "score": "0.83834296", "text": "func (s *Service) UpdateBackendsState(backends []*lb.Backend) error {\n\tif len(backends) == 0 {\n\t\treturn nil\n\t}\n\n\tif logging.CanLogAt(log.Logger, logrus.DebugLevel) {\n\t\tfor _, b := range backends {\n\t\t\tlog.WithFields(logrus.Fields{\n\t\t\t\tlogfields.L3n4Addr: b.L3n4Addr.String(),\n\t\t\t\tlogfields.BackendState: b.State,\n\t\t\t\tlogfields.BackendPreferred: b.Preferred,\n\t\t\t}).Debug(\"Update backend states\")\n\t\t}\n\t}\n\n\tvar (\n\t\terrs error\n\t\tupdatedBackends []*lb.Backend\n\t)\n\tupdateSvcs := make(map[lb.ID]*datapathTypes.UpsertServiceParams)\n\n\ts.Lock()\n\tdefer s.Unlock()\n\tfor _, updatedB := range backends {\n\t\thash := updatedB.L3n4Addr.Hash()\n\n\t\tbe, exists := s.backendByHash[hash]\n\t\tif !exists {\n\t\t\t// Cilium service API and Kubernetes events are asynchronous, so it's\n\t\t\t// possible to receive an API call for a backend that's already deleted.\n\t\t\tcontinue\n\t\t}\n\t\tif !lb.IsValidStateTransition(be.State, updatedB.State) {\n\t\t\tcurrentState, _ := be.State.String()\n\t\t\tnewState, _ := updatedB.State.String()\n\t\t\terrs = errors.Join(errs,\n\t\t\t\tfmt.Errorf(\"invalid state transition for backend[%s] (%s) -> (%s)\",\n\t\t\t\t\tupdatedB.String(), currentState, newState),\n\t\t\t)\n\t\t\tcontinue\n\t\t}\n\t\tbe.State = updatedB.State\n\t\tbe.Preferred = updatedB.Preferred\n\n\t\tfor id, info := range s.svcByID {\n\t\t\tvar p *datapathTypes.UpsertServiceParams\n\t\t\tfor i, b := range info.backends {\n\t\t\t\tif b.L3n4Addr.String() != updatedB.L3n4Addr.String() {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif b.State == updatedB.State {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tinfo.backends[i].State = updatedB.State\n\t\t\t\tinfo.backends[i].Preferred = updatedB.Preferred\n\t\t\t\tfound := false\n\n\t\t\t\tif p, found = updateSvcs[id]; !found {\n\t\t\t\t\tp = &datapathTypes.UpsertServiceParams{\n\t\t\t\t\t\tID: uint16(id),\n\t\t\t\t\t\tIP: info.frontend.L3n4Addr.AddrCluster.AsNetIP(),\n\t\t\t\t\t\tPort: info.frontend.L3n4Addr.L4Addr.Port,\n\t\t\t\t\t\tPrevBackendsCount: len(info.backends),\n\t\t\t\t\t\tIPv6: info.frontend.IsIPv6(),\n\t\t\t\t\t\tType: info.svcType,\n\t\t\t\t\t\tExtLocal: info.isExtLocal(),\n\t\t\t\t\t\tIntLocal: info.isIntLocal(),\n\t\t\t\t\t\tScope: info.frontend.L3n4Addr.Scope,\n\t\t\t\t\t\tSessionAffinity: info.sessionAffinity,\n\t\t\t\t\t\tSessionAffinityTimeoutSec: info.sessionAffinityTimeoutSec,\n\t\t\t\t\t\tCheckSourceRange: info.checkLBSourceRange(),\n\t\t\t\t\t\tUseMaglev: info.useMaglev(),\n\t\t\t\t\t\tName: info.svcName,\n\t\t\t\t\t\tLoopbackHostport: info.LoopbackHostport,\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tp.PreferredBackends, p.ActiveBackends, p.NonActiveBackends = segregateBackends(info.backends)\n\t\t\t\tupdateSvcs[id] = p\n\t\t\t\tlog.WithFields(logrus.Fields{\n\t\t\t\t\tlogfields.ServiceID: p.ID,\n\t\t\t\t\tlogfields.BackendID: b.ID,\n\t\t\t\t\tlogfields.L3n4Addr: b.L3n4Addr.String(),\n\t\t\t\t\tlogfields.BackendState: b.State,\n\t\t\t\t\tlogfields.BackendPreferred: b.Preferred,\n\t\t\t\t}).Info(\"Persisting service with backend state update\")\n\t\t\t}\n\t\t\ts.svcByID[id] = info\n\t\t\ts.svcByHash[info.frontend.Hash()] = info\n\t\t}\n\t\tupdatedBackends = append(updatedBackends, be)\n\t}\n\n\t// Update the persisted backend state in BPF maps.\n\tfor _, b := range updatedBackends {\n\t\tlog.WithFields(logrus.Fields{\n\t\t\tlogfields.BackendID: b.ID,\n\t\t\tlogfields.L3n4Addr: b.L3n4Addr.String(),\n\t\t\tlogfields.BackendState: b.State,\n\t\t\tlogfields.BackendPreferred: b.Preferred,\n\t\t}).Info(\"Persisting updated backend state for backend\")\n\t\tif err := s.lbmap.UpdateBackendWithState(b); err != nil {\n\t\t\terrs = errors.Join(errs, fmt.Errorf(\"failed to update backend %+v %w\", b, err))\n\t\t}\n\t}\n\n\tfor i := range updateSvcs {\n\t\terrs = errors.Join(errs, s.lbmap.UpsertService(updateSvcs[i]))\n\t}\n\treturn errs\n}", "title": "" } ]
[ { "docid": "189499502bfa59dc6677d926bcf5875f", "score": "0.71409774", "text": "func (o *OrService) updateBackends(backends []*model.Backend) error {\n\turl := fmt.Sprintf(\"http://127.0.0.1:%v/config/backends\", o.ocfg.ListenPorts.Status)\n\tif err := post(url, backends); err != nil {\n\t\treturn err\n\t}\n\tlogrus.Debug(\"dynamically update http Upstream success\")\n\treturn nil\n}", "title": "" }, { "docid": "2d4cc5c92399b875e4892390b22ce121", "score": "0.6551287", "text": "func (s *Service) UpdateBackendServices() error {\n\t// Refresh the instance groups available.\n\tif err := s.ReconcileInstanceGroups(); err != nil {\n\t\treturn err\n\t}\n\n\t// Retrieve the spec and the current backend service.\n\tbackendServiceSpec := s.getAPIServerBackendServiceSpec()\n\tbackendService, err := s.backendservices.Get(s.scope.Project(), backendServiceSpec.Name).Do()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Update backend service if the list of backends has changed in the spec.\n\t// This might happen if new instance groups for the control plane api server\n\t// are created in additional zones.\n\tif len(backendService.Backends) != len(backendServiceSpec.Backends) {\n\t\tbackendService.Backends = backendServiceSpec.Backends\n\t\top, err := s.backendservices.Update(s.scope.Project(), backendService.Name, backendService).Do()\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"failed to update backend service\")\n\t\t}\n\t\tif err := wait.ForComputeOperation(s.scope.Compute, s.scope.Project(), op); err != nil {\n\t\t\treturn errors.Wrapf(err, \"failed to update backend service\")\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "37b97a4a133d859764071826c6855b09", "score": "0.63895947", "text": "func (b *BackendController) ReconcileBackends(actual, intended AutonegStatus) (err error) {\n\tremoves, upserts := ReconcileStatus(b.project, actual, intended)\n\n\tfor port, _removes := range removes {\n\t\tfor idx, remove := range _removes {\n\t\t\tvar oldSvc *compute.BackendService\n\t\t\toldSvc, err = b.getBackendService(remove.name, remove.region)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tvar newSvc *compute.BackendService\n\t\t\tupsert := upserts[port][idx]\n\n\t\t\tif upsert.name != remove.name {\n\t\t\t\tif newSvc, err = b.getBackendService(upsert.name, upsert.region); err != nil {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tnewSvc = oldSvc\n\t\t\t}\n\n\t\t\t// Remove backends in the list to be deleted\n\t\t\tfor _, d := range remove.backends {\n\t\t\t\tfor i, be := range oldSvc.Backends {\n\t\t\t\t\tif d.Group == be.Group {\n\t\t\t\t\t\tcopy(oldSvc.Backends[i:], oldSvc.Backends[i+1:])\n\t\t\t\t\t\toldSvc.Backends = oldSvc.Backends[:len(oldSvc.Backends)-1]\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// If we are changing backend services, save the old service\n\t\t\tif upsert.name != remove.name {\n\t\t\t\tif err = b.updateBackends(remove.name, remove.region, oldSvc); err != nil {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Add or update any new backends to the list\n\t\t\tfor _, u := range upsert.backends {\n\t\t\t\tcopy := true\n\t\t\t\tfor _, be := range newSvc.Backends {\n\t\t\t\t\tif u.Group == be.Group {\n\t\t\t\t\t\t// TODO: copy fields explicitly\n\t\t\t\t\t\tbe.MaxRatePerEndpoint = u.MaxRatePerEndpoint\n\t\t\t\t\t\tbe.MaxConnectionsPerEndpoint = u.MaxConnectionsPerEndpoint\n\t\t\t\t\t\tcopy = false\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif copy {\n\t\t\t\t\tnewBackend := u\n\t\t\t\t\tnewSvc.Backends = append(newSvc.Backends, &newBackend)\n\t\t\t\t}\n\t\t\t}\n\t\t\terr = b.updateBackends(upsert.name, upsert.region, newSvc)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0abf5ca9fbc5473172132284d2e091f6", "score": "0.6363584", "text": "func UpdateService(fe ServiceKey, backends []ServiceValue,\n\taddRevNAT bool, revNATID int,\n\tacquireBackendID func(loadbalancer.L3n4Addr) (loadbalancer.BackendID, error),\n\treleaseBackendID func(loadbalancer.BackendID)) error {\n\n\tscopedLog := log.WithFields(logrus.Fields{\n\t\t\"frontend\": fe,\n\t\t\"backends\": backends,\n\t})\n\n\tmutex.Lock()\n\tdefer mutex.Unlock()\n\n\tvar (\n\t\tweights []uint16\n\t\tnNonZeroWeights uint16\n\t)\n\n\t// Find out which backends are new (i.e. the ones which do not exist yet and\n\t// will be created in this function) and acquire IDs for them\n\tnewBackendIDs, err := acquireNewBackendIDs(backends, acquireBackendID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Store mapping of backend addr ID => backend ID in the cache\n\tcache.addBackendIDs(newBackendIDs)\n\n\t// Prepare the service cache for the updates\n\tsvc, addedBackends, removedBackendIDs, err := cache.prepareUpdate(fe, backends)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// FIXME(brb) Uncomment the following code after we have enabled weights\n\t// in the BPF datapath code.\n\t//for _, be := range besValues {\n\t//\tweights = append(weights, be.GetWeight())\n\t//\tif be.GetWeight() != 0 {\n\t//\t\tnNonZeroWeights++\n\t//\t}\n\t//}\n\n\tbesValuesV2 := svc.getBackendsV2()\n\n\tscopedLog.Debug(\"Updating BPF representation of service\")\n\n\t// Add the new backends to the BPF maps\n\tif err := updateBackendsLocked(addedBackends); err != nil {\n\t\treturn err\n\t}\n\n\t// Update the v2 service BPF maps\n\tif err := updateServiceV2Locked(fe, besValuesV2, svc, addRevNAT, revNATID, weights, nNonZeroWeights); err != nil {\n\t\treturn err\n\t}\n\n\t// Delete no longer needed backends\n\tif err := removeBackendsLocked(removedBackendIDs, releaseBackendID); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "db3c2afd3e3d8084bc837f7413dabae0", "score": "0.57959706", "text": "func (l *lbmapCache) prepareUpdate(fe ServiceKey, backends []ServiceValue) (\n\t*bpfService, map[loadbalancer.BackendID]ServiceValue, []BackendKey, error) {\n\n\tfrontendID := fe.String()\n\n\tbpfSvc, ok := l.entries[frontendID]\n\tif !ok {\n\t\tbpfSvc = newBpfService(fe)\n\t\tl.entries[frontendID] = bpfSvc\n\t}\n\n\tnewBackendsMap := createBackendsMap(backends)\n\ttoRemoveBackendIDs := []BackendKey{}\n\ttoAddBackendIDs := map[loadbalancer.BackendID]ServiceValue{}\n\n\t// Step 1: Delete all backends that no longer exist.\n\tfor addrID := range bpfSvc.backendsV2 {\n\t\tif _, ok := newBackendsMap[addrID]; !ok {\n\t\t\tisLastInstanceRemoved, err := l.delBackendV2Locked(addrID)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, nil, nil, err\n\t\t\t}\n\t\t\tif isLastInstanceRemoved {\n\t\t\t\ttoRemoveBackendIDs = append(toRemoveBackendIDs,\n\t\t\t\t\tl.backendIDByAddrID[addrID])\n\t\t\t\tdelete(l.backendIDByAddrID, addrID)\n\t\t\t}\n\t\t\tdelete(bpfSvc.backendsV2, addrID)\n\t\t}\n\t}\n\n\t// Step 2: Add all backends that don't exist in the service yet.\n\tfor _, b := range backends {\n\t\taddrID := b.BackendAddrID()\n\t\tif _, ok := bpfSvc.backendsV2[addrID]; !ok {\n\t\t\tbpfSvc.backendsV2[addrID] = b\n\t\t\tisNew := l.addBackendV2Locked(addrID)\n\t\t\tif isNew {\n\t\t\t\ttoAddBackendIDs[l.backendIDByAddrID[addrID].GetID()] = b\n\t\t\t}\n\t\t}\n\t}\n\n\treturn bpfSvc, toAddBackendIDs, toRemoveBackendIDs, nil\n}", "title": "" }, { "docid": "8f3906f1f2d683ba9d7453624fcd799e", "score": "0.5782606", "text": "func segregateBackends(backends []*lb.Backend) (preferredBackends map[string]*lb.Backend,\n\tactiveBackends map[string]*lb.Backend, nonActiveBackends []lb.BackendID) {\n\tpreferredBackends = make(map[string]*lb.Backend)\n\tactiveBackends = make(map[string]*lb.Backend, len(backends))\n\n\tfor _, b := range backends {\n\t\t// Separate active from non-active backends so that they won't be selected\n\t\t// to serve new requests, but can be restored after agent restart. Non-active backends\n\t\t// are kept in the affinity and backend maps so that existing connections\n\t\t// are able to terminate gracefully. Such backends would either be cleaned-up\n\t\t// when the backends are deleted, or they could transition to active state.\n\t\tif b.State == lb.BackendStateActive {\n\t\t\tactiveBackends[b.String()] = b\n\t\t\t// keep another list of preferred backends if available\n\t\t\tif b.Preferred {\n\t\t\t\tpreferredBackends[b.String()] = b\n\t\t\t}\n\t\t} else {\n\t\t\tnonActiveBackends = append(nonActiveBackends, b.ID)\n\t\t}\n\t}\n\t// To avoid connections drops during rolling updates, Kubernetes defines a Terminating state on the EndpointSlices\n\t// that can be used to identify Pods that, despite being terminated, still can serve traffic.\n\t// In case that there are no Active backends, use the Backends in TerminatingState to answer new requests\n\t// and avoid traffic disruption until new active backends are created.\n\t// https://github.com/kubernetes/enhancements/tree/master/keps/sig-network/1669-proxy-terminating-endpoints\n\tif option.Config.EnableK8sTerminatingEndpoint && len(activeBackends) == 0 {\n\t\tnonActiveBackends = []lb.BackendID{}\n\t\tfor _, b := range backends {\n\t\t\tif b.State == lb.BackendStateTerminating {\n\t\t\t\tactiveBackends[b.String()] = b\n\t\t\t} else {\n\t\t\t\tnonActiveBackends = append(nonActiveBackends, b.ID)\n\t\t\t}\n\t\t}\n\t}\n\treturn preferredBackends, activeBackends, nonActiveBackends\n}", "title": "" }, { "docid": "771e9a2bcd0ca4565b003fa20f6cff33", "score": "0.57774115", "text": "func UpdateService(fe ServiceKey, backends []ServiceValue, addRevNAT bool, revNATID int) error {\n\tvar (\n\t\tweights []uint16\n\t\tnNonZeroWeights uint16\n\t\texistingCount int\n\t)\n\n\tsvc := cache.prepareUpdate(fe, backends)\n\tbesValues := svc.getBackends()\n\n\tlog.WithFields(logrus.Fields{\n\t\t\"frontend\": fe,\n\t\t\"backends\": besValues,\n\t}).Debugf(\"Updating BPF representation of service\")\n\n\tfor _, be := range besValues {\n\t\tweights = append(weights, be.GetWeight())\n\t\tif be.GetWeight() != 0 {\n\t\t\tnNonZeroWeights++\n\t\t}\n\t}\n\n\tmutex.Lock()\n\tdefer mutex.Unlock()\n\n\t// Check if the service already exists, it is not failure scenario if\n\t// the services doesn't exist. That's simply a new service. Even if the\n\t// service cannot be looked up for an existing service, it is still\n\t// better to proceed and update the service, at the cost of a slightly\n\t// less atomic update.\n\tsvcValue, err := lookupService(fe)\n\tif err == nil {\n\t\texistingCount = svcValue.GetCount()\n\t}\n\n\tfor nsvc, be := range besValues {\n\t\tfe.SetBackend(nsvc + 1) // service count starts with 1\n\t\tif err := updateService(fe, be); err != nil {\n\t\t\treturn fmt.Errorf(\"unable to update service %+v with the value %+v: %s\", fe, be, err)\n\t\t}\n\t}\n\n\tif addRevNAT {\n\t\tzeroValue := fe.NewValue().(ServiceValue)\n\t\tzeroValue.SetRevNat(revNATID)\n\t\trevNATKey := zeroValue.RevNatKey()\n\t\trevNATValue := fe.RevNatValue()\n\n\t\tif err := updateRevNatLocked(revNATKey, revNATValue); err != nil {\n\t\t\treturn fmt.Errorf(\"unable to update reverse NAT %+v with value %+v, %s\", revNATKey, revNATValue, err)\n\t\t}\n\t\tdefer func() {\n\t\t\tif err != nil {\n\t\t\t\tdeleteRevNatLocked(revNATKey)\n\t\t\t}\n\t\t}()\n\t}\n\n\terr = updateMasterService(fe, len(besValues), nNonZeroWeights)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to update service %+v: %s\", fe, err)\n\t}\n\n\terr = updateWrrSeq(fe, weights)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to update service weights for %s with value %+v: %s\", fe.String(), weights, err)\n\t}\n\n\t// Remove old backends that are no longer needed\n\tfor i := len(besValues) + 1; i <= existingCount; i++ {\n\t\tfe.SetBackend(i)\n\t\tif err := deleteServiceLocked(fe); err != nil {\n\t\t\treturn fmt.Errorf(\"unable to delete service %+v: %s\", fe, err)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e86f480ff26679086669cdd1b3e23dab", "score": "0.5747919", "text": "func (e *Explorer) updateBalancers(discovery *Discovery) {\n\tstate := e.getState()\n\n\tnow := time.Now()\n\n\tupdates := []balancer.Balancer{}\n\tfor _, b := range discovery.Balancers {\n\t\tbs := b.String()\n\t\tif reflect.DeepEqual(e.updated[bs].apps, discovery.Apps) {\n\t\t\tif now.Sub(e.updated[bs].time) < e.laziness {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tupdates = append(updates, b)\n\t}\n\n\twg := sync.WaitGroup{}\n\twg.Add(len(updates))\n\n\tfor _, b := range updates {\n\t\tgo func(b balancer.Balancer) {\n\t\t\tdefer wg.Done()\n\n\t\t\terr := b.Update(e.name, discovery.Apps, state)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"error updating state on %s: %s\", b, err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\te.mutex.Lock()\n\t\t\te.updated[b.String()] = update{\n\t\t\t\ttime: now,\n\t\t\t\tapps: discovery.Apps,\n\t\t\t}\n\t\t\te.mutex.Unlock()\n\t\t}(b)\n\t}\n\n\twg.Wait()\n}", "title": "" }, { "docid": "d267945f272f2672eea85afd1ede84ab", "score": "0.5740991", "text": "func (s *LoadBalancerClient) UpdateDefaultServerGroup(backends interface{}, lb *slb.LoadBalancerType) error {\n\tnodes, ok := backends.([]*v1.Node)\n\tif !ok {\n\t\tglog.Infof(\"skip default server group update for type %s\", reflect.TypeOf(backends))\n\t\treturn nil\n\t}\n\tadditions, deletions := []slb.BackendServerType{}, []string{}\n\tglog.V(5).Infof(\"alicloud: try to update loadbalancer backend servers. [%s]\", lb.LoadBalancerId)\n\t// checkout for newly added servers\n\tfor _, n1 := range nodes {\n\t\tfound := false\n\t\t_, id, err := nodeFromProviderID(n1.Spec.ProviderID)\n\t\tfor _, n2 := range lb.BackendServers.BackendServer {\n\t\t\tif err != nil {\n\t\t\t\tglog.Errorf(\"alicloud: node providerid=%s is not\"+\n\t\t\t\t\t\" in the correct form, expect regionid.instanceid. skip add op\", n1.Spec.ProviderID)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif id == n2.ServerId {\n\t\t\t\tfound = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !found {\n\t\t\tadditions = append(additions, slb.BackendServerType{ServerId: string(id), Weight: DEFAULT_SERVER_WEIGHT, Type: \"ecs\"})\n\t\t}\n\t}\n\tif len(additions) > 0 {\n\t\tglog.V(5).Infof(\"alicloud: add loadbalancer backend for [%s] \\n %s\\n\", lb.LoadBalancerId, PrettyJson(additions))\n\t\t// only 20 backend servers is accepted per delete.\n\t\tfor len(additions) > 0 {\n\t\t\tvar target []slb.BackendServerType\n\t\t\tif len(additions) > MAX_LOADBALANCER_BACKEND {\n\t\t\t\ttarget = additions[0:MAX_LOADBALANCER_BACKEND]\n\t\t\t\tadditions = additions[MAX_LOADBALANCER_BACKEND:]\n\t\t\t\tglog.V(5).Infof(\"alicloud: batch add backend servers, %v\", target)\n\t\t\t} else {\n\t\t\t\ttarget = additions\n\t\t\t\tadditions = []slb.BackendServerType{}\n\t\t\t\tglog.V(5).Infof(\"alicloud: batch add backend servers, else %v\", target)\n\t\t\t}\n\t\t\tif _, err := s.c.AddBackendServers(lb.LoadBalancerId, target); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// check for removed backend servers\n\tfor _, n1 := range lb.BackendServers.BackendServer {\n\t\tfound := false\n\t\tfor _, n2 := range nodes {\n\t\t\t_, id, err := nodeFromProviderID(n2.Spec.ProviderID)\n\t\t\tif err != nil {\n\t\t\t\tglog.Errorf(\"alicloud: node providerid=%s is not \"+\n\t\t\t\t\t\"in the correct form, expect regionid.instanceid.. skip delete op... [%s]\", n2.Spec.ProviderID, err.Error())\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif n1.ServerId == id {\n\t\t\t\tfound = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !found {\n\t\t\tdeletions = append(deletions, n1.ServerId)\n\t\t}\n\t}\n\tif len(deletions) > 0 {\n\t\tglog.V(5).Infof(\"alicloud: delete loadbalancer backend for [%s] %v\", lb.LoadBalancerId, deletions)\n\t\t// only 20 backend servers is accepted per delete.\n\t\tfor len(deletions) > 0 {\n\t\t\tvar target []string\n\t\t\tif len(deletions) > MAX_LOADBALANCER_BACKEND {\n\t\t\t\ttarget = deletions[0:MAX_LOADBALANCER_BACKEND]\n\t\t\t\tdeletions = deletions[MAX_LOADBALANCER_BACKEND:]\n\t\t\t\tglog.V(5).Infof(\"alicloud: batch delete backend servers, %s\", target)\n\t\t\t} else {\n\t\t\t\ttarget = deletions\n\t\t\t\tdeletions = []string{}\n\t\t\t\tglog.V(5).Infof(\"alicloud: batch delete backend servers else, %s\", target)\n\t\t\t}\n\t\t\tif _, err := s.c.RemoveBackendServers(lb.LoadBalancerId, target); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\tif len(additions) <= 0 && len(deletions) <= 0 {\n\t\tglog.V(5).Infof(\"alicloud: no backend servers need to be updated.[%s]\", lb.LoadBalancerId)\n\t\treturn nil\n\t}\n\tglog.V(5).Infof(\"alicloud: update loadbalancer`s backend servers finished! [%s]\", lb.LoadBalancerId)\n\treturn nil\n}", "title": "" }, { "docid": "2c5ae7ad5c6a0d2b18c62f94ab2d0ae7", "score": "0.5530304", "text": "func (s *ServerPool) SetBackendStatus(backendURL *url.URL, alive bool) {\n\tfor _, b := range s.backends {\n\t\tif b.URL.String() == backendURL.String() {\n\t\t\tb.SetAlive(alive)\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b2090390f62889810f66b807fe1e9a00", "score": "0.5484758", "text": "func (l *lbmapCache) filterNewBackends(backends serviceValueMap) serviceValueMap {\n\tnewBackends := serviceValueMap{}\n\n\tfor addrID, b := range backends {\n\t\tif _, found := l.backendIDByAddrID[addrID]; !found {\n\t\t\tnewBackends[addrID] = b\n\t\t}\n\t}\n\n\treturn newBackends\n}", "title": "" }, { "docid": "aaeed50cf1dd41d62420d5bca62660c2", "score": "0.54525876", "text": "func (s *backendServer) ApplyChanges(backendName templaterouter.ServiceAliasConfigKey, client *Client) error {\n\t// Build the haproxy dynamic config API commands.\n\tcommands := []string{}\n\n\tcmdPrefix := fmt.Sprintf(\"%s %s/%s\", SetServerCommand, string(backendName), s.Name)\n\n\tif s.updatedIPAddress != s.IPAddress || s.updatedPort != s.Port {\n\t\tcmd := fmt.Sprintf(\"%s addr %s\", cmdPrefix, s.updatedIPAddress)\n\t\tif s.updatedPort != s.Port {\n\t\t\tcmd = fmt.Sprintf(\"%s port %v\", cmd, s.updatedPort)\n\t\t}\n\t\tcommands = append(commands, cmd)\n\t}\n\n\tif s.updatedWeight != strconv.Itoa(int(s.CurrentWeight)) {\n\t\t// Build and execute the haproxy dynamic config API command.\n\t\tcmd := fmt.Sprintf(\"%s weight %s\", cmdPrefix, s.updatedWeight)\n\t\tcommands = append(commands, cmd)\n\t}\n\n\tstate := string(s.updatedState)\n\tif s.updatedState == BackendServerStateDown {\n\t\t// BackendServerStateDown for a server can't be set!\n\t\tstate = \"\"\n\t}\n\n\tif len(state) > 0 && s.updatedState != s.State {\n\t\tcmd := fmt.Sprintf(\"%s state %s\", cmdPrefix, state)\n\t\tcommands = append(commands, cmd)\n\t}\n\n\t// Execute all the commands.\n\tfor _, cmd := range commands {\n\t\tif err := s.executeCommand(cmd, client); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c4c33986cc1b8c15031ce7f5685696d0", "score": "0.54432607", "text": "func (tg *TargetGroup) AddBackends(adds BackendList) {\n\ttmp := make(map[string]*Backend)\n\tfor _, bk := range tg.Backends {\n\t\ttmp[bk.IP+strconv.Itoa(int(bk.Port))] = bk\n\t}\n\tfor _, add := range adds {\n\t\tif _, ok := tmp[add.IP+strconv.Itoa(int(add.Port))]; !ok {\n\t\t\ttg.Backends = append(tg.Backends, add)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7a545107a9dd2104523d9836aa8f4b77", "score": "0.5416064", "text": "func (d *persistentStore) ListBackends(ctx context.Context) ([]*types.Backend, error) {\n\tvar backends []*types.Backend\n\tq := datastore.NewQuery(backendKind).Distinct()\n\t_, err := q.GetAll(ctx, &backends)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to query the backends: %q\", err.Error())\n\t}\n\tif backends == nil {\n\t\treturn []*types.Backend{}, nil\n\t}\n\tfor _, b := range backends {\n\t\tb.LastUsed = backendLastActive(ctx, b.BackendID).Format(time.RFC3339)\n\t}\n\treturn backends, nil\n}", "title": "" }, { "docid": "01ecb563f92ed0d9bfe62dd48824e81b", "score": "0.5319048", "text": "func Backends() (names []string) {\n\tfor name, _ := range backends {\n\t\tnames = append(names, name)\n\t}\n\treturn\n}", "title": "" }, { "docid": "3f576fb0490105b64e7bcb1f5da25ddb", "score": "0.5316709", "text": "func (b *BackendServiceSyncer) updateBackendService(desiredBE *compute.BackendService) (*compute.BackendService, error) {\n\tname := desiredBE.Name\n\tfmt.Println(\"Updating existing backend service\", name, \"to match the desired state\")\n\terr := b.bsp.UpdateGlobalBackendService(desiredBE)\n\tif err != nil {\n\t\t// TODO(G-Harmon): Errors should probably go to STDERR.\n\t\tfmt.Printf(\"Error from UpdateGlobalBackendService: %s\\n\", err)\n\t\treturn nil, err\n\t}\n\tfmt.Println(\"Backend service\", name, \"updated successfully\")\n\treturn b.bsp.GetGlobalBackendService(name)\n}", "title": "" }, { "docid": "9b007650a48fdba5dba6002f6de0ede5", "score": "0.53086287", "text": "func (c *Config) filterBackendsByBackends(backendNames []string) {\n\tvar newBackends []Backend\n\tfor _, name := range backendNames {\n\t\tfor i := range c.Backends {\n\t\t\tif c.Backends[i].Backend == name {\n\t\t\t\tnewBackends = append(newBackends, c.Backends[i])\n\t\t\t}\n\t\t}\n\t}\n\tc.Backends = newBackends\n}", "title": "" }, { "docid": "55e064bdc81be03d1e837e7a3f6b0e93", "score": "0.52880776", "text": "func (client NetworkLoadBalancerClient) UpdateBackendSet(ctx context.Context, request UpdateBackendSetRequest) (response UpdateBackendSetResponse, err error) {\n\tvar ociResponse common.OCIResponse\n\tpolicy := common.NoRetryPolicy()\n\tif client.RetryPolicy() != nil {\n\t\tpolicy = *client.RetryPolicy()\n\t}\n\tif request.RetryPolicy() != nil {\n\t\tpolicy = *request.RetryPolicy()\n\t}\n\n\tif !(request.OpcRetryToken != nil && *request.OpcRetryToken != \"\") {\n\t\trequest.OpcRetryToken = common.String(common.RetryToken())\n\t}\n\n\tociResponse, err = common.Retry(ctx, request, client.updateBackendSet, policy)\n\tif err != nil {\n\t\tif ociResponse != nil {\n\t\t\tif httpResponse := ociResponse.HTTPResponse(); httpResponse != nil {\n\t\t\t\topcRequestId := httpResponse.Header.Get(\"opc-request-id\")\n\t\t\t\tresponse = UpdateBackendSetResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId}\n\t\t\t} else {\n\t\t\t\tresponse = UpdateBackendSetResponse{}\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\tif convertedResponse, ok := ociResponse.(UpdateBackendSetResponse); ok {\n\t\tresponse = convertedResponse\n\t} else {\n\t\terr = fmt.Errorf(\"failed to convert OCIResponse into UpdateBackendSetResponse\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "145f9fd4413f937c1fa42f4e3ca1443e", "score": "0.5281852", "text": "func ListBackends() {\n\tfor _, f := range frontends {\n\t\tfor _, b := range f.Backends {\n\t\t\tbackends.append(b)\n\t\t}\n\t}\n\tfmt.Println(backends.list())\n\tfmt.Printf(\"%d backends\\n\", len(backends))\n}", "title": "" }, { "docid": "b8a4e15e7eb91cffd933af1f9687f366", "score": "0.52787435", "text": "func (a *LbrpApiService) UpdateLbrpServiceBackendListByID(ctx context.Context, name string, vip string, vport int32, proto string, backend []ServiceBackend) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Patch\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/lbrp/{name}/service/{vip}/{vport}/{proto}/backend/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", fmt.Sprintf(\"%v\", name), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"vip\"+\"}\", fmt.Sprintf(\"%v\", vip), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"vport\"+\"}\", fmt.Sprintf(\"%v\", vport), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"proto\"+\"}\", fmt.Sprintf(\"%v\", proto), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = &backend\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "title": "" }, { "docid": "b8be912d84c56e54d099147756df4553", "score": "0.52614015", "text": "func (a *App) UpdateBalances(broadcast bool) error {\n\t// Fetch current balances from bittrex.\n\tbalances, err := a.client.GetBalances()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Pull relevant balances into our own format.\n\tbs := []*types.Balance{}\n\tfor _, b := range balances {\n\t\tava, _ := b.Available.Float64()\n\t\tbal, _ := b.Balance.Float64()\n\t\tif bal > 0.0 {\n\t\t\tbs = append(bs, &types.Balance{\n\t\t\t\tCurrency: strings.ToUpper(b.Currency),\n\t\t\t\tAvailable: ava,\n\t\t\t\tTotal: bal,\n\t\t\t})\n\t\t}\n\t}\n\n\t// Update the db.\n\terr = a.db.UpdateBalances(bs)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Update clients (if we need to broadcast).\n\tif broadcast {\n\t\treturn a.BroadcastBalances()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "deccd1ff8a7fe5d66889d103730b3c47", "score": "0.525147", "text": "func sortBackends(backends *[]compute.Backend) {\n\tsort.SliceStable(*backends, func(i, j int) bool {\n\t\treturn (*backends)[i].Group < (*backends)[j].Group\n\t})\n}", "title": "" }, { "docid": "8da9c8d572c29c092aecb638164f350c", "score": "0.52161855", "text": "func ClearBackends() error {\n\n\tfor name := range globalBackends {\n\t\tRemoveBackend(name)\n\t}\n\n\tresetBackends()\n\n\treturn nil\n}", "title": "" }, { "docid": "26c868c7061058541bf55118e701e95c", "score": "0.52013785", "text": "func (c *Client) UpdateIngressBackendStatus(obj *policyv1alpha1.IngressBackend) (*policyv1alpha1.IngressBackend, error) {\n\treturn c.policyClient.PolicyV1alpha1().IngressBackends(obj.Namespace).UpdateStatus(context.Background(), obj, metav1.UpdateOptions{})\n}", "title": "" }, { "docid": "9693b36f386b2d008f0b2619ade71f52", "score": "0.5166845", "text": "func (client NetworkLoadBalancerClient) updateBackend(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) {\n\n\thttpRequest, err := request.HTTPRequest(http.MethodPut, \"/networkLoadBalancers/{networkLoadBalancerId}/backendSets/{backendSetName}/backends/{backendName}\", binaryReqBody, extraHeaders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response UpdateBackendResponse\n\tvar httpResponse *http.Response\n\thttpResponse, err = client.Call(ctx, &httpRequest)\n\tdefer common.CloseBodyIfValid(httpResponse)\n\tresponse.RawResponse = httpResponse\n\tif err != nil {\n\t\tapiReferenceLink := \"https://docs.oracle.com/iaas/api/#/en/networkloadbalancer/20200501/Backend/UpdateBackend\"\n\t\terr = common.PostProcessServiceError(err, \"NetworkLoadBalancer\", \"UpdateBackend\", apiReferenceLink)\n\t\treturn response, err\n\t}\n\n\terr = common.UnmarshalResponse(httpResponse, &response)\n\treturn response, err\n}", "title": "" }, { "docid": "a645b4edcbaf6e95b055eb5af00d0075", "score": "0.51590574", "text": "func (o *OrService) UpdatePools(hpools []*v1.Pool, tpools []*v1.Pool) error {\n\tvar lock sync.Mutex\n\tlock.Lock()\n\tdefer lock.Unlock()\n\tlogrus.Debugf(\"start update pools(tcp pools count %d, http pool count %d)\", len(tpools), len(hpools))\n\tif len(tpools) > 0 {\n\t\terr := o.persistUpstreams(tpools)\n\t\tif err != nil {\n\t\t\tlogrus.Warningf(\"error updating upstream.default.tcp.conf\")\n\t\t}\n\t}\n\tif hpools == nil || len(hpools) == 0 {\n\t\treturn nil\n\t}\n\tvar backends []*model.Backend\n\tfor _, pool := range hpools {\n\t\tbackends = append(backends, model.CreateBackendByPool(pool))\n\t}\n\treturn o.updateBackends(backends)\n}", "title": "" }, { "docid": "b0511a6f7c0c36fca7faaf09e47686dc", "score": "0.51496744", "text": "func (client NetworkLoadBalancerClient) updateBackendSet(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) {\n\n\thttpRequest, err := request.HTTPRequest(http.MethodPut, \"/networkLoadBalancers/{networkLoadBalancerId}/backendSets/{backendSetName}\", binaryReqBody, extraHeaders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response UpdateBackendSetResponse\n\tvar httpResponse *http.Response\n\thttpResponse, err = client.Call(ctx, &httpRequest)\n\tdefer common.CloseBodyIfValid(httpResponse)\n\tresponse.RawResponse = httpResponse\n\tif err != nil {\n\t\tapiReferenceLink := \"https://docs.oracle.com/iaas/api/#/en/networkloadbalancer/20200501/BackendSet/UpdateBackendSet\"\n\t\terr = common.PostProcessServiceError(err, \"NetworkLoadBalancer\", \"UpdateBackendSet\", apiReferenceLink)\n\t\treturn response, err\n\t}\n\n\terr = common.UnmarshalResponse(httpResponse, &response)\n\treturn response, err\n}", "title": "" }, { "docid": "071b72fde42ecd87238ca6015b49e13b", "score": "0.5148235", "text": "func (a *ServerMetrics) SetBackendCount(count int) {\n\ta.backend.WithLabelValues().Set(float64(count))\n}", "title": "" }, { "docid": "f9eca27610eff8b83c3bc18b7c5c043d", "score": "0.51452494", "text": "func (v *VirtualNode) Backends() []appmeshv1beta1.Backend {\n\tif v.Data.Spec.Backends == nil {\n\t\treturn []appmeshv1beta1.Backend{}\n\t}\n\n\tvar backends = []appmeshv1beta1.Backend{}\n\tfor _, b := range v.Data.Spec.Backends {\n\t\tbackends = append(backends, appmeshv1beta1.Backend{\n\t\t\tVirtualService: appmeshv1beta1.VirtualServiceBackend{\n\t\t\t\tVirtualServiceName: aws.StringValue(b.VirtualService.VirtualServiceName),\n\t\t\t},\n\t\t})\n\t}\n\treturn backends\n}", "title": "" }, { "docid": "fd521c407e1da0837dc0d33887d42d73", "score": "0.50768185", "text": "func (l4 *L4) Backends() ([]instance.ID, error) {\n\treturn l4.DoBackends()\n}", "title": "" }, { "docid": "e2486d93412a5c5e7457474cbafd9852", "score": "0.5060714", "text": "func (a *Actuator) UpdateLoadBalancers(client awsclient.Client, providerConfig *providerconfigv1.AWSMachineProviderConfig, instance *ec2.Instance) error {\n\tif len(providerConfig.LoadBalancers) == 0 {\n\t\tglog.V(4).Infof(\"Instance %q has no load balancers configured. Skipping\", *instance.InstanceId)\n\t\treturn nil\n\t}\n\terrs := []error{}\n\tclassicLoadBalancerNames := []string{}\n\tnetworkLoadBalancerNames := []string{}\n\tfor _, loadBalancerRef := range providerConfig.LoadBalancers {\n\t\tswitch loadBalancerRef.Type {\n\t\tcase providerconfigv1.NetworkLoadBalancerType:\n\t\t\tnetworkLoadBalancerNames = append(networkLoadBalancerNames, loadBalancerRef.Name)\n\t\tcase providerconfigv1.ClassicLoadBalancerType:\n\t\t\tclassicLoadBalancerNames = append(classicLoadBalancerNames, loadBalancerRef.Name)\n\t\t}\n\t}\n\n\tvar err error\n\tif len(classicLoadBalancerNames) > 0 {\n\t\terr := a.registerWithClassicLoadBalancers(client, classicLoadBalancerNames, instance)\n\t\tif err != nil {\n\t\t\tglog.Errorf(\"failed to register classic load balancers: %v\", err)\n\t\t\terrs = append(errs, err)\n\t\t}\n\t}\n\tif len(networkLoadBalancerNames) > 0 {\n\t\terr = a.registerWithNetworkLoadBalancers(client, networkLoadBalancerNames, instance)\n\t\tif err != nil {\n\t\t\tglog.Errorf(\"failed to register network load balancers: %v\", err)\n\t\t\terrs = append(errs, err)\n\t\t}\n\t}\n\tif len(errs) > 0 {\n\t\treturn errorutil.NewAggregate(errs)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6edb5e04e76ca6181d85030d50fd2cde", "score": "0.50562614", "text": "func (l4 *L4) RegisterBackends(ids []instance.ID) (loadbalancer.Result, error) {\n\treturn l4.DoRegisterBackends(ids)\n}", "title": "" }, { "docid": "e07c28c0ae473b859e89692a462cef40", "score": "0.50377667", "text": "func (b *Backend) Refresh() error {\n\tentries := []*serverStateInfo{}\n\tconverter := NewCSVConverter(serversStateHeader, &entries, stripVersionNumber)\n\tcmd := fmt.Sprintf(\"%s %s\", GetServersStateCommand, b.Name())\n\t_, err := b.client.RunCommand(cmd, converter)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tb.servers = make(map[string]*backendServer)\n\tfor _, v := range entries {\n\t\tinfo := BackendServerInfo{\n\t\t\tName: v.Name,\n\t\t\tIPAddress: v.IPAddress,\n\t\t\tPort: v.Port,\n\t\t\tFQDN: v.FQDN,\n\t\t\tCurrentWeight: v.UserVisibleWeight,\n\t\t\tInitialWeight: v.InitialWeight,\n\t\t\tState: getManagedServerState(v),\n\t\t}\n\n\t\tb.servers[v.Name] = newBackendServer(info)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "dfb7c0f78d13de5a3dbcd1d783e4f7fd", "score": "0.5034642", "text": "func (ds *StateMachineWrapper) BatchedUpdate(ents []sm.Entry) ([]sm.Entry, error) {\n\tpanic(\"not supported\")\n}", "title": "" }, { "docid": "803cce7ba20f3e3d40c84af98ec559cb", "score": "0.5028169", "text": "func filterServiceBackends(svc *svcInfo, onlyPorts []string) map[string][]*lb.Backend {\n\tif len(onlyPorts) == 0 {\n\t\treturn map[string][]*lb.Backend{\n\t\t\tanyPort: filterPreferredBackends(svc.backends),\n\t\t}\n\t}\n\n\tres := map[string][]*lb.Backend{}\n\tfor _, port := range onlyPorts {\n\t\t// check for port number\n\t\tif port == strconv.Itoa(int(svc.frontend.Port)) {\n\t\t\treturn map[string][]*lb.Backend{\n\t\t\t\tport: filterPreferredBackends(svc.backends),\n\t\t\t}\n\t\t}\n\t\t// check for either named port\n\t\tfor _, backend := range filterPreferredBackends(svc.backends) {\n\t\t\tif port == backend.FEPortName {\n\t\t\t\tres[port] = append(res[port], backend)\n\t\t\t}\n\t\t}\n\t}\n\treturn res\n}", "title": "" }, { "docid": "351e1f59986ec3917588fa29b28f6384", "score": "0.50167423", "text": "func (client NetworkLoadBalancerClient) listBackends(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) {\n\n\thttpRequest, err := request.HTTPRequest(http.MethodGet, \"/networkLoadBalancers/{networkLoadBalancerId}/backendSets/{backendSetName}/backends\", binaryReqBody, extraHeaders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response ListBackendsResponse\n\tvar httpResponse *http.Response\n\thttpResponse, err = client.Call(ctx, &httpRequest)\n\tdefer common.CloseBodyIfValid(httpResponse)\n\tresponse.RawResponse = httpResponse\n\tif err != nil {\n\t\tapiReferenceLink := \"https://docs.oracle.com/iaas/api/#/en/networkloadbalancer/20200501/BackendSummary/ListBackends\"\n\t\terr = common.PostProcessServiceError(err, \"NetworkLoadBalancer\", \"ListBackends\", apiReferenceLink)\n\t\treturn response, err\n\t}\n\n\terr = common.UnmarshalResponse(httpResponse, &response)\n\treturn response, err\n}", "title": "" }, { "docid": "9d27c8537a2d76c4c39021fd207e77a1", "score": "0.5014452", "text": "func (client NetworkLoadBalancerClient) UpdateBackend(ctx context.Context, request UpdateBackendRequest) (response UpdateBackendResponse, err error) {\n\tvar ociResponse common.OCIResponse\n\tpolicy := common.NoRetryPolicy()\n\tif client.RetryPolicy() != nil {\n\t\tpolicy = *client.RetryPolicy()\n\t}\n\tif request.RetryPolicy() != nil {\n\t\tpolicy = *request.RetryPolicy()\n\t}\n\n\tif !(request.OpcRetryToken != nil && *request.OpcRetryToken != \"\") {\n\t\trequest.OpcRetryToken = common.String(common.RetryToken())\n\t}\n\n\tociResponse, err = common.Retry(ctx, request, client.updateBackend, policy)\n\tif err != nil {\n\t\tif ociResponse != nil {\n\t\t\tif httpResponse := ociResponse.HTTPResponse(); httpResponse != nil {\n\t\t\t\topcRequestId := httpResponse.Header.Get(\"opc-request-id\")\n\t\t\t\tresponse = UpdateBackendResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId}\n\t\t\t} else {\n\t\t\t\tresponse = UpdateBackendResponse{}\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\tif convertedResponse, ok := ociResponse.(UpdateBackendResponse); ok {\n\t\tresponse = convertedResponse\n\t} else {\n\t\terr = fmt.Errorf(\"failed to convert OCIResponse into UpdateBackendResponse\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "0ebc21741e02b4058590e279b1f3b2b8", "score": "0.50053436", "text": "func (tg *TargetGroup) GetUpdateBackend(cur *TargetGroup) (updates BackendList) {\n\ttmpMapAdd := make(map[string]*Backend)\n\tfor _, tgBack := range tg.Backends {\n\t\ttmpMapAdd[tgBack.IP+strconv.Itoa(int(tgBack.Port))] = tgBack\n\t}\n\tfor _, curBack := range cur.Backends {\n\t\tbackendOld, ok := tmpMapAdd[curBack.IP+strconv.Itoa(int(curBack.Port))]\n\t\tif ok && !backendOld.IsEqual(curBack) {\n\t\t\tupdates = append(updates, curBack)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "5b62fa9bb15055e4e1401c8e392163e4", "score": "0.4996295", "text": "func (rt *Router) loadBackends(c *mgo.Collection) (backends map[string]http.Handler) {\n\tbackend := &Backend{}\n\tbackends = make(map[string]http.Handler)\n\n\titer := c.Find(nil).Iter()\n\n\tfor iter.Next(&backend) {\n\t\tbackendURL, err := backend.ParseURL()\n\t\tif err != nil {\n\t\t\tlogWarn(fmt.Errorf(\"router: couldn't parse URL %s for backend %s \"+\n\t\t\t\t\"(error: %w), skipping\", backend.BackendURL, backend.BackendID, err))\n\t\t\tcontinue\n\t\t}\n\n\t\tbackends[backend.BackendID] = handlers.NewBackendHandler(\n\t\t\tbackend.BackendID,\n\t\t\tbackendURL,\n\t\t\trt.opts.BackendConnTimeout,\n\t\t\trt.opts.BackendHeaderTimeout,\n\t\t\trt.logger,\n\t\t)\n\t}\n\n\tif err := iter.Err(); err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "3353596ab77efd6bc82ec2863de6c62e", "score": "0.499612", "text": "func (l *loadbalancers) UpdateLoadBalancer(ctx context.Context, clusterName string, service *v1.Service, nodes []*v1.Node) error {\n\tserviceName := fmt.Sprintf(\"%s/%s\", service.Namespace, service.Name)\n\tklog.V(4).Infof(\"UpdateLoadBalancer(%v, %s, %v)\", clusterName, serviceName, nodes)\n\n\tports := service.Spec.Ports\n\tif len(ports) == 0 {\n\t\treturn fmt.Errorf(\"no ports provided to bizflycloud load balancer\")\n\t}\n\n\tname := l.GetLoadBalancerName(ctx, clusterName, service)\n\tlb, err := getLBByName(ctx, l.gclient, name)\n\n\tif err != nil {\n\t\tif errors.Is(err, ErrNotFound) {\n\t\t\tklog.Errorf(\"loadbalancer does not exist for Service %w\", serviceName)\n\t\t\treturn fmt.Errorf(\"loadbalancer does not exist for Service %w\", serviceName)\n\t\t}\n\t\treturn err\n\t}\n\n\ttype portKey struct {\n\t\tProtocol string\n\t\tPort int\n\t}\n\tvar listenerIDs []string\n\tlbListeners := make(map[portKey]*gobizfly.Listener)\n\tlisteners, err := getListenersByLoadBalancerID(ctx, l.gclient, lb.ID)\n\tif err != nil {\n\t\tklog.Errorf(\"error getting listeners for LB %w: %v\", lb.ID, err)\n\t\treturn fmt.Errorf(\"error getting listeners for LB %w: %v\", lb.ID, err)\n\t}\n\n\tfor _, l := range listeners {\n\t\tkey := portKey{Protocol: string(l.Protocol), Port: int(l.ProtocolPort)}\n\t\tlbListeners[key] = l\n\t\tlistenerIDs = append(listenerIDs, l.ID)\n\t}\n\n\t// Get all pools for this loadbalancer, by listener ID.\n\tlbPools := make(map[string]*gobizfly.Pool)\n\tfor _, listenerID := range listenerIDs {\n\t\tpool, err := getPoolByListenerID(ctx, l.gclient, lb.ID, listenerID)\n\t\tif err != nil {\n\t\t\tklog.Errorf(\"error getting pool for listener %w: %v\", listenerID, err)\n\t\t\treturn fmt.Errorf(\"error getting pool for listener %w: %v\", listenerID, err)\n\t\t}\n\t\tlbPools[listenerID] = pool\n\t}\n\n\taddrs := make(map[string]*v1.Node)\n\tfor _, node := range nodes {\n\t\taddr, err := nodeAddressForLB(node)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\taddrs[addr] = node\n\t}\n\n\t// Check for adding/removing members associated with each port\n\tfor portIndex, port := range ports {\n\t\t// Get listener associated with this port\n\t\tlistener, ok := lbListeners[portKey{\n\t\t\tProtocol: string(port.Protocol),\n\t\t\tPort: int(port.Port),\n\t\t}]\n\t\tif !ok {\n\t\t\tklog.Errorf(\"loadbalancer %w does not contain required listener for port %d and protocol %w\", lb.ID, port.Port, port.Protocol)\n\t\t\treturn fmt.Errorf(\"loadbalancer %w does not contain required listener for port %d and protocol %w\", lb.ID, port.Port, port.Protocol)\n\t\t}\n\n\t\t// Get pool associated with this listener\n\t\tpool, ok := lbPools[listener.ID]\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"loadbalancer %w does not contain required pool for listener %w\", lb.ID, listener.ID)\n\t\t}\n\n\t\t// Find existing pool members (by address) for this port\n\t\tgetMembers, err := getMembersByPoolID(ctx, l.gclient, pool.ID)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error getting pool members %w: %v\", pool.ID, err)\n\t\t}\n\t\tmembers := make(map[string]*gobizfly.Member)\n\t\tfor _, member := range getMembers {\n\t\t\tmembers[member.Address] = member\n\t\t}\n\n\t\t// Add any new members for this port\n\t\tfor addr, node := range addrs {\n\t\t\tif _, ok := members[addr]; ok && members[addr].ProtocolPort == int(port.NodePort) {\n\t\t\t\t// Already exists, do not create member\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t_, err := l.gclient.Member.Create(ctx, pool.ID, &gobizfly.MemberCreateRequest{\n\t\t\t\tName: cutString(fmt.Sprintf(\"member_%d_%s_%s_\", portIndex, node.Name, lb.Name)),\n\t\t\t\tAddress: addr,\n\t\t\t\tProtocolPort: int(port.NodePort),\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tprovisioningStatus, err := waitLoadbalancerActiveProvisioningStatus(ctx, l.gclient, lb.ID)\n\t\t\tif err != nil {\n\t\t\t\tklog.Errorf(\"timeout when waiting for loadbalancer to be ACTIVE after creating member, current provisioning status %w\", provisioningStatus)\n\t\t\t\treturn fmt.Errorf(\"timeout when waiting for loadbalancer to be ACTIVE after creating member, current provisioning status %w\", provisioningStatus)\n\t\t\t}\n\t\t}\n\n\t\t// Remove any old members for this port\n\t\tfor _, member := range members {\n\t\t\tif _, ok := addrs[member.Address]; ok && member.ProtocolPort == int(port.NodePort) {\n\t\t\t\t// Still present, do not delete member\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\terr = l.gclient.Member.Delete(ctx, pool.ID, member.ID)\n\t\t\tif err != nil && !cpoerrors.IsNotFound(err) {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tprovisioningStatus, err := waitLoadbalancerActiveProvisioningStatus(ctx, l.gclient, lb.ID)\n\t\t\tif err != nil {\n\t\t\t\tklog.Errorf(\"timeout when waiting for loadbalancer to be ACTIVE after deleting member, current provisioning status %w\", provisioningStatus)\n\t\t\t\treturn fmt.Errorf(\"timeout when waiting for loadbalancer to be ACTIVE after deleting member, current provisioning status %w\", provisioningStatus)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "eebef6045cdda9285ba6b1398803e5ab", "score": "0.49927932", "text": "func (b *Backend) Commit() error {\n\tfor _, s := range b.servers {\n\t\tif err := s.ApplyChanges(b.name, b.client); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tb.Reset()\n\treturn nil\n}", "title": "" }, { "docid": "9694ba873fcd169382e206cf4ab3a9e4", "score": "0.49883103", "text": "func (c *Controller) UpdateIngressLoadBalancers(ingresses []extensions.Ingress, IPs ...string) error {\n\tloadBalancers := make([]v1.LoadBalancerIngress, 0, len(IPs))\n\n\tfor _, ip := range IPs {\n\t\tloadBalancers = append(loadBalancers, v1.LoadBalancerIngress{IP: ip})\n\t}\n\n\tfor _, ingress := range ingresses {\n\t\tingress.Status.LoadBalancer.Ingress = loadBalancers\n\n\t\tif _, err := c.Client.Extensions().Ingresses(ingress.Namespace).UpdateStatus(&ingress); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "52ab6d0ea8ae41e0c4dd0bb829eb55b0", "score": "0.4986456", "text": "func (s *System) PluginsReloadBackends(ctx context.Context, request schema.PluginsReloadBackendsRequest, options ...RequestOption) (*Response[schema.PluginsReloadBackendsResponse], error) {\n\trequestModifiers, err := requestOptionsToRequestModifiers(options)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trequestPath := \"/v1/sys/plugins/reload/backend\"\n\n\trequestQueryParameters := requestModifiers.customQueryParametersOrDefault()\n\n\treturn sendStructuredRequestParseResponse[schema.PluginsReloadBackendsResponse](\n\t\tctx,\n\t\ts.client,\n\t\thttp.MethodPost,\n\t\trequestPath,\n\t\trequest,\n\t\trequestQueryParameters,\n\t\trequestModifiers,\n\t)\n}", "title": "" }, { "docid": "084d7b23099a0a59a63bd9185363cc6d", "score": "0.49814847", "text": "func (rndr *Renderer) UpdateLocalBackendIfs(oldIfNames, newIfNames renderer.Interfaces) error {\n\tif rndr.snatOnly {\n\t\treturn nil\n\t}\n\trndr.Log.WithFields(logging.Fields{\n\t\t\"oldIfNames\": oldIfNames,\n\t\t\"newIfNames\": newIfNames,\n\t}).Debug(\"Nat44Renderer - UpdateLocalBackendIfs()\")\n\n\t// Re-build the list of interfaces with enabled NAT features.\n\trndr.natGlobalCfg = proto.Clone(rndr.natGlobalCfg).(*nat.Nat44Global)\n\t// - keep non-backends unchanged\n\tnewNatIfs := []*nat.Nat44Global_NatInterface{}\n\tfor _, natIf := range rndr.natGlobalCfg.NatInterfaces {\n\t\tif !natIf.IsInside || natIf.OutputFeature {\n\t\t\tnewNatIfs = append(newNatIfs, natIf)\n\t\t}\n\t}\n\t// - re-create the list of backends\n\tfor backendIf := range newIfNames {\n\t\tnewNatIfs = append(newNatIfs,\n\t\t\t&nat.Nat44Global_NatInterface{\n\t\t\t\tName: backendIf,\n\t\t\t\tIsInside: true,\n\t\t\t\tOutputFeature: false,\n\t\t\t})\n\t}\n\t// - re-write the cached list\n\trndr.natGlobalCfg.NatInterfaces = newNatIfs\n\n\t// Update global NAT config via ligato/vpp-agent.\n\tdsl := rndr.NATTxnFactory()\n\tputDsl := dsl.Put()\n\tputDsl.NAT44Global(rndr.natGlobalCfg)\n\n\treturn dsl.Send().ReceiveReply()\n}", "title": "" }, { "docid": "7e566d11088f1291894b79e69f5a6f3e", "score": "0.4970483", "text": "func buildHAProxyBackends(c *Client) ([]*Backend, error) {\n\tentries := []*backendEntry{}\n\tconverter := NewCSVConverter(showBackendHeader, &entries, nil)\n\t_, err := c.RunCommand(ListBackendsCommand, converter)\n\tif err != nil {\n\t\treturn []*Backend{}, err\n\t}\n\n\tbackends := make([]*Backend, len(entries))\n\tfor k, v := range entries {\n\t\tbackends[k] = newBackend(templaterouter.ServiceAliasConfigKey(v.Name), c)\n\t}\n\n\treturn backends, nil\n}", "title": "" }, { "docid": "933f5f216541da8d8f618c24164a6704", "score": "0.4963355", "text": "func (m *MockBetaBackendServices) Update(ctx context.Context, key *meta.Key, arg0 *beta.BackendService) error {\n\tif m.UpdateHook != nil {\n\t\treturn m.UpdateHook(ctx, key, arg0, m)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9e04360f8c83aa3d6fd921838af9d1ee", "score": "0.49492496", "text": "func (s *Server) AddBackend(b *Backend) {\n\ts.Backends = append(s.Backends, b)\n}", "title": "" }, { "docid": "d42c974948031148a43931efeab7fc7f", "score": "0.4946612", "text": "func DumpBackendMapsToUserspace() (map[BackendAddrID]*loadbalancer.LBBackEnd, error) {\n\tmutex.RLock()\n\tdefer mutex.RUnlock()\n\n\tbackendValueMap := map[loadbalancer.BackendID]BackendValue{}\n\tlbBackends := map[BackendAddrID]*loadbalancer.LBBackEnd{}\n\n\tparseBackendEntries := func(key bpf.MapKey, value bpf.MapValue) {\n\t\t// No need to deep copy the key because we are using the ID which\n\t\t// is a value.\n\t\tbackendKey := key.(BackendKey)\n\t\tbackendValue := value.DeepCopyMapValue().(BackendValue)\n\t\tbackendValueMap[backendKey.GetID()] = backendValue\n\t}\n\n\tif option.Config.EnableIPv4 {\n\t\terr := Backend4Map.DumpWithCallback(parseBackendEntries)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"Unable to dump lb4 backends map: %s\", err)\n\t\t}\n\t}\n\n\tif option.Config.EnableIPv6 {\n\t\terr := Backend6Map.DumpWithCallback(parseBackendEntries)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"Unable to dump lb6 backends map: %s\", err)\n\t\t}\n\t}\n\n\tfor backendID, backendVal := range backendValueMap {\n\t\tip := backendVal.GetAddress()\n\t\tport := backendVal.GetPort()\n\t\tweight := uint16(0) // FIXME(brb): set weight when we support it\n\t\tproto := loadbalancer.NONE\n\t\tlbBackend := loadbalancer.NewLBBackEnd(backendID, proto, ip, port, weight)\n\t\tlbBackends[backendVal.BackendAddrID()] = lbBackend\n\t}\n\n\treturn lbBackends, nil\n}", "title": "" }, { "docid": "e23bc62ae1f99bb1536e2f2f12173e47", "score": "0.4930604", "text": "func (app *App) UpdateState(updaters ...func(state metast.State) (metast.State, error)) error {\n\treturn app.updateStateInner(false, updaters...)\n}", "title": "" }, { "docid": "2421fae3bf116b5cda408ce616e99153", "score": "0.4886665", "text": "func (server *Server) SyncLoadBalancers(e *Executor, addDynos []Dyno, removeDynos []Dyno) error {\n\tsyncLoadBalancerLock.Lock()\n\tdefer syncLoadBalancerLock.Unlock()\n\n\tcfg, err := server.getConfig(true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlogServerIpAndPort, err := server.ResolveLogServerIpAndPort()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlbSpec := &LBSpec{\n\t\tLogServerIpAndPort: logServerIpAndPort,\n\t\tApplications: []*LBApp{},\n\t\tLoadBalancers: cfg.LoadBalancers,\n\t\tHaProxyStatsEnabled: isTruthy(DefaultHAProxyStats),\n\t\tHaProxyCredentials: HaProxyCredentials(),\n\t}\n\n\tfor _, app := range cfg.Applications {\n\t\ta := &LBApp{\n\t\t\tName: app.Name,\n\t\t\tDomains: app.Domains,\n\t\t\tFirstDomain: app.FirstDomain(),\n\t\t\tServers: []*LBAppDyno{},\n\t\t\tMaintenance: app.Maintenance,\n\t\t\tMaintenancePageFullPath: app.MaintenancePageFullPath(),\n\t\t\tMaintenancePageBasePath: app.MaintenancePageBasePath(),\n\t\t\tMaintenancePageDomain: app.MaintenancePageDomain(),\n\t\t\tSSL: !isTruthy(app.Environment[\"SB_DISABLE_SSL\"]),\n\t\t\tSSLForwarding: !isTruthy(app.Environment[\"SB_DISABLE_SSL_FORWARDING\"]),\n\t\t}\n\t\tfor proc, _ := range app.Processes {\n\t\t\tif proc == \"web\" {\n\t\t\t\t// Find and don't add `removeDynos`.\n\t\t\t\trunningDynos, err := server.GetRunningDynos(app.Name, proc)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tfor _, dyno := range runningDynos {\n\t\t\t\t\tfound := false\n\t\t\t\t\tfor _, remove := range removeDynos {\n\t\t\t\t\t\tif remove == dyno {\n\t\t\t\t\t\t\tfound = true\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\tif found {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tport, err := strconv.Atoi(dyno.Port)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\ta.Servers = append(a.Servers, &LBAppDyno{\n\t\t\t\t\t\tHost: dyno.Host,\n\t\t\t\t\t\tPort: port,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t\t// Add `addDynos` if type is \"web\" and it matches the current application and process.\n\t\t\t\tfor _, addDyno := range addDynos {\n\t\t\t\t\tif addDyno.Application == app.Name && addDyno.Process == proc {\n\t\t\t\t\t\tport, err := strconv.Atoi(addDyno.Port)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\treturn err\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcandidateServer := &LBAppDyno{\n\t\t\t\t\t\t\tHost: addDyno.Host,\n\t\t\t\t\t\t\tPort: port,\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Check if the server has already been added.\n\t\t\t\t\t\talreadyAdded := false\n\t\t\t\t\t\tfor _, existingServer := range a.Servers {\n\t\t\t\t\t\t\tif existingServer == candidateServer {\n\t\t\t\t\t\t\t\talreadyAdded = true\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif !alreadyAdded {\n\t\t\t\t\t\t\ta.Servers = append(a.Servers, candidateServer)\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\tlbSpec.Applications = append(lbSpec.Applications, a)\n\t}\n\n\t// Save it to the load balancer\n\thapFileLoc := \"/tmp/haproxy.cfg\"\n\tf, err := os.OpenFile(hapFileLoc, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, os.FileMode(int(0666)))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer func() {\n\t\tif rmErr := os.Remove(hapFileLoc); rmErr != nil {\n\t\t\tlog.Warnf(\"Unexpected problem during cleanup removal of %q: %s\", hapFileLoc, rmErr)\n\t\t}\n\t}()\n\n\terr = HAPROXY_CONFIG.Execute(f, lbSpec)\n\n\tif closeErr := f.Close(); closeErr != nil {\n\t\tlog.Warnf(\"Unexpected problem closing %q: %s\", hapFileLoc, closeErr)\n\t}\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttype LBSyncResult struct {\n\t\tlbHost string\n\t\terr error\n\t}\n\n\tsyncChannel := make(chan LBSyncResult)\n\tfor _, host := range cfg.LoadBalancers {\n\t\tgo func(host string) {\n\t\t\tc := make(chan error, 1)\n\t\t\tgo func() {\n\t\t\t\terr := e.Run(\"rsync\",\n\t\t\t\t\t\"-azve\", \"ssh \"+DEFAULT_SSH_PARAMETERS,\n\t\t\t\t\t\"/tmp/haproxy.cfg\", \"root@\"+host+\":/etc/haproxy/\",\n\t\t\t\t)\n\t\t\t\tif err != nil {\n\t\t\t\t\tc <- err\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tif err = e.Run(\"ssh\", DEFAULT_NODE_USERNAME+\"@\"+host, bashHAProxyReloadCommand); err != nil {\n\t\t\t\t\tc <- err\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tc <- nil\n\t\t\t}()\n\t\t\tgo func() {\n\t\t\t\ttime.Sleep(LOAD_BALANCER_SYNC_TIMEOUT_SECONDS * time.Second)\n\t\t\t\tc <- fmt.Errorf(\"LB sync operation to %q timed out after %v seconds\", host, LOAD_BALANCER_SYNC_TIMEOUT_SECONDS)\n\t\t\t}()\n\t\t\t// Block until chan has something, at which point syncChannel will be notified.\n\t\t\tsyncChannel <- LBSyncResult{host, <-c}\n\t\t}(host)\n\t}\n\n\tnLoadBalancers := len(cfg.LoadBalancers)\n\terrors := []error{}\n\tfor i := 1; i <= nLoadBalancers; i++ {\n\t\tsyncResult := <-syncChannel\n\t\tif syncResult.err != nil {\n\t\t\terrors = append(errors, syncResult.err)\n\t\t}\n\t\tfmt.Fprintf(e.Logger, \"%v/%v load-balancer sync finished (%v succeeded, %v failed, %v outstanding)\\n\", i, nLoadBalancers, i-len(errors), len(errors), nLoadBalancers-i)\n\t}\n\n\t// If all LB updates failed, abort with error.\n\tif nLoadBalancers > 0 && len(errors) == nLoadBalancers {\n\t\terr = fmt.Errorf(\"error: all load-balancer updates failed: %v\", errors)\n\t\tfmt.Fprintf(e.Logger, \"%s\\n\", err)\n\t\treturn err\n\t}\n\n\t// Uddate `currentLoadBalancerConfig` with updated HAProxy configuration.\n\tcfgBuffer := bytes.Buffer{}\n\tif err = HAPROXY_CONFIG.Execute(&cfgBuffer, lbSpec); err != nil {\n\t\treturn err\n\t}\n\tserver.currentLoadBalancerConfig = cfgBuffer.String()\n\n\treturn nil\n}", "title": "" }, { "docid": "73d8226f27937bdaf0de1268ff825c01", "score": "0.4874505", "text": "func (in *BackendList) DeepCopy() *BackendList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BackendList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "c0e47f2ea88a0499d1f196c4fea71eb3", "score": "0.48651257", "text": "func (m *Manager) Update(services []*corev1.Service) error {\n\tvar want []targetService\n\t//Get wanted list\n\tfor _, s := range services {\n\t\tfor _, sp := range s.Spec.Ports {\n\t\t\tif sp.NodePort != 0 {\n\t\t\t\twant = append(want, targetService{\n\t\t\t\t\tclusterIP: s.Spec.ClusterIP,\n\t\t\t\t\tnodePort: sp.NodePort,\n\t\t\t\t\tname: fmt.Sprintf(\"%s-%s-%d\", s.Namespace, s.Name, sp.NodePort),\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\tif len(want) == 0 {\n\t\twant = append(want, keepaliveTargetService)\n\t}\n\n\tif err := m.updateLBService(want); err != nil {\n\t\treturn err\n\t}\n\tif err := m.updateEndpoints(want); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e03c318f98ef3e5211ff467da0d5d2ab", "score": "0.48447686", "text": "func (g *GCEBetaBackendServices) Update(ctx context.Context, key *meta.Key, arg0 *beta.BackendService) error {\n\tklog.V(5).Infof(\"GCEBetaBackendServices.Update(%v, %v, ...): called\", ctx, key)\n\n\tif !key.Valid() {\n\t\tklog.V(2).Infof(\"GCEBetaBackendServices.Update(%v, %v, ...): key is invalid (%#v)\", ctx, key, key)\n\t\treturn fmt.Errorf(\"invalid GCE key (%+v)\", key)\n\t}\n\tprojectID := g.s.ProjectRouter.ProjectID(ctx, \"beta\", \"BackendServices\")\n\trk := &RateLimitKey{\n\t\tProjectID: projectID,\n\t\tOperation: \"Update\",\n\t\tVersion: meta.Version(\"beta\"),\n\t\tService: \"BackendServices\",\n\t}\n\tklog.V(5).Infof(\"GCEBetaBackendServices.Update(%v, %v, ...): projectID = %v, rk = %+v\", ctx, key, projectID, rk)\n\n\tif err := g.s.RateLimiter.Accept(ctx, rk); err != nil {\n\t\tklog.V(4).Infof(\"GCEBetaBackendServices.Update(%v, %v, ...): RateLimiter error: %v\", ctx, key, err)\n\t\treturn err\n\t}\n\tcall := g.s.Beta.BackendServices.Update(projectID, key.Name, arg0)\n\tcall.Context(ctx)\n\top, err := call.Do()\n\tif err != nil {\n\t\tklog.V(4).Infof(\"GCEBetaBackendServices.Update(%v, %v, ...) = %+v\", ctx, key, err)\n\t\treturn err\n\t}\n\terr = g.s.WaitForCompletion(ctx, op)\n\tklog.V(4).Infof(\"GCEBetaBackendServices.Update(%v, %v, ...) = %+v\", ctx, key, err)\n\treturn err\n}", "title": "" }, { "docid": "6d507387c116fea33174693e05114e12", "score": "0.48435247", "text": "func UpdateValidatorsDelegations(\n\theight int64, validators []stakingtypes.Validator, client stakingtypes.QueryClient, db *database.Db,\n) {\n\tlog.Debug().Str(\"module\", \"staking\").Int64(\"height\", height).\n\t\tMsg(\"updating validators delegations\")\n\n\tvar wg sync.WaitGroup\n\tfor _, val := range validators {\n\t\twg.Add(1)\n\t\tgo getDelegationsFromGrpc(val.OperatorAddress, height, client, db, &wg)\n\t}\n\twg.Wait()\n}", "title": "" }, { "docid": "5118759d17ef0348dc76f5f4440ed1e7", "score": "0.4842519", "text": "func UpdateBackendServiceHook(ctx context.Context, key *meta.Key, obj *ga.BackendService, m *cloud.MockBackendServices) error {\n\t_, err := m.Get(ctx, key)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tobj.Name = key.Name\n\tprojectID := m.ProjectRouter.ProjectID(ctx, \"ga\", \"backendServices\")\n\tobj.SelfLink = cloud.SelfLink(meta.VersionGA, projectID, \"backendServices\", key)\n\n\tm.Objects[*key] = &cloud.MockBackendServicesObj{Obj: obj}\n\treturn nil\n}", "title": "" }, { "docid": "bf1d48d6ac007a9202549b2e54aed68e", "score": "0.48349005", "text": "func (c *Cluster) Backends() []*Backend {\n\treturn c.backends\n}", "title": "" }, { "docid": "7c5be8d32d8de17068dafc91552b51a4", "score": "0.48221263", "text": "func RegisterBackends() {\n\tservices.RegisterLegacyMarshaler(&commandline.LegacyUnmarshaler{})\n\tservices.RegisterBackend(&commandline.Loader{})\n\tservices.RegisterBackend(&docker.Loader{})\n}", "title": "" }, { "docid": "35ac245a660067178f3eb4abffc1dac1", "score": "0.48204565", "text": "func filterPreferredBackends(backends []*lb.Backend) []*lb.Backend {\n\tres := []*lb.Backend{}\n\tfor _, backend := range backends {\n\t\tif backend.Preferred == lb.Preferred(true) {\n\t\t\tres = append(res, backend)\n\t\t}\n\t}\n\tif len(res) > 0 {\n\t\treturn res\n\t}\n\treturn backends\n}", "title": "" }, { "docid": "5207e1a9491e8c0555015819e97d54e3", "score": "0.48088872", "text": "func (in *ComputeBackendServiceList) DeepCopy() *ComputeBackendServiceList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeBackendServiceList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "5207e1a9491e8c0555015819e97d54e3", "score": "0.48088872", "text": "func (in *ComputeBackendServiceList) DeepCopy() *ComputeBackendServiceList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ComputeBackendServiceList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "4f8100d72eb29cf417c4a3c26c9d2948", "score": "0.48021343", "text": "func convertClbBackends(backends []*tclb.Backend) *networkextensionv1.ListenerTargetGroup {\n\ttg := &networkextensionv1.ListenerTargetGroup{}\n\tfor _, backend := range backends {\n\t\tif len(backend.PrivateIpAddresses) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\ttg.Backends = append(tg.Backends, networkextensionv1.ListenerBackend{\n\t\t\tIP: *backend.PrivateIpAddresses[0],\n\t\t\tPort: int(*backend.Port),\n\t\t\tWeight: int(*backend.Weight),\n\t\t})\n\t}\n\treturn tg\n}", "title": "" }, { "docid": "973c05836c39a4037f22f44c0ee14dab", "score": "0.47954392", "text": "func UpdateBetaBackendServiceHook(ctx context.Context, key *meta.Key, obj *beta.BackendService, m *cloud.MockBetaBackendServices) error {\n\t_, err := m.Get(ctx, key)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tobj.Name = key.Name\n\tprojectID := m.ProjectRouter.ProjectID(ctx, \"beta\", \"backendServices\")\n\tobj.SelfLink = cloud.SelfLink(meta.VersionBeta, projectID, \"backendServices\", key)\n\n\tm.Objects[*key] = &cloud.MockBackendServicesObj{Obj: obj}\n\treturn nil\n}", "title": "" }, { "docid": "f1dc6738d0e78db2c207ac2c75e78512", "score": "0.47840613", "text": "func (m *MockAlphaBackendServices) Update(ctx context.Context, key *meta.Key, arg0 *alpha.BackendService) error {\n\tif m.UpdateHook != nil {\n\t\treturn m.UpdateHook(ctx, key, arg0, m)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "77c9a4488f8aac38b4bbb1bd3e9a5392", "score": "0.4784022", "text": "func (l4 *L4) DeregisterBackends(ids []instance.ID) (loadbalancer.Result, error) {\n\treturn l4.DoDeregisterBackends(ids)\n}", "title": "" }, { "docid": "504a40be71ce74228246b5a4dd508d57", "score": "0.475207", "text": "func ListBackendConfigs(kvs kvstore.KVStore) ([]*BackendConfig, error) {\n\tpairs, err := kvs.List(\"backends/\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar backends []*BackendConfig\n\tfor _, p := range pairs {\n\t\tbackends = append(backends, JSONToBackend(p.Value))\n\t}\n\n\treturn backends, nil\n}", "title": "" }, { "docid": "54837865633fb64b101ef33c13d846a5", "score": "0.4750795", "text": "func (k *CRDClientV1) DeleteBackends(ctx context.Context) error {\n\tLogc(ctx).Debug(\"DeleteBackends.\")\n\n\tbackendList, err := k.crdClient.TridentV1().TridentBackends(k.namespace).List(ctx, listOpts)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, backend := range backendList.Items {\n\t\t// Delete the backend resource\n\t\terr = k.crdClient.TridentV1().TridentBackends(k.namespace).Delete(ctx, backend.Name, k.deleteOpts())\n\t\tif err != nil {\n\t\t\tLogc(ctx).WithField(\"error\", err).Error(\"Could not delete backend.\")\n\t\t\treturn err\n\t\t}\n\t\tLogc(ctx).WithFields(LogFields{\n\t\t\t\"backend\": backend.BackendName,\n\t\t\t\"resource\": backend.Name,\n\t\t}).Debug(\"Deleted backend resource.\")\n\n\t\t// Delete the secret\n\t\tsecretName := k.backendSecretName(backend.BackendUUID)\n\t\terr = k.k8sClient.DeleteSecretDefault(secretName)\n\t\tif err != nil {\n\t\t\tLogc(ctx).WithField(\"error\", err).Error(\"Could not delete secret.\")\n\t\t\treturn err\n\t\t}\n\t\tLogc(ctx).WithField(\"secret\", secretName).Debug(\"Deleted backend secret.\")\n\t}\n\n\tLogc(ctx).Debug(\"Deleted all backend resources and secrets.\")\n\n\treturn nil\n}", "title": "" }, { "docid": "5fe236da11627d6f716970535c6ffa53", "score": "0.4743759", "text": "func (lb *LoadBalancer) Update(newInstances []string) {\n\tlb.Lock()\n\tdefer lb.Unlock()\n\tnewProxyInstances := make([]*ProxyInfo, 0)\n\tfor _, instance := range newInstances {\n\t\tnewProxyInstances = append(newProxyInstances, NewProxyInfo(instance))\n\t}\n\tlb.Instances = newProxyInstances\n}", "title": "" }, { "docid": "b5aa96db6955d7a153efb614a6f1be50", "score": "0.47353804", "text": "func updateValidatorsStatus(height int64, validators []stakingtypes.Validator, cdc codec.Codec, db *database.Db) {\n\tlog.Debug().Str(\"module\", \"staking\").Int64(\"height\", height).\n\t\tMsg(\"updating validators statuses\")\n\n\tstatuses, err := stakingutils.GetValidatorsStatuses(height, validators, cdc)\n\tif err != nil {\n\t\tlog.Error().Str(\"module\", \"staking\").Err(err).\n\t\t\tInt64(\"height\", height).\n\t\t\tSend()\n\t\treturn\n\t}\n\n\terr = db.SaveValidatorsStatuses(statuses)\n\tif err != nil {\n\t\tlog.Error().Str(\"module\", \"staking\").Err(err).\n\t\t\tInt64(\"height\", height).\n\t\t\tMsg(\"error while saving validators statuses\")\n\t}\n}", "title": "" }, { "docid": "0759a18c96045ba397b1a3fc392ae53a", "score": "0.47316718", "text": "func parseBfeBackends(out []byte, conf *BfeBackendConfList, withDefaultWeight bool) error {\n\tvalidFieldLen := 8\n\tif withDefaultWeight {\n\t\tvalidFieldLen = 7\n\t}\n\n\tinstances := bytes.Split(out, []byte(\"\\n\"))\n\tfor _, instance := range instances {\n\t\tfields := bytes.Split(instance, []byte(\" \"))\n\t\tfieldLen := len(fields)\n\t\tif fieldLen < validFieldLen {\n\t\t\tcontinue\n\t\t}\n\n\t\tname := string(fields[0])\n\t\taddr := string(fields[1])\n\n\t\t// port\n\t\tport, err := strconv.Atoi(string(fields[3]))\n\t\tif err != nil {\n\t\t\tport = 0\n\t\t}\n\n\t\t// status\n\t\tstatus, err := strconv.Atoi(string(fields[4]))\n\t\tif err != nil {\n\t\t\tstatus = -2\n\t\t}\n\n\t\t// weight\n\t\tweight := -1\n\t\tif fieldLen > 7 {\n\t\t\t// length > 7, may contain weight tag, try to get weight\n\t\t\tweight, err = parseBfeBackendWeight(fields[7])\n\t\t\tif err != nil {\n\t\t\t\t// parse backend weight failed, set weight to -1\n\t\t\t\tweight = -1\n\t\t\t}\n\t\t}\n\t\t// weight < 0 means getting weight failed\n\t\tif withDefaultWeight && weight < 0 {\n\t\t\tweight = 1\n\t\t}\n\n\t\tif len(name) == 0 || len(addr) == 0 || port <= 0 || weight <= 0 || status != 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\tbackendConf := &BfeBackendConf{\n\t\t\tName: &name,\n\t\t\tAddr: &addr,\n\t\t\tPort: &port,\n\t\t\tWeight: &weight,\n\t\t}\n\n\t\t*conf = append(*conf, backendConf)\n\t}\n\n\tif len(*conf) == 0 {\n\t\treturn fmt.Errorf(\"get 0 avail instance from output\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "986304cea7878856f2536fc074e76f7f", "score": "0.4731056", "text": "func (v *VirtualNode) BackendsSet() set.Set {\n\tbackends := v.Backends()\n\ts := set.NewSet()\n\tfor i := range backends {\n\t\ts.Add(backends[i])\n\t}\n\treturn s\n}", "title": "" }, { "docid": "e90e1e700ac2a31942c50b9087467be3", "score": "0.4721566", "text": "func computeBackendWeights(backendWeights map[string]float64, rule *rule) {\n\ttype pathInfo struct {\n\t\tsum float64\n\t\tlastActive *backend\n\t\tcount int\n\t}\n\n\t// get backend weight sum and count of backends for all paths\n\tpathInfos := make(map[string]*pathInfo)\n\tfor _, path := range rule.Http.Paths {\n\t\tsc, ok := pathInfos[path.Path]\n\t\tif !ok {\n\t\t\tsc = &pathInfo{}\n\t\t\tpathInfos[path.Path] = sc\n\t\t}\n\n\t\tif weight, ok := backendWeights[path.Backend.ServiceName]; ok {\n\t\t\tsc.sum += weight\n\t\t\tif weight > 0 {\n\t\t\t\tsc.lastActive = path.Backend\n\t\t\t}\n\t\t} else {\n\t\t\tsc.count++\n\t\t}\n\t}\n\n\t// calculate traffic weight for each backend\n\tfor _, path := range rule.Http.Paths {\n\t\tif sc, ok := pathInfos[path.Path]; ok {\n\t\t\tif weight, ok := backendWeights[path.Backend.ServiceName]; ok {\n\t\t\t\t// force a weight of 1.0 for the last backend with a non-zero weight to avoid rounding issues\n\t\t\t\tif sc.lastActive == path.Backend {\n\t\t\t\t\tpath.Backend.Traffic = 1.0\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tpath.Backend.Traffic = weight / sc.sum\n\t\t\t\t// subtract weight from the sum in order to\n\t\t\t\t// give subsequent backends a higher relative\n\t\t\t\t// weight.\n\t\t\t\tsc.sum -= weight\n\t\t\t} else if sc.sum == 0 && sc.count > 0 {\n\t\t\t\tpath.Backend.Traffic = 1.0 / float64(sc.count)\n\t\t\t}\n\t\t\t// reduce count by one in order to give subsequent\n\t\t\t// backends for the path a higher relative weight.\n\t\t\tsc.count--\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6c83eb286e2ad48796f0f448cf570a81", "score": "0.4712313", "text": "func (c *HAProxyController) handleBackendAnnotations(ingress *Ingress, service *Service, backendName string, newBackend bool) (needReload bool, err error) {\n\tneedReload = false\n\tmodel, _ := c.backendGet(backendName)\n\tbackend := backend(model)\n\tbackendAnnotations := make(map[string]*StringW, 3)\n\tbackendAnnotations[\"annBalanceAlg\"], _ = GetValueFromAnnotations(\"load-balance\", service.Annotations, ingress.Annotations, c.cfg.ConfigMap.Annotations)\n\tbackendAnnotations[\"annCheckHttp\"], _ = GetValueFromAnnotations(\"check-http\", service.Annotations, ingress.Annotations, c.cfg.ConfigMap.Annotations)\n\tbackendAnnotations[\"annForwardedFor\"], _ = GetValueFromAnnotations(\"forwarded-for\", service.Annotations, ingress.Annotations, c.cfg.ConfigMap.Annotations)\n\tbackendAnnotations[\"annTimeoutCheck\"], _ = GetValueFromAnnotations(\"timeout-check\", service.Annotations, ingress.Annotations, c.cfg.ConfigMap.Annotations)\n\n\tfor k, v := range backendAnnotations {\n\t\tif v == nil {\n\t\t\tcontinue\n\t\t}\n\t\tif v.Status != EMPTY || newBackend {\n\t\t\tswitch k {\n\t\t\tcase \"annBalanceAlg\":\n\t\t\t\tif err := backend.updateBalance(v); err != nil {\n\t\t\t\t\tLogErr(err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tneedReload = true\n\t\t\tcase \"annCheckHttp\":\n\t\t\t\tif v.Status == DELETED && !newBackend {\n\t\t\t\t\tbackend.Httpchk = nil\n\t\t\t\t} else if err := backend.updateHttpchk(v); err != nil {\n\t\t\t\t\tLogErr(err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tneedReload = true\n\t\t\tcase \"annForwardedFor\":\n\t\t\t\tif err := backend.updateForwardfor(v); err != nil {\n\t\t\t\t\tLogErr(err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tneedReload = true\n\t\t\tcase \"annTimeoutCheck\":\n\t\t\t\tif v.Status == DELETED && !newBackend {\n\t\t\t\t\tbackend.CheckTimeout = nil\n\t\t\t\t} else if err := backend.updateCheckTimeout(v); err != nil {\n\t\t\t\t\tLogErr(err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tneedReload = true\n\t\t\t}\n\t\t}\n\t}\n\n\tif needReload {\n\t\tif err := c.backendEdit(models.Backend(backend)); err != nil {\n\t\t\treturn needReload, err\n\t\t}\n\t}\n\treturn needReload, nil\n}", "title": "" }, { "docid": "91acce2cc4913352dad26df1b5f228b8", "score": "0.47117257", "text": "func (gateway *ChildProcessGateway) HTTPBackends() map[string]*testBackend.TestHTTPBackend {\n\treturn gateway.backendsHTTP\n}", "title": "" }, { "docid": "67f62bfaa1a1ac25af7ff9536cc62816", "score": "0.47110745", "text": "func (b KantreeBackend) GetFormBackends(string) ([]Backend, error) {\n\treturn nil, errors.New(\"not implemented\")\n}", "title": "" }, { "docid": "5cfef0baac5bb62a08ab6e8fb8e3177b", "score": "0.4697655", "text": "func (b *ringhashBalancer) updateAddresses(addrs []resolver.Address) bool {\n\tvar addrsUpdated bool\n\t// addrsSet is the set converted from addrs, used for quick lookup.\n\taddrsSet := resolver.NewAddressMap()\n\tfor _, addr := range addrs {\n\t\taddrsSet.Set(addr, true)\n\t\tnewWeight := getWeightAttribute(addr)\n\t\tif val, ok := b.subConns.Get(addr); !ok {\n\t\t\tvar sc balancer.SubConn\n\t\t\topts := balancer.NewSubConnOptions{\n\t\t\t\tHealthCheckEnabled: true,\n\t\t\t\tStateListener: func(state balancer.SubConnState) { b.updateSubConnState(sc, state) },\n\t\t\t}\n\t\t\tsc, err := b.cc.NewSubConn([]resolver.Address{addr}, opts)\n\t\t\tif err != nil {\n\t\t\t\tb.logger.Warningf(\"Failed to create new SubConn: %v\", err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tscs := &subConn{addr: addr.Addr, weight: newWeight, sc: sc}\n\t\t\tscs.logger = subConnPrefixLogger(b, scs)\n\t\t\tscs.setState(connectivity.Idle)\n\t\t\tb.state = b.csEvltr.recordTransition(connectivity.Shutdown, connectivity.Idle)\n\t\t\tb.subConns.Set(addr, scs)\n\t\t\tb.scStates[sc] = scs\n\t\t\taddrsUpdated = true\n\t\t} else {\n\t\t\t// We have seen this address before and created a subConn for it. If the\n\t\t\t// weight associated with the address has changed, update the subConns map\n\t\t\t// with the new weight. This will be used when a new ring is created.\n\t\t\t//\n\t\t\t// There is no need to call UpdateAddresses on the subConn at this point\n\t\t\t// since *only* the weight attribute has changed, and that does not affect\n\t\t\t// subConn uniqueness.\n\t\t\tscInfo := val.(*subConn)\n\t\t\tif oldWeight := scInfo.weight; oldWeight != newWeight {\n\t\t\t\tscInfo.weight = newWeight\n\t\t\t\tb.subConns.Set(addr, scInfo)\n\t\t\t\t// Return true to force recreation of the ring.\n\t\t\t\taddrsUpdated = true\n\t\t\t}\n\t\t}\n\t}\n\tfor _, addr := range b.subConns.Keys() {\n\t\t// addr was removed by resolver.\n\t\tif _, ok := addrsSet.Get(addr); !ok {\n\t\t\tv, _ := b.subConns.Get(addr)\n\t\t\tscInfo := v.(*subConn)\n\t\t\tscInfo.sc.Shutdown()\n\t\t\tb.subConns.Delete(addr)\n\t\t\taddrsUpdated = true\n\t\t\t// Keep the state of this sc in b.scStates until sc's state becomes Shutdown.\n\t\t\t// The entry will be deleted in updateSubConnState.\n\t\t}\n\t}\n\treturn addrsUpdated\n}", "title": "" }, { "docid": "dfc1ca208ae9a2dbfc70786c2dc3075f", "score": "0.46976113", "text": "func (m *MockBetaRegionBackendServices) Update(ctx context.Context, key *meta.Key, arg0 *beta.BackendService) error {\n\tif m.UpdateHook != nil {\n\t\treturn m.UpdateHook(ctx, key, arg0, m)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ef75e6662a308d523db6e8f7bda005e2", "score": "0.468416", "text": "func (m *MockAlphaTargetTcpProxies) SetBackendService(ctx context.Context, key *meta.Key, arg0 *alpha.TargetTcpProxiesSetBackendServiceRequest) error {\n\tif m.SetBackendServiceHook != nil {\n\t\treturn m.SetBackendServiceHook(ctx, key, arg0, m)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d04c48e2f9dfe20a467bc33f653d3e6b", "score": "0.46813983", "text": "func (s *States) UpdateAll(a asset.Item, updates map[currency.Code]Options) error {\n\tif s == nil {\n\t\treturn errNilStates\n\t}\n\n\tif !a.IsValid() {\n\t\treturn fmt.Errorf(\"%s %w\", a, asset.ErrNotSupported)\n\t}\n\tif updates == nil {\n\t\treturn errUpdatesAreNil\n\t}\n\ts.mtx.Lock()\n\tfor code, option := range updates {\n\t\ts.update(code, a, option)\n\t}\n\ts.mtx.Unlock()\n\treturn nil\n}", "title": "" }, { "docid": "9be1615b9069f3aad1e54285ea42f404", "score": "0.46777734", "text": "func (m *MockBackendServices) Update(ctx context.Context, key *meta.Key, arg0 *ga.BackendService) error {\n\tif m.UpdateHook != nil {\n\t\treturn m.UpdateHook(ctx, key, arg0, m)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6ce5fcb781369c8050e6e7a659d654fe", "score": "0.46681675", "text": "func (mr *MockStoreClientMockRecorder) UpdateBackend(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"UpdateBackend\", reflect.TypeOf((*MockStoreClient)(nil).UpdateBackend), arg0, arg1)\n}", "title": "" }, { "docid": "3eedd7f9c77da90846068e28a62aac27", "score": "0.4665412", "text": "func (ings *ingressServer) Update(allFunctions map[string]*spec.Function) {\n\tings.mutex.Lock()\n\tdefer ings.mutex.Unlock()\n\tfor _, v := range allFunctions {\n\t\tindex := ings.find(v.Spec.Name)\n\t\t_, exist := ings.pipelines[v.Spec.Name]\n\n\t\tif v.Status.State == spec.ActiveState {\n\t\t\t// need to add rule in HTTPServer or create this pipeline\n\t\t\t// especially in reboot scenario.\n\t\t\tif index == -1 || !exist {\n\t\t\t\terr := ings.Put(v.Spec)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogger.Errorf(\"ingress add back local pipeline: %s, failed: %v\",\n\t\t\t\t\t\tv.Spec.Name, err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t// Function not ready, then remove it from HTTPServer's route rule\n\t\t\tif index != -1 {\n\t\t\t\tings.remove(v.Spec.Name)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c61cdff92056b717751d851534204901", "score": "0.46643674", "text": "func (in *BackendserviceBackend) DeepCopy() *BackendserviceBackend {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BackendserviceBackend)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "5b8b0948234fbde6f7543b7b1d2cbf2f", "score": "0.46617243", "text": "func (o ServiceVclDirectorOutput) Backends() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v ServiceVclDirector) []string { return v.Backends }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "0593771344ec0f7368c68946452b865c", "score": "0.4657899", "text": "func (m *MockBetaTargetTcpProxies) SetBackendService(ctx context.Context, key *meta.Key, arg0 *beta.TargetTcpProxiesSetBackendServiceRequest) error {\n\tif m.SetBackendServiceHook != nil {\n\t\treturn m.SetBackendServiceHook(ctx, key, arg0, m)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "73421c21cff888856d8bb7f35e2a4ca8", "score": "0.46390972", "text": "func (k *k3s) UpdateLoadBalancer(ctx context.Context, clusterName string, service *corev1.Service, nodes []*corev1.Node) error {\n\treturn cloudprovider.ImplementedElsewhere\n}", "title": "" }, { "docid": "00c12b60ed70a909c0bd8b7722e00904", "score": "0.46354225", "text": "func (ds *NativeSM) BatchedUpdate(ents []sm.Entry) ([]sm.Entry, error) {\n\tinputLen := len(ents)\n\tresults, err := ds.sm.Update(ents)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(results) != inputLen {\n\t\tpanic(\"unexpected result length\")\n\t}\n\treturn results, nil\n}", "title": "" }, { "docid": "fcc4b15393c7bcf0ad0689bc66b1f3a5", "score": "0.46332967", "text": "func(h *HAProxyOutput) SaveState() error {\n\tdata, err := json.Marshal(h.Backends)\n\tif err != nil {\n\t\tlog.WithError(err).Warn(\"Unable to Marchal in JSON Backends State\")\n\t\treturn err\n\t}\n\terr = ioutil.WriteFile(h.StateFile,data,0644)\n\tif err != nil {\n\t\tlog.WithField(\"Filename\",h.StateFile).WithError(err).Warn(\"Unable to Write Backends State into File\")\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d0cfb37d6a1f8e0a3326dd430c154160", "score": "0.46186253", "text": "func (c *BackendConfigs) GetBackends() []template.BackendConnector {\n\tbc := []template.BackendConnector{\n\t\tc.Etcd,\n\t\tc.File,\n\t\tc.Env,\n\t\tc.Consul,\n\t\tc.Vault,\n\t\tc.Redis,\n\t\tc.Zookeeper,\n\t\tc.Mock,\n\t\tc.Nats,\n\t}\n\n\tfor _, v := range c.Plugin {\n\t\tbc = append(bc, &v)\n\t}\n\n\treturn bc\n}", "title": "" }, { "docid": "c114ec376616ec1470d7788d331d0fa9", "score": "0.46164316", "text": "func (s *Service) GetFormBackends(formid string) ([]Backend, error) {\n\tif len(s.Backends) == 0 {\n\t\treturn nil, errors.New(\"not enough backends\")\n\t}\n\n\tbackends, err := s.Backends[0].GetFormBackends(formid)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn backends, nil\n}", "title": "" }, { "docid": "ef319ef32aa7b8fb8fbb5a9d7da8261c", "score": "0.4614676", "text": "func updateFallbacks() {\n\tfor {\n\t\tdoUpdateFallbacks()\n\t}\n}", "title": "" }, { "docid": "b52714178f09f45504f2d00d8ddb6a9b", "score": "0.46115482", "text": "func (sm *SQLStateManager) BatchUpdateWorkers(updates []Worker) (WorkersList, error) {\n\tvar existing WorkersList\n\n\tfor _, w := range updates {\n\t\t_, err := sm.UpdateWorker(w.WorkerType, w)\n\n\t\tif err != nil {\n\t\t\treturn existing, err\n\t\t}\n\t}\n\n\treturn sm.ListWorkers(DefaultEngine)\n}", "title": "" }, { "docid": "56a5734a4096da154c47510fceba61fe", "score": "0.46114162", "text": "func AddBackend(service string, ip []byte, healthCheckType int) {\n\t// make copies of passed-in data to avoid lua gc\n\tnewServiceBytes := make([]byte, len(service))\n\tcopy(newServiceBytes, []byte(service))\n\tnewService := string(newServiceBytes)\n\tnewIP := make([]byte, len(ip))\n\tcopy(newIP, ip)\n\n\tbackends := make(chan *common.Backend, 1)\n\tquit := make(chan struct{})\n\tinfo := &serviceInfo{newIP, quit}\n\n\tvar healthCheckFunc func() bool\n\tswitch healthCheckType {\n\tcase healthCheckNone:\n\t\thealthCheckFunc = func() bool {\n\t\t\treturn true\n\t\t}\n\tcase healthCheckHTTP:\n\t\thealthCheckFunc = func() bool {\n\t\t\treturn health.HTTP(newService, 2*time.Second)\n\t\t}\n\tdefault:\n\t\tpanic(\"Unrecognized health check type\")\n\t}\n\n\thealth.CheckFun(healthCheckFunc,\n\t\tfunc() {\n\t\t\tdown := make(chan struct{})\n\t\t\tbackend := &common.Backend{\n\t\t\t\tIP: newIP,\n\t\t\t\tUnhealthy: down,\n\t\t\t}\n\t\t\tbackends <- backend\n\t\t\tg.maglev.Add(backend)\n\t\t},\n\t\tfunc() {\n\t\t\tbackend := <-backends\n\t\t\tclose(backend.Unhealthy)\n\t\t\tg.maglev.Remove(backend)\n\t\t},\n\t\ttime.Second, 5*time.Second, quit)\n\tg.servicesLock.Lock()\n\tdefer g.servicesLock.Unlock()\n\tg.services[newService] = info\n}", "title": "" }, { "docid": "388d21f7c69039c8d8700a3dbcef1808", "score": "0.46086508", "text": "func (ds *NativeSM) BatchedUpdate(ents []sm.Entry) ([]sm.Entry, error) {\n\til := len(ents)\n\tresults, err := ds.sm.Update(ents)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(results) != il {\n\t\tpanic(\"unexpected result length\")\n\t}\n\treturn results, nil\n}", "title": "" }, { "docid": "77c417f419eeb4e21db9523f4ee93d2b", "score": "0.46085468", "text": "func (s *LoadBalancerClient) UpdateLoadBalancer(service *v1.Service, nodes interface{}, withVgroup bool) error {\n\n\texists, lb, err := s.findLoadBalancer(service)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !exists {\n\t\treturn fmt.Errorf(\"the loadbalance you specified by name [%s] does not exist\", service.Name)\n\t}\n\tif withVgroup {\n\t\tvgs := BuildVirturalGroupFromService(s, service, lb)\n\t\tif err := EnsureVirtualGroups(vgs, nodes); err != nil {\n\t\t\treturn fmt.Errorf(\"update backend servers: error %s\", err.Error())\n\t\t}\n\t}\n\tif !needUpdateDefaultBackend(service, lb) {\n\t\treturn nil\n\t}\n\tutils.Logf(service, \"update default backend server group\")\n\treturn s.UpdateDefaultServerGroup(nodes, lb)\n}", "title": "" }, { "docid": "53739cb5ad419d7031fdc6e9492e06c7", "score": "0.4607483", "text": "func (o GetApplicationLoadBalancersBalancerOutput) BackendServers() GetApplicationLoadBalancersBalancerBackendServerArrayOutput {\n\treturn o.ApplyT(func(v GetApplicationLoadBalancersBalancer) []GetApplicationLoadBalancersBalancerBackendServer {\n\t\treturn v.BackendServers\n\t}).(GetApplicationLoadBalancersBalancerBackendServerArrayOutput)\n}", "title": "" }, { "docid": "f46c80320c4502242f5075a396f8f589", "score": "0.46040922", "text": "func (bc *Baiducloud) UpdateLoadBalancer(ctx context.Context, clusterName string, service *v1.Service, nodes []*v1.Node) error {\n\tctx = context.WithValue(ctx, RequestID, GetRandom())\n\tstartTime := time.Now()\n\tserviceKey := fmt.Sprintf(\"%s/%s\", service.Namespace, service.Name)\n\tdefer func() {\n\t\tklog.V(4).Infof(Message(ctx, fmt.Sprintf(\"Finished UpdateLoadBalancer for service %q (%v)\", serviceKey, time.Since(startTime))))\n\t}()\n\tklog.Infof(Message(ctx, fmt.Sprintf(\"UpdateLoadBalancer for service %s\", serviceKey)))\n\terr := bc.reconcileBackendServers(ctx, clusterName, service, nodes)\n\tif err != nil {\n\t\treturn err\n\t}\n\tklog.Infof(Message(ctx, fmt.Sprintf(\"UpdateLoadBalancer for service %s success\", serviceKey)))\n\treturn nil\n}", "title": "" }, { "docid": "cbc4b1465497599504f938851e060b51", "score": "0.46022367", "text": "func (m *MockAlphaRegionBackendServices) Update(ctx context.Context, key *meta.Key, arg0 *alpha.BackendService) error {\n\tif m.UpdateHook != nil {\n\t\treturn m.UpdateHook(ctx, key, arg0, m)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7488391e5eeaa82bd9ce2694c75645c8", "score": "0.45984262", "text": "func UpdateAssemblyList(assemblyURL string, jobPrefix []string) {\n\tr, err := http.Get(assemblyURL)\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\tdefer r.Body.Close()\n\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\n\tvar assembly Assembly\n\tif err := json.Unmarshal(body, &assembly); err != nil {\n\t\tlog.Panic(err)\n\t}\n\n\tvar jobIds []interface{}\n\tfor _, job := range assembly.Jobs {\n\t\tgoodJob := false\n\t\tfor _, prefix := range jobPrefix {\n\t\t\tif strings.HasPrefix(job.Name, prefix) {\n\t\t\t\tgoodJob = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif goodJob {\n\t\t\trow := db.QueryRow(\"select id from assembly where name = ?\", job.Name)\n\t\t\tvar id int64\n\t\t\terr = row.Scan(&id)\n\t\t\tif err == sql.ErrNoRows {\n\t\t\t\tresult, err := db.Exec(\"INSERT INTO assembly(name, url, color) VALUES(?, ?, ?)\", job.Name, job.URL, job.Color)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Panic(err)\n\t\t\t\t}\n\n\t\t\t\tid, err := result.LastInsertId()\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Panic(err)\n\t\t\t\t}\n\t\t\t\tjobIds = append(jobIds, id)\n\t\t\t} else if err != nil {\n\t\t\t\tlog.Panic(err)\n\t\t\t} else {\n\t\t\t\tjobIds = append(jobIds, id)\n\t\t\t}\n\t\t}\n\t}\n\n\tif jobIds != nil {\n\t\tquery := fmt.Sprintf(\"UPDATE assembly SET active=0 WHERE id NOT IN(%s)\",\n\t\t\tstrings.Join(strings.Split(strings.Repeat(\"?\", len(jobIds)), \"\"), \",\"))\n\t\tstmt, _ := db.Prepare(query)\n\t\t_, err := stmt.Exec(jobIds...)\n\t\tif err != nil {\n\t\t\tlog.Panic(err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "466ee37d2e4f8b10f42efc81b003dc63", "score": "0.45965138", "text": "func (s *Service) BatchUpdateState(c context.Context, qids []int64, state int8, operator string) (err error) {\n\tfor _, id := range qids {\n\t\ts.UpdateStatus(c, id, state, operator)\n\t}\n\treturn\n}", "title": "" }, { "docid": "e37cc929deffe9602088ef1cd28297ae", "score": "0.45951098", "text": "func (m *MockTargetTcpProxies) SetBackendService(ctx context.Context, key *meta.Key, arg0 *ga.TargetTcpProxiesSetBackendServiceRequest) error {\n\tif m.SetBackendServiceHook != nil {\n\t\treturn m.SetBackendServiceHook(ctx, key, arg0, m)\n\t}\n\treturn nil\n}", "title": "" } ]
d1ef70cf783f4be8dfb57bb774ffbbc5
MapperToTransition map array string to Transition struct
[ { "docid": "1db338500f7f9258c7624c61a3b4808f", "score": "0.80315065", "text": "func MapperToTransition(s []string) *model.Transition {\n\tt := model.Transition{\n\t\tInitialState: s[0],\n\t\tReadElement: s[1],\n\t\tPullElement: strings.Split(s[2], \";\")[0],\n\t\tFinalState: strings.Split(s[2], \";\")[1],\n\t\tPushElement: s[3],\n\t}\n\treturn &t\n}", "title": "" } ]
[ { "docid": "dfadadf0dba5fad6da4e93123056c2e8", "score": "0.5667962", "text": "func (e *Event) Transition(to string, froms ...string) error {\n\tstates := append(froms[:], to)\n\n\tfor _, state := range states {\n\t\tif !e.sm.states.Has(gset.T(state)) {\n\t\t\treturn fmt.Errorf(\"has not state: %s\", state)\n\t\t}\n\t}\n\n\te.to = to\n\te.froms = froms\n\treturn nil\n}", "title": "" }, { "docid": "1279acfd59695e92b46304356d134dd2", "score": "0.5512325", "text": "func MapperToMetadata(s []string) *model.MetaData {\n\tm := model.MetaData{\n\t\tAcceptStates: strings.Split(s[1], \";\"),\n\t}\n\treturn &m\n}", "title": "" }, { "docid": "2da8ec8c6469014bdc1065041f7ecbde", "score": "0.535579", "text": "func NewDelta(transitions [][]string) *Delta {\n delta := new(Delta)\n delta.transition = make(map[Argument]Result)\n delta.build(transitions)\n return delta\n}", "title": "" }, { "docid": "d3b4ebc001e328d199bc045a759bd67f", "score": "0.5321688", "text": "func (delta *Delta) build(transitions [][]string ) {\n for _, transition := range transitions {\n if (len(transition) % 5 == 0) {\n argumentState := *NewState(transition[0])\n runeArgumentSlice := []rune(transition[1])\n argumentSymbol := runeArgumentSlice[0]\n argument := Argument{argumentState, argumentSymbol}\n resultState := *NewState(transition[2])\n runeResultSlice := []rune(transition[3])\n resultSymbol := runeResultSlice[0]\n var result Result\n switch transition[4] {\n case \"L\":\n result = Result{resultState, resultSymbol, L}\n case \"N\":\n result = Result{resultState, resultSymbol, N}\n case \"R\":\n result = Result{resultState, resultSymbol, R}\n default:\n result = Result{resultState, resultSymbol, N}\n }\n delta.addTransition(argument, result)\n }\n }\n}", "title": "" }, { "docid": "771f859021c8e1bbc1990eddaf3d9b3e", "score": "0.5112311", "text": "func ActiveToSingleStates(active map[string][]UnitState) (map[string]UnitState, error) {\n\tstates := make(map[string]UnitState)\n\tfor name, us := range active {\n\t\tif len(us) != 1 {\n\t\t\treturn nil, fmt.Errorf(\"unit %s running in multiple locations: %v\", name, us)\n\t\t}\n\t\tstates[name] = us[0]\n\t}\n\treturn states, nil\n}", "title": "" }, { "docid": "e06b08ec8791d5527987375d7f57de78", "score": "0.50587416", "text": "func TestTransitionMap_isValidTransition(t *testing.T) {\n\ttype fields struct {\n\t\ttransitions map[Trigger]Transition\n\t\tcurrentDeviceState DeviceState\n\t}\n\ttype args struct {\n\t\ttrigger Trigger\n\t}\n\ttests := []struct {\n\t\tname string\n\t\tfields fields\n\t\targs args\n\t\twant bool\n\t}{\n\t\t{\"isValidTransition-1\", fields{getTranisitions(), deviceStateConnected}, args{DeviceInit},\n\t\t\ttrue},\n\t\t{\"isValidTransition-2\", fields{getTranisitions(), deviceStateDown}, args{GrpcConnected},\n\t\t\tfalse},\n\t\t{\"isValidTransition-3\", fields{getTranisitions(), deviceStateConnected}, args{DeviceDownInd},\n\t\t\tfalse},\n\t}\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\ttMap := &TransitionMap{\n\t\t\t\ttransitions: tt.fields.transitions,\n\t\t\t\tcurrentDeviceState: tt.fields.currentDeviceState,\n\t\t\t}\n\t\t\tif got := tMap.isValidTransition(tt.args.trigger); reflect.TypeOf(got) != reflect.TypeOf(tt.want) {\n\t\t\t\tt.Errorf(\"isValidTransition() = %v, want %v\", got, tt.want)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "8ce0e588e02e75e00dff1ae7eb07bf32", "score": "0.50549865", "text": "func Transition(toState string) Decider {\n\treturn func(ctx *FSMContext, h *swf.HistoryEvent, data interface{}) Outcome {\n\t\tlogf(ctx, \"at=transition\")\n\t\treturn ctx.Goto(toState, data, ctx.EmptyDecisions())\n\t}\n}", "title": "" }, { "docid": "ca137411590232126281fe75e918647b", "score": "0.5028132", "text": "func NewTransitionMap(dMgr DeviceManager) *TransitionMap {\n\tvar transitionMap TransitionMap\n\ttransitionMap.dMgr = dMgr\n\ttransitionMap.transitions = make([]transition, 0)\n\ttransitionMap.transitions = append(\n\t\ttransitionMap.transitions,\n\t\ttransition{\n\t\t\tdeviceType: parent,\n\t\t\tpreviousState: deviceState{Admin: voltha.AdminState_ENABLED, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_ACTIVATING, Transient: voltha.DeviceTransientState_NONE},\n\t\t\tcurrentState: deviceState{Admin: voltha.AdminState_ENABLED, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_ACTIVE, Transient: voltha.DeviceTransientState_NONE},\n\t\t\thandlers: []transitionHandler{dMgr.CreateLogicalDevice}})\n\ttransitionMap.transitions = append(transitionMap.transitions,\n\t\ttransition{\n\t\t\tdeviceType: child,\n\t\t\tpreviousState: deviceState{Admin: voltha.AdminState_ENABLED, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_DISCOVERED, Transient: voltha.DeviceTransientState_NONE},\n\t\t\tcurrentState: deviceState{Admin: voltha.AdminState_ENABLED, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_ACTIVATING, Transient: voltha.DeviceTransientState_NONE},\n\t\t\thandlers: []transitionHandler{}})\n\ttransitionMap.transitions = append(transitionMap.transitions,\n\t\ttransition{\n\t\t\tdeviceType: child,\n\t\t\tpreviousState: deviceState{Admin: voltha.AdminState_ENABLED, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_DISCOVERED, Transient: voltha.DeviceTransientState_NONE},\n\t\t\tcurrentState: deviceState{Admin: voltha.AdminState_ENABLED, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_ACTIVE, Transient: voltha.DeviceTransientState_NONE},\n\t\t\thandlers: []transitionHandler{dMgr.SetupUNILogicalPorts}})\n\ttransitionMap.transitions = append(transitionMap.transitions,\n\t\ttransition{\n\t\t\tdeviceType: child,\n\t\t\tpreviousState: deviceState{Admin: voltha.AdminState_ENABLED, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_ACTIVATING, Transient: voltha.DeviceTransientState_NONE},\n\t\t\tcurrentState: deviceState{Admin: voltha.AdminState_ENABLED, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_DISCOVERED, Transient: voltha.DeviceTransientState_NONE},\n\t\t\thandlers: []transitionHandler{}})\n\ttransitionMap.transitions = append(transitionMap.transitions,\n\t\ttransition{\n\t\t\tdeviceType: child,\n\t\t\tpreviousState: deviceState{Admin: voltha.AdminState_ENABLED, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_ACTIVATING, Transient: voltha.DeviceTransientState_NONE},\n\t\t\tcurrentState: deviceState{Admin: voltha.AdminState_ENABLED, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_ACTIVE, Transient: voltha.DeviceTransientState_NONE},\n\t\t\thandlers: []transitionHandler{dMgr.SetupUNILogicalPorts}})\n\ttransitionMap.transitions = append(transitionMap.transitions,\n\t\ttransition{ //DELETE PRE PROVISIONED State device forcefully\n\t\t\tdeviceType: any,\n\t\t\tpreviousState: deviceState{Admin: voltha.AdminState_PREPROVISIONED, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_UNKNOWN, Transient: voltha.DeviceTransientState_ANY},\n\t\t\tcurrentState: deviceState{Admin: voltha.AdminState_PREPROVISIONED, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_UNKNOWN, Transient: voltha.DeviceTransientState_FORCE_DELETING},\n\t\t\thandlers: []transitionHandler{dMgr.RunPostDeviceDelete}})\n\ttransitionMap.transitions = append(transitionMap.transitions,\n\t\ttransition{ // DELETE PRE PROVISIONED State device no force option set\n\t\t\tdeviceType: any,\n\t\t\tpreviousState: deviceState{Admin: voltha.AdminState_PREPROVISIONED, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_UNKNOWN, Transient: voltha.DeviceTransientState_ANY},\n\t\t\tcurrentState: deviceState{Admin: voltha.AdminState_PREPROVISIONED, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_UNKNOWN, Transient: voltha.DeviceTransientState_DELETING_POST_ADAPTER_RESPONSE},\n\t\t\thandlers: []transitionHandler{dMgr.RunPostDeviceDelete}})\n\ttransitionMap.transitions = append(transitionMap.transitions,\n\t\ttransition{ //DELETE device forcefully\n\t\t\tdeviceType: parent,\n\t\t\tpreviousState: deviceState{Admin: voltha.AdminState_UNKNOWN, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_UNKNOWN, Transient: voltha.DeviceTransientState_ANY},\n\t\t\tcurrentState: deviceState{Admin: voltha.AdminState_UNKNOWN, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_UNKNOWN, Transient: voltha.DeviceTransientState_FORCE_DELETING},\n\t\t\thandlers: []transitionHandler{dMgr.DeleteAllLogicalPorts, dMgr.DeleteAllChildDevices, dMgr.DeleteLogicalDevice, dMgr.RunPostDeviceDelete}})\n\ttransitionMap.transitions = append(transitionMap.transitions,\n\t\ttransition{ //DELETE device after adapter response\n\t\t\tdeviceType: parent,\n\t\t\tpreviousState: deviceState{Admin: voltha.AdminState_UNKNOWN, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_UNKNOWN, Transient: voltha.DeviceTransientState_ANY},\n\t\t\tcurrentState: deviceState{Admin: voltha.AdminState_UNKNOWN, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_UNKNOWN, Transient: voltha.DeviceTransientState_DELETING_POST_ADAPTER_RESPONSE},\n\t\t\thandlers: []transitionHandler{dMgr.DeleteAllLogicalPorts, dMgr.DeleteAllChildDevices, dMgr.DeleteLogicalDevice, dMgr.RunPostDeviceDelete}})\n\ttransitionMap.transitions = append(transitionMap.transitions,\n\t\ttransition{ //DELETE no operation transition\n\t\t\tdeviceType: parent,\n\t\t\tpreviousState: deviceState{Admin: voltha.AdminState_UNKNOWN, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_UNKNOWN, Transient: voltha.DeviceTransientState_ANY},\n\t\t\tcurrentState: deviceState{Admin: voltha.AdminState_UNKNOWN, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_UNKNOWN, Transient: voltha.DeviceTransientState_DELETING_FROM_ADAPTER},\n\t\t\thandlers: []transitionHandler{}})\n\ttransitionMap.transitions = append(transitionMap.transitions,\n\t\ttransition{\n\t\t\tdeviceType: parent,\n\t\t\tpreviousState: deviceState{Admin: voltha.AdminState_ENABLED, Connection: voltha.ConnectStatus_REACHABLE, Operational: voltha.OperStatus_ACTIVE, Transient: voltha.DeviceTransientState_NONE},\n\t\t\tcurrentState: deviceState{Admin: voltha.AdminState_ENABLED, Connection: voltha.ConnectStatus_UNREACHABLE, Operational: voltha.OperStatus_UNKNOWN, Transient: voltha.DeviceTransientState_NONE},\n\t\t\thandlers: []transitionHandler{dMgr.DeleteAllLogicalPorts, dMgr.DeleteAllChildDevices, dMgr.DeleteLogicalDevice, dMgr.DeleteAllDeviceFlows}})\n\ttransitionMap.transitions = append(transitionMap.transitions,\n\t\ttransition{\n\t\t\tdeviceType: parent,\n\t\t\tpreviousState: deviceState{Admin: voltha.AdminState_DISABLED, Connection: voltha.ConnectStatus_REACHABLE, Operational: voltha.OperStatus_UNKNOWN, Transient: voltha.DeviceTransientState_NONE},\n\t\t\tcurrentState: deviceState{Admin: voltha.AdminState_DISABLED, Connection: voltha.ConnectStatus_UNREACHABLE, Operational: voltha.OperStatus_UNKNOWN, Transient: voltha.DeviceTransientState_NONE},\n\t\t\thandlers: []transitionHandler{dMgr.DeleteAllLogicalPorts, dMgr.DeleteAllChildDevices, dMgr.DeleteLogicalDevice, dMgr.DeleteAllDeviceFlows}})\n\ttransitionMap.transitions = append(transitionMap.transitions,\n\t\ttransition{\n\t\t\tdeviceType: parent,\n\t\t\tpreviousState: deviceState{Admin: voltha.AdminState_ENABLED, Connection: voltha.ConnectStatus_UNREACHABLE, Operational: voltha.OperStatus_UNKNOWN, Transient: voltha.DeviceTransientState_NONE},\n\t\t\tcurrentState: deviceState{Admin: voltha.AdminState_ENABLED, Connection: voltha.ConnectStatus_REACHABLE, Operational: voltha.OperStatus_ACTIVE, Transient: voltha.DeviceTransientState_NONE},\n\t\t\thandlers: []transitionHandler{dMgr.CreateLogicalDevice}})\n\ttransitionMap.transitions = append(transitionMap.transitions,\n\t\ttransition{\n\t\t\tdeviceType: parent,\n\t\t\tpreviousState: deviceState{Admin: voltha.AdminState_DISABLED, Connection: voltha.ConnectStatus_UNREACHABLE, Operational: voltha.OperStatus_UNKNOWN, Transient: voltha.DeviceTransientState_NONE},\n\t\t\tcurrentState: deviceState{Admin: voltha.AdminState_DISABLED, Connection: voltha.ConnectStatus_REACHABLE, Operational: voltha.OperStatus_UNKNOWN, Transient: voltha.DeviceTransientState_NONE},\n\t\t\thandlers: []transitionHandler{dMgr.CreateLogicalDevice}})\n\ttransitionMap.transitions = append(transitionMap.transitions,\n\t\ttransition{ //DELETE force case\n\t\t\tdeviceType: child,\n\t\t\tpreviousState: deviceState{Admin: voltha.AdminState_UNKNOWN, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_UNKNOWN, Transient: voltha.DeviceTransientState_ANY},\n\t\t\tcurrentState: deviceState{Admin: voltha.AdminState_UNKNOWN, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_UNKNOWN, Transient: voltha.DeviceTransientState_FORCE_DELETING},\n\t\t\thandlers: []transitionHandler{dMgr.ChildDeviceLost, dMgr.DeleteLogicalPorts, dMgr.RunPostDeviceDelete}})\n\ttransitionMap.transitions = append(transitionMap.transitions,\n\t\ttransition{ //DELETE after adapter response case\n\t\t\tdeviceType: child,\n\t\t\tpreviousState: deviceState{Admin: voltha.AdminState_UNKNOWN, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_UNKNOWN, Transient: voltha.DeviceTransientState_ANY},\n\t\t\tcurrentState: deviceState{Admin: voltha.AdminState_UNKNOWN, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_UNKNOWN, Transient: voltha.DeviceTransientState_DELETING_POST_ADAPTER_RESPONSE},\n\t\t\thandlers: []transitionHandler{dMgr.ChildDeviceLost, dMgr.DeleteLogicalPorts, dMgr.RunPostDeviceDelete}})\n\ttransitionMap.transitions = append(transitionMap.transitions,\n\t\ttransition{ //DELETE wait for adapter response(no operation)\n\t\t\tdeviceType: child,\n\t\t\tpreviousState: deviceState{Admin: voltha.AdminState_UNKNOWN, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_UNKNOWN, Transient: voltha.DeviceTransientState_ANY},\n\t\t\tcurrentState: deviceState{Admin: voltha.AdminState_UNKNOWN, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_UNKNOWN, Transient: voltha.DeviceTransientState_DELETING_FROM_ADAPTER},\n\t\t\thandlers: []transitionHandler{}})\n\ttransitionMap.transitions = append(transitionMap.transitions,\n\t\ttransition{\n\t\t\tdeviceType: any,\n\t\t\tpreviousState: deviceState{Admin: voltha.AdminState_ENABLED, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_ACTIVE, Transient: voltha.DeviceTransientState_NONE},\n\t\t\tcurrentState: deviceState{Admin: voltha.AdminState_ENABLED, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_ACTIVATING, Transient: voltha.DeviceTransientState_NONE},\n\t\t\thandlers: []transitionHandler{dMgr.NotifyInvalidTransition}})\n\ttransitionMap.transitions = append(transitionMap.transitions,\n\t\ttransition{\n\t\t\tdeviceType: any,\n\t\t\tpreviousState: deviceState{Admin: voltha.AdminState_ENABLED, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_ACTIVATING, Transient: voltha.DeviceTransientState_NONE},\n\t\t\tcurrentState: deviceState{Admin: voltha.AdminState_ENABLED, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_UNKNOWN, Transient: voltha.DeviceTransientState_NONE},\n\t\t\thandlers: []transitionHandler{dMgr.NotifyInvalidTransition}})\n\ttransitionMap.transitions = append(transitionMap.transitions,\n\t\ttransition{\n\t\t\tdeviceType: any,\n\t\t\tpreviousState: deviceState{Admin: voltha.AdminState_PREPROVISIONED, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_UNKNOWN, Transient: voltha.DeviceTransientState_NONE},\n\t\t\tcurrentState: deviceState{Admin: voltha.AdminState_UNKNOWN, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_UNKNOWN, Transient: voltha.DeviceTransientState_NONE},\n\t\t\thandlers: []transitionHandler{dMgr.NotifyInvalidTransition}})\n\ttransitionMap.transitions = append(transitionMap.transitions,\n\t\ttransition{\n\t\t\tdeviceType: any,\n\t\t\tpreviousState: deviceState{Admin: voltha.AdminState_ENABLED, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_UNKNOWN, Transient: voltha.DeviceTransientState_NONE},\n\t\t\tcurrentState: deviceState{Admin: voltha.AdminState_DOWNLOADING_IMAGE, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_UNKNOWN, Transient: voltha.DeviceTransientState_NONE},\n\t\t\thandlers: []transitionHandler{dMgr.NotifyInvalidTransition}})\n\ttransitionMap.transitions = append(transitionMap.transitions,\n\t\ttransition{\n\t\t\tdeviceType: any,\n\t\t\tpreviousState: deviceState{Admin: voltha.AdminState_ENABLED, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_UNKNOWN, Transient: voltha.DeviceTransientState_NONE},\n\t\t\tcurrentState: deviceState{Admin: voltha.AdminState_UNKNOWN, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_UNKNOWN, Transient: voltha.DeviceTransientState_NONE},\n\t\t\thandlers: []transitionHandler{dMgr.NotifyInvalidTransition}})\n\ttransitionMap.transitions = append(transitionMap.transitions,\n\t\ttransition{\n\t\t\tdeviceType: parent,\n\t\t\tpreviousState: deviceState{Admin: voltha.AdminState_ENABLED, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_ACTIVE, Transient: voltha.DeviceTransientState_NONE},\n\t\t\tcurrentState: deviceState{Admin: voltha.AdminState_ENABLED, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_ACTIVATING, Transient: voltha.DeviceTransientState_NONE},\n\t\t\thandlers: []transitionHandler{dMgr.NotifyInvalidTransition}})\n\ttransitionMap.transitions = append(transitionMap.transitions,\n\t\ttransition{\n\t\t\tdeviceType: any,\n\t\t\tpreviousState: deviceState{Admin: voltha.AdminState_ENABLED, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_ACTIVATING, Transient: voltha.DeviceTransientState_NONE},\n\t\t\tcurrentState: deviceState{Admin: voltha.AdminState_ENABLED, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_UNKNOWN, Transient: voltha.DeviceTransientState_NONE},\n\t\t\thandlers: []transitionHandler{dMgr.NotifyInvalidTransition}})\n\ttransitionMap.transitions = append(transitionMap.transitions,\n\t\ttransition{\n\t\t\tdeviceType: any,\n\t\t\tpreviousState: deviceState{Admin: voltha.AdminState_ENABLED, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_UNKNOWN, Transient: voltha.DeviceTransientState_NONE},\n\t\t\tcurrentState: deviceState{Admin: voltha.AdminState_PREPROVISIONED, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_UNKNOWN, Transient: voltha.DeviceTransientState_NONE},\n\t\t\thandlers: []transitionHandler{dMgr.NotifyInvalidTransition}})\n\ttransitionMap.transitions = append(transitionMap.transitions,\n\t\ttransition{\n\t\t\tdeviceType: child,\n\t\t\tpreviousState: deviceState{Admin: voltha.AdminState_DISABLED, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_UNKNOWN, Transient: voltha.DeviceTransientState_NONE},\n\t\t\tcurrentState: deviceState{Admin: voltha.AdminState_UNKNOWN, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_UNKNOWN, Transient: voltha.DeviceTransientState_NONE},\n\t\t\thandlers: []transitionHandler{dMgr.NotifyInvalidTransition}})\n\ttransitionMap.transitions = append(transitionMap.transitions,\n\t\ttransition{\n\t\t\tdeviceType: any,\n\t\t\tpreviousState: deviceState{Admin: voltha.AdminState_DISABLED, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_UNKNOWN, Transient: voltha.DeviceTransientState_NONE},\n\t\t\tcurrentState: deviceState{Admin: voltha.AdminState_PREPROVISIONED, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_UNKNOWN, Transient: voltha.DeviceTransientState_NONE},\n\t\t\thandlers: []transitionHandler{dMgr.NotifyInvalidTransition}})\n\ttransitionMap.transitions = append(transitionMap.transitions,\n\t\ttransition{\n\t\t\tdeviceType: any,\n\t\t\tpreviousState: deviceState{Admin: voltha.AdminState_DOWNLOADING_IMAGE, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_UNKNOWN, Transient: voltha.DeviceTransientState_NONE},\n\t\t\tcurrentState: deviceState{Admin: voltha.AdminState_DISABLED, Connection: voltha.ConnectStatus_UNKNOWN, Operational: voltha.OperStatus_UNKNOWN, Transient: voltha.DeviceTransientState_NONE},\n\t\t\thandlers: []transitionHandler{dMgr.NotifyInvalidTransition}})\n\n\treturn &transitionMap\n}", "title": "" }, { "docid": "44a365cce0578164ed534a7a0068a66d", "score": "0.49446473", "text": "func MeapperFileToPA(file string) ([]*model.Transition, *model.MetaData, error) {\n\trows := ReadFile(file)\n\ttransitions := make([]*model.Transition, 0)\n\tvar metaData *model.MetaData = nil\n\tfor _, v := range rows {\n\t\tif v[0] != \"METADATA\" {\n\t\t\tt := MapperToTransition(v)\n\t\t\ttransitions = append(transitions, t)\n\t\t} else {\n\t\t\t// Validate that if value is METADATA we need to use another mapper\n\t\t\tmetaData = MapperToMetadata(v)\n\t\t}\n\t}\n\treturn transitions, metaData, nil\n}", "title": "" }, { "docid": "3b627ce93b1e904c13a32e430d7c6553", "score": "0.48407575", "text": "func Transition(v string) predicate.Metrics {\n\treturn predicate.Metrics(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldTransition), v))\n\t})\n}", "title": "" }, { "docid": "96638fd91f84cc65be30b7d7781df72d", "score": "0.4791075", "text": "func TestNewTransitionMap(t *testing.T) {\n\ttype args struct {\n\t\tdh *DeviceHandler\n\t}\n\ttests := []struct {\n\t\tname string\n\t\targs args\n\t\twant *TransitionMap\n\t}{\n\t\t{\"NewTransitionMap-1\", args{newMockDeviceHandler()}, &TransitionMap{}},\n\t}\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\tif got := NewTransitionMap(tt.args.dh); reflect.TypeOf(got) != reflect.TypeOf(tt.want) {\n\t\t\t\tt.Errorf(\"NewTransitionMap() = %v, want %v\", got, tt.want)\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "16819e729270d50cad2704b982c5f0f0", "score": "0.47893503", "text": "func (m *Machine) Transition(event string) string {\n\tcurrent := m.Current()\n\ttransitions := m.States[current].On\n\tnext := transitions[event].To\n\n\tif next != \"\" {\n\t\tcallFuncts(m.Subscribers, current, next)\n\n\t\tif transitions[event].Cond != nil {\n\t\t\tif transitions[event].Cond(current, next) {\n\t\t\t\tm.current = next\n\t\t\t\treturn next\n\t\t\t}\n\t\t\treturn current\n\t\t}\n\t\tif transitions[event].Actions != nil {\n\t\t\tcallFuncts(transitions[event].Actions, current, next)\n\t\t}\n\n\t\tm.current = next\n\t\treturn next\n\t}\n\treturn current\n}", "title": "" }, { "docid": "ae7f5523572bce8108f406f6c619a931", "score": "0.46852398", "text": "func MapperFileToPA(file string) (*model.PushDownAutomaton, error) {\n\trows := ReadFile(file)\n\ttransitions := make([]*model.Transition, 0)\n\tvar metaData *model.MetaData = nil\n\tfor _, v := range rows {\n\t\tif v[0] != \"METADATA\" {\n\t\t\tt := MapperToTransition(v)\n\t\t\ttransitions = append(transitions, t)\n\t\t} else {\n\t\t\t// Validate that if value is METADATA we need to use another mapper\n\t\t\tmetaData = MapperToMetadata(v)\n\t\t}\n\t}\n\treturn &model.PushDownAutomaton{Transitions: transitions, MetaData: metaData}, nil\n}", "title": "" }, { "docid": "644eb4e42591c0beee2bd780abb1a5c3", "score": "0.46686572", "text": "func TransitionIn(vs ...string) predicate.Metrics {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Metrics(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(FieldTransition), v...))\n\t})\n}", "title": "" }, { "docid": "3f291d243c7eebb5a713439b5e1115cd", "score": "0.4646287", "text": "func (n *NFA) addTransition(r rune, from, to state) *NFA {\n\t_, ok := n.transitions[r]\n\tif !ok {\n\t\tn.transitions[r] = make(map[state]stateSet)\n\t}\n\t_, ok = n.transitions[r][from]\n\tif !ok {\n\t\tn.transitions[r][from] = newStateSet()\n\t}\n\tn.transitions[r][from].add(to)\n\treturn n\n}", "title": "" }, { "docid": "4d8eaef1e7094657bf86857ddc276c02", "score": "0.45673433", "text": "func ValidateStateTransitions(rmtask *rm_task.RMTask,\n\tstates []task.TaskState) {\n\tfor _, state := range states {\n\t\terr := rmtask.TransitTo(state.String())\n\t\tassert.NoError(&testing.T{}, err)\n\t}\n}", "title": "" }, { "docid": "ade7c3d5ab7327115ad69ff345afd489", "score": "0.45162374", "text": "func (tpc *TwoPC) Transition(ctx context.Context, conn *StatefulConnection, dtid string, state querypb.TransactionState) error {\n\tbindVars := map[string]*querypb.BindVariable{\n\t\t\"dtid\": sqltypes.StringBindVariable(dtid),\n\t\t\"state\": sqltypes.Int64BindVariable(int64(state)),\n\t\t\"prepare\": sqltypes.Int64BindVariable(int64(querypb.TransactionState_PREPARE)),\n\t}\n\tqr, err := tpc.exec(ctx, conn, tpc.transition, bindVars)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif qr.RowsAffected != 1 {\n\t\treturn vterrors.Errorf(vtrpcpb.Code_NOT_FOUND, \"could not transition to %v: %s\", state, dtid)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f00efba013b3ae5fd598ee2b51e18b56", "score": "0.44880185", "text": "func NewStateMachine(states ...string) *StateMachine {\n\tstateE := make([]gset.Elementer, len(states))\n\tfor i, state := range states {\n\t\tstateE[i] = gset.T(state)\n\t}\n\tstateSet := gset.NewSet(stateE...)\n\treturn &StateMachine{make(map[string]*Event), stateSet}\n}", "title": "" }, { "docid": "d27a60d19826cc6c85d4744b520207bc", "score": "0.44661757", "text": "func mapFromPairs(pairs ...interface{}) (interface{}, error) {\n\tlength := len(pairs)\n\n\tif length == 1 {\n\t\treturn pairs[0], nil\n\t}\n\n\tif length%2 != 0 {\n\t\treturn nil, fmt.Errorf(\"wutrender: number of parameters must be multiple of 2, got %v\", pairs)\n\t}\n\n\tm := make(map[string]interface{}, length/2)\n\n\tfor i := 0; i < length; i += 2 {\n\t\tv := pairs[i]\n\t\tswitch v.(type) {\n\t\tcase string:\n\t\t\tm[v.(string)] = pairs[i+1]\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"wutrender: pairs should be in format \\\"string => interface{}\\\", got %v, %v\", v, pairs[i+1])\n\t\t}\n\t}\n\treturn m, nil\n}", "title": "" }, { "docid": "bd656b80f05cc9b40c067c9079d644d7", "score": "0.44473633", "text": "func MapArr(in interface{}) interface{} {\n\trin := reflect.ValueOf(in)\n\trout := reflect.MakeSlice(reflect.SliceOf(rin.Type().Elem()), rin.Len(), rin.Len())\n\tvar i int\n\n\tit := rin.MapRange()\n\tfor it.Next() {\n\t\trout.Index(i).Set(it.Value())\n\t\ti++\n\t}\n\n\treturn rout.Interface()\n}", "title": "" }, { "docid": "8a0fb3e355987584f6087739999109c8", "score": "0.44332674", "text": "func FromProcessingQueueStateArrayMap(t map[string][]*types.ProcessingQueueState) map[string][]*history.ProcessingQueueState {\n\tif t == nil {\n\t\treturn nil\n\t}\n\tv := make(map[string][]*history.ProcessingQueueState, len(t))\n\tfor key := range t {\n\t\tv[key] = FromProcessingQueueStateArray(t[key])\n\t}\n\treturn v\n}", "title": "" }, { "docid": "9c5cf0ee1d3f13c29fa842bd92b5ff50", "score": "0.4433041", "text": "func Mapper(arr []string) *ExcelRow {\n\treceipt_number, _ := strconv.ParseUint(GetElementFromArray(arr, 5), 10, 64)\n\treceipt_state := GetElementFromArray(arr, 6)\n\toperation_number, _ := strconv.ParseUint(GetElementFromArray(arr, 7), 10, 64)\n\tservice_id := GetElementFromArray(arr, 8)\n\tpoint_name := GetElementFromArray(arr, 9)\n\tpoint_id, _ := strconv.ParseUint(GetElementFromArray(arr, 10), 10, 64)\n\tsum_in, _ := strconv.ParseUint(GetElementFromArray(arr, 11), 10, 64)\n\tsum_out, _ := strconv.ParseUint(GetElementFromArray(arr, 12), 10, 64)\n\tfee, _ := strconv.ParseUint(GetElementFromArray(arr, 13), 10, 64)\n\tcash, _ := strconv.ParseUint(GetElementFromArray(arr, 14), 10, 64)\n\tprovider_transaction_id, _ := strconv.ParseUint(GetElementFromArray(arr, 15), 10, 64)\n\tpayment_type := GetElementFromArray(arr, 16)\n\tcorrected_operation := GetElementFromArray(arr, 17)\n\tcorrecting_operation := GetElementFromArray(arr, 18)\n\t// Mapping ...\n\texcelRow := &ExcelRow{\n\t\tReceiptNumber: receipt_number,\n\t\tReceiptState: receipt_state,\n\t\tOperationNumber: operation_number,\n\t\tServiceId: service_id,\n\t\tPointName: point_name,\n\t\tPointId: point_id,\n\t\tSumIn: sum_in,\n\t\tSumOut: sum_out,\n\t\tFee: fee,\n\t\tCash: cash,\n\t\tProviderTransactionId: provider_transaction_id,\n\t\tPaymentType: payment_type,\n\t\tCorrectedOperation: corrected_operation,\n\t\tCorrectingOperation: correcting_operation,\n\t}\n\treturn excelRow\n}", "title": "" }, { "docid": "a0b75a9a1c0e19255f22a88392ae9812", "score": "0.44249326", "text": "func unionTransitions(tss1 map[rune]map[state]stateSet, tss2 map[rune]map[state]stateSet) map[rune]map[state]stateSet {\n\tres := make(map[rune]map[state]stateSet)\n\tfor r, ts := range tss1 {\n\t\t_, ok := res[r]\n\t\tif !ok {\n\t\t\tres[r] = make(map[state]stateSet)\n\t\t}\n\t\tres[r] = unionTrans(ts, res[r])\n\t}\n\tfor r, ts := range tss2 {\n\t\t_, ok := res[r]\n\t\tif !ok {\n\t\t\tres[r] = make(map[state]stateSet)\n\t\t}\n\t\tres[r] = unionTrans(ts, res[r])\n\t}\n\treturn res\n}", "title": "" }, { "docid": "acaca657e5bb94081b8b6f9aa512e7cd", "score": "0.4419905", "text": "func DecodeTransformTable(transforms string) ([]IPConversion, error) {\n\tresult := []IPConversion{}\n\trows := strings.Split(transforms, \";\")\n\tfor ri, row := range rows {\n\t\titems := strings.Split(row, \"~\")\n\t\tif len(items) != 4 {\n\t\t\treturn nil, fmt.Errorf(\"transform_table rows should have 4 elements. (%v) found in row (%v) of %#v\", len(items), ri, transforms)\n\t\t}\n\t\tfor i, item := range items {\n\t\t\titems[i] = strings.TrimSpace(item)\n\t\t}\n\n\t\tcon := IPConversion{\n\t\t\tLow: net.ParseIP(items[0]),\n\t\t\tHigh: net.ParseIP(items[1]),\n\t\t}\n\t\tparseList := func(s string) ([]net.IP, error) {\n\t\t\tips := []net.IP{}\n\t\t\tfor _, ip := range strings.Split(s, \",\") {\n\n\t\t\t\tif ip == \"\" {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\taddr := net.ParseIP(ip)\n\t\t\t\tif addr == nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"%s is not a valid ip address\", ip)\n\t\t\t\t}\n\t\t\t\tips = append(ips, addr)\n\t\t\t}\n\t\t\treturn ips, nil\n\t\t}\n\t\tvar err error\n\t\tif con.NewBases, err = parseList(items[2]); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif con.NewIPs, err = parseList(items[3]); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tlow, _ := ipToUint(con.Low)\n\t\thigh, _ := ipToUint(con.High)\n\t\tif low > high {\n\t\t\treturn nil, fmt.Errorf(\"transform_table Low should be less than High. row (%v) %v>%v (%v)\", ri, con.Low, con.High, transforms)\n\t\t}\n\t\tif len(con.NewBases) > 0 && len(con.NewIPs) > 0 {\n\t\t\treturn nil, fmt.Errorf(\"transform_table_rows should only specify one of NewBases or NewIPs, Not both\")\n\t\t}\n\t\tresult = append(result, con)\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "d87d91f77956763aaf0f9fe4da49d5c8", "score": "0.44117454", "text": "func (o DetectorModelOnInputOutput) TransitionEvents() DetectorModelTransitionEventArrayOutput {\n\treturn o.ApplyT(func(v DetectorModelOnInput) []DetectorModelTransitionEvent { return v.TransitionEvents }).(DetectorModelTransitionEventArrayOutput)\n}", "title": "" }, { "docid": "1c6299d82936dd369f321e5b6ef1da6f", "score": "0.44074503", "text": "func NewTransformMap(p ...string) *TransformMap {\n\treturn &TransformMap{Path: p}\n}", "title": "" }, { "docid": "490c927eff752f7331b67b9c3d523ab4", "score": "0.44062418", "text": "func Map(vs []string, f func(string) string) []string {\n\tvsm := make([]string, len(vs))\n\tfor i, v := range vs {\n\t\tvsm[i] = f(v)\n\t}\n\treturn vsm\n}", "title": "" }, { "docid": "490c927eff752f7331b67b9c3d523ab4", "score": "0.44062418", "text": "func Map(vs []string, f func(string) string) []string {\n\tvsm := make([]string, len(vs))\n\tfor i, v := range vs {\n\t\tvsm[i] = f(v)\n\t}\n\treturn vsm\n}", "title": "" }, { "docid": "490c927eff752f7331b67b9c3d523ab4", "score": "0.44062418", "text": "func Map(vs []string, f func(string) string) []string {\n\tvsm := make([]string, len(vs))\n\tfor i, v := range vs {\n\t\tvsm[i] = f(v)\n\t}\n\treturn vsm\n}", "title": "" }, { "docid": "490c927eff752f7331b67b9c3d523ab4", "score": "0.44062418", "text": "func Map(vs []string, f func(string) string) []string {\n\tvsm := make([]string, len(vs))\n\tfor i, v := range vs {\n\t\tvsm[i] = f(v)\n\t}\n\treturn vsm\n}", "title": "" }, { "docid": "490c927eff752f7331b67b9c3d523ab4", "score": "0.44062418", "text": "func Map(vs []string, f func(string) string) []string {\n\tvsm := make([]string, len(vs))\n\tfor i, v := range vs {\n\t\tvsm[i] = f(v)\n\t}\n\treturn vsm\n}", "title": "" }, { "docid": "20c660bd5d28b5c842a8df77d8883fa4", "score": "0.44061437", "text": "func TestTransitionMap_Handle(t *testing.T) {\n\ttype fields struct {\n\t\ttransitions map[Trigger]Transition\n\t\tcurrentDeviceState DeviceState\n\t}\n\ttype args struct {\n\t\ttrigger Trigger\n\t}\n\ttests := []struct {\n\t\tname string\n\t\tfields fields\n\t\targs args\n\t}{\n\t\t{\"Handle-1\", fields{getTranisitions(), deviceStateDown}, args{GrpcConnected}},\n\t\t{\"Handle-2\", fields{getTranisitions(), deviceStateConnected}, args{GrpcConnected}},\n\t\t{\"Handle-3\", fields{getTranisitionsBefore(), deviceStateConnected}, args{GrpcConnected}},\n\t\t{\"Handle-4\", fields{getTranisitionsAfter(), deviceStateConnected}, args{GrpcConnected}},\n\t}\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\ttMap := &TransitionMap{\n\t\t\t\ttransitions: tt.fields.transitions,\n\t\t\t\tcurrentDeviceState: tt.fields.currentDeviceState,\n\t\t\t}\n\t\t\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\t\t\tdefer cancel()\n\t\t\ttMap.Handle(ctx, tt.args.trigger)\n\t\t})\n\t}\n}", "title": "" }, { "docid": "99b26c1927ca3f3677f809d7a6de1509", "score": "0.44048056", "text": "func Map(vs []string, f func(string) string) []string {\n\tvsm := make([]string, len(vs))\n\tfor i, v := range vs {\n\t\tvsm[i] = f(v)\n\t}\n\n\treturn vsm\n}", "title": "" }, { "docid": "1f61ec1a118626afecb196dc1df54eff", "score": "0.44030473", "text": "func SerializeActionTransitions(ats []*action.Transition, baseOff int) []byte {\n\t// Reserve room for the leading set of pointers.\n\tdata := make([]byte, len(ats)*2)\n\n\tfor i, at := range ats {\n\t\t// Write pointer to start.\n\t\tif at == nil {\n\t\t\tcopy(data[i*2:i*2+2], gen.WriteUint16(uint16(0)))\n\t\t} else {\n\t\t\tp := baseOff + len(data)\n\t\t\tcopy(data[i*2:i*2+2], gen.WriteUint16(uint16(p)))\n\n\t\t\t// Append transition definition to end.\n\t\t\tdata = append(data, action.EncodeActionTransition(*at)...)\n\t\t}\n\t}\n\n\treturn data\n}", "title": "" }, { "docid": "c09d8e6d598128bee9248ae664011c0c", "score": "0.43997574", "text": "func unionTrans(t1 map[state]stateSet, t2 map[state]stateSet) map[state]stateSet {\n\tres := make(map[state]stateSet)\n\tfor k, v := range t1 {\n\t\t_, ok := t2[k]\n\t\tif ok {\n\t\t\tpanic(\"transition union fail\") // when offset not correctly added\n\t\t}\n\t\tres[k] = v\n\t}\n\tfor k, v := range t2 {\n\t\t_, ok := t1[k]\n\t\tif ok {\n\t\t\tpanic(\"transition union fail\")\n\t\t}\n\t\tres[k] = v\n\t}\n\treturn res\n}", "title": "" }, { "docid": "549a6fc9b465c05722b7aa2765d52185", "score": "0.43975222", "text": "func StringToTranslator(ts string) (Translator, error) {\n\tswitch strings.ToLower(ts) {\n\tcase \"json\":\n\t\treturn &JsonTranslator{}, nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unknown format: %s\", ts)\n\t}\n}", "title": "" }, { "docid": "3cdc70f2788849c017dc06fafe954c1f", "score": "0.4394797", "text": "func MapStrInt8(f func(string) int8, list []string) []int8 {\n\tif f == nil {\n\t\treturn []int8{}\n\t}\n\tnewList := make([]int8, len(list))\n\tfor i, v := range list {\n\t\tnewList[i] = f(v)\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "099359f14d5957b860b3774115fc3f34", "score": "0.43858218", "text": "func (delta *Delta) addTransition(argument Argument, result Result){\n delta.transition[argument] = result\n}", "title": "" }, { "docid": "03d30d0fdf14d2072d439b35a20062f7", "score": "0.43836173", "text": "func (v *ChainLink)_map(fn stringFunc) *ChainLink {\n\tvar mapped []string\n\torig := *v\n\tfor _, s := range orig.Data {\n\t\tmapped = append(mapped, fn(s)) // first-class function\n\t}\n\tv.Data = mapped\n\treturn v\n}", "title": "" }, { "docid": "7f4386bb2a9377775b8a18c19e7ed93b", "score": "0.43732136", "text": "func (m *Model) Transition(def ...func(t *Transition)) Node {\n\tt := &Transition{\n\t\tLabel: m.TransitionSeq(),\n\t\tOffset: int64(len(m.Transitions)),\n\t\tPosition: Position{},\n\t\tRole: defaultRole,\n\t\tDelta: Vector{},\n\t\tGuards: GuardMap{},\n\t}\n\tfor _, defn := range def {\n\t\tdefn(t)\n\t}\n\tm.Roles[t.Role.Label] = t.Role\n\tm.Transitions[t.Label] = t\n\treturn &node{\n\t\tm: m,\n\t\tTransition: t,\n\t}\n}", "title": "" }, { "docid": "c87b961888b11e9e73eb35cae95f6e33", "score": "0.43705407", "text": "func (state *StateInstance) AddTransitions(trans []Transition) {\n\tif state != nil {\n\t\tfor _, tran := range trans {\n\t\t\tstate.transitions[tran.On] = &tran\n\t\t}\n\t}\n}", "title": "" }, { "docid": "79ebaa77efd7a6e4c19d014230abfbba", "score": "0.435366", "text": "func (s ListStates) FromName(str string) ListStates {\n\tswitch str {\n\tcase \"deployed\":\n\t\treturn ListDeployed\n\tcase \"uninstalled\":\n\t\treturn ListUninstalled\n\tcase \"superseded\":\n\t\treturn ListSuperseded\n\tcase \"failed\":\n\t\treturn ListFailed\n\tcase \"uninstalling\":\n\t\treturn ListUninstalling\n\tcase \"pending-install\":\n\t\treturn ListPendingInstall\n\tcase \"pending-upgrade\":\n\t\treturn ListPendingUpgrade\n\tcase \"pending-rollback\":\n\t\treturn ListPendingRollback\n\t}\n\treturn ListUnknown\n}", "title": "" }, { "docid": "7eb5987f7b857f57c0bb877ae40a729c", "score": "0.4343966", "text": "func TransitionrunEvent(mods ...string) JSONEvent {\n\treturn JSONEvent{Name: strcase.ToKebab(\"transitionrun\"), Targets: mods}\n}", "title": "" }, { "docid": "de502dd4330e3e4bfddc739a378a124c", "score": "0.43045077", "text": "func ParseIntoMap(micros []Microservice) (m MServices) {\n\tm = make(MServices, len(micros))\n\tfor i := 0; i < len(micros); i++ {\n\t\tm[micros[i].Name] = &micros[i]\n\t}\n\tfmt.Println(m)\n\treturn\n}", "title": "" }, { "docid": "df44a63618d2c8eea359af34a0289556", "score": "0.4288783", "text": "func (i *IssueService) Transitions(ctx context.Context, issueKeyOrID string) (result *IssueTransitionsScheme, response *Response, err error) {\n\n\tif len(issueKeyOrID) == 0 {\n\t\treturn nil, nil, fmt.Errorf(\"error, please provide a valid issueKeyOrID string value\")\n\t}\n\n\tvar endpoint = fmt.Sprintf(\"rest/api/3/issue/%v/transitions\", issueKeyOrID)\n\n\trequest, err := i.client.newRequest(ctx, http.MethodGet, endpoint, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\trequest.Header.Set(\"Accept\", \"application/json\")\n\n\tresponse, err = i.client.Do(request)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tresult = new(IssueTransitionsScheme)\n\tif err = json.Unmarshal(response.BodyAsBytes, &result); err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "387084cab9dc467a9b55c91f9a557865", "score": "0.42887688", "text": "func Map[S, D any](s []S, callback func(S) D) []D {\n\tr := make([]D, len(s))\n\tfor i, v := range s {\n\t\tr[i] = callback(v)\n\t}\n\treturn r\n}", "title": "" }, { "docid": "c340502359f42f061c2a68bf8419c67f", "score": "0.42877966", "text": "func reverseTransitions(\n\ttransitions map[State]map[State]bool,\n) map[State]map[State]bool {\n\tret := make(map[State]map[State]bool)\n\tfor state := range transitions {\n\t\tret[state] = make(map[State]bool)\n\t}\n\tfor start, ends := range transitions {\n\t\tfor end := range ends {\n\t\t\tret[end][start] = true\n\t\t}\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "60b74c19c500d25b8bb905f0a6344aff", "score": "0.4261486", "text": "func Trans(f TransformFunc, sel string) (*Transform, error) {\n\tsq, err := selector.Selector(sel)\n\treturn TransCollector(f, sq), err\n}", "title": "" }, { "docid": "f2962268bbc8f1bdfba135e8e027d29a", "score": "0.42572927", "text": "func MapStrUint8(f func(string) uint8, list []string) []uint8 {\n\tif f == nil {\n\t\treturn []uint8{}\n\t}\n\tnewList := make([]uint8, len(list))\n\tfor i, v := range list {\n\t\tnewList[i] = f(v)\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "2e488665ee46cb47033559f430e1e6cd", "score": "0.42526874", "text": "func OrderedSetTransition(db XODB, v0 pgtypes.Internal, v1 []byte) (pgtypes.Internal, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.ordered_set_transition($1, $2)`\n\n\t// run query\n\tvar ret pgtypes.Internal\n\tXOLog(sqlstr, v0, v1)\n\terr = db.QueryRow(sqlstr, v0, v1).Scan(&ret)\n\tif err != nil {\n\t\treturn pgtypes.Internal{}, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "302dfb24b7998c5863376b8b111b5dc9", "score": "0.42288333", "text": "func Map(f func(string) string, a []string) []string {\n\tmapped := make([]string, len(a))\n\tfor i, s := range a {\n\t\tmapped[i] = f(s)\n\t}\n\treturn mapped\n}", "title": "" }, { "docid": "bb889922ef2839729143ec05a01ec3b6", "score": "0.4226515", "text": "func Array2Map_string(a []string) map[string]bool {\n\tmc := make(map[string]bool)\n for _,tok := range a {\n mc[tok]=false\n }\n return mc\n}", "title": "" }, { "docid": "bd47a0b68167f07c211a0c5029cc34cc", "score": "0.4213514", "text": "func (s *State) IsValidTransition(target string) bool {\n\tfor _, t := range s.Transitions {\n\t\tif t == target {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "3f2a36cb779df19b9843678f06f98990", "score": "0.42109206", "text": "func Mapper(arr []interface{}, delegate types.GenericFunction) []interface{} {\n\tresult := make([]interface{}, len(arr))\n\tfor i, v := range arr {\n\t\tresult[i] = delegate(v)\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "54a58844bcbe0f24d2fd9b4ad560a29c", "score": "0.42076108", "text": "func DecodeWorkflow(m map[string]*dynamodb.AttributeValue) (models.Workflow, error) {\n\tvar dj ddbWorkflow\n\tif err := dynamodbattribute.UnmarshalMap(m, &dj); err != nil {\n\t\treturn models.Workflow{}, err\n\t}\n\treturn dj.Workflow, nil\n}", "title": "" }, { "docid": "df9b02d3e709113f43037a65e0e8a587", "score": "0.42058298", "text": "func translatePayloadsToEvents(payloads <-chan []byte, events *emitter.Emitter) {\n\tfor payload := range payloads {\n\t\tif len(payload) >= 4 && int(payload[0]) == 255 {\n\t\t\tswitch int(payload[1]) {\n\t\t\tcase 1:\n\t\t\t\tlog.Debugf(\"Handshake successful\")\n\t\t\t\tgo events.Emit(EventHandshakeSuccess)\n\t\t\tcase 2:\n\t\t\t\tmodel, name, err := translateModelFromPayload(payload)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Fatal(err)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tlog.Infof(\"Model: %s/%s\", model, name)\n\t\t\t\tgo events.Emit(EventModelRecognized, model)\n\t\t\tcase 5:\n\t\t\t\tif payload[2] == 1 && payload[3] == 1 {\n\t\t\t\t\tlog.Debug(\"Ready for image upload\")\n\t\t\t\t\tgo events.Emit(EventReadyForUpload)\n\t\t\t\t}\n\t\t\tcase 6:\n\t\t\t\tlog.Debugf(\"Engraving done\")\n\t\t\t\tgo events.Emit(EventEngravingDone)\n\t\t\tcase 9:\n\t\t\t\t// battery status in %\n\t\t\t\tstatus := int(payload[2]) * 25\n\t\t\t\tif status > 100 {\n\t\t\t\t\tstatus = 100\n\t\t\t\t}\n\t\t\t\tlog.Tracef(\"Battery status: %d%%\", status)\n\t\t\t\tgo events.Emit(EventBatteryStatus, status)\n\t\t\tcase 10:\n\t\t\t\t// carving time in ms\n\t\t\t\ttime := int(payload[2])*100 + int(payload[3])\n\t\t\t\tlog.Debugf(\"Carving time was: %dms\", time)\n\t\t\t\tgo events.Emit(EventCarvingTime, time)\n\t\t\tcase 13:\n\t\t\t\t// laser power in %\n\t\t\t\tstatus := int(payload[2])*100 + int(payload[3])\n\t\t\t\tlog.Debugf(\"Laser power status: %d%%\", status)\n\t\t\t\tgo events.Emit(EventLaserPowerStatus, status)\n\t\t\tcase 15:\n\t\t\t\t// charging current in mA\n\t\t\t\tstatus := int(payload[2])*100 + int(payload[3])\n\t\t\t\tlog.Tracef(\"Charging current: %dmA\", status)\n\t\t\t\tgo events.Emit(EventChargingStatus, status)\n\t\t\tcase 16:\n\t\t\t\tif payload[2] != 1 || payload[3] != 0 {\n\t\t\t\t\tlog.Warnf(\"Control over laser power seems supported by the graver but is not implemented yet.\")\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "aeed9b013de5c877ceb4c160bbcc9c89", "score": "0.42057735", "text": "func (mc *MapConverter) CTransitionType() string {\n return \"char*\"\n}", "title": "" }, { "docid": "247f23e4f047d1c26b1e55acaa2b8d2b", "score": "0.4204803", "text": "func MapperSlice(fromSlice, toSlice interface{}) error {\n\tvar err error\n\ttoValue := reflect.ValueOf(toSlice)\n\tif toValue.Kind() != reflect.Ptr {\n\t\treturn errors.New(\"toSlice must be a pointer to a slice\")\n\t}\n\tif toValue.IsNil() {\n\t\treturn errors.New(\"toSlice must not be a nil pointer\")\n\t}\n\n\telemType := reflect.TypeOf(toSlice).Elem().Elem()\n\trealType := elemType.Kind()\n\tdirect := reflect.Indirect(toValue)\n\t//3 elem parse: 1.[]*type 2.*type 3.type\n\tif realType == reflect.Ptr {\n\t\telemType = elemType.Elem()\n\t}\n\n\tfromElems := convertToSlice(fromSlice)\n\tfor _, v := range fromElems {\n\t\telem := reflect.New(elemType).Elem()\n\t\tif realType == reflect.Ptr {\n\t\t\telem = reflect.New(elemType)\n\t\t}\n\t\tif realType == reflect.Ptr {\n\t\t\terr = elemMapper(reflect.ValueOf(v).Elem(), elem.Elem())\n\t\t} else {\n\t\t\terr = elemMapper(reflect.ValueOf(v), elem)\n\t\t}\n\t\tif err == nil {\n\t\t\tdirect.Set(reflect.Append(direct, elem))\n\t\t}\n\t}\n\treturn err\n}", "title": "" }, { "docid": "8ec51c280f1fac0fef837ba4fe2f1c5a", "score": "0.419252", "text": "func (noApp) ValidTransition(*Params, *State, *State, Index) error {\n\treturn nil\n}", "title": "" }, { "docid": "d9da512e8295391175cda6674ebccc01", "score": "0.41904673", "text": "func (o *Sprint) FromMap(kv map[string]interface{}) {\n\n\to.ID = \"\"\n\n\t// if coming from db\n\tif id, ok := kv[\"_id\"]; ok && id != \"\" {\n\t\tkv[\"id\"] = id\n\t}\n\tif val, ok := kv[\"active\"].(bool); ok {\n\t\to.Active = val\n\t} else {\n\t\tif val, ok := kv[\"active\"]; ok {\n\t\t\tif val == nil {\n\t\t\t\to.Active = false\n\t\t\t} else {\n\t\t\t\to.Active = number.ToBoolAny(val)\n\t\t\t}\n\t\t}\n\t}\n\t// Deprecated\n\tif val, ok := kv[\"board_id\"].(*string); ok {\n\t\to.BoardID = val\n\t} else if val, ok := kv[\"board_id\"].(string); ok {\n\t\to.BoardID = &val\n\t} else {\n\t\tif val, ok := kv[\"board_id\"]; ok {\n\t\t\tif val == nil {\n\t\t\t\to.BoardID = pstrings.Pointer(\"\")\n\t\t\t} else {\n\t\t\t\t// if coming in as map, convert it back\n\t\t\t\tif kv, ok := val.(map[string]interface{}); ok {\n\t\t\t\t\tval = kv[\"string\"]\n\t\t\t\t}\n\t\t\t\to.BoardID = pstrings.Pointer(fmt.Sprintf(\"%v\", val))\n\t\t\t}\n\t\t}\n\t}\n\tif val, ok := kv[\"board_ids\"]; ok {\n\t\tif val != nil {\n\t\t\tna := make([]string, 0)\n\t\t\tif a, ok := val.([]string); ok {\n\t\t\t\tna = append(na, a...)\n\t\t\t} else {\n\t\t\t\tif a, ok := val.([]interface{}); ok {\n\t\t\t\t\tfor _, ae := range a {\n\t\t\t\t\t\tif av, ok := ae.(string); ok {\n\t\t\t\t\t\t\tna = append(na, av)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif badMap, ok := ae.(map[interface{}]interface{}); ok {\n\t\t\t\t\t\t\t\tae = slice.ConvertToStringToInterface(badMap)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tb, _ := json.Marshal(ae)\n\t\t\t\t\t\t\tvar av string\n\t\t\t\t\t\t\tif err := json.Unmarshal(b, &av); err != nil {\n\t\t\t\t\t\t\t\tpanic(\"unsupported type for board_ids field entry: \" + reflect.TypeOf(ae).String())\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tna = append(na, av)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else if s, ok := val.(string); ok {\n\t\t\t\t\tfor _, sv := range strings.Split(s, \",\") {\n\t\t\t\t\t\tna = append(na, strings.TrimSpace(sv))\n\t\t\t\t\t}\n\t\t\t\t} else if a, ok := val.(primitive.A); ok {\n\t\t\t\t\tfor _, ae := range a {\n\t\t\t\t\t\tif av, ok := ae.(string); ok {\n\t\t\t\t\t\t\tna = append(na, av)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tb, _ := json.Marshal(ae)\n\t\t\t\t\t\t\tvar av string\n\t\t\t\t\t\t\tif err := json.Unmarshal(b, &av); err != nil {\n\t\t\t\t\t\t\t\tpanic(\"unsupported type for board_ids field entry: \" + reflect.TypeOf(ae).String())\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tna = append(na, av)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tfmt.Println(reflect.TypeOf(val).String())\n\t\t\t\t\tpanic(\"unsupported type for board_ids field\")\n\t\t\t\t}\n\t\t\t}\n\t\t\to.BoardIds = na\n\t\t}\n\t}\n\tif o.BoardIds == nil {\n\t\to.BoardIds = make([]string, 0)\n\t}\n\n\tif o == nil {\n\n\t\to.Columns = make([]SprintColumns, 0)\n\n\t}\n\tif val, ok := kv[\"columns\"]; ok {\n\t\tif sv, ok := val.([]SprintColumns); ok {\n\t\t\to.Columns = sv\n\t\t} else if sp, ok := val.([]*SprintColumns); ok {\n\t\t\to.Columns = o.Columns[:0]\n\t\t\tfor _, e := range sp {\n\t\t\t\to.Columns = append(o.Columns, *e)\n\t\t\t}\n\t\t} else if a, ok := val.(primitive.A); ok {\n\t\t\tfor _, ae := range a {\n\t\t\t\tif av, ok := ae.(SprintColumns); ok {\n\t\t\t\t\to.Columns = append(o.Columns, av)\n\t\t\t\t} else if av, ok := ae.(primitive.M); ok {\n\t\t\t\t\tvar fm SprintColumns\n\t\t\t\t\tfm.FromMap(av)\n\t\t\t\t\to.Columns = append(o.Columns, fm)\n\t\t\t\t} else {\n\t\t\t\t\tb, _ := json.Marshal(ae)\n\t\t\t\t\tbkv := make(map[string]interface{})\n\t\t\t\t\tjson.Unmarshal(b, &bkv)\n\t\t\t\t\tvar av SprintColumns\n\t\t\t\t\tav.FromMap(bkv)\n\t\t\t\t\to.Columns = append(o.Columns, av)\n\t\t\t\t}\n\t\t\t}\n\t\t} else if arr, ok := val.([]interface{}); ok {\n\t\t\tfor _, item := range arr {\n\t\t\t\tif r, ok := item.(SprintColumns); ok {\n\t\t\t\t\to.Columns = append(o.Columns, r)\n\t\t\t\t} else if r, ok := item.(map[string]interface{}); ok {\n\t\t\t\t\tvar fm SprintColumns\n\t\t\t\t\tfm.FromMap(r)\n\t\t\t\t\to.Columns = append(o.Columns, fm)\n\t\t\t\t} else if r, ok := item.(primitive.M); ok {\n\t\t\t\t\tfm := SprintColumns{}\n\t\t\t\t\tfm.FromMap(r)\n\t\t\t\t\to.Columns = append(o.Columns, fm)\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tarr := reflect.ValueOf(val)\n\t\t\tif arr.Kind() == reflect.Slice {\n\t\t\t\tfor i := 0; i < arr.Len(); i++ {\n\t\t\t\t\titem := arr.Index(i)\n\t\t\t\t\tif item.CanAddr() {\n\t\t\t\t\t\tv := item.Addr().MethodByName(\"ToMap\")\n\t\t\t\t\t\tif !v.IsNil() {\n\t\t\t\t\t\t\tm := v.Call([]reflect.Value{})\n\t\t\t\t\t\t\tvar fm SprintColumns\n\t\t\t\t\t\t\tfm.FromMap(m[0].Interface().(map[string]interface{}))\n\t\t\t\t\t\t\to.Columns = append(o.Columns, fm)\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 val, ok := kv[\"completed_date\"]; ok {\n\t\tif kv, ok := val.(map[string]interface{}); ok {\n\t\t\to.CompletedDate.FromMap(kv)\n\t\t} else if sv, ok := val.(SprintCompletedDate); ok {\n\t\t\t// struct\n\t\t\to.CompletedDate = sv\n\t\t} else if sp, ok := val.(*SprintCompletedDate); ok {\n\t\t\t// struct pointer\n\t\t\to.CompletedDate = *sp\n\t\t} else if dt, ok := val.(*datetime.Date); ok && dt != nil {\n\t\t\to.CompletedDate.Epoch = dt.Epoch\n\t\t\to.CompletedDate.Rfc3339 = dt.Rfc3339\n\t\t\to.CompletedDate.Offset = dt.Offset\n\t\t} else if tv, ok := val.(time.Time); ok && !tv.IsZero() {\n\t\t\tdt := datetime.NewDateWithTime(tv)\n\t\t\to.CompletedDate.Epoch = dt.Epoch\n\t\t\to.CompletedDate.Rfc3339 = dt.Rfc3339\n\t\t\to.CompletedDate.Offset = dt.Offset\n\t\t} else if s, ok := val.(string); ok && s != \"\" {\n\t\t\tdt, err := datetime.NewDate(s)\n\t\t\tif err == nil {\n\t\t\t\to.CompletedDate.Epoch = dt.Epoch\n\t\t\t\to.CompletedDate.Rfc3339 = dt.Rfc3339\n\t\t\t\to.CompletedDate.Offset = dt.Offset\n\t\t\t}\n\t\t}\n\t} else {\n\t\to.CompletedDate.FromMap(map[string]interface{}{})\n\t}\n\n\tif val, ok := kv[\"customer_id\"].(string); ok {\n\t\to.CustomerID = val\n\t} else {\n\t\tif val, ok := kv[\"customer_id\"]; ok {\n\t\t\tif val == nil {\n\t\t\t\to.CustomerID = \"\"\n\t\t\t} else {\n\t\t\t\tv := pstrings.Value(val)\n\t\t\t\tif v != \"\" {\n\t\t\t\t\tif m, ok := val.(map[string]interface{}); ok && m != nil {\n\t\t\t\t\t\tval = pjson.Stringify(m)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tval = v\n\t\t\t\t}\n\t\t\t\to.CustomerID = fmt.Sprintf(\"%v\", val)\n\t\t\t}\n\t\t}\n\t}\n\tif val, ok := kv[\"deleted\"].(bool); ok {\n\t\to.Deleted = val\n\t} else {\n\t\tif val, ok := kv[\"deleted\"]; ok {\n\t\t\tif val == nil {\n\t\t\t\to.Deleted = false\n\t\t\t} else {\n\t\t\t\to.Deleted = number.ToBoolAny(val)\n\t\t\t}\n\t\t}\n\t}\n\n\tif val, ok := kv[\"ended_date\"]; ok {\n\t\tif kv, ok := val.(map[string]interface{}); ok {\n\t\t\to.EndedDate.FromMap(kv)\n\t\t} else if sv, ok := val.(SprintEndedDate); ok {\n\t\t\t// struct\n\t\t\to.EndedDate = sv\n\t\t} else if sp, ok := val.(*SprintEndedDate); ok {\n\t\t\t// struct pointer\n\t\t\to.EndedDate = *sp\n\t\t} else if dt, ok := val.(*datetime.Date); ok && dt != nil {\n\t\t\to.EndedDate.Epoch = dt.Epoch\n\t\t\to.EndedDate.Rfc3339 = dt.Rfc3339\n\t\t\to.EndedDate.Offset = dt.Offset\n\t\t} else if tv, ok := val.(time.Time); ok && !tv.IsZero() {\n\t\t\tdt := datetime.NewDateWithTime(tv)\n\t\t\to.EndedDate.Epoch = dt.Epoch\n\t\t\to.EndedDate.Rfc3339 = dt.Rfc3339\n\t\t\to.EndedDate.Offset = dt.Offset\n\t\t} else if s, ok := val.(string); ok && s != \"\" {\n\t\t\tdt, err := datetime.NewDate(s)\n\t\t\tif err == nil {\n\t\t\t\to.EndedDate.Epoch = dt.Epoch\n\t\t\t\to.EndedDate.Rfc3339 = dt.Rfc3339\n\t\t\t\to.EndedDate.Offset = dt.Offset\n\t\t\t}\n\t\t}\n\t} else {\n\t\to.EndedDate.FromMap(map[string]interface{}{})\n\t}\n\n\tif val, ok := kv[\"goal\"].(string); ok {\n\t\to.Goal = val\n\t} else {\n\t\tif val, ok := kv[\"goal\"]; ok {\n\t\t\tif val == nil {\n\t\t\t\to.Goal = \"\"\n\t\t\t} else {\n\t\t\t\tv := pstrings.Value(val)\n\t\t\t\tif v != \"\" {\n\t\t\t\t\tif m, ok := val.(map[string]interface{}); ok && m != nil {\n\t\t\t\t\t\tval = pjson.Stringify(m)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tval = v\n\t\t\t\t}\n\t\t\t\to.Goal = fmt.Sprintf(\"%v\", val)\n\t\t\t}\n\t\t}\n\t}\n\tif val, ok := kv[\"id\"].(string); ok {\n\t\to.ID = val\n\t} else {\n\t\tif val, ok := kv[\"id\"]; ok {\n\t\t\tif val == nil {\n\t\t\t\to.ID = \"\"\n\t\t\t} else {\n\t\t\t\tv := pstrings.Value(val)\n\t\t\t\tif v != \"\" {\n\t\t\t\t\tif m, ok := val.(map[string]interface{}); ok && m != nil {\n\t\t\t\t\t\tval = pjson.Stringify(m)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tval = v\n\t\t\t\t}\n\t\t\t\to.ID = fmt.Sprintf(\"%v\", val)\n\t\t\t}\n\t\t}\n\t}\n\tif val, ok := kv[\"integration_instance_id\"].(*string); ok {\n\t\to.IntegrationInstanceID = val\n\t} else if val, ok := kv[\"integration_instance_id\"].(string); ok {\n\t\to.IntegrationInstanceID = &val\n\t} else {\n\t\tif val, ok := kv[\"integration_instance_id\"]; ok {\n\t\t\tif val == nil {\n\t\t\t\to.IntegrationInstanceID = pstrings.Pointer(\"\")\n\t\t\t} else {\n\t\t\t\t// if coming in as map, convert it back\n\t\t\t\tif kv, ok := val.(map[string]interface{}); ok {\n\t\t\t\t\tval = kv[\"string\"]\n\t\t\t\t}\n\t\t\t\to.IntegrationInstanceID = pstrings.Pointer(fmt.Sprintf(\"%v\", val))\n\t\t\t}\n\t\t}\n\t}\n\tif val, ok := kv[\"issue_ids\"]; ok {\n\t\tif val != nil {\n\t\t\tna := make([]string, 0)\n\t\t\tif a, ok := val.([]string); ok {\n\t\t\t\tna = append(na, a...)\n\t\t\t} else {\n\t\t\t\tif a, ok := val.([]interface{}); ok {\n\t\t\t\t\tfor _, ae := range a {\n\t\t\t\t\t\tif av, ok := ae.(string); ok {\n\t\t\t\t\t\t\tna = append(na, av)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif badMap, ok := ae.(map[interface{}]interface{}); ok {\n\t\t\t\t\t\t\t\tae = slice.ConvertToStringToInterface(badMap)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tb, _ := json.Marshal(ae)\n\t\t\t\t\t\t\tvar av string\n\t\t\t\t\t\t\tif err := json.Unmarshal(b, &av); err != nil {\n\t\t\t\t\t\t\t\tpanic(\"unsupported type for issue_ids field entry: \" + reflect.TypeOf(ae).String())\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tna = append(na, av)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else if s, ok := val.(string); ok {\n\t\t\t\t\tfor _, sv := range strings.Split(s, \",\") {\n\t\t\t\t\t\tna = append(na, strings.TrimSpace(sv))\n\t\t\t\t\t}\n\t\t\t\t} else if a, ok := val.(primitive.A); ok {\n\t\t\t\t\tfor _, ae := range a {\n\t\t\t\t\t\tif av, ok := ae.(string); ok {\n\t\t\t\t\t\t\tna = append(na, av)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tb, _ := json.Marshal(ae)\n\t\t\t\t\t\t\tvar av string\n\t\t\t\t\t\t\tif err := json.Unmarshal(b, &av); err != nil {\n\t\t\t\t\t\t\t\tpanic(\"unsupported type for issue_ids field entry: \" + reflect.TypeOf(ae).String())\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tna = append(na, av)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tfmt.Println(reflect.TypeOf(val).String())\n\t\t\t\t\tpanic(\"unsupported type for issue_ids field\")\n\t\t\t\t}\n\t\t\t}\n\t\t\to.IssueIds = na\n\t\t}\n\t}\n\tif o.IssueIds == nil {\n\t\to.IssueIds = make([]string, 0)\n\t}\n\tif val, ok := kv[\"name\"].(string); ok {\n\t\to.Name = val\n\t} else {\n\t\tif val, ok := kv[\"name\"]; ok {\n\t\t\tif val == nil {\n\t\t\t\to.Name = \"\"\n\t\t\t} else {\n\t\t\t\tv := pstrings.Value(val)\n\t\t\t\tif v != \"\" {\n\t\t\t\t\tif m, ok := val.(map[string]interface{}); ok && m != nil {\n\t\t\t\t\t\tval = pjson.Stringify(m)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tval = v\n\t\t\t\t}\n\t\t\t\to.Name = fmt.Sprintf(\"%v\", val)\n\t\t\t}\n\t\t}\n\t}\n\tif val, ok := kv[\"project_ids\"]; ok {\n\t\tif val != nil {\n\t\t\tna := make([]string, 0)\n\t\t\tif a, ok := val.([]string); ok {\n\t\t\t\tna = append(na, a...)\n\t\t\t} else {\n\t\t\t\tif a, ok := val.([]interface{}); ok {\n\t\t\t\t\tfor _, ae := range a {\n\t\t\t\t\t\tif av, ok := ae.(string); ok {\n\t\t\t\t\t\t\tna = append(na, av)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif badMap, ok := ae.(map[interface{}]interface{}); ok {\n\t\t\t\t\t\t\t\tae = slice.ConvertToStringToInterface(badMap)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tb, _ := json.Marshal(ae)\n\t\t\t\t\t\t\tvar av string\n\t\t\t\t\t\t\tif err := json.Unmarshal(b, &av); err != nil {\n\t\t\t\t\t\t\t\tpanic(\"unsupported type for project_ids field entry: \" + reflect.TypeOf(ae).String())\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tna = append(na, av)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else if s, ok := val.(string); ok {\n\t\t\t\t\tfor _, sv := range strings.Split(s, \",\") {\n\t\t\t\t\t\tna = append(na, strings.TrimSpace(sv))\n\t\t\t\t\t}\n\t\t\t\t} else if a, ok := val.(primitive.A); ok {\n\t\t\t\t\tfor _, ae := range a {\n\t\t\t\t\t\tif av, ok := ae.(string); ok {\n\t\t\t\t\t\t\tna = append(na, av)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tb, _ := json.Marshal(ae)\n\t\t\t\t\t\t\tvar av string\n\t\t\t\t\t\t\tif err := json.Unmarshal(b, &av); err != nil {\n\t\t\t\t\t\t\t\tpanic(\"unsupported type for project_ids field entry: \" + reflect.TypeOf(ae).String())\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tna = append(na, av)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tfmt.Println(reflect.TypeOf(val).String())\n\t\t\t\t\tpanic(\"unsupported type for project_ids field\")\n\t\t\t\t}\n\t\t\t}\n\t\t\to.ProjectIds = na\n\t\t}\n\t}\n\tif o.ProjectIds == nil {\n\t\to.ProjectIds = make([]string, 0)\n\t}\n\tif val, ok := kv[\"ref_id\"].(string); ok {\n\t\to.RefID = val\n\t} else {\n\t\tif val, ok := kv[\"ref_id\"]; ok {\n\t\t\tif val == nil {\n\t\t\t\to.RefID = \"\"\n\t\t\t} else {\n\t\t\t\tv := pstrings.Value(val)\n\t\t\t\tif v != \"\" {\n\t\t\t\t\tif m, ok := val.(map[string]interface{}); ok && m != nil {\n\t\t\t\t\t\tval = pjson.Stringify(m)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tval = v\n\t\t\t\t}\n\t\t\t\to.RefID = fmt.Sprintf(\"%v\", val)\n\t\t\t}\n\t\t}\n\t}\n\tif val, ok := kv[\"ref_type\"].(string); ok {\n\t\to.RefType = val\n\t} else {\n\t\tif val, ok := kv[\"ref_type\"]; ok {\n\t\t\tif val == nil {\n\t\t\t\to.RefType = \"\"\n\t\t\t} else {\n\t\t\t\tv := pstrings.Value(val)\n\t\t\t\tif v != \"\" {\n\t\t\t\t\tif m, ok := val.(map[string]interface{}); ok && m != nil {\n\t\t\t\t\t\tval = pjson.Stringify(m)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tval = v\n\t\t\t\t}\n\t\t\t\to.RefType = fmt.Sprintf(\"%v\", val)\n\t\t\t}\n\t\t}\n\t}\n\n\tif val, ok := kv[\"started_date\"]; ok {\n\t\tif kv, ok := val.(map[string]interface{}); ok {\n\t\t\to.StartedDate.FromMap(kv)\n\t\t} else if sv, ok := val.(SprintStartedDate); ok {\n\t\t\t// struct\n\t\t\to.StartedDate = sv\n\t\t} else if sp, ok := val.(*SprintStartedDate); ok {\n\t\t\t// struct pointer\n\t\t\to.StartedDate = *sp\n\t\t} else if dt, ok := val.(*datetime.Date); ok && dt != nil {\n\t\t\to.StartedDate.Epoch = dt.Epoch\n\t\t\to.StartedDate.Rfc3339 = dt.Rfc3339\n\t\t\to.StartedDate.Offset = dt.Offset\n\t\t} else if tv, ok := val.(time.Time); ok && !tv.IsZero() {\n\t\t\tdt := datetime.NewDateWithTime(tv)\n\t\t\to.StartedDate.Epoch = dt.Epoch\n\t\t\to.StartedDate.Rfc3339 = dt.Rfc3339\n\t\t\to.StartedDate.Offset = dt.Offset\n\t\t} else if s, ok := val.(string); ok && s != \"\" {\n\t\t\tdt, err := datetime.NewDate(s)\n\t\t\tif err == nil {\n\t\t\t\to.StartedDate.Epoch = dt.Epoch\n\t\t\t\to.StartedDate.Rfc3339 = dt.Rfc3339\n\t\t\t\to.StartedDate.Offset = dt.Offset\n\t\t\t}\n\t\t}\n\t} else {\n\t\to.StartedDate.FromMap(map[string]interface{}{})\n\t}\n\n\tif val, ok := kv[\"status\"].(SprintStatus); ok {\n\t\to.Status = val\n\t} else {\n\t\tif em, ok := kv[\"status\"].(map[string]interface{}); ok {\n\n\t\t\tev := em[\"work.status\"].(string)\n\t\t\tswitch ev {\n\t\t\tcase \"active\", \"ACTIVE\":\n\t\t\t\to.Status = 0\n\t\t\tcase \"future\", \"FUTURE\":\n\t\t\t\to.Status = 1\n\t\t\tcase \"closed\", \"CLOSED\":\n\t\t\t\to.Status = 2\n\t\t\t}\n\t\t}\n\t\tif em, ok := kv[\"status\"].(string); ok {\n\t\t\tswitch em {\n\t\t\tcase \"active\", \"ACTIVE\":\n\t\t\t\to.Status = 0\n\t\t\tcase \"future\", \"FUTURE\":\n\t\t\t\to.Status = 1\n\t\t\tcase \"closed\", \"CLOSED\":\n\t\t\t\to.Status = 2\n\t\t\t}\n\t\t}\n\t}\n\n\tif val, ok := kv[\"updated_date\"]; ok {\n\t\tif kv, ok := val.(map[string]interface{}); ok {\n\t\t\to.UpdatedDate.FromMap(kv)\n\t\t} else if sv, ok := val.(SprintUpdatedDate); ok {\n\t\t\t// struct\n\t\t\to.UpdatedDate = sv\n\t\t} else if sp, ok := val.(*SprintUpdatedDate); ok {\n\t\t\t// struct pointer\n\t\t\to.UpdatedDate = *sp\n\t\t} else if dt, ok := val.(*datetime.Date); ok && dt != nil {\n\t\t\to.UpdatedDate.Epoch = dt.Epoch\n\t\t\to.UpdatedDate.Rfc3339 = dt.Rfc3339\n\t\t\to.UpdatedDate.Offset = dt.Offset\n\t\t} else if tv, ok := val.(time.Time); ok && !tv.IsZero() {\n\t\t\tdt := datetime.NewDateWithTime(tv)\n\t\t\to.UpdatedDate.Epoch = dt.Epoch\n\t\t\to.UpdatedDate.Rfc3339 = dt.Rfc3339\n\t\t\to.UpdatedDate.Offset = dt.Offset\n\t\t} else if s, ok := val.(string); ok && s != \"\" {\n\t\t\tdt, err := datetime.NewDate(s)\n\t\t\tif err == nil {\n\t\t\t\to.UpdatedDate.Epoch = dt.Epoch\n\t\t\t\to.UpdatedDate.Rfc3339 = dt.Rfc3339\n\t\t\t\to.UpdatedDate.Offset = dt.Offset\n\t\t\t}\n\t\t}\n\t} else {\n\t\to.UpdatedDate.FromMap(map[string]interface{}{})\n\t}\n\n\tif val, ok := kv[\"updated_ts\"].(int64); ok {\n\t\to.UpdatedAt = val\n\t} else {\n\t\tif val, ok := kv[\"updated_ts\"]; ok {\n\t\t\tif val == nil {\n\t\t\t\to.UpdatedAt = 0\n\t\t\t} else {\n\t\t\t\tif tv, ok := val.(time.Time); ok {\n\t\t\t\t\tval = datetime.TimeToEpoch(tv)\n\t\t\t\t}\n\t\t\t\to.UpdatedAt = number.ToInt64Any(val)\n\t\t\t}\n\t\t}\n\t}\n\tif val, ok := kv[\"url\"].(*string); ok {\n\t\to.URL = val\n\t} else if val, ok := kv[\"url\"].(string); ok {\n\t\to.URL = &val\n\t} else {\n\t\tif val, ok := kv[\"url\"]; ok {\n\t\t\tif val == nil {\n\t\t\t\to.URL = pstrings.Pointer(\"\")\n\t\t\t} else {\n\t\t\t\t// if coming in as map, convert it back\n\t\t\t\tif kv, ok := val.(map[string]interface{}); ok {\n\t\t\t\t\tval = kv[\"string\"]\n\t\t\t\t}\n\t\t\t\to.URL = pstrings.Pointer(fmt.Sprintf(\"%v\", val))\n\t\t\t}\n\t\t}\n\t}\n\to.setDefaults(false)\n}", "title": "" }, { "docid": "24412644f96bf91b2fbea8aadfdbdd6c", "score": "0.41772163", "text": "func (i *Input) FromMap(values map[string]interface{}) error {\n\n\tvar err error\n\tif i.StateKey, err = coerce.ToString(values[\"key\"]); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8042772d42952e646b86c578ec505636", "score": "0.41713646", "text": "func (o LifecycleHookOutput) LifecycleTransition() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *LifecycleHook) pulumi.StringOutput { return v.LifecycleTransition }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "2ddf6fbe89d27010ab143b13a7028090", "score": "0.41666692", "text": "func (c TransformMap) Transform(obj interface{}) util.Mapper {\n\tm := make(util.Mapper)\n\tutil.NewQuery(obj).Path(c.Path...).Range(func(q *util.Query) {\n\t\tm[q.Str(c.Key...)] = q.Str(c.Value...)\n\t})\n\treturn m\n}", "title": "" }, { "docid": "11a44c085014bb9e800c6f09f516bfad", "score": "0.41558567", "text": "func (decoder *Decoder) Decode(payload []Msg) Action {\n\n\ttmp := make([]Msg, len(payload))\n\tcopy(tmp, payload)\n\n\tslice.Sort(tmp, func(left int, right int) bool {\n\t\treturn tmp[left].Index < tmp[right].Index\n\t})\n\n\tnumBytes := decoder.wordLength / 8\n\n\tactionValue := mapSlice(tmp[:numBytes], getValue)\n\tactionConst := utils.FromBytes(decoder.wordLength, actionValue)\n\n\taction := Action{\n\t\tKey: tmp[0].Key,\n\t\tAction: actionConst,\n\t}\n\n\tif actionConst == NULL {\n\t\treturn action\n\t}\n\n\tmsg := tmp[numBytes]\n\tlocationValue := mapSlice(tmp[numBytes:numBytes*2], getValue)\n\tvalue := utils.FromBytes(decoder.wordLength, locationValue)\n\n\tif msg.Type == REGISTER {\n\t\tvalue = -(value + 1)\n\t}\n\n\taction.Location = Parameter{\n\t\tType: msg.Type,\n\t\tValue: value,\n\t}\n\n\tchunks := decoder.MakeChunks(tmp[numBytes*2:])\n\n\tfor _, chunk := range chunks {\n\t\tchunkValue := mapSlice(chunk, getValue)\n\n\t\tv := utils.FromBytes(decoder.wordLength, chunkValue)\n\t\tvl := Parameter{}\n\n\t\tvl.Type = chunk[0].Type\n\n\t\tif vl.Type == REGISTER {\n\t\t\tvl.Value = (v + 1) * -1\n\t\t} else {\n\t\t\tvl.Value = v\n\t\t}\n\n\t\taction.Parameters = append(action.Parameters, vl)\n\t}\n\n\treturn action\n}", "title": "" }, { "docid": "984f550bda90ed1e884215b741aaf859", "score": "0.41480464", "text": "func (s StateMachine) Transform(action string, multiplier uint64) ([]int64, error) {\n\tvar vectorOut []int64\n\tvar err error = nil\n\n\tfor offset, delta := range s.Transitions[Action(action)] {\n\t\tval := int64(s.State[offset]) + delta*int64(multiplier)\n\t\tvectorOut = append(vectorOut, val)\n\t\tif err == nil && val < 0 {\n\t\t\terr = errors.New(\"invalid output\")\n\t\t}\n\t\tif err == nil && s.Capacity[offset] != 0 && val > int64(s.Capacity[offset]) {\n\t\t\terr = errors.New(\"exceeded capacity\")\n\t\t}\n\t}\n\treturn vectorOut, err\n}", "title": "" }, { "docid": "5e1546968ed255477d4d00ff75060d4f", "score": "0.4140919", "text": "func (MapStringString) DecodeSlice() {}", "title": "" }, { "docid": "9f8f131c2cee32dec7c115b786fc6354", "score": "0.4128768", "text": "func eventMapping(status map[string]string) common.MapStr {\n\tsource := map[string]interface{}{}\n\tfor key, val := range status {\n\t\tsource[key] = val\n\t}\n\treturn schema.Apply(source)\n}", "title": "" }, { "docid": "eceb1f8a6f475e9b5afa6b38c8a27291", "score": "0.412806", "text": "func StringToIntMapper(element interface{}) interface{} {\n\tasInt, err := strconv.Atoi(element.(string))\n\n\tif err == nil {\n\t\treturn asInt\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "b924cb86470652905fc396dc48561b4e", "score": "0.41275537", "text": "func NewStateTransition(evm *vm.EVM, msg txinterface.Message, gp *GasPool) *StateTransition {\n\t//gasprice, err := matrixstate.GetTxpoolGasLimit(evm.StateDB)\n\t//if err != nil {\n\t//\tlog.Error(\"NewStateTransition err\")\n\t//\treturn nil\n\t//}\n\treturn &StateTransition{\n\t\tgp: gp,\n\t\tevm: evm,\n\t\tmsg: msg,\n\t\tgasPrice: new(big.Int).SetUint64(params.TxGasPrice),\n\t\tvalue: msg.Value(),\n\t\tdata: msg.Data(),\n\t\tstate: evm.StateDB,\n\t}\n}", "title": "" }, { "docid": "cdbb6fb8ce0f76d35439687445b8324b", "score": "0.41230246", "text": "func (mc *MapConverter) GoTransitionType() string {\n return \"*C.char\"\n}", "title": "" }, { "docid": "eb76c163c7f0e6d2e7b4ab3f6ad4d536", "score": "0.41143757", "text": "func StringToFloatMapper(floatSize int) streams.Mapper {\n\treturn func(element interface{}) interface{} {\n\t\tasFloat, err := strconv.ParseFloat(element.(string), floatSize)\n\n\t\tif err == nil {\n\t\t\treturn asFloat\n\t\t}\n\t\treturn 0.0\n\t}\n}", "title": "" }, { "docid": "bd96f8ef9e00773ee27a92bb388df091", "score": "0.41107222", "text": "func (t transitionerStruct) transition(f *FSM) error {\r\n\tif f.transition == nil {\r\n\t\treturn NotInTransitionError{}\r\n\t}\r\n\tf.transition()\r\n\treturn nil\r\n}", "title": "" }, { "docid": "6b024870c28b5aa99d8ed2167a359b55", "score": "0.41079262", "text": "func TransitionLT(v string) predicate.Metrics {\n\treturn predicate.Metrics(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldTransition), v))\n\t})\n}", "title": "" }, { "docid": "10984fa4a8e8a8d50f98bc0a145b3190", "score": "0.4101597", "text": "func (mc *MetricsCreate) SetTransition(s string) *MetricsCreate {\n\tmc.mutation.SetTransition(s)\n\treturn mc\n}", "title": "" }, { "docid": "e71ddd6b7aef730e3561ef7abc498ffd", "score": "0.40931398", "text": "func (_App *AppCaller) ValidTransition(opts *bind.CallOpts, params ChannelParams, from ChannelState, to ChannelState, actorIdx *big.Int) error {\n\tvar out []interface{}\n\terr := _App.contract.Call(opts, &out, \"validTransition\", params, from, to, actorIdx)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn err\n\n}", "title": "" }, { "docid": "44b6e0848821881b4ad6816b136a2287", "score": "0.40912426", "text": "func (o *SprintPartial) FromMap(kv map[string]interface{}) {\n\tif val, ok := kv[\"active\"].(*bool); ok {\n\t\to.Active = val\n\t} else if val, ok := kv[\"active\"].(bool); ok {\n\t\to.Active = &val\n\t} else {\n\t\tif val, ok := kv[\"active\"]; ok {\n\t\t\tif val == nil {\n\t\t\t\to.Active = nil\n\t\t\t} else {\n\t\t\t\t// if coming in as map, convert it back\n\t\t\t\tif kv, ok := val.(map[string]interface{}); ok {\n\t\t\t\t\tval = kv[\"bool\"]\n\t\t\t\t}\n\t\t\t\to.Active = number.BoolPointer(number.ToBoolAny(val))\n\t\t\t}\n\t\t}\n\t}\n\t// Deprecated\n\tif val, ok := kv[\"board_id\"].(*string); ok {\n\t\to.BoardID = val\n\t} else if val, ok := kv[\"board_id\"].(string); ok {\n\t\to.BoardID = &val\n\t} else {\n\t\tif val, ok := kv[\"board_id\"]; ok {\n\t\t\tif val == nil {\n\t\t\t\to.BoardID = pstrings.Pointer(\"\")\n\t\t\t} else {\n\t\t\t\t// if coming in as map, convert it back\n\t\t\t\tif kv, ok := val.(map[string]interface{}); ok {\n\t\t\t\t\tval = kv[\"string\"]\n\t\t\t\t}\n\t\t\t\to.BoardID = pstrings.Pointer(fmt.Sprintf(\"%v\", val))\n\t\t\t}\n\t\t}\n\t}\n\tif val, ok := kv[\"board_ids\"]; ok {\n\t\tif val != nil {\n\t\t\tna := make([]string, 0)\n\t\t\tif a, ok := val.([]string); ok {\n\t\t\t\tna = append(na, a...)\n\t\t\t} else {\n\t\t\t\tif a, ok := val.([]interface{}); ok {\n\t\t\t\t\tfor _, ae := range a {\n\t\t\t\t\t\tif av, ok := ae.(string); ok {\n\t\t\t\t\t\t\tna = append(na, av)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif badMap, ok := ae.(map[interface{}]interface{}); ok {\n\t\t\t\t\t\t\t\tae = slice.ConvertToStringToInterface(badMap)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tb, _ := json.Marshal(ae)\n\t\t\t\t\t\t\tvar av string\n\t\t\t\t\t\t\tif err := json.Unmarshal(b, &av); err != nil {\n\t\t\t\t\t\t\t\tpanic(\"unsupported type for board_ids field entry: \" + reflect.TypeOf(ae).String())\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tna = append(na, av)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else if s, ok := val.(string); ok {\n\t\t\t\t\tfor _, sv := range strings.Split(s, \",\") {\n\t\t\t\t\t\tna = append(na, strings.TrimSpace(sv))\n\t\t\t\t\t}\n\t\t\t\t} else if a, ok := val.(primitive.A); ok {\n\t\t\t\t\tfor _, ae := range a {\n\t\t\t\t\t\tif av, ok := ae.(string); ok {\n\t\t\t\t\t\t\tna = append(na, av)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tb, _ := json.Marshal(ae)\n\t\t\t\t\t\t\tvar av string\n\t\t\t\t\t\t\tif err := json.Unmarshal(b, &av); err != nil {\n\t\t\t\t\t\t\t\tpanic(\"unsupported type for board_ids field entry: \" + reflect.TypeOf(ae).String())\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tna = append(na, av)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tfmt.Println(reflect.TypeOf(val).String())\n\t\t\t\t\tpanic(\"unsupported type for board_ids field\")\n\t\t\t\t}\n\t\t\t}\n\t\t\to.BoardIds = na\n\t\t}\n\t}\n\tif o.BoardIds == nil {\n\t\to.BoardIds = make([]string, 0)\n\t}\n\n\tif o == nil {\n\n\t\to.Columns = make([]SprintColumns, 0)\n\n\t}\n\tif val, ok := kv[\"columns\"]; ok {\n\t\tif sv, ok := val.([]SprintColumns); ok {\n\t\t\to.Columns = sv\n\t\t} else if sp, ok := val.([]*SprintColumns); ok {\n\t\t\to.Columns = o.Columns[:0]\n\t\t\tfor _, e := range sp {\n\t\t\t\to.Columns = append(o.Columns, *e)\n\t\t\t}\n\t\t} else if a, ok := val.(primitive.A); ok {\n\t\t\tfor _, ae := range a {\n\t\t\t\tif av, ok := ae.(SprintColumns); ok {\n\t\t\t\t\to.Columns = append(o.Columns, av)\n\t\t\t\t} else if av, ok := ae.(primitive.M); ok {\n\t\t\t\t\tvar fm SprintColumns\n\t\t\t\t\tfm.FromMap(av)\n\t\t\t\t\to.Columns = append(o.Columns, fm)\n\t\t\t\t} else {\n\t\t\t\t\tb, _ := json.Marshal(ae)\n\t\t\t\t\tbkv := make(map[string]interface{})\n\t\t\t\t\tjson.Unmarshal(b, &bkv)\n\t\t\t\t\tvar av SprintColumns\n\t\t\t\t\tav.FromMap(bkv)\n\t\t\t\t\to.Columns = append(o.Columns, av)\n\t\t\t\t}\n\t\t\t}\n\t\t} else if arr, ok := val.([]interface{}); ok {\n\t\t\tfor _, item := range arr {\n\t\t\t\tif r, ok := item.(SprintColumns); ok {\n\t\t\t\t\to.Columns = append(o.Columns, r)\n\t\t\t\t} else if r, ok := item.(map[string]interface{}); ok {\n\t\t\t\t\tvar fm SprintColumns\n\t\t\t\t\tfm.FromMap(r)\n\t\t\t\t\to.Columns = append(o.Columns, fm)\n\t\t\t\t} else if r, ok := item.(primitive.M); ok {\n\t\t\t\t\tfm := SprintColumns{}\n\t\t\t\t\tfm.FromMap(r)\n\t\t\t\t\to.Columns = append(o.Columns, fm)\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tarr := reflect.ValueOf(val)\n\t\t\tif arr.Kind() == reflect.Slice {\n\t\t\t\tfor i := 0; i < arr.Len(); i++ {\n\t\t\t\t\titem := arr.Index(i)\n\t\t\t\t\tif item.CanAddr() {\n\t\t\t\t\t\tv := item.Addr().MethodByName(\"ToMap\")\n\t\t\t\t\t\tif !v.IsNil() {\n\t\t\t\t\t\t\tm := v.Call([]reflect.Value{})\n\t\t\t\t\t\t\tvar fm SprintColumns\n\t\t\t\t\t\t\tfm.FromMap(m[0].Interface().(map[string]interface{}))\n\t\t\t\t\t\t\to.Columns = append(o.Columns, fm)\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 o.CompletedDate == nil {\n\t\to.CompletedDate = &SprintCompletedDate{}\n\t}\n\n\tif val, ok := kv[\"completed_date\"]; ok {\n\t\tif kv, ok := val.(map[string]interface{}); ok {\n\t\t\to.CompletedDate.FromMap(kv)\n\t\t} else if sv, ok := val.(SprintCompletedDate); ok {\n\t\t\t// struct\n\t\t\to.CompletedDate = &sv\n\t\t} else if sp, ok := val.(*SprintCompletedDate); ok {\n\t\t\t// struct pointer\n\t\t\to.CompletedDate = sp\n\t\t} else if dt, ok := val.(*datetime.Date); ok && dt != nil {\n\t\t\to.CompletedDate.Epoch = dt.Epoch\n\t\t\to.CompletedDate.Rfc3339 = dt.Rfc3339\n\t\t\to.CompletedDate.Offset = dt.Offset\n\t\t} else if tv, ok := val.(time.Time); ok && !tv.IsZero() {\n\t\t\tdt := datetime.NewDateWithTime(tv)\n\t\t\to.CompletedDate.Epoch = dt.Epoch\n\t\t\to.CompletedDate.Rfc3339 = dt.Rfc3339\n\t\t\to.CompletedDate.Offset = dt.Offset\n\t\t} else if s, ok := val.(string); ok && s != \"\" {\n\t\t\tdt, err := datetime.NewDate(s)\n\t\t\tif err == nil {\n\t\t\t\to.CompletedDate.Epoch = dt.Epoch\n\t\t\t\to.CompletedDate.Rfc3339 = dt.Rfc3339\n\t\t\t\to.CompletedDate.Offset = dt.Offset\n\t\t\t}\n\t\t}\n\t} else {\n\t\to.CompletedDate.FromMap(map[string]interface{}{})\n\t}\n\n\tif val, ok := kv[\"deleted\"].(*bool); ok {\n\t\to.Deleted = val\n\t} else if val, ok := kv[\"deleted\"].(bool); ok {\n\t\to.Deleted = &val\n\t} else {\n\t\tif val, ok := kv[\"deleted\"]; ok {\n\t\t\tif val == nil {\n\t\t\t\to.Deleted = nil\n\t\t\t} else {\n\t\t\t\t// if coming in as map, convert it back\n\t\t\t\tif kv, ok := val.(map[string]interface{}); ok {\n\t\t\t\t\tval = kv[\"bool\"]\n\t\t\t\t}\n\t\t\t\to.Deleted = number.BoolPointer(number.ToBoolAny(val))\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.EndedDate == nil {\n\t\to.EndedDate = &SprintEndedDate{}\n\t}\n\n\tif val, ok := kv[\"ended_date\"]; ok {\n\t\tif kv, ok := val.(map[string]interface{}); ok {\n\t\t\to.EndedDate.FromMap(kv)\n\t\t} else if sv, ok := val.(SprintEndedDate); ok {\n\t\t\t// struct\n\t\t\to.EndedDate = &sv\n\t\t} else if sp, ok := val.(*SprintEndedDate); ok {\n\t\t\t// struct pointer\n\t\t\to.EndedDate = sp\n\t\t} else if dt, ok := val.(*datetime.Date); ok && dt != nil {\n\t\t\to.EndedDate.Epoch = dt.Epoch\n\t\t\to.EndedDate.Rfc3339 = dt.Rfc3339\n\t\t\to.EndedDate.Offset = dt.Offset\n\t\t} else if tv, ok := val.(time.Time); ok && !tv.IsZero() {\n\t\t\tdt := datetime.NewDateWithTime(tv)\n\t\t\to.EndedDate.Epoch = dt.Epoch\n\t\t\to.EndedDate.Rfc3339 = dt.Rfc3339\n\t\t\to.EndedDate.Offset = dt.Offset\n\t\t} else if s, ok := val.(string); ok && s != \"\" {\n\t\t\tdt, err := datetime.NewDate(s)\n\t\t\tif err == nil {\n\t\t\t\to.EndedDate.Epoch = dt.Epoch\n\t\t\t\to.EndedDate.Rfc3339 = dt.Rfc3339\n\t\t\t\to.EndedDate.Offset = dt.Offset\n\t\t\t}\n\t\t}\n\t} else {\n\t\to.EndedDate.FromMap(map[string]interface{}{})\n\t}\n\n\tif val, ok := kv[\"goal\"].(*string); ok {\n\t\to.Goal = val\n\t} else if val, ok := kv[\"goal\"].(string); ok {\n\t\to.Goal = &val\n\t} else {\n\t\tif val, ok := kv[\"goal\"]; ok {\n\t\t\tif val == nil {\n\t\t\t\to.Goal = pstrings.Pointer(\"\")\n\t\t\t} else {\n\t\t\t\t// if coming in as map, convert it back\n\t\t\t\tif kv, ok := val.(map[string]interface{}); ok {\n\t\t\t\t\tval = kv[\"string\"]\n\t\t\t\t}\n\t\t\t\to.Goal = pstrings.Pointer(fmt.Sprintf(\"%v\", val))\n\t\t\t}\n\t\t}\n\t}\n\tif val, ok := kv[\"issue_ids\"]; ok {\n\t\tif val != nil {\n\t\t\tna := make([]string, 0)\n\t\t\tif a, ok := val.([]string); ok {\n\t\t\t\tna = append(na, a...)\n\t\t\t} else {\n\t\t\t\tif a, ok := val.([]interface{}); ok {\n\t\t\t\t\tfor _, ae := range a {\n\t\t\t\t\t\tif av, ok := ae.(string); ok {\n\t\t\t\t\t\t\tna = append(na, av)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif badMap, ok := ae.(map[interface{}]interface{}); ok {\n\t\t\t\t\t\t\t\tae = slice.ConvertToStringToInterface(badMap)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tb, _ := json.Marshal(ae)\n\t\t\t\t\t\t\tvar av string\n\t\t\t\t\t\t\tif err := json.Unmarshal(b, &av); err != nil {\n\t\t\t\t\t\t\t\tpanic(\"unsupported type for issue_ids field entry: \" + reflect.TypeOf(ae).String())\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tna = append(na, av)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else if s, ok := val.(string); ok {\n\t\t\t\t\tfor _, sv := range strings.Split(s, \",\") {\n\t\t\t\t\t\tna = append(na, strings.TrimSpace(sv))\n\t\t\t\t\t}\n\t\t\t\t} else if a, ok := val.(primitive.A); ok {\n\t\t\t\t\tfor _, ae := range a {\n\t\t\t\t\t\tif av, ok := ae.(string); ok {\n\t\t\t\t\t\t\tna = append(na, av)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tb, _ := json.Marshal(ae)\n\t\t\t\t\t\t\tvar av string\n\t\t\t\t\t\t\tif err := json.Unmarshal(b, &av); err != nil {\n\t\t\t\t\t\t\t\tpanic(\"unsupported type for issue_ids field entry: \" + reflect.TypeOf(ae).String())\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tna = append(na, av)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tfmt.Println(reflect.TypeOf(val).String())\n\t\t\t\t\tpanic(\"unsupported type for issue_ids field\")\n\t\t\t\t}\n\t\t\t}\n\t\t\to.IssueIds = na\n\t\t}\n\t}\n\tif o.IssueIds == nil {\n\t\to.IssueIds = make([]string, 0)\n\t}\n\tif val, ok := kv[\"name\"].(*string); ok {\n\t\to.Name = val\n\t} else if val, ok := kv[\"name\"].(string); ok {\n\t\to.Name = &val\n\t} else {\n\t\tif val, ok := kv[\"name\"]; ok {\n\t\t\tif val == nil {\n\t\t\t\to.Name = pstrings.Pointer(\"\")\n\t\t\t} else {\n\t\t\t\t// if coming in as map, convert it back\n\t\t\t\tif kv, ok := val.(map[string]interface{}); ok {\n\t\t\t\t\tval = kv[\"string\"]\n\t\t\t\t}\n\t\t\t\to.Name = pstrings.Pointer(fmt.Sprintf(\"%v\", val))\n\t\t\t}\n\t\t}\n\t}\n\tif val, ok := kv[\"project_ids\"]; ok {\n\t\tif val != nil {\n\t\t\tna := make([]string, 0)\n\t\t\tif a, ok := val.([]string); ok {\n\t\t\t\tna = append(na, a...)\n\t\t\t} else {\n\t\t\t\tif a, ok := val.([]interface{}); ok {\n\t\t\t\t\tfor _, ae := range a {\n\t\t\t\t\t\tif av, ok := ae.(string); ok {\n\t\t\t\t\t\t\tna = append(na, av)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif badMap, ok := ae.(map[interface{}]interface{}); ok {\n\t\t\t\t\t\t\t\tae = slice.ConvertToStringToInterface(badMap)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tb, _ := json.Marshal(ae)\n\t\t\t\t\t\t\tvar av string\n\t\t\t\t\t\t\tif err := json.Unmarshal(b, &av); err != nil {\n\t\t\t\t\t\t\t\tpanic(\"unsupported type for project_ids field entry: \" + reflect.TypeOf(ae).String())\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tna = append(na, av)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else if s, ok := val.(string); ok {\n\t\t\t\t\tfor _, sv := range strings.Split(s, \",\") {\n\t\t\t\t\t\tna = append(na, strings.TrimSpace(sv))\n\t\t\t\t\t}\n\t\t\t\t} else if a, ok := val.(primitive.A); ok {\n\t\t\t\t\tfor _, ae := range a {\n\t\t\t\t\t\tif av, ok := ae.(string); ok {\n\t\t\t\t\t\t\tna = append(na, av)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tb, _ := json.Marshal(ae)\n\t\t\t\t\t\t\tvar av string\n\t\t\t\t\t\t\tif err := json.Unmarshal(b, &av); err != nil {\n\t\t\t\t\t\t\t\tpanic(\"unsupported type for project_ids field entry: \" + reflect.TypeOf(ae).String())\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tna = append(na, av)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tfmt.Println(reflect.TypeOf(val).String())\n\t\t\t\t\tpanic(\"unsupported type for project_ids field\")\n\t\t\t\t}\n\t\t\t}\n\t\t\to.ProjectIds = na\n\t\t}\n\t}\n\tif o.ProjectIds == nil {\n\t\to.ProjectIds = make([]string, 0)\n\t}\n\n\tif o.StartedDate == nil {\n\t\to.StartedDate = &SprintStartedDate{}\n\t}\n\n\tif val, ok := kv[\"started_date\"]; ok {\n\t\tif kv, ok := val.(map[string]interface{}); ok {\n\t\t\to.StartedDate.FromMap(kv)\n\t\t} else if sv, ok := val.(SprintStartedDate); ok {\n\t\t\t// struct\n\t\t\to.StartedDate = &sv\n\t\t} else if sp, ok := val.(*SprintStartedDate); ok {\n\t\t\t// struct pointer\n\t\t\to.StartedDate = sp\n\t\t} else if dt, ok := val.(*datetime.Date); ok && dt != nil {\n\t\t\to.StartedDate.Epoch = dt.Epoch\n\t\t\to.StartedDate.Rfc3339 = dt.Rfc3339\n\t\t\to.StartedDate.Offset = dt.Offset\n\t\t} else if tv, ok := val.(time.Time); ok && !tv.IsZero() {\n\t\t\tdt := datetime.NewDateWithTime(tv)\n\t\t\to.StartedDate.Epoch = dt.Epoch\n\t\t\to.StartedDate.Rfc3339 = dt.Rfc3339\n\t\t\to.StartedDate.Offset = dt.Offset\n\t\t} else if s, ok := val.(string); ok && s != \"\" {\n\t\t\tdt, err := datetime.NewDate(s)\n\t\t\tif err == nil {\n\t\t\t\to.StartedDate.Epoch = dt.Epoch\n\t\t\t\to.StartedDate.Rfc3339 = dt.Rfc3339\n\t\t\t\to.StartedDate.Offset = dt.Offset\n\t\t\t}\n\t\t}\n\t} else {\n\t\to.StartedDate.FromMap(map[string]interface{}{})\n\t}\n\n\tif val, ok := kv[\"status\"].(*SprintStatus); ok {\n\t\to.Status = val\n\t} else if val, ok := kv[\"status\"].(SprintStatus); ok {\n\t\to.Status = &val\n\t} else {\n\t\tif val, ok := kv[\"status\"]; ok {\n\t\t\tif val == nil {\n\t\t\t\to.Status = toSprintStatusPointer(0)\n\t\t\t} else {\n\t\t\t\t// if coming in as map, convert it back\n\t\t\t\tif kv, ok := val.(map[string]interface{}); ok {\n\t\t\t\t\tval = kv[\"SprintStatus\"]\n\t\t\t\t}\n\t\t\t\t// this is an enum pointer\n\t\t\t\tif em, ok := val.(string); ok {\n\t\t\t\t\tswitch em {\n\t\t\t\t\tcase \"active\", \"ACTIVE\":\n\t\t\t\t\t\to.Status = toSprintStatusPointer(0)\n\t\t\t\t\tcase \"future\", \"FUTURE\":\n\t\t\t\t\t\to.Status = toSprintStatusPointer(1)\n\t\t\t\t\tcase \"closed\", \"CLOSED\":\n\t\t\t\t\t\to.Status = toSprintStatusPointer(2)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif o.UpdatedDate == nil {\n\t\to.UpdatedDate = &SprintUpdatedDate{}\n\t}\n\n\tif val, ok := kv[\"updated_date\"]; ok {\n\t\tif kv, ok := val.(map[string]interface{}); ok {\n\t\t\to.UpdatedDate.FromMap(kv)\n\t\t} else if sv, ok := val.(SprintUpdatedDate); ok {\n\t\t\t// struct\n\t\t\to.UpdatedDate = &sv\n\t\t} else if sp, ok := val.(*SprintUpdatedDate); ok {\n\t\t\t// struct pointer\n\t\t\to.UpdatedDate = sp\n\t\t} else if dt, ok := val.(*datetime.Date); ok && dt != nil {\n\t\t\to.UpdatedDate.Epoch = dt.Epoch\n\t\t\to.UpdatedDate.Rfc3339 = dt.Rfc3339\n\t\t\to.UpdatedDate.Offset = dt.Offset\n\t\t} else if tv, ok := val.(time.Time); ok && !tv.IsZero() {\n\t\t\tdt := datetime.NewDateWithTime(tv)\n\t\t\to.UpdatedDate.Epoch = dt.Epoch\n\t\t\to.UpdatedDate.Rfc3339 = dt.Rfc3339\n\t\t\to.UpdatedDate.Offset = dt.Offset\n\t\t} else if s, ok := val.(string); ok && s != \"\" {\n\t\t\tdt, err := datetime.NewDate(s)\n\t\t\tif err == nil {\n\t\t\t\to.UpdatedDate.Epoch = dt.Epoch\n\t\t\t\to.UpdatedDate.Rfc3339 = dt.Rfc3339\n\t\t\t\to.UpdatedDate.Offset = dt.Offset\n\t\t\t}\n\t\t}\n\t} else {\n\t\to.UpdatedDate.FromMap(map[string]interface{}{})\n\t}\n\n\tif val, ok := kv[\"url\"].(*string); ok {\n\t\to.URL = val\n\t} else if val, ok := kv[\"url\"].(string); ok {\n\t\to.URL = &val\n\t} else {\n\t\tif val, ok := kv[\"url\"]; ok {\n\t\t\tif val == nil {\n\t\t\t\to.URL = pstrings.Pointer(\"\")\n\t\t\t} else {\n\t\t\t\t// if coming in as map, convert it back\n\t\t\t\tif kv, ok := val.(map[string]interface{}); ok {\n\t\t\t\t\tval = kv[\"string\"]\n\t\t\t\t}\n\t\t\t\to.URL = pstrings.Pointer(fmt.Sprintf(\"%v\", val))\n\t\t\t}\n\t\t}\n\t}\n\to.setDefaults(false)\n}", "title": "" }, { "docid": "24f36f3ea94b810ce568ed14afa344a1", "score": "0.4075333", "text": "func (s *list) Map(f Action, newType interface{}, threadCount ...int) IStream {\n\ts.workerCount = getThreadCount(threadCount...)\n\n\ts.process()\n\n\tv := reflect.ValueOf(newType)\n\tkind := v.Kind()\n\ttypeOf := reflect.TypeOf(newType)\n\n\tif (s.kind == reflect.Slice || s.kind == reflect.Array) && (kind == reflect.Slice || kind == reflect.Array) {\n\t\treturn listToList(s, typeOf, f)\n\t} else if (s.kind == reflect.Slice || s.kind == reflect.Array) && kind == reflect.Map {\n\t\treturn listToMap(s, typeOf, f)\n\t} else {\n\t\tpanic(\"newType should be slice,array or map\")\n\t}\n\n\treturn s\n}", "title": "" }, { "docid": "a36e7f5aab0875da1c0d7420bff37abb", "score": "0.40732637", "text": "func (t *Task) Map() {\n\tif len(t.SegOpts) != 0 {\n\t\treturn\n\t}\n\tvar startFrame = t.StartFrame\n\tvar endFrame = t.EndFrame\n\tvar totalFrames = endFrame - startFrame + 1\n\tvar avgFrames = totalFrames / TaskSplitNum\n\tfor i := 0; i < TaskSplitNum; i++ {\n\t\tvar sOptions = new(SegmentOptions)\n\t\tsOptions.StartFrame = startFrame + (i * avgFrames)\n\t\tsOptions.FrameAt = sOptions.StartFrame\n\t\tif i == TaskSplitNum-1 {\n\t\t\tsOptions.EndFrame = endFrame\n\t\t} else {\n\t\t\tsOptions.EndFrame = sOptions.StartFrame + avgFrames - 1\n\t\t}\n\t\tt.SegOpts = append(t.SegOpts, sOptions)\n\t}\n}", "title": "" }, { "docid": "2051897a1d89448c97a35a68f6a53e5e", "score": "0.40672356", "text": "func (s StringSlice) Map(f func(string) string) []string {\n\tresult := make([]string, len(s), len(s))\n\tfor i, v := range s {\n\t\tresult[i] = f(v)\n\t}\n\treturn result\n}", "title": "" }, { "docid": "805ab5356edd0b66593d3c62fdc45b99", "score": "0.40660903", "text": "func (o DetectorModelOnInputPtrOutput) TransitionEvents() DetectorModelTransitionEventArrayOutput {\n\treturn o.ApplyT(func(v *DetectorModelOnInput) []DetectorModelTransitionEvent {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.TransitionEvents\n\t}).(DetectorModelTransitionEventArrayOutput)\n}", "title": "" }, { "docid": "100a9501739dd8a862cb5170831c2703", "score": "0.40583837", "text": "func (obj StateSetTransitionsAction) MarshalJSON() ([]byte, error) {\n\ttype Alias StateSetTransitionsAction\n\tdata, err := json.Marshal(struct {\n\t\tAction string `json:\"action\"`\n\t\t*Alias\n\t}{Action: \"setTransitions\", Alias: (*Alias)(&obj)})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\traw := make(map[string]interface{})\n\tif err := json.Unmarshal(data, &raw); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif raw[\"transitions\"] == nil {\n\t\tdelete(raw, \"transitions\")\n\t}\n\n\treturn json.Marshal(raw)\n\n}", "title": "" }, { "docid": "9779927c25c42e4a8e4f9d9436fd4a4c", "score": "0.40578705", "text": "func (pm *projectManager) Mutate(ctx context.Context, events eventbox.Events, s eventbox.State) (\n\t[]eventbox.Transition, error) {\n\ttr := &triageResult{}\n\tfor _, e := range events {\n\t\ttr.triage(ctx, e)\n\t}\n\treturn pm.mutate(ctx, tr, s.(*state))\n}", "title": "" }, { "docid": "067800f969b5e0ff0f29392e70c806aa", "score": "0.4050207", "text": "func Map[T1, T2 any](s []T1, f func(T1) T2) []T2 {\n\tr := make([]T2, len(s))\n\n\tfor i, v := range s {\n\t\tr[i] = f(v)\n\t}\n\n\treturn r\n}", "title": "" }, { "docid": "6ca5dd901c094868e91dd10a77b440c1", "score": "0.40272096", "text": "func TestConvertIngressControllerToMap(t *testing.T) {\n\n\tconvert := convertIngressControllerToMap(mockIngressControllerList().Items)\n\n\texpected := map[string]operatorv1.IngressController{\"example-domain\": mockIngressControllerList().Items[0], \"example-non-default-domain\": mockIngressControllerList().Items[1], \"example-domain-3\": mockIngressControllerList().Items[2]}\n\n\tequal := reflect.DeepEqual(convert, expected)\n\tif !equal {\n\t\tt.Errorf(\"got %v, expect %v \\n\", convert, expected)\n\t}\n}", "title": "" }, { "docid": "1bafea69f65b9dd125c3785b3be3e43a", "score": "0.40196872", "text": "func (m *Model) TransitionSeq() Label {\n\ti := 0\n\tfor {\n\t\tlabel := fmt.Sprintf(\"txn%v\", i)\n\t\tif m.Transitions[label] == nil {\n\t\t\treturn label\n\t\t} else {\n\t\t\ti++\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a8120a411b50b35c896fe914d84860da", "score": "0.40190578", "text": "func Mapping(src, dst any) error {\n\tbts, err := json.Marshal(src)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn Decode(bts, dst)\n}", "title": "" }, { "docid": "fb154a6e0d632eefdc88ca987984426d", "score": "0.40184933", "text": "func CycleMap(f, xs interface{}, n int) interface{} {\n\tchk := ty.Check(\n\t\tnew(func(func(ty.A) ty.B, []ty.A, int) []ty.B),\n\t\tf, xs, n)\n\tvp, vxs, tys := chk.Args[0], chk.Args[1], chk.Returns[0]\n\n\txsLen := vxs.Len()\n\tvys := reflect.MakeSlice(tys, xsLen*n, xsLen*n)\n\tfor t := 0; t < n; t++ {\n\t\tfor i := 0; i < xsLen; i++ {\n\t\t\tvy := call1(vp, vxs.Index(i))\n\t\t\tvys.Index(t*xsLen + i).Set(vy)\n\t\t}\n\t}\n\treturn vys.Interface()\n}", "title": "" }, { "docid": "bbec1778ccee63484a67f56c9322b33d", "score": "0.4010947", "text": "func (state *User) Transition(event interface{}) {\n\tswitch e := event.(type) {\n\tcase CreateUser:\n\t\tstate.Username = e.Username\n\t\tstate.Password = e.Password\n\t\tstate.Email = e.Email\n\t\tstate.AccessLevel = AccessLevelUser\n\n\tcase PromoteUser:\n\t\tif state.AccessLevel < AccessLevelAdmin {\n\t\t\tstate.AccessLevel += 1\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5b7a3aafe9ba5110a407aafe7143839a", "score": "0.40093315", "text": "func CreateStepSequence(src *[]string,\n\tresSteps *[]*State,\n\tapertl *list.List,\n\tregl *list.List,\n\tfSpec *FormatSpec) (NumberOfSteps int) {\n\n\tstepNumber := 1 // step number\n\tstepCompleted := true\n\t// create the root step with default properties\n\t(*resSteps)[0] = NewState()\n\t// process string by string\n\tvar step *State\n\tfor i, s := range *src {\n\t\tif stepCompleted == true {\n\t\t\t//\t\t\tstep = new(State)\n\t\t\tstep = NewState()\n\t\t\t//\t\t\t*step = *(*resSteps)[stepNumber-1]\n\t\t\tstep.CopyOfWithOffset((*resSteps)[stepNumber-1], 0, 0)\n\t\t\tstep.Coord = nil\n\t\t\tstep.PrevCoord = nil\n\t\t}\n\t\tcreateStepResult := step.CreateStep(&s, (*resSteps)[stepNumber-1], apertl, regl, i, fSpec)\n\t\tswitch createStepResult {\n\t\tcase SCResultNextString:\n\t\t\tfallthrough\n\t\tcase SCResultSkipString:\n\t\t\tstepCompleted = false\n\t\t\tcontinue\n\t\tcase SCResultStepCompleted:\n\t\t\tstep.PrevCoord = (*resSteps)[stepNumber-1].Coord\n\t\t\tstep.StepNumber = stepNumber\n\t\t\t(*resSteps)[stepNumber] = step\n\t\t\tstepNumber++\n\t\t\tstepCompleted = true\n\t\t\tcontinue\n\t\tcase SCResultStop:\n\t\t\tstep.StepNumber = stepNumber\n\t\t\t(*resSteps)[stepNumber] = step\n\t\t\tstep.Coord = (*resSteps)[stepNumber-1].Coord\n\t\t\tstepNumber++\n\t\t\tstepCompleted = true\n\t\t\tbreak\n\t\tdefault:\n\t\t\tbreak\n\t\t}\n\t\t//\t\tglog.Warningln(\"Still unknown command: \", s)\n\t} // end of input strings parsing\n\treturn stepNumber\n}", "title": "" }, { "docid": "4adbfb74af88bc31687a682c1eaaf6a2", "score": "0.40079936", "text": "func StrMap(args ...string) map[string]Unit {\n\tret := make(map[string]Unit)\n\tfor _, e := range args {\n\t\tret[e] = unit\n\t}\n\n\treturn ret\n}", "title": "" }, { "docid": "1b715d0b26cb3ad5906414b61454eb7c", "score": "0.4004079", "text": "func (v *Video) ConvertFromMap(data map[string]interface{}) *Video {\n\tif data != nil && len(data) > 0 {\n\t\tval := reflect.ValueOf(v).Elem()\n\t\tfor i := 0; i < val.NumField(); i++ {\n\t\t\tvalueField := val.Field(i)\n\t\t\ttypeField := val.Type().Field(i)\n\t\t\tif v, ok := data[strings.ToLower(typeField.Name)]; ok {\n\t\t\t\tvalueField.Set(reflect.ValueOf(v))\n\t\t\t}\n\t\t}\n\t}\n\treturn v\n}", "title": "" }, { "docid": "a307e3e667d3ca3365a4668c0a49bc68", "score": "0.40003368", "text": "func Map(slice, function interface{}) MapResult {\n\tvslice := reflect.ValueOf(slice)\n\n\tswitch vslice.Kind() {\n\tcase reflect.Array, reflect.Slice:\n\tdefault:\n\t\tpanic(\"input is not an array or slice\")\n\t}\n\n\ttfunction := reflect.TypeOf(function)\n\n\tif tfunction.Kind() != reflect.Func {\n\t\tpanic(\"function must be a func\")\n\t}\n\tif tfunction.NumIn() == 0 || tfunction.NumIn() > 3 {\n\t\tpanic(\"function must have at least 1 and at most 3 arguments\")\n\t}\n\tif tfunction.NumOut() != 1 && tfunction.NumOut() != 2 {\n\t\tpanic(\"function must have at least 1 and at most 2 outputs\")\n\t}\n\n\tret := reflect.MakeSlice(reflect.SliceOf(tfunction.Out(0)), 0, vslice.Len())\n\n\tif vslice.Len() == 0 {\n\t\treturn MapResult{val: ret}\n\t}\n\n\tidx := 0\n\n\tinput := make([]reflect.Value, tfunction.NumIn())\n\tfor i := 0; i < tfunction.NumIn(); i++ {\n\t\tswitch i {\n\t\tcase 0:\n\t\t\tinput[i] = vslice.Index(idx)\n\t\tcase 1:\n\t\t\tinput[i] = reflect.ValueOf(idx)\n\t\tcase 2:\n\t\t\tinput[i] = vslice\n\t\t}\n\t}\n\n\tfor i := idx; i < vslice.Len(); i++ {\n\t\tinput[0] = vslice.Index(i)\n\t\tif len(input) > 1 {\n\t\t\tinput[1] = reflect.ValueOf(i)\n\t\t}\n\n\t\tout := reflect.ValueOf(function).Call(input)\n\n\t\tswitch len(out) {\n\t\tcase 1:\n\t\t\tret = reflect.Append(ret, out[0])\n\t\tcase 2:\n\t\t\terr, ok := out[1].Interface().(error)\n\t\t\tif !ok {\n\t\t\t\treturn MapResult{err: errors.New(\"fp: function second output must be of error type\")}\n\t\t\t}\n\n\t\t\treturn MapResult{err: err}\n\t\tdefault:\n\t\t\treturn MapResult{err: errors.New(\"fp: function call return a number of outputs different from 1 or 2\")}\n\t\t}\n\t}\n\n\treturn MapResult{val: ret.Interface()}\n}", "title": "" }, { "docid": "a3eb85e8dbbf29ac60884bec2418ba52", "score": "0.39950493", "text": "func MapToDefibrillators(lines [][]string) (defibrillators []Defibrillator, err error) {\n\tdefibrillators = make([]Defibrillator, len(lines))\n\tfor i, line := range lines {\n\t\tdefib, err := DefibrillatorFromFields(line)\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\t\tdefibrillators[i] = *defib\n\t}\n\treturn\n}", "title": "" }, { "docid": "22ab89c75133deeec8684b0409d9184c", "score": "0.3990858", "text": "func StrSlicesMap(strarr []string, lambda func(s string) string) []string {\n\tresult := make([]string, len(strarr))\n\tfor i, elem := range strarr {\n\t\tresult[i] = lambda(elem)\n\t}\n\treturn result\n}", "title": "" }, { "docid": "f477b49862379ae606ad5ceff7d875b5", "score": "0.39881605", "text": "func (rmF *Factory) FromResourceSlice(ress []*resource.Resource) ResMap {\n\tm, err := newResMapFromResourceSlice(ress)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "fc5d157eb04e804b63ed073dafb01fdf", "score": "0.39858213", "text": "func Map(filename string, contents string) []KeyValue {\n\treturn Task3Map(filename, contents)\n}", "title": "" }, { "docid": "1168e7fef3b1a39b4ea060c84213e20e", "score": "0.39853725", "text": "func convertAndSetMap(ptr interface{}, value string) {\n\t// settableValue := reflect.ValueOf(ptr).Elem()\n\n\t// tmp := map[string]interface{}{}\n\t// _ = json.Unmarshal(value.([]byte), tmp) // @TODO: err\n\n\t// settableValue.Set(tmp)\n\n\t_ = json.Unmarshal([]byte(value), ptr) // @TODO: err\n}", "title": "" }, { "docid": "4ceb4048cc88dc4df7ba5db83078538a", "score": "0.39809135", "text": "func (o ObservableInt) SwitchMapString(project func(int) ObservableString) ObservableString {\n\treturn o.MapObservableString(project).SwitchAll()\n}", "title": "" }, { "docid": "c3ab191fef84617dee0587540180edbd", "score": "0.3978952", "text": "func MapInt8Str(f func(int8) string, list []int8) []string {\n\tif f == nil {\n\t\treturn []string{}\n\t}\n\tnewList := make([]string, len(list))\n\tfor i, v := range list {\n\t\tnewList[i] = f(v)\n\t}\n\treturn newList\n}", "title": "" }, { "docid": "938957730309b7bb6f0e68d76b79765e", "score": "0.3973811", "text": "func Map(slice, mapFunc interface{}) interface{} {\n\tsliceVal := reflect.ValueOf(slice)\n\tfuncVal := reflect.ValueOf(mapFunc)\n\n\tif sliceVal.Kind() != reflect.Slice {\n\t\tpanic(\"First argument must be a slice\")\n\t}\n\n\tif funcVal.Kind() != reflect.Func {\n\t\tpanic(\"Second argument must be a func\")\n\t}\n\n\telemType := reflect.TypeOf(slice).Elem()\n\tif isValidMapFunc(funcVal, elemType) == false {\n\t\tpanic(fmt.Sprintf(\"mapFunc must receive one parameter with type %s and return a value\", elemType.Name()))\n\t}\n\n\tfuncReturnType := funcVal.Type().Out(0)\n\n\tresult := reflect.MakeSlice(reflect.SliceOf(funcReturnType), sliceVal.Len(), sliceVal.Len())\n\tmapParams := [1]reflect.Value{}\n\tfor i := 0; i < result.Len(); i++ {\n\t\tmapParams[0] = sliceVal.Index(i)\n\t\tresult.Index(i).Set(funcVal.Call(mapParams[:])[0])\n\t}\n\n\treturn result.Interface()\n}", "title": "" } ]
4eb271179414cea13d22eda2df679e63
Custom marshaller to add the resourceType property, as required by the specification
[ { "docid": "30ebefd275a065109609c3379dd01756", "score": "0.0", "text": "func (resource *MessageHeader) MarshalJSON() ([]byte, error) {\n\tresource.ResourceType = \"MessageHeader\"\n\t// Dereferencing the pointer to avoid infinite recursion.\n\t// Passing in plain old x (a pointer to MessageHeader), would cause this same\n\t// MarshallJSON function to be called again\n\treturn json.Marshal(*resource)\n}", "title": "" } ]
[ { "docid": "7a209247a35a73bfd9d43e35d81c827d", "score": "0.69336486", "text": "func (a ApplicationTypeResource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"etag\", a.Etag)\n\tpopulate(objectMap, \"id\", a.ID)\n\tpopulate(objectMap, \"location\", a.Location)\n\tpopulate(objectMap, \"name\", a.Name)\n\tpopulate(objectMap, \"properties\", a.Properties)\n\tpopulate(objectMap, \"systemData\", a.SystemData)\n\tpopulate(objectMap, \"tags\", a.Tags)\n\tpopulate(objectMap, \"type\", a.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "8c125bc15dedfb8e23eb434178b4d007", "score": "0.68766475", "text": "func (a ApplicationTypeVersionResource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"etag\", a.Etag)\n\tpopulate(objectMap, \"id\", a.ID)\n\tpopulate(objectMap, \"location\", a.Location)\n\tpopulate(objectMap, \"name\", a.Name)\n\tpopulate(objectMap, \"properties\", a.Properties)\n\tpopulate(objectMap, \"systemData\", a.SystemData)\n\tpopulate(objectMap, \"tags\", a.Tags)\n\tpopulate(objectMap, \"type\", a.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "53b696137b8802a903845c5593af100b", "score": "0.6840871", "text": "func (w WidgetTypeResourceFormat) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", w.ID)\n\tpopulate(objectMap, \"name\", w.Name)\n\tpopulate(objectMap, \"properties\", w.Properties)\n\tpopulate(objectMap, \"type\", w.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "997f78314f549ad621a2230eb45a4e99", "score": "0.6700121", "text": "func (rt ResourceType) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif rt.ID != nil {\n\t\tobjectMap[\"id\"] = rt.ID\n\t}\n\tif rt.Location != nil {\n\t\tobjectMap[\"location\"] = rt.Location\n\t}\n\tif rt.Name != nil {\n\t\tobjectMap[\"name\"] = rt.Name\n\t}\n\tif rt.Type != nil {\n\t\tobjectMap[\"type\"] = rt.Type\n\t}\n\tif rt.Tags != nil {\n\t\tobjectMap[\"tags\"] = rt.Tags\n\t}\n\tif rt.Properties != nil {\n\t\tobjectMap[\"properties\"] = rt.Properties\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "752c7f9b9f74169e782498e478b397cb", "score": "0.6626398", "text": "func (r ResourceType) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"displayName\", r.DisplayName)\n\tpopulate(objectMap, \"name\", r.Name)\n\tpopulate(objectMap, \"operations\", r.Operations)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "752c7f9b9f74169e782498e478b397cb", "score": "0.6626398", "text": "func (r ResourceType) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"displayName\", r.DisplayName)\n\tpopulate(objectMap, \"name\", r.Name)\n\tpopulate(objectMap, \"operations\", r.Operations)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "efa94fce90058606806db3aaad72852b", "score": "0.6586811", "text": "func (resource *Binary) MarshalJSON() ([]byte, error) {\n\tresource.ResourceType = \"Binary\"\n\t// Dereferencing the pointer to avoid infinite recursion.\n\t// Passing in plain old x (a pointer to Binary), would cause this same\n\t// MarshallJSON function to be called again\n\treturn json.Marshal(*resource)\n}", "title": "" }, { "docid": "cfef45251edc93912babbb54f8c2c82c", "score": "0.6577962", "text": "func (c ConnectorResourceFormat) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", c.ID)\n\tpopulate(objectMap, \"name\", c.Name)\n\tpopulate(objectMap, \"properties\", c.Properties)\n\tpopulate(objectMap, \"type\", c.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "e6d194a0127bedf6973239c148d585b0", "score": "0.6573264", "text": "func (c ConnectorMappingResourceFormat) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", c.ID)\n\tpopulate(objectMap, \"name\", c.Name)\n\tpopulate(objectMap, \"properties\", c.Properties)\n\tpopulate(objectMap, \"type\", c.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "582e317d11d7410a7b9e55df92570edf", "score": "0.65375775", "text": "func (r Resource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif r.Identity != nil {\n\t\tobjectMap[\"identity\"] = r.Identity\n\t}\n\tif r.Location != nil {\n\t\tobjectMap[\"location\"] = r.Location\n\t}\n\tif r.Tags != nil {\n\t\tobjectMap[\"tags\"] = r.Tags\n\t}\n\tif r.Sku != nil {\n\t\tobjectMap[\"sku\"] = r.Sku\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "e7edbbf069039a3d63b36cba66296070", "score": "0.6523069", "text": "func (a ApplicationTypeVersionResourceProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"appPackageUrl\", a.AppPackageURL)\n\tpopulate(objectMap, \"defaultParameterList\", a.DefaultParameterList)\n\tpopulate(objectMap, \"provisioningState\", a.ProvisioningState)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "d01df5cfe06a9a73d344cf431711b155", "score": "0.65075463", "text": "func (r Resource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif r.Kind != \"\" {\n\t\tobjectMap[\"kind\"] = r.Kind\n\t}\n\tif r.Location != nil {\n\t\tobjectMap[\"location\"] = r.Location\n\t}\n\tif r.Tags != nil {\n\t\tobjectMap[\"tags\"] = r.Tags\n\t}\n\tif r.Etag != nil {\n\t\tobjectMap[\"etag\"] = r.Etag\n\t}\n\tif r.Identity != nil {\n\t\tobjectMap[\"identity\"] = r.Identity\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "14bbcff9c76ff9aef08e4d59ee0d87fb", "score": "0.6453812", "text": "func (o ServiceDefinitionV1Resource) MarshalJSON() ([]byte, error) {\n\ttoSerialize := map[string]interface{}{}\n\tif o.UnparsedObject != nil {\n\t\treturn json.Marshal(o.UnparsedObject)\n\t}\n\ttoSerialize[\"name\"] = o.Name\n\ttoSerialize[\"type\"] = o.Type\n\ttoSerialize[\"url\"] = o.Url\n\n\tfor key, value := range o.AdditionalProperties {\n\t\ttoSerialize[key] = value\n\t}\n\treturn json.Marshal(toSerialize)\n}", "title": "" }, { "docid": "084562d4f5832a87fce0075d37bf2073", "score": "0.64435595", "text": "func (resource *ConceptMap) MarshalJSON() ([]byte, error) {\n\tresource.ResourceType = \"ConceptMap\"\n\t// Dereferencing the pointer to avoid infinite recursion.\n\t// Passing in plain old x (a pointer to ConceptMap), would cause this same\n\t// MarshallJSON function to be called again\n\treturn json.Marshal(*resource)\n}", "title": "" }, { "docid": "b66dc1f1bef5bc407c41de086a0d8fe6", "score": "0.6436617", "text": "func (obj TypeResourceIdentifier) MarshalJSON() ([]byte, error) {\n\ttype Alias TypeResourceIdentifier\n\treturn json.Marshal(struct {\n\t\tTypeID string `json:\"typeId\"`\n\t\t*Alias\n\t}{TypeID: \"type\", Alias: (*Alias)(&obj)})\n}", "title": "" }, { "docid": "840a52375f55256f95f6516a0b70f365", "score": "0.64314324", "text": "func (r Resource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif r.Location != nil {\n\t\tobjectMap[\"location\"] = r.Location\n\t}\n\tif r.Sku != nil {\n\t\tobjectMap[\"sku\"] = r.Sku\n\t}\n\tif r.Zones != nil {\n\t\tobjectMap[\"zones\"] = r.Zones\n\t}\n\tif r.Tags != nil {\n\t\tobjectMap[\"tags\"] = r.Tags\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "49433591cf4599c032733c544fdf13a0", "score": "0.6422735", "text": "func (b BackupResourceEncryptionConfigExtendedResource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"eTag\", b.ETag)\n\tpopulate(objectMap, \"id\", b.ID)\n\tpopulate(objectMap, \"location\", b.Location)\n\tpopulate(objectMap, \"name\", b.Name)\n\tpopulate(objectMap, \"properties\", b.Properties)\n\tpopulate(objectMap, \"tags\", b.Tags)\n\tpopulate(objectMap, \"type\", b.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "5e28415b2c7501a96334f16d0076c4d5", "score": "0.639318", "text": "func (resource *RelatedPerson) MarshalJSON() ([]byte, error) {\n\tresource.ResourceType = \"RelatedPerson\"\n\t// Dereferencing the pointer to avoid infinite recursion.\n\t// Passing in plain old x (a pointer to RelatedPerson), would cause this same\n\t// MarshallJSON function to be called again\n\treturn json.Marshal(*resource)\n}", "title": "" }, { "docid": "31271b15ea52274f305a61ab34cc0834", "score": "0.63859206", "text": "func (resource *Observation) MarshalJSON() ([]byte, error) {\n\tresource.ResourceType = \"Observation\"\n\t// Dereferencing the pointer to avoid infinite recursion.\n\t// Passing in plain old x (a pointer to Observation), would cause this same\n\t// MarshallJSON function to be called again\n\treturn json.Marshal(*resource)\n}", "title": "" }, { "docid": "8688b784548d6c6378bfd432c5556a7f", "score": "0.63817555", "text": "func (resource *DocumentManifest) MarshalJSON() ([]byte, error) {\n\tresource.ResourceType = \"DocumentManifest\"\n\t// Dereferencing the pointer to avoid infinite recursion.\n\t// Passing in plain old x (a pointer to DocumentManifest), would cause this same\n\t// MarshallJSON function to be called again\n\treturn json.Marshal(*resource)\n}", "title": "" }, { "docid": "c2211740712259016a8086d22914848b", "score": "0.6374412", "text": "func (b BackupResourceVaultConfigResource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"eTag\", b.ETag)\n\tpopulate(objectMap, \"id\", b.ID)\n\tpopulate(objectMap, \"location\", b.Location)\n\tpopulate(objectMap, \"name\", b.Name)\n\tpopulate(objectMap, \"properties\", b.Properties)\n\tpopulate(objectMap, \"tags\", b.Tags)\n\tpopulate(objectMap, \"type\", b.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "e376d130825466fe7db810a48839cf4a", "score": "0.63620317", "text": "func (er EndpointResource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tobjectMap[\"properties\"] = er.Properties\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "410bd9323dfff4036187ce84dcba2eb4", "score": "0.63591266", "text": "func (k KpiResourceFormat) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", k.ID)\n\tpopulate(objectMap, \"name\", k.Name)\n\tpopulate(objectMap, \"properties\", k.Properties)\n\tpopulate(objectMap, \"type\", k.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "194713ea9dce904ef1dc7e91b59fb317", "score": "0.6359035", "text": "func (v ViewResourceFormat) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", v.ID)\n\tpopulate(objectMap, \"name\", v.Name)\n\tpopulate(objectMap, \"properties\", v.Properties)\n\tpopulate(objectMap, \"type\", v.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "07e7ddfd7f024c62cdaa66e33c190e3f", "score": "0.63578576", "text": "func (r Resource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", r.ID)\n\tpopulate(objectMap, \"location\", r.Location)\n\tpopulate(objectMap, \"name\", r.Name)\n\tpopulate(objectMap, \"sku\", r.SKU)\n\tpopulate(objectMap, \"tags\", r.Tags)\n\tpopulate(objectMap, \"type\", r.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "9e89bc88fc6189cc2e4c1698e6ba38a5", "score": "0.6350361", "text": "func (r Resource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif r.Location != nil {\n\t\tobjectMap[\"location\"] = r.Location\n\t}\n\tif r.Tags != nil {\n\t\tobjectMap[\"tags\"] = r.Tags\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "9e89bc88fc6189cc2e4c1698e6ba38a5", "score": "0.6350361", "text": "func (r Resource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif r.Location != nil {\n\t\tobjectMap[\"location\"] = r.Location\n\t}\n\tif r.Tags != nil {\n\t\tobjectMap[\"tags\"] = r.Tags\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "3b2497fe8e5ed83905d547f1238b953d", "score": "0.6345253", "text": "func (b BackupEngineBaseResource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"eTag\", b.ETag)\n\tpopulate(objectMap, \"id\", b.ID)\n\tpopulate(objectMap, \"location\", b.Location)\n\tpopulate(objectMap, \"name\", b.Name)\n\tpopulate(objectMap, \"properties\", b.Properties)\n\tpopulate(objectMap, \"tags\", b.Tags)\n\tpopulate(objectMap, \"type\", b.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "1c1b3e2b7619e269154f326015533f30", "score": "0.63435304", "text": "func (r Resource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", r.ID)\n\tpopulate(objectMap, \"name\", r.Name)\n\tpopulate(objectMap, \"systemData\", r.SystemData)\n\tpopulate(objectMap, \"type\", r.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "1c1b3e2b7619e269154f326015533f30", "score": "0.63435304", "text": "func (r Resource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", r.ID)\n\tpopulate(objectMap, \"name\", r.Name)\n\tpopulate(objectMap, \"systemData\", r.SystemData)\n\tpopulate(objectMap, \"type\", r.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "1c1b3e2b7619e269154f326015533f30", "score": "0.63435304", "text": "func (r Resource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", r.ID)\n\tpopulate(objectMap, \"name\", r.Name)\n\tpopulate(objectMap, \"systemData\", r.SystemData)\n\tpopulate(objectMap, \"type\", r.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "4a7e81adfd73c6090be947b3cec2f51a", "score": "0.6339338", "text": "func (rmwaps ResourceModelWithAllowedPropertySetIdentity) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif rmwaps.Type != \"\" {\n\t\tobjectMap[\"type\"] = rmwaps.Type\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "84a170ee4e3a09d28980b2e78ac2e02d", "score": "0.63389045", "text": "func (r Resource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif r.ID != nil {\n\t\tobjectMap[\"id\"] = r.ID\n\t}\n\tif r.Name != nil {\n\t\tobjectMap[\"name\"] = r.Name\n\t}\n\tif r.Type != nil {\n\t\tobjectMap[\"type\"] = r.Type\n\t}\n\tif r.Location != nil {\n\t\tobjectMap[\"location\"] = r.Location\n\t}\n\tif r.Tags != nil {\n\t\tobjectMap[\"tags\"] = r.Tags\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "84a170ee4e3a09d28980b2e78ac2e02d", "score": "0.63389045", "text": "func (r Resource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif r.ID != nil {\n\t\tobjectMap[\"id\"] = r.ID\n\t}\n\tif r.Name != nil {\n\t\tobjectMap[\"name\"] = r.Name\n\t}\n\tif r.Type != nil {\n\t\tobjectMap[\"type\"] = r.Type\n\t}\n\tif r.Location != nil {\n\t\tobjectMap[\"location\"] = r.Location\n\t}\n\tif r.Tags != nil {\n\t\tobjectMap[\"tags\"] = r.Tags\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "84a170ee4e3a09d28980b2e78ac2e02d", "score": "0.63389045", "text": "func (r Resource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif r.ID != nil {\n\t\tobjectMap[\"id\"] = r.ID\n\t}\n\tif r.Name != nil {\n\t\tobjectMap[\"name\"] = r.Name\n\t}\n\tif r.Type != nil {\n\t\tobjectMap[\"type\"] = r.Type\n\t}\n\tif r.Location != nil {\n\t\tobjectMap[\"location\"] = r.Location\n\t}\n\tif r.Tags != nil {\n\t\tobjectMap[\"tags\"] = r.Tags\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "84a170ee4e3a09d28980b2e78ac2e02d", "score": "0.63389045", "text": "func (r Resource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif r.ID != nil {\n\t\tobjectMap[\"id\"] = r.ID\n\t}\n\tif r.Name != nil {\n\t\tobjectMap[\"name\"] = r.Name\n\t}\n\tif r.Type != nil {\n\t\tobjectMap[\"type\"] = r.Type\n\t}\n\tif r.Location != nil {\n\t\tobjectMap[\"location\"] = r.Location\n\t}\n\tif r.Tags != nil {\n\t\tobjectMap[\"tags\"] = r.Tags\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "84a170ee4e3a09d28980b2e78ac2e02d", "score": "0.63389045", "text": "func (r Resource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif r.ID != nil {\n\t\tobjectMap[\"id\"] = r.ID\n\t}\n\tif r.Name != nil {\n\t\tobjectMap[\"name\"] = r.Name\n\t}\n\tif r.Type != nil {\n\t\tobjectMap[\"type\"] = r.Type\n\t}\n\tif r.Location != nil {\n\t\tobjectMap[\"location\"] = r.Location\n\t}\n\tif r.Tags != nil {\n\t\tobjectMap[\"tags\"] = r.Tags\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "84a170ee4e3a09d28980b2e78ac2e02d", "score": "0.63389045", "text": "func (r Resource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif r.ID != nil {\n\t\tobjectMap[\"id\"] = r.ID\n\t}\n\tif r.Name != nil {\n\t\tobjectMap[\"name\"] = r.Name\n\t}\n\tif r.Type != nil {\n\t\tobjectMap[\"type\"] = r.Type\n\t}\n\tif r.Location != nil {\n\t\tobjectMap[\"location\"] = r.Location\n\t}\n\tif r.Tags != nil {\n\t\tobjectMap[\"tags\"] = r.Tags\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "52626e02d1a153c1f33c9b89d2f277d9", "score": "0.6334374", "text": "func (sr ServiceResource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tobjectMap[\"properties\"] = sr.Properties\n\tif sr.Identity != nil {\n\t\tobjectMap[\"identity\"] = sr.Identity\n\t}\n\tif sr.Location != nil {\n\t\tobjectMap[\"location\"] = sr.Location\n\t}\n\tif sr.Tags != nil {\n\t\tobjectMap[\"tags\"] = sr.Tags\n\t}\n\tif sr.Sku != nil {\n\t\tobjectMap[\"sku\"] = sr.Sku\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "d8a9fd9166ee5f6241d8956034617102", "score": "0.6330573", "text": "func (r Resource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", r.ID)\n\tpopulate(objectMap, \"location\", r.Location)\n\tpopulate(objectMap, \"name\", r.Name)\n\tpopulate(objectMap, \"systemData\", r.SystemData)\n\tpopulate(objectMap, \"tags\", r.Tags)\n\tpopulate(objectMap, \"type\", r.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "36d7c7d3d23a31e1c3b0c934de0cc3b4", "score": "0.6328036", "text": "func (cr ComputeResource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tobjectMap[\"properties\"] = cr.Properties\n\tif cr.Identity != nil {\n\t\tobjectMap[\"identity\"] = cr.Identity\n\t}\n\tif cr.Location != nil {\n\t\tobjectMap[\"location\"] = cr.Location\n\t}\n\tif cr.Tags != nil {\n\t\tobjectMap[\"tags\"] = cr.Tags\n\t}\n\tif cr.Sku != nil {\n\t\tobjectMap[\"sku\"] = cr.Sku\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "a2b7ccac95678676a31202c6741c8640", "score": "0.6317953", "text": "func (resource *StructureDefinition) MarshalJSON() ([]byte, error) {\n\tresource.ResourceType = \"StructureDefinition\"\n\t// Dereferencing the pointer to avoid infinite recursion.\n\t// Passing in plain old x (a pointer to StructureDefinition), would cause this same\n\t// MarshallJSON function to be called again\n\treturn json.Marshal(*resource)\n}", "title": "" }, { "docid": "c0c4d758faf444f04c1d7134d8c09193", "score": "0.6308327", "text": "func (m MemoryUtilizationResultSingletonResourceProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tobjectMap[\"analysisResultType\"] = AnalysisResultTypeMemoryUtilization\n\tpopulate(objectMap, \"grade\", m.Grade)\n\tpopulate(objectMap, \"memoryUtilizationResults\", m.MemoryUtilizationResults)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "9af192a9f7ff7780949b47434832a5b2", "score": "0.63056284", "text": "func (r Resource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"id\", r.ID)\n\tpopulate(objectMap, \"location\", r.Location)\n\tpopulate(objectMap, \"name\", r.Name)\n\tpopulate(objectMap, \"sku\", r.SKU)\n\tpopulate(objectMap, \"tags\", r.Tags)\n\tpopulate(objectMap, \"type\", r.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "6bf79415b5317bfd2b812390523438b0", "score": "0.6301285", "text": "func (b BackupResourceConfigResource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"eTag\", b.ETag)\n\tpopulate(objectMap, \"id\", b.ID)\n\tpopulate(objectMap, \"location\", b.Location)\n\tpopulate(objectMap, \"name\", b.Name)\n\tpopulate(objectMap, \"properties\", b.Properties)\n\tpopulate(objectMap, \"tags\", b.Tags)\n\tpopulate(objectMap, \"type\", b.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "b2ba86e6b4844da88af0960fdd281bb1", "score": "0.6300318", "text": "func (r ResourceGuardProxyBaseResource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"eTag\", r.ETag)\n\tpopulate(objectMap, \"id\", r.ID)\n\tpopulate(objectMap, \"location\", r.Location)\n\tpopulate(objectMap, \"name\", r.Name)\n\tpopulate(objectMap, \"properties\", r.Properties)\n\tpopulate(objectMap, \"tags\", r.Tags)\n\tpopulate(objectMap, \"type\", r.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "2017a78588482a403b17cdbf4c29feff", "score": "0.62948066", "text": "func (resource *OperationOutcome) MarshalJSON() ([]byte, error) {\n\tresource.ResourceType = \"OperationOutcome\"\n\t// Dereferencing the pointer to avoid infinite recursion.\n\t// Passing in plain old x (a pointer to OperationOutcome), would cause this same\n\t// MarshallJSON function to be called again\n\treturn json.Marshal(*resource)\n}", "title": "" }, { "docid": "28d3644ed4f3e77f48230464d660a596", "score": "0.6294661", "text": "func (m MonitorResource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", m.ID)\n\tpopulate(objectMap, \"identity\", m.Identity)\n\tpopulate(objectMap, \"location\", m.Location)\n\tpopulate(objectMap, \"name\", m.Name)\n\tpopulate(objectMap, \"properties\", m.Properties)\n\tpopulate(objectMap, \"systemData\", m.SystemData)\n\tpopulate(objectMap, \"tags\", m.Tags)\n\tpopulate(objectMap, \"type\", m.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "0111f12d26507771234bf3ad14368916", "score": "0.6294021", "text": "func (r Resource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif r.SystemData != nil {\n\t\tobjectMap[\"systemData\"] = r.SystemData\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "56f52420e71d8470e2c76e247177fcce", "score": "0.62936485", "text": "func (r Resource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", r.ID)\n\tpopulate(objectMap, \"name\", r.Name)\n\tpopulate(objectMap, \"type\", r.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "56f52420e71d8470e2c76e247177fcce", "score": "0.62936485", "text": "func (r Resource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", r.ID)\n\tpopulate(objectMap, \"name\", r.Name)\n\tpopulate(objectMap, \"type\", r.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "56f52420e71d8470e2c76e247177fcce", "score": "0.62936485", "text": "func (r Resource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", r.ID)\n\tpopulate(objectMap, \"name\", r.Name)\n\tpopulate(objectMap, \"type\", r.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "56f52420e71d8470e2c76e247177fcce", "score": "0.62936485", "text": "func (r Resource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", r.ID)\n\tpopulate(objectMap, \"name\", r.Name)\n\tpopulate(objectMap, \"type\", r.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "56f52420e71d8470e2c76e247177fcce", "score": "0.62936485", "text": "func (r Resource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", r.ID)\n\tpopulate(objectMap, \"name\", r.Name)\n\tpopulate(objectMap, \"type\", r.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "56f52420e71d8470e2c76e247177fcce", "score": "0.62936485", "text": "func (r Resource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", r.ID)\n\tpopulate(objectMap, \"name\", r.Name)\n\tpopulate(objectMap, \"type\", r.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "103fabcf575fa687696c9912d6529e16", "score": "0.6290832", "text": "func (p ProfileResourceFormat) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", p.ID)\n\tpopulate(objectMap, \"name\", p.Name)\n\tpopulate(objectMap, \"properties\", p.Properties)\n\tpopulate(objectMap, \"type\", p.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "05dc4e39c46857e736d8831f37bbbbc5", "score": "0.62828845", "text": "func (resource *ValueSet) MarshalJSON() ([]byte, error) {\n\tresource.ResourceType = \"ValueSet\"\n\t// Dereferencing the pointer to avoid infinite recursion.\n\t// Passing in plain old x (a pointer to ValueSet), would cause this same\n\t// MarshallJSON function to be called again\n\treturn json.Marshal(*resource)\n}", "title": "" }, { "docid": "bac23e49c60d03d648c6884a41c2eb8f", "score": "0.6281252", "text": "func (nr NamespaceResource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif nr.ID != nil {\n\t\tobjectMap[\"id\"] = nr.ID\n\t}\n\tif nr.Location != nil {\n\t\tobjectMap[\"location\"] = nr.Location\n\t}\n\tif nr.Name != nil {\n\t\tobjectMap[\"name\"] = nr.Name\n\t}\n\tif nr.Type != nil {\n\t\tobjectMap[\"type\"] = nr.Type\n\t}\n\tif nr.Tags != nil {\n\t\tobjectMap[\"tags\"] = nr.Tags\n\t}\n\tif nr.Properties != nil {\n\t\tobjectMap[\"properties\"] = nr.Properties\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "444f20ad75e2a0c825ff8a4db154c1d5", "score": "0.6280703", "text": "func (m MarketplaceSaaSResourceDetailsRequest) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"tenantId\", m.TenantID)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "24fae1ae8786edc3d5f9505c96532b57", "score": "0.6277086", "text": "func (t TrackedResource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", t.ID)\n\tpopulate(objectMap, \"location\", t.Location)\n\tpopulate(objectMap, \"name\", t.Name)\n\tpopulate(objectMap, \"sku\", t.SKU)\n\tpopulate(objectMap, \"tags\", t.Tags)\n\tpopulate(objectMap, \"type\", t.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "4640a7c512d38d06d625927add2bb18f", "score": "0.6276382", "text": "func (p ProxyOnlyResource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", p.ID)\n\tpopulate(objectMap, \"name\", p.Name)\n\tpopulate(objectMap, \"type\", p.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "4dc26347bcd7f0b2c93a12b54f29cf64", "score": "0.6272702", "text": "func (r Resource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif r.ID != nil {\n\t\tobjectMap[\"id\"] = r.ID\n\t}\n\tif r.Name != nil {\n\t\tobjectMap[\"name\"] = r.Name\n\t}\n\tif r.Type != nil {\n\t\tobjectMap[\"type\"] = r.Type\n\t}\n\tif r.Location != nil {\n\t\tobjectMap[\"location\"] = r.Location\n\t}\n\tif r.Tags != nil {\n\t\tobjectMap[\"tags\"] = r.Tags\n\t}\n\tif r.Etag != nil {\n\t\tobjectMap[\"etag\"] = r.Etag\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "049c38f31f28ee74f4655f078dfb0429", "score": "0.6272241", "text": "func (i InteractionResourceFormat) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", i.ID)\n\tpopulate(objectMap, \"name\", i.Name)\n\tpopulate(objectMap, \"properties\", i.Properties)\n\tpopulate(objectMap, \"type\", i.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "afee6205561c844aa7e4d1ff0e0151c2", "score": "0.62717277", "text": "func (t TrackedResource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", t.ID)\n\tpopulate(objectMap, \"location\", t.Location)\n\tpopulate(objectMap, \"name\", t.Name)\n\tpopulate(objectMap, \"systemData\", t.SystemData)\n\tpopulate(objectMap, \"tags\", t.Tags)\n\tpopulate(objectMap, \"type\", t.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "afee6205561c844aa7e4d1ff0e0151c2", "score": "0.62717277", "text": "func (t TrackedResource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", t.ID)\n\tpopulate(objectMap, \"location\", t.Location)\n\tpopulate(objectMap, \"name\", t.Name)\n\tpopulate(objectMap, \"systemData\", t.SystemData)\n\tpopulate(objectMap, \"tags\", t.Tags)\n\tpopulate(objectMap, \"type\", t.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "9920e7f659570648d5611a58992d5a2f", "score": "0.6265609", "text": "func (sr ServiceResource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif sr.Location != nil {\n\t\tobjectMap[\"location\"] = sr.Location\n\t}\n\tif sr.Tags != nil {\n\t\tobjectMap[\"tags\"] = sr.Tags\n\t}\n\tif sr.ServiceProperties != nil {\n\t\tobjectMap[\"properties\"] = sr.ServiceProperties\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "3a28f8ca0c8e95ec70604fa69a277115", "score": "0.6263366", "text": "func (r Resource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", r.ID)\n\tpopulate(objectMap, \"location\", r.Location)\n\tpopulate(objectMap, \"name\", r.Name)\n\tpopulate(objectMap, \"tags\", r.Tags)\n\tpopulate(objectMap, \"type\", r.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "ae1aef4362686f4c15cb2b6fc87d0a75", "score": "0.6261373", "text": "func (resource *Practitioner) MarshalJSON() ([]byte, error) {\n\tresource.ResourceType = \"Practitioner\"\n\t// Dereferencing the pointer to avoid infinite recursion.\n\t// Passing in plain old x (a pointer to Practitioner), would cause this same\n\t// MarshallJSON function to be called again\n\treturn json.Marshal(*resource)\n}", "title": "" }, { "docid": "1cbc6e97306d45292725da9dcbd986f9", "score": "0.6248028", "text": "func (tr TrackedResource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif tr.Location != nil {\n\t\tobjectMap[\"location\"] = tr.Location\n\t}\n\tif tr.Tags != nil {\n\t\tobjectMap[\"tags\"] = tr.Tags\n\t}\n\tif tr.ID != nil {\n\t\tobjectMap[\"id\"] = tr.ID\n\t}\n\tif tr.Name != nil {\n\t\tobjectMap[\"name\"] = tr.Name\n\t}\n\tif tr.Type != nil {\n\t\tobjectMap[\"type\"] = tr.Type\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "5d980925fde58280effdbfc10ee9bc22", "score": "0.62478155", "text": "func (resource *NamingSystem) MarshalJSON() ([]byte, error) {\n\tresource.ResourceType = \"NamingSystem\"\n\t// Dereferencing the pointer to avoid infinite recursion.\n\t// Passing in plain old x (a pointer to NamingSystem), would cause this same\n\t// MarshallJSON function to be called again\n\treturn json.Marshal(*resource)\n}", "title": "" }, { "docid": "4dffdfc21c732ac13c02a005e93cea08", "score": "0.6245988", "text": "func (a ApplicationResource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"etag\", a.Etag)\n\tpopulate(objectMap, \"id\", a.ID)\n\tpopulate(objectMap, \"identity\", a.Identity)\n\tpopulate(objectMap, \"location\", a.Location)\n\tpopulate(objectMap, \"name\", a.Name)\n\tpopulate(objectMap, \"properties\", a.Properties)\n\tpopulate(objectMap, \"systemData\", a.SystemData)\n\tpopulate(objectMap, \"tags\", a.Tags)\n\tpopulate(objectMap, \"type\", a.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "00f46f0cefea458bac0ef52238db724f", "score": "0.6245381", "text": "func (a AnalysisResultSingletonResource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"id\", a.ID)\n\tpopulate(objectMap, \"name\", a.Name)\n\tpopulate(objectMap, \"properties\", a.Properties)\n\tpopulate(objectMap, \"systemData\", a.SystemData)\n\tpopulate(objectMap, \"type\", a.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "c0116273519cf3875d3027860175a609", "score": "0.6245", "text": "func (t TrackedResource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"id\", t.ID)\n\tpopulate(objectMap, \"location\", t.Location)\n\tpopulate(objectMap, \"name\", t.Name)\n\tpopulate(objectMap, \"systemData\", t.SystemData)\n\tpopulate(objectMap, \"tags\", t.Tags)\n\tpopulate(objectMap, \"type\", t.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "7960ff50981cda9424000b439c997b52", "score": "0.62448096", "text": "func (t TrackedResource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"id\", t.ID)\n\tpopulate(objectMap, \"location\", t.Location)\n\tpopulate(objectMap, \"name\", t.Name)\n\tpopulate(objectMap, \"sku\", t.SKU)\n\tpopulate(objectMap, \"tags\", t.Tags)\n\tpopulate(objectMap, \"type\", t.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "42ce15fe5b757458b2a127a92e69670c", "score": "0.6240679", "text": "func (a AuthorizationPolicyResourceFormat) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", a.ID)\n\tpopulate(objectMap, \"name\", a.Name)\n\tpopulate(objectMap, \"properties\", a.Properties)\n\tpopulate(objectMap, \"type\", a.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "5df12f830a958660f7f17d257281b1bd", "score": "0.62320757", "text": "func (resource *Device) MarshalJSON() ([]byte, error) {\n\tresource.ResourceType = \"Device\"\n\t// Dereferencing the pointer to avoid infinite recursion.\n\t// Passing in plain old x (a pointer to Device), would cause this same\n\t// MarshallJSON function to be called again\n\treturn json.Marshal(*resource)\n}", "title": "" }, { "docid": "f34d047f340555b1fabac6ca69efba69", "score": "0.62314284", "text": "func (tr TrackedResource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif tr.Location != nil {\n\t\tobjectMap[\"location\"] = tr.Location\n\t}\n\tif tr.Tags != nil {\n\t\tobjectMap[\"tags\"] = tr.Tags\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "025875acff0a61df7ac49173b84e920a", "score": "0.6227275", "text": "func (r Resource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", r.ID)\n\tpopulate(objectMap, \"location\", r.Location)\n\tpopulate(objectMap, \"name\", r.Name)\n\tpopulate(objectMap, \"sku\", r.SKU)\n\tpopulate(objectMap, \"tags\", r.Tags)\n\tpopulate(objectMap, \"type\", r.Type)\n\tpopulate(objectMap, \"zones\", r.Zones)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "cb2d8b22699d549a8facb45904d729fd", "score": "0.6227256", "text": "func (resource *HealthcareService) MarshalJSON() ([]byte, error) {\n\tresource.ResourceType = \"HealthcareService\"\n\t// Dereferencing the pointer to avoid infinite recursion.\n\t// Passing in plain old x (a pointer to HealthcareService), would cause this same\n\t// MarshallJSON function to be called again\n\treturn json.Marshal(*resource)\n}", "title": "" }, { "docid": "c89a3a4a770886e76159853a75187b9b", "score": "0.62249994", "text": "func (r Resource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"eTag\", r.ETag)\n\tpopulate(objectMap, \"id\", r.ID)\n\tpopulate(objectMap, \"location\", r.Location)\n\tpopulate(objectMap, \"name\", r.Name)\n\tpopulate(objectMap, \"tags\", r.Tags)\n\tpopulate(objectMap, \"type\", r.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "e8f62d35d252be36fa82a89f9c6cfdad", "score": "0.6224808", "text": "func (rmwaps ResourceModelWithAllowedPropertySet) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif rmwaps.Location != nil {\n\t\tobjectMap[\"location\"] = rmwaps.Location\n\t}\n\tif rmwaps.ManagedBy != nil {\n\t\tobjectMap[\"managedBy\"] = rmwaps.ManagedBy\n\t}\n\tif rmwaps.Kind != nil {\n\t\tobjectMap[\"kind\"] = rmwaps.Kind\n\t}\n\tif rmwaps.Tags != nil {\n\t\tobjectMap[\"tags\"] = rmwaps.Tags\n\t}\n\tif rmwaps.Identity != nil {\n\t\tobjectMap[\"identity\"] = rmwaps.Identity\n\t}\n\tif rmwaps.Sku != nil {\n\t\tobjectMap[\"sku\"] = rmwaps.Sku\n\t}\n\tif rmwaps.Plan != nil {\n\t\tobjectMap[\"plan\"] = rmwaps.Plan\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "55984af02aae73b8fdd4eec6ed74bbee", "score": "0.62245744", "text": "func (o OperationResultInfoBaseResource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"headers\", o.Headers)\n\tpopulate(objectMap, \"operation\", o.Operation)\n\tpopulate(objectMap, \"statusCode\", o.StatusCode)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "1a64d7b5c31cab848a968244fb538f0b", "score": "0.622147", "text": "func (erp EndpointResourceProperties) MarshalJSON() ([]byte, error) {\n\terp.EndpointType = EndpointTypeDigitalTwinsEndpointResourceProperties\n\tobjectMap := make(map[string]interface{})\n\tif erp.DeadLetterSecret != nil {\n\t\tobjectMap[\"deadLetterSecret\"] = erp.DeadLetterSecret\n\t}\n\tif erp.EndpointType != \"\" {\n\t\tobjectMap[\"endpointType\"] = erp.EndpointType\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "7302a0a43573ff9466543aeb58b11004", "score": "0.6221369", "text": "func (r Resource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"etag\", r.Etag)\n\tpopulate(objectMap, \"id\", r.ID)\n\tpopulate(objectMap, \"location\", r.Location)\n\tpopulate(objectMap, \"name\", r.Name)\n\tpopulate(objectMap, \"systemData\", r.SystemData)\n\tpopulate(objectMap, \"tags\", r.Tags)\n\tpopulate(objectMap, \"type\", r.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "d39f2d288fb70a78e6d51da525fa0162", "score": "0.6221364", "text": "func (t TrackedResource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", t.ID)\n\tpopulate(objectMap, \"location\", t.Location)\n\tpopulate(objectMap, \"name\", t.Name)\n\tpopulate(objectMap, \"tags\", t.Tags)\n\tpopulate(objectMap, \"type\", t.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "d39f2d288fb70a78e6d51da525fa0162", "score": "0.6221364", "text": "func (t TrackedResource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", t.ID)\n\tpopulate(objectMap, \"location\", t.Location)\n\tpopulate(objectMap, \"name\", t.Name)\n\tpopulate(objectMap, \"tags\", t.Tags)\n\tpopulate(objectMap, \"type\", t.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "d39f2d288fb70a78e6d51da525fa0162", "score": "0.6221364", "text": "func (t TrackedResource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", t.ID)\n\tpopulate(objectMap, \"location\", t.Location)\n\tpopulate(objectMap, \"name\", t.Name)\n\tpopulate(objectMap, \"tags\", t.Tags)\n\tpopulate(objectMap, \"type\", t.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "d39f2d288fb70a78e6d51da525fa0162", "score": "0.6221364", "text": "func (t TrackedResource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", t.ID)\n\tpopulate(objectMap, \"location\", t.Location)\n\tpopulate(objectMap, \"name\", t.Name)\n\tpopulate(objectMap, \"tags\", t.Tags)\n\tpopulate(objectMap, \"type\", t.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "0a7bcccba148455b040196293b104986", "score": "0.6213447", "text": "func (tr TrackedResource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif tr.Tags != nil {\n\t\tobjectMap[\"tags\"] = tr.Tags\n\t}\n\tif tr.Location != nil {\n\t\tobjectMap[\"location\"] = tr.Location\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "0a7bcccba148455b040196293b104986", "score": "0.6213447", "text": "func (tr TrackedResource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif tr.Tags != nil {\n\t\tobjectMap[\"tags\"] = tr.Tags\n\t}\n\tif tr.Location != nil {\n\t\tobjectMap[\"location\"] = tr.Location\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "0a7bcccba148455b040196293b104986", "score": "0.6213447", "text": "func (tr TrackedResource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif tr.Tags != nil {\n\t\tobjectMap[\"tags\"] = tr.Tags\n\t}\n\tif tr.Location != nil {\n\t\tobjectMap[\"location\"] = tr.Location\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "0a7bcccba148455b040196293b104986", "score": "0.6213447", "text": "func (tr TrackedResource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif tr.Tags != nil {\n\t\tobjectMap[\"tags\"] = tr.Tags\n\t}\n\tif tr.Location != nil {\n\t\tobjectMap[\"location\"] = tr.Location\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "0a7bcccba148455b040196293b104986", "score": "0.6213447", "text": "func (tr TrackedResource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif tr.Tags != nil {\n\t\tobjectMap[\"tags\"] = tr.Tags\n\t}\n\tif tr.Location != nil {\n\t\tobjectMap[\"location\"] = tr.Location\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "0a7bcccba148455b040196293b104986", "score": "0.6213447", "text": "func (tr TrackedResource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif tr.Tags != nil {\n\t\tobjectMap[\"tags\"] = tr.Tags\n\t}\n\tif tr.Location != nil {\n\t\tobjectMap[\"location\"] = tr.Location\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "6eab4b6c1fa0dfe16a263205ebaeeb1f", "score": "0.62098736", "text": "func (resource *Account) MarshalJSON() ([]byte, error) {\n\tresource.ResourceType = \"Account\"\n\t// Dereferencing the pointer to avoid infinite recursion.\n\t// Passing in plain old x (a pointer to Account), would cause this same\n\t// MarshallJSON function to be called again\n\treturn json.Marshal(*resource)\n}", "title": "" }, { "docid": "a0806f42bba61b63189af9a7efd70080", "score": "0.6209487", "text": "func (c CPUUtilizationResultSingletonResourceProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tobjectMap[\"analysisResultType\"] = AnalysisResultTypeCPUUtilization\n\tpopulate(objectMap, \"cpuUtilizationResults\", c.CPUUtilizationResults)\n\tpopulate(objectMap, \"grade\", c.Grade)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "cde1b28668c76709cc289a1c8cb8796d", "score": "0.62052923", "text": "func (r RelationshipResourceFormat) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", r.ID)\n\tpopulate(objectMap, \"name\", r.Name)\n\tpopulate(objectMap, \"properties\", r.Properties)\n\tpopulate(objectMap, \"type\", r.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "c4361287865c1998225ba78d3a4e310e", "score": "0.6195588", "text": "func (tr TrackedResource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tif tr.Tags != nil {\n\t\tobjectMap[\"tags\"] = tr.Tags\n\t}\n\tif tr.Location != nil {\n\t\tobjectMap[\"location\"] = tr.Location\n\t}\n\tif tr.ID != nil {\n\t\tobjectMap[\"id\"] = tr.ID\n\t}\n\tif tr.Name != nil {\n\t\tobjectMap[\"name\"] = tr.Name\n\t}\n\tif tr.Type != nil {\n\t\tobjectMap[\"type\"] = tr.Type\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "d1b52ed2214078091d7cdb769bc839b1", "score": "0.61954904", "text": "func (r RecoveryPointResource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"eTag\", r.ETag)\n\tpopulate(objectMap, \"id\", r.ID)\n\tpopulate(objectMap, \"location\", r.Location)\n\tpopulate(objectMap, \"name\", r.Name)\n\tpopulate(objectMap, \"properties\", r.Properties)\n\tpopulate(objectMap, \"tags\", r.Tags)\n\tpopulate(objectMap, \"type\", r.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "3cf7a84d3fb7088a4efef64dcf9130a9", "score": "0.61930287", "text": "func (resource *Invoice) MarshalJSON() ([]byte, error) {\n\tresource.ResourceType = \"Invoice\"\n\t// Dereferencing the pointer to avoid infinite recursion.\n\t// Passing in plain old x (a pointer to Invoice), would cause this same\n\t// MarshallJSON function to be called again\n\treturn json.Marshal(*resource)\n}", "title": "" }, { "docid": "c2b08e7226db8b2b3fbc9d8ecdc10cbc", "score": "0.6190087", "text": "func (t TrackedResource) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"id\", t.ID)\n\tpopulate(objectMap, \"location\", t.Location)\n\tpopulate(objectMap, \"name\", t.Name)\n\tpopulate(objectMap, \"tags\", t.Tags)\n\tpopulate(objectMap, \"type\", t.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" } ]
b619dffcab8372ca5694651066634a10
BalanceOf is a free data retrieval call binding the contract method 0x70a08231. Solidity: function balanceOf(_owner address) constant returns(balance uint256)
[ { "docid": "bafef27a535c53a114998ff90ca0380e", "score": "0.79731816", "text": "func (_PausableToken *PausableTokenCallerSession) BalanceOf(_owner common.Address) (*big.Int, error) {\n\treturn _PausableToken.Contract.BalanceOf(&_PausableToken.CallOpts, _owner)\n}", "title": "" } ]
[ { "docid": "f767b63b75160dc77f18dadebeb9dbac", "score": "0.8415227", "text": "func (_ReserveDollarV2 *ReserveDollarV2Caller) BalanceOf(opts *bind.CallOpts, holder common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ReserveDollarV2.contract.Call(opts, out, \"balanceOf\", holder)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "f70ba83236480558f38f6f18179beb74", "score": "0.8406113", "text": "func (_SmartToken *SmartTokenCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _SmartToken.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "3b06377a3d0cc920c27a133eb1ce0a71", "score": "0.8403745", "text": "func (_DebtEngine *DebtEngineCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _DebtEngine.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "672f13d64335ea13b435f0970e2aea59", "score": "0.8329534", "text": "func (_Token *TokenCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _Token.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "672f13d64335ea13b435f0970e2aea59", "score": "0.8329534", "text": "func (_Token *TokenCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _Token.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "ad77232f8fcbdfa914fd9bec7c674cf5", "score": "0.83213556", "text": "func (_PausableToken *PausableTokenCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _PausableToken.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "52ad71911fad8d0b63edeecaff37a716", "score": "0.83169854", "text": "func (_ReserveDollarV2 *ReserveDollarV2CallerSession) BalanceOf(holder common.Address) (*big.Int, error) {\n\treturn _ReserveDollarV2.Contract.BalanceOf(&_ReserveDollarV2.CallOpts, holder)\n}", "title": "" }, { "docid": "d27fc701ee29651918ad6a3e01f5b380", "score": "0.8283084", "text": "func (_WindMineToken *WindMineTokenCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _WindMineToken.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "08b64960828ebe3eec1004c653f10e37", "score": "0.8257447", "text": "func (_StandardToken *StandardTokenCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _StandardToken.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "08b64960828ebe3eec1004c653f10e37", "score": "0.8257447", "text": "func (_StandardToken *StandardTokenCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _StandardToken.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "e9fac8e6eaa8de358011d9ceff35c8d2", "score": "0.8254411", "text": "func (_Cerc20 *Cerc20Caller) BalanceOf(opts *bind.CallOpts, owner common.Address) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _Cerc20.contract.Call(opts, &out, \"balanceOf\", owner)\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": "61b311ceafc35334dda5052da0e1aa7b", "score": "0.8244364", "text": "func (_DisputeCrowdsourcer *DisputeCrowdsourcerCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _DisputeCrowdsourcer.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "e4424f2f415a1fa847dd21e29d3f03b5", "score": "0.8237306", "text": "func (_DebtEngine *DebtEngineCallerSession) BalanceOf(_owner common.Address) (*big.Int, error) {\n\treturn _DebtEngine.Contract.BalanceOf(&_DebtEngine.CallOpts, _owner)\n}", "title": "" }, { "docid": "4c587dcea1f6687118a5acd08aacc8f9", "score": "0.8227822", "text": "func (_BasicToken *BasicTokenCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _BasicToken.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "4c587dcea1f6687118a5acd08aacc8f9", "score": "0.8227822", "text": "func (_BasicToken *BasicTokenCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _BasicToken.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "08601a002568a979a147adbfec750a4d", "score": "0.8224402", "text": "func (_ERC223TokenMock *ERC223TokenMockCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ERC223TokenMock.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "94eaa0b3a46abe153b3d45a2de5ab002", "score": "0.82178605", "text": "func (_PausableTokenMock *PausableTokenMockCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _PausableTokenMock.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "e5f38d3d0f85d39ff66e0ffb1d19a203", "score": "0.82151854", "text": "func (_DebtEngine *DebtEngineSession) BalanceOf(_owner common.Address) (*big.Int, error) {\n\treturn _DebtEngine.Contract.BalanceOf(&_DebtEngine.CallOpts, _owner)\n}", "title": "" }, { "docid": "ffa104286a42a5f18e242b931d0a9a6c", "score": "0.8207154", "text": "func (_Cash *CashCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _Cash.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "894e67899ea3b356564f66739a3fa18a", "score": "0.82063437", "text": "func (_NbcToken *NbcTokenCaller) BalanceOf(opts *bind.CallOpts, owner common.Address) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _NbcToken.contract.Call(opts, &out, \"balanceOf\", owner)\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": "60f6034bdfc9a7f34736bbbdc436ff48", "score": "0.82034", "text": "func (_ERC20Pausable *ERC20PausableCaller) BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ERC20Pausable.contract.Call(opts, out, \"balanceOf\", account)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "789b6045a266cd1542c27c94f38447d9", "score": "0.81989163", "text": "func (_StandardToken *StandardTokenCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _StandardToken.contract.Call(opts, &out, \"balanceOf\", _owner)\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": "fe5df32f16614f97874a463c015aa929", "score": "0.8197519", "text": "func (_Lobster *LobsterCaller) BalanceOf(opts *bind.CallOpts, owner common.Address) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _Lobster.contract.Call(opts, &out, \"balanceOf\", owner)\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": "6b6af0acb2bd00134db8a7efa77c5c6d", "score": "0.8191469", "text": "func (_Lobster *LobsterSession) BalanceOf(owner common.Address) (*big.Int, error) {\n\treturn _Lobster.Contract.BalanceOf(&_Lobster.CallOpts, owner)\n}", "title": "" }, { "docid": "b5f066cc1e8305175b88fb77fbef49fb", "score": "0.81894284", "text": "func (_Erc721 *Erc721Caller) BalanceOf(opts *bind.CallOpts, owner common.Address) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _Erc721.contract.Call(opts, &out, \"balanceOf\", owner)\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": "41eb9dbe86202a934043f2d7b5a0e7a0", "score": "0.81864095", "text": "func (_Token *TokenCaller) BalanceOf(opts *bind.CallOpts, a common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _Token.contract.Call(opts, out, \"balanceOf\", a)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "0ea0fe1456f3e83a96371d2c85608692", "score": "0.81782645", "text": "func (_Portalv3 *Portalv3Caller) BalanceOf(opts *bind.CallOpts, token common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _Portalv3.contract.Call(opts, out, \"balanceOf\", token)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "0dd4e40fc286c368fc408848d23ba563", "score": "0.8177908", "text": "func (_Jifen *JifenCallerSession) BalanceOf(arg0 [32]byte) (*big.Int, error) {\n\treturn _Jifen.Contract.BalanceOf(&_Jifen.CallOpts, arg0)\n}", "title": "" }, { "docid": "24909236f80ba626fbcc73e0d0b46c05", "score": "0.81751126", "text": "func (_StandaloneERC20 *StandaloneERC20Caller) BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _StandaloneERC20.contract.Call(opts, out, \"balanceOf\", account)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "8d48f2c04fe0c4d480a034e08d28a9b8", "score": "0.81657124", "text": "func (_Jifen *JifenSession) BalanceOf(arg0 [32]byte) (*big.Int, error) {\n\treturn _Jifen.Contract.BalanceOf(&_Jifen.CallOpts, arg0)\n}", "title": "" }, { "docid": "899a3369256007251d6425c9dd9f5222", "score": "0.81634176", "text": "func (_ReserveDollarV2 *ReserveDollarV2Session) BalanceOf(holder common.Address) (*big.Int, error) {\n\treturn _ReserveDollarV2.Contract.BalanceOf(&_ReserveDollarV2.CallOpts, holder)\n}", "title": "" }, { "docid": "3fbf20662aaa7b0d9ab0573e401f0583", "score": "0.81605655", "text": "func (_CappedToken *CappedTokenCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _CappedToken.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "d0976d5b6daf6865e0e7130ef713e40a", "score": "0.81585336", "text": "func (_Lobster *LobsterCallerSession) BalanceOf(owner common.Address) (*big.Int, error) {\n\treturn _Lobster.Contract.BalanceOf(&_Lobster.CallOpts, owner)\n}", "title": "" }, { "docid": "bde81cab1583d89e4a2d70856e5251f8", "score": "0.81584644", "text": "func (_Cerc20 *Cerc20CallerSession) BalanceOf(owner common.Address) (*big.Int, error) {\n\treturn _Cerc20.Contract.BalanceOf(&_Cerc20.CallOpts, owner)\n}", "title": "" }, { "docid": "43ff9281eb44a13c2314c46fd59c44d3", "score": "0.8155785", "text": "func (_Token *TokenCaller) BalanceOf(opts *bind.CallOpts, arg0 common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _Token.contract.Call(opts, out, \"balanceOf\", arg0)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "8ce1bbcb8b73487893ec3c9e20083e23", "score": "0.81516993", "text": "func (_BasicToken *BasicTokenCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _BasicToken.contract.Call(opts, &out, \"balanceOf\", _owner)\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": "3214387304edea1ee2aaed71d7a14423", "score": "0.81401485", "text": "func (_Cerc20 *Cerc20Session) BalanceOf(owner common.Address) (*big.Int, error) {\n\treturn _Cerc20.Contract.BalanceOf(&_Cerc20.CallOpts, owner)\n}", "title": "" }, { "docid": "6ce0f409c0c0121f933d0856def64b56", "score": "0.81300724", "text": "func (_ERC20Mintable *ERC20MintableCaller) BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ERC20Mintable.contract.Call(opts, out, \"balanceOf\", account)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "ef73b7baeff53cc4746a2d738a174ffa", "score": "0.81256175", "text": "func (_SmartToken *SmartTokenCallerSession) BalanceOf(_owner common.Address) (*big.Int, error) {\n\treturn _SmartToken.Contract.BalanceOf(&_SmartToken.CallOpts, _owner)\n}", "title": "" }, { "docid": "832c5ef88cf4db77af835508c016b248", "score": "0.8107195", "text": "func (_CWBTC *CWBTCSession) BalanceOf(owner common.Address) (*big.Int, error) {\n\treturn _CWBTC.Contract.BalanceOf(&_CWBTC.CallOpts, owner)\n}", "title": "" }, { "docid": "04d719bf4a7684de6520e78011b13180", "score": "0.8103688", "text": "func (_SampleCrowdsaleToken *SampleCrowdsaleTokenCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _SampleCrowdsaleToken.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "26f1655ffd2897788bfa3e8789b53a36", "score": "0.8089623", "text": "func (_Token *TokenCaller) BalanceOf(opts *bind.CallOpts, tokenHolder common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _Token.contract.Call(opts, out, \"balanceOf\", tokenHolder)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "5f962feafccb8c35be19d425d23ae65c", "score": "0.80811596", "text": "func (_Token *TokenCaller) BalanceOf(opts *bind.CallOpts, arg0 common.Address) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _Token.contract.Call(opts, &out, \"balanceOf\", arg0)\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": "5e0035098f0732c41789db42c75c7fbb", "score": "0.8078813", "text": "func (_IDisputeCrowdsourcer *IDisputeCrowdsourcerCaller) BalanceOf(opts *bind.CallOpts, _who common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _IDisputeCrowdsourcer.contract.Call(opts, out, \"balanceOf\", _who)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "62df8b343ef520727437e737954a3fc9", "score": "0.80748326", "text": "func (_MonsterAuction *MonsterAuctionCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _MonsterAuction.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "1be2523b3144e81065dd06a68480cb49", "score": "0.8067371", "text": "func (_Contract *ContractCaller) BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _Contract.contract.Call(opts, out, \"balanceOf\", account)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "764c99ed06cfe99ddc9a1e762d65b791", "score": "0.80647165", "text": "func (_Vault *VaultCaller) BalanceOf(opts *bind.CallOpts) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _Vault.contract.Call(opts, &out, \"balanceOf\")\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": "3459aaf3b9eaeffcaeb8258c3b630c3f", "score": "0.8062047", "text": "func (_NeutralToken *NeutralTokenCaller) BalanceOf(opts *bind.CallOpts, who common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _NeutralToken.contract.Call(opts, out, \"balanceOf\", who)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "20abdbc39f2ba0a86db5847647d5d8c3", "score": "0.8061651", "text": "func (_SMTToken *SMTTokenCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _SMTToken.contract.Call(opts, out, \"balanceOf\", _owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "b2bc1772193b9cb50eb0a0297eb5eb24", "score": "0.8060691", "text": "func (_SmartToken *SmartTokenSession) BalanceOf(_owner common.Address) (*big.Int, error) {\n\treturn _SmartToken.Contract.BalanceOf(&_SmartToken.CallOpts, _owner)\n}", "title": "" }, { "docid": "378e5c8d3291fc22ee5d0996249179ba", "score": "0.80585575", "text": "func (_CWBTC *CWBTCCaller) BalanceOf(opts *bind.CallOpts, owner common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _CWBTC.contract.Call(opts, out, \"balanceOf\", owner)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "54fcd3df0e0f5d2369affbc29b7bb4b5", "score": "0.805691", "text": "func (_LinkToken *LinkTokenCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _LinkToken.contract.Call(opts, &out, \"balanceOf\", _owner)\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": "4d1c71d0daa9a9a8ba7c865c50408b27", "score": "0.8055181", "text": "func (_UniswapStaking *UniswapStakingCaller) BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _UniswapStaking.contract.Call(opts, out, \"balanceOf\", account)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "1f8a133f6edf31347d22046415452d54", "score": "0.8053489", "text": "func (_RenERC20LogicV1 *RenERC20LogicV1Caller) BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _RenERC20LogicV1.contract.Call(opts, out, \"balanceOf\", account)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "f7357d9ef14c5141f4680fd400ad8c7d", "score": "0.80522263", "text": "func (_ERC20 *ERC20Caller) BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ERC20.contract.Call(opts, out, \"balanceOf\", account)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "f7357d9ef14c5141f4680fd400ad8c7d", "score": "0.80522263", "text": "func (_ERC20 *ERC20Caller) BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ERC20.contract.Call(opts, out, \"balanceOf\", account)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "f7357d9ef14c5141f4680fd400ad8c7d", "score": "0.8051506", "text": "func (_ERC20 *ERC20Caller) BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ERC20.contract.Call(opts, out, \"balanceOf\", account)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "8d56dee76ba107c61d09fe99a5c6fe9f", "score": "0.8050781", "text": "func (_ERC20 *ERC20Caller) BalanceOf(opts *bind.CallOpts, _who common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ERC20.contract.Call(opts, out, \"balanceOf\", _who)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "1ed7b9640684529df396e0f59c8b66fe", "score": "0.80452615", "text": "func (_ERC20Basic *ERC20BasicCaller) BalanceOf(opts *bind.CallOpts, _who common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ERC20Basic.contract.Call(opts, out, \"balanceOf\", _who)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "11e89947918102ec0cf4c03482103224", "score": "0.803614", "text": "func (_ERC223TokenMock *ERC223TokenMockSession) BalanceOf(_owner common.Address) (*big.Int, error) {\n\treturn _ERC223TokenMock.Contract.BalanceOf(&_ERC223TokenMock.CallOpts, _owner)\n}", "title": "" }, { "docid": "cf6b2f0b6378400dc065f639d0d12576", "score": "0.8034125", "text": "func (_AastraVault *AastraVaultCaller) BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _AastraVault.contract.Call(opts, &out, \"balanceOf\", account)\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": "16b4b56d474f4257285d65b2e698f651", "score": "0.80315447", "text": "func (_Dai *Dai) BalanceOf(opts *bind.CallOpts, arg0 common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _Dai.Call(opts, out, \"balanceOf\", arg0)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "6311141317a65c495af964306c6dfc9f", "score": "0.80310345", "text": "func (_PausableTokenMock *PausableTokenMockSession) BalanceOf(_owner common.Address) (*big.Int, error) {\n\treturn _PausableTokenMock.Contract.BalanceOf(&_PausableTokenMock.CallOpts, _owner)\n}", "title": "" }, { "docid": "c2901aae05a93372846cb37014d1ab07", "score": "0.80237335", "text": "func (_WindMineToken *WindMineTokenSession) BalanceOf(_owner common.Address) (*big.Int, error) {\n\treturn _WindMineToken.Contract.BalanceOf(&_WindMineToken.CallOpts, _owner)\n}", "title": "" }, { "docid": "84464d3123d1d640436d99f7268fa3d7", "score": "0.8023369", "text": "func (_StandardToken *StandardTokenCallerSession) BalanceOf(_owner common.Address) (*big.Int, error) {\n\treturn _StandardToken.Contract.BalanceOf(&_StandardToken.CallOpts, _owner)\n}", "title": "" }, { "docid": "84464d3123d1d640436d99f7268fa3d7", "score": "0.8023369", "text": "func (_StandardToken *StandardTokenCallerSession) BalanceOf(_owner common.Address) (*big.Int, error) {\n\treturn _StandardToken.Contract.BalanceOf(&_StandardToken.CallOpts, _owner)\n}", "title": "" }, { "docid": "84464d3123d1d640436d99f7268fa3d7", "score": "0.8023369", "text": "func (_StandardToken *StandardTokenCallerSession) BalanceOf(_owner common.Address) (*big.Int, error) {\n\treturn _StandardToken.Contract.BalanceOf(&_StandardToken.CallOpts, _owner)\n}", "title": "" }, { "docid": "162fef83d69e4b54f33b814bffb383b2", "score": "0.8023123", "text": "func (_NbcToken *NbcTokenCallerSession) BalanceOf(owner common.Address) (*big.Int, error) {\n\treturn _NbcToken.Contract.BalanceOf(&_NbcToken.CallOpts, owner)\n}", "title": "" }, { "docid": "a2272dfb8bdf7ce4149e8bb5cff97938", "score": "0.8019749", "text": "func (_ERC20WithPermit *ERC20WithPermitCaller) BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ERC20WithPermit.contract.Call(opts, out, \"balanceOf\", account)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "be5a99aebb161292ebd15ed9c475e340", "score": "0.8016806", "text": "func (_WETH *WETHCaller) BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _WETH.contract.Call(opts, &out, \"balanceOf\", account)\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": "50f92820aec23cd1ef1b20f6b8acbc77", "score": "0.80145514", "text": "func (_OToken *OTokenCaller) BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _OToken.contract.Call(opts, &out, \"balanceOf\", account)\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": "5a9dcf914238976920a82d54bbcf9ab8", "score": "0.80113095", "text": "func (_PausableTokenMock *PausableTokenMockCallerSession) BalanceOf(_owner common.Address) (*big.Int, error) {\n\treturn _PausableTokenMock.Contract.BalanceOf(&_PausableTokenMock.CallOpts, _owner)\n}", "title": "" }, { "docid": "f230183b36add6ad1ef2bc532f5333b1", "score": "0.80105865", "text": "func (_WindMineToken *WindMineTokenCallerSession) BalanceOf(_owner common.Address) (*big.Int, error) {\n\treturn _WindMineToken.Contract.BalanceOf(&_WindMineToken.CallOpts, _owner)\n}", "title": "" }, { "docid": "91841d2718c93e58038f1a57241692ef", "score": "0.8008463", "text": "func (_IERC20 *IERC20Caller) BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _IERC20.contract.Call(opts, out, \"balanceOf\", account)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "91841d2718c93e58038f1a57241692ef", "score": "0.8007274", "text": "func (_IERC20 *IERC20Caller) BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _IERC20.contract.Call(opts, out, \"balanceOf\", account)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "91841d2718c93e58038f1a57241692ef", "score": "0.8007274", "text": "func (_IERC20 *IERC20Caller) BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _IERC20.contract.Call(opts, out, \"balanceOf\", account)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "91841d2718c93e58038f1a57241692ef", "score": "0.8007274", "text": "func (_IERC20 *IERC20Caller) BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _IERC20.contract.Call(opts, out, \"balanceOf\", account)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "8509df5ddfcc28adbcdea7b86831f99c", "score": "0.80069757", "text": "func (_Levtoken *LevtokenCaller) BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _Levtoken.contract.Call(opts, &out, \"balanceOf\", account)\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": "568b1b8ff7e85d4b9a76f215aa182023", "score": "0.8006747", "text": "func (_ERC20 *ERC20Caller) BalanceOf(opts *bind.CallOpts, who common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ERC20.contract.Call(opts, out, \"balanceOf\", who)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "20e7317454096a212822f9879003db10", "score": "0.80058426", "text": "func (_IUniswapV2Pair *IUniswapV2PairCallerSession) BalanceOf(owner common.Address) (*big.Int, error) {\n\treturn _IUniswapV2Pair.Contract.BalanceOf(&_IUniswapV2Pair.CallOpts, owner)\n}", "title": "" }, { "docid": "4d442ceb79380bac5e1e3b480051f7b8", "score": "0.80057204", "text": "func (_ERC20Basic *ERC20BasicCaller) BalanceOf(opts *bind.CallOpts, who common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ERC20Basic.contract.Call(opts, out, \"balanceOf\", who)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "4d442ceb79380bac5e1e3b480051f7b8", "score": "0.80057204", "text": "func (_ERC20Basic *ERC20BasicCaller) BalanceOf(opts *bind.CallOpts, who common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ERC20Basic.contract.Call(opts, out, \"balanceOf\", who)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "109712787182a797a863c0c19712f6d6", "score": "0.7994766", "text": "func (_ICash *ICashCaller) BalanceOf(opts *bind.CallOpts, _who common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ICash.contract.Call(opts, out, \"balanceOf\", _who)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "893386f701c77dc7eeb9be2157ad6e0a", "score": "0.79905796", "text": "func (_StakingContract *StakingContractCaller) BalanceOf(opts *bind.CallOpts, user common.Address) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _StakingContract.contract.Call(opts, &out, \"balanceOf\", user)\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": "c7d3537ba017c4fb4674020e53aa76ce", "score": "0.7990262", "text": "func (_Token *TokenCallerSession) BalanceOf(arg0 common.Address) (*big.Int, error) {\n\treturn _Token.Contract.BalanceOf(&_Token.CallOpts, arg0)\n}", "title": "" }, { "docid": "c7d3537ba017c4fb4674020e53aa76ce", "score": "0.7990262", "text": "func (_Token *TokenCallerSession) BalanceOf(arg0 common.Address) (*big.Int, error) {\n\treturn _Token.Contract.BalanceOf(&_Token.CallOpts, arg0)\n}", "title": "" }, { "docid": "40fcd2040ba2c3ff4c1300ce2d8de555", "score": "0.7988995", "text": "func (_Bnb *BnbCaller) BalanceOf(opts *bind.CallOpts, arg0 common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _Bnb.contract.Call(opts, out, \"balanceOf\", arg0)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "eab5fdcbdfe8f5c04f002cee0d3c568b", "score": "0.7987392", "text": "func (_ERC223TokenMock *ERC223TokenMockCallerSession) BalanceOf(_owner common.Address) (*big.Int, error) {\n\treturn _ERC223TokenMock.Contract.BalanceOf(&_ERC223TokenMock.CallOpts, _owner)\n}", "title": "" }, { "docid": "0bd53e6689fba1accf7a75acd4150bc2", "score": "0.7986955", "text": "func (_NbcToken *NbcTokenSession) BalanceOf(owner common.Address) (*big.Int, error) {\n\treturn _NbcToken.Contract.BalanceOf(&_NbcToken.CallOpts, owner)\n}", "title": "" }, { "docid": "95d4656dface3abe29ef18ef9910015c", "score": "0.7986227", "text": "func (_Token *TokenCallerSession) BalanceOf(_owner common.Address) (*big.Int, error) {\n\treturn _Token.Contract.BalanceOf(&_Token.CallOpts, _owner)\n}", "title": "" }, { "docid": "95d4656dface3abe29ef18ef9910015c", "score": "0.7986227", "text": "func (_Token *TokenCallerSession) BalanceOf(_owner common.Address) (*big.Int, error) {\n\treturn _Token.Contract.BalanceOf(&_Token.CallOpts, _owner)\n}", "title": "" }, { "docid": "8092934be00f73972ac417d9e2a3a247", "score": "0.79858613", "text": "func (_Mkr *Mkr) BalanceOf(opts *bind.CallOpts, src common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _Mkr.Call(opts, out, \"balanceOf\", src)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "f9f43ec9c8b4cbeab0d8c1e5872ef8ea", "score": "0.79852766", "text": "func (_StandardToken *StandardTokenSession) BalanceOf(_owner common.Address) (*big.Int, error) {\n\treturn _StandardToken.Contract.BalanceOf(&_StandardToken.CallOpts, _owner)\n}", "title": "" }, { "docid": "f9f43ec9c8b4cbeab0d8c1e5872ef8ea", "score": "0.79852766", "text": "func (_StandardToken *StandardTokenSession) BalanceOf(_owner common.Address) (*big.Int, error) {\n\treturn _StandardToken.Contract.BalanceOf(&_StandardToken.CallOpts, _owner)\n}", "title": "" }, { "docid": "f9f43ec9c8b4cbeab0d8c1e5872ef8ea", "score": "0.79852766", "text": "func (_StandardToken *StandardTokenSession) BalanceOf(_owner common.Address) (*big.Int, error) {\n\treturn _StandardToken.Contract.BalanceOf(&_StandardToken.CallOpts, _owner)\n}", "title": "" }, { "docid": "57ceb050aab431f59e40af1035eca0b1", "score": "0.7977298", "text": "func (_Jifen *JifenCaller) BalanceOf(opts *bind.CallOpts, arg0 [32]byte) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _Jifen.contract.Call(opts, out, \"balanceOf\", arg0)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "fc3b16aa432f6d97e21fd102efe6c16d", "score": "0.79753715", "text": "func (_Exchange *ExchangeCaller) BalanceOf(opts *bind.CallOpts, _owner common.Address) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _Exchange.contract.Call(opts, &out, \"balanceOf\", _owner)\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": "aa263e33635ca0370c5da92cac2de349", "score": "0.79704726", "text": "func (_ITellor *ITellorCaller) BalanceOf(opts *bind.CallOpts, _user common.Address) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _ITellor.contract.Call(opts, &out, \"balanceOf\", _user)\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": "c14eae4d692324e19f06170a3d3f4b13", "score": "0.7968397", "text": "func (_QLCChain *QLCChainCaller) BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _QLCChain.contract.Call(opts, out, \"balanceOf\", account)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "105525a1940962cc83ac9b2f49652a18", "score": "0.79634315", "text": "func BalanceOf(addr interop.Hash160) int {\n\treturn neogointernal.CallWithToken(Hash, \"balanceOf\", int(contract.ReadStates), addr).(int)\n}", "title": "" } ]
45573466d485648f5dd78ab4ee677bbd
RunJSONSerializationTestForWinRMListener runs a test to see if a specific instance of WinRMListener round trips to JSON and back losslessly
[ { "docid": "6aa50cc61227c622e190bbf344ca7519", "score": "0.8072775", "text": "func RunJSONSerializationTestForWinRMListener(subject WinRMListener) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual WinRMListener\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" } ]
[ { "docid": "0db6283b2194d8751cd5e2c51179bca9", "score": "0.7471539", "text": "func RunJSONSerializationTestForWinRMListenerStatus(subject WinRMListener_Status) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual WinRMListener_Status\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "cf9c1e30a4caedb8d4f77296161e5746", "score": "0.63352937", "text": "func RunJSONSerializationTestForVirtualNetworkPeering_ARM(subject VirtualNetworkPeering_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual VirtualNetworkPeering_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "e80969552b4a6a87c7517147de2ea0a6", "score": "0.62942815", "text": "func RunJSONSerializationTestForInboundIpRule_ARM(subject InboundIpRule_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual InboundIpRule_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "5d49efd8a9c407958be6a120db3689d2", "score": "0.6279706", "text": "func RunJSONSerializationTestForWinRMConfiguration(subject WinRMConfiguration) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual WinRMConfiguration\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "612fb4c1f381c022586fa338c06db24d", "score": "0.62412804", "text": "func RunJSONSerializationTestForVirtualNetworks_Subnet_STATUS(subject VirtualNetworks_Subnet_STATUS) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual VirtualNetworks_Subnet_STATUS\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "07e605d01f8bdd68623372f22d3f26ad", "score": "0.62371314", "text": "func RunJSONSerializationTestForWindowsGmsaProfile_STATUS_ARM(subject WindowsGmsaProfile_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual WindowsGmsaProfile_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "1a456d516231660f6469eb0d1086dcd4", "score": "0.62302446", "text": "func RunJSONSerializationTestForNamespaces_Eventhub_Spec_ARM(subject Namespaces_Eventhub_Spec_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual Namespaces_Eventhub_Spec_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "5f1142c7909c9ce25abcf5b68b96b10f", "score": "0.6226099", "text": "func RunJSONSerializationTestForForwardingRuleProperties_STATUS_ARM(subject ForwardingRuleProperties_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual ForwardingRuleProperties_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "49d5719099144b70665b9b8b1c6c4a00", "score": "0.6219192", "text": "func RunJSONSerializationTestForVirtualMachine_STATUS_ARM(subject VirtualMachine_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual VirtualMachine_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "1f7f9e2cac3887c4cd67e8119925c521", "score": "0.6203023", "text": "func RunJSONSerializationTestForManagedClusterHTTPProxyConfig_ARM(subject ManagedClusterHTTPProxyConfig_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual ManagedClusterHTTPProxyConfig_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "31a60debf51c79066f7dfc7a2a9a53bd", "score": "0.6202174", "text": "func RunJSONSerializationTestForServers_Ipv6FirewallRule_STATUS(subject Servers_Ipv6FirewallRule_STATUS) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual Servers_Ipv6FirewallRule_STATUS\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "d7345d37eff3025866bc092aad8b2e41", "score": "0.61946005", "text": "func RunJSONSerializationTestForManagedClusterWindowsProfile_ARM(subject ManagedClusterWindowsProfile_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual ManagedClusterWindowsProfile_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "e366af2cb854aa60fffa0ecdcd5ca11c", "score": "0.61873055", "text": "func RunJSONSerializationTestForVirtualMachineImage_STATUS_ARM(subject VirtualMachineImage_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual VirtualMachineImage_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "494611141b18a1fcf5a6b603bf7855ee", "score": "0.6186636", "text": "func RunJSONSerializationTestForRedisInstanceDetails_STATUS_ARM(subject RedisInstanceDetails_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual RedisInstanceDetails_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "e349ef0496cf03425a1c58a8498f22a8", "score": "0.6185005", "text": "func RunJSONSerializationTestForRollingUpgradePolicyStatus(subject RollingUpgradePolicy_Status) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual RollingUpgradePolicy_Status\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "203bc0b1dd6dce24c698b6e9a9724ce9", "score": "0.6179666", "text": "func RunJSONSerializationTestForSetupScripts_STATUS_ARM(subject SetupScripts_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual SetupScripts_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "67d1ab9bdc40a5026d21b51e7ad53885", "score": "0.6175062", "text": "func RunJSONSerializationTestForServers_Administrator_STATUS_ARM(subject Servers_Administrator_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual Servers_Administrator_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "9a877d48115f610db8d4cc5d757afdd7", "score": "0.61673504", "text": "func RunJSONSerializationTestForVirtualNetwork_Spec_ARM(subject VirtualNetwork_Spec_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual VirtualNetwork_Spec_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "fcf3bf2baeb7c1331e266e87b51bd44a", "score": "0.6161234", "text": "func RunJSONSerializationTestForVirtualNetworkLinkProperties_ARM(subject VirtualNetworkLinkProperties_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual VirtualNetworkLinkProperties_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "2cce316409a777194e4c9099ecdfe5a3", "score": "0.61521596", "text": "func RunJSONSerializationTestForVirtualNetworkPropertiesFormat_ARM(subject VirtualNetworkPropertiesFormat_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual VirtualNetworkPropertiesFormat_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "ce00dc07482c8e4f7ee18800a9590c35", "score": "0.6151374", "text": "func RunJSONSerializationTestForHDInsight_STATUS_ARM(subject HDInsight_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual HDInsight_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "bf30137c0040ce97f8b5b01dde322f65", "score": "0.6140855", "text": "func RunJSONSerializationTestForVirtualNetworksSubnet(subject VirtualNetworksSubnet) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual VirtualNetworksSubnet\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "5fa4c955ca0097e4e9a2c3a4535f84fa", "score": "0.61301124", "text": "func RunJSONSerializationTestForComputeInstanceApplication_STATUS_ARM(subject ComputeInstanceApplication_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual ComputeInstanceApplication_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "22207fa7acef0d620e06131d2ff869e3", "score": "0.61292005", "text": "func RunJSONSerializationTestForRollingUpgradePolicy(subject RollingUpgradePolicy) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual RollingUpgradePolicy\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "4233a801c324320e1de5da9e046a0bf2", "score": "0.61272246", "text": "func RunJSONSerializationTestForFailoverGroupReadWriteEndpoint_STATUS(subject FailoverGroupReadWriteEndpoint_STATUS) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual FailoverGroupReadWriteEndpoint_STATUS\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "2dde7210f485118571e053baafad03c3", "score": "0.6125746", "text": "func RunJSONSerializationTestForPartnerInfo_STATUS(subject PartnerInfo_STATUS) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual PartnerInfo_STATUS\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "7b4b3d92d4cdee1299c55af384643dc4", "score": "0.6123648", "text": "func RunJSONSerializationTestForWinRMConfigurationStatus(subject WinRMConfiguration_Status) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual WinRMConfiguration_Status\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "2a9eabd749cb4563de894e9177ba855d", "score": "0.61228836", "text": "func RunJSONSerializationTestForTargetDnsServer_STATUS_ARM(subject TargetDnsServer_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual TargetDnsServer_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "a7515f4c89b0b3c97fda3a30c8db3c51", "score": "0.6121414", "text": "func RunJSONSerializationTestForManagedClusterAddonProfile_ARM(subject ManagedClusterAddonProfile_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual ManagedClusterAddonProfile_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "0c269214bd1b71a1706b5d08deb41c5a", "score": "0.6118977", "text": "func RunJSONSerializationTestForManagedClusterLoadBalancerProfile_ManagedOutboundIPs_ARM(subject ManagedClusterLoadBalancerProfile_ManagedOutboundIPs_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual ManagedClusterLoadBalancerProfile_ManagedOutboundIPs_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "afc6c9e7e6836f2cbbcf0eb64c5f4d33", "score": "0.6112757", "text": "func RunJSONSerializationTestForManagedClusterLoadBalancerProfile_OutboundIPs_ARM(subject ManagedClusterLoadBalancerProfile_OutboundIPs_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual ManagedClusterLoadBalancerProfile_OutboundIPs_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "7675048d977386eb0da8b5d9f53836cb", "score": "0.6106989", "text": "func RunJSONSerializationTestForFailoverGroupReadWriteEndpoint(subject FailoverGroupReadWriteEndpoint) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual FailoverGroupReadWriteEndpoint\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "10b16f5d683d5f4e258da41199c374dc", "score": "0.61066216", "text": "func RunJSONSerializationTestForManagedClusterAutoUpgradeProfile_ARM(subject ManagedClusterAutoUpgradeProfile_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual ManagedClusterAutoUpgradeProfile_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "0d62593da1532fdc457be0ef32973468", "score": "0.61033916", "text": "func RunJSONSerializationTestForContainerServiceNetworkProfile_ARM(subject ContainerServiceNetworkProfile_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual ContainerServiceNetworkProfile_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "65186e1dc67ba823778e26790b96a410", "score": "0.60939217", "text": "func RunJSONSerializationTestForCaptureDescription_ARM(subject CaptureDescription_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual CaptureDescription_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "f8532f5e3bf6d6d66633a8f09684d3b1", "score": "0.6091563", "text": "func RunJSONSerializationTestForManagedClusterLoadBalancerProfile_OutboundIPPrefixes_ARM(subject ManagedClusterLoadBalancerProfile_OutboundIPPrefixes_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual ManagedClusterLoadBalancerProfile_OutboundIPPrefixes_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "7f1281cc4df51678b2aba3127f814c6f", "score": "0.60881096", "text": "func RunJSONSerializationTestForDataFactory_STATUS_ARM(subject DataFactory_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual DataFactory_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "907e0dc4f98a389aa14a1e0726df171e", "score": "0.6088084", "text": "func RunJSONSerializationTestForManagedClusterLoadBalancerProfile_ARM(subject ManagedClusterLoadBalancerProfile_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual ManagedClusterLoadBalancerProfile_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "7af98ed0af06204ff99125a2b0a3b363", "score": "0.6087182", "text": "func RunJSONSerializationTestForVirtualMachine_Properties_STATUS_ARM(subject VirtualMachine_Properties_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual VirtualMachine_Properties_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "309d1493299598033d3a2056a9628734", "score": "0.60869", "text": "func RunJSONSerializationTestForRegistryProperties_ARM(subject RegistryProperties_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual RegistryProperties_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "d43aa99cfff673f179addfc86abffe08", "score": "0.60813934", "text": "func RunJSONSerializationTestForNamespaces_Eventhub_Properties_Spec_ARM(subject Namespaces_Eventhub_Properties_Spec_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual Namespaces_Eventhub_Properties_Spec_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "81c5fea496d2765c4b9c792244c5cb61", "score": "0.6080708", "text": "func RunJSONSerializationTestForServersIPV6FirewallRule(subject ServersIPV6FirewallRule) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual ServersIPV6FirewallRule\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "e2e5d7aa64fb18aecf20cfd634195255", "score": "0.60788804", "text": "func RunJSONSerializationTestForContainerServiceNetworkProfile_STATUS_ARM(subject ContainerServiceNetworkProfile_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual ContainerServiceNetworkProfile_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "045b936ef7b39b8f5535aaaf37f710f2", "score": "0.6074601", "text": "func RunJSONSerializationTestForPrivateEndpointConnection_STATUS_ARM(subject PrivateEndpointConnection_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual PrivateEndpointConnection_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "045b936ef7b39b8f5535aaaf37f710f2", "score": "0.6074601", "text": "func RunJSONSerializationTestForPrivateEndpointConnection_STATUS_ARM(subject PrivateEndpointConnection_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual PrivateEndpointConnection_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "15e929b747dc0b973b28d8320a6fb671", "score": "0.60738075", "text": "func RunJSONSerializationTestForManagedClusterWindowsProfile_STATUS_ARM(subject ManagedClusterWindowsProfile_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual ManagedClusterWindowsProfile_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "7851ba0584dbef35f6b4597a1d0384ea", "score": "0.60722494", "text": "func RunJSONSerializationTestForHDInsightProperties_STATUS_ARM(subject HDInsightProperties_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual HDInsightProperties_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "cc7d3495c92be32350a762b0219501fb", "score": "0.6071749", "text": "func RunJSONSerializationTestForComputeInstance_STATUS_ARM(subject ComputeInstance_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual ComputeInstance_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "cccf4d5e9326d91cc20d37a0626274ad", "score": "0.6070376", "text": "func RunJSONSerializationTestForTrustedAccessRoleBinding(subject TrustedAccessRoleBinding) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual TrustedAccessRoleBinding\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "82d6b946bdb3d293168ffb56df5169fd", "score": "0.6066688", "text": "func RunJSONSerializationTestForDatabricks_STATUS_ARM(subject Databricks_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual Databricks_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "801ebcf58ba421b080e581a76bb312a8", "score": "0.60664487", "text": "func RunJSONSerializationTestForSignalRFeature_STATUS(subject SignalRFeature_STATUS) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual SignalRFeature_STATUS\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "79154f35b94c6036986a4d1a71a2b4c4", "score": "0.60637224", "text": "func RunJSONSerializationTestForEncryption_STATUS_ARM(subject Encryption_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual Encryption_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "936c7553739f2144c133f4b71bc04125", "score": "0.60617083", "text": "func RunJSONSerializationTestForServerfarm_STATUS_ARM(subject Serverfarm_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual Serverfarm_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "f0d22c3aa2433fbfbc9492aef1c7420e", "score": "0.6058343", "text": "func RunJSONSerializationTestForRedisFirewallRuleProperties_ARM(subject RedisFirewallRuleProperties_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual RedisFirewallRuleProperties_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "24228be99fd355db72083d01bf47fb95", "score": "0.6048716", "text": "func RunJSONSerializationTestForLoadBalancers_InboundNatRule_STATUS(subject LoadBalancers_InboundNatRule_STATUS) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual LoadBalancers_InboundNatRule_STATUS\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "d2b133b1497471a782456ef744b1c555", "score": "0.6041597", "text": "func RunJSONSerializationTestForComputeInstanceProperties_STATUS_ARM(subject ComputeInstanceProperties_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual ComputeInstanceProperties_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "075be2c86bc121df9098f522ec963a8b", "score": "0.60400957", "text": "func RunJSONSerializationTestForSqlContainerCreateUpdateProperties_ARM(subject SqlContainerCreateUpdateProperties_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual SqlContainerCreateUpdateProperties_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "f550ef41d46d15277bc4bf7a3f7ef6fc", "score": "0.6038563", "text": "func RunJSONSerializationTestForSku_STATUS_ARM(subject Sku_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual Sku_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "3fd442c42a2a4705f7769b56ce814ccf", "score": "0.6038136", "text": "func RunJSONSerializationTestForDataLakeAnalytics_STATUS_ARM(subject DataLakeAnalytics_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual DataLakeAnalytics_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "38dc5bc0e66e8700e123e2038422a826", "score": "0.60357696", "text": "func RunJSONSerializationTestForAmlCompute_STATUS_ARM(subject AmlCompute_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual AmlCompute_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "256d737c5ae96e1180011325dfba8b7b", "score": "0.60339284", "text": "func RunJSONSerializationTestForVirtualNetworkRule_STATUS(subject VirtualNetworkRule_STATUS) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual VirtualNetworkRule_STATUS\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "256d737c5ae96e1180011325dfba8b7b", "score": "0.60339284", "text": "func RunJSONSerializationTestForVirtualNetworkRule_STATUS(subject VirtualNetworkRule_STATUS) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual VirtualNetworkRule_STATUS\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "714c805160cf1512c6dea3606c62f7a4", "score": "0.60287917", "text": "func RunJSONSerializationTestForVirtualNetworkRule(subject VirtualNetworkRule) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual VirtualNetworkRule\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "714c805160cf1512c6dea3606c62f7a4", "score": "0.60287917", "text": "func RunJSONSerializationTestForVirtualNetworkRule(subject VirtualNetworkRule) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual VirtualNetworkRule\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "df101bb1a531c4030c8ed11da84df555", "score": "0.6028355", "text": "func RunJSONSerializationTestForTrustPolicy_ARM(subject TrustPolicy_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual TrustPolicy_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "5f1aaa1e367f8461c1bd76b0e36fefc0", "score": "0.6024629", "text": "func RunJSONSerializationTestForIpFilterRule_STATUS(subject IpFilterRule_STATUS) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual IpFilterRule_STATUS\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "7d6dc6d4aa0a505eef6bb78b0d3dca4b", "score": "0.60243857", "text": "func RunJSONSerializationTestForUpgradePolicyStatus(subject UpgradePolicy_Status) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual UpgradePolicy_Status\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "12960eca110476c20528f9ad0d1edbf9", "score": "0.6024156", "text": "func RunJSONSerializationTestForServers_ElasticPool_Spec_ARM(subject Servers_ElasticPool_Spec_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual Servers_ElasticPool_Spec_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "01b6674cbbec32b00d92a6d064ddad50", "score": "0.6022881", "text": "func RunJSONSerializationTestForContainerServiceLinuxProfile_ARM(subject ContainerServiceLinuxProfile_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual ContainerServiceLinuxProfile_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "e3f62c65dc8c446f116813fe14ce3aa3", "score": "0.6021457", "text": "func RunJSONSerializationTestForScriptsToExecute_STATUS_ARM(subject ScriptsToExecute_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual ScriptsToExecute_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "8b708d9c46681b333f4ed3fc136123b5", "score": "0.601997", "text": "func RunJSONSerializationTestForManagedClusterLoadBalancerProfile_OutboundIPs_STATUS_ARM(subject ManagedClusterLoadBalancerProfile_OutboundIPs_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual ManagedClusterLoadBalancerProfile_OutboundIPs_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "318633f7eba123b0c167c6191132ceb8", "score": "0.60198665", "text": "func RunJSONSerializationTestForSslConfiguration_STATUS_ARM(subject SslConfiguration_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual SslConfiguration_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "a4a3be8f1719d050a9fd9a993c5c2463", "score": "0.60163397", "text": "func RunJSONSerializationTestForDelegation_STATUS(subject Delegation_STATUS) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual Delegation_STATUS\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "c5164b01de10cb07525429154157f63e", "score": "0.60127705", "text": "func RunJSONSerializationTestForEventHubProperties_STATUS(subject EventHubProperties_STATUS) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual EventHubProperties_STATUS\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "f309c0d919b169b372318c63de86e223", "score": "0.60122067", "text": "func RunJSONSerializationTestForAmlComputeProperties_STATUS_ARM(subject AmlComputeProperties_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual AmlComputeProperties_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "158c44bb331c293e1c6025e533dba54d", "score": "0.6011363", "text": "func RunJSONSerializationTestForNetworkRuleSet_ARM(subject NetworkRuleSet_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual NetworkRuleSet_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "48e2e828d7368be6062592853391c35f", "score": "0.60080683", "text": "func RunJSONSerializationTestForDnsForwardingRulesets_ForwardingRule_STATUS_ARM(subject DnsForwardingRulesets_ForwardingRule_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual DnsForwardingRulesets_ForwardingRule_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "77cee87c6bf786a722c4ba0c7cba7e20", "score": "0.6007388", "text": "func RunJSONSerializationTestForSBSku_STATUS_ARM(subject SBSku_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual SBSku_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "b7bf12cf8fcb0fdede62f537587a5b7b", "score": "0.6007386", "text": "func RunJSONSerializationTestForIPRule_ARM(subject IPRule_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual IPRule_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "90e9172b89f27c6b97cd9007107bacbf", "score": "0.6006364", "text": "func RunJSONSerializationTestForExtendedLocation_STATUS_ARM(subject ExtendedLocation_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual ExtendedLocation_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "90e9172b89f27c6b97cd9007107bacbf", "score": "0.6006364", "text": "func RunJSONSerializationTestForExtendedLocation_STATUS_ARM(subject ExtendedLocation_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual ExtendedLocation_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "0eedcccfaf226d8f6263b9b26883932f", "score": "0.6003558", "text": "func RunJSONSerializationTestForScriptReference_STATUS_ARM(subject ScriptReference_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual ScriptReference_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "afca0a3b8f0bd08977b0012676a7a942", "score": "0.6000115", "text": "func RunJSONSerializationTestForContainerServiceLinuxProfile_STATUS_ARM(subject ContainerServiceLinuxProfile_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual ContainerServiceLinuxProfile_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "d878d9057fe5a89ad23d5380d393fdd4", "score": "0.6000092", "text": "func RunJSONSerializationTestForDatabricksProperties_STATUS_ARM(subject DatabricksProperties_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual DatabricksProperties_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "ff3a2bcce86f5823b8675d811e602bb0", "score": "0.60000074", "text": "func RunJSONSerializationTestForResourceId_STATUS_ARM(subject ResourceId_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual ResourceId_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "3793b6ac39508f4b87e31c318fc653ba", "score": "0.59995466", "text": "func RunJSONSerializationTestForManagedClusterLoadBalancerProfile_ManagedOutboundIPs_STATUS_ARM(subject ManagedClusterLoadBalancerProfile_ManagedOutboundIPs_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual ManagedClusterLoadBalancerProfile_ManagedOutboundIPs_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "be83a761cf12081d2758b83b2e15c004", "score": "0.5999151", "text": "func RunJSONSerializationTestForManagedClusterHTTPProxyConfig_STATUS_ARM(subject ManagedClusterHTTPProxyConfig_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual ManagedClusterHTTPProxyConfig_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "4c81270d40f4aed94e70c51bfb321a48", "score": "0.5998409", "text": "func RunJSONSerializationTestForPrivateLinkServiceProperties_ARM(subject PrivateLinkServiceProperties_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual PrivateLinkServiceProperties_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "5f96acf95eb72231500b4b7542cad50f", "score": "0.59951067", "text": "func RunJSONSerializationTestForAutoPauseProperties_STATUS_ARM(subject AutoPauseProperties_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual AutoPauseProperties_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "a54c0a60d971fe016858266bfdb19d7b", "score": "0.5992797", "text": "func RunJSONSerializationTestForServerfarm_Properties_STATUS_ARM(subject Serverfarm_Properties_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual Serverfarm_Properties_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "2b694916f6d52b774a70744305f99757", "score": "0.5989907", "text": "func RunJSONSerializationTestForComputeInstanceCreatedBy_STATUS_ARM(subject ComputeInstanceCreatedBy_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual ComputeInstanceCreatedBy_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "304b2c0a7e4eb521ddf64e55f511c20e", "score": "0.5988515", "text": "func RunJSONSerializationTestForManagedClusterAutoUpgradeProfile_STATUS_ARM(subject ManagedClusterAutoUpgradeProfile_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual ManagedClusterAutoUpgradeProfile_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "928456687b499d5d90524a0c72694a63", "score": "0.598844", "text": "func RunJSONSerializationTestForLoadBalancersInboundNatRule(subject LoadBalancersInboundNatRule) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual LoadBalancersInboundNatRule\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "e74efc167a832320ea6322eab30a6434", "score": "0.5988398", "text": "func RunJSONSerializationTestForComputeInstanceLastOperation_STATUS_ARM(subject ComputeInstanceLastOperation_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual ComputeInstanceLastOperation_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "1e9156bad95c0117e5ef21475383335d", "score": "0.5985193", "text": "func RunJSONSerializationTestForManagedClusters_TrustedAccessRoleBinding_STATUS(subject ManagedClusters_TrustedAccessRoleBinding_STATUS) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual ManagedClusters_TrustedAccessRoleBinding_STATUS\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "461c4bb3ae0be8627a85415c007485e4", "score": "0.59829575", "text": "func RunJSONSerializationTestForPrivateLinkServiceIpConfigurationProperties_ARM(subject PrivateLinkServiceIpConfigurationProperties_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual PrivateLinkServiceIpConfigurationProperties_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "4e3fa165d2b17740e0c17c53ea0aeaff", "score": "0.5980631", "text": "func RunJSONSerializationTestForElasticPoolProperties_ARM(subject ElasticPoolProperties_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual ElasticPoolProperties_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "0b8e9ad32dca6aace54f5a926e759bee", "score": "0.59768003", "text": "func RunJSONSerializationTestForScheduleEntries_STATUS_ARM(subject ScheduleEntries_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual ScheduleEntries_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "8bb2d4bd3c2398c57b9838ff8c357d5f", "score": "0.5976569", "text": "func RunJSONSerializationTestForManagedClusterAddonProfile_STATUS_ARM(subject ManagedClusterAddonProfile_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual ManagedClusterAddonProfile_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "e70c13ac5fd62d3f022da84b0b1655d8", "score": "0.5974655", "text": "func RunJSONSerializationTestForSignalR_STATUS(subject SignalR_STATUS) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual SignalR_STATUS\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" } ]
86884bdb668b5404329a4a8f003c944f
check runs all checks and userdefined validators on the builder.
[ { "docid": "08c083ab4ce9c8f3b014634f044b3090", "score": "0.62747777", "text": "func (mruo *MedicalRecordUpdateOne) check() error {\n\tif v, ok := mruo.mutation.Email(); ok {\n\t\tif err := medicalrecord.EmailValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"email\", err: fmt.Errorf(\"ent: validator failed for field \\\"email\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := mruo.mutation.Password(); ok {\n\t\tif err := medicalrecord.PasswordValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"password\", err: fmt.Errorf(\"ent: validator failed for field \\\"password\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := mruo.mutation.Name(); ok {\n\t\tif err := medicalrecord.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(\"ent: validator failed for field \\\"name\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" } ]
[ { "docid": "f143e8331ee497e8d61f1fd234446204", "score": "0.7180964", "text": "func (bc *BuilderCreate) check() error {\n\treturn nil\n}", "title": "" }, { "docid": "c2194a3c39d260ec9170f59c9702f1e7", "score": "0.647148", "text": "func (buo *BadgeUpdateOne) check() error {\n\tif v, ok := buo.mutation.Color(); ok {\n\t\tif err := badge.ColorValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"color\", err: fmt.Errorf(\"ent: validator failed for field \\\"color\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := buo.mutation.Material(); ok {\n\t\tif err := badge.MaterialValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"material\", err: fmt.Errorf(\"ent: validator failed for field \\\"material\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c09c49f32ff65e642306cd655869c462", "score": "0.646057", "text": "func (suo *SurgeryappointmentUpdateOne) check() error {\n\tif v, ok := suo.mutation.Phone(); ok {\n\t\tif err := surgeryappointment.PhoneValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"phone\", err: fmt.Errorf(\"ent: validator failed for field \\\"phone\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := suo.mutation.Note(); ok {\n\t\tif err := surgeryappointment.NoteValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"note\", err: fmt.Errorf(\"ent: validator failed for field \\\"note\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := suo.mutation.Cost(); ok {\n\t\tif err := surgeryappointment.CostValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"cost\", err: fmt.Errorf(\"ent: validator failed for field \\\"cost\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0e65a56b2f2a9f814a85386ee8e88287", "score": "0.64493746", "text": "func (su *SurgeryappointmentUpdate) check() error {\n\tif v, ok := su.mutation.Phone(); ok {\n\t\tif err := surgeryappointment.PhoneValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"phone\", err: fmt.Errorf(\"ent: validator failed for field \\\"phone\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := su.mutation.Note(); ok {\n\t\tif err := surgeryappointment.NoteValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"note\", err: fmt.Errorf(\"ent: validator failed for field \\\"note\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := su.mutation.Cost(); ok {\n\t\tif err := surgeryappointment.CostValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"cost\", err: fmt.Errorf(\"ent: validator failed for field \\\"cost\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2dd7e2308117ccda2ca2700503eaccb8", "score": "0.641878", "text": "func (bc *BankdetailCreate) check() error {\n\tif v, ok := bc.mutation.BankAccountNo(); ok {\n\t\tif err := bankdetail.BankAccountNoValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"Bank_AccountNo\", err: fmt.Errorf(\"ent: validator failed for field \\\"Bank_AccountNo\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := bc.mutation.BankName(); ok {\n\t\tif err := bankdetail.BankNameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"Bank_Name\", err: fmt.Errorf(\"ent: validator failed for field \\\"Bank_Name\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := bc.mutation.BankAccountName(); ok {\n\t\tif err := bankdetail.BankAccountNameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"Bank_AccountName\", err: fmt.Errorf(\"ent: validator failed for field \\\"Bank_AccountName\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "548c1c9692c2d11bd4cb41c9b5b5cdac", "score": "0.6364866", "text": "func (uuo *UserUpdateOne) check() error {\n\tif v, ok := uuo.mutation.BillingID(); ok {\n\t\tif err := user.BillingIDValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"billing_id\", err: fmt.Errorf(\"models: validator failed for field \\\"billing_id\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uuo.mutation.Provider(); ok {\n\t\tif err := user.ProviderValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"provider\", err: fmt.Errorf(\"models: validator failed for field \\\"provider\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uuo.mutation.Email(); ok {\n\t\tif err := user.EmailValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"email\", err: fmt.Errorf(\"models: validator failed for field \\\"email\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uuo.mutation.Password(); ok {\n\t\tif err := user.PasswordValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"password\", err: fmt.Errorf(\"models: validator failed for field \\\"password\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uuo.mutation.APIKey(); ok {\n\t\tif err := user.APIKeyValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"api_key\", err: fmt.Errorf(\"models: validator failed for field \\\"api_key\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uuo.mutation.ConfirmationToken(); ok {\n\t\tif err := user.ConfirmationTokenValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"confirmation_token\", err: fmt.Errorf(\"models: validator failed for field \\\"confirmation_token\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uuo.mutation.RecoveryToken(); ok {\n\t\tif err := user.RecoveryTokenValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"recovery_token\", err: fmt.Errorf(\"models: validator failed for field \\\"recovery_token\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uuo.mutation.Otp(); ok {\n\t\tif err := user.OtpValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"otp\", err: fmt.Errorf(\"models: validator failed for field \\\"otp\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uuo.mutation.EmailChange(); ok {\n\t\tif err := user.EmailChangeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"email_change\", err: fmt.Errorf(\"models: validator failed for field \\\"email_change\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uuo.mutation.EmailChangeToken(); ok {\n\t\tif err := user.EmailChangeTokenValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"email_change_token\", err: fmt.Errorf(\"models: validator failed for field \\\"email_change_token\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "473718b4ae4892faeb26b8ca205ec644", "score": "0.63606703", "text": "func (mc *MachineCreate) check() error {\n\tif _, ok := mc.mutation.Hwid(); !ok {\n\t\treturn &ValidationError{Name: \"hwid\", err: errors.New(\"ent: missing required field \\\"hwid\\\"\")}\n\t}\n\tif v, ok := mc.mutation.Hwid(); ok {\n\t\tif err := machine.HwidValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"hwid\", err: fmt.Errorf(\"ent: validator failed for field \\\"hwid\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := mc.mutation.Hostname(); !ok {\n\t\treturn &ValidationError{Name: \"hostname\", err: errors.New(\"ent: missing required field \\\"hostname\\\"\")}\n\t}\n\tif v, ok := mc.mutation.Hostname(); ok {\n\t\tif err := machine.HostnameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"hostname\", err: fmt.Errorf(\"ent: validator failed for field \\\"hostname\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := mc.mutation.Fingerprint(); !ok {\n\t\treturn &ValidationError{Name: \"fingerprint\", err: errors.New(\"ent: missing required field \\\"fingerprint\\\"\")}\n\t}\n\tif v, ok := mc.mutation.Fingerprint(); ok {\n\t\tif err := machine.FingerprintValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"fingerprint\", err: fmt.Errorf(\"ent: validator failed for field \\\"fingerprint\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "dca83afcb50783c7d0fcfbe5c031cb07", "score": "0.6351384", "text": "func (wu *WalletUpdate) check() error {\n\tif v, ok := wu.mutation.Seed(); ok {\n\t\tif err := wallet.SeedValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"seed\", err: fmt.Errorf(`ent: validator failed for field \"Wallet.seed\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := wu.mutation.Representative(); ok {\n\t\tif err := wallet.RepresentativeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"representative\", err: fmt.Errorf(`ent: validator failed for field \"Wallet.representative\": %w`, err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d68beebab4f1ed0abfb79c42d2567891", "score": "0.6349047", "text": "func (wuo *WalletUpdateOne) check() error {\n\tif v, ok := wuo.mutation.Seed(); ok {\n\t\tif err := wallet.SeedValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"seed\", err: fmt.Errorf(`ent: validator failed for field \"Wallet.seed\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := wuo.mutation.Representative(); ok {\n\t\tif err := wallet.RepresentativeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"representative\", err: fmt.Errorf(`ent: validator failed for field \"Wallet.representative\": %w`, err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "afaf714fa735f61d3b200554a16366e2", "score": "0.63405704", "text": "func (uu *UserUpdate) check() error {\n\tif v, ok := uu.mutation.BillingID(); ok {\n\t\tif err := user.BillingIDValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"billing_id\", err: fmt.Errorf(\"models: validator failed for field \\\"billing_id\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uu.mutation.Provider(); ok {\n\t\tif err := user.ProviderValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"provider\", err: fmt.Errorf(\"models: validator failed for field \\\"provider\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uu.mutation.Email(); ok {\n\t\tif err := user.EmailValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"email\", err: fmt.Errorf(\"models: validator failed for field \\\"email\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uu.mutation.Password(); ok {\n\t\tif err := user.PasswordValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"password\", err: fmt.Errorf(\"models: validator failed for field \\\"password\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uu.mutation.APIKey(); ok {\n\t\tif err := user.APIKeyValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"api_key\", err: fmt.Errorf(\"models: validator failed for field \\\"api_key\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uu.mutation.ConfirmationToken(); ok {\n\t\tif err := user.ConfirmationTokenValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"confirmation_token\", err: fmt.Errorf(\"models: validator failed for field \\\"confirmation_token\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uu.mutation.RecoveryToken(); ok {\n\t\tif err := user.RecoveryTokenValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"recovery_token\", err: fmt.Errorf(\"models: validator failed for field \\\"recovery_token\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uu.mutation.Otp(); ok {\n\t\tif err := user.OtpValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"otp\", err: fmt.Errorf(\"models: validator failed for field \\\"otp\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uu.mutation.EmailChange(); ok {\n\t\tif err := user.EmailChangeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"email_change\", err: fmt.Errorf(\"models: validator failed for field \\\"email_change\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uu.mutation.EmailChangeToken(); ok {\n\t\tif err := user.EmailChangeTokenValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"email_change_token\", err: fmt.Errorf(\"models: validator failed for field \\\"email_change_token\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "59c3a5519d8215c5a8ac6f6ae85c7dcf", "score": "0.63285786", "text": "func (bu *BadgeUpdate) check() error {\n\tif v, ok := bu.mutation.Color(); ok {\n\t\tif err := badge.ColorValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"color\", err: fmt.Errorf(\"ent: validator failed for field \\\"color\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := bu.mutation.Material(); ok {\n\t\tif err := badge.MaterialValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"material\", err: fmt.Errorf(\"ent: validator failed for field \\\"material\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f51a284f9578f97aa05133915a694eae", "score": "0.63111174", "text": "func (rdc *ResultsDefinitionCreate) check() error {\n\treturn nil\n}", "title": "" }, { "docid": "3005349b035081ad8cb7bc82f3a6419d", "score": "0.6310506", "text": "func (cc *ConsumerCreate) check() error {\n\tif v, ok := cc.mutation.TransactionID(); ok {\n\t\tif err := consumer.TransactionIDValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"transaction_id\", err: fmt.Errorf(\"ent: validator failed for field \\\"transaction_id\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.TransactionStatus(); ok {\n\t\tif err := consumer.TransactionStatusValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"TransactionStatus\", err: fmt.Errorf(\"ent: validator failed for field \\\"TransactionStatus\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.TransactionType(); ok {\n\t\tif err := consumer.TransactionTypeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"TransactionType\", err: fmt.Errorf(\"ent: validator failed for field \\\"TransactionType\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.PaymentChannel(); ok {\n\t\tif err := consumer.PaymentChannelValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"PaymentChannel\", err: fmt.Errorf(\"ent: validator failed for field \\\"PaymentChannel\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.PaymentType(); ok {\n\t\tif err := consumer.PaymentTypeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"PaymentType\", err: fmt.Errorf(\"ent: validator failed for field \\\"PaymentType\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.TypeCode(); ok {\n\t\tif err := consumer.TypeCodeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"TypeCode\", err: fmt.Errorf(\"ent: validator failed for field \\\"TypeCode\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.ApprovalCode(); ok {\n\t\tif err := consumer.ApprovalCodeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"ApprovalCode\", err: fmt.Errorf(\"ent: validator failed for field \\\"ApprovalCode\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.BillerID(); ok {\n\t\tif err := consumer.BillerIDValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"BillerID\", err: fmt.Errorf(\"ent: validator failed for field \\\"BillerID\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.Ref1(); ok {\n\t\tif err := consumer.Ref1Validator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"ref1\", err: fmt.Errorf(\"ent: validator failed for field \\\"ref1\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.Ref2(); ok {\n\t\tif err := consumer.Ref2Validator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"ref2\", err: fmt.Errorf(\"ent: validator failed for field \\\"ref2\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.Ref3(); ok {\n\t\tif err := consumer.Ref3Validator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"ref3\", err: fmt.Errorf(\"ent: validator failed for field \\\"ref3\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.FromReference(); ok {\n\t\tif err := consumer.FromReferenceValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"FromReference\", err: fmt.Errorf(\"ent: validator failed for field \\\"FromReference\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.FromPhoneNo(); ok {\n\t\tif err := consumer.FromPhoneNoValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"FromPhoneNo\", err: fmt.Errorf(\"ent: validator failed for field \\\"FromPhoneNo\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.FromName(); ok {\n\t\tif err := consumer.FromNameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"FromName\", err: fmt.Errorf(\"ent: validator failed for field \\\"FromName\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.ToAccount(); ok {\n\t\tif err := consumer.ToAccountValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"ToAccount\", err: fmt.Errorf(\"ent: validator failed for field \\\"ToAccount\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.ToAccountPhoneNo(); ok {\n\t\tif err := consumer.ToAccountPhoneNoValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"ToAccountPhoneNo\", err: fmt.Errorf(\"ent: validator failed for field \\\"ToAccountPhoneNo\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.ToAccountName(); ok {\n\t\tif err := consumer.ToAccountNameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"ToAccountName\", err: fmt.Errorf(\"ent: validator failed for field \\\"ToAccountName\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.BankCode(); ok {\n\t\tif err := consumer.BankCodeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"BankCode\", err: fmt.Errorf(\"ent: validator failed for field \\\"BankCode\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.TerminalId(); ok {\n\t\tif err := consumer.TerminalIdValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"TerminalId\", err: fmt.Errorf(\"ent: validator failed for field \\\"TerminalId\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.TerminalType(); ok {\n\t\tif err := consumer.TerminalTypeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"TerminalType\", err: fmt.Errorf(\"ent: validator failed for field \\\"TerminalType\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.ToAccount105(); ok {\n\t\tif err := consumer.ToAccount105Validator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"ToAccount105\", err: fmt.Errorf(\"ent: validator failed for field \\\"ToAccount105\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.FromReference105(); ok {\n\t\tif err := consumer.FromReference105Validator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"FromReference105\", err: fmt.Errorf(\"ent: validator failed for field \\\"FromReference105\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.PartnerRef(); ok {\n\t\tif err := consumer.PartnerRefValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"PartnerRef\", err: fmt.Errorf(\"ent: validator failed for field \\\"PartnerRef\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.ResponseCode(); ok {\n\t\tif err := consumer.ResponseCodeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"ResponseCode\", err: fmt.Errorf(\"ent: validator failed for field \\\"ResponseCode\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cc.mutation.ResponseDescription(); ok {\n\t\tif err := consumer.ResponseDescriptionValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"ResponseDescription\", err: fmt.Errorf(\"ent: validator failed for field \\\"ResponseDescription\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8d27ffd89ac9eb617c0aad9d2531d53c", "score": "0.62828857", "text": "func (lbc *LoadBalanceCreate) check() error {\n\tif _, ok := lbc.mutation.ServiceID(); !ok {\n\t\treturn &ValidationError{Name: \"service_id\", err: errors.New(\"ent: missing required field \\\"service_id\\\"\")}\n\t}\n\tif _, ok := lbc.mutation.CheckMethod(); !ok {\n\t\treturn &ValidationError{Name: \"check_method\", err: errors.New(\"ent: missing required field \\\"check_method\\\"\")}\n\t}\n\tif _, ok := lbc.mutation.CheckTimeout(); !ok {\n\t\treturn &ValidationError{Name: \"check_timeout\", err: errors.New(\"ent: missing required field \\\"check_timeout\\\"\")}\n\t}\n\tif _, ok := lbc.mutation.CheckInterval(); !ok {\n\t\treturn &ValidationError{Name: \"check_interval\", err: errors.New(\"ent: missing required field \\\"check_interval\\\"\")}\n\t}\n\tif _, ok := lbc.mutation.RoundType(); !ok {\n\t\treturn &ValidationError{Name: \"round_type\", err: errors.New(\"ent: missing required field \\\"round_type\\\"\")}\n\t}\n\tif _, ok := lbc.mutation.IPList(); !ok {\n\t\treturn &ValidationError{Name: \"ip_list\", err: errors.New(\"ent: missing required field \\\"ip_list\\\"\")}\n\t}\n\tif _, ok := lbc.mutation.WeightList(); !ok {\n\t\treturn &ValidationError{Name: \"weight_list\", err: errors.New(\"ent: missing required field \\\"weight_list\\\"\")}\n\t}\n\tif _, ok := lbc.mutation.ForbidList(); !ok {\n\t\treturn &ValidationError{Name: \"forbid_list\", err: errors.New(\"ent: missing required field \\\"forbid_list\\\"\")}\n\t}\n\tif _, ok := lbc.mutation.UpstreamConnectTimeout(); !ok {\n\t\treturn &ValidationError{Name: \"upstream_connect_timeout\", err: errors.New(\"ent: missing required field \\\"upstream_connect_timeout\\\"\")}\n\t}\n\tif _, ok := lbc.mutation.UpstreamHeaderTimeout(); !ok {\n\t\treturn &ValidationError{Name: \"upstream_header_timeout\", err: errors.New(\"ent: missing required field \\\"upstream_header_timeout\\\"\")}\n\t}\n\tif _, ok := lbc.mutation.UpstreamIdleTimeout(); !ok {\n\t\treturn &ValidationError{Name: \"upstream_idle_timeout\", err: errors.New(\"ent: missing required field \\\"upstream_idle_timeout\\\"\")}\n\t}\n\tif _, ok := lbc.mutation.UpstreamMaxIdle(); !ok {\n\t\treturn &ValidationError{Name: \"upstream_max_idle\", err: errors.New(\"ent: missing required field \\\"upstream_max_idle\\\"\")}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c403b2d0e69ea50df75140faf9aa5203", "score": "0.6281193", "text": "func (auo *AccountUpdateOne) check() error {\n\tif v, ok := auo.mutation.Provider(); ok {\n\t\tif err := account.ProviderValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"provider\", err: fmt.Errorf(\"models: validator failed for field \\\"provider\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := auo.mutation.Email(); ok {\n\t\tif err := account.EmailValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"email\", err: fmt.Errorf(\"models: validator failed for field \\\"email\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := auo.mutation.Password(); ok {\n\t\tif err := account.PasswordValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"password\", err: fmt.Errorf(\"models: validator failed for field \\\"password\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := auo.mutation.ConfirmationToken(); ok {\n\t\tif err := account.ConfirmationTokenValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"confirmation_token\", err: fmt.Errorf(\"models: validator failed for field \\\"confirmation_token\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := auo.mutation.RecoveryToken(); ok {\n\t\tif err := account.RecoveryTokenValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"recovery_token\", err: fmt.Errorf(\"models: validator failed for field \\\"recovery_token\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := auo.mutation.Otp(); ok {\n\t\tif err := account.OtpValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"otp\", err: fmt.Errorf(\"models: validator failed for field \\\"otp\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := auo.mutation.EmailChange(); ok {\n\t\tif err := account.EmailChangeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"email_change\", err: fmt.Errorf(\"models: validator failed for field \\\"email_change\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := auo.mutation.EmailChangeToken(); ok {\n\t\tif err := account.EmailChangeTokenValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"email_change_token\", err: fmt.Errorf(\"models: validator failed for field \\\"email_change_token\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0ae4254751a29e15b4c8fb7cc507be1f", "score": "0.6254646", "text": "func (wc *WidgetCreate) check() error {\n\tif _, ok := wc.mutation.Note(); !ok {\n\t\treturn &ValidationError{Name: \"note\", err: errors.New(`ent: missing required field \"note\"`)}\n\t}\n\tif v, ok := wc.mutation.Note(); ok {\n\t\tif err := widget.NoteValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"note\", err: fmt.Errorf(`ent: validator failed for field \"note\": %w`, err)}\n\t\t}\n\t}\n\tif _, ok := wc.mutation.CreatedAt(); !ok {\n\t\treturn &ValidationError{Name: \"created_at\", err: errors.New(`ent: missing required field \"created_at\"`)}\n\t}\n\tif _, ok := wc.mutation.Status(); !ok {\n\t\treturn &ValidationError{Name: \"status\", err: errors.New(`ent: missing required field \"status\"`)}\n\t}\n\tif v, ok := wc.mutation.Status(); ok {\n\t\tif err := widget.StatusValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"status\", err: fmt.Errorf(`ent: validator failed for field \"status\": %w`, err)}\n\t\t}\n\t}\n\tif _, ok := wc.mutation.Priority(); !ok {\n\t\treturn &ValidationError{Name: \"priority\", err: errors.New(`ent: missing required field \"priority\"`)}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5a63be3a2971a22ec56fd2ee96bd5341", "score": "0.62460715", "text": "func (mru *MedicalRecordUpdate) check() error {\n\tif v, ok := mru.mutation.Email(); ok {\n\t\tif err := medicalrecord.EmailValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"email\", err: fmt.Errorf(\"ent: validator failed for field \\\"email\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := mru.mutation.Password(); ok {\n\t\tif err := medicalrecord.PasswordValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"password\", err: fmt.Errorf(\"ent: validator failed for field \\\"password\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := mru.mutation.Name(); ok {\n\t\tif err := medicalrecord.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(\"ent: validator failed for field \\\"name\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ce3ddf249a04b5314b6d2872b91d2eca", "score": "0.6206899", "text": "func (ksc *KeyStoreCreate) check() error {\n\tif _, ok := ksc.mutation.Address(); !ok {\n\t\treturn &ValidationError{Name: \"address\", err: errors.New(`ent: missing required field \"address\"`)}\n\t}\n\tif v, ok := ksc.mutation.Address(); ok {\n\t\tif err := keystore.AddressValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"address\", err: fmt.Errorf(`ent: validator failed for field \"address\": %w`, err)}\n\t\t}\n\t}\n\tif _, ok := ksc.mutation.PrivateKey(); !ok {\n\t\treturn &ValidationError{Name: \"private_key\", err: errors.New(`ent: missing required field \"private_key\"`)}\n\t}\n\tif v, ok := ksc.mutation.PrivateKey(); ok {\n\t\tif err := keystore.PrivateKeyValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"private_key\", err: fmt.Errorf(`ent: validator failed for field \"private_key\": %w`, err)}\n\t\t}\n\t}\n\tif _, ok := ksc.mutation.CoinID(); !ok {\n\t\treturn &ValidationError{Name: \"coin\", err: errors.New(\"ent: missing required edge \\\"coin\\\"\")}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4111d7cbdf0a11bb5485110fe813b708", "score": "0.6196275", "text": "func (osu *OutboundShippingUpdate) check() error {\n\tif v, ok := osu.mutation.Courier(); ok {\n\t\tif err := outboundshipping.CourierValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"courier\", err: fmt.Errorf(\"ent: validator failed for field \\\"courier\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := osu.mutation.GetType(); ok {\n\t\tif err := outboundshipping.TypeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"type\", err: fmt.Errorf(\"ent: validator failed for field \\\"type\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := osu.mutation.State(); ok {\n\t\tif err := outboundshipping.StateValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"state\", err: fmt.Errorf(\"ent: validator failed for field \\\"state\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e38ef9e0064111cf38f5f647e56ef2e4", "score": "0.61909986", "text": "func (ugu *UsersGroupUpdate) check() error {\n\tif v, ok := ugu.mutation.Name(); ok {\n\t\tif err := usersgroup.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(\"ent: validator failed for field \\\"name\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := ugu.mutation.Status(); ok {\n\t\tif err := usersgroup.StatusValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"status\", err: fmt.Errorf(\"ent: validator failed for field \\\"status\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a5db892567d08866be7601bffb36be4c", "score": "0.61795294", "text": "func (cuo *ConnectorUpdateOne) check() error {\n\tif v, ok := cuo.mutation.GetType(); ok {\n\t\tif err := connector.TypeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"type\", err: fmt.Errorf(`db: validator failed for field \"Connector.type\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := cuo.mutation.Name(); ok {\n\t\tif err := connector.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(`db: validator failed for field \"Connector.name\": %w`, err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9c2bf5b27fee427e32cfe6cd05231d0e", "score": "0.6177564", "text": "func (osuo *OutboundShippingUpdateOne) check() error {\n\tif v, ok := osuo.mutation.Courier(); ok {\n\t\tif err := outboundshipping.CourierValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"courier\", err: fmt.Errorf(\"ent: validator failed for field \\\"courier\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := osuo.mutation.GetType(); ok {\n\t\tif err := outboundshipping.TypeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"type\", err: fmt.Errorf(\"ent: validator failed for field \\\"type\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := osuo.mutation.State(); ok {\n\t\tif err := outboundshipping.StateValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"state\", err: fmt.Errorf(\"ent: validator failed for field \\\"state\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ab90c9390bc47e5ee84f4401715e3f59", "score": "0.6176628", "text": "func (au *AccountUpdate) check() error {\n\tif v, ok := au.mutation.Provider(); ok {\n\t\tif err := account.ProviderValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"provider\", err: fmt.Errorf(\"models: validator failed for field \\\"provider\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := au.mutation.Email(); ok {\n\t\tif err := account.EmailValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"email\", err: fmt.Errorf(\"models: validator failed for field \\\"email\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := au.mutation.Password(); ok {\n\t\tif err := account.PasswordValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"password\", err: fmt.Errorf(\"models: validator failed for field \\\"password\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := au.mutation.ConfirmationToken(); ok {\n\t\tif err := account.ConfirmationTokenValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"confirmation_token\", err: fmt.Errorf(\"models: validator failed for field \\\"confirmation_token\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := au.mutation.RecoveryToken(); ok {\n\t\tif err := account.RecoveryTokenValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"recovery_token\", err: fmt.Errorf(\"models: validator failed for field \\\"recovery_token\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := au.mutation.Otp(); ok {\n\t\tif err := account.OtpValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"otp\", err: fmt.Errorf(\"models: validator failed for field \\\"otp\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := au.mutation.EmailChange(); ok {\n\t\tif err := account.EmailChangeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"email_change\", err: fmt.Errorf(\"models: validator failed for field \\\"email_change\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := au.mutation.EmailChangeToken(); ok {\n\t\tif err := account.EmailChangeTokenValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"email_change_token\", err: fmt.Errorf(\"models: validator failed for field \\\"email_change_token\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9b8325909fc5a6487cc06324c502e5f2", "score": "0.6175111", "text": "func (ddu *DatabaseDetectorUpdate) check() error {\n\tif v, ok := ddu.mutation.Status(); ok {\n\t\tif err := databasedetector.StatusValidator(int8(v)); err != nil {\n\t\t\treturn &ValidationError{Name: \"status\", err: fmt.Errorf(`ent: validator failed for field \"DatabaseDetector.status\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := ddu.mutation.Name(); ok {\n\t\tif err := databasedetector.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(`ent: validator failed for field \"DatabaseDetector.name\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := ddu.mutation.Timeout(); ok {\n\t\tif err := databasedetector.TimeoutValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"timeout\", err: fmt.Errorf(`ent: validator failed for field \"DatabaseDetector.timeout\": %w`, err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "578579b7115bdf7b1cdb19e6be1a568f", "score": "0.6172396", "text": "func (cuo *CompanyUpdateOne) check() error {\n\tif v, ok := cuo.mutation.Name(); ok {\n\t\tif err := company.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(\"ent: validator failed for field \\\"name\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cuo.mutation.Location(); ok {\n\t\tif err := company.LocationValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"location\", err: fmt.Errorf(\"ent: validator failed for field \\\"location\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cuo.mutation.PostalCode(); ok {\n\t\tif err := company.PostalCodeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"postal_code\", err: fmt.Errorf(\"ent: validator failed for field \\\"postal_code\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cuo.mutation.PhoneNumber(); ok {\n\t\tif err := company.PhoneNumberValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"phone_number\", err: fmt.Errorf(\"ent: validator failed for field \\\"phone_number\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cuo.mutation.CompanyID(); ok {\n\t\tif err := company.CompanyIDValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"company_id\", err: fmt.Errorf(\"ent: validator failed for field \\\"company_id\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cuo.mutation.Introduction(); ok {\n\t\tif err := company.IntroductionValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"introduction\", err: fmt.Errorf(\"ent: validator failed for field \\\"introduction\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9993f90e40a75f40c8828294a0fda4d0", "score": "0.61665046", "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": "62400b9f384f1cce59d0de6195fe4c55", "score": "0.6165011", "text": "func (tc *ToyCreate) check() error {\n\tif _, ok := tc.mutation.Color(); !ok {\n\t\treturn &ValidationError{Name: \"color\", err: errors.New(`ent: missing required field \"color\"`)}\n\t}\n\tif v, ok := tc.mutation.Color(); ok {\n\t\tif err := toy.ColorValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"color\", err: fmt.Errorf(`ent: validator failed for field \"color\": %w`, err)}\n\t\t}\n\t}\n\tif _, ok := tc.mutation.Material(); !ok {\n\t\treturn &ValidationError{Name: \"material\", err: errors.New(`ent: missing required field \"material\"`)}\n\t}\n\tif v, ok := tc.mutation.Material(); ok {\n\t\tif err := toy.MaterialValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"material\", err: fmt.Errorf(`ent: validator failed for field \"material\": %w`, err)}\n\t\t}\n\t}\n\tif _, ok := tc.mutation.Title(); !ok {\n\t\treturn &ValidationError{Name: \"title\", err: errors.New(`ent: missing required field \"title\"`)}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "19795b1cb08b64df617caccfc8d6fc27", "score": "0.61634755", "text": "func (b *Builder) validate() error {\n\tif len(b.errors) != 0 {\n\t\treturn errors.Errorf(\"failed to validate: build errors were found: %v\", b.errors)\n\t}\n\tvalidationErrs := []error{}\n\tif b.meta.object.Name == \"\" && b.meta.object.GenerateName == \"\" {\n\t\tvalidationErrs = append(validationErrs, errors.New(\"missing name\"))\n\t}\n\tif len(validationErrs) != 0 {\n\t\tb.errors = append(b.errors, validationErrs...)\n\t\treturn errors.Errorf(\"validation error(s) found: %v\", validationErrs)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "629cea7828656e3bfd0ef2486536a823", "score": "0.6151915", "text": "func (vuo *VehicleUpdateOne) check() error {\n\tif v, ok := vuo.mutation.Hours(); ok {\n\t\tif err := vehicle.HoursValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"hours\", err: fmt.Errorf(\"ent: validator failed for field \\\"hours\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := vuo.mutation.Year(); ok {\n\t\tif err := vehicle.YearValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"year\", err: fmt.Errorf(\"ent: validator failed for field \\\"year\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := vuo.mutation.Power(); ok {\n\t\tif err := vehicle.PowerValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"power\", err: fmt.Errorf(\"ent: validator failed for field \\\"power\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := vuo.mutation.LocationID(); vuo.mutation.LocationCleared() && !ok {\n\t\treturn errors.New(\"ent: clearing a required unique edge \\\"location\\\"\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6c0a46f05d84b70f698d2f8902f5d51f", "score": "0.61513853", "text": "func (v *Validation) Check(obj interface{}, checks ...Validator) *Result {\n\tvldts := make([]validation.Validator, 0, len(checks))\n\tfor _, v := range checks {\n\t\tvldts = append(vldts, validation.Validator(v))\n\t}\n\treturn (*Result)((*validation.Validation)(v).Check(obj, vldts...))\n}", "title": "" }, { "docid": "493510861124c41aff0a4817b946622a", "score": "0.615092", "text": "func (rwc *ReportWalletCreate) check() error {\n\tif _, ok := rwc.mutation.Walletid(); !ok {\n\t\treturn &ValidationError{Name: \"walletid\", err: errors.New(\"ent: missing required field \\\"walletid\\\"\")}\n\t}\n\tif v, ok := rwc.mutation.Walletid(); ok {\n\t\tif err := reportwallet.WalletidValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"walletid\", err: fmt.Errorf(\"ent: validator failed for field \\\"walletid\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rwc.mutation.WalletTypeName(); ok {\n\t\tif err := reportwallet.WalletTypeNameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"WalletTypeName\", err: fmt.Errorf(\"ent: validator failed for field \\\"WalletTypeName\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rwc.mutation.WalletPhoneno(); ok {\n\t\tif err := reportwallet.WalletPhonenoValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"WalletPhoneno\", err: fmt.Errorf(\"ent: validator failed for field \\\"WalletPhoneno\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rwc.mutation.WalletName(); ok {\n\t\tif err := reportwallet.WalletNameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"WalletName\", err: fmt.Errorf(\"ent: validator failed for field \\\"WalletName\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rwc.mutation.CitizenId(); ok {\n\t\tif err := reportwallet.CitizenIdValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"CitizenId\", err: fmt.Errorf(\"ent: validator failed for field \\\"CitizenId\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rwc.mutation.Status(); ok {\n\t\tif err := reportwallet.StatusValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"Status\", err: fmt.Errorf(\"ent: validator failed for field \\\"Status\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rwc.mutation.Email(); ok {\n\t\tif err := reportwallet.EmailValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"Email\", err: fmt.Errorf(\"ent: validator failed for field \\\"Email\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rwc.mutation.IsForgetPin(); ok {\n\t\tif err := reportwallet.IsForgetPinValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"IsForgetPin\", err: fmt.Errorf(\"ent: validator failed for field \\\"IsForgetPin\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rwc.mutation.ATMCard(); ok {\n\t\tif err := reportwallet.ATMCardValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"ATMCard\", err: fmt.Errorf(\"ent: validator failed for field \\\"ATMCard\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rwc.mutation.AccountNo(); ok {\n\t\tif err := reportwallet.AccountNoValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"AccountNo\", err: fmt.Errorf(\"ent: validator failed for field \\\"AccountNo\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rwc.mutation.Street(); ok {\n\t\tif err := reportwallet.StreetValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"Street\", err: fmt.Errorf(\"ent: validator failed for field \\\"Street\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rwc.mutation.District(); ok {\n\t\tif err := reportwallet.DistrictValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"District\", err: fmt.Errorf(\"ent: validator failed for field \\\"District\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rwc.mutation.SubDistrict(); ok {\n\t\tif err := reportwallet.SubDistrictValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"SubDistrict\", err: fmt.Errorf(\"ent: validator failed for field \\\"SubDistrict\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rwc.mutation.Province(); ok {\n\t\tif err := reportwallet.ProvinceValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"Province\", err: fmt.Errorf(\"ent: validator failed for field \\\"Province\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rwc.mutation.PostalCode(); ok {\n\t\tif err := reportwallet.PostalCodeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"PostalCode\", err: fmt.Errorf(\"ent: validator failed for field \\\"PostalCode\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0ae860301658deb84b160d86b6978989", "score": "0.61460835", "text": "func (uc *UserCreate) check() error {\n\tif _, ok := uc.mutation.Created(); !ok {\n\t\treturn &ValidationError{Name: \"created\", err: errors.New(`ent: missing required field \"User.created\"`)}\n\t}\n\tif _, ok := uc.mutation.Updated(); !ok {\n\t\treturn &ValidationError{Name: \"updated\", err: errors.New(`ent: missing required field \"User.updated\"`)}\n\t}\n\tif _, ok := uc.mutation.NickName(); !ok {\n\t\treturn &ValidationError{Name: \"nick_name\", err: errors.New(`ent: missing required field \"User.nick_name\"`)}\n\t}\n\tif v, ok := uc.mutation.NickName(); ok {\n\t\tif err := user.NickNameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"nick_name\", err: fmt.Errorf(`ent: validator failed for field \"User.nick_name\": %w`, err)}\n\t\t}\n\t}\n\tif _, ok := uc.mutation.Sex(); !ok {\n\t\treturn &ValidationError{Name: \"sex\", err: errors.New(`ent: missing required field \"User.sex\"`)}\n\t}\n\tif v, ok := uc.mutation.Phone(); ok {\n\t\tif err := user.PhoneValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"phone\", err: fmt.Errorf(`ent: validator failed for field \"User.phone\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := uc.mutation.Email(); ok {\n\t\tif err := user.EmailValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"email\", err: fmt.Errorf(`ent: validator failed for field \"User.email\": %w`, err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "186e2733af68da41cc081097ef35926e", "score": "0.61436445", "text": "func (uguo *UsersGroupUpdateOne) check() error {\n\tif v, ok := uguo.mutation.Name(); ok {\n\t\tif err := usersgroup.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(\"ent: validator failed for field \\\"name\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uguo.mutation.Status(); ok {\n\t\tif err := usersgroup.StatusValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"status\", err: fmt.Errorf(\"ent: validator failed for field \\\"status\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9784b4b8f7c98e327c1af6ffb63ee164", "score": "0.6135915", "text": "func (vcc *VehicleClassCreate) check() error {\n\tif _, ok := vcc.mutation.CreatedAt(); !ok {\n\t\treturn &ValidationError{Name: \"created_at\", err: errors.New(`ent: missing required field \"created_at\"`)}\n\t}\n\tif _, ok := vcc.mutation.UpdatedAt(); !ok {\n\t\treturn &ValidationError{Name: \"updated_at\", err: errors.New(`ent: missing required field \"updated_at\"`)}\n\t}\n\tif _, ok := vcc.mutation.Short(); !ok {\n\t\treturn &ValidationError{Name: \"short\", err: errors.New(`ent: missing required field \"short\"`)}\n\t}\n\tif v, ok := vcc.mutation.Short(); ok {\n\t\tif err := vehicleclass.ShortValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"short\", err: fmt.Errorf(`ent: validator failed for field \"short\": %w`, err)}\n\t\t}\n\t}\n\tif _, ok := vcc.mutation.Title(); !ok {\n\t\treturn &ValidationError{Name: \"title\", err: errors.New(`ent: missing required field \"title\"`)}\n\t}\n\tif v, ok := vcc.mutation.Title(); ok {\n\t\tif err := vehicleclass.TitleValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"title\", err: fmt.Errorf(`ent: validator failed for field \"title\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := vcc.mutation.Description(); ok {\n\t\tif err := vehicleclass.DescriptionValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"description\", err: fmt.Errorf(`ent: validator failed for field \"description\": %w`, err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "222986cfe4216c6adb599e9156ad1a21", "score": "0.6124101", "text": "func (vu *VehicleUpdate) check() error {\n\tif v, ok := vu.mutation.Hours(); ok {\n\t\tif err := vehicle.HoursValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"hours\", err: fmt.Errorf(\"ent: validator failed for field \\\"hours\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := vu.mutation.Year(); ok {\n\t\tif err := vehicle.YearValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"year\", err: fmt.Errorf(\"ent: validator failed for field \\\"year\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := vu.mutation.Power(); ok {\n\t\tif err := vehicle.PowerValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"power\", err: fmt.Errorf(\"ent: validator failed for field \\\"power\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := vu.mutation.LocationID(); vu.mutation.LocationCleared() && !ok {\n\t\treturn errors.New(\"ent: clearing a required unique edge \\\"location\\\"\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1a1b781c1c49544d078e2700e522d1d5", "score": "0.61137456", "text": "func (bc *BankCreate) check() error {\n\tif _, ok := bc.mutation.BankCode(); !ok {\n\t\treturn &ValidationError{Name: \"bankCode\", err: errors.New(\"ent: missing required field \\\"bankCode\\\"\")}\n\t}\n\tif _, ok := bc.mutation.BankName(); !ok {\n\t\treturn &ValidationError{Name: \"bankName\", err: errors.New(\"ent: missing required field \\\"bankName\\\"\")}\n\t}\n\tif _, ok := bc.mutation.URL(); !ok {\n\t\treturn &ValidationError{Name: \"url\", err: errors.New(\"ent: missing required field \\\"url\\\"\")}\n\t}\n\tif _, ok := bc.mutation.Swift(); !ok {\n\t\treturn &ValidationError{Name: \"swift\", err: errors.New(\"ent: missing required field \\\"swift\\\"\")}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f4026194c6e564497d2ec0c27f20e9fc", "score": "0.61076105", "text": "func (muo *MetricsUpdateOne) check() error {\n\tif v, ok := muo.mutation.Namespace(); ok {\n\t\tif err := metrics.NamespaceValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"namespace\", err: fmt.Errorf(\"ent: validator failed for field \\\"namespace\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := muo.mutation.Workflow(); ok {\n\t\tif err := metrics.WorkflowValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"workflow\", err: fmt.Errorf(\"ent: validator failed for field \\\"workflow\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := muo.mutation.Instance(); ok {\n\t\tif err := metrics.InstanceValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"instance\", err: fmt.Errorf(\"ent: validator failed for field \\\"instance\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := muo.mutation.State(); ok {\n\t\tif err := metrics.StateValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"state\", err: fmt.Errorf(\"ent: validator failed for field \\\"state\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := muo.mutation.WorkflowMs(); ok {\n\t\tif err := metrics.WorkflowMsValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"workflow_ms\", err: fmt.Errorf(\"ent: validator failed for field \\\"workflow_ms\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := muo.mutation.IsolateMs(); ok {\n\t\tif err := metrics.IsolateMsValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"isolate_ms\", err: fmt.Errorf(\"ent: validator failed for field \\\"isolate_ms\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := muo.mutation.Next(); ok {\n\t\tif err := metrics.NextValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"next\", err: fmt.Errorf(\"ent: validator failed for field \\\"next\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2198919160cc219954e8b6d02d366c23", "score": "0.61044437", "text": "func (cu *ConnectorUpdate) check() error {\n\tif v, ok := cu.mutation.GetType(); ok {\n\t\tif err := connector.TypeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"type\", err: fmt.Errorf(`db: validator failed for field \"Connector.type\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := cu.mutation.Name(); ok {\n\t\tif err := connector.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(`db: validator failed for field \"Connector.name\": %w`, err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "14780b8e54b029345699428ab07cf358", "score": "0.60967284", "text": "func (ftuo *FieldTypeUpdateOne) check() error {\n\tif v, ok := ftuo.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 := ftuo.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 := ftuo.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 := ftuo.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 := ftuo.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 := ftuo.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 := ftuo.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 := ftuo.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 := ftuo.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": "2f1bab6ecb35f43d2a8f4bcc050b1a8a", "score": "0.609368", "text": "func (ouo *OperationUpdateOne) check() error {\n\tif v, ok := ouo.mutation.GetType(); ok {\n\t\tif err := operation.TypeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"type\", err: fmt.Errorf(\"ent: validator failed for field \\\"type\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := ouo.mutation.Status(); ok {\n\t\tif err := operation.StatusValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"status\", err: fmt.Errorf(\"ent: validator failed for field \\\"status\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a14f835f797d9a32c3e4df12d8b60f1e", "score": "0.6091827", "text": "func (dduo *DatabaseDetectorUpdateOne) check() error {\n\tif v, ok := dduo.mutation.Status(); ok {\n\t\tif err := databasedetector.StatusValidator(int8(v)); err != nil {\n\t\t\treturn &ValidationError{Name: \"status\", err: fmt.Errorf(`ent: validator failed for field \"DatabaseDetector.status\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := dduo.mutation.Name(); ok {\n\t\tif err := databasedetector.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(`ent: validator failed for field \"DatabaseDetector.name\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := dduo.mutation.Timeout(); ok {\n\t\tif err := databasedetector.TimeoutValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"timeout\", err: fmt.Errorf(`ent: validator failed for field \"DatabaseDetector.timeout\": %w`, err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9ef625d72e4d174bc30bcab788279b79", "score": "0.60916334", "text": "func (rc *RunCreate) check() error {\n\tif _, ok := rc.mutation.CreatedAt(); !ok {\n\t\treturn &ValidationError{Name: \"created_at\", err: errors.New(\"ent: missing required field \\\"created_at\\\"\")}\n\t}\n\tif _, ok := rc.mutation.UpdatedAt(); !ok {\n\t\treturn &ValidationError{Name: \"updated_at\", err: errors.New(\"ent: missing required field \\\"updated_at\\\"\")}\n\t}\n\tif _, ok := rc.mutation.Status(); !ok {\n\t\treturn &ValidationError{Name: \"status\", err: errors.New(\"ent: missing required field \\\"status\\\"\")}\n\t}\n\tif v, ok := rc.mutation.Status(); ok {\n\t\tif err := run.StatusValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"status\", err: fmt.Errorf(\"ent: validator failed for field \\\"status\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := rc.mutation.Name(); !ok {\n\t\treturn &ValidationError{Name: \"name\", err: errors.New(\"ent: missing required field \\\"name\\\"\")}\n\t}\n\tif v, ok := rc.mutation.ID(); ok {\n\t\tif err := run.IDValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"id\", err: fmt.Errorf(\"ent: validator failed for field \\\"id\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := rc.mutation.TemplateID(); !ok {\n\t\treturn &ValidationError{Name: \"template\", err: errors.New(\"ent: missing required edge \\\"template\\\"\")}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a3a6cb045698ca6182bda705185d5f52", "score": "0.6084024", "text": "func (usc *UserSettingsCreate) check() error {\n\tif _, ok := usc.mutation.CreateTime(); !ok {\n\t\treturn &ValidationError{Name: \"create_time\", err: errors.New(\"ent: missing required field \\\"create_time\\\"\")}\n\t}\n\tif _, ok := usc.mutation.UpdateTime(); !ok {\n\t\treturn &ValidationError{Name: \"update_time\", err: errors.New(\"ent: missing required field \\\"update_time\\\"\")}\n\t}\n\tif _, ok := usc.mutation.NewCardsPerDay(); !ok {\n\t\treturn &ValidationError{Name: \"newCardsPerDay\", err: errors.New(\"ent: missing required field \\\"newCardsPerDay\\\"\")}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "382fb583256671006ba8de66fdc47e44", "score": "0.608311", "text": "func (cu *CompanyUpdate) check() error {\n\tif v, ok := cu.mutation.Name(); ok {\n\t\tif err := company.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(\"ent: validator failed for field \\\"name\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cu.mutation.Location(); ok {\n\t\tif err := company.LocationValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"location\", err: fmt.Errorf(\"ent: validator failed for field \\\"location\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cu.mutation.PostalCode(); ok {\n\t\tif err := company.PostalCodeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"postal_code\", err: fmt.Errorf(\"ent: validator failed for field \\\"postal_code\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cu.mutation.PhoneNumber(); ok {\n\t\tif err := company.PhoneNumberValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"phone_number\", err: fmt.Errorf(\"ent: validator failed for field \\\"phone_number\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cu.mutation.CompanyID(); ok {\n\t\tif err := company.CompanyIDValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"company_id\", err: fmt.Errorf(\"ent: validator failed for field \\\"company_id\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cu.mutation.Introduction(); ok {\n\t\tif err := company.IntroductionValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"introduction\", err: fmt.Errorf(\"ent: validator failed for field \\\"introduction\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "413e2c53a10c1e6561182f6896e33439", "score": "0.6078334", "text": "func (tuo *TankUpdateOne) check() error {\n\tif v, ok := tuo.mutation.Name(); ok {\n\t\tif err := tank.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(\"ent: validator failed for field \\\"name\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := tuo.mutation.TankClass(); ok {\n\t\tif err := tank.TankClassValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"tankClass\", err: fmt.Errorf(\"ent: validator failed for field \\\"tankClass\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := tuo.mutation.Country(); ok {\n\t\tif err := tank.CountryValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"country\", err: fmt.Errorf(\"ent: validator failed for field \\\"country\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2110e856848d0f7d12d7ebb637d0108e", "score": "0.6075246", "text": "func (cc *CustomerCreate) check() error {\n\tif _, ok := cc.mutation.CreatedAt(); !ok {\n\t\treturn &ValidationError{Name: \"created_at\", err: errors.New(\"ent: missing required field \\\"created_at\\\"\")}\n\t}\n\tif _, ok := cc.mutation.UpdatedAt(); !ok {\n\t\treturn &ValidationError{Name: \"updated_at\", err: errors.New(\"ent: missing required field \\\"updated_at\\\"\")}\n\t}\n\tif _, ok := cc.mutation.Address(); !ok {\n\t\treturn &ValidationError{Name: \"address\", err: errors.New(\"ent: missing required field \\\"address\\\"\")}\n\t}\n\tif v, ok := cc.mutation.Address(); ok {\n\t\tif err := customer.AddressValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"address\", err: fmt.Errorf(\"ent: validator failed for field \\\"address\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := cc.mutation.Phone(); !ok {\n\t\treturn &ValidationError{Name: \"phone\", err: errors.New(\"ent: missing required field \\\"phone\\\"\")}\n\t}\n\tif v, ok := cc.mutation.Phone(); ok {\n\t\tif err := customer.PhoneValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"phone\", err: fmt.Errorf(\"ent: validator failed for field \\\"phone\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := cc.mutation.UserID(); !ok {\n\t\treturn &ValidationError{Name: \"user\", err: errors.New(\"ent: missing required edge \\\"user\\\"\")}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f60e9d4ee4fd86181fb41a2e6b92f37b", "score": "0.6071693", "text": "func (djuo *DetectionJobUpdateOne) check() error {\n\tif v, ok := djuo.mutation.Method(); ok {\n\t\tif err := detectionjob.MethodValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"method\", err: fmt.Errorf(\"ent: validator failed for field \\\"method\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := djuo.mutation.SiteID(); ok {\n\t\tif err := detectionjob.SiteIDValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"site_id\", err: fmt.Errorf(\"ent: validator failed for field \\\"site_id\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := djuo.mutation.Metric(); ok {\n\t\tif err := detectionjob.MetricValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"metric\", err: fmt.Errorf(\"ent: validator failed for field \\\"metric\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := djuo.mutation.Attribute(); ok {\n\t\tif err := detectionjob.AttributeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"attribute\", err: fmt.Errorf(\"ent: validator failed for field \\\"attribute\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := djuo.mutation.TimeAgo(); ok {\n\t\tif err := detectionjob.TimeAgoValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"time_ago\", err: fmt.Errorf(\"ent: validator failed for field \\\"time_ago\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := djuo.mutation.TimeStep(); ok {\n\t\tif err := detectionjob.TimeStepValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"time_step\", err: fmt.Errorf(\"ent: validator failed for field \\\"time_step\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2bfa0e0a02339ba714a301175a0a7fb4", "score": "0.6071523", "text": "func (ac *AgentCreate) check() error {\n\tif _, ok := ac.mutation.UUID(); !ok {\n\t\treturn &ValidationError{Name: \"uuid\", err: errors.New(\"ent: missing required field \\\"uuid\\\"\")}\n\t}\n\tif _, ok := ac.mutation.Hostname(); !ok {\n\t\treturn &ValidationError{Name: \"hostname\", err: errors.New(\"ent: missing required field \\\"hostname\\\"\")}\n\t}\n\tif _, ok := ac.mutation.IP(); !ok {\n\t\treturn &ValidationError{Name: \"ip\", err: errors.New(\"ent: missing required field \\\"ip\\\"\")}\n\t}\n\tif _, ok := ac.mutation.Port(); !ok {\n\t\treturn &ValidationError{Name: \"port\", err: errors.New(\"ent: missing required field \\\"port\\\"\")}\n\t}\n\tif _, ok := ac.mutation.Pid(); !ok {\n\t\treturn &ValidationError{Name: \"pid\", err: errors.New(\"ent: missing required field \\\"pid\\\"\")}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6ae2b6d80681e1db38cfbc78d9693b84", "score": "0.60671026", "text": "func (rsc *RequestStatusCreate) check() error {\n\tif _, ok := rsc.mutation.Status(); !ok {\n\t\treturn &ValidationError{Name: \"status\", err: errors.New(`ent: missing required field \"RequestStatus.status\"`)}\n\t}\n\tif v, ok := rsc.mutation.Status(); ok {\n\t\tif err := requeststatus.StatusValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"status\", err: fmt.Errorf(`ent: validator failed for field \"RequestStatus.status\": %w`, err)}\n\t\t}\n\t}\n\tif _, ok := rsc.mutation.CreatedAt(); !ok {\n\t\treturn &ValidationError{Name: \"created_at\", err: errors.New(`ent: missing required field \"RequestStatus.created_at\"`)}\n\t}\n\tif _, ok := rsc.mutation.RequestID(); !ok {\n\t\treturn &ValidationError{Name: \"request\", err: errors.New(`ent: missing required edge \"RequestStatus.request\"`)}\n\t}\n\tif _, ok := rsc.mutation.UserID(); !ok {\n\t\treturn &ValidationError{Name: \"user\", err: errors.New(`ent: missing required edge \"RequestStatus.user\"`)}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cb50a612be091c5af0647d36a54c1331", "score": "0.6067089", "text": "func (uuo *UserUpdateOne) check() error {\n\tif v, ok := uuo.mutation.Name(); ok {\n\t\tif err := user.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(\"ent: validator failed for field \\\"name\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uuo.mutation.Username(); ok {\n\t\tif err := user.UsernameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"username\", err: fmt.Errorf(\"ent: validator failed for field \\\"username\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uuo.mutation.Password(); ok {\n\t\tif err := user.PasswordValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"password\", err: fmt.Errorf(\"ent: validator failed for field \\\"password\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uuo.mutation.Bio(); ok {\n\t\tif err := user.BioValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"bio\", err: fmt.Errorf(\"ent: validator failed for field \\\"bio\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uuo.mutation.Gender(); ok {\n\t\tif err := user.GenderValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"gender\", err: fmt.Errorf(\"ent: validator failed for field \\\"gender\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uuo.mutation.Role(); ok {\n\t\tif err := user.RoleValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"role\", err: fmt.Errorf(\"ent: validator failed for field \\\"role\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7f06a19d4bbdcaf03740f1ead4123b66", "score": "0.6054371", "text": "func (vu *VeterinarianUpdate) check() error {\n\tif v, ok := vu.mutation.Phone(); ok {\n\t\tif err := veterinarian.PhoneValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"phone\", err: fmt.Errorf(\"ent: validator failed for field \\\"phone\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := vu.mutation.UserID(); vu.mutation.UserCleared() && !ok {\n\t\treturn errors.New(\"ent: clearing a required unique edge \\\"user\\\"\")\n\t}\n\tif _, ok := vu.mutation.ClinicID(); vu.mutation.ClinicCleared() && !ok {\n\t\treturn errors.New(\"ent: clearing a required unique edge \\\"clinic\\\"\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fab19cfca255d8e65913363a04ce0235", "score": "0.6045848", "text": "func (mpu *MedicalProcedureUpdate) check() error {\n\tif v, ok := mpu.mutation.ProcedureOrder(); ok {\n\t\tif err := medicalprocedure.ProcedureOrderValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"procedureOrder\", err: fmt.Errorf(\"ent: validator failed for field \\\"procedureOrder\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := mpu.mutation.ProcedureRoom(); ok {\n\t\tif err := medicalprocedure.ProcedureRoomValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"procedureRoom\", err: fmt.Errorf(\"ent: validator failed for field \\\"procedureRoom\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := mpu.mutation.ProcedureDescripe(); ok {\n\t\tif err := medicalprocedure.ProcedureDescripeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"procedureDescripe\", err: fmt.Errorf(\"ent: validator failed for field \\\"procedureDescripe\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6dc7147dbbf21954edea86225104454c", "score": "0.60448533", "text": "func (tu *TankUpdate) check() error {\n\tif v, ok := tu.mutation.Name(); ok {\n\t\tif err := tank.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(\"ent: validator failed for field \\\"name\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := tu.mutation.TankClass(); ok {\n\t\tif err := tank.TankClassValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"tankClass\", err: fmt.Errorf(\"ent: validator failed for field \\\"tankClass\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := tu.mutation.Country(); ok {\n\t\tif err := tank.CountryValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"country\", err: fmt.Errorf(\"ent: validator failed for field \\\"country\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c9ea28e7216c756fc65bce4cce10a7d0", "score": "0.60361594", "text": "func Check() {\n\tmg.Deps(CheckGoImports, CheckGoLint, CheckGoVet, CheckCopyright)\n}", "title": "" }, { "docid": "8714b6142bf9609f4021ba3bb50186da", "score": "0.6035628", "text": "func (pc *PatientCreate) check() error {\n\tif _, ok := pc.mutation.PersonalID(); !ok {\n\t\treturn &ValidationError{Name: \"personalID\", err: errors.New(\"ent: missing required field \\\"personalID\\\"\")}\n\t}\n\tif v, ok := pc.mutation.PersonalID(); ok {\n\t\tif err := patient.PersonalIDValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"personalID\", err: fmt.Errorf(\"ent: validator failed for field \\\"personalID\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := pc.mutation.HospitalNumber(); !ok {\n\t\treturn &ValidationError{Name: \"hospitalNumber\", err: errors.New(\"ent: missing required field \\\"hospitalNumber\\\"\")}\n\t}\n\tif v, ok := pc.mutation.HospitalNumber(); ok {\n\t\tif err := patient.HospitalNumberValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"hospitalNumber\", err: fmt.Errorf(\"ent: validator failed for field \\\"hospitalNumber\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := pc.mutation.PatientName(); !ok {\n\t\treturn &ValidationError{Name: \"patientName\", err: errors.New(\"ent: missing required field \\\"patientName\\\"\")}\n\t}\n\tif v, ok := pc.mutation.PatientName(); ok {\n\t\tif err := patient.PatientNameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"patientName\", err: fmt.Errorf(\"ent: validator failed for field \\\"patientName\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := pc.mutation.DrugAllergy(); !ok {\n\t\treturn &ValidationError{Name: \"drugAllergy\", err: errors.New(\"ent: missing required field \\\"drugAllergy\\\"\")}\n\t}\n\tif v, ok := pc.mutation.DrugAllergy(); ok {\n\t\tif err := patient.DrugAllergyValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"drugAllergy\", err: fmt.Errorf(\"ent: validator failed for field \\\"drugAllergy\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := pc.mutation.MobileNumber(); !ok {\n\t\treturn &ValidationError{Name: \"mobileNumber\", err: errors.New(\"ent: missing required field \\\"mobileNumber\\\"\")}\n\t}\n\tif v, ok := pc.mutation.MobileNumber(); ok {\n\t\tif err := patient.MobileNumberValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"mobileNumber\", err: fmt.Errorf(\"ent: validator failed for field \\\"mobileNumber\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := pc.mutation.Added(); !ok {\n\t\treturn &ValidationError{Name: \"added\", err: errors.New(\"ent: missing required field \\\"added\\\"\")}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d644611295caf0223dc8b1ce7167ba0a", "score": "0.60342765", "text": "func (mu *MetricsUpdate) check() error {\n\tif v, ok := mu.mutation.Namespace(); ok {\n\t\tif err := metrics.NamespaceValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"namespace\", err: fmt.Errorf(\"ent: validator failed for field \\\"namespace\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := mu.mutation.Workflow(); ok {\n\t\tif err := metrics.WorkflowValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"workflow\", err: fmt.Errorf(\"ent: validator failed for field \\\"workflow\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := mu.mutation.Instance(); ok {\n\t\tif err := metrics.InstanceValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"instance\", err: fmt.Errorf(\"ent: validator failed for field \\\"instance\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := mu.mutation.State(); ok {\n\t\tif err := metrics.StateValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"state\", err: fmt.Errorf(\"ent: validator failed for field \\\"state\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := mu.mutation.WorkflowMs(); ok {\n\t\tif err := metrics.WorkflowMsValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"workflow_ms\", err: fmt.Errorf(\"ent: validator failed for field \\\"workflow_ms\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := mu.mutation.IsolateMs(); ok {\n\t\tif err := metrics.IsolateMsValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"isolate_ms\", err: fmt.Errorf(\"ent: validator failed for field \\\"isolate_ms\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := mu.mutation.Next(); ok {\n\t\tif err := metrics.NextValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"next\", err: fmt.Errorf(\"ent: validator failed for field \\\"next\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "16b52f866e84103a326b025df09105aa", "score": "0.60341936", "text": "func (ou *OperationUpdate) check() error {\n\tif v, ok := ou.mutation.GetType(); ok {\n\t\tif err := operation.TypeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"type\", err: fmt.Errorf(\"ent: validator failed for field \\\"type\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := ou.mutation.Status(); ok {\n\t\tif err := operation.StatusValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"status\", err: fmt.Errorf(\"ent: validator failed for field \\\"status\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e33eec3a7309fce3003abe1f7cf8b9d4", "score": "0.60308284", "text": "func (gcc *GoodsClassifyCreate) check() error {\n\tif _, ok := gcc.mutation.CreatedAt(); !ok {\n\t\treturn &ValidationError{Name: \"created_at\", err: errors.New(\"ent: missing required field \\\"created_at\\\"\")}\n\t}\n\tif _, ok := gcc.mutation.Level(); !ok {\n\t\treturn &ValidationError{Name: \"level\", err: errors.New(\"ent: missing required field \\\"level\\\"\")}\n\t}\n\tif v, ok := gcc.mutation.Sort(); ok {\n\t\tif err := goodsclassify.SortValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"sort\", err: fmt.Errorf(\"ent: validator failed for field \\\"sort\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b14d508a7ee8ba3dcb05c6ee6640205e", "score": "0.6024593", "text": "func (status *Status) check() (string, error) {\n\tstatus.Version = newVersionStatus(status.cli)\n\tstatus.System = newSystemStatus()\n\tstatus.Configuration = newConfigurationStatus(status)\n\tstatus.APIReachability = newAPIReachabilityStatus(status.cfg)\n\n\treturn status.compile()\n}", "title": "" }, { "docid": "09f0e5ad76ff0257fc8d17e49a6590fa", "score": "0.602112", "text": "func (smc *StockManagerCreate) check() error {\n\tif _, ok := smc.mutation.Activite(); !ok {\n\t\treturn &ValidationError{Name: \"Activite\", err: errors.New(\"ent: missing required field \\\"Activite\\\"\")}\n\t}\n\tif _, ok := smc.mutation.SemaineA(); !ok {\n\t\treturn &ValidationError{Name: \"SemaineA\", err: errors.New(\"ent: missing required field \\\"SemaineA\\\"\")}\n\t}\n\tif v, ok := smc.mutation.SemaineA(); ok {\n\t\tif err := stockmanager.SemaineAValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"SemaineA\", err: fmt.Errorf(\"ent: validator failed for field \\\"SemaineA\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := smc.mutation.SemaineB(); !ok {\n\t\treturn &ValidationError{Name: \"SemaineB\", err: errors.New(\"ent: missing required field \\\"SemaineB\\\"\")}\n\t}\n\tif v, ok := smc.mutation.SemaineB(); ok {\n\t\tif err := stockmanager.SemaineBValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"SemaineB\", err: fmt.Errorf(\"ent: validator failed for field \\\"SemaineB\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := smc.mutation.SemaineC(); !ok {\n\t\treturn &ValidationError{Name: \"SemaineC\", err: errors.New(\"ent: missing required field \\\"SemaineC\\\"\")}\n\t}\n\tif v, ok := smc.mutation.SemaineC(); ok {\n\t\tif err := stockmanager.SemaineCValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"SemaineC\", err: fmt.Errorf(\"ent: validator failed for field \\\"SemaineC\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := smc.mutation.SemaineD(); !ok {\n\t\treturn &ValidationError{Name: \"SemaineD\", err: errors.New(\"ent: missing required field \\\"SemaineD\\\"\")}\n\t}\n\tif v, ok := smc.mutation.SemaineD(); ok {\n\t\tif err := stockmanager.SemaineDValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"SemaineD\", err: fmt.Errorf(\"ent: validator failed for field \\\"SemaineD\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := smc.mutation.SemaineE(); !ok {\n\t\treturn &ValidationError{Name: \"SemaineE\", err: errors.New(\"ent: missing required field \\\"SemaineE\\\"\")}\n\t}\n\tif v, ok := smc.mutation.SemaineE(); ok {\n\t\tif err := stockmanager.SemaineEValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"SemaineE\", err: fmt.Errorf(\"ent: validator failed for field \\\"SemaineE\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := smc.mutation.SemaineF(); !ok {\n\t\treturn &ValidationError{Name: \"SemaineF\", err: errors.New(\"ent: missing required field \\\"SemaineF\\\"\")}\n\t}\n\tif v, ok := smc.mutation.SemaineF(); ok {\n\t\tif err := stockmanager.SemaineFValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"SemaineF\", err: fmt.Errorf(\"ent: validator failed for field \\\"SemaineF\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := smc.mutation.SemaineG(); !ok {\n\t\treturn &ValidationError{Name: \"SemaineG\", err: errors.New(\"ent: missing required field \\\"SemaineG\\\"\")}\n\t}\n\tif v, ok := smc.mutation.SemaineG(); ok {\n\t\tif err := stockmanager.SemaineGValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"SemaineG\", err: fmt.Errorf(\"ent: validator failed for field \\\"SemaineG\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := smc.mutation.SemaineH(); !ok {\n\t\treturn &ValidationError{Name: \"SemaineH\", err: errors.New(\"ent: missing required field \\\"SemaineH\\\"\")}\n\t}\n\tif v, ok := smc.mutation.SemaineH(); ok {\n\t\tif err := stockmanager.SemaineHValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"SemaineH\", err: fmt.Errorf(\"ent: validator failed for field \\\"SemaineH\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := smc.mutation.ID(); ok {\n\t\tif err := stockmanager.IDValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"id\", err: fmt.Errorf(\"ent: validator failed for field \\\"id\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "59028a2a53bf1edd36ca930b331d0d77", "score": "0.60174954", "text": "func (u *user) check(ca checkArg) {\n\tvar err error\n\n\tdefer func() {\n\t\tu.ca.log.Debug(\"Check %s, err: %v\", ca, err)\n\t\tca.retCh <- err\n\t}()\n\n\tif err = u.repopulate(); err != nil {\n\t\treturn\n\t}\n\n\tu.lock.RLock()\n\tdefer u.lock.RUnlock()\n\n\terr = u.checkAfterPopulatedRLocked(ca)\n}", "title": "" }, { "docid": "f34ddb4c5dcab1c3365dba856079ee00", "score": "0.6012221", "text": "func (ru *RouteUpdate) check() error {\n\tif v, ok := ru.mutation.Tenant(); ok {\n\t\tif err := route.TenantValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"tenant\", err: fmt.Errorf(\"ent: validator failed for field \\\"tenant\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := ru.mutation.Name(); ok {\n\t\tif err := route.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(\"ent: validator failed for field \\\"name\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := ru.mutation.URI(); ok {\n\t\tif err := route.URIValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"uri\", err: fmt.Errorf(\"ent: validator failed for field \\\"uri\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := ru.mutation.Method(); ok {\n\t\tif err := route.MethodValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"method\", err: fmt.Errorf(\"ent: validator failed for field \\\"method\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6433d2da8c2634eff1dfb8389cfbf713", "score": "0.60061824", "text": "func (dju *DetectionJobUpdate) check() error {\n\tif v, ok := dju.mutation.Method(); ok {\n\t\tif err := detectionjob.MethodValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"method\", err: fmt.Errorf(\"ent: validator failed for field \\\"method\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := dju.mutation.SiteID(); ok {\n\t\tif err := detectionjob.SiteIDValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"site_id\", err: fmt.Errorf(\"ent: validator failed for field \\\"site_id\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := dju.mutation.Metric(); ok {\n\t\tif err := detectionjob.MetricValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"metric\", err: fmt.Errorf(\"ent: validator failed for field \\\"metric\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := dju.mutation.Attribute(); ok {\n\t\tif err := detectionjob.AttributeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"attribute\", err: fmt.Errorf(\"ent: validator failed for field \\\"attribute\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := dju.mutation.TimeAgo(); ok {\n\t\tif err := detectionjob.TimeAgoValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"time_ago\", err: fmt.Errorf(\"ent: validator failed for field \\\"time_ago\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := dju.mutation.TimeStep(); ok {\n\t\tif err := detectionjob.TimeStepValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"time_step\", err: fmt.Errorf(\"ent: validator failed for field \\\"time_step\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9dcde44108b14285fc2eaeefbfe79bdb", "score": "0.60057855", "text": "func (vuo *VeterinarianUpdateOne) check() error {\n\tif v, ok := vuo.mutation.Phone(); ok {\n\t\tif err := veterinarian.PhoneValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"phone\", err: fmt.Errorf(\"ent: validator failed for field \\\"phone\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := vuo.mutation.UserID(); vuo.mutation.UserCleared() && !ok {\n\t\treturn errors.New(\"ent: clearing a required unique edge \\\"user\\\"\")\n\t}\n\tif _, ok := vuo.mutation.ClinicID(); vuo.mutation.ClinicCleared() && !ok {\n\t\treturn errors.New(\"ent: clearing a required unique edge \\\"clinic\\\"\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6c205b5d636f9c84383f878b1de8aa66", "score": "0.60031337", "text": "func (puo *PetUpdateOne) check() error {\n\tif v, ok := puo.mutation.Height(); ok {\n\t\tif err := pet.HeightValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"height\", err: fmt.Errorf(\"ent: validator failed for field \\\"height\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := puo.mutation.Weight(); ok {\n\t\tif err := pet.WeightValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"weight\", err: fmt.Errorf(\"ent: validator failed for field \\\"weight\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := puo.mutation.Sex(); ok {\n\t\tif err := pet.SexValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"sex\", err: fmt.Errorf(\"ent: validator failed for field \\\"sex\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := puo.mutation.BadgeID(); puo.mutation.BadgeCleared() && !ok {\n\t\treturn errors.New(\"ent: clearing a required unique edge \\\"badge\\\"\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cdf975b831e4c8fa849a7eb2d23b417f", "score": "0.6001334", "text": "func (uu *UserUpdate) check() error {\n\tif v, ok := uu.mutation.Name(); ok {\n\t\tif err := user.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(\"ent: validator failed for field \\\"name\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uu.mutation.Username(); ok {\n\t\tif err := user.UsernameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"username\", err: fmt.Errorf(\"ent: validator failed for field \\\"username\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uu.mutation.Password(); ok {\n\t\tif err := user.PasswordValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"password\", err: fmt.Errorf(\"ent: validator failed for field \\\"password\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uu.mutation.Bio(); ok {\n\t\tif err := user.BioValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"bio\", err: fmt.Errorf(\"ent: validator failed for field \\\"bio\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uu.mutation.Gender(); ok {\n\t\tif err := user.GenderValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"gender\", err: fmt.Errorf(\"ent: validator failed for field \\\"gender\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uu.mutation.Role(); ok {\n\t\tif err := user.RoleValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"role\", err: fmt.Errorf(\"ent: validator failed for field \\\"role\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cc0d6b3ae4c99534a434dcb8b6c1de01", "score": "0.6000752", "text": "func (ugc *UserGroupCreate) check() error {\n\tif _, ok := ugc.mutation.JoinedAt(); !ok {\n\t\treturn &ValidationError{Name: \"joined_at\", err: errors.New(`ent: missing required field \"UserGroup.joined_at\"`)}\n\t}\n\tif _, ok := ugc.mutation.UserID(); !ok {\n\t\treturn &ValidationError{Name: \"user_id\", err: errors.New(`ent: missing required field \"UserGroup.user_id\"`)}\n\t}\n\tif _, ok := ugc.mutation.GroupID(); !ok {\n\t\treturn &ValidationError{Name: \"group_id\", err: errors.New(`ent: missing required field \"UserGroup.group_id\"`)}\n\t}\n\tif _, ok := ugc.mutation.UserID(); !ok {\n\t\treturn &ValidationError{Name: \"user\", err: errors.New(`ent: missing required edge \"UserGroup.user\"`)}\n\t}\n\tif _, ok := ugc.mutation.GroupID(); !ok {\n\t\treturn &ValidationError{Name: \"group\", err: errors.New(`ent: missing required edge \"UserGroup.group\"`)}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cfd7c9ed5cbe4c93c9b6051401b70c19", "score": "0.5983192", "text": "func (sc *SensorCreate) check() error {\n\tif _, ok := sc.mutation.GetType(); !ok {\n\t\treturn &ValidationError{Name: \"type\", err: errors.New(`ent: missing required field \"type\"`)}\n\t}\n\tif v, ok := sc.mutation.GetType(); ok {\n\t\tif err := sensor.TypeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"type\", err: fmt.Errorf(`ent: validator failed for field \"type\": %w`, err)}\n\t\t}\n\t}\n\tif _, ok := sc.mutation.Location(); !ok {\n\t\treturn &ValidationError{Name: \"location\", err: errors.New(`ent: missing required field \"location\"`)}\n\t}\n\tif v, ok := sc.mutation.Location(); ok {\n\t\tif err := sensor.LocationValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"location\", err: fmt.Errorf(`ent: validator failed for field \"location\": %w`, err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "44da8050d760a3cfdf50eb46ffef11f8", "score": "0.59773666", "text": "func (ruo *RouteUpdateOne) check() error {\n\tif v, ok := ruo.mutation.Tenant(); ok {\n\t\tif err := route.TenantValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"tenant\", err: fmt.Errorf(\"ent: validator failed for field \\\"tenant\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := ruo.mutation.Name(); ok {\n\t\tif err := route.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(\"ent: validator failed for field \\\"name\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := ruo.mutation.URI(); ok {\n\t\tif err := route.URIValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"uri\", err: fmt.Errorf(\"ent: validator failed for field \\\"uri\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := ruo.mutation.Method(); ok {\n\t\tif err := route.MethodValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"method\", err: fmt.Errorf(\"ent: validator failed for field \\\"method\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "68c4108deec4d04e53af4467fd2a128c", "score": "0.5976949", "text": "func (mpuo *MedicalProcedureUpdateOne) check() error {\n\tif v, ok := mpuo.mutation.ProcedureOrder(); ok {\n\t\tif err := medicalprocedure.ProcedureOrderValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"procedureOrder\", err: fmt.Errorf(\"ent: validator failed for field \\\"procedureOrder\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := mpuo.mutation.ProcedureRoom(); ok {\n\t\tif err := medicalprocedure.ProcedureRoomValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"procedureRoom\", err: fmt.Errorf(\"ent: validator failed for field \\\"procedureRoom\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := mpuo.mutation.ProcedureDescripe(); ok {\n\t\tif err := medicalprocedure.ProcedureDescripeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"procedureDescripe\", err: fmt.Errorf(\"ent: validator failed for field \\\"procedureDescripe\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "57dbadada2c1dad05414d25b04b8c6b1", "score": "0.59741735", "text": "func (hdu *HTTPDetectorUpdate) check() error {\n\tif v, ok := hdu.mutation.Status(); ok {\n\t\tif err := httpdetector.StatusValidator(int8(v)); err != nil {\n\t\t\treturn &ValidationError{Name: \"status\", err: fmt.Errorf(`ent: validator failed for field \"HTTPDetector.status\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := hdu.mutation.Name(); ok {\n\t\tif err := httpdetector.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(`ent: validator failed for field \"HTTPDetector.name\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := hdu.mutation.Timeout(); ok {\n\t\tif err := httpdetector.TimeoutValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"timeout\", err: fmt.Errorf(`ent: validator failed for field \"HTTPDetector.timeout\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := hdu.mutation.URL(); ok {\n\t\tif err := httpdetector.URLValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"url\", err: fmt.Errorf(`ent: validator failed for field \"HTTPDetector.url\": %w`, err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d23ebc4b8d3fbea970f6db8f45c99e7f", "score": "0.596966", "text": "func (cc *CardCreate) check() error {\n\tif _, ok := cc.mutation.GetType(); !ok {\n\t\treturn &ValidationError{Name: \"type\", err: errors.New(\"ent: missing required field \\\"type\\\"\")}\n\t}\n\tif v, ok := cc.mutation.GetType(); ok {\n\t\tif err := card.TypeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"type\", err: fmt.Errorf(\"ent: validator failed for field \\\"type\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := cc.mutation.Number(); !ok {\n\t\treturn &ValidationError{Name: \"number\", err: errors.New(\"ent: missing required field \\\"number\\\"\")}\n\t}\n\tif _, ok := cc.mutation.StartDate(); !ok {\n\t\treturn &ValidationError{Name: \"startDate\", err: errors.New(\"ent: missing required field \\\"startDate\\\"\")}\n\t}\n\tif _, ok := cc.mutation.ExpiryDate(); !ok {\n\t\treturn &ValidationError{Name: \"expiryDate\", err: errors.New(\"ent: missing required field \\\"expiryDate\\\"\")}\n\t}\n\tif _, ok := cc.mutation.HolderName(); !ok {\n\t\treturn &ValidationError{Name: \"holderName\", err: errors.New(\"ent: missing required field \\\"holderName\\\"\")}\n\t}\n\tif _, ok := cc.mutation.Status(); !ok {\n\t\treturn &ValidationError{Name: \"status\", err: errors.New(\"ent: missing required field \\\"status\\\"\")}\n\t}\n\tif v, ok := cc.mutation.Status(); ok {\n\t\tif err := card.StatusValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"status\", err: fmt.Errorf(\"ent: validator failed for field \\\"status\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := cc.mutation.URL(); !ok {\n\t\treturn &ValidationError{Name: \"url\", err: errors.New(\"ent: missing required field \\\"url\\\"\")}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ef68686fc47cc039877ddad79d9faca9", "score": "0.59616727", "text": "func (tuo *TransactionUpdateOne) check() error {\n\tif v, ok := tuo.mutation.Status(); ok {\n\t\tif err := transaction.StatusValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"status\", err: fmt.Errorf(\"ent: validator failed for field \\\"status\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := tuo.mutation.ExecutedCurrencyCode(); ok {\n\t\tif err := transaction.ExecutedCurrencyCodeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"executedCurrencyCode\", err: fmt.Errorf(\"ent: validator failed for field \\\"executedCurrencyCode\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := tuo.mutation.OriginatingCurrencyCode(); ok {\n\t\tif err := transaction.OriginatingCurrencyCodeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"originatingCurrencyCode\", err: fmt.Errorf(\"ent: validator failed for field \\\"originatingCurrencyCode\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := tuo.mutation.Direction(); ok {\n\t\tif err := transaction.DirectionValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"direction\", err: fmt.Errorf(\"ent: validator failed for field \\\"direction\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0327d700b145d9074310b60323b0b2e5", "score": "0.5943712", "text": "func (suu *SysUserUpdate) check() error {\n\tif v, ok := suu.mutation.RealName(); ok {\n\t\tif err := sysuser.RealNameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"real_name\", err: fmt.Errorf(\"ent: validator failed for field \\\"real_name\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := suu.mutation.FirstName(); ok {\n\t\tif err := sysuser.FirstNameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"first_name\", err: fmt.Errorf(\"ent: validator failed for field \\\"first_name\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := suu.mutation.LastName(); ok {\n\t\tif err := sysuser.LastNameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"last_name\", err: fmt.Errorf(\"ent: validator failed for field \\\"last_name\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := suu.mutation.Password(); ok {\n\t\tif err := sysuser.PasswordValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"Password\", err: fmt.Errorf(\"ent: validator failed for field \\\"Password\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := suu.mutation.Email(); ok {\n\t\tif err := sysuser.EmailValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"Email\", err: fmt.Errorf(\"ent: validator failed for field \\\"Email\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := suu.mutation.Phone(); ok {\n\t\tif err := sysuser.PhoneValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"Phone\", err: fmt.Errorf(\"ent: validator failed for field \\\"Phone\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "95c81e9ac94e78efb86059a8fc8167f5", "score": "0.5938081", "text": "func (wc *WorkspaceCreate) check() error {\n\tif _, ok := wc.mutation.Name(); !ok {\n\t\treturn &ValidationError{Name: \"name\", err: errors.New(\"models: missing required field \\\"name\\\"\")}\n\t}\n\tif v, ok := wc.mutation.Name(); ok {\n\t\tif err := workspace.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(\"models: validator failed for field \\\"name\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := wc.mutation.Plan(); !ok {\n\t\treturn &ValidationError{Name: \"plan\", err: errors.New(\"models: missing required field \\\"plan\\\"\")}\n\t}\n\tif v, ok := wc.mutation.Plan(); ok {\n\t\tif err := workspace.PlanValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"plan\", err: fmt.Errorf(\"models: validator failed for field \\\"plan\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := wc.mutation.Description(); ok {\n\t\tif err := workspace.DescriptionValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"description\", err: fmt.Errorf(\"models: validator failed for field \\\"description\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := wc.mutation.CreatedAt(); !ok {\n\t\treturn &ValidationError{Name: \"created_at\", err: errors.New(\"models: missing required field \\\"created_at\\\"\")}\n\t}\n\tif _, ok := wc.mutation.UpdatedAt(); !ok {\n\t\treturn &ValidationError{Name: \"updated_at\", err: errors.New(\"models: missing required field \\\"updated_at\\\"\")}\n\t}\n\tif _, ok := wc.mutation.OwnerID(); !ok {\n\t\treturn &ValidationError{Name: \"owner\", err: errors.New(\"models: missing required edge \\\"owner\\\"\")}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "52cda27cb4dfb992121a4b36ae00e1f8", "score": "0.59359515", "text": "func (suuo *SysUserUpdateOne) check() error {\n\tif v, ok := suuo.mutation.RealName(); ok {\n\t\tif err := sysuser.RealNameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"real_name\", err: fmt.Errorf(\"ent: validator failed for field \\\"real_name\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := suuo.mutation.FirstName(); ok {\n\t\tif err := sysuser.FirstNameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"first_name\", err: fmt.Errorf(\"ent: validator failed for field \\\"first_name\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := suuo.mutation.LastName(); ok {\n\t\tif err := sysuser.LastNameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"last_name\", err: fmt.Errorf(\"ent: validator failed for field \\\"last_name\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := suuo.mutation.Password(); ok {\n\t\tif err := sysuser.PasswordValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"Password\", err: fmt.Errorf(\"ent: validator failed for field \\\"Password\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := suuo.mutation.Email(); ok {\n\t\tif err := sysuser.EmailValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"Email\", err: fmt.Errorf(\"ent: validator failed for field \\\"Email\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := suuo.mutation.Phone(); ok {\n\t\tif err := sysuser.PhoneValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"Phone\", err: fmt.Errorf(\"ent: validator failed for field \\\"Phone\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6a7a3530f694de111f08c2633c427b70", "score": "0.5922713", "text": "func (ac *AccountCreate) check() error {\n\tif _, ok := ac.mutation.GetType(); !ok {\n\t\treturn &ValidationError{Name: \"type\", err: errors.New(\"ent: missing required field \\\"type\\\"\")}\n\t}\n\tif _, ok := ac.mutation.Number(); !ok {\n\t\treturn &ValidationError{Name: \"number\", err: errors.New(\"ent: missing required field \\\"number\\\"\")}\n\t}\n\tif _, ok := ac.mutation.Name(); !ok {\n\t\treturn &ValidationError{Name: \"name\", err: errors.New(\"ent: missing required field \\\"name\\\"\")}\n\t}\n\tif _, ok := ac.mutation.Title(); !ok {\n\t\treturn &ValidationError{Name: \"title\", err: errors.New(\"ent: missing required field \\\"title\\\"\")}\n\t}\n\tif _, ok := ac.mutation.DateCreated(); !ok {\n\t\treturn &ValidationError{Name: \"dateCreated\", err: errors.New(\"ent: missing required field \\\"dateCreated\\\"\")}\n\t}\n\tif _, ok := ac.mutation.DateOpened(); !ok {\n\t\treturn &ValidationError{Name: \"dateOpened\", err: errors.New(\"ent: missing required field \\\"dateOpened\\\"\")}\n\t}\n\tif _, ok := ac.mutation.DateLastUpdated(); !ok {\n\t\treturn &ValidationError{Name: \"dateLastUpdated\", err: errors.New(\"ent: missing required field \\\"dateLastUpdated\\\"\")}\n\t}\n\tif _, ok := ac.mutation.CurrencyCode(); !ok {\n\t\treturn &ValidationError{Name: \"currencyCode\", err: errors.New(\"ent: missing required field \\\"currencyCode\\\"\")}\n\t}\n\tif _, ok := ac.mutation.Status(); !ok {\n\t\treturn &ValidationError{Name: \"status\", err: errors.New(\"ent: missing required field \\\"status\\\"\")}\n\t}\n\tif v, ok := ac.mutation.Status(); ok {\n\t\tif err := account.StatusValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"status\", err: fmt.Errorf(\"ent: validator failed for field \\\"status\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := ac.mutation.Source(); !ok {\n\t\treturn &ValidationError{Name: \"source\", err: errors.New(\"ent: missing required field \\\"source\\\"\")}\n\t}\n\tif _, ok := ac.mutation.InterestReporting(); !ok {\n\t\treturn &ValidationError{Name: \"interestReporting\", err: errors.New(\"ent: missing required field \\\"interestReporting\\\"\")}\n\t}\n\tif _, ok := ac.mutation.CurrentBalance(); !ok {\n\t\treturn &ValidationError{Name: \"currentBalance\", err: errors.New(\"ent: missing required field \\\"currentBalance\\\"\")}\n\t}\n\tif _, ok := ac.mutation.AvailableBalance(); !ok {\n\t\treturn &ValidationError{Name: \"availableBalance\", err: errors.New(\"ent: missing required field \\\"availableBalance\\\"\")}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4234c900fdd0aff346e31270fd292bfc", "score": "0.5914133", "text": "func (arc *APIResponseCreate) check() error {\n\tif _, ok := arc.mutation.Code(); !ok {\n\t\treturn &ValidationError{Name: \"code\", err: errors.New(\"ent: missing required field \\\"code\\\"\")}\n\t}\n\tif v, ok := arc.mutation.Code(); ok {\n\t\tif err := apiresponse.CodeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"code\", err: fmt.Errorf(\"ent: validator failed for field \\\"code\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := arc.mutation.GetType(); !ok {\n\t\treturn &ValidationError{Name: \"type\", err: errors.New(\"ent: missing required field \\\"type\\\"\")}\n\t}\n\tif _, ok := arc.mutation.Message(); !ok {\n\t\treturn &ValidationError{Name: \"message\", err: errors.New(\"ent: missing required field \\\"message\\\"\")}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6df8b3c0294890f8b0a527c0e1f15f3e", "score": "0.58989227", "text": "func (ucc *UserCardCreate) check() error {\n\tif _, ok := ucc.mutation.CreatedAt(); !ok {\n\t\treturn &ValidationError{Name: \"created_at\", err: errors.New(`ent: missing required field \"created_at\"`)}\n\t}\n\tif _, ok := ucc.mutation.UpdatedAt(); !ok {\n\t\treturn &ValidationError{Name: \"updated_at\", err: errors.New(`ent: missing required field \"updated_at\"`)}\n\t}\n\tif _, ok := ucc.mutation.LimitDaily(); !ok {\n\t\treturn &ValidationError{Name: \"limit_daily\", err: errors.New(`ent: missing required field \"limit_daily\"`)}\n\t}\n\tif _, ok := ucc.mutation.LimitMonthly(); !ok {\n\t\treturn &ValidationError{Name: \"limit_monthly\", err: errors.New(`ent: missing required field \"limit_monthly\"`)}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d9ca0102fee50af7de871fad1606065d", "score": "0.5895411", "text": "func (pu *PetUpdate) check() error {\n\tif v, ok := pu.mutation.Height(); ok {\n\t\tif err := pet.HeightValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"height\", err: fmt.Errorf(\"ent: validator failed for field \\\"height\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := pu.mutation.Weight(); ok {\n\t\tif err := pet.WeightValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"weight\", err: fmt.Errorf(\"ent: validator failed for field \\\"weight\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := pu.mutation.Sex(); ok {\n\t\tif err := pet.SexValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"sex\", err: fmt.Errorf(\"ent: validator failed for field \\\"sex\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := pu.mutation.BadgeID(); pu.mutation.BadgeCleared() && !ok {\n\t\treturn errors.New(\"ent: clearing a required unique edge \\\"badge\\\"\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "924c0514c07cc6b91801f5a8161c6193", "score": "0.58939976", "text": "func (tu *TransactionUpdate) check() error {\n\tif v, ok := tu.mutation.Status(); ok {\n\t\tif err := transaction.StatusValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"status\", err: fmt.Errorf(\"ent: validator failed for field \\\"status\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := tu.mutation.ExecutedCurrencyCode(); ok {\n\t\tif err := transaction.ExecutedCurrencyCodeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"executedCurrencyCode\", err: fmt.Errorf(\"ent: validator failed for field \\\"executedCurrencyCode\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := tu.mutation.OriginatingCurrencyCode(); ok {\n\t\tif err := transaction.OriginatingCurrencyCodeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"originatingCurrencyCode\", err: fmt.Errorf(\"ent: validator failed for field \\\"originatingCurrencyCode\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := tu.mutation.Direction(); ok {\n\t\tif err := transaction.DirectionValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"direction\", err: fmt.Errorf(\"ent: validator failed for field \\\"direction\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "16acea9e55b4e37da52de2ce6916bcb8", "score": "0.58870596", "text": "func (m *MainCfg) check() error {\n\tif len(m.AutoscalerFiles) == 0 {\n\t\treturn fmt.Errorf(\"Autoscaler files can't be empty\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4e8424217c4f2c1a021dbf9a97eeb073", "score": "0.5884465", "text": "func (uuo *UserUpdateOne) check() error {\n\tif v, ok := uuo.mutation.Username(); ok {\n\t\tif err := user.UsernameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"username\", err: fmt.Errorf(\"ent: validator failed for field \\\"username\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uuo.mutation.Password(); ok {\n\t\tif err := user.PasswordValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"password\", err: fmt.Errorf(\"ent: validator failed for field \\\"password\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cac18a107cc69358cfc2d3b8babfceb1", "score": "0.5878986", "text": "func (uu *UserUpdate) check() error {\n\tif v, ok := uu.mutation.Username(); ok {\n\t\tif err := user.UsernameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"username\", err: fmt.Errorf(\"ent: validator failed for field \\\"username\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := uu.mutation.Password(); ok {\n\t\tif err := user.PasswordValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"password\", err: fmt.Errorf(\"ent: validator failed for field \\\"password\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c9a8ea7636f4a97fea849a7fd231c2eb", "score": "0.5871045", "text": "func (bmc *BookingMetadatumCreate) check() error {\n\tif _, ok := bmc.mutation.Key(); !ok {\n\t\treturn &ValidationError{Name: \"key\", err: errors.New(`ent: missing required field \"key\"`)}\n\t}\n\tif _, ok := bmc.mutation.Value(); !ok {\n\t\treturn &ValidationError{Name: \"value\", err: errors.New(`ent: missing required field \"value\"`)}\n\t}\n\tif _, ok := bmc.mutation.BookingId(); !ok {\n\t\treturn &ValidationError{Name: \"bookingId\", err: errors.New(`ent: missing required field \"bookingId\"`)}\n\t}\n\tif _, ok := bmc.mutation.BookingID(); !ok {\n\t\treturn &ValidationError{Name: \"booking\", err: errors.New(\"ent: missing required edge \\\"booking\\\"\")}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0b67a898785e966aef265c3e9f441c6c", "score": "0.58593076", "text": "func (cuuo *CompanyUserUpdateOne) check() error {\n\tif v, ok := cuuo.mutation.LastName(); ok {\n\t\tif err := companyuser.LastNameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"last_name\", err: fmt.Errorf(\"ent: validator failed for field \\\"last_name\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cuuo.mutation.FirstName(); ok {\n\t\tif err := companyuser.FirstNameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"first_name\", err: fmt.Errorf(\"ent: validator failed for field \\\"first_name\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cuuo.mutation.LastNameFurigana(); ok {\n\t\tif err := companyuser.LastNameFuriganaValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"last_name_furigana\", err: fmt.Errorf(\"ent: validator failed for field \\\"last_name_furigana\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cuuo.mutation.FirstNameFurigana(); ok {\n\t\tif err := companyuser.FirstNameFuriganaValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"first_name_furigana\", err: fmt.Errorf(\"ent: validator failed for field \\\"first_name_furigana\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cuuo.mutation.ProfileName(); ok {\n\t\tif err := companyuser.ProfileNameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"profile_name\", err: fmt.Errorf(\"ent: validator failed for field \\\"profile_name\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cuuo.mutation.IconURL(); ok {\n\t\tif err := companyuser.IconURLValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"icon_url\", err: fmt.Errorf(\"ent: validator failed for field \\\"icon_url\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cuuo.mutation.Gender(); ok {\n\t\tif err := companyuser.GenderValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"gender\", err: fmt.Errorf(\"ent: validator failed for field \\\"gender\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1427b6e5c0e6f0bdadbc6a64910b5467", "score": "0.58516866", "text": "func (sec *StudyEligibilityCreate) check() error {\n\tif _, ok := sec.mutation.EligibilityCriteria(); !ok {\n\t\treturn &ValidationError{Name: \"EligibilityCriteria\", err: errors.New(`models: missing required field \"StudyEligibility.EligibilityCriteria\"`)}\n\t}\n\tif _, ok := sec.mutation.HealthyVolunteers(); !ok {\n\t\treturn &ValidationError{Name: \"HealthyVolunteers\", err: errors.New(`models: missing required field \"StudyEligibility.HealthyVolunteers\"`)}\n\t}\n\tif _, ok := sec.mutation.Gender(); !ok {\n\t\treturn &ValidationError{Name: \"Gender\", err: errors.New(`models: missing required field \"StudyEligibility.Gender\"`)}\n\t}\n\tif _, ok := sec.mutation.MinimumAge(); !ok {\n\t\treturn &ValidationError{Name: \"MinimumAge\", err: errors.New(`models: missing required field \"StudyEligibility.MinimumAge\"`)}\n\t}\n\tif _, ok := sec.mutation.MaximumAge(); !ok {\n\t\treturn &ValidationError{Name: \"MaximumAge\", err: errors.New(`models: missing required field \"StudyEligibility.MaximumAge\"`)}\n\t}\n\tif _, ok := sec.mutation.StdAgeList(); !ok {\n\t\treturn &ValidationError{Name: \"StdAgeList\", err: errors.New(`models: missing required field \"StudyEligibility.StdAgeList\"`)}\n\t}\n\tif _, ok := sec.mutation.Ethnicity(); !ok {\n\t\treturn &ValidationError{Name: \"Ethnicity\", err: errors.New(`models: missing required field \"StudyEligibility.Ethnicity\"`)}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "34a548465e15ee912a541180a5be6092", "score": "0.58508646", "text": "func (rc *ReportwallettbCreate) check() error {\n\tif _, ok := rc.mutation.Walletid(); !ok {\n\t\treturn &ValidationError{Name: \"walletid\", err: errors.New(\"ent: missing required field \\\"walletid\\\"\")}\n\t}\n\tif v, ok := rc.mutation.Walletid(); ok {\n\t\tif err := reportwallettb.WalletidValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"walletid\", err: fmt.Errorf(\"ent: validator failed for field \\\"walletid\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rc.mutation.WalletTypeName(); ok {\n\t\tif err := reportwallettb.WalletTypeNameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"WalletTypeName\", err: fmt.Errorf(\"ent: validator failed for field \\\"WalletTypeName\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rc.mutation.WalletPhoneno(); ok {\n\t\tif err := reportwallettb.WalletPhonenoValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"WalletPhoneno\", err: fmt.Errorf(\"ent: validator failed for field \\\"WalletPhoneno\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rc.mutation.WalletName(); ok {\n\t\tif err := reportwallettb.WalletNameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"WalletName\", err: fmt.Errorf(\"ent: validator failed for field \\\"WalletName\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rc.mutation.CitizenId(); ok {\n\t\tif err := reportwallettb.CitizenIdValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"CitizenId\", err: fmt.Errorf(\"ent: validator failed for field \\\"CitizenId\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rc.mutation.Status(); ok {\n\t\tif err := reportwallettb.StatusValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"Status\", err: fmt.Errorf(\"ent: validator failed for field \\\"Status\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rc.mutation.UserAgent(); ok {\n\t\tif err := reportwallettb.UserAgentValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"UserAgent\", err: fmt.Errorf(\"ent: validator failed for field \\\"UserAgent\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rc.mutation.ATMCard(); ok {\n\t\tif err := reportwallettb.ATMCardValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"ATMCard\", err: fmt.Errorf(\"ent: validator failed for field \\\"ATMCard\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rc.mutation.AccountNo(); ok {\n\t\tif err := reportwallettb.AccountNoValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"AccountNo\", err: fmt.Errorf(\"ent: validator failed for field \\\"AccountNo\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rc.mutation.Province(); ok {\n\t\tif err := reportwallettb.ProvinceValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"Province\", err: fmt.Errorf(\"ent: validator failed for field \\\"Province\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rc.mutation.PostalCode(); ok {\n\t\tif err := reportwallettb.PostalCodeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"PostalCode\", err: fmt.Errorf(\"ent: validator failed for field \\\"PostalCode\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := rc.mutation.IsKYC(); ok {\n\t\tif err := reportwallettb.IsKYCValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"isKYC\", err: fmt.Errorf(\"ent: validator failed for field \\\"isKYC\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "80b1c4e0991fbbae6ace56b96eb183bc", "score": "0.58506465", "text": "func (rc *RestaurantCreate) check() error {\n\tif _, ok := rc.mutation.Name(); !ok {\n\t\treturn &ValidationError{Name: \"name\", err: errors.New(\"ent: missing required field \\\"name\\\"\")}\n\t}\n\tif v, ok := rc.mutation.Name(); ok {\n\t\tif err := restaurant.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(\"ent: validator failed for field \\\"name\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "db95d39bdefc8f28e2e16127eda70541", "score": "0.58464783", "text": "func (ac *AlertCreate) check() error {\n\tif _, ok := ac.mutation.Scenario(); !ok {\n\t\treturn &ValidationError{Name: \"scenario\", err: errors.New(`ent: missing required field \"Alert.scenario\"`)}\n\t}\n\tif _, ok := ac.mutation.Simulated(); !ok {\n\t\treturn &ValidationError{Name: \"simulated\", err: errors.New(`ent: missing required field \"Alert.simulated\"`)}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b2518bc3f0989288a73b8cc0bc341374", "score": "0.58464557", "text": "func (mc *MetadataCreate) check() error {\n\tif _, ok := mc.mutation.Age(); !ok {\n\t\treturn &ValidationError{Name: \"age\", err: errors.New(`ent: missing required field \"Metadata.age\"`)}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8654cc96b0f43f70e07d08ef7da9cfec", "score": "0.5845067", "text": "func (nc *NodeCreate) check() error {\n\tif _, ok := nc.mutation.Tenant(); !ok {\n\t\treturn &ValidationError{Name: \"tenant\", err: errors.New(\"ent: missing required field \\\"tenant\\\"\")}\n\t}\n\tif v, ok := nc.mutation.Tenant(); ok {\n\t\tif err := node.TenantValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"tenant\", err: fmt.Errorf(\"ent: validator failed for field \\\"tenant\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := nc.mutation.Name(); !ok {\n\t\treturn &ValidationError{Name: \"name\", err: errors.New(\"ent: missing required field \\\"name\\\"\")}\n\t}\n\tif v, ok := nc.mutation.Name(); ok {\n\t\tif err := node.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(\"ent: validator failed for field \\\"name\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := nc.mutation.GetType(); !ok {\n\t\treturn &ValidationError{Name: \"type\", err: errors.New(\"ent: missing required field \\\"type\\\"\")}\n\t}\n\tif v, ok := nc.mutation.GetType(); ok {\n\t\tif err := node.TypeValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"type\", err: fmt.Errorf(\"ent: validator failed for field \\\"type\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := nc.mutation.Data(); !ok {\n\t\treturn &ValidationError{Name: \"data\", err: errors.New(\"ent: missing required field \\\"data\\\"\")}\n\t}\n\tif _, ok := nc.mutation.CreatedAt(); !ok {\n\t\treturn &ValidationError{Name: \"created_at\", err: errors.New(\"ent: missing required field \\\"created_at\\\"\")}\n\t}\n\tif _, ok := nc.mutation.UpdatedAt(); !ok {\n\t\treturn &ValidationError{Name: \"updated_at\", err: errors.New(\"ent: missing required field \\\"updated_at\\\"\")}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bcd381b65e361376e8e58a45de8ab006", "score": "0.5843084", "text": "func (sc *StateCreate) check() error {\n\tif _, ok := sc.mutation.CreatedAt(); !ok {\n\t\treturn &ValidationError{Name: \"created_at\", err: errors.New(`ent: missing required field \"created_at\"`)}\n\t}\n\tif _, ok := sc.mutation.UpdatedAt(); !ok {\n\t\treturn &ValidationError{Name: \"updated_at\", err: errors.New(`ent: missing required field \"updated_at\"`)}\n\t}\n\tif _, ok := sc.mutation.Short(); !ok {\n\t\treturn &ValidationError{Name: \"short\", err: errors.New(`ent: missing required field \"short\"`)}\n\t}\n\tif v, ok := sc.mutation.Short(); ok {\n\t\tif err := state.ShortValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"short\", err: fmt.Errorf(`ent: validator failed for field \"short\": %w`, err)}\n\t\t}\n\t}\n\tif _, ok := sc.mutation.Title(); !ok {\n\t\treturn &ValidationError{Name: \"title\", err: errors.New(`ent: missing required field \"title\"`)}\n\t}\n\tif v, ok := sc.mutation.Title(); ok {\n\t\tif err := state.TitleValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"title\", err: fmt.Errorf(`ent: validator failed for field \"title\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := sc.mutation.Description(); ok {\n\t\tif err := state.DescriptionValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"description\", err: fmt.Errorf(`ent: validator failed for field \"description\": %w`, err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c2670fb492cd80d930d837dcbc9942c5", "score": "0.58383876", "text": "func (in WasmPluginChecker) Check() models.IstioValidations {\n\tvalidations := models.IstioValidations{}\n\n\treturn validations\n}", "title": "" }, { "docid": "c9ee2e2fabbbfafe0e65203fd14b67d4", "score": "0.5838124", "text": "func (qc *QuestionCreate) check() error {\n\tif _, ok := qc.mutation.Body(); !ok {\n\t\treturn &ValidationError{Name: \"body\", err: errors.New(`ent: missing required field \"body\"`)}\n\t}\n\tif _, ok := qc.mutation.UserID(); !ok {\n\t\treturn &ValidationError{Name: \"user_id\", err: errors.New(`ent: missing required field \"user_id\"`)}\n\t}\n\tif _, ok := qc.mutation.PollExpiry(); !ok {\n\t\treturn &ValidationError{Name: \"pollExpiry\", err: errors.New(`ent: missing required field \"pollExpiry\"`)}\n\t}\n\tif _, ok := qc.mutation.CreatedAt(); !ok {\n\t\treturn &ValidationError{Name: \"created_at\", err: errors.New(`ent: missing required field \"created_at\"`)}\n\t}\n\tif _, ok := qc.mutation.UpdatedAt(); !ok {\n\t\treturn &ValidationError{Name: \"updated_at\", err: errors.New(`ent: missing required field \"updated_at\"`)}\n\t}\n\tif _, ok := qc.mutation.UserID(); !ok {\n\t\treturn &ValidationError{Name: \"user\", err: errors.New(\"ent: missing required edge \\\"user\\\"\")}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "78547698aaf0cfa5ee8fe9a65e5ac6f5", "score": "0.58343345", "text": "func (hduo *HTTPDetectorUpdateOne) check() error {\n\tif v, ok := hduo.mutation.Status(); ok {\n\t\tif err := httpdetector.StatusValidator(int8(v)); err != nil {\n\t\t\treturn &ValidationError{Name: \"status\", err: fmt.Errorf(`ent: validator failed for field \"HTTPDetector.status\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := hduo.mutation.Name(); ok {\n\t\tif err := httpdetector.NameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name\", err: fmt.Errorf(`ent: validator failed for field \"HTTPDetector.name\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := hduo.mutation.Timeout(); ok {\n\t\tif err := httpdetector.TimeoutValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"timeout\", err: fmt.Errorf(`ent: validator failed for field \"HTTPDetector.timeout\": %w`, err)}\n\t\t}\n\t}\n\tif v, ok := hduo.mutation.URL(); ok {\n\t\tif err := httpdetector.URLValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"url\", err: fmt.Errorf(`ent: validator failed for field \"HTTPDetector.url\": %w`, err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e8b08ae4985e05ab222df5d81eb62e28", "score": "0.58321387", "text": "func (auo *AvatarUpdateOne) check() error {\n\tif v, ok := auo.mutation.URL(); ok {\n\t\tif err := avatar.URLValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"url\", err: fmt.Errorf(\"ent: validator failed for field \\\"url\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := auo.mutation.Status(); ok {\n\t\tif err := avatar.StatusValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"status\", err: fmt.Errorf(\"ent: validator failed for field \\\"status\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ad0a33f518b427efb9d6ee5bd9e2c233", "score": "0.5827806", "text": "func (gic *GroupInfoCreate) check() error {\n\tif _, ok := gic.mutation.Desc(); !ok {\n\t\treturn &ValidationError{Name: \"desc\", err: errors.New(`ent: missing required field \"GroupInfo.desc\"`)}\n\t}\n\tif _, ok := gic.mutation.MaxUsers(); !ok {\n\t\treturn &ValidationError{Name: \"max_users\", err: errors.New(`ent: missing required field \"GroupInfo.max_users\"`)}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "20777b674308527dffb5c312902ee993", "score": "0.58269715", "text": "func (sdc *SysDictCreate) check() error {\n\tif _, ok := sdc.mutation.IsDel(); !ok {\n\t\treturn &ValidationError{Name: \"is_del\", err: errors.New(\"ent: missing required field \\\"is_del\\\"\")}\n\t}\n\tif _, ok := sdc.mutation.Memo(); !ok {\n\t\treturn &ValidationError{Name: \"memo\", err: errors.New(\"ent: missing required field \\\"memo\\\"\")}\n\t}\n\tif v, ok := sdc.mutation.Memo(); ok {\n\t\tif err := sysdict.MemoValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"memo\", err: fmt.Errorf(\"ent: validator failed for field \\\"memo\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := sdc.mutation.Sort(); !ok {\n\t\treturn &ValidationError{Name: \"sort\", err: errors.New(\"ent: missing required field \\\"sort\\\"\")}\n\t}\n\tif _, ok := sdc.mutation.CreatedAt(); !ok {\n\t\treturn &ValidationError{Name: \"created_at\", err: errors.New(\"ent: missing required field \\\"created_at\\\"\")}\n\t}\n\tif _, ok := sdc.mutation.UpdatedAt(); !ok {\n\t\treturn &ValidationError{Name: \"updated_at\", err: errors.New(\"ent: missing required field \\\"updated_at\\\"\")}\n\t}\n\tif _, ok := sdc.mutation.Status(); !ok {\n\t\treturn &ValidationError{Name: \"status\", err: errors.New(\"ent: missing required field \\\"status\\\"\")}\n\t}\n\tif _, ok := sdc.mutation.NameCn(); !ok {\n\t\treturn &ValidationError{Name: \"name_cn\", err: errors.New(\"ent: missing required field \\\"name_cn\\\"\")}\n\t}\n\tif v, ok := sdc.mutation.NameCn(); ok {\n\t\tif err := sysdict.NameCnValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name_cn\", err: fmt.Errorf(\"ent: validator failed for field \\\"name_cn\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := sdc.mutation.NameEn(); !ok {\n\t\treturn &ValidationError{Name: \"name_en\", err: errors.New(\"ent: missing required field \\\"name_en\\\"\")}\n\t}\n\tif v, ok := sdc.mutation.NameEn(); ok {\n\t\tif err := sysdict.NameEnValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"name_en\", err: fmt.Errorf(\"ent: validator failed for field \\\"name_en\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := sdc.mutation.ID(); ok {\n\t\tif err := sysdict.IDValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"id\", err: fmt.Errorf(\"ent: validator failed for field \\\"id\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5902a5c9d905dacdbab9e5a69018edc0", "score": "0.5823135", "text": "func (cuu *CompanyUserUpdate) check() error {\n\tif v, ok := cuu.mutation.LastName(); ok {\n\t\tif err := companyuser.LastNameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"last_name\", err: fmt.Errorf(\"ent: validator failed for field \\\"last_name\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cuu.mutation.FirstName(); ok {\n\t\tif err := companyuser.FirstNameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"first_name\", err: fmt.Errorf(\"ent: validator failed for field \\\"first_name\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cuu.mutation.LastNameFurigana(); ok {\n\t\tif err := companyuser.LastNameFuriganaValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"last_name_furigana\", err: fmt.Errorf(\"ent: validator failed for field \\\"last_name_furigana\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cuu.mutation.FirstNameFurigana(); ok {\n\t\tif err := companyuser.FirstNameFuriganaValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"first_name_furigana\", err: fmt.Errorf(\"ent: validator failed for field \\\"first_name_furigana\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cuu.mutation.ProfileName(); ok {\n\t\tif err := companyuser.ProfileNameValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"profile_name\", err: fmt.Errorf(\"ent: validator failed for field \\\"profile_name\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cuu.mutation.IconURL(); ok {\n\t\tif err := companyuser.IconURLValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"icon_url\", err: fmt.Errorf(\"ent: validator failed for field \\\"icon_url\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := cuu.mutation.Gender(); ok {\n\t\tif err := companyuser.GenderValidator(v); err != nil {\n\t\t\treturn &ValidationError{Name: \"gender\", err: fmt.Errorf(\"ent: validator failed for field \\\"gender\\\": %w\", err)}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" } ]
57fcd7ef72bf2f58387d7199de9bb22b
Create creates a new tab.
[ { "docid": "222b538e48d130ed91a323792213a03e", "score": "0.74718887", "text": "func (t *Tabs) Create(createProperties interface{}, callback func(tab Tab)) {\n\tt.o.Call(\"create\", createProperties, callback)\n}", "title": "" } ]
[ { "docid": "6757d154796cc8d55eab6040a1c07ba8", "score": "0.6776617", "text": "func (c *Gcd) NewTab() (*ChromeTarget, error) {\n\treq, err := http.NewRequest(\"PUT\", c.apiEndpoint+\"/new\", nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\tbody, errRead := ioutil.ReadAll(resp.Body)\n\tif errRead != nil {\n\t\treturn nil, &GcdBodyReadErr{Message: errRead.Error()}\n\t}\n\n\ttabTarget := &TargetInfo{}\n\terr = json.Unmarshal(body, &tabTarget)\n\tif err != nil {\n\t\treturn nil, &GcdDecodingErr{Message: err.Error()}\n\t}\n\treturn openChromeTarget(c, tabTarget, c.messageObserver)\n}", "title": "" }, { "docid": "e7c01e5945444554b8d6a9b1c361852a", "score": "0.633815", "text": "func NewTab(args []string) {\n\tif len(args) == 0 {\n\t\tCurView().AddTab(true)\n\t} else {\n\t\tbuf, err := NewBufferFromFile(args[0])\n\t\tif err != nil {\n\t\t\tmessenger.Alert(\"error\", err)\n\t\t\treturn\n\t\t}\n\n\t\ttab := NewTabFromView(NewView(buf))\n\t\ttab.SetNum(len(tabs))\n\t\ttabs = append(tabs, tab)\n\t\tcurTab = len(tabs) - 1\n\t\tif len(tabs) == 2 {\n\t\t\tfor _, t := range tabs {\n\t\t\t\tfor _, v := range t.Views {\n\t\t\t\t\tv.AddTabbarSpace()\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "21e36eab9c073f1300ca3feb1687fded", "score": "0.632764", "text": "func (s *Service) Create(tabMetadata *model.TabMetadata) *CreateOp {\n\treturn &CreateOp{\n\t\tCredential: s.credential,\n\t\tMethod: \"POST\",\n\t\tPath: \"tab_definitions\",\n\t\tPayload: tabMetadata,\n\t\tQueryOpts: make(url.Values),\n\t\tVersion: esign.APIv21,\n\t}\n}", "title": "" }, { "docid": "11f370b873fc81e2f5bb4cd4630dd567", "score": "0.6145206", "text": "func newTab(ctx context.Context) Tab {\n\tctx, cancel := context.WithTimeout(ctx, 60*time.Second)\n\tctx, _ = chromedp.NewContext(ctx)\n\treturn Tab{context: ctx, cancel: cancel}\n}", "title": "" }, { "docid": "bd15c02179d71ba83be35e580d951a1b", "score": "0.600452", "text": "func openNewTab() {\n\trobotgo.Sleep(2)\n\trobotgo.KeyToggle(\"control\", \"down\")\n\trobotgo.KeyTap(\"t\")\n\trobotgo.KeyToggle(\"control\", \"up\")\n\trobotgo.TypeStringDelayed(\"https://docs.google.com/spreadsheets/u/0/create?usp=sheets_home\", 300)\n\trobotgo.KeyTap(\"enter\")\n}", "title": "" }, { "docid": "d03d9260bc71854f830b9a29566cb92f", "score": "0.5893878", "text": "func NewTab() *Tab {\n\tt := new(Tab)\n\n\tt.t = C.uiNewTab()\n\n\tt.ControlBase = NewControlBase(t, uintptr(unsafe.Pointer(t.t)))\n\treturn t\n}", "title": "" }, { "docid": "f77b33a37f74ae8a513a0d8abaab5d6c", "score": "0.5833899", "text": "func Create(w http.ResponseWriter, r *http.Request) {\n\ttmpl.ExecuteTemplate(w, \"create\", nil)\n}", "title": "" }, { "docid": "7b86576a90400cca6060af1d6c5ce89d", "score": "0.57452196", "text": "func NewTabItem(text string, content fyne.CanvasObject) *TabItem {\n\treturn &TabItem{Text: text, Content: content}\n}", "title": "" }, { "docid": "f7202673ad5d19fbcc7266e79e11d19c", "score": "0.56262326", "text": "func (c ProjectPanelCreator) Create(ctx context.Context, parent page.ControlI) page.ControlI {\n\tctrl := NewProjectPanel(parent)\n\treturn ctrl\n}", "title": "" }, { "docid": "64980572495af7c847d71397c6c34e7b", "score": "0.5577791", "text": "func NewTabItem(text string, content fyne.CanvasObject) *TabItem {\n\treturn widget.NewTabItem(text, content)\n}", "title": "" }, { "docid": "dd2a0aa17e74769dcdf05db0af8a46c3", "score": "0.55331576", "text": "func openTabs(ctx context.Context, br *browser.Browser, createTabCount, mbPerTab int, compressRatio float64, baseURL string) error {\n\tfor i := 0; i < createTabCount; i++ {\n\t\turl := fmt.Sprintf(\"%s?alloc=%d&ratio=%.3f&id=%d\", baseURL, mbPerTab, compressRatio, i)\n\t\tif err := openAllocationPage(ctx, url, br); err != nil {\n\t\t\treturn errors.Wrap(err, \"cannot create tab\")\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e9b726493404b1208bac3321ce45c54f", "score": "0.5442362", "text": "func createHandler(w http.ResponseWriter, r *http.Request) {\n\terr := templates.ExecuteTemplate(w, \"create.html\", nil)\n\tif err != nil {\n\t\thandleCommonErrors(err, w)\n\t}\n}", "title": "" }, { "docid": "3e105b8f5f97225001a517d15b44b3e7", "score": "0.5400765", "text": "func (m *ChatItemRequestBuilder) Tabs()(*id387b678bda7815af798dc5b19d04d6775c9e30340b77735c65b245e5bae6867.TabsRequestBuilder) {\n return id387b678bda7815af798dc5b19d04d6775c9e30340b77735c65b245e5bae6867.NewTabsRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "title": "" }, { "docid": "dbdbb2feffb1daf4d76346cd47e21316", "score": "0.5380633", "text": "func New() *Tab {\n\treturn &Tab{\n\t\tCrons: make(map[string]*Cron),\n\t}\n}", "title": "" }, { "docid": "9db99d258bf5efd6bf75cfafed154535", "score": "0.5371972", "text": "func CreateProcess(w http.ResponseWriter, r *http.Request) {\n\tif !session.AlreadyLoggedIn(w, r) {\n\t\thttp.Redirect(w, r, \"/\", http.StatusSeeOther)\n\t\treturn\n\t}\n\n\tif r.Method != \"POST\" {\n\t\thttp.Error(w, http.StatusText(405), http.StatusMethodNotAllowed)\n\t\treturn\n\t}\n\n\tdl, err := PutDL(w, r)\n\tfmt.Println(dl)\n\n\tif err != nil {\n\t\tprintln(\"error in processing PutDL\")\n\t\thttp.Error(w, http.StatusText(406), http.StatusNotAcceptable)\n\t\treturn\n\t}\n\n\tconfig.TPL.ExecuteTemplate(w, \"created.html\", dl)\n}", "title": "" }, { "docid": "9cc2c13fddbd5ecd672cdc5a02195f09", "score": "0.53682995", "text": "func (c *NametitleClient) Create() *NametitleCreate {\n\tmutation := newNametitleMutation(c.config, OpCreate)\n\treturn &NametitleCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "381936011a1538ce236a5b0b832f8d32", "score": "0.53539115", "text": "func (w *Windows) Create(createData Object, callback func(window Window)) {\n\tw.o.Call(\"create\", createData, callback)\n}", "title": "" }, { "docid": "9daf73a5828ef6345a04080e6f1a1715", "score": "0.5345967", "text": "func CreatePage(w http.ResponseWriter, r *http.Request, pageT reflect.Type) interface{} {\n\tif seg := register.GetPage(pageT); seg != nil {\n\t\tvar newlcc = NewPageFlow(w, r, seg)\n\t\tvar page = newlcc.current.proton\n\t\tpage.SetFlowLife(newlcc.current)\n\t\treturn page\n\t}\n\tpanic(fmt.Sprintf(\"Can't create page instance for %v\", pageT))\n}", "title": "" }, { "docid": "eac90438e3061335524d5775618e5b88", "score": "0.52980965", "text": "func (f *FolderController) Create(title string, workspace string) {\n\tnotePath := filepath.Join(f.Folder.Path, workspace, fmt.Sprintf(\"%s.md\", title))\n\tnoteContent := []byte(fmt.Sprintf(\"# %s\", title))\n\terr := ioutil.WriteFile(notePath, noteContent, 0644)\n\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tpanic(err)\n\t}\n\n\tpath, err := homedir.Dir()\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tsettingPath := filepath.Join(path, \".notorious\")\n\tf.Open(notePath)\n\tf.Folder = buildTree(settingPath)\n}", "title": "" }, { "docid": "ad022317aa4592cc829c133c49994a3c", "score": "0.52911425", "text": "func (m *ChannelItemRequestBuilder) Tabs()(*ie326949afcb08e6a5436a367b925b7f68ec414a2c72fce4b6164a4b239264d52.TabsRequestBuilder) {\n return ie326949afcb08e6a5436a367b925b7f68ec414a2c72fce4b6164a4b239264d52.NewTabsRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "title": "" }, { "docid": "18581c7c2dc016284ae3380ab52bd878", "score": "0.52877414", "text": "func CreatePost(c Context) {\n\tc.JSON(http.StatusCreated, \"www\")\n}", "title": "" }, { "docid": "003fa280ca84f8af6b54b253247b2ffd", "score": "0.5259057", "text": "func (h *HistoryFile) Create() {\n\tos.Create((h.Path))\n}", "title": "" }, { "docid": "afa9c7420e11d6a6bb9b42f00401417d", "score": "0.5233199", "text": "func CreateBDTPolicy(c *gin.Context) {\n\tvar bdtReqData models.BdtReqData\n\tc.ShouldBindJSON(&bdtReqData)\n\n\treq := http_wrapper.NewRequest(c.Request, bdtReqData)\n\tchannelMsg := message.NewHttpChannelMessage(message.EventBDTPolicyCreate, req)\n\n\tmessage.SendMessage(channelMsg)\n\trecvMsg := <-channelMsg.HttpChannel\n\tHTTPResponse := recvMsg.HTTPResponse\n\n\tfor key, val := range HTTPResponse.Header {\n\t\tc.Header(key, val[0])\n\t}\n\n\tc.JSON(HTTPResponse.Status, HTTPResponse.Body)\n}", "title": "" }, { "docid": "a5b1e246d661178541706732ef8ce578", "score": "0.51905215", "text": "func CreateBDTPolicy(c *gin.Context) {\n\tvar bdtReqData models.BdtReqData\n\tc.BindJSON(&bdtReqData)\n\n\treq := http_wrapper.NewRequest(c.Request, bdtReqData)\n\treq.Params[\"bdtPolicyId\"] = c.Params.ByName(\"bdtPolicyId\")\n\tchannelMsg := pcf_message.NewHttpChannelMessage(pcf_message.EventBDTPolicyCreate, req)\n\n\tpcf_message.SendMessage(channelMsg)\n\trecvMsg := <-channelMsg.HttpChannel\n\tHTTPResponse := recvMsg.HTTPResponse\n\n\tif HTTPResponse.Header == nil {\n\t\tc.JSON(HTTPResponse.Status, HTTPResponse.Body)\n\t} else {\n\t\tc.Redirect(HTTPResponse.Status, HTTPResponse.Header[\"Location\"][0])\n\t}\n}", "title": "" }, { "docid": "d8f3b6d66dab1ae912c0e2088b085f79", "score": "0.5179807", "text": "func newThread(w http.ResponseWriter, r *http.Request) {\n\t_, err := session(w, r)\n\t\n\tif err != nil {\n\t\thttp.Redirect(w, r, \"/login\", 302)\n\t} else {\n\t\tgenerateHTML(w, nil, \"layout\", \"private.navbar\", \"new.thread\")\n\t}\n}", "title": "" }, { "docid": "53b1f23af1ba3d55287f737dfb6a9281", "score": "0.51700634", "text": "func (c *TitleClient) Create() *TitleCreate {\n\tmutation := newTitleMutation(c.config, OpCreate)\n\treturn &TitleCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "862cbfdc631a3a47d1b49d77f1d02a92", "score": "0.51632935", "text": "func (webInterface) CreateButton() interfaces.Button {\n\treturn &webButton{}\n}", "title": "" }, { "docid": "6f69c84bd349703ffcf98497dbf26ad6", "score": "0.51237804", "text": "func Create(c *cli.Context) error {\n\tif c.NArg() < 1 {\n\t\treturn fmt.Errorf(\"Please specify a project name to create\")\n\t}\n\n\tname := strings.Trim(c.Args().First(), \" \")\n\tif err := createNewProject(name); err != nil {\n\t\treturn err\n\t}\n\n\tif err := Init(c); err != nil {\n\t\treturn err\n\t}\n\n\tfmt.Printf(\"Successfully created project %q.\\n\", name)\n\tif err := Track(c); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7467727274618fef0a0d12b7ca695d86", "score": "0.5121602", "text": "func (a *App) createProject(w http.ResponseWriter, r *http.Request) {\n\n\tm := models.Project{\n\t\tID: 0,\n\t\tCustID: 0,\n\t\tName: \"\",\n\t\tStartDate: \"\",\n\t\tHours: 0,\n\t}\n\n\tdata := struct {\n\t\tTitle string\n\t\tObject models.Project\n\t\tActive string\n\t\tHeaderTitle string\n\t\tUserRole string\n\t}{\n\t\tTitle: \"Project - Create\",\n\t\tObject: m,\n\t\tActive: \"Projects\",\n\t\tHeaderTitle: \"Project\",\n\t\tUserRole: a.getUserRole(r),\n\t}\n\n\tgetTemplate(w, r, \"editProject\", data)\n\n}", "title": "" }, { "docid": "2c2b40a73996b3b856cd0937214107f8", "score": "0.51187015", "text": "func (app *application) createBookForm(w http.ResponseWriter, r *http.Request) {\n\t//w.Write([]byte(\"Create a new snippet...\"))\n\tapp.render(w, r, \"create.page.tmpl\", nil)\n}", "title": "" }, { "docid": "a6465c31bfb8ae9467fd9b373dc13423", "score": "0.5072934", "text": "func CreateNewProject(ns string) {\n\tlog.Printf(\"output: %s\\n\", cmd.MustSucceed(\"oc\", \"new-project\", ns).Stdout())\n}", "title": "" }, { "docid": "59ae096b2fe93fae9241494707ba73a3", "score": "0.5067463", "text": "func Create(w http.ResponseWriter, r *http.Request) {\n\tc := flight.Context(w, r)\n\tnow := time.Now()\n\n\tv := c.View.New(\"smartmoney/create\")\n\tv.Vars[\"curdate\"] = now.Format(\"2006-01-02\")\n\tc.Repopulate(v.Vars, \"name\")\n\tv.Render(w, r)\n}", "title": "" }, { "docid": "68b6dd40ad17fcbb6f01c51b50e124cd", "score": "0.5061674", "text": "func NewThread(w http.ResponseWriter, r *http.Request) {\n\t_, err := utils.Session(w, r)\n\tif err != nil {\n\t\thttp.Redirect(w, r, \"/login\", 302)\n\t} else {\n\t\tutils.GenerateHTML(w, nil, \"layout\", \"private.navbar\", \"new.thread\")\n\t}\n}", "title": "" }, { "docid": "e1bf5a2249b01c58338a499e239dcd11", "score": "0.504071", "text": "func (w *Window) Create() {\n\tif err := w.tmuxCommand.Execute(); err != nil {\n\t\tlog.Fatalf(\"Couldn't create panes %v\", err)\n\t}\n}", "title": "" }, { "docid": "677179037f9b1168c3131e4c982220ca", "score": "0.504045", "text": "func CreateThread(w http.ResponseWriter, r *http.Request) {\n\tsession, err := utils.Session(w, r)\n\tif err != nil {\n\t\thttp.Redirect(w, r, \"/login\", 302)\n\t} else {\n\t\terr = r.ParseForm()\n\t\tif err != nil {\n\t\t\tutils.Danger(err, \"Can not parse form.\")\n\t\t}\n\t\tuser, err := session.User()\n\t\tif err != nil {\n\t\t\tutils.Danger(err, \"Can not get user from session.\")\n\t\t}\n\t\ttopic := r.PostFormValue(\"topic\")\n\t\tif _, err := user.CreateThread(topic); err != nil {\n\t\t\tutils.Danger(err, \"Can not create thread.\")\n\t\t}\n\t\thttp.Redirect(w, r, \"/\", 302)\n\t}\n}", "title": "" }, { "docid": "0170f5520ecbf59c0e24b087d6ed41ff", "score": "0.50333035", "text": "func newTestContext(t *testing.T,\n\t\topt ...string) *testContext {\n\ttabName := \"\"\n\tif len(opt) > 0 {\n\t\ttabName = opt[0]\n\t}\n\treturn &testContext{t, tabName, 0}\n}", "title": "" }, { "docid": "42babb87dcd97cfe46c4f1fd9c5ee8dd", "score": "0.5023179", "text": "func NewTabControl(idd uintptr) *TabControl {\n\treturn &TabControl{\n\t\tWindowBase: WindowBase{idd: idd},\n\t}\n}", "title": "" }, { "docid": "e0f6c15bb29731f6c16bc6f76dccc329", "score": "0.50219333", "text": "func (a *App) CreateRibbon(w http.ResponseWriter, r *http.Request) {\n\thandler.CreateRibbon(a.DB, w, r)\n}", "title": "" }, { "docid": "a490367ff2109c1e93e0a69ffb3cb3ee", "score": "0.5000583", "text": "func (page *PageController) CreatePage() {\n\tresp := helper.NewResponse()\n\n\tdefer resp.WriteJson(page.Ctx.ResponseWriter)\n\n\tvar info models.PageInfo\n\tjson.Unmarshal(page.Ctx.Input.RequestBody, &info)\n\n\tpageNum, _ := page.o.QueryTable(new(models.PageInfo)).Filter(\"name\", info.Name).Count()\n\n\tif pageNum > 0 {\n\t\tresp.Status = helper.RS_tag_exist\n\t\tresp.Tips(helper.WARNING, helper.Desc(helper.RS_tag_exist))\n\t\treturn\n\t}\n\n\tinfo.Created = time.Now()\n\tinfo.Status = 1\n\n\t_, err := page.o.Insert(&info)\n\n\tif err != nil {\n\t\tresp.Status = helper.RS_create_failed\n\t\tresp.Tips(helper.WARNING, helper.Desc(helper.RS_create_failed))\n\t\treturn\n\t}\n\n\tresp.Data = info\n}", "title": "" }, { "docid": "a330494263c65a7e048e261f6fad8694", "score": "0.49924496", "text": "func showNewJobPage(c *gin.Context) {\r\n\trender(c, gin.H{\r\n\t\t\"Title\": \"Add New Job\", \"UserName\": userName,\r\n\t}, \"add-job.html\")\r\n}", "title": "" }, { "docid": "3f5d13b8765167874f489e3b7485b4a5", "score": "0.498629", "text": "func (s *Scenario) Create(db *sql.DB) (err error) {\n\terr = db.QueryRow(\"INSERT INTO scenario (name,descript) VALUES($1,$2) RETURNING id\",\n\t\ts.Name, s.Descript).Scan(&s.ID)\n\treturn err\n}", "title": "" }, { "docid": "d7d6ccdbaba3fc6a91335b457395893c", "score": "0.49797982", "text": "func (t *Tab) Construct() {\n\twidget := widgets.NewTabPane(\"🌎 Worldwide\", \"🇺 USA\", \"💉 Vaccine tracker\", \"😷 Protect yourself\", \"👌 Credits\")\n\twidget.Border = true\n\twidget.InactiveTabStyle = ui.NewStyle(ui.ColorClear)\n\n\tt.Widget = widget\n}", "title": "" }, { "docid": "cd691676828a0713c77dae99e9d37a33", "score": "0.49762154", "text": "func (app *Application) Create(rw http.ResponseWriter, r *http.Request) {\n\tvar lab models.Lab\n\terr := json.NewDecoder(r.Body).Decode(&lab)\n\tif err != nil {\n\t\tapp.serverError(rw, err)\n\t}\n\tlab.CreatedOn = time.Now()\n\tinsert, err := app.labs.CreateLab(lab)\n\tif err != nil {\n\t\tapp.serverError(rw, err)\n\t}\n\t// app.infoLog.Printf(\"Created a new lab, id=%s\", insert.InsertedID)\n\tapp.infoLog.Printf(\"Created a new lab: %s\", insert)\n}", "title": "" }, { "docid": "11430edf9b48626d29c20294a4adb415", "score": "0.49727598", "text": "func makeTabs(n int) string {\n\tvar tabs string\n\tfor i := 0; i < n; i++ {\n\t\ttabs += \"\\t\"\n\t}\n\treturn tabs\n}", "title": "" }, { "docid": "7bae2954d9ac639bd81cf121935dc529", "score": "0.4947852", "text": "func Create(args ...string) ([]byte, error) {\n\treturn Run(\"create\", args...)\n}", "title": "" }, { "docid": "2d56183b54712e98c45bb273d52256e6", "score": "0.49160466", "text": "func Create(ctx *context.Context) {\n\tvar (\n\t\tname = ctx.Query(\"name\")\n\t\ttoken = ctx.Query(\"token\")\n\t\townerID = ctx.User.ID\n\t)\n\n\twalletID, blocked, balance, err := qiwi.CheckToken(token)\n\tif ctx.HasError(err) {\n\t\tcolor.Red(\"Ошибка при проверке кошелька: %s\", err)\n\t\treturn\n\t}\n\twallet := new(models.Wallet)\n\twallet.Name = name\n\twallet.Balance = balance\n\twallet.Blocked = blocked\n\twallet.WalletID = walletID\n\twallet.Token = token\n\twallet.OwnerID = ownerID\n\twallet.GroupID = uint(ctx.QueryInt64(\"group\"))\n\twallet.Limit = 15000\n\n\terr = models.CreateWallet(wallet)\n\tif ctx.HasError(err) {\n\t\treturn\n\t}\n\n\terr = syncronizer.Sync(wallet.ID)\n\tif ctx.HasError(err) {\n\t\treturn\n\t}\n\n\tctx.Data[\"Title\"] = \"Мои кошельки\"\n\tctx.Redirect(fmt.Sprintf(\"/wallets/%d\", wallet.ID))\n}", "title": "" }, { "docid": "eba7034e108838e29d7bd6a824052508", "score": "0.49076086", "text": "func NewTabFromView(v *View) *Tab {\n\tt := new(Tab)\n\tt.views = append(t.views, v)\n\tt.views[0].Num = 0\n\n\tt.tree = new(SplitTree)\n\tt.tree.kind = VerticalSplit\n\tt.tree.children = []Node{NewLeafNode(t.views[0], t.tree)}\n\n\tw, h := screen.Size()\n\tt.tree.width = w\n\tt.tree.height = h\n\n\tif globalSettings[\"infobar\"].(bool) {\n\t\tt.tree.height--\n\t}\n\n\t//Reset the Scroll Offset so that the tabbar centers correctly on the new tab.\n\tScrollOffset = 0\n\n\t//Reset the Scroll Offset so that the tabbar centers correctly on the new tab.\n\tScrollOffset = 0\n\n\tt.Resize()\n\n\treturn t\n}", "title": "" }, { "docid": "3cfc9f558fbbc4d311222fab58f0d16c", "score": "0.48721004", "text": "func (t *SimpleChaincode) createScenario(stub shim.ChaincodeStubInterface) error {\n\treturn nil\n}", "title": "" }, { "docid": "9c3470ce5704170a7f21ab58f04d79a6", "score": "0.48699823", "text": "func newPage(title, author, summary, body, target, meta string) *Page {\n\n\tvar md Page\n\n\tmd.Title = title\n\tmd.URL = titleToURL(title)\n\tmd.Author = author\n\tmd.Summary = summary\n\tmd.Body = body\n\tmd.Target = target\n\tmd.Key = generateKey()\n\tmd.Visible = 0\n\tmd.Datetime = int(time.Now().Unix())\n\tmd.Meta = meta\n\n\treturn &md\n}", "title": "" }, { "docid": "848087af5fd67ec4d32e761718b921c1", "score": "0.48688984", "text": "func CreateProject(jiraProjectName string) {\n}", "title": "" }, { "docid": "2f57cce80fc69a92678f85422283ab76", "score": "0.48613486", "text": "func (n *Notebook) createNotebook(basePath string) error {\n\tvar dirToMake []string\n\tdirToMake = append(dirToMake, basePath)\n\tdirToMake = append(dirToMake, strconv.Itoa(n.ID))\n\terr := os.Mkdir(strings.Join(dirToMake, \"\"), 0755)\n\n\tn.NotebookPath = strings.Join(dirToMake, \"\")\n\n\t// may not be the best idea but tagging extra bits onto dirToMake and re-using the variable\n\tdirToMake = append(dirToMake, \"/\")\n\tdirToMake = append(dirToMake, strconv.Itoa(n.ID))\n\tdirToMake = append(dirToMake, \".notebook\")\n\n\tb, err := json.MarshalIndent(n, \"\", \" \")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = ioutil.WriteFile(strings.Join(dirToMake, \"\"), b, 0755)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a2a82fedd5ee3fcf2d6d3b480f802531", "score": "0.4850548", "text": "func CreateNewFile(level int32, file *FileMeta) Log {\n\treturn &newFile{\n\t\tlevel: level,\n\t\tfile: file,\n\t}\n}", "title": "" }, { "docid": "1774625bfc03ecb84e6042f4082f2bbd", "score": "0.48504594", "text": "func createPort(title, tooltip string) serialPortGUI {\n\tvar port serialPortGUI\n\n\tport.title = title\n\tport.item = systray.AddMenuItem(title, tooltip)\n\n\treturn port\n}", "title": "" }, { "docid": "364b44ab66432a1740fc093409913a88", "score": "0.48458067", "text": "func CreateTeacher(app *App) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tteacher := &TeacherRequest{}\n\t\tif err := render.Bind(r, teacher); err != nil {\n\t\t\trender.Render(w, r, ErrInvalidRequest(err))\n\t\t\treturn\n\t\t}\n\n\t\tdbNewTeacher(app, teacher)\n\t\t// TODO add a response\n\t}\n}", "title": "" }, { "docid": "505813b2aee058a1e8f04f90a969a954", "score": "0.4844352", "text": "func CreatePost() {\n\tvar result response\n\tpayload := createRequestPayload{\n\t\tTitle: \"GarzAlma\",\n\t\tBody: \"bar\",\n\t\tUserID: 1,\n\t}\n\terr := HTTPPost(\"https://jsonplaceholder.typicode.com/posts\", &payload, &result)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(\"POST REQUEST:\", result.Title)\n}", "title": "" }, { "docid": "8eb99df00781b9ca16c0d5a397609efe", "score": "0.484018", "text": "func (c *HyperlinkClient) Create() *HyperlinkCreate {\n\tmutation := newHyperlinkMutation(c.config, OpCreate)\n\treturn &HyperlinkCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "2c4a5d3c99bcef0c77c1ae8b556f65fd", "score": "0.48312962", "text": "func Create(w http.ResponseWriter, r *http.Request) {\n\tif !session.AlreadyLoggedIn(w, r) {\n\t\thttp.Redirect(w, r, \"/\", http.StatusSeeOther)\n\t\treturn\n\t}\n\n\tus = session.GetUser(w, r)\n\tldl, err := LastDL(&us.Id)\n\tif err != nil {\n\t\thttp.Error(w, http.StatusText(500), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tconfig.TPL.ExecuteTemplate(w, \"create.html\", ldl)\n}", "title": "" }, { "docid": "bbd95c08c4f1070402dce46179aad14f", "score": "0.48286393", "text": "func NewItem(title string) *Item { return wf.NewItem(title) }", "title": "" }, { "docid": "9033a02ab6741b87423730aedd785ae3", "score": "0.48249677", "text": "func (h *FlinkJobHandler) Create(ctx context.Context, project, service string, req CreateFlinkJobRequest) (*CreateFlinkJobResponse, error) {\n\tpath := buildPath(\"project\", project, \"service\", service, \"flink\", \"job\")\n\tbts, err := h.client.doPostRequest(ctx, path, req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar r CreateFlinkJobResponse\n\treturn &r, checkAPIResponse(bts, &r)\n}", "title": "" }, { "docid": "77267bcd15d3c15fdad767ee8f0eec47", "score": "0.48212257", "text": "func (h *Handler) ThreadsCreate() http.HandlerFunc {\n\n\ttmpl := template.Must(template.New(\"\").Parse(threadCreateHTML))\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\ttmpl.Execute(w, nil)\n\t}\n}", "title": "" }, { "docid": "db3c49297a160199ee00e4a9c5e11c24", "score": "0.48168254", "text": "func Create(cfg Config) (restic.Backend, error) {\n\treturn open(cfg)\n}", "title": "" }, { "docid": "eae59a3e9d91b9dd6e294a43deb49ae6", "score": "0.48143706", "text": "func Create(filename string) Draft {\n\tglobalList, _ := playerlist.Create(filename)\n\tplayerList1, _ := playerlist.Create(filename)\n\tplayerList2, _ := playerlist.Create(filename)\n\n\treturn CreateArgs(globalList, playerList1, playerList2)\n}", "title": "" }, { "docid": "81d859fa8cf4c7a714277b207d8112e8", "score": "0.48130426", "text": "func createThread(w http.ResponseWriter, r *http.Request) {\n\tsess, err := session(w, r)\n\t\n\tif err != nill {\n\t\thttp.Redirect(w, r, \"login\", 302)\n\t} else {\n\t\terr = r.ParseForm()\n\t\tif err != nill {\n\t\t\tdanger(err, \"Cannot parse form\")\n\t\t}\n\t\t\n\t\tuser, err := sess.User()\n\t\tif err != nill {\n\t\t\tdanger(err, \"Cannot get user from session\")\n\t\t}\n\t\t\n\t\ttopic := r.PostFormValue(\"topic\")\n\t\tif _, err := user.createThread(topic); err != nill {\n\t\t\tdanger(err, \"Cannot create thread\")\n\t\t}\n\t\t\n\t\thttp.Redirect(w, r, \"/\", 302)\n\t}\n}", "title": "" }, { "docid": "f6b2ae3ad779ca22bcd847cdd3dce9bf", "score": "0.47817558", "text": "func (widget *Widget) Create(widgetToCreate dashboard.Widget, dashnoardID string) (string, error) {\n\tauth, err := widget.GetAuth(widgetTokenName)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tbody, err := json.Marshal(widgetToCreate)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tendpoint := fmt.Sprintf(CreateEndpoint.String(), dashnoardID)\n\tresponse, status, err := widget.Client.Post(endpoint, headers, auth, bytes.NewBuffer(body))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif err := widget.HandleFailure(response, status); err != nil {\n\t\treturn \"\", err\n\t}\n\n\tsuccess := dto.WidgetCreation{}\n\tif err := json.Unmarshal(response, &success); err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn success.WidgetID, nil\n}", "title": "" }, { "docid": "8d977f949ff3b96349e693073076ae61", "score": "0.47809508", "text": "func (c *Context) Create(name string) (*os.File, error) {\n\treturn os.Create(filepath.Join(c.wd, name))\n}", "title": "" }, { "docid": "24c1cd048c0de17666cc3e1fa1338c94", "score": "0.47808692", "text": "func (a Dashboards) Create(dashboard *Dashboard) error {\n\treturn a.crudDashboard(\"POST\", baseDashboardPath, dashboard)\n}", "title": "" }, { "docid": "24c1cd048c0de17666cc3e1fa1338c94", "score": "0.47808692", "text": "func (a Dashboards) Create(dashboard *Dashboard) error {\n\treturn a.crudDashboard(\"POST\", baseDashboardPath, dashboard)\n}", "title": "" }, { "docid": "81de8e31288097f4b2e6d19d0913fc2e", "score": "0.47760743", "text": "func (a *Actions) Create(title, pipelineName string) error {\n\tvar err error\n\tvar pipelineID string\n\n\tfmt.Printf(\"Creating new issue...\\n\")\n\n\t// Since backlog is the default pipeline, we save a few seconds by not checking if it exists (since a move won't be necessary later)\n\tif pipelineName != \"backlog\" {\n\t\tpipelineID, err = a.zenHubAPI.GetPipelineID(pipelineName)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tnewIssueNumber, err := a.githubAPI.CreateIssue(title)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfmt.Printf(\"Issue %v created in the backlog.\", newIssueNumber)\n\tif pipelineName == \"backlog\" {\n\t\tfmt.Println()\n\t\treturn nil\n\t}\n\n\tfmt.Printf(\" Moving it to %v...\\n\", pipelineName)\n\terr = a.zenHubAPI.MovePipeline(newIssueNumber, pipelineID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfmt.Printf(\"New issue (%v) has been created and moved to %v.\\n\", newIssueNumber, pipelineName)\n\treturn nil\n}", "title": "" }, { "docid": "b6d5f35be4ebba221ba7f1af68096a40", "score": "0.47737885", "text": "func Create(w http.ResponseWriter, r *http.Request) {\n\tdecoder := json.NewDecoder(r.Body)\n\tvar book *Book\n\tif err := decoder.Decode(&book); err != nil {\n\t\thttp.Error(w, http.StatusText(422), 422)\n\t\treturn\n\t}\n\n\tsequence++\n\tbook.ID = sequence\n\tbooks[int64(book.ID)] = book\n\n\tresponse := make(map[string]interface{})\n\tresponse[\"success\"] = true\n\tresponse[\"message\"] = fmt.Sprintf(\"created '%s'\", book.Title)\n\trender.JSON(w, r, response)\n}", "title": "" }, { "docid": "a3a765d0e799d9a5676eefd795dbbb7e", "score": "0.47623786", "text": "func CreateCmd() *cobra.Command {\n\tvar cmd = cobra.Command{\n\t\tUse: \"web\",\n\t\tShort: \"start the knut web frontend\",\n\t\tLong: `start the knut web frontend`,\n\n\t\tArgs: cobra.ExactValidArgs(1),\n\n\t\tRun: run,\n\t}\n\tcmd.Flags().Int16P(\"port\", \"p\", 9001, \"port\")\n\tcmd.Flags().StringP(\"address\", \"a\", \"localhost\", \"listen address\")\n\treturn &cmd\n}", "title": "" }, { "docid": "a897127371ad3f07d432e961bc5e4b12", "score": "0.47560948", "text": "func createAppUrlBody() string {\n\treturn `/^Action=CreateStack/`\n}", "title": "" }, { "docid": "df4e690b03af3b85d5680da428ba6ebc", "score": "0.47539783", "text": "func Create(path_dir, namespace string) {\n\tlog.Printf(\"output: %s\\n\", cmd.MustSucceed(\"oc\", \"create\", \"-f\", resource.Path(path_dir), \"-n\", namespace).Stdout())\n}", "title": "" }, { "docid": "13491351eff596da4ea3a3a6af0b4dc4", "score": "0.47508883", "text": "func (c *ProblemTitleClient) Create() *ProblemTitleCreate {\n\tmutation := newProblemTitleMutation(c.config, OpCreate)\n\treturn &ProblemTitleCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "6b5205c3cd8e84a2696f08f5104a271d", "score": "0.47491315", "text": "func (app *application) createSnippetForm(w http.ResponseWriter, r *http.Request) {\n\tapp.render(w, r, \"create.page.tmpl\", &templateData{Form: forms.New(nil)})\n}", "title": "" }, { "docid": "c989ba9c66efe9849b7f5860a924dbc1", "score": "0.47474274", "text": "func (s *PageService) Create(page *Page) (*Page, error) {\n\tu := fmt.Sprintf(\"/page\")\n\tpg := &Page{}\n\terr := s.client.Call(\"POST\", u, page, pg)\n\n\treturn pg, err\n}", "title": "" }, { "docid": "5aa28d3b302f238db3ec1b3efdb17706", "score": "0.47456905", "text": "func Create(name string) (windows.Handle, error) {\n\tvar sbName strings.Builder\n\tsbName.WriteString(\"Portapps\")\n\tsbName.WriteString(name)\n\n\tmuName, err := windows.UTF16PtrFromString(sbName.String())\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\thandle, err := windows.OpenMutex(windows.MUTEX_ALL_ACCESS, false, muName)\n\tif err == nil {\n\t\twindows.CloseHandle(handle)\n\t\treturn 0, errors.Errorf(\"already running\")\n\t}\n\n\treturn windows.CreateMutex(nil, false, muName)\n}", "title": "" }, { "docid": "1748002ad0cc7fb95f217df21c1c515b", "score": "0.4733723", "text": "func (g *Gitlab) Create() error {\n\n\tnsID, err := g.getNamespaceID()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tprojectOptions := &gitlab.CreateProjectOptions{\n\t\tPath: &g.ops.RepoName,\n\t\tName: &g.ops.RepoName,\n\t\tDescription: &g.ops.DisplayName,\n\t\tNamespaceID: nsID,\n\t}\n\n\tproject, _, err := g.client.Projects.CreateProject(projectOptions)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tg.project = project\n\treturn g.setDeployKeys(g.deployKeys, false)\n}", "title": "" }, { "docid": "ddfbf18089798084de058bea1c1b2da6", "score": "0.47327754", "text": "func NewPage(title, rootTagName string) *Page {\n\tvar page Page\n\tpage.title = title\n\trootTag := NewTag(rootTagName)\n\tpage.root = rootTag\n\treturn &page\n}", "title": "" }, { "docid": "5203f42df54a4b45c37581f89d4c3c35", "score": "0.47316533", "text": "func (client *VIMgrNWRuntimeClient) Create(obj *models.VIMgrNWRuntime) (*models.VIMgrNWRuntime, error) {\n\tvar robj *models.VIMgrNWRuntime\n\terr := client.aviSession.Post(client.getAPIPath(\"\"), obj, &robj)\n\treturn robj, err\n}", "title": "" }, { "docid": "5b4be1f6ca5461c50b690c35792b4c9a", "score": "0.47252166", "text": "func (c *Client) CreateWeb(ctx context.Context, path string, payload *CreateWebPayload) (*http.Response, error) {\n\treq, err := c.NewCreateWebRequest(ctx, path, payload)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn c.Client.Do(ctx, req)\n}", "title": "" }, { "docid": "db6e8188c982c483e8ec65e8947fd841", "score": "0.47226447", "text": "func (t *Tabs) Duplicate(tabId int, callback func(tab Tab)) {\n\tt.o.Call(\"duplicate\", tabId, callback)\n}", "title": "" }, { "docid": "57088303685b8a421ee936e9907e52f3", "score": "0.47223142", "text": "func CreateFromWizard(db *sql.Tx, p *sdk.Project, u *sdk.User) error {\n\n\t// INSERT NEW PROJECT\n\terr := InsertProject(db, p)\n\tif err != nil {\n\t\tlog.Warning(\"CreateFromWizard: Cannot insert project: %s\\n\", err)\n\t\treturn err\n\t}\n\n\t// INSERT & CONFIGURE GROUP\n\tfor i := range p.ProjectGroups {\n\t\tgroupPermission := &p.ProjectGroups[i]\n\n\t\t// Insert group\n\t\tgroupID, new, err := group.AddGroup(db, &groupPermission.Group)\n\t\tif groupID == 0 {\n\t\t\tif err == sdk.ErrInvalidGroupPattern {\n\t\t\t\tlog.Warning(\"CreateFromWizard: Wrong group name: %s\\n\", err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tlog.Warning(\"CreateFromWizard: Cannot add group: %s\\n\", err)\n\t\t\treturn err\n\t\t}\n\t\tgroupPermission.Group.ID = groupID\n\n\t\t// Add group on project\n\t\terr = group.InsertGroupInProject(db, p.ID, groupPermission.Group.ID, groupPermission.Permission)\n\t\tif err != nil {\n\t\t\tlog.Warning(\"CreateFromWizard: Cannot add group %s in project %s: %s\\n\", groupPermission.Group.Name, p.Name, err)\n\t\t\treturn err\n\t\t}\n\n\t\t// Add user in the new group as admin\n\t\tif new {\n\t\t\terr = group.InsertUserInGroup(db, groupPermission.Group.ID, u.ID, true)\n\t\t\tif err != nil {\n\t\t\t\tlog.Warning(\"CreateFromWizard: Cannot add user %s in group %s: %s\\n\", u.Username, groupPermission.Group.Name, err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tfor i := range p.Applications {\n\t\t// check application name pattern\n\t\tregexp := regexp.MustCompile(sdk.NamePattern)\n\t\tif !regexp.MatchString(p.Applications[i].Name) {\n\t\t\tlog.Warning(\"CreateFromWizard: Application name %s do not respect pattern %s\", p.Applications[i].Name, sdk.NamePattern)\n\t\t\treturn sdk.ErrInvalidApplicationPattern\n\t\t}\n\n\t\terr = template.ApplyTemplate(db, p, &p.Applications[i])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a0e2bc9d7479a13cc7c9ef1d28c8f13d", "score": "0.47179624", "text": "func CmdCreate() *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"create\",\n\t\tShort: \"Create noobaa CRDs\",\n\t\tRun: RunCreate,\n\t\tArgs: cobra.NoArgs,\n\t}\n\treturn cmd\n}", "title": "" }, { "docid": "dec4a274f973d0eb65ae77b4d035b583", "score": "0.47027043", "text": "func (yc *YnoteClient) CreateNotebook(name, group string) (*NotebookInfo, error) {\n\treqUrl := yc.URLBase + \"/yws/open/notebook/create.json\"\n\n\tparams := make(url.Values)\n\tparams.Set(\"name\", name)\n\tparams.Set(\"group\", group)\n\n\tres, err := yc.oauthClient.Post(http.DefaultClient, (*oauth.Credentials)(yc.AccToken), reqUrl, params)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer res.Body.Close()\n\n\tjs, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif res.StatusCode == 500 {\n\t\treturn nil, parseFailInfo(js)\n\t}\n\treturn parseNotebookInfo(js)\n}", "title": "" }, { "docid": "5061059973d3a63c014ac885c166fe1c", "score": "0.46975243", "text": "func (d *Site) create(fname string) (string, error) {\n\t// template.Execute expects a writes, we use a buffer here\n\tvar b bytes.Buffer\n\n\t// create the contents\n\tfor _, page := range d.Pages {\n\t\tt := template.New(\"menuentry\")\n\n\t\tvar err error\n\n\t\tif fname == page.Out {\n\t\t\tt, err = t.Parse(d.Menu.Active)\n\t\t} else {\n\t\t\tt, err = t.Parse(d.Menu.Inactive)\n\n\t\t}\n\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\terr = t.Execute(&b, struct {\n\t\t\tHref string\n\t\t\tLabel string\n\t\t}{page.Out, page.Menu})\n\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\t// according to the docs, err is always nil, so we ignore it\n\t\tb.WriteString(\"\\n\")\n\t}\n\n\t// wrap the contents in Menu\n\tvar buff bytes.Buffer\n\n\tm := template.New(\"menu\")\n\tm, err := m.Parse(d.Menu.Menu)\n\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\terr = m.Execute(&buff, struct {\n\t\tMenu string\n\t}{b.String()})\n\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn buff.String(), nil\n}", "title": "" }, { "docid": "1c3fcb5b78e0902603e4fa23e9c426e4", "score": "0.469246", "text": "func Create(w http.ResponseWriter, r *http.Request) {\n\tc := flight.Context(w, r)\n\tnow := time.Now()\n\n\tv := c.View.New(\"cash/create\")\n\tv.Vars[\"curdate\"] = now.Format(\"2006-01-02\")\n\tc.Repopulate(v.Vars, \"amount\")\n\tv.Render(w, r)\n}", "title": "" }, { "docid": "da8b8b4b3a1e2275a034645bbcb2b818", "score": "0.46861383", "text": "func Create(name string) (f *File, err error) {\n\n\tbase, fname := filepath.Split(name)\n\tif base == \"\" {\n\t\tbase = \".\"\n\t}\n\tif fname == \"\" {\n\t\treturn nil, &os.PathError{Op: \"open\", Path: name, Err: os.ErrInvalid}\n\t}\n\n\ttmpfile, err := ioutil.TempFile(base, fname)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &File{File: tmpfile, oname: name}, nil\n}", "title": "" }, { "docid": "8ac01c65a77ff8ef8821d34136613799", "score": "0.4684365", "text": "func Create(writer http.ResponseWriter, request *http.Request, p httprouter.Params) {\n\terr := request.ParseForm()\n\tif err != nil {\n\t\tLogger.Println(\"Not able to get The Form Detail!!\")\n\t\thttp.Redirect(writer, request, \"/Dashboard\", 302)\n\t\treturn\n\t}\n\n\t// Create a BSON ObjectID by passing string to ObjectIDFromHex() method\n\tdocID, err := m.ToDocID(p.ByName(\"id\"))\n\tif err != nil {\n\t\tLogger.Println(\"Not able to get the id of the Thread!!\")\n\t\thttp.Redirect(writer, request, \"/Dashboard/show/\"+p.ByName(\"id\"), 302)\n\t\treturn\n\t}\n\n\tvar LIP m.LogInUser\n\n\terr = m.GetLogInUser(\"User\", &LIP, request)\n\tif err != nil {\n\t\tLogger.Printf(\"Failed to get the login details %v\\n\", err)\n\t\thttp.Redirect(writer, request, \"/login\", 302)\n\t\treturn\n\t}\n\tnewItem := m.Comment{\n\t\tComment: request.Form[\"comment\"][0],\n\t\tAuthor: LIP.Name,\n\t\tThread: docID,\n\t\tUser: LIP.ID,\n\t\tCreatedAt: time.Now(),\n\t}\n\n\t_, err = m.Comments.AddItem(newItem)\n\tif err != nil {\n\t\tLogger.Println(\"Not able to add new Comment to DB!!\")\n\t\thttp.Redirect(writer, request, \"/Dashboard/show/\"+p.ByName(\"id\"), 302)\n\t\treturn\n\t}\n\n\thttp.Redirect(writer, request, \"/Dashboard/show/\"+p.ByName(\"id\"), 302)\n\n}", "title": "" }, { "docid": "0917274225dfa4def3bc066aa50ab401", "score": "0.4684358", "text": "func createStory(title string, content string, cookie *http.Cookie, webURL string, contentKey string) (bool, error) {\n\tif len(title) == 0 {\n\t\treturn false, ErrEmptyTitle\n\t}\n\n\tsubmitFormURL := fmt.Sprintf(\"%s/%s\", webURL, \"submit\")\n\tfnID, err := matchRegexFromBody(submitFormURL, createStoryFormRegex, cookie)\n\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tsubmitURL := fmt.Sprintf(\"%s/%s\", webURL, \"r\")\n\n\tbody := url.Values{}\n\tbody.Set(\"fnid\", fnID)\n\tbody.Set(\"fnop\", \"submit-page\")\n\tbody.Set(\"title\", title)\n\n\tif contentKey == \"text\" {\n\t\tbody.Set(\"url\", \"\")\n\t\tbody.Set(\"text\", content)\n\t} else if contentKey == \"url\" {\n\t\tbody.Set(\"url\", content)\n\t\tbody.Set(\"text\", \"\")\n\t}\n\n\tresp, err := postWithCookie(submitURL, body, cookie)\n\n\tif err == nil && resp != nil {\n\t\treturn true, nil\n\t}\n\n\treturn false, err\n}", "title": "" }, { "docid": "bf5baf413c0df50ef2df49431724a2f2", "score": "0.4683776", "text": "func CreateProfileHandler(w http.ResponseWriter, r *http.Request) {\n\tprofile := Profile{\n\t\tName: r.PostFormValue(\"name\"),\n\t\tCloudConfig: r.PostFormValue(\"cloud_config\"),\n\t\tConsole: r.PostFormValue(\"console\"),\n\t\tCoreosAutologin: r.PostFormValue(\"coreos_autologin\"),\n\t\tRootFstype: r.PostFormValue(\"rootfstype\"),\n\t\tRoot: r.PostFormValue(\"root\"),\n\t\tSSHKey: r.PostFormValue(\"sshkey\"),\n\t\tVersion: r.PostFormValue(\"version\"),\n\t}\n\tprofile.Save()\n\thttp.Redirect(w, r, \"/profiles/\"+profile.Name, http.StatusMovedPermanently)\n}", "title": "" }, { "docid": "657a4de7e7d7c308603a494e968368a2", "score": "0.46801153", "text": "func (app *App) CreateAccount(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\tstrPass := r.FormValue(\"pass\")\n\tstrDetails := r.FormValue(\"details\")\n\n\tvar details jsonEntries.Details\n\terr := json.Unmarshal([]byte(strDetails), &details)\n\tif err != nil {\n\t\tfmt.Fprintf(w, string(err.Error()))\n\t\treturn;\n\t}\n\n\tstrInsertQ := \"INSERT INTO account (details, hash) VALUES ('\" + strDetails + \"','\" + strPass + \"');\"\n\tapp.connector.Insert(strInsertQ)\n\tselector := \"SELECT id FROM account where details->>'email'='\" + details.Email + \"'\"\n\tvar account string\n\tapp.connector.Get(selector, &account)\n\tcookie := http.Cookie{Name: \"account_id\", Value: account}\n\thttp.SetCookie(w, &cookie)\n\thttp.Redirect(w, r, app.GetConfig().WebUrlFront+\"/#/analyze\", 301)\n}", "title": "" }, { "docid": "a110443a8eb685bb3a3f51f5151506e6", "score": "0.46777084", "text": "func CreateController(c Config) (Controller, error) {\n\n\thelmClient := helm.NewClient(helm.Host(c.TillerHost))\n\n\treturn &helmController{\n\t\thelmClient: *helmClient,\n\t\tchartUrls: c.ChartUrls,\n\t\ttillerHost: c.TillerHost,\n\t}, nil\n}", "title": "" }, { "docid": "5f1848661f788712fb25d60824270add", "score": "0.46770155", "text": "func (c *Client) CreateHistory() (*History, error) {\n\treq, err := http.NewRequest(\"POST\", fmt.Sprintf(\"/version/1/account/%s/own-history-keys\", c.EMail), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresp, err := c.do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\tif resp.StatusCode != http.StatusOK {\n\t\tif resp.StatusCode == http.StatusUnauthorized {\n\t\t\treturn nil, ErrUnauthorized\n\t\t}\n\t\treturn nil, fmt.Errorf(\"http response code: %s\", resp.Status)\n\n\t}\n\tbs, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar v createHistoryResponse\n\tjson.Unmarshal(bs, &v)\n\treturn &History{\n\t\tClient: c,\n\t\tID: v.Key,\n\t}, nil\n}", "title": "" }, { "docid": "5ea43ebaeb004a457d6042868c67f4aa", "score": "0.4676481", "text": "func createPostPageHandler(db *bolt.DB, t *template.Template) http.HandlerFunc {\n\tfn := func(res http.ResponseWriter, r *http.Request) {\n\t\tlog.Println(\"Requested the create post page.\")\n\t\tres.Header().Set(\"Content-Type\", \"text/html; charset=UTF-8\")\n\t\tres.WriteHeader(http.StatusOK)\n\t\tt.Execute(res, HomePageData{SiteMetaData: siteMetaData})\n\t}\n\n\treturn fn\n}", "title": "" }, { "docid": "c7e6b0e32c09beed74ed8c759dfd5104", "score": "0.4676157", "text": "func CrearTablaActividad() {\n\tEjecutarExec(queryActividad)\n}", "title": "" }, { "docid": "123a81dbee5172baa0c61fe7b7e3009e", "score": "0.46754757", "text": "func ToDoCreate(w http.ResponseWriter, r *http.Request) {\n\tvar todo ToDo\n\n\tparams := strings.Split(r.URL.RawQuery, \"?\")\n\ttitle := strings.Split(params[0], \"=\")\n\tdescription := strings.Split(params[1], \"=\")\n\tif todo.Title = title[1]; todo.Title == \"\" {\n\t\tw.WriteHeader(422)\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t} else {\n\t\ttodo.Description = description[1]\n\t\tnewToDo := tdll.CreateToDo(todo)\n\t\ttdll.AppendToDo(newToDo)\n\t\tbstID.InsertByID(newToDo)\n\t\tbstTitle.InsertByString(newToDo)\n\n\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\t\tw.WriteHeader(http.StatusCreated)\n\t\tif err := json.NewEncoder(w).Encode(newToDo); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "79e7dc919dd34a846bf246ccccba35c3", "score": "0.4674344", "text": "func (self *Client) CreateDashboard(dash *Dashboard) (*Dashboard, error) {\n\tvar out reqGetDashboard\n\terr := self.doJsonRequest(\"POST\", \"/v1/dash\", dash, &out)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &out.Dashboard, nil\n}", "title": "" }, { "docid": "39d39f5582847965736e1a6ce05644e6", "score": "0.46680522", "text": "func NewPost(w http.ResponseWriter, r *http.Request) {\n\tdata := context.Get(r, \"data\")\n\tt, _ := template.ParseFiles(\"templates/layout.html\", \"templates/new.html\")\n\tt.Execute(w, data)\n}", "title": "" }, { "docid": "95d685d05b4fe0d085ef24aba83f8e6b", "score": "0.4665753", "text": "func (s *mergeRequestsService) Create() error {\n\tproject, _, err := s.gitlabProject.GetProject(s.project, &gitlab.GetProjectOptions{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefaultBranch := project.DefaultBranch\n\tcurrentBranch := git.CurrentBranch()\n\tif defaultBranch == currentBranch {\n\t\treturn fmt.Errorf(\"must be on a branch named differently than %q\", defaultBranch)\n\t}\n\n\tif err := git.Push(currentBranch); err != nil {\n\t\treturn fmt.Errorf(\"failed to push branch %q (non-fast-forward)\", currentBranch)\n\t}\n\n\tu := *s.baseURL\n\tu.Path = path.Join(s.project, \"merge_requests\", \"new\")\n\tq := u.Query()\n\tq.Set(\"merge_request[source_branch]\", currentBranch)\n\tq.Set(\"merge_request[target_branch]\", defaultBranch)\n\tq.Set(\"merge_request[source_project_id]\", strconv.Itoa(project.ID))\n\tq.Set(\"merge_request[target_project_id]\", strconv.Itoa(project.ID))\n\tu.RawQuery = q.Encode()\n\n\tfmt.Fprintf(s.out, \"\\nOpening %s in your browser\\n\", u.String())\n\treturn s.openURL(u.String())\n}", "title": "" }, { "docid": "a21baa477159f81a9710cd5593c3e9a6", "score": "0.4663196", "text": "func (s *user) Create() (err error) { return s.PtrScope().Create() }", "title": "" } ]
7e1b9c8dc28da9c5f3345f3243b7d99e
Convert_aws_InstanceProfile_To_v1alpha1_InstanceProfile is an autogenerated conversion function.
[ { "docid": "5a51ed89f0d56c12e96f572f7410dee9", "score": "0.8497053", "text": "func Convert_aws_InstanceProfile_To_v1alpha1_InstanceProfile(in *aws.InstanceProfile, out *InstanceProfile, s conversion.Scope) error {\n\treturn autoConvert_aws_InstanceProfile_To_v1alpha1_InstanceProfile(in, out, s)\n}", "title": "" } ]
[ { "docid": "001dc1182da059f43664116493096da3", "score": "0.78106254", "text": "func Convert_aws_IAMInstanceProfile_To_v1alpha1_IAMInstanceProfile(in *aws.IAMInstanceProfile, out *IAMInstanceProfile, s conversion.Scope) error {\n\treturn autoConvert_aws_IAMInstanceProfile_To_v1alpha1_IAMInstanceProfile(in, out, s)\n}", "title": "" }, { "docid": "24278581c7d40b8fd385433f8ad865f1", "score": "0.668234", "text": "func Convert_v1alpha1_InstanceProfile_To_aws_InstanceProfile(in *InstanceProfile, out *aws.InstanceProfile, s conversion.Scope) error {\n\treturn autoConvert_v1alpha1_InstanceProfile_To_aws_InstanceProfile(in, out, s)\n}", "title": "" }, { "docid": "8bdeb71cfecec52ca2ae5ee893a5f479", "score": "0.6197644", "text": "func Convert_v1alpha1_IAMInstanceProfile_To_aws_IAMInstanceProfile(in *IAMInstanceProfile, out *aws.IAMInstanceProfile, s conversion.Scope) error {\n\treturn autoConvert_v1alpha1_IAMInstanceProfile_To_aws_IAMInstanceProfile(in, out, s)\n}", "title": "" }, { "docid": "bbe2e73905b426d47d74da5d3990e650", "score": "0.61625797", "text": "func (in *IAMInstanceProfile) DeepCopy() *IAMInstanceProfile {\n\tif in == nil { return nil }\n\tout := new(IAMInstanceProfile)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "84d6d5986544e03e8f551ce16a9b338f", "score": "0.5465863", "text": "func (*VpcV1) NewInstancePatchProfileInstanceProfileIdentityByName(name string) (_model *InstancePatchProfileInstanceProfileIdentityByName, err error) {\n\t_model = &InstancePatchProfileInstanceProfileIdentityByName{\n\t\tName: core.StringPtr(name),\n\t}\n\terr = core.ValidateStruct(_model, \"required parameters\")\n\treturn\n}", "title": "" }, { "docid": "9079dd0371bb0ed231b7cb242cc2717a", "score": "0.5405165", "text": "func NewInstanceProfile(ctx *pulumi.Context,\n\tname string, args *InstanceProfileArgs, opts ...pulumi.ResourceOption) (*InstanceProfile, error) {\n\tif args == nil {\n\t\targs = &InstanceProfileArgs{}\n\t}\n\n\tvar resource InstanceProfile\n\terr := ctx.RegisterResource(\"aws:iam/instanceProfile:InstanceProfile\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "bebec5c244b9b019c07b0740e9fb7862", "score": "0.5306595", "text": "func StatusInstanceIAMInstanceProfile(conn *ec2.EC2, id string) resource.StateRefreshFunc {\n\treturn func() (interface{}, string, error) {\n\t\tinstance, err := FindInstanceByID(conn, id)\n\n\t\tif tfawserr.ErrCodeEquals(err, ErrCodeInvalidInstanceIDNotFound) {\n\t\t\treturn nil, \"\", nil\n\t\t}\n\n\t\tif err != nil {\n\t\t\treturn nil, \"\", err\n\t\t}\n\n\t\tif instance == nil {\n\t\t\treturn nil, \"\", nil\n\t\t}\n\n\t\tif instance.IamInstanceProfile == nil || instance.IamInstanceProfile.Arn == nil {\n\t\t\treturn instance, \"\", nil\n\t\t}\n\n\t\tname, err := tfiam.InstanceProfileARNToName(aws.StringValue(instance.IamInstanceProfile.Arn))\n\n\t\tif err != nil {\n\t\t\treturn instance, \"\", err\n\t\t}\n\n\t\treturn instance, name, nil\n\t}\n}", "title": "" }, { "docid": "504dbaf56639d955f001a8b821da4801", "score": "0.53015876", "text": "func UnmarshalInstanceProfile(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(InstanceProfile)\n\terr = core.UnmarshalModel(m, \"bandwidth\", &obj.Bandwidth, UnmarshalInstanceProfileBandwidth)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"disks\", &obj.Disks, UnmarshalInstanceProfileDisk)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"family\", &obj.Family)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"gpu_count\", &obj.GpuCount, UnmarshalInstanceProfileGpu)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"gpu_manufacturer\", &obj.GpuManufacturer, UnmarshalInstanceProfileGpuManufacturer)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"gpu_memory\", &obj.GpuMemory, UnmarshalInstanceProfileGpuMemory)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"gpu_model\", &obj.GpuModel, UnmarshalInstanceProfileGpuModel)\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.UnmarshalModel(m, \"memory\", &obj.Memory, UnmarshalInstanceProfileMemory)\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.UnmarshalModel(m, \"os_architecture\", &obj.OsArchitecture, UnmarshalInstanceProfileOsArchitecture)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"port_speed\", &obj.PortSpeed, UnmarshalInstanceProfilePortSpeed)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"total_volume_bandwidth\", &obj.TotalVolumeBandwidth, UnmarshalInstanceProfileVolumeBandwidth)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"vcpu_architecture\", &obj.VcpuArchitecture, UnmarshalInstanceProfileVcpuArchitecture)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(m, \"vcpu_count\", &obj.VcpuCount, UnmarshalInstanceProfileVcpu)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "title": "" }, { "docid": "d4d68376391f8e7d34c060417bb86c70", "score": "0.519168", "text": "func (in *VirtualMachineInstanceProfile) DeepCopy() *VirtualMachineInstanceProfile {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VirtualMachineInstanceProfile)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "ff75ef202c2e83f37b6b404fe7451b38", "score": "0.51077706", "text": "func (c *IAM) CreateInstanceProfile(req *CreateInstanceProfileRequest) (resp *CreateInstanceProfileResult, err error) {\n\tresp = &CreateInstanceProfileResult{}\n\terr = c.client.Do(\"CreateInstanceProfile\", \"POST\", \"/\", req, resp)\n\treturn\n}", "title": "" }, { "docid": "2927ec25c09ef1a3d1f17ba004ab8a43", "score": "0.50930196", "text": "func Convert_core_TidbInstance_To_v1alpha1_TidbInstance(in *core.TidbInstance, out *TidbInstance, s conversion.Scope) error {\n\treturn autoConvert_core_TidbInstance_To_v1alpha1_TidbInstance(in, out, s)\n}", "title": "" }, { "docid": "0bc512d013a40ca62079fcf5763e5b8f", "score": "0.50336856", "text": "func Convert_garden_Extension_To_v1alpha1_Extension(in *garden.Extension, out *Extension, s conversion.Scope) error {\n\treturn autoConvert_garden_Extension_To_v1alpha1_Extension(in, out, s)\n}", "title": "" }, { "docid": "c81020bc51c7a16c7cfdee2289c05a60", "score": "0.5024831", "text": "func (o LookupLaunchConfigurationResultOutput) IamInstanceProfile() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupLaunchConfigurationResult) string { return v.IamInstanceProfile }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "3cac054ee5d797c7b5cd471b53a9da8f", "score": "0.5017129", "text": "func (*VpcV1) NewInstancePatchProfileInstanceProfileIdentityByHref(href string) (_model *InstancePatchProfileInstanceProfileIdentityByHref, err error) {\n\t_model = &InstancePatchProfileInstanceProfileIdentityByHref{\n\t\tHref: core.StringPtr(href),\n\t}\n\terr = core.ValidateStruct(_model, \"required parameters\")\n\treturn\n}", "title": "" }, { "docid": "ee10c1e6df7944d317dbc3262aa258f9", "score": "0.501626", "text": "func (in *ScheduledInstancesIAMInstanceProfile) DeepCopy() *ScheduledInstancesIAMInstanceProfile {\n\tif in == nil { return nil }\n\tout := new(ScheduledInstancesIAMInstanceProfile)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "dfd4c3c770533fdc4c700c144184e07b", "score": "0.50138617", "text": "func Convert_core_BackupEntry_To_v1alpha1_BackupEntry(in *core.BackupEntry, out *BackupEntry, s conversion.Scope) error {\n\treturn autoConvert_core_BackupEntry_To_v1alpha1_BackupEntry(in, out, s)\n}", "title": "" }, { "docid": "fa1876aa1c6505a62dbb2be4508ab797", "score": "0.50135016", "text": "func (*VpcV1) NewInstanceProfileIdentityByName(name string) (_model *InstanceProfileIdentityByName, err error) {\n\t_model = &InstanceProfileIdentityByName{\n\t\tName: core.StringPtr(name),\n\t}\n\terr = core.ValidateStruct(_model, \"required parameters\")\n\treturn\n}", "title": "" }, { "docid": "95190f46284a2cf06e6878457705df70", "score": "0.49026877", "text": "func (vpc *VpcV1) GetInstanceProfileWithContext(ctx context.Context, getInstanceProfileOptions *GetInstanceProfileOptions) (result *InstanceProfile, response *core.DetailedResponse, err error) {\n\terr = core.ValidateNotNil(getInstanceProfileOptions, \"getInstanceProfileOptions cannot be nil\")\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.ValidateStruct(getInstanceProfileOptions, \"getInstanceProfileOptions\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tpathParamsMap := map[string]string{\n\t\t\"name\": *getInstanceProfileOptions.Name,\n\t}\n\n\tbuilder := core.NewRequestBuilder(core.GET)\n\tbuilder = builder.WithContext(ctx)\n\tbuilder.EnableGzipCompression = vpc.GetEnableGzipCompression()\n\t_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/profiles/{name}`, pathParamsMap)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor headerName, headerValue := range getInstanceProfileOptions.Headers {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\tsdkHeaders := common.GetSdkHeaders(\"vpc\", \"V1\", \"GetInstanceProfile\")\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(*vpc.Version))\n\tbuilder.AddQuery(\"generation\", fmt.Sprint(*vpc.generation))\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 = vpc.Service.Request(request, &rawResponse)\n\tif err != nil {\n\t\treturn\n\t}\n\tif rawResponse != nil {\n\t\terr = core.UnmarshalModel(rawResponse, \"\", &result, UnmarshalInstanceProfile)\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": "a74a472543154620e5548a3b650f171f", "score": "0.48845974", "text": "func NewA1ControllerGetPolicyInstanceStatusOK() *A1ControllerGetPolicyInstanceStatusOK {\n\n\treturn &A1ControllerGetPolicyInstanceStatusOK{}\n}", "title": "" }, { "docid": "b2f62135a4dd87ca86f902f8395989a4", "score": "0.48628822", "text": "func (s AssociateIamInstanceProfileInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "416cfa4cc5b86a4bd0077eb601cd2481", "score": "0.483093", "text": "func NewProfile() *Profile {\n\treturn &Profile{}\n}", "title": "" }, { "docid": "74031a7fc2f14df21e914f9110df3898", "score": "0.48222628", "text": "func NewProfile() *Profile {\n\treturn &Profile{\n\t\tCreatedAt: time.Now().UTC(),\n\t\tUpdatedAt: time.Now().UTC(),\n\t}\n}", "title": "" }, { "docid": "d08257f0aca38a41a0b90aaae446736b", "score": "0.47990608", "text": "func (s CreateInstanceProfileInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "30532e597e44d0f6c2a5d6c2e50c40d0", "score": "0.47772986", "text": "func StartProfileWithName(name string) {\n\tif agentKey != \"\" {\n\t\tspan = Agent.ProfileWithName(name)\n\t}\n}", "title": "" }, { "docid": "481b37b0b50f14afba35695bd6be976f", "score": "0.47714743", "text": "func (s AssociateIamInstanceProfileOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "0b5209378f8d7530a39458a004856fb2", "score": "0.47699395", "text": "func Convert_v1alpha4_Instance_To_v1alpha3_Instance(in *v1alpha4.Instance, out *Instance, s conversion.Scope) error {\n\treturn autoConvert_v1alpha4_Instance_To_v1alpha3_Instance(in, out, s)\n}", "title": "" }, { "docid": "ff1e948aab626a664e216189818cfc60", "score": "0.47455606", "text": "func Convert_admissionregistration_Rule_To_v1alpha1_Rule(in *admissionregistration.Rule, out *Rule, s conversion.Scope) error {\n\treturn autoConvert_admissionregistration_Rule_To_v1alpha1_Rule(in, out, s)\n}", "title": "" }, { "docid": "53da7d2f2ffa6375cda6e39a9b129d25", "score": "0.47299287", "text": "func (in *Profile) DeepCopy() *Profile {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Profile)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "ec2d3af369f14cf18373de0ec91e1506", "score": "0.472435", "text": "func (t *ApnProfile_ApnProfile) NewApnProfile(Id string) (*ApnProfile_ApnProfile_ApnProfile, error){\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.ApnProfile == nil {\n\t\tt.ApnProfile = make(map[string]*ApnProfile_ApnProfile_ApnProfile)\n\t}\n\n\tkey := Id\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.ApnProfile[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list ApnProfile\", key)\n\t}\n\n\tt.ApnProfile[key] = &ApnProfile_ApnProfile_ApnProfile{\n\t\tId: &Id,\n\t}\n\n\treturn t.ApnProfile[key], nil\n}", "title": "" }, { "docid": "b2f94e49dd3e2c8f17777c82a232c8f7", "score": "0.46911132", "text": "func Convert_admissionregistration_Rule_To_v1alpha1_Rule(in *admissionregistration.Rule, out *v1alpha1.Rule, s conversion.Scope) error {\n\treturn autoConvert_admissionregistration_Rule_To_v1alpha1_Rule(in, out, s)\n}", "title": "" }, { "docid": "bbdadb300055fef74b0f50d785b328a7", "score": "0.469086", "text": "func NewProfile() *Profile {\n\treturn &Profile{\n\t\taccount: make(map[string]*models.Account),\n\t}\n}", "title": "" }, { "docid": "c5034471ca82f91a4637b749cad80b42", "score": "0.4690735", "text": "func Convert_core_TidbInstanceSpec_To_v1alpha1_TidbInstanceSpec(in *core.TidbInstanceSpec, out *TidbInstanceSpec, s conversion.Scope) error {\n\treturn autoConvert_core_TidbInstanceSpec_To_v1alpha1_TidbInstanceSpec(in, out, s)\n}", "title": "" }, { "docid": "bf434c79e473d621f75b4160e9861fd1", "score": "0.46810493", "text": "func NewProfileUpdate() *ProfileUpdate {\n\treturn &ProfileUpdate{}\n}", "title": "" }, { "docid": "d68d87df01f183c65ea428340b0e64fc", "score": "0.46728", "text": "func (o *CustomerInventory) SetProfile(v CustomerProfile) {\n\to.Profile = &v\n}", "title": "" }, { "docid": "afec7cd6b5bc2ca9e383e67785d9348d", "score": "0.464244", "text": "func UnmarshalInstancePatchProfileInstanceProfileIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(InstancePatchProfileInstanceProfileIdentityByName)\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": "862207e2f9b72109377f0164251b1fa5", "score": "0.46395585", "text": "func (c *Client) ImagepolicyV1Alpha1() *ImagepolicyV1Alpha1 {\n\treturn &ImagepolicyV1Alpha1{c}\n}", "title": "" }, { "docid": "862207e2f9b72109377f0164251b1fa5", "score": "0.46395585", "text": "func (c *Client) ImagepolicyV1Alpha1() *ImagepolicyV1Alpha1 {\n\treturn &ImagepolicyV1Alpha1{c}\n}", "title": "" }, { "docid": "54a564140b21608a72a3cf905228e914", "score": "0.4623606", "text": "func NewProfile() *Profile {\n\treturn &Profile{\n\t\tLastUpdated: time.Now(),\n\t}\n}", "title": "" }, { "docid": "6475fa0bb362689cbb0213f368e9d5c5", "score": "0.46207646", "text": "func (p *Profiler) StartProfile(key string) {\n\tif config.GlobalAppConfig.Profiler.Enable == false {\n\t\treturn\n\t}\n\tp.startTime = time.Now()\n\tp.key = key\n}", "title": "" }, { "docid": "264f5f10792c05457408aeb488b64a95", "score": "0.46193177", "text": "func (s CreateInstanceProfileOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "fb6b43d7888eb1711567913643d5f0a7", "score": "0.46175775", "text": "func StartProfile() {\n\tif agentKey != \"\" {\n\t\tspan = Agent.Profile()\n\t}\n}", "title": "" }, { "docid": "2efc901a375a12b9c5efa906a7d63808", "score": "0.46161422", "text": "func (addigy AddigyClient) CreateProfile(profile Instruction) (*Instruction, error) {\n\turl := addigy.buildURL(\"/api/profiles\", nil)\n\tjsonPayload, _ := json.Marshal(profile)\n\treq, err := http.NewRequest(\"POST\", url, bytes.NewBuffer(jsonPayload))\n\tif err != nil {\n\t\t// Handle error from creating new request.\n\t\treturn nil, fmt.Errorf(\"error occurred creating new request: %s\", err)\n\t}\n\n\tvar createdProfile *Instruction\n\terr = addigy.do(req, &createdProfile)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error occurred performing request: %s\", err)\n\t}\n\n\treturn createdProfile, nil\n}", "title": "" }, { "docid": "000dc18ee91571eb1e978ca04ea7a7fd", "score": "0.4607425", "text": "func NewProfile(store storage.Store) *Profile {\n\treturn &Profile{store: store}\n}", "title": "" }, { "docid": "b14391babc2aaee60a64c5eae9998f19", "score": "0.46000734", "text": "func NewProfile() *Profile {\n\tp := &Profile{}\n\tp.SetDefaults()\n\treturn p\n}", "title": "" }, { "docid": "a3ad037e964b97b5b40925c592d1b934", "score": "0.4598035", "text": "func (v *version) IamInstanceProfiles() IamInstanceProfileInformer {\n\treturn &iamInstanceProfileInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}\n}", "title": "" }, { "docid": "d44b1ad39985c087687e41bfac073e62", "score": "0.45921496", "text": "func Convert_core_TidbInstanceStrategy_To_v1alpha1_TidbInstanceStrategy(in *core.TidbInstanceStrategy, out *TidbInstanceStrategy, s conversion.Scope) error {\n\treturn autoConvert_core_TidbInstanceStrategy_To_v1alpha1_TidbInstanceStrategy(in, out, s)\n}", "title": "" }, { "docid": "2f1294653c09a9c155181adebbeb8742", "score": "0.4589277", "text": "func (o LaunchTemplateIamInstanceProfileOutput) Name() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LaunchTemplateIamInstanceProfile) *string { return v.Name }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "2217e9520be33b958412d7c464ebaf80", "score": "0.45782733", "text": "func (c *IAM) DeleteInstanceProfile(req *DeleteInstanceProfileRequest) (err error) {\n\t// NRE\n\terr = c.client.Do(\"DeleteInstanceProfile\", \"POST\", \"/\", req, nil)\n\treturn\n}", "title": "" }, { "docid": "238f828cf443fdff01fe9bd8270d65e7", "score": "0.4562689", "text": "func (o *A1ControllerGetPolicyInstanceStatusOK) WithPayload(payload *A1ControllerGetPolicyInstanceStatusOKBody) *A1ControllerGetPolicyInstanceStatusOK {\n\to.Payload = payload\n\treturn o\n}", "title": "" }, { "docid": "7fbb022ddc2d72c9ab31fb258e88f01e", "score": "0.45615888", "text": "func NewProfile() *Profile {\n\treturn &Profile{\n\t\tTypeMetadata: unversioned.TypeMetadata{\n\t\t\tKind: \"profile\",\n\t\t\tAPIVersion: unversioned.VersionCurrent,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "c7a75c95c69a538e5812f227fd18a896", "score": "0.45596454", "text": "func Convert_aws_Zone_To_v1alpha1_Zone(in *aws.Zone, out *Zone, s conversion.Scope) error {\n\treturn autoConvert_aws_Zone_To_v1alpha1_Zone(in, out, s)\n}", "title": "" }, { "docid": "32dd2d6e94a4a9d192da49f36a0996b8", "score": "0.4552777", "text": "func Convert_core_TidbBackup_To_v1alpha1_TidbBackup(in *core.TidbBackup, out *TidbBackup, s conversion.Scope) error {\n\treturn autoConvert_core_TidbBackup_To_v1alpha1_TidbBackup(in, out, s)\n}", "title": "" }, { "docid": "23890e207b2946acfdeffd75402a321f", "score": "0.4533343", "text": "func (*VpcV1) NewLoadBalancerProfileIdentityByName(name string) (_model *LoadBalancerProfileIdentityByName, err error) {\n\t_model = &LoadBalancerProfileIdentityByName{\n\t\tName: core.StringPtr(name),\n\t}\n\terr = core.ValidateStruct(_model, \"required parameters\")\n\treturn\n}", "title": "" }, { "docid": "7f5838d02d39cf1749c283d9ad9344ae", "score": "0.45088336", "text": "func doProfileUpdateInstance(s *state.State, args db.InstanceArgs, p api.Project) error {\n\tprofileNames := make([]string, 0, len(args.Profiles))\n\n\tfor _, profile := range args.Profiles {\n\t\tprofileNames = append(profileNames, profile.Name)\n\t}\n\n\tprofiles, err := s.DB.Cluster.GetProfiles(args.Project, profileNames)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Load the instance using the old profile config.\n\tinst, err := instance.Load(s, args, p)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Update will internally load the new profile configs and detect the changes to apply.\n\treturn inst.Update(db.InstanceArgs{\n\t\tArchitecture: inst.Architecture(),\n\t\tConfig: inst.LocalConfig(),\n\t\tDescription: inst.Description(),\n\t\tDevices: inst.LocalDevices(),\n\t\tEphemeral: inst.IsEphemeral(),\n\t\tProfiles: profiles, // Supply with new profile config.\n\t\tProject: inst.Project().Name,\n\t\tType: inst.Type(),\n\t\tSnapshot: inst.IsSnapshot(),\n\t}, true)\n}", "title": "" }, { "docid": "e3447fcc212e177fb7513cc6144bc8fa", "score": "0.45051724", "text": "func (vpc *VpcV1) GetInstanceProfile(getInstanceProfileOptions *GetInstanceProfileOptions) (result *InstanceProfile, response *core.DetailedResponse, err error) {\n\treturn vpc.GetInstanceProfileWithContext(context.Background(), getInstanceProfileOptions)\n}", "title": "" }, { "docid": "c7d2f9eb7c6b55361d3f34a8f27aa2a9", "score": "0.4501853", "text": "func InstanceToProto(resource *alpha.Instance) *alphapb.ComputeAlphaInstance {\n\tp := &alphapb.ComputeAlphaInstance{}\n\tp.SetCanIpForward(dcl.ValueOrEmptyBool(resource.CanIPForward))\n\tp.SetCpuPlatform(dcl.ValueOrEmptyString(resource.CpuPlatform))\n\tp.SetCreationTimestamp(dcl.ValueOrEmptyString(resource.CreationTimestamp))\n\tp.SetDeletionProtection(dcl.ValueOrEmptyBool(resource.DeletionProtection))\n\tp.SetDescription(dcl.ValueOrEmptyString(resource.Description))\n\tp.SetHostname(dcl.ValueOrEmptyString(resource.Hostname))\n\tp.SetId(dcl.ValueOrEmptyString(resource.Id))\n\tp.SetMachineType(dcl.ValueOrEmptyString(resource.MachineType))\n\tp.SetMinCpuPlatform(dcl.ValueOrEmptyString(resource.MinCpuPlatform))\n\tp.SetName(dcl.ValueOrEmptyString(resource.Name))\n\tp.SetScheduling(ComputeAlphaInstanceSchedulingToProto(resource.Scheduling))\n\tp.SetShieldedInstanceConfig(ComputeAlphaInstanceShieldedInstanceConfigToProto(resource.ShieldedInstanceConfig))\n\tp.SetStatus(ComputeAlphaInstanceStatusEnumToProto(resource.Status))\n\tp.SetStatusMessage(dcl.ValueOrEmptyString(resource.StatusMessage))\n\tp.SetZone(dcl.ValueOrEmptyString(resource.Zone))\n\tp.SetProject(dcl.ValueOrEmptyString(resource.Project))\n\tp.SetSelfLink(dcl.ValueOrEmptyString(resource.SelfLink))\n\tsDisks := make([]*alphapb.ComputeAlphaInstanceDisks, len(resource.Disks))\n\tfor i, r := range resource.Disks {\n\t\tsDisks[i] = ComputeAlphaInstanceDisksToProto(&r)\n\t}\n\tp.SetDisks(sDisks)\n\tsGuestAccelerators := make([]*alphapb.ComputeAlphaInstanceGuestAccelerators, len(resource.GuestAccelerators))\n\tfor i, r := range resource.GuestAccelerators {\n\t\tsGuestAccelerators[i] = ComputeAlphaInstanceGuestAcceleratorsToProto(&r)\n\t}\n\tp.SetGuestAccelerators(sGuestAccelerators)\n\tmLabels := make(map[string]string, len(resource.Labels))\n\tfor k, r := range resource.Labels {\n\t\tmLabels[k] = r\n\t}\n\tp.SetLabels(mLabels)\n\tmMetadata := make(map[string]string, len(resource.Metadata))\n\tfor k, r := range resource.Metadata {\n\t\tmMetadata[k] = r\n\t}\n\tp.SetMetadata(mMetadata)\n\tsNetworkInterfaces := make([]*alphapb.ComputeAlphaInstanceNetworkInterfaces, len(resource.NetworkInterfaces))\n\tfor i, r := range resource.NetworkInterfaces {\n\t\tsNetworkInterfaces[i] = ComputeAlphaInstanceNetworkInterfacesToProto(&r)\n\t}\n\tp.SetNetworkInterfaces(sNetworkInterfaces)\n\tsServiceAccounts := make([]*alphapb.ComputeAlphaInstanceServiceAccounts, len(resource.ServiceAccounts))\n\tfor i, r := range resource.ServiceAccounts {\n\t\tsServiceAccounts[i] = ComputeAlphaInstanceServiceAccountsToProto(&r)\n\t}\n\tp.SetServiceAccounts(sServiceAccounts)\n\tsTags := make([]string, len(resource.Tags))\n\tfor i, r := range resource.Tags {\n\t\tsTags[i] = r\n\t}\n\tp.SetTags(sTags)\n\n\treturn p\n}", "title": "" }, { "docid": "194f7da025b55a7f2f40778293b93f94", "score": "0.4490205", "text": "func Convert_core_BackupEntryStatus_To_v1alpha1_BackupEntryStatus(in *core.BackupEntryStatus, out *BackupEntryStatus, s conversion.Scope) error {\n\treturn autoConvert_core_BackupEntryStatus_To_v1alpha1_BackupEntryStatus(in, out, s)\n}", "title": "" }, { "docid": "9c5226269e62c05d40b7214c04408107", "score": "0.44867724", "text": "func GetInstanceProfile(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *InstanceProfileState, opts ...pulumi.ResourceOption) (*InstanceProfile, error) {\n\tvar resource InstanceProfile\n\terr := ctx.ReadResource(\"aws:iam/instanceProfile:InstanceProfile\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "24d300cbf3799df4875eb653a3bda628", "score": "0.44805446", "text": "func Convert_v1alpha3_Instance_To_v1alpha4_Instance(in *Instance, out *v1alpha4.Instance, s conversion.Scope) error {\n\treturn autoConvert_v1alpha3_Instance_To_v1alpha4_Instance(in, out, s)\n}", "title": "" }, { "docid": "dd0f613575e652c326ab1f45f6523e8f", "score": "0.44798097", "text": "func Convert_garden_CloudProfileList_To_v1alpha1_CloudProfileList(in *garden.CloudProfileList, out *CloudProfileList, s conversion.Scope) error {\n\treturn autoConvert_garden_CloudProfileList_To_v1alpha1_CloudProfileList(in, out, s)\n}", "title": "" }, { "docid": "b8ffa069cb091e7d0bea4c79858a20fb", "score": "0.4479017", "text": "func (p Profile) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(&struct {\n\t\tAPIKey string `json:\"apiKey,omitempty\"`\n\t\tInsightsInsertKey string `json:\"insightsInsertKey,omitempty\"`\n\t\tRegion string `json:\"region,omitempty\"`\n\t\tAccountID int `json:\"accountID,omitempty\"`\n\t\tLicenseKey string `json:\"licenseKey,omitempty\"`\n\t}{\n\t\tAPIKey: p.APIKey,\n\t\tInsightsInsertKey: p.InsightsInsertKey,\n\t\tAccountID: p.AccountID,\n\t\tLicenseKey: p.LicenseKey,\n\t\tRegion: strings.ToLower(p.Region),\n\t})\n}", "title": "" }, { "docid": "065897d45758d10c4510023d2e686306", "score": "0.44780564", "text": "func Convert_core_BackupEntrySpec_To_v1alpha1_BackupEntrySpec(in *core.BackupEntrySpec, out *BackupEntrySpec, s conversion.Scope) error {\n\treturn autoConvert_core_BackupEntrySpec_To_v1alpha1_BackupEntrySpec(in, out, s)\n}", "title": "" }, { "docid": "55509700896b541dccef282f37dff533", "score": "0.44771743", "text": "func (s *ProfilesService) Add(\n\tctx context.Context,\n\tprofileARN string,\n\tskipValidation bool,\n) error {\n\traw, err := json.Marshal(struct {\n\t\tInstanceProfileARN string\n\t\tSkipValidation bool\n\t}{\n\t\tprofileARN,\n\t\tskipValidation,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treq, err := http.NewRequest(\n\t\thttp.MethodPost,\n\t\ts.client.url+\"2.0/instance-profiles/add\",\n\t\tbytes.NewBuffer(raw),\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\treq = req.WithContext(ctx)\n\tres, err := s.client.client.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif res.StatusCode >= 300 || res.StatusCode <= 199 {\n\t\treturn fmt.Errorf(\n\t\t\t\"Failed to returns 2XX response: %d\", res.StatusCode)\n\t}\n\n\treturn nil\n\n}", "title": "" }, { "docid": "5eca56e01692f6add0e1ed5b9ba0b843", "score": "0.4476486", "text": "func UnmarshalInstanceProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(InstanceProfileIdentity)\n\terr = core.UnmarshalPrimitive(m, \"name\", &obj.Name)\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\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "title": "" }, { "docid": "7854108e9bb2aa9c6449fcb3135f6434", "score": "0.44740814", "text": "func (o LaunchTemplateIamInstanceProfilePtrOutput) Name() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *LaunchTemplateIamInstanceProfile) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Name\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "f3026d0d5c7a9ae144acb4b17e7b77f1", "score": "0.4473515", "text": "func Convert_core_TidbBackupSpec_To_v1alpha1_TidbBackupSpec(in *core.TidbBackupSpec, out *TidbBackupSpec, s conversion.Scope) error {\n\treturn autoConvert_core_TidbBackupSpec_To_v1alpha1_TidbBackupSpec(in, out, s)\n}", "title": "" }, { "docid": "1ee1c82ca1cc621744cd5b0747bdbb87", "score": "0.44642553", "text": "func (c *IAM) GetInstanceProfile(req *GetInstanceProfileRequest) (resp *GetInstanceProfileResult, err error) {\n\tresp = &GetInstanceProfileResult{}\n\terr = c.client.Do(\"GetInstanceProfile\", \"POST\", \"/\", req, resp)\n\treturn\n}", "title": "" }, { "docid": "1fe6adbef7da816f5bb3a2c5c8b9232a", "score": "0.44587758", "text": "func Convert_garden_SeedBackup_To_v1alpha1_SeedBackup(in *garden.SeedBackup, out *SeedBackup, s conversion.Scope) error {\n\treturn autoConvert_garden_SeedBackup_To_v1alpha1_SeedBackup(in, out, s)\n}", "title": "" }, { "docid": "0b04a798294730a1138ae47a723feba5", "score": "0.4445478", "text": "func Convert_garden_Hibernation_To_v1alpha1_Hibernation(in *garden.Hibernation, out *Hibernation, s conversion.Scope) error {\n\treturn autoConvert_garden_Hibernation_To_v1alpha1_Hibernation(in, out, s)\n}", "title": "" }, { "docid": "109fe863c64b7fa49bb67915a0983743", "score": "0.4444931", "text": "func Convert_sample_Test_To_v1alpha1_Test(in *sample.Test, out *Test, s conversion.Scope) error {\n\treturn autoConvert_sample_Test_To_v1alpha1_Test(in, out, s)\n}", "title": "" }, { "docid": "82832f0aef001ea2e14f7f3bf37be75e", "score": "0.44297472", "text": "func Convert_core_BackupBucket_To_v1alpha1_BackupBucket(in *core.BackupBucket, out *BackupBucket, s conversion.Scope) error {\n\treturn autoConvert_core_BackupBucket_To_v1alpha1_BackupBucket(in, out, s)\n}", "title": "" }, { "docid": "c6549cd3f6e49052060ee3d25c12d0e1", "score": "0.44092187", "text": "func (in *AWSProfile) DeepCopy() *AWSProfile {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AWSProfile)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "27659d14da7bee0eeac59a281b76aee5", "score": "0.44058418", "text": "func NewProfile() *Profile {\n\treturn &Profile{\n\t\tCreatedAt: time.Now().UTC(),\n\t\tLinkColor: \"FF0000\",\n\t}\n}", "title": "" }, { "docid": "135c3a2a6387a1c22ffaa4362d4546b0", "score": "0.43934903", "text": "func Convert_garden_NginxIngress_To_v1alpha1_NginxIngress(in *garden.NginxIngress, out *NginxIngress, s conversion.Scope) error {\n\treturn autoConvert_garden_NginxIngress_To_v1alpha1_NginxIngress(in, out, s)\n}", "title": "" }, { "docid": "940ee1dc3eedc6115f812740f81f2b60", "score": "0.4392579", "text": "func (c *Client) CreateProfile(ctx context.Context, profile *api.FargateProfile, waitForCreation bool) error {\n\tif profile == nil {\n\t\treturn errors.New(\"invalid Fargate profile: nil\")\n\t}\n\tlogger.Debug(\"Fargate profile: create request input: %#v\", profile)\n\tout, err := c.api.CreateFargateProfile(ctx, createRequest(c.clusterName, profile))\n\tlogger.Debug(\"Fargate profile: create request: received: %#v\", out)\n\tif err != nil {\n\t\tvar ipe *ekstypes.InvalidParameterException\n\t\tif errors.As(err, &ipe) && strings.HasPrefix(ipe.ErrorMessage(), \"Fargate Profile creation for the Availability Zone\") {\n\t\t\treturn fmt.Errorf(\"%s; please rerun the command by supplying subnets in the Fargate Profile that do not exist in the unsupported AZ, or recreate the cluster after specifying supported AZs in `availabilityZones`\", ipe.ErrorMessage())\n\t\t}\n\t\treturn errors.Wrapf(err, \"failed to create Fargate profile %q\", profile.Name)\n\t}\n\tif waitForCreation {\n\t\treturn c.waitForCreation(ctx, profile.Name)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "02d458b91daa91a9675f65ca0b302607", "score": "0.43918845", "text": "func (rd *IAMInstanceProfileDeleter) RequestIAMInstanceProfiles() ([]*iam.InstanceProfile, error) {\n\tif len(rd.ResourceNames) == 0 {\n\t\treturn nil, nil\n\t}\n\n\t// We cannot request a filtered list of instance profiles, so we must\n\t// iterate through all returned profiles and select the ones we want.\n\twant, iprs := createResourceNameMapFromResourceNames(rd.ResourceNames), make([]*iam.InstanceProfile, 0)\n\tparams := &iam.ListInstanceProfilesInput{\n\t\tMaxItems: aws.Int64(100),\n\t}\n\tfor {\n\t\tctx := aws.BackgroundContext()\n\t\tresp, err := rd.GetClient().ListInstanceProfilesWithContext(ctx, params)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"{\\\"error\\\": \\\"%s\\\"}\\n\", err)\n\t\t\treturn iprs, err\n\t\t}\n\n\t\tfor _, rp := range resp.InstanceProfiles {\n\t\t\tif _, ok := want[arn.ToResourceName(rp.InstanceProfileName)]; ok {\n\t\t\t\tiprs = append(iprs, rp)\n\t\t\t}\n\t\t}\n\n\t\tif !aws.BoolValue(resp.IsTruncated) {\n\t\t\tbreak\n\t\t}\n\n\t\tparams.Marker = resp.Marker\n\n\t}\n\treturn iprs, nil\n}", "title": "" }, { "docid": "757386e86940b26485f05e13741858da", "score": "0.43914133", "text": "func (o *Reconciliation) SetProfile(v string) {\n\to.Profile = &v\n}", "title": "" }, { "docid": "244e7e8f3a38d54bd9526ef5d40d3dfd", "score": "0.43892378", "text": "func (in *IAMInstanceProfileSpecification) DeepCopy() *IAMInstanceProfileSpecification {\n\tif in == nil { return nil }\n\tout := new(IAMInstanceProfileSpecification)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "949c1a47231f0844d3c76b6d932aa93b", "score": "0.43829018", "text": "func Convert_garden_AuditPolicy_To_v1alpha1_AuditPolicy(in *garden.AuditPolicy, out *AuditPolicy, s conversion.Scope) error {\n\treturn autoConvert_garden_AuditPolicy_To_v1alpha1_AuditPolicy(in, out, s)\n}", "title": "" }, { "docid": "a992b328e216282fd6006e99b1a4eed9", "score": "0.43774736", "text": "func (uc *UserCreate) SetProfile(s string) *UserCreate {\n\tuc.mutation.SetProfile(s)\n\treturn uc\n}", "title": "" }, { "docid": "46b093c8e04f470feeb631bdfa390ca4", "score": "0.43738565", "text": "func Convert_core_BackupBucketSpec_To_v1alpha1_BackupBucketSpec(in *core.BackupBucketSpec, out *BackupBucketSpec, s conversion.Scope) error {\n\treturn autoConvert_core_BackupBucketSpec_To_v1alpha1_BackupBucketSpec(in, out, s)\n}", "title": "" }, { "docid": "c20372755d5a4916b1c79b4d914276c1", "score": "0.43704832", "text": "func (*VpcV1) NewInstanceProfileIdentityByHref(href string) (_model *InstanceProfileIdentityByHref, err error) {\n\t_model = &InstanceProfileIdentityByHref{\n\t\tHref: core.StringPtr(href),\n\t}\n\terr = core.ValidateStruct(_model, \"required parameters\")\n\treturn\n}", "title": "" }, { "docid": "05b1b332caa07caa1ca863f7bca45d2d", "score": "0.43647656", "text": "func (d *AWSProfile) UpdateProfile(r *components.ClusterProfileRequest, withSave bool) error {\n\n\tif len(r.Location) != 0 {\n\t\td.Location = r.Location\n\t}\n\n\tif len(r.NodeInstanceType) != 0 {\n\t\td.NodeInstanceType = r.NodeInstanceType\n\t}\n\tif r.Properties.Amazon != nil {\n\t\tif r.Properties.Amazon.Node != nil {\n\t\t\tif len(r.Properties.Amazon.Node.SpotPrice) != 0 {\n\t\t\t\td.NodeSpotPrice = r.Properties.Amazon.Node.SpotPrice\n\t\t\t}\n\n\t\t\tif r.Properties.Amazon.Node.MinCount != 0 {\n\t\t\t\td.NodeMinCount = r.Properties.Amazon.Node.MinCount\n\t\t\t}\n\n\t\t\tif r.Properties.Amazon.Node.MaxCount != 0 {\n\t\t\t\td.NodeMaxCount = r.Properties.Amazon.Node.MaxCount\n\t\t\t}\n\n\t\t\tif len(r.Properties.Amazon.Node.Image) != 0 {\n\t\t\t\td.NodeImage = r.Properties.Amazon.Node.Image\n\t\t\t}\n\t\t}\n\n\t\tif r.Properties.Amazon.Master != nil {\n\t\t\tif len(r.Properties.Amazon.Master.InstanceType) != 0 {\n\t\t\t\td.MasterInstanceType = r.Properties.Amazon.Master.InstanceType\n\t\t\t}\n\n\t\t\tif len(r.Properties.Amazon.Master.Image) != 0 {\n\t\t\t\td.MasterImage = r.Properties.Amazon.Master.Image\n\t\t\t}\n\t\t}\n\t}\n\tif withSave {\n\t\treturn d.SaveInstance()\n\t}\n\td.Name = r.Name\n\treturn nil\n}", "title": "" }, { "docid": "5befe0473036397bc0567a4019d03d3e", "score": "0.4360289", "text": "func (addigy AddigyClient) UpdateProfile (instructionID string, payloads []Payload) (*Instruction, error) {\n\turl := addigy.buildURL(\"/api/profiles\", nil)\n\ttype UpdateRequest struct {\n\t\tInstructionID string `json:\"instruction_id\"`\n\t\tPayloads []Payload `json:\"payloads\"`\n\t}\n\n\tupdateRequest := UpdateRequest{InstructionID: instructionID, Payloads: payloads}\n\tjsonPayload, _ := json.Marshal(updateRequest)\n\treq, err := http.NewRequest(\"PUT\", url, bytes.NewBuffer(jsonPayload))\n\tif err != nil {\n\t\t// Handle error from creating new request.\n\t\treturn nil, fmt.Errorf(\"error occurred creating new request: %s\", err)\n\t}\n\n\tvar updatedProfile *Instruction\n\terr = addigy.do(req, &updatedProfile)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error occurred performing request: %s\", err)\n\t}\n\n\treturn updatedProfile, nil\n}", "title": "" }, { "docid": "e61ecff5572123787ff5dabc8ee0570b", "score": "0.43364182", "text": "func deleteInstanceProfile(instanceProfileID *string, iamClient *iam.IAM, logger log.FieldLogger) error {\n\tipList, err := iamClient.ListInstanceProfiles(&iam.ListInstanceProfilesInput{})\n\tif err != nil {\n\t\tlogger.Debugf(\"error listing instance profiles: %v\", err)\n\t\treturn err\n\t}\n\n\tvar matchedIP *iam.InstanceProfile\n\tfor _, ip := range ipList.InstanceProfiles {\n\t\tif *ip.InstanceProfileId == *instanceProfileID {\n\t\t\tmatchedIP = ip\n\t\t}\n\t}\n\n\tif matchedIP == nil {\n\t\t// nothing found, so already deleted?\n\t\treturn nil\n\t}\n\n\t// first delete any roles out of the instance profile\n\terr = deleteRolesFromInstanceProfile(matchedIP, iamClient, logger)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error deleting roles from instance profile: %v\", err)\n\t}\n\n\tlogger.Debugf(\"deleting instance profile: %v\", *matchedIP.InstanceProfileName)\n\t_, err = iamClient.DeleteInstanceProfile(&iam.DeleteInstanceProfileInput{\n\t\tInstanceProfileName: matchedIP.InstanceProfileName,\n\t})\n\tif err != nil {\n\t\tlogger.Debugf(\"error deleting instance profile: %v\", err)\n\t\treturn err\n\t} else if err == nil {\n\t\tlogger.WithField(\"name\", *matchedIP.InstanceProfileName).Info(\"Deleted instance profile\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e2422f08f5357d722deaa5c9cb4bc783", "score": "0.4336231", "text": "func (vpc *VpcV1) ListInstanceProfilesWithContext(ctx context.Context, listInstanceProfilesOptions *ListInstanceProfilesOptions) (result *InstanceProfileCollection, response *core.DetailedResponse, err error) {\n\terr = core.ValidateStruct(listInstanceProfilesOptions, \"listInstanceProfilesOptions\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tbuilder := core.NewRequestBuilder(core.GET)\n\tbuilder = builder.WithContext(ctx)\n\tbuilder.EnableGzipCompression = vpc.GetEnableGzipCompression()\n\t_, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/profiles`, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor headerName, headerValue := range listInstanceProfilesOptions.Headers {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\tsdkHeaders := common.GetSdkHeaders(\"vpc\", \"V1\", \"ListInstanceProfiles\")\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(*vpc.Version))\n\tbuilder.AddQuery(\"generation\", fmt.Sprint(*vpc.generation))\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 = vpc.Service.Request(request, &rawResponse)\n\tif err != nil {\n\t\treturn\n\t}\n\tif rawResponse != nil {\n\t\terr = core.UnmarshalModel(rawResponse, \"\", &result, UnmarshalInstanceProfileCollection)\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": "9b751785e97c326d01a03c403cb8f3c0", "score": "0.4335497", "text": "func Convert_garden_AvailabilityZone_To_v1alpha1_AvailabilityZone(in *garden.AvailabilityZone, out *AvailabilityZone, s conversion.Scope) error {\n\treturn autoConvert_garden_AvailabilityZone_To_v1alpha1_AvailabilityZone(in, out, s)\n}", "title": "" }, { "docid": "5125be5455098b68babf23632f9075da", "score": "0.43339068", "text": "func Convert_aws_IAM_To_v1alpha1_IAM(in *aws.IAM, out *IAM, s conversion.Scope) error {\n\treturn autoConvert_aws_IAM_To_v1alpha1_IAM(in, out, s)\n}", "title": "" }, { "docid": "e9df38c2e08828ee53242cbd680329e8", "score": "0.4332931", "text": "func Convert_sample_UserSpec_To_v1alpha1_UserSpec(in *sample.UserSpec, out *UserSpec, s conversion.Scope) error {\n\treturn autoConvert_sample_UserSpec_To_v1alpha1_UserSpec(in, out, s)\n}", "title": "" }, { "docid": "e9050e92ed7d7cfe9672945aaceac427", "score": "0.43286806", "text": "func Convert_core_TidbInstanceStatus_To_v1alpha1_TidbInstanceStatus(in *core.TidbInstanceStatus, out *TidbInstanceStatus, s conversion.Scope) error {\n\treturn autoConvert_core_TidbInstanceStatus_To_v1alpha1_TidbInstanceStatus(in, out, s)\n}", "title": "" }, { "docid": "ad982afc96e94033cd3c23c4d51978f4", "score": "0.43239883", "text": "func Convert_repositories_Snapshot_To_v1alpha1_Snapshot(in *repositories.Snapshot, out *Snapshot, s conversion.Scope) error {\n\treturn autoConvert_repositories_Snapshot_To_v1alpha1_Snapshot(in, out, s)\n}", "title": "" }, { "docid": "ef212ff599a8cb9f92d61a68098b9105", "score": "0.4319487", "text": "func UnmarshalInstancePatchProfile(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(InstancePatchProfile)\n\terr = core.UnmarshalPrimitive(m, \"name\", &obj.Name)\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\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "title": "" }, { "docid": "f8cb5e9b5731509ff9d1bd4d581183fc", "score": "0.4314125", "text": "func (d *AWSProfile) SaveInstance() error {\n\treturn save(d)\n}", "title": "" }, { "docid": "f92ef7f10bb5c646aa6313968a981883", "score": "0.43120888", "text": "func Convert_servicecatalog_ServiceInstance_To_v1beta1_ServiceInstance(in *servicecatalog.ServiceInstance, out *ServiceInstance, s conversion.Scope) error {\n\treturn autoConvert_servicecatalog_ServiceInstance_To_v1beta1_ServiceInstance(in, out, s)\n}", "title": "" }, { "docid": "f0018e7a94dc54601b595ba994c12901", "score": "0.43107483", "text": "func Convert_core_TidbBackupStrategy_To_v1alpha1_TidbBackupStrategy(in *core.TidbBackupStrategy, out *TidbBackupStrategy, s conversion.Scope) error {\n\treturn autoConvert_core_TidbBackupStrategy_To_v1alpha1_TidbBackupStrategy(in, out, s)\n}", "title": "" }, { "docid": "81170dbce0cb29274e32155e87959769", "score": "0.43078977", "text": "func LookupInstanceProfile(ctx *pulumi.Context, args *LookupInstanceProfileArgs, opts ...pulumi.InvokeOption) (*LookupInstanceProfileResult, error) {\n\topts = internal.PkgInvokeDefaultOpts(opts)\n\tvar rv LookupInstanceProfileResult\n\terr := ctx.Invoke(\"aws-native:iam:getInstanceProfile\", args, &rv, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &rv, nil\n}", "title": "" }, { "docid": "082c9ec10b1e393c6fdf86545c3ea83a", "score": "0.4303585", "text": "func Start(options ...func(*Profile)) interface {\n\tStop()\n} {\n\tif !atomic.CompareAndSwapUint32(&started, 0, 1) {\n\t\tlog.Fatal(\"profile: Start() already called\")\n\t}\n\n\tvar prof Profile\n\tfor _, option := range options {\n\t\toption(&prof)\n\t}\n\n\tpath, err := func() (string, error) {\n\t\tif p := prof.path; p != \"\" {\n\t\t\treturn p, os.MkdirAll(p, 0777)\n\t\t}\n\t\treturn ioutil.TempDir(\"\", \"profile\")\n\t}()\n\n\tif err != nil {\n\t\tlog.Fatalf(\"profile: could not create initial output directory: %v\", err)\n\t}\n\n\tlogf := func(format string, args ...interface{}) {\n\t\tif !prof.quiet {\n\t\t\tlog.Printf(format, args...)\n\t\t}\n\t}\n\n\tswitch prof.mode {\n\tcase cpuMode:\n\t\tfn := filepath.Join(path, \"cpu.pprof\")\n\t\tf, err := os.Create(fn)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"profile: could not create cpu profile %q: %v\", fn, err)\n\t\t}\n\t\tlogf(\"profile: cpu profiling enabled, %s\", fn)\n\t\tpprof.StartCPUProfile(f)\n\t\tprof.closer = func() {\n\t\t\tpprof.StopCPUProfile()\n\t\t\tf.Close()\n\t\t\tlogf(\"profile: cpu profiling disabled, %s\", fn)\n\t\t}\n\n\tcase memMode:\n\t\tfn := filepath.Join(path, \"mem.pprof\")\n\t\tf, err := os.Create(fn)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"profile: could not create memory profile %q: %v\", fn, err)\n\t\t}\n\t\told := runtime.MemProfileRate\n\t\truntime.MemProfileRate = prof.memProfileRate\n\t\tlogf(\"profile: memory profiling enabled (rate %d), %s\", runtime.MemProfileRate, fn)\n\t\tprof.closer = func() {\n\t\t\tpprof.Lookup(\"heap\").WriteTo(f, 0)\n\t\t\tf.Close()\n\t\t\truntime.MemProfileRate = old\n\t\t\tlogf(\"profile: memory profiling disabled, %s\", fn)\n\t\t}\n\n\tcase mutexMode:\n\t\tfn := filepath.Join(path, \"mutex.pprof\")\n\t\tf, err := os.Create(fn)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"profile: could not create mutex profile %q: %v\", fn, err)\n\t\t}\n\t\tenableMutexProfile()\n\t\tlogf(\"profile: mutex profiling enabled, %s\", fn)\n\t\tprof.closer = func() {\n\t\t\tif mp := pprof.Lookup(\"mutex\"); mp != nil {\n\t\t\t\tmp.WriteTo(f, 0)\n\t\t\t}\n\t\t\tf.Close()\n\t\t\tdisableMutexProfile()\n\t\t\tlogf(\"profile: mutex profiling disabled, %s\", fn)\n\t\t}\n\n\tcase blockMode:\n\t\tfn := filepath.Join(path, \"block.pprof\")\n\t\tf, err := os.Create(fn)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"profile: could not create block profile %q: %v\", fn, err)\n\t\t}\n\t\truntime.SetBlockProfileRate(1)\n\t\tlogf(\"profile: block profiling enabled, %s\", fn)\n\t\tprof.closer = func() {\n\t\t\tpprof.Lookup(\"block\").WriteTo(f, 0)\n\t\t\tf.Close()\n\t\t\truntime.SetBlockProfileRate(0)\n\t\t\tlogf(\"profile: block profiling disabled, %s\", fn)\n\t\t}\n\n\tcase threadCreateMode:\n\t\tfn := filepath.Join(path, \"threadcreation.pprof\")\n\t\tf, err := os.Create(fn)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"profile: could not create thread creation profile %q: %v\", fn, err)\n\t\t}\n\t\tlogf(\"profile: thread creation profiling enabled, %s\", fn)\n\t\tprof.closer = func() {\n\t\t\tif mp := pprof.Lookup(\"threadcreate\"); mp != nil {\n\t\t\t\tmp.WriteTo(f, 0)\n\t\t\t}\n\t\t\tf.Close()\n\t\t\tlogf(\"profile: thread creation profiling disabled, %s\", fn)\n\t\t}\n\n\tcase traceMode:\n\t\tfn := filepath.Join(path, \"trace.out\")\n\t\tf, err := os.Create(fn)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"profile: could not create trace output file %q: %v\", fn, err)\n\t\t}\n\t\tif err := startTrace(f); err != nil {\n\t\t\tlog.Fatalf(\"profile: could not start trace: %v\", err)\n\t\t}\n\t\tlogf(\"profile: trace enabled, %s\", fn)\n\t\tprof.closer = func() {\n\t\t\tstopTrace()\n\t\t\tlogf(\"profile: trace disabled, %s\", fn)\n\t\t}\n\t}\n\n\tif !prof.noShutdownHook {\n\t\tgo func() {\n\t\t\tc := make(chan os.Signal, 1)\n\t\t\tsignal.Notify(c, os.Interrupt)\n\t\t\t<-c\n\n\t\t\tlog.Println(\"profile: caught interrupt, stopping profiles\")\n\t\t\tprof.Stop()\n\n\t\t\tos.Exit(0)\n\t\t}()\n\t}\n\n\treturn &prof\n}", "title": "" }, { "docid": "5fe029de7331991d42aface373c8bac9", "score": "0.429661", "text": "func Convert_aws_InstanceMetadataOptions_To_v1alpha1_InstanceMetadataOptions(in *aws.InstanceMetadataOptions, out *InstanceMetadataOptions, s conversion.Scope) error {\n\treturn autoConvert_aws_InstanceMetadataOptions_To_v1alpha1_InstanceMetadataOptions(in, out, s)\n}", "title": "" }, { "docid": "ae9ceb17b7b01eeddc531acd488c08bf", "score": "0.42950898", "text": "func (_options *CreateLoadBalancerOptions) SetProfile(profile LoadBalancerProfileIdentityIntf) *CreateLoadBalancerOptions {\n\t_options.Profile = profile\n\treturn _options\n}", "title": "" }, { "docid": "c1bfb23e768261dd9f15d2f0f4505b54", "score": "0.4292914", "text": "func (a AutoscaleProfile) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"capacity\", a.Capacity)\n\tpopulate(objectMap, \"fixedDate\", a.FixedDate)\n\tpopulate(objectMap, \"name\", a.Name)\n\tpopulate(objectMap, \"recurrence\", a.Recurrence)\n\tpopulate(objectMap, \"rules\", a.Rules)\n\treturn json.Marshal(objectMap)\n}", "title": "" } ]
028933ca3234bbf6c09b3e300a1be1d1
close closes the connection.
[ { "docid": "d20a9667e67f2aa9ff076bb97e966894", "score": "0.6790891", "text": "func (f *Fluent) close() (err error) {\n\tif f.conn != nil {\n\t\tf.mu.Lock()\n\t\tdefer f.mu.Unlock()\n\t} else {\n\t\treturn\n\t}\n\tif f.conn != nil {\n\t\tf.conn.Close()\n\t\tf.conn = nil\n\t}\n\treturn\n}", "title": "" } ]
[ { "docid": "58d53c77eb7ba530a1ec1936f655e4ce", "score": "0.7560687", "text": "func (c *command) close() error {\n return c.conn.Close()\n}", "title": "" }, { "docid": "8e16281ba78cae4311ffc7c33d41bbaf", "score": "0.7421217", "text": "func (c *connection) Close() error { return c.conn.Close() }", "title": "" }, { "docid": "7df4aeb52ce9a252b55b2d5980d6447a", "score": "0.72611696", "text": "func (conn *Connection) close() {\n\t// Remove from link manager\n\tif conn.lm != nil {\n\t\tif conn.control {\n\t\t\tconn.lm.InvalidateControl(conn)\n\t\t} else {\n\t\t\tconn.lm.RemoveDataLink(conn)\n\t\t}\n\t}\n\n\t// Putting close in mutex can prevent resouces used by ongoing transactions being released.\n\tconn.mu.Lock()\n\tdefer conn.mu.Unlock()\n\n\t// Call signal function to avoid duplicated close.\n\tconn.CloseAndWait()\n\n\t// Clear pending requests after TCP connection closed, so current request got chance to return first.\n\tconn.ClearResponses()\n\n\tvar w, r interface{}\n\tconn.w, w = nil, conn.w\n\tconn.r, r = nil, conn.r\n\t// Ensure peeking get unblocked.\n\tconn.peeking.Wait()\n\treaderPool.Put(r)\n\twriterPool.Put(w)\n\tconn.lm = nil\n\t// Don't reset instance to nil, we may need it to resend request.\n\n\tatomic.CompareAndSwapUint32(&conn.closed, ConnectionClosing, ConnectionClosed)\n\tconn.log.Debug(\"Closed.\")\n}", "title": "" }, { "docid": "481573b874d7b333d35517ab74c506f2", "score": "0.71284103", "text": "func (n *localConn) close() error {\n\treturn n.conn.Close()\n}", "title": "" }, { "docid": "ca1c54364cdd7281713ea2c2f9f51362", "score": "0.70677096", "text": "func (cc *ClientConn) Close() error {}", "title": "" }, { "docid": "42e37b87874eb1511dee10893ef0ac0a", "score": "0.67654324", "text": "func (c *Client) Close() {}", "title": "" }, { "docid": "67845345ebae290f8fe4c860b24bbb06", "score": "0.665661", "text": "func (c *FakeConn) Close() error { return nil }", "title": "" }, { "docid": "e6f3b5b1ea8f9cb2baca199b5fb8f2d2", "score": "0.65990776", "text": "func (sc *ServerConn) Close() error {}", "title": "" }, { "docid": "82303b0a17496b34515165c457a8cb5d", "score": "0.65823907", "text": "func (p *NotifyProxy) close() error {\n\tdefer os.Remove(p.socketPath)\n\treturn p.connection.Close()\n}", "title": "" }, { "docid": "754746bf259c5f464759dd4be95258c4", "score": "0.656804", "text": "func (s *socket) close() {\n\ts.connection.WriteControl(websocket.CloseMessage, websocket.FormatCloseMessage(websocket.CloseNormalClosure, \"\"), time.Time{})\n\ts.connection.Close()\n}", "title": "" }, { "docid": "3d53c256b13077e10adae233f4e310c7", "score": "0.652536", "text": "func (c *Client) Close() error { return c.rwc.Close() }", "title": "" }, { "docid": "69a567b9a1f4f33a672d11d3d0351dd0", "score": "0.6516609", "text": "func (c *conn) Close() error {\n\treturn errUnimplemented\n}", "title": "" }, { "docid": "c909296a12886736ea961e337112128e", "score": "0.6509619", "text": "func (d *Client) Close() {\n if d.connection == nil { return }\n d.connection.Close()\n}", "title": "" }, { "docid": "db152ad0ada0ef340881ff94228b0850", "score": "0.6493995", "text": "func TCPConnClose(c *net.TCPConn,) error", "title": "" }, { "docid": "bc40bc0b9fc10d9f899ff3b163e727e3", "score": "0.6482027", "text": "func (conn *Connection) Close() error {\n\treturn nil\n}", "title": "" }, { "docid": "920e1c2aeb32f86367bcf23d6479115f", "score": "0.647393", "text": "func (c *connection) Close() error {\n\tc.session.closeConnection(c.connID, io.EOF)\n\treturn nil\n}", "title": "" }, { "docid": "9811f3c5b895c39715cc128afe0a0f74", "score": "0.646708", "text": "func Close() error {\n\treturn conn.Close()\n}", "title": "" }, { "docid": "c7c1f7de74da3c2bb9346fc3fbe20d25", "score": "0.6461305", "text": "func (*arangoConn) Close() (err error) { return }", "title": "" }, { "docid": "e55da2de2718329071fd7997a101921e", "score": "0.6452007", "text": "func (c *connection) Close() error {\n\t// don't shutdown the connection, we'll internally handle it\n\treturn nil\n}", "title": "" }, { "docid": "7c6ec383b7ddae57c55ef86344246b2c", "score": "0.6424242", "text": "func (c *conn) Close() error {\n\treturn c.s.Close()\n}", "title": "" }, { "docid": "ff3f6abfa47da9a77c1ae1df843ba714", "score": "0.63989466", "text": "func (t *httpServerConn) Close() error { return nil }", "title": "" }, { "docid": "d7eae6b3edfb983eed9af9f4d39a216e", "score": "0.6391299", "text": "func (c *Connection) Close() {\n\tc.plainconn.Close()\n}", "title": "" }, { "docid": "f47b35d6bdd123871aded0e0bb84bc8e", "score": "0.6390266", "text": "func IPConnClose(c *net.IPConn,) error", "title": "" }, { "docid": "699c2742bc9e317bee49df3fbe28af4e", "score": "0.63810587", "text": "func (r *RemoteHTTPBase) Close() error { return nil }", "title": "" }, { "docid": "a6c27a31f23e9792e8485a65c7148e42", "score": "0.63643533", "text": "func (client *ClientConn) close() error {\n\tif client.inUse <= 0 {\n\t\treturn client.ClientConn.Close()\n\t}\n\n\tgo client.closeWatch()\n\treturn nil\n}", "title": "" }, { "docid": "469f56d4fcc3dd94f6b097538c02a56f", "score": "0.6353198", "text": "func (r ResourceConn) Close() {\n\tr.Conn.Close()\n}", "title": "" }, { "docid": "92bfe7032ccf52e26c4bc00b157d6016", "score": "0.63181746", "text": "func (*BytesConn) Close() error {\n\treturn nil\n}", "title": "" }, { "docid": "4367a7ffcc45c5fea2ba969a13c9c40e", "score": "0.62862736", "text": "func (c ConnRWC) Close() error {\n\n\treturn c.connection.Close()\n\n}", "title": "" }, { "docid": "60fb70415049576c834c100ce71bb451", "score": "0.62790656", "text": "func (u *UdpConnObject) close(line string, args ...Object) Object {\n\treturn u.Close(line, args...)\n}", "title": "" }, { "docid": "be59b72cf25b3905b188dbf08b1e0d72", "score": "0.6271876", "text": "func (c *Client)Close() error {\n\terr := c.conn.Close()\n\tc.conn = nil\n\treturn err\n}", "title": "" }, { "docid": "7e1f5283d703200f45a77825363b1b0a", "score": "0.62648267", "text": "func (s *Node) close(c *gnet.Conn) {\n\ts.deleteConnFromFeeds(c)\n\ts.deleteConnFromPending(c)\n\tc.Close()\n}", "title": "" }, { "docid": "7e1f5283d703200f45a77825363b1b0a", "score": "0.62648267", "text": "func (s *Node) close(c *gnet.Conn) {\n\ts.deleteConnFromFeeds(c)\n\ts.deleteConnFromPending(c)\n\tc.Close()\n}", "title": "" }, { "docid": "924221512ff628e82284e1cfd68322d3", "score": "0.6264104", "text": "func (s *server) closeConn(tcpConn net.Conn, protocol HttpProtocol, status HttpStatus) {\n defer tcpConn.Close()\n response := NewCloseResponse(protocol, status)\n tcpConn.Write(response.ToBytes())\n}", "title": "" }, { "docid": "d687ac4cf0d9460a71c82a7a403823f2", "score": "0.62614316", "text": "func (q *NATS) Close() {\n\tq.conn.Close()\n}", "title": "" }, { "docid": "8dc8ecbe0c4776f1e9675d4c531eeeb2", "score": "0.6253601", "text": "func (c *Conn) Close() error {\n\treturn c.protocol.Close()\n}", "title": "" }, { "docid": "4fc9368e67c420db818f5a6f430ac073", "score": "0.6251", "text": "func (c *Conn) Close() error {\n\treturn kerrors.NewAggregate([]error{c.stream.Close(), c.connection.Close()})\n}", "title": "" }, { "docid": "3aceeb853ab8a4964ad8560a5e2b2452", "score": "0.62505347", "text": "func (conn Connection) Close() error {\n\treturn syscall.Close(conn.fd)\n}", "title": "" }, { "docid": "a317fe4c356883aad1eaa7256eed1477", "score": "0.6242574", "text": "func (c *Connection) Close() {\n\tc.conn.Close()\n}", "title": "" }, { "docid": "9399901e6475024e6e02cdcef209ff6a", "score": "0.62373024", "text": "func (w *response) Close() error {\n\treturn w.conn.rwc.Close()\n}", "title": "" }, { "docid": "637853a955355c0406917de08740a8cb", "score": "0.6235046", "text": "func (conn *Conn) Close() {\n\tconn.session.Close()\n\t//conn.closed = true\n}", "title": "" }, { "docid": "117c952e4673ba8043a008669e86b0bb", "score": "0.6230342", "text": "func (p *pool) close() error {\n\tp.mu.Lock()\n\tdefer p.mu.Unlock()\n\tif !p.active {\n\t\treturn failure.New(\"connection pool closed\")\n\t}\n\tp.active = false\n\tvar err error\n\tfor resp := range p.available {\n\t\tcerr := resp.close()\n\t\tif err == nil {\n\t\t\terr = cerr\n\t\t}\n\t}\n\tp.available = nil\n\treturn err\n}", "title": "" }, { "docid": "9b2baffcedda0292f3dadd7ed75a856d", "score": "0.6227267", "text": "func (c *Connector) Close() {\n\tc.conn.Close()\n\tclose(c.die)\n}", "title": "" }, { "docid": "8dd6aecdd38cdeec8d5cc99696368417", "score": "0.6215692", "text": "func (c *client) Close() error {\n\treturn c.conn.Close()\n}", "title": "" }, { "docid": "4f522041beea0da54895229a85874f62", "score": "0.6206116", "text": "func (c *Connection) Close() error {\n\treturn c.Connection.Close()\n}", "title": "" }, { "docid": "33a85a9362e057453c74db64e378ebe5", "score": "0.6203369", "text": "func (c *conn) Close() error {\n\n\tif c.connectionId == \"\" {\n\t\treturn driver.ErrBadConn\n\t}\n\n\t_, err := c.httpClient.post(context.Background(), &message.CloseConnectionRequest{\n\t\tConnectionId: c.connectionId,\n\t})\n\n\tc.connectionId = \"\"\n\n\tif err != nil {\n\t\treturn c.avaticaErrorToResponseErrorOrError(err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7746248d52e565ca19adecbb03f034b1", "score": "0.6200134", "text": "func (conn *Connection) Close() error {\n if conn.a != nil {\n if err := conn.a.Close(); err != nil {\n return err\n }\n }\n if conn.c != nil {\n if err := conn.c.Close(); err != nil {\n return err\n }\n }\n e := C.hb_connection_destroy(conn.hb)\n if e != 0 {\n return Errno(e)\n }\n return nil\n}", "title": "" }, { "docid": "66aa80dd3cc0882c4b55e90eddb2eae2", "score": "0.61974317", "text": "func (c *Conn) Close() error {\n\treturn fmt.Errorf(\"not supported\")\n}", "title": "" }, { "docid": "e0dbad28f20c658873f7f4f346eb8b51", "score": "0.6193114", "text": "func (conn *connWrapper) Close() error {\n\treturn conn.readCloser.Close()\n}", "title": "" }, { "docid": "a292e5c83ab7ef850bb50c49e5553786", "score": "0.61459434", "text": "func (c conn) Close() error {\n\tif c.Closer == nil {\n\t\treturn nil\n\t}\n\treturn c.Closer.Close()\n}", "title": "" }, { "docid": "55f7bc31da993330b07bf9b7c9bb2bda", "score": "0.61392885", "text": "func (c *Connection) Close() error {\n\treturn c.conn.Close()\n}", "title": "" }, { "docid": "61a883bdb215ace1fee5c7a5f3a86539", "score": "0.6137887", "text": "func (c *connection) Close() {\n\tif c.stream != nil {\n\t\tc.stream.CloseSend()\n\t}\n\tif c.conn != nil {\n\t\tc.conn.Close()\n\t}\n\tc.conn = nil\n\tc.servClient = nil\n\tc.stream = nil\n}", "title": "" }, { "docid": "be09f2d3277606467c1d78e4466866c9", "score": "0.61176646", "text": "func (c *Connection) Close() {\n\tc.open = false\n}", "title": "" }, { "docid": "d6abd4d9eb2544c4681bb9827c65c1e0", "score": "0.61073667", "text": "func (r *Resource) Close() {\n\tif err := r.Connection.Close(); err != nil {\n\t\txlog.Error(err.Error())\n\t}\n}", "title": "" }, { "docid": "a8c96f1c9ae2b1d3927b2cb3d7dafb39", "score": "0.6080076", "text": "func (c *fakeConn) Close() error {\n\treturn nil\n}", "title": "" }, { "docid": "0cd8baa4596997a4d0f85a296a18b85e", "score": "0.60628176", "text": "func (conn *connection) Close() {\n\tif conn.Session != nil {\n\t\tconn.Session.Close()\n\t}\n}", "title": "" }, { "docid": "ebfc3a59d9a1d8a4a7639e58075ab33f", "score": "0.6062642", "text": "func (u *UnixConnObject) close(line string, args ...Object) Object {\n\treturn u.Close(line, args...)\n}", "title": "" }, { "docid": "a0ca6a2c50b2eab27979f0d57f8b65a9", "score": "0.60574657", "text": "func (c *MockConnection) Close() error {\n\treturn nil\n}", "title": "" }, { "docid": "3b11e62cc5f451415f8f32509fe1dcb3", "score": "0.6057367", "text": "func (r *RPCMethod) Close() {\n\tr.conn.Close()\n}", "title": "" }, { "docid": "3af66e9add01b5703d90aca708f0c0a0", "score": "0.6055298", "text": "func (c *BestEffortConn) Close() error {\n\tc.Lock()\n\tdefer c.Unlock()\n\tc.hostport = \"\"\n\tif c.conn != nil {\n\t\tc.conn.Close()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9d71be7be667c82a2d043beb1a56ba1f", "score": "0.6053", "text": "func (c *connection) Close() (err error) {\n\tif c.conn != nil {\n\t\terr = c.conn.Close()\n\t\tc.conn = nil\n\t}\n\tc.cursors = nil\n\tc.cursor = nil\n\tc.responseCount = 0\n\tc.responseLen = 0\n\tc.err = errors.New(\"mongo: connection closed\")\n\treturn err\n}", "title": "" }, { "docid": "856eb39e5530bd26505a6743bcb5bd42", "score": "0.6047624", "text": "func (p *Conn) Close() error {\n\treturn p.conn.Close()\n}", "title": "" }, { "docid": "37ce8ca084e5cded71e4e0d0e0ec1823", "score": "0.60438937", "text": "func (c *Client) close() {\n\tif c.Error == nil && c.over != nil {\n\t\tif c.used {\n\t\t\tc.over.closeClient(c)\n\t\t}\n\t} else {\n\t\tc.over.clientTemp.Put(c)\n\t}\n}", "title": "" }, { "docid": "8808212220fab6bc379761f66e7f039e", "score": "0.6040404", "text": "func (c *Conn) Close() {\n\tc.conn.Close()\n}", "title": "" }, { "docid": "8808212220fab6bc379761f66e7f039e", "score": "0.6040404", "text": "func (c *Conn) Close() {\n\tc.conn.Close()\n}", "title": "" }, { "docid": "05f48b7ec11eda82873bac36bbfb251b", "score": "0.6031563", "text": "func closeConnection(c net.Conn) {\n\tif nil != c {\n\t\tc.Close()\n\t}\n}", "title": "" }, { "docid": "8b653a3b04b52defd5d054c13bc06a13", "score": "0.60204303", "text": "func (p *pool) close(c *connection) error {\r\n\tif c.pool != p {\r\n\t\treturn ErrWrongPool\r\n\t}\r\n\tp.Lock()\r\n\tdelete(p.opened, c.poolID)\r\n\tp.Unlock()\r\n\tif c.nc == nil {\r\n\t\treturn nil // We're closing an already closed connection.\r\n\t}\r\n\terr := c.nc.Close()\r\n\tc.nc = nil\r\n\tif err != nil {\r\n\t\treturn ConnectionError{ConnectionID: c.id, Wrapped: err, message: \"failed to close net.Conn\"}\r\n\t}\r\n\treturn nil\r\n}", "title": "" }, { "docid": "a52a6ed9312dd55469f4b109ea7f9c34", "score": "0.60201687", "text": "func (connection *Connection) Close() {\n\tif !connection.use_fake {\n\t\tconnection.conn.Close()\n\t}\n}", "title": "" }, { "docid": "304555631190810751f934a60f37aec1", "score": "0.60183525", "text": "func (t *TcpConnObject) close(line string, args ...Object) Object {\n\treturn t.Close(line, args...)\n}", "title": "" }, { "docid": "1fa98164231217b91f9b97785b3ac927", "score": "0.601801", "text": "func (s *Conn) Close() error {\n\ts.conn.Close(true, transport.NoError, \"bye\")\n\treturn nil\n}", "title": "" }, { "docid": "68accb62dc1febdda3e3acdb5cf6a0fc", "score": "0.60112125", "text": "func (c *Connection) Close() {\n\tc.onClose <- nil\n}", "title": "" }, { "docid": "23262e7da29008ea051e1543a5996256", "score": "0.60007036", "text": "func (c *Client) shutdown(ctx context.Context) error {\n\tif err := c.conn.Shutdown(ctx); err != nil {\n\t\tc.conn.Close()\n\t\treturn errors.Wrap(err, \"connection shutdown failed\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "636938e2893be2d75a438d78b5ba666a", "score": "0.5992536", "text": "func (s *secureConnection) Close() error {\n\treturn s.conn.Close()\n}", "title": "" }, { "docid": "1c6a3e7ac383a4b3a86f157d362975a4", "score": "0.59906507", "text": "func (c *Client) Close() (err error) {\n\terr = (*(c.Connection)).Close()\n\treturn\n}", "title": "" }, { "docid": "aefcf1dbce1cbc16b73078144e57c13f", "score": "0.5989968", "text": "func (s *server) close() error {\n\treturn s.server.Close()\n}", "title": "" }, { "docid": "18d2e95861d3ad4598ff952a885bf531", "score": "0.5987966", "text": "func (c *connection) Close() error {\n\tc.mu.Lock()\n\tif c.stopErr == nil {\n\t\tc.stopErr = ErrClosed\n\t\tclose(c.stop)\n\t}\n\tc.mu.Unlock()\n\treturn c.rw.Close()\n}", "title": "" }, { "docid": "5e13ba3a20849f7c70a61306134aaf63", "score": "0.5985019", "text": "func (c *Client) Close() {\n\tc.conn.Close()\n}", "title": "" }, { "docid": "5e13ba3a20849f7c70a61306134aaf63", "score": "0.5985019", "text": "func (c *Client) Close() {\n\tc.conn.Close()\n}", "title": "" }, { "docid": "9f69bfb46add6045e745a2f4a3ad4250", "score": "0.5975165", "text": "func (t *GarlicTCPConn) Close() error {\n\t//return t.SAMConn.Close()\n\treturn nil\n}", "title": "" }, { "docid": "55907a24129e8f3d2a11d80248d077c3", "score": "0.5970909", "text": "func (s *OutClientImpl) Close() {\n\ts.connection.Close()\n}", "title": "" }, { "docid": "e86847833fdb67e08926ebcebf4d57d0", "score": "0.5964864", "text": "func (c FakeConn) Close() error {\n\treturn nil\n}", "title": "" }, { "docid": "885dbccf096d15700d8295cb1dbf27bc", "score": "0.5962854", "text": "func (c *Conn) Close() error {\n\treturn c.p.Close()\n}", "title": "" }, { "docid": "1b930678374d9cd00309339165126e7c", "score": "0.5961006", "text": "func (conn *TLSConnection) Close() error {\n\treturn conn.Conn.Close()\n}", "title": "" }, { "docid": "b8064066739e57c252be755ea22c5a23", "score": "0.5952514", "text": "func (k *Client) Close() {\n\tk.connection.Close()\n}", "title": "" }, { "docid": "9e1bc135d2dd1e338a108a6300d070e8", "score": "0.594816", "text": "func (p *pool) close() error {\n\tp.mux.Lock()\n\tdefer p.mux.Unlock()\n\tfor conn := range p.available {\n\t\tif err := conn.close(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tfor conn := range p.inUse {\n\t\tif err := conn.close(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "06e9b65182205a4d730af51ad8877879", "score": "0.5945007", "text": "func (g *Graphite) Close() error {\n\treturn g.conn.Close()\n}", "title": "" }, { "docid": "10df62221133ac97c0f546172e704e58", "score": "0.5943792", "text": "func (this *MySqlConnection) Close() error {\n\treturn nil\n}", "title": "" }, { "docid": "ad21853d5dc40a6b008bd3814d74b9a3", "score": "0.59384346", "text": "func (s *SingleConnectionMode) Close() error {\n\ts.closed = true\n\treturn s.conn.Close()\n}", "title": "" }, { "docid": "ecc96319dc8e29dde27b05ef1dae8902", "score": "0.59382254", "text": "func (c *Conn) Close() error {\n\treturn c.close()\n}", "title": "" }, { "docid": "b6f79448db50fa377f4e4f5f00ea9656", "score": "0.5934587", "text": "func (p *peer) close() {\n\t// If the connection is closing, we can immediately cancel the ticker\n\t// goroutines.\n\tclose(p.tickerCloser)\n\n\tp.closed.SetValue(true)\n\n\tif err := p.conn.Close(); err != nil {\n\t\tp.net.log.Debug(\"closing connection to %s%s at %s resulted in an error: %s\", constants.NodeIDPrefix, p.nodeID, p.getIP(), err)\n\t}\n\n\t// Remove this node from the throttler.\n\tp.net.inboundMsgThrottler.RemoveNode(p.nodeID)\n\n\tp.sendQueueCond.L.Lock()\n\t// Release the bytes of the unsent messages to the outbound message throttler\n\tfor i := 0; i < len(p.sendQueue); i++ {\n\t\tmsg := p.sendQueue[i]\n\t\tp.net.outboundMsgThrottler.Release(uint64(len(msg.Bytes())), p.nodeID)\n\t\tmsg.DecRef()\n\t}\n\tp.sendQueue = nil\n\tp.sendQueueCond.L.Unlock()\n\t// Per [p.sendQueueCond]'s spec, it is signalled when [p.closed] is set to true\n\t// so that we exit the WriteMessages goroutine.\n\t// Since [p.closed] is now true, nothing else will be put on [p.sendQueue]\n\tp.sendQueueCond.Signal()\n\tp.net.disconnected(p)\n}", "title": "" }, { "docid": "0f1cab65e56a95cf13d939a4624ef079", "score": "0.59340143", "text": "func (c *Manager) Close() error {\n\treturn c.conn.Close()\n}", "title": "" }, { "docid": "0ba7422d1436077f997d396cab90dd58", "score": "0.59338266", "text": "func (s *Session) Close() error {\n\treturn s.conn.Close()\n}", "title": "" }, { "docid": "9603447c2d650c42e52937ad02b38a97", "score": "0.5933743", "text": "func (s *Stream) close() error {\n\t// Add lock & close flag to prevent multi call.\n\t//s.syncMutex.Lock()\n\t//defer s.syncMutex.Unlock()\n\t//s.node.logger.Info(\"Closing stream.\")\n\n\tif s.stream != nil {\n\t\ts.node.netService.MessageEvent().Publish(common.EventDeleteP2PStream, s.pid.Pretty())\n\t}\n\n\t// cleanup.\n\ts.node.streamManager.RemoveStream(s)\n\n\t// quit.\n\ts.quitWriteCh <- true\n\n\t// close stream.\n\tif s.stream != nil {\n\t\tif err := s.stream.Close(); err != nil {\n\t\t\treturn ErrCloseStream\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a17203b256e6463542037eecc79ff1f1", "score": "0.59319377", "text": "func (c *MemoryConnection) Close() error {\n\tc.closer.Close()\n\tc.logger.Info(\"closed connection\")\n\treturn nil\n}", "title": "" }, { "docid": "c9f857d5e07a2c8e71d6d5939c882656", "score": "0.5930159", "text": "func (c *Conn) Close() error {\n\treturn c.agent.Close()\n}", "title": "" }, { "docid": "0d89ff62f7090e1a58bf8fd9dd3a32f5", "score": "0.592741", "text": "func (c *Conn) Close() error {\n\tfmt.Fprintf(c.Transcript, \"Server closing connection\\n\")\n\treturn c.Rwc.Close()\n}", "title": "" }, { "docid": "ef4ce0249d9cf8e3db732b45c792b797", "score": "0.59250164", "text": "func (this *MgoConn) Close() {\n\tsession.Close()\n}", "title": "" }, { "docid": "940867572adf18d7cbbae441a3bf531c", "score": "0.5921566", "text": "func (m *DriverClient) Close() {}", "title": "" }, { "docid": "bf75145e5dd9d633f36f09b447f5d6f3", "score": "0.5917144", "text": "func (c *SecureConn) Close() error {\n\treturn c.co.Close()\n}", "title": "" }, { "docid": "10404184245c2bb1138c516bd8dbc631", "score": "0.5913349", "text": "func (c *Conn) Close() error {\n\treturn c.conn.Close()\n}", "title": "" }, { "docid": "10404184245c2bb1138c516bd8dbc631", "score": "0.5913349", "text": "func (c *Conn) Close() error {\n\treturn c.conn.Close()\n}", "title": "" } ]
91fdf5acc291fe5b277849ca3b2ebdc9
PostSession Post a session in DB.
[ { "docid": "e17e8dcbe3367cddfdc313cb55faa097", "score": "0.82523805", "text": "func (impl *AuthDBImplement) PostSession(session *model.Session) *model.Session {\n\tc := commonDB.GetConnection()\n\te := new(entity.Session)\n\te.Load(session)\n\tc.Create(e)\n\treturn e.Model()\n}", "title": "" } ]
[ { "docid": "f92c1fc8264346a77bbb9db9df29fa40", "score": "0.76054734", "text": "func PostSessionUser(w http.ResponseWriter, r *http.Request, session *sessions.Session) {\n}", "title": "" }, { "docid": "fb8acb99aaab8ce8616107b573a2a899", "score": "0.68232375", "text": "func (restContext *RestContext) SendSessionPost(sessionId string, reqName string, names []string,\n\tvalues []string) (*http.Response, error) {\n\n\treturn restContext.SendSessionReq(sessionId, \"POST\", reqName, names, values, nil, nil)\n}", "title": "" }, { "docid": "d19b096fda9987af7f147855e3039fac", "score": "0.6375257", "text": "func saveSessionToDB(w http.ResponseWriter, ac AuthController, sess model.Session) bool {\n\tif _, err := ac.db.Collection(\"sessions\").InsertOne(context.TODO(), sess); err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "2820d975397dc7440aaf32d7d7b5f021", "score": "0.61279577", "text": "func (l *Forwarder) PostSessionChunk(namespace string, sid session.ID, reader io.Reader) error {\n\treturn trace.BadParameter(\"not implemented\")\n}", "title": "" }, { "docid": "60e0b7aa1dbb65c8fae8fbaae1457c85", "score": "0.61084014", "text": "func PostAppSessions(c *gin.Context) {\n\tvar appSessionContext models.AppSessionContext\n\tc.BindJSON(&appSessionContext)\n\n\treq := http_wrapper.NewRequest(c.Request, appSessionContext)\n\treq.Params[\"ReqURI\"] = c.Request.RequestURI\n\tchannelMsg := pcf_message.NewHttpChannelMessage(pcf_message.EventPostAppSessions, req)\n\n\tpcf_message.SendMessage(channelMsg)\n\trecvMsg := <-channelMsg.HttpChannel\n\n\tHTTPResponse := recvMsg.HTTPResponse\n\tif !zero.IsZero(HTTPResponse.Header[\"Location\"]) {\n\t\tvar appSessionId = HTTPResponse.Header[\"Location\"][0]\n\t\tc.Header(\"Location\", appSessionId)\n\t\tc.JSON(HTTPResponse.Status, HTTPResponse.Body)\n\t} else {\n\t\tc.JSON(HTTPResponse.Status, HTTPResponse.Body)\n\t}\n\n}", "title": "" }, { "docid": "6cca704fdf4dab627a7952b90207377d", "score": "0.59578747", "text": "func StoreSession(session *entity.Session) (*entity.Session, error){\n\touput,err:= json.MarshalIndent(session,\"\",\"\\t\\t\")\n\t\n\tclient := &http.Client{}\n\tURL := fmt.Sprintf(\"%s%s\",baseSessionURL,\"store\")\n\treq,_ := http.NewRequest(\"POST\",URL,bytes.NewBuffer(ouput) )\n\t//DO return an http responce\n\tres,err := client.Do(req)\n\t\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsess := &entity.Session{}\n\tbody, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = json.Unmarshal(body,sess)\n\tif err != nil{\n\t\treturn nil,err\n\t}\n\treturn sess,nil\n}", "title": "" }, { "docid": "d0eec2d6d15af63a8adf9b9236a9f7ca", "score": "0.58996135", "text": "func (session *Session) Post(path string, params Params) (Result, error) {\n\treturn session.Api(path, POST, params)\n}", "title": "" }, { "docid": "7540b8a5605f61dc0c56a81dbe370347", "score": "0.5885366", "text": "func (ms store) SaveSession(http.ResponseWriter, *http.Request, interface{}) error {\n\treturn ms.SaveError\n}", "title": "" }, { "docid": "88f3e1cebf16a0cc2ec5a84b3442bd71", "score": "0.5767543", "text": "func (s *Store) InsertSession(sess *Session) error {\n\treturn meddler.Insert(s.sqlDB, \"sessions\", sess)\n}", "title": "" }, { "docid": "a265730919328deff191a6d910808fe7", "score": "0.5756486", "text": "func SaveSession(userId interface{}, w http.ResponseWriter, r *http.Request) error {\n\tstore.Options.MaxAge = 60 * 60 * 24 * 2 // 2 days, MaxAge is in seconds\n\n\t//------------------------ session-key/name\n\tsession, _ := store.Get(r, \"user\")\n\t// Set some session values.\n\tsession.Values[\"id\"] = userId\n\t// Save it before we write to the response/return from the handler.\n\terr := session.Save(r, w)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "08bf11b170106f2ff4e3df414fdaee8e", "score": "0.57008827", "text": "func (sr *SessionRepo) StoreSession(session *models.Session) (*models.Session, error) {\n\tsess := session\n\terr := sr.conn.QueryRow(\"INSERT INTO session(uuid,expires,signingkey) VALUES($1, $2, $3) returning id\", session.UUID, session.Expires, session.SigningKey).Scan(&sess.ID)\n\n\tif err != nil{\n\t\treturn sess, err\n\t}\n\treturn sess, nil\n\n\n\n}", "title": "" }, { "docid": "d6b3f34591181d6158500a53f723904d", "score": "0.5699135", "text": "func (u *UserSessionsApp) PostRequest(writer http.ResponseWriter, r *http.Request) {\n\tvar (\n\t\tusername string\n\t\tuserExists bool\n\t\thasSession bool\n\t\terr error\n\t\tok bool\n\t\tv = mux.Vars(r)\n\t)\n\n\tif username, ok = v[\"username\"]; !ok {\n\t\tbadRequest(writer, \"Missing username in URL\")\n\t\treturn\n\t}\n\n\tif userExists, err = u.sessions.isUser(username); err != nil {\n\t\tbadRequest(writer, fmt.Sprintf(\"Error checking for username %s: %s\", username, err))\n\t\treturn\n\t}\n\n\tif !userExists {\n\t\tbadRequest(writer, fmt.Sprintf(\"User %s does not exist\", username))\n\t\treturn\n\t}\n\n\tif hasSession, err = u.sessions.hasSessions(username); err != nil {\n\t\terrored(writer, fmt.Sprintf(\"Error checking session for user %s: %s\", username, err))\n\t\treturn\n\t}\n\n\tvar checked map[string]interface{}\n\tbodyBuffer, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\terrored(writer, fmt.Sprintf(\"Error reading body: %s\", err))\n\t\treturn\n\t}\n\n\tif err = json.Unmarshal(bodyBuffer, &checked); err != nil {\n\t\terrored(writer, fmt.Sprintf(\"Error parsing request body: %s\", err))\n\t\treturn\n\t}\n\n\tbodyString := string(bodyBuffer)\n\tif !hasSession {\n\t\tif err = u.sessions.insertSession(username, bodyString); err != nil {\n\t\t\terrored(writer, fmt.Sprintf(\"Error inserting session for user %s: %s\", username, err))\n\t\t\treturn\n\t\t}\n\t} else {\n\t\tif err = u.sessions.updateSession(username, bodyString); err != nil {\n\t\t\terrored(writer, fmt.Sprintf(\"Error updating session for user %s: %s\", username, err))\n\t\t\treturn\n\t\t}\n\t}\n\n\tjsoned, err := u.getUserSessionForRequest(username, true)\n\tif err != nil {\n\t\terrored(writer, err.Error())\n\t\treturn\n\t}\n\n\twriter.Write(jsoned)\n}", "title": "" }, { "docid": "25cea82428848cbb9a0a8a5d79ea4a4a", "score": "0.56634444", "text": "func (s *SessionsDB) insertSession(username, session string) error {\n\tquery := `INSERT INTO user_sessions (user_id, session)\n VALUES ($1, $2)`\n\tuserID, err := queries.UserID(s.db, username)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = s.db.Exec(query, userID, session)\n\treturn err\n}", "title": "" }, { "docid": "865f1b5f17b3fddba36105eedc6bb329", "score": "0.56460327", "text": "func (instance *CstAccountSessionDAO) InsertSession(tx *sql.Tx, accountID int64, platform, deviceModel, deviceID, userAgent, ipAddress string) (int64, error) {\n\tvar id int64\n\terr := tx.QueryRow(`INSERT INTO tb_t_cst_account_session\n\t\t\t(account_id, platform, device_model, device_id, user_agent, ip_address)\n\t\t\tVALUES($1, $2, $3, $4, $5, $6) RETURNING id\n\t\t`, accountID, platform, deviceModel, deviceID, userAgent, ipAddress,\n\t).Scan(&id)\n\tif err != nil {\n\t\tlogger.Fatal(\"CstAccountSessionDAO\", logger.FromError(err))\n\t}\n\treturn id, err\n}", "title": "" }, { "docid": "77524f4d5db0688a3334c461dde029f5", "score": "0.562953", "text": "func InsertSession(sessionWriter service.WriterInterface, log *logging.Logger, userID string, tokenString string) {\n\tif sessionWriter == nil {\n\t\tlog.Fatal(\"sessionWriter nil\")\n\t}\n\tsessionWriter.Write(userID, tokenString)\n}", "title": "" }, { "docid": "88745816798709fe11e0b92a09b9ffcd", "score": "0.5608563", "text": "func PostLogout(c *gin.Context) {\n\tdb := initDb()\n\tdefer db.Close()\n\tvar post m.PostResponse\n\tsession := sessions.Default(c)\n\tvar loggedUser m.User\n\tc.Bind(&loggedUser)\n\tusername := loggedUser.Username\n\tpassword := loggedUser.Password\n\tuser := session.Get(username)\n\tif user == nil {\n\t\tpost.Code = 505\n\t\tpost.Message = \"User \" + loggedUser.Username + \" is not logged in.\"\n\t\tc.JSON(http.StatusBadRequest, post)\n\t} else {\n\t\tvar dbUser m.User\n\t\tdb.Where(\"username = ?\", username).Find(&dbUser)\n\t\tif password == dbUser.Password && username == c.GetHeader(\"X-Auth-Key\") {\n\t\t\tsession.Delete(user)\n\t\t\tsession.Save()\n\t\t\tpost.Code = 200\n\t\t\tpost.Message = \"User \" + loggedUser.Username + \" Logged Out Successfully.\"\n\t\t\tc.JSON(http.StatusOK, post)\n\t\t} else {\n\t\t\tpost.Code = 405\n\t\t\tpost.Message = \"Wrong Credentials. Logout Failed.\"\n\t\t\tc.JSON(http.StatusBadRequest, post)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "cb33491ebaf94b7884bc88ca38fa640b", "score": "0.55723286", "text": "func (user *User) CreateSession(w http.ResponseWriter) error {\n\tsid := make([]byte, 32)\n\tio.ReadFull(rand.Reader, sid)\n\tsession := Session{\n\t\tUUID: base64.URLEncoding.EncodeToString(sid),\n\t\tUserID: user.UserID,\n\t}\n\tcookie := &http.Cookie{\n\t\tName: \"session_id\",\n\t\tValue: session.UUID,\n\t\tPath: \"/\",\n\t}\n\thttp.SetCookie(w, cookie)\n\treturn db.Create(&session).Error\n}", "title": "" }, { "docid": "a0a6d1281ced67110345a6ed5b6168fe", "score": "0.5560419", "text": "func CreateSession(db *gorm.DB, user *models.User, browserInfo string) (*models.Session, *lib.FameError) {\n\tsession := &models.Session{}\n\n\t// Delete all sessions for that user that have expired\n\t/*err := db.Where(db.L(models.SessionT, \"UserID\").Eq(user.ID)).\n\t\tWhere(db.L(models.SessionT, \"UpdatedAt\").Lt(time.Now().Add(-models.SessionTimeout))).\n\t\tDelete(models.SessionT).Error\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Could not invalidate expired sessions: %+v\", err)\n\t}*/\n\n\tcnt := db.Where(db.L(models.SessionT, \"UserID\").Eq(user.ID)).\n\t\t//Where(db.L(models.SessionT, \"UpdatedAt\").Gt(time.Now().Add(-models.SessionTimeout))).\n\t\tFirst(session).RowsAffected\n\n\tif cnt == 1 { // return current session key\n\t\terr := db.Save(session).Error // renew the UpdatedAt field\n\t\tif err != nil {\n\t\t\treturn nil, lib.DataCorruptionError(\n\t\t\t\terr,\n\t\t\t)\n\t\t}\n\t\treturn session, nil\n\t}\n\n\tkey, err := generateSessionKey()\n\tif err != nil {\n\t\treturn nil, lib.InternalError(\n\t\t\tfmt.Errorf(\"Error creating secure session key! %s\", err),\n\t\t)\n\t}\n\n\tlog.Infof(\"SessionKey: %s\", key)\n\tsession = &models.Session{Key: key, User: user, BrowserInfo: browserInfo}\n\n\terr = db.Save(&session).Error\n\tif err != nil {\n\t\treturn nil, lib.DataCorruptionError(\n\t\t\terr,\n\t\t)\n\t}\n\n\treturn session, nil\n}", "title": "" }, { "docid": "69b079dc3c4528c55612ed90f6a6e047", "score": "0.55488515", "text": "func (p *ExtendablePersistenceLayer) SaveSession(id string, session *Session) error {\n\tif p.SaveSessionFunc != nil {\n\t\treturn p.SaveSessionFunc(id, session)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1157ceba035d11ba0af75a535971164e", "score": "0.55397654", "text": "func Post(data interface{}) error {\n\tLogger.Trace(constants.LogBeginFunc)\n\n\tSqliteInstance.AutoMigrate(data)\n\tLogger.Debug(\"Persisting new record : \", &data)\n\tresult := SqliteInstance.Create(data)\n\n\terr := result.Error\n\tif err != nil {\n\t\tLogger.Warn(err.Error(), err)\n\t\treturn result.Error\n\t}\n\n\tLogger.Trace(constants.LogFinishFunc)\n\treturn nil\n}", "title": "" }, { "docid": "c6ecf3fa9db78323fc5d742b167e95c1", "score": "0.5537015", "text": "func (c *Client) CreateSession(name, password string) (*PostSessionResponse, error) {\n\tu := \"_session\"\n\tcreds := Credentials{name, password}\n\tvar b bytes.Buffer\n\tif err := json.NewEncoder(&b).Encode(creds); err != nil {\n\t\treturn nil, err\n\t}\n\tres, err := c.Request(http.MethodPost, u, &b, \"application/json\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer res.Body.Close()\n\tsessionResponse := &PostSessionResponse{}\n\treturn sessionResponse, json.NewDecoder(res.Body).Decode(&sessionResponse)\n}", "title": "" }, { "docid": "eba26ed29d276fb0a9ef593c6d1a0c90", "score": "0.55190563", "text": "func (l *Forwarder) PostSessionSlice(slice SessionSlice) error {\n\t// setup slice sets slice verison, properly numerates\n\t// all chunks and\n\tchunksWithoutPrintEvents, err := l.setupSlice(&slice)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\n\t// log all events and session recording locally\n\terr = l.sessionLogger.PostSessionSlice(slice)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\t// no chunks to post (all chunks are print events)\n\tif len(chunksWithoutPrintEvents) == 0 {\n\t\treturn nil\n\t}\n\tslice.Chunks = chunksWithoutPrintEvents\n\tslice.Version = V3\n\terr = l.ForwardTo.PostSessionSlice(slice)\n\treturn err\n}", "title": "" }, { "docid": "a83dc7ed0a4dc9ed27b9acef3a54a7f5", "score": "0.5513023", "text": "func CreateSession(w http.ResponseWriter, r *http.Request) {\n\t// read POST request body from client\n\treq, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tfmt.Fprintf(w, \"%v\", err)\n\t\treturn\n\t}\n\n\t// convert JSON data into a session struct\n\tvar session sessions.Session\n\terr = json.Unmarshal(req, &session)\n\tif err != nil {\n\t\tfmt.Fprintf(w, \"%v\", err)\n\t\treturn\n\t}\n\t// pass session struct to handler\n\terr = sessions.AddSession(session)\n\tif err != nil {\n\t\tfmt.Fprintf(w, \"%v\", err)\n\t\treturn\n\t}\n\t// send success message to client\n\t_, err = fmt.Fprint(w, \"successfully added session\")\n\tif err != nil {\n\t\tlogger.Error(err)\n\t\treturn\n\t}\n\t// display new session on console\n\tdisplay.PrintSession(session)\n}", "title": "" }, { "docid": "53b4de2340bf98e883a3e0a7b7f171dd", "score": "0.5499866", "text": "func (sdb *SQLiteNewtonDB) CreateSession(session *Session) (int64, error) {\n\tconst insertSQL = `INSERT INTO sessions (access_token, user_id, creation_date) VALUES (:access_token, :user_id, :creation_date)`\n\tresult, err := sqlx.NamedExec(sdb.db, insertSQL, session)\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\n\treturn result.LastInsertId()\n}", "title": "" }, { "docid": "0b0eee5881928f887b04f768e7470385", "score": "0.54899853", "text": "func (t *ticket) saveSession(s *sessions.SessionState, saver saveFunc) error {\n\tc, err := t.makeCipher()\n\tif err != nil {\n\t\treturn err\n\t}\n\tciphertext, err := s.EncodeSessionState(c, false)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to encode the session state with the ticket: %v\", err)\n\t}\n\treturn saver(t.id, ciphertext, t.options.Expire)\n}", "title": "" }, { "docid": "b74fea3c8e88be3e92dcaa789e7cd6a4", "score": "0.5473004", "text": "func TestDataBase_AddSession(t *testing.T) {\n\tmockRes := MockResult{}\n\n\tdb := new(mocks.DB)\n\tquery := new(ormmocks.Query)\n\n\tdb.On(\"Model\", &testSession).Return(query)\n\tquery.On(\"Insert\").Return(mockRes, nil)\n\n\trepository = &dataBase{DB: db}\n\n\terr := repository.AddSession(testSession.Id, uint64(testSession.UserId), testSession.User)\n\tassert.Nil(t, err)\n}", "title": "" }, { "docid": "d7f0924b4138d9e72a027ea356be3457", "score": "0.5460793", "text": "func CreateSessionHandler(rw http.ResponseWriter, req *http.Request) {\n\tif err := req.ParseForm(); err != nil {\n\t\trenderer.JSON(rw, http.StatusBadRequest, map[string]string{\n\t\t\t\"status\": requests.StatusFailed,\n\t\t\t\"error\": err.Error(),\n\t\t})\n\t\treturn\n\t}\n\n\tname := req.PostFormValue(\"name\")\n\tid := req.PostFormValue(\"id\")\n\temail := req.PostFormValue(\"stripeEmail\")\n\tif email == \"\" {\n\t\temail = req.PostFormValue(\"email\")\n\t}\n\n\tu := &schemas.Developer{\n\t\tName: name,\n\t\tEmail: email,\n\t\tExpiration: time.Now().Add(time.Hour * 24 * 30),\n\t\tID: bson.ObjectIdHex(id),\n\t}\n\n\t// Silent Signup from cli and not signup form. Will not charge them, but will give them a free month\n\tif err := db.Save(u); err != nil {\n\t\trenderer.JSON(rw, http.StatusBadRequest, map[string]string{\n\t\t\t\"status\": requests.StatusFailed,\n\t\t\t\"error\": err.Error(),\n\t\t})\n\t\treturn\n\t}\n\n\trenderer.JSON(rw, http.StatusOK, map[string]interface{}{\n\t\t\"status\": requests.StatusCreated,\n\t\t\"developer\": u,\n\t})\n}", "title": "" }, { "docid": "bdc7ad3c7f729b4ddbdec325e3db1f7b", "score": "0.5446753", "text": "func addSession(username string, secret string) {\n\tdb := connDB()\n\n\tqueryStmt, err := db.Prepare(\"INSERT INTO sessions (user_id,secret) SELECT id, $1 FROM accounts WHERE username = $2\")\n\n\t//the database itself should error if the username already exists\n\t_, err = queryStmt.Exec(secret, username)\n\n\tif err == nil {\n\t\tlog.Println(\"Successfully created a new session!\")\n\t} else {\n\t\tSQLErrorHandling(err)\n\t}\n\n\tdb.Close()\n}", "title": "" }, { "docid": "1d4a6ddd2ddf863842c5756ae7c4660b", "score": "0.5440006", "text": "func (restContext *RestContext) SendSessionFilePost(sessionId string, reqName string, names []string,\n\tvalues []string, path string) (*http.Response, error) {\n\n\treturn restContext.SendFilePost(sessionId, reqName, names, values, path)\n}", "title": "" }, { "docid": "74482a1130cd1ab4582282cf0bf91627", "score": "0.5404051", "text": "func PostLogin(c *gin.Context) {\n\tdb := initDb()\n\tdefer db.Close()\n\tvar user m.User\n\tvar post m.PostResponse\n\tc.Bind(&user)\n\tusername := user.Username\n\tpassword := user.Password\n\tvar dbUser m.User\n\tdb.Where(\"username = ?\", username).Find(&dbUser)\n\tif dbUser.Username != \"\" {\n\t\terr := bcrypt.CompareHashAndPassword([]byte(dbUser.Password), []byte(password))\n\t\tif err == nil {\n\t\t\tsession := sessions.Default(c)\n\t\t\tsession.Set(dbUser.Username, dbUser.Username)\n\t\t\tsession.Save()\n\t\t\tc.JSON(http.StatusOK, dbUser)\n\t\t} else {\n\t\t\tpost.Code = 409\n\t\t\tpost.Message = \"Incorrect Login\"\n\t\t\tc.JSON(http.StatusBadRequest, post)\n\t\t}\n\t} else {\n\t\tpost.Code = 409\n\t\tpost.Message = \"Incorrect Login\"\n\t\tc.JSON(http.StatusBadRequest, post)\n\t}\n}", "title": "" }, { "docid": "d4a29c61544a8e572d35d76969625bd1", "score": "0.5402969", "text": "func (p *Provider) SaveSession(w http.ResponseWriter, se *Session) (err error) {\n\t//RemoveAll is better if you want to remove the session from store.\n\tif se.Id == \"\" {\n\t\tse.RemoveAll()\n\t\tp.DelCookie(w)\n\t\treturn nil\n\t}\n\n\tsm := se.Values.(*values.SafeMap)\n\tsm.LockGuard(func(data map[string]interface{}) {\n\t\t//remove from store if data is empty\n\t\tif len(data) == 0 {\n\t\t\t// Do not delete from LruMemCache, otherwise clients can\n\t\t\t// reuse id and token themselves.\n\t\t\t// m.lmc.Del(se.Id())\n\t\t\tp.DelCookie(w)\n\t\t\terr = p.store.Remove(w, se.Id)\n\t\t} else {\n\t\t\tp.SetCookie(w, se.Id)\n\t\t\terr = p.store.Save(w, se.Id, data)\n\t\t}\n\t})\n\treturn err\n}", "title": "" }, { "docid": "662b31736c8d5fa94cb4fd6e8d2bffa3", "score": "0.53883713", "text": "func NewPost(client DBClient, store *sessions.CookieStore, config utils.AppConfig) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tpostBody := r.FormValue(\"post-body\")\n\n\t\tsession, err := store.Get(r, config.SessionName)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\tblankUser := db.User{}\n\t\tuserCookie, ok := session.Values[config.UserCookieKey].(db.PublicUserData)\n\t\tif !ok {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\tblankUser.ID = userCookie.ID\n\t\tpost := db.NewPost(blankUser, postBody)\n\n\t\terr = client.SetPost(post)\n\t\tif err != nil {\n\t\t\tsession.AddFlash(\"Could not send post.\")\n\n\t\t\terr = session.Save(r, w)\n\t\t\tif err != nil {\n\t\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\thttp.Redirect(w, r, \"/index\", http.StatusFound)\n\t\t\treturn\n\t\t}\n\n\t\tsession.AddFlash(\"Your post has been sended.\")\n\t\terr = session.Save(r, w)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\thttp.Redirect(w, r, \"/index\", http.StatusFound)\n\t}\n}", "title": "" }, { "docid": "b762224c023cbc9cfd7e63c009ac8b26", "score": "0.5370882", "text": "func (c *AutheliaCtx) SaveSession(userSession session.UserSession) error {\n\treturn c.Providers.SessionProvider.SaveSession(c.RequestCtx, userSession)\n}", "title": "" }, { "docid": "3d8e1d4c71bce543db39f1dad2cb6d2d", "score": "0.5367153", "text": "func (service *Service) AddSession(clientSession *session.ClientSession, staffMember *entity.Staff, r *http.Request) error {\n\n\tserverSession := new(session.ServerSession)\n\tserverSession.SessionID = clientSession.SessionID\n\tserverSession.UserID = staffMember.ID\n\tserverSession.DeviceInfo = r.UserAgent()\n\tserverSession.IPAddress = r.Host\n\n\terr := service.sessionRepo.Create(serverSession)\n\tif err != nil {\n\t\treturn errors.New(\"unable to add new session\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8a492d299e6b07a7e3e8dbe7b03f6778", "score": "0.5349112", "text": "func (am *AuthManager) saveSession(sess *Session) error {\n\tkapi := registry.GetEtcdKeyAPI()\n\tttl := time.Duration(config.Auth.SessionTimeout) * time.Second\n\tsessBytes, err := json.Marshal(sess)\n\tsessStr := string(sessBytes)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = kapi.Set(context.Background(), sessionsLocation+sess.Id, sessStr,\n\t\t&etcd.SetOptions{TTL: ttl})\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5751fbe65b0305320778b59eb1218002", "score": "0.53268474", "text": "func (p *OAuthProxy) SaveSession(rw http.ResponseWriter, req *http.Request, s *sessionsapi.SessionState) error {\n\treturn p.sessionStore.Save(rw, req, s)\n}", "title": "" }, { "docid": "03883b8f471d241f0918f2fddfe8b067", "score": "0.53134197", "text": "func (user *User) CreateSession() (session Session, err error) {\n\t//statement := \"insert into sessions (uuid, email, user_id, created_at) values ($1, $2, $3, $4) returning id, uuid, email, user_id, created_at\"\n\tstatement := \"insert into sessions set uuid=?, email=?, user_id=?, created_at=?\" \t\t// for mysql\n\t//statement := \"insert into sessions(uuid, email, user_id, created_at) values ($, $, $, $)\" \t// for mysql\n\tfmt.Println(\"user.CreateSession()_#1\")\n\tstmt, err :=Db.Prepare(statement)\n\tif err !=nil {\n\t\tfmt.Println(\"CreateSession_ERR1 !!\")\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\tfmt.Println(\"user.CreateSession()_#2\")\n\tdefer stmt.Close()\n\tnewUuid := createUUID()\n\t//err=stmt.QueryRow(createUUID(), user.Email, user.Id, time.Now()).Scan(&session.Id, &session.Uuid, &session.Email, &session.UserId, &session.CreatedAt)\n\t_, err=stmt.Exec(newUuid, user.Email, user.Id, time.Now())\n\tfmt.Println(\"user.CreateSession()_#3\")\n\n\tif err !=nil {\n\t\tfmt.Println(\"CreateSession_ERR2 !!\")\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\tsession.Uuid=newUuid\n\tsession.UserId=user.Id\n\tsession.Email=user.Email\n\tsession.CreatedAt=time.Now()\n\tfmt.Println(\"user.CreateSession()_#3\")\n\n\treturn\n}", "title": "" }, { "docid": "77eafe3475959aa98a40d08ac39158e9", "score": "0.52900004", "text": "func postLogin (w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\n\tif r.Method == http.MethodPost {\n\t\te := r.FormValue(\"email\")\n\t\tp := r.FormValue(\"password\")\n\n\t\tu := User{}\n\n\t\tif e == \"\" || p == \"\" {\n\t\t\thttp.Error(w,\"400. Bad Request.\", http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\t//Does the user email exist in the database?\n\t\trow := config.Db.QueryRow(\"SELECT * FROM users WHERE email = $1\", e)\n\t\t// Whack the JSON into a string\n\t\terr := row.Scan(&u.Id, &u.Name, &u.Email, &u.Password)\n\n\t\t// does the entered password match the stored password?\n\t\terr = bcrypt.CompareHashAndPassword([]byte(u.Password), []byte(p))\n\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusForbidden)\n\t\t\treturn\n\t\t}\n\n\t\t// create session\n\n\t\ts, err := createSession(r, u.Id)\n\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusForbidden)\n\t\t\treturn\n\t\t}\n\n\t\tc := &http.Cookie{\n\t\t\tName: \"session\",\n\t\t\tValue: s.Id,\n\t\t}\n\t\thttp.SetCookie(w, c)\n\n\t\thttp.Redirect(w, r, \"/dashboard\", http.StatusSeeOther)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "585394aa79b9c61661ce83e5562aba8b", "score": "0.52588516", "text": "func (p *Persister) UpsertSession(ctx context.Context, s *session.Session) (err error) {\n\tctx, span := p.r.Tracer(ctx).Tracer().Start(ctx, \"persistence.sql.UpsertSession\")\n\tdefer otelx.End(span, &err)\n\n\ts.NID = p.NetworkID(ctx)\n\n\treturn errors.WithStack(p.Transaction(ctx, func(ctx context.Context, tx *pop.Connection) error {\n\t\texists := false\n\t\tif !s.ID.IsNil() {\n\t\t\tvar err error\n\t\t\texists, err = tx.Where(\"id = ? AND nid = ?\", s.ID, s.NID).Exists(new(session.Session))\n\t\t\tif err != nil {\n\t\t\t\treturn sqlcon.HandleError(err)\n\t\t\t}\n\t\t}\n\n\t\tif exists {\n\t\t\t// This must not be eager or identities will be created / updated\n\t\t\t// Only update session and not corresponding session device records\n\t\t\tif err := tx.Update(s); err != nil {\n\t\t\t\treturn sqlcon.HandleError(err)\n\t\t\t}\n\t\t\ttrace.SpanFromContext(ctx).AddEvent(events.NewSessionChanged(ctx, string(s.AuthenticatorAssuranceLevel), s.ID, s.IdentityID))\n\t\t\treturn nil\n\t\t}\n\n\t\t// This must not be eager or identities will be created / updated\n\t\tif err := sqlcon.HandleError(tx.Create(s)); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor i := range s.Devices {\n\t\t\tdevice := &(s.Devices[i])\n\t\t\tdevice.SessionID = s.ID\n\t\t\tdevice.NID = s.NID\n\n\t\t\tif device.Location != nil {\n\t\t\t\tdevice.Location = stringsx.GetPointer(stringsx.TruncateByteLen(*device.Location, SessionDeviceLocationMaxLength))\n\t\t\t}\n\t\t\tif device.UserAgent != nil {\n\t\t\t\tdevice.UserAgent = stringsx.GetPointer(stringsx.TruncateByteLen(*device.UserAgent, SessionDeviceUserAgentMaxLength))\n\t\t\t}\n\n\t\t\tif err := p.DevicePersister.CreateDevice(ctx, device); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\ttrace.SpanFromContext(ctx).AddEvent(events.NewSessionIssued(ctx, string(s.AuthenticatorAssuranceLevel), s.ID, s.IdentityID))\n\t\treturn nil\n\t}))\n}", "title": "" }, { "docid": "bf01303b0a40032c6e723f6832250e28", "score": "0.5256534", "text": "func (sessionrepo *SessionRepository) CreateSession(session *entity.Session) []error {\n\terrors := sessionrepo.db.Table(\"session\").Create(session).GetErrors()\n\treturn errors\n}", "title": "" }, { "docid": "add43cd033f7319fb4433c0020462472", "score": "0.5256239", "text": "func (s *Server) SaveToSession(w http.ResponseWriter, r *http.Request, key string, value interface{}) error {\n\tss, err := s.store.Get(r, s.cfg.SessionName)\n\tif err != nil {\n\t\ts.log.Println(err)\n\t}\n\tss.Values[key] = value\n\treturn ss.Save(r, w)\n}", "title": "" }, { "docid": "06fdb1e11dce72a6d3c32b92f5229b1d", "score": "0.5252639", "text": "func (admin *Admin) CreateSession() (session Session, err error) {\r\n\tstatement := \"insert into sessions (uuid, email, admin_id, created_at) values ($1, $2, $3, $4) returning id, uuid, email, admin_id, created_at\"\r\n\tstmt, err := Db.Prepare(statement)\r\n\tif err != nil {\r\n\t\treturn\r\n\t}\r\n\tdefer stmt.Close()\r\n\t// use QueryRow to return a row and scan the returned id into the Session struct\r\n\terr = stmt.QueryRow(CreateUUID(), admin.Email, admin.Id, time.Now()).Scan(&session.Id, &session.Uuid, &session.Email, &session.AdminId, &session.CreatedAt)\r\n\treturn\r\n}", "title": "" }, { "docid": "3789fb040049e58b9561a789d5ad45e7", "score": "0.52493054", "text": "func (u *User) CreateSession() (session Session, err error) {\n\n\tstmt := \"insert into sessions (uuid, email, user_id, created_at)\" +\n\t\t\" values($1,$2,$3,$4) returning id, uuid, email, user_id, created_at\"\n\n\tdbStmt, err := DB.Prepare(stmt)\n\n\tdefer dbStmt.Close()\n\n\tpanicErrs(err)\n\n\tdbStmt.QueryRow(createUUID(), u.Email, u.ID, time.Now()).Scan(&session.ID, &session.UUID, &session.Email, &session.UserID, &session.CreatedAt)\n\n\tfmt.Println(session)\n\treturn\n}", "title": "" }, { "docid": "c351984c2ff1e12b2dcb500618802046", "score": "0.5248096", "text": "func CreateSession(w http.ResponseWriter, u models.User) {\n\n\t// create session\n\tsID, _ := uuid.NewV4()\n\tc := &http.Cookie{\n\t\tName: \"session\",\n\t\tValue: sID.String(),\n\t}\n\n\trefreshCookie(w, c)\n\tstoredSessions[c.Value] = session{u.Username, time.Now()}\n\n}", "title": "" }, { "docid": "bbc90ef133ee8d2c1f11b9b772dc11e2", "score": "0.5206547", "text": "func (s *Server) CreateSession(ctx context.Context, in *pb.Session) (*pb.Session, error) {\n\ttoCreate := &models.Session{}\n\ttoCreate.ProtoUnMarshal(in)\n\n\t// Validate Fields\n\tif toCreate.UserId == 0 {\n\t\treturn nil, errors.New(\"can not create session without user_id set\")\n\t}\n\n\tif toCreate.Name == \"\" {\n\t\treturn nil, errors.New(\"can not create Session with empty name\")\n\t}\n\n\tif toCreate.Date < 0 {\n\t\treturn nil, errors.New(\"can not create Session with date value less than 0\")\n\t}\n\n\t// Dedupe by name and user id and date\n\tif existing, err := s.repo.GetSessionByUserIdAndNameAndDateAndDuration(toCreate.UserId, toCreate.Date, toCreate.Duration, toCreate.Name); err == nil && existing.ID != 0 {\n\t\treturn nil, errors.New(\"session with the same name, user_id, duration and date already exists\")\n\t}\n\n\t// Meeting ID is set and non-zero\n\tif toCreate.ZoomMeetingId != nil && *toCreate.ZoomMeetingId != 0 {\n\t\tif toCreate.ZoomOccurrenceId != \"\" {\n\t\t\tif existing, err := s.repo.GetSessionByUserIdAndZoomMeetingIdAndOccurrenceId(toCreate.UserId, *toCreate.ZoomMeetingId, toCreate.ZoomOccurrenceId); err == nil && existing.ID != 0 {\n\t\t\t\treturn nil, errors.New(\"session with the same user_id and zoom_meeting_id and occurrence id already exists\")\n\t\t\t}\n\t\t} else {\n\t\t\tif existing, err := s.repo.GetSessionByUserIdAndZoomMeetingId(toCreate.UserId, *toCreate.ZoomMeetingId); err == nil && existing.ID != 0 {\n\t\t\t\treturn nil, errors.New(\"session with the same user_id and zoom_meeting_id already exists\")\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// Validate supplied user exists\n\t_, err := s.GetUserById(ctx, &pb.Id{Id: toCreate.UserId})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// validate unix time\n\ttimeStr := strconv.Itoa(int(toCreate.Date))\n\t_, cErr := strconv.ParseInt(timeStr, 10, 64)\n\tif cErr != nil {\n\t\tlog.Println(\"Can not create Session without valid time stamp\")\n\t\treturn nil, cErr\n\t}\n\n\tif toCreate.Duration < 1 || toCreate.Duration > 10000 {\n\t\treturn nil, errors.New(\"session duration must be between 1 and 10,000\")\n\t}\n\n\t// Get unsplash if images are empty and created from webhook:\n\tshouldGetUnsplash := false\n\n\tif (toCreate.ProfileImgUrl == \"\" || toCreate.BannerImgUrl == \"\") &&\n\t\ttoCreate.Source == pb.Session_ZOOM_WEBHOOK.Enum().String() {\n\t\tshouldGetUnsplash = true\n\t}\n\tif shouldGetUnsplash {\n\t\tunsplashBytes, uErr := utils.GetUnsplashImages(toCreate.Name)\n\t\tif uErr != nil {\n\t\t\tlog.Println(\"Unable to get unsplash image response, error: \", uErr, \" ignoring error and will continue to save session\")\n\t\t}\n\t\tif toCreate.ProfileImgUrl == \"\" {\n\t\t\tif toCreate.ProfileImgUrl, err = utils.RandomImageFromUnsplashResponse(unsplashBytes); err != nil {\n\t\t\t\tlog.Println(\"Error parsing image for Profile from unsplash response: \", err)\n\t\t\t\ttoCreate.ProfileImgUrl = \"/Shared/via_banner_default.png\"\n\t\t\t}\n\t\t}\n\t\tif toCreate.BannerImgUrl == \"\" {\n\t\t\tif toCreate.BannerImgUrl, err = utils.RandomImageFromUnsplashResponse(unsplashBytes); err != nil {\n\t\t\t\tlog.Println(\"Error parsing image for Banner from unsplash response: \", err)\n\t\t\t\ttoCreate.ProfileImgUrl = \"/Shared/via_banner_default.png\"\n\t\t\t}\n\t\t}\n\t}\n\n\tu, crErr := s.repo.CreateSession(toCreate)\n\tif crErr != nil {\n\t\treturn nil, crErr\n\t}\n\n\tcreatedSession := u.ProtoMarshalPrivate()\n\t// decide if we need to create in zoom\n\tif !in.GetCreateMeetingInZoom() {\n\t\treturn createdSession, nil\n\t}\n\n\tzmToken, zmTokenErr := s.GetZoomTokenByUserId(ctx, &pb.Id{Id: createdSession.GetUserId()})\n\tif zmTokenErr != nil {\n\t\tlog.Println(\"CreateZoomMeeting is true but returned err retrieving zoom token\", zmTokenErr)\n\t\treturn createdSession, zmTokenErr\n\t}\n\n\tzm, zmErr := s.CreateMeetingInZoom(ctx, &pb.CreateMeetingInZoomRequest{\n\t\tFields: &pb.CreateZoomMeetingFields{\n\t\t\tTopic: u.Name,\n\t\t\tType: 2,\n\t\t\tStartTime: time.Unix(createdSession.GetStartTime(), 0).Format(time.RFC3339),\n\t\t\t// get first 10 characters of random due to zoom limit\n\t\t\tPassword: strconv.Itoa(seededRand.Int())[0:9],\n\t\t\tDuration: createdSession.GetDuration(),\n\t\t},\n\t\tAccessToken: zmToken.GetAccessToken(),\n\t})\n\tif zmErr != nil {\n\t\treturn nil, zmErr\n\t}\n\n\tupdateSessionWithZoom := &pb.Session{\n\t\tId: createdSession.GetId(),\n\t\tZoomMeetingId: &pb.OptionalInt64{Value: zm.GetId()},\n\t\tZoomMeetingJoinUrl: &pb.OptionalString{Value: zm.GetJoinUrl()},\n\t\tZoomMeetingStartUrl: &pb.OptionalString{Value: zm.GetStartUrl()},\n\t\tMeetingUrl: &pb.OptionalString{Value: zm.GetJoinUrl()},\n\t\tZoomSyncEnabled: &pb.OptionalBool{Value: true},\n\t\tZoomMeetingType: utils.ZoomMeetingTypeSingular,\n\t}\n\n\tupdate, updateErr := s.UpdateSession(ctx, updateSessionWithZoom)\n\tif updateErr != nil {\n\t\treturn nil, err\n\t}\n\treturn update, nil\n\n}", "title": "" }, { "docid": "b99afe1312db79ff1a58db321ea6ad4a", "score": "0.52049524", "text": "func (s *Session) Save(w http.ResponseWriter) error {\n\tst := s.store\n\n\tif s.MaxAgeSecs < 1 {\n\t\treturn qsErr{\"Save - MaxAgeSecs must be positive\", nil}\n\t}\n\n\tdbData, err := s.Data.Marshal()\n\tif err != nil {\n\t\treturn qsErr{\"Save - marshal failed\", err}\n\t}\n\terr = st.backEnd.Save(&s.sessID, dbData, s.userID, s.MaxAgeSecs, s.MinRefreshSecs)\n\tif err != nil {\n\t\treturn qsErr{\"Save - db write failed\", err}\n\t}\n\n\tswitch st.AuthType {\n\tcase CookieAuth:\n\t\tckData, err := s.encode()\n\t\tif err != nil {\n\t\t\treturn qsErr{\"Save - cookie encode failed\", err}\n\t\t}\n\t\thttp.SetCookie(w, s.newCookie(ckData))\n\tcase TokenAuth:\n\t\tif st.SendToken != nil {\n\t\t\ttokData, err := s.encode()\n\t\t\tif err != nil {\n\t\t\t\treturn qsErr{\"Save - token creation failed\", err}\n\t\t\t}\n\t\t\tif err := st.SendToken(tokData, s.MaxAgeSecs, w); err != nil {\n\t\t\t\treturn qsErr{\"Save - SendToken failed\", err}\n\t\t\t}\n\t\t}\n\t}\n\n\tif st.SessionSaved != nil {\n\t\tif err := st.SessionSaved(s.userID, time.Now()); err != nil {\n\t\t\treturn qsErr{\"Save - SessionSaved failed\", err}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "52bbf9cac1264d0f931eb6f3d6424b59", "score": "0.5196795", "text": "func (p *PostgresStore) CloseSession() {\n\tp.db.Close()\n}", "title": "" }, { "docid": "9007132870452ec32d5df5c7b9863d0a", "score": "0.5180392", "text": "func (db *DB) UpgradeSession(s *Session, u *User) error {\n\tif !s.Valid || s.Expires.Before(time.Now()) {\n\t\treturn errors.New(\"session invalid/expired\")\n\t}\n\n\ts.CSRFToken = Random(256)\n\ts.Valid = true\n\ts.Expires = time.Now().AddDate(1, 0, 0)\n\ts.UserID = u.ID\n\n\tif err := db.Save(s).Error; err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f5d9e5b6f9aca562307d27656ddf17d9", "score": "0.5178819", "text": "func (user *User) CreateSession() (session Session, err error) {\n\tsql, err := readSqlFile(\"data/sql/insert_session.sql\")\n\tif err != nil {\n\t\treturn\n\t}\n\tstatement := sql\n\tstmt, err := Db.Prepare(statement)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer stmt.Close()\n\terr = stmt.QueryRow(createUUID(), user.Email, user.Id, time.Now()).Scan(&session.Id, &session.Uuid, &session.Email, &session.UserId, &session.CreatedAt)\n\treturn\n}", "title": "" }, { "docid": "599bc20a0bf7ed980f142fa6ee633164", "score": "0.51700234", "text": "func (s *Store) Save(writer http.ResponseWriter, session sessions.Session) error {\n\tswitch s.AuthOptions.AuthMethod {\n\tcase AuthMethodCookie:\n\t\ts.saveCookie(writer, session)\n\tcase AuthMethodHeader:\n\t\twriter.Header().Set(s.AuthOptions.HeaderName, session.ID())\n\t}\n\n\tquery := fmt.Sprintf(queries[s.Dialect][querySave], s.TableName)\n\n\tencodedFlashes, err := json.Marshal(session.Flashes().GetAll())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tencodedValues, err := json.Marshal(session.Values().GetAll())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = s.DB.Exec(\n\t\tquery,\n\t\tencodedValues,\n\t\tsession.DateCreated(),\n\t\tencodedFlashes,\n\t\tsession.ID(),\n\t\tsession.Values().Get(KeyUserID),\n\t)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsession.SetIsStored(true)\n\treturn nil\n}", "title": "" }, { "docid": "5e451dfcc1a73ec865ed071b97e4f776", "score": "0.51586384", "text": "func (s *Service) AddSession(u *storage.Session) error {\n\tc := s.db.Collection(\"session\")\n\t_, err := c.InsertOne(context.Background(), u)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cannot create a session: %v\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e38757d1496555b2c644cf7608bcb07d", "score": "0.5144516", "text": "func (t *instance) SetSessionID(id string) { t.sessionID = id }", "title": "" }, { "docid": "e31d2c4920a707a3e18e8fe6d080b892", "score": "0.5132627", "text": "func (c *UnauthenticatedUserController) PostLogin(session *sessions.Session) mvc.Response {\n\tsession.Set(\"user_id\", 1)\n\n\t// Redirect (you can still use the Context.Redirect if you want so).\n\treturn mvc.Response{\n\t\tPath: \"/user\",\n\t\tCode: iris.StatusFound,\n\t}\n}", "title": "" }, { "docid": "9d6ea9cc607f681883a8e38834c42d26", "score": "0.5113041", "text": "func (u *Session) Save() error {\n\treturn DB.SaveSession(u)\n}", "title": "" }, { "docid": "d3e82d406ea0d7b1f240dc435e0a92ed", "score": "0.51120883", "text": "func serveCreateSession(w http.ResponseWriter, r *http.Request) error {\n\n\t// var s string\n\t// err := json.NewDecoder(r.Body).Decode(&s)\n\t// if err != nil {\n\t// \treturn err\n\t// }\n\n\tvar opt m.SessionCreateOpt\n\terr := json.NewDecoder(r.Body).Decode(&opt)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tstore, err := GetDatastore()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tres, err := store.Sessions.Create(opt)\n\tpp.Println(\"res:\", res)\n\tif res.Success {\n\t\tfmt.Printf(\"API created session. sessionID: %v\\n\", res.SessionID)\n\t\tw.WriteHeader(http.StatusCreated)\n\t} else {\n\t\tfmt.Printf(\"API failed to create session. sessionID: %v. Error: %v\\n\", res.SessionID, err)\n\t\tw.WriteHeader(http.StatusNotModified)\n\t}\n\te := writeJSON(w, res)\n\tfmt.Printf(\"Error in writeJSON: %v\\n\", e)\n\treturn e\n\n}", "title": "" }, { "docid": "34729989eaa9611210a71d5727372547", "score": "0.5110314", "text": "func (s *CookieStore) SaveSession(w http.ResponseWriter, req *http.Request, sessionState *SessionState) error {\n\tvalue, err := MarshalSession(sessionState, s.CookieCipher)\n\tif err != nil {\n\t\treturn err\n\t}\n\ts.setSessionCookie(w, req, value)\n\treturn nil\n}", "title": "" }, { "docid": "3bba4715f73065e3f2601244f97a7a09", "score": "0.509408", "text": "func (s *StorageRedis) SetSession(ctx context.Context, sessionId string, sessionData *gmap.StrAnyMap, ttl time.Duration) error {\n\tintlog.Printf(ctx, \"StorageRedis.SetSession: %s, %v, %v\", sessionId, sessionData, ttl)\n\tcontent, err := json.Marshal(sessionData)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = s.redis.Do(ctx, \"SETEX\", s.sessionIdToRedisKey(sessionId), int64(ttl.Seconds()), content)\n\treturn err\n}", "title": "" }, { "docid": "eb0d141cacb0c67faf2fe560c0bf8a39", "score": "0.5092822", "text": "func postToGuestBook(message string, from string, email string) (err error) {\n\tif from == \"error\" {\n\t\treturn errors.New(\"ok\")\n\t}\n\n\tdb, err := openDbConn()\n\tdefer db.Close()\n\n\t// Prepare statement for inserting data\n\tstmtIns, err := db.Prepare(\"INSERT INTO guest_book(guest_book.message, guest_book.from, guest_book.email, guest_book.posted) VALUES( ?, ?, ?, ? )\") // ? = placeholder\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer stmtIns.Close() // Close the statement when we leave main() / the program terminates\n\n\t_, err = stmtIns.Exec(message, from, email, time.Now())\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5ddfd99448193b7b590e0e2b0e3481ca", "score": "0.5089395", "text": "func (_BountyRegistry *BountyRegistrySession) PostAssertion(bountyGuid *big.Int, verdicts *big.Int, bid *big.Int, metadata string) (*types.Transaction, error) {\n\treturn _BountyRegistry.Contract.PostAssertion(&_BountyRegistry.TransactOpts, bountyGuid, verdicts, bid, metadata)\n}", "title": "" }, { "docid": "29b2e02a04c435530aca7b0ae22fff8e", "score": "0.50845605", "text": "func (k *PaymentGateway) CreateSession(req *PaymentOrder) (*PaymentOrderResponse, error) {\n\turi := k.createURL(sessionCreateURL)\n\n\tres, err := k.post(uri, req)\n\n\tif nil != err {\n\t\treturn nil, err\n\t}\n\n\tvar p PaymentOrderResponse\n\tif err := json.Unmarshal(res.Body, &p); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &p, nil\n}", "title": "" }, { "docid": "dccae9f9dce096aee923572519d702e7", "score": "0.50831497", "text": "func (m *MongoManager) createSession(signature string, requester fosite.Requester, collectionName string) error {\n\tdata, err := mongoCollectionFromRequest(signature, requester)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tc := m.DB.C(collectionName).With(m.DB.Session.Copy())\n\tdefer c.Database.Session.Close()\n\tif err := c.Insert(data); err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7214cc423af6ee0fd4c5557190d8edfa", "score": "0.5080187", "text": "func PostThread(w http.ResponseWriter, request *http.Request){\n\n\tsess,err := utils.CheckSession(w,request)\n\n\tif err != nil {\n\t\thttp.Redirect(w,request,\"/login\",http.StatusFound)\n\t}else{\n\t\terr = request.ParseForm()\n\n\t\tif err != nil {\n\t\t\tutils.Danger(\"can't parse form\",err)\n\t\t}\n\n\t\tuser,err := sess.User()\n\n\t\tfmt.Println(\"---- User from session for CreateThread ----->\",user)\n\n\t\tif err != nil {\n\t\t\tutils.Danger(\"can't get user from session\",err)\n\t\t}\n\n\t\tbody := request.PostFormValue(\"body\")\n\t\tuuid := request.PostFormValue(\"uuid\")\n\n\t\tthread, err := data.GetThreadByUUID(uuid)\n\n\t\tfmt.Println(\"---- post thread by id from thread_handler file ------->\",thread)\n\n\t\tif err != nil {\n\t\t\tutils.ErrorMessage(w,request,\"cannot read thread\")\n\t\t}\n\n\t\tif _,err := user.CreatePost(thread,body); err != nil {\n\t\t\tutils.Danger(\"can't create post\", err)\n\t\t}\n\n\t\turl := fmt.Sprint(\"/thread/read?id=\",uuid)\n\t\thttp.Redirect(w,request,url,http.StatusFound)\n\t}\n\n}", "title": "" }, { "docid": "724c3377f0ddd14c642c485eb88c2a1f", "score": "0.50780404", "text": "func CreateSession(conn db.Conn, user db.User, creationTime time.Time) (db.Session, error) {\n\tif len(user.Uuid) == 0 {\n\t\treturn db.Session{}, fmt.Errorf(\"nil user given to CreateSession\")\n\t}\n\n\tsession := db.Session{\n\t\tToken: uuid.New(),\n\t\tUser: user,\n\t\tHitTime: creationTime,\n\t}\n\n\terr := conn.InsertSession(session)\n\treturn session, err\n}", "title": "" }, { "docid": "d407fdf357cd83238fdcd14bea4dc910", "score": "0.50707036", "text": "func CreateSession(username string, password string) string {\n\tsessionKeyHash, err := bcrypt.GenerateFromPassword([]byte(username + settings.SESSIONPEPPER + password), bcrypt.DefaultCost)\n\tcheckErr(\"Bcrypt generate answer hash error in CreateSession()\", err)\n\n\tqueryInsert, errDbInsert := db.Prepare(\"INSERT INTO usersSession (username, sessionkey) VALUES (?, ?);\")\n\tcheckErr(\"Db error in CreateSession()\", errDbInsert)\n\n\t_, errDBInsertExec := queryInsert.Exec(username, string(sessionKeyHash))\n\tcheckErr(\"Db exec error in CreateSession()\", errDBInsertExec)\n\n\tqueryInsert.Close()\n\n\treturn string(sessionKeyHash)\n}", "title": "" }, { "docid": "50ed2295e2e6a80f6256698daeda6b77", "score": "0.50507134", "text": "func (res *SessionResource) Post(reader io.Reader) (ret resource.Document, err error) {\n\t// FIX? because the interface takes a reader,\n\t// we have to sit on the write lock for the duration of the read.\n\tdefer res.session.Unlock()\n\tres.session.Lock()\n\tif d, e := res.endpoint.Post(reader); e != nil {\n\t\terr = e\n\t} else {\n\t\tresource.NewDocumentBuilder(&d).SetMeta(frameKey, res.session.Frame())\n\t\tret = d\n\t}\n\treturn\n}", "title": "" }, { "docid": "70e617e8dc4d91fb543b3e9ae48a4077", "score": "0.504385", "text": "func (user *UserModel) createSession() (session *SessionModel, err error) {\n\tif session, err = user.userSession(); err == nil {\n\t\treturn\n\t}\n\tstatement := fmt.Sprintf(model.GetFormat(3),\n\t\t\"insert into sessions (uuid, user_id, created_at)\",\n\t\t\"values ($1, $2, $3)\",\n\t\t\"returning id, uuid, user_id, created_at\",\n\t)\n\tstmt, err := model.Db.Prepare(statement)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer stmt.Close()\n\tse := SessionModel{}\n\terr = stmt.QueryRow(common.CreateUUID(),\n\t\tuser.Id, time.Now(),\n\t).Scan(&se.Id, &se.Uuid, &se.UserId, &se.CreatedAt)\n\tsession = &se\n\treturn\n}", "title": "" }, { "docid": "ed5d0ae1a1765243f5e56ceb0d745647", "score": "0.5041141", "text": "func (instance *CstAccountSessionDAO) InsertSessionToken(tx *sql.Tx, sessionID int64, accessToken string, accessTokenExpiry int64, refreshToken string, refreshTokenExpiry int64) (int64, error) {\n\tvar id int64\n\terr := tx.QueryRow(`INSERT INTO tb_t_cst_account_session_token\n\t\t\t(session_id, access_token, access_token_expiry_time, refresh_token, refresh_token_expiry_time)\n\t\t\tVALUES ($1, $2, TO_TIMESTAMP($3), $4, TO_TIMESTAMP($5)) RETURNING id\n\t\t`, sessionID, accessToken, accessTokenExpiry/1000, refreshToken, refreshTokenExpiry/1000,\n\t).Scan(&id)\n\tif err != nil {\n\t\tlogger.Fatal(\"CstAccountSessionDAO\", logger.FromError(err))\n\t}\n\treturn id, err\n}", "title": "" }, { "docid": "cc9bd2461796e1ade064ceeef4a50746", "score": "0.503418", "text": "func StoreUserSession(userId int, token string) error {\n\tSQL := `INSERT INTO user_session(user_id, token, last_used_at) VALUES ($1, $2, $3)`\n\t_, err := database.RemoteOfficeDB.Exec(SQL, userId, token, time.Now())\n\treturn err\n}", "title": "" }, { "docid": "b5e722ca2a8217e10a3852a7d4d5441a", "score": "0.503211", "text": "func PostUser(db *sql.DB, username string, email string) (int64, error) {\n\tsql := \"INSERT INTO user(username, email) VALUES(?, ?)\"\n\n\tstmt, err := db.Prepare(sql)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tdefer stmt.Close()\n\n\tr, err := stmt.Exec(username, email)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn r.LastInsertId()\n}", "title": "" }, { "docid": "a2f198a3fe098883f68cb5e13288833a", "score": "0.5029053", "text": "func (s *service) PostInsert(db gorp.SqlExecutor) error {\n\treturn s.PostUpdate(db)\n}", "title": "" }, { "docid": "a2f198a3fe098883f68cb5e13288833a", "score": "0.5029053", "text": "func (s *service) PostInsert(db gorp.SqlExecutor) error {\n\treturn s.PostUpdate(db)\n}", "title": "" }, { "docid": "b6938b5d18223d91fe8de591c4a013d0", "score": "0.5016313", "text": "func (c *UserController) PostLogout(ctx iris.Context) {\n\tsessions.Get(ctx).Man.Destroy(ctx)\n}", "title": "" }, { "docid": "46265f14d37bb722d1377b7f3806561f", "score": "0.50074965", "text": "func (s *SessionStore) SessionRelease(ctx context.Context, w http.ResponseWriter) {\n\ts.lock.RLock()\n\tvalues := s.values\n\ts.lock.RUnlock()\n\tb, err := session.EncodeGob(values)\n\tif err != nil {\n\t\treturn\n\t}\n\ts.client.Do(\"setx\", s.sid, string(b), s.maxLifetime)\n}", "title": "" }, { "docid": "51c0a7f3b8cdb13ea9146ae410dcf56a", "score": "0.49910972", "text": "func (_BountyRegistry *BountyRegistryTransactorSession) PostAssertion(bountyGuid *big.Int, verdicts *big.Int, bid *big.Int, metadata string) (*types.Transaction, error) {\n\treturn _BountyRegistry.Contract.PostAssertion(&_BountyRegistry.TransactOpts, bountyGuid, verdicts, bid, metadata)\n}", "title": "" }, { "docid": "191b528afa3bdad4f5123dce2db94875", "score": "0.49810472", "text": "func (s *Server) saveSession(w http.ResponseWriter, r *http.Request, ses *session.Session, domain, path string) (rr *http.Request, err error) {\n\tdefer func() {\n\t\trr = r.WithContext(context.WithValue(r.Context(), contextKeySession, ses))\n\t}()\n\n\tif ses == nil {\n\t\tses = &session.Session{}\n\t}\n\n\tif ses.ID == \"\" {\n\t\tif ses, err = s.SessionService.CreateSession(&session.Options{\n\t\t\tValues: &ses.Values,\n\t\t\tMaxAge: &ses.MaxAge,\n\t\t}); err != nil {\n\t\t\treturn\n\t\t}\n\t} else {\n\t\tif ses, err = s.SessionService.UpdateSession(ses.ID, &session.Options{\n\t\t\tValues: &ses.Values,\n\t\t\tMaxAge: &ses.MaxAge,\n\t\t}); err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\n\tif path == \"\" {\n\t\tpath = \"/\"\n\t}\n\tcookie := &http.Cookie{\n\t\tName: s.SessionCookieName,\n\t\tValue: ses.ID,\n\t\tPath: path,\n\t\tDomain: domain,\n\t\tMaxAge: ses.MaxAge,\n\t\tSecure: r.TLS != nil,\n\t\tHttpOnly: true,\n\t}\n\tif cookie.MaxAge > 0 {\n\t\tcookie.Expires = time.Now().Add(time.Duration(cookie.MaxAge) * time.Second)\n\t} else if cookie.MaxAge < 0 {\n\t\tcookie.Expires = time.Unix(1, 0)\n\t}\n\thttp.SetCookie(w, cookie)\n\treturn\n}", "title": "" }, { "docid": "79ba5c5869de80cc737d8b51d2946b64", "score": "0.498017", "text": "func (s OrdersServer) PostOrder(ctx stdctx.Context, order *pb.CreateOrder) (*pb.Order, error) {\n newOrder, err := db.InsertOrder(ordersTableName, pbToCreateOrder(order))\n return orderToPb(newOrder), err\n}", "title": "" }, { "docid": "db299a281aa4183ae253ccf828f5defb", "score": "0.49706018", "text": "func PostTransaction(c *gin.Context) {\n\tvar err error\n\tvar ctx = context.Background()\n\tconn, err := database.GetConnection()\n\tdefer conn.Release()\n\tif err != nil {\n\t\tc.AbortWithStatus(503)\n\t\treturn\n\t}\n\n\tcurrentUserId, _ := c.Get(\"user_id\")\n\n\tvar requestBody requests.PostTransactionRequest\n\terr = c.Bind(&requestBody)\n\tif err != nil {\n\t\tc.AbortWithStatus(400)\n\t\treturn\n\t}\n\n\tvar recipientId int\n\terr = conn.QueryRow(ctx, \"select id from users where email=$1\", requestBody.UserEmail).Scan(&recipientId)\n\tif err != nil {\n\t\tc.AbortWithStatus(400)\n\t\treturn\n\t}\n\n\ttx, err := conn.Begin(ctx)\n\t_, err = tx.Exec(ctx, \"select * from users where id=$1 for update;\", currentUserId)\n\t_, err = tx.Exec(ctx, \"select * from users where id=$1 for update;\", recipientId)\n\n\t_, err = tx.Exec(ctx, \"update users set balance=balance-$1 where id=$2;\", requestBody.TransactionAmount, currentUserId)\n\t_, err = tx.Exec(ctx, \"update users set balance=balance+$1 where id=$2\", requestBody.TransactionAmount, recipientId)\n\n\t_, err = tx.Exec(ctx, \"insert into transactions (user_id_from, user_id_to, amount) values ($1, $2, $3);\", currentUserId, recipientId, requestBody.TransactionAmount)\n\terr = tx.Commit(ctx)\n\n\tif err != nil {\n\t\t_ = tx.Rollback(ctx)\n\t\tlog.Println(\"Can`t make the transaction\")\n\t\tc.AbortWithStatus(503)\n\t\treturn\n\t}\n\n\tc.Status(200)\n}", "title": "" }, { "docid": "b0af0ebc28bdad51b83d94233a793047", "score": "0.49696755", "text": "func (m *MongoStore) Save(r *http.Request, w http.ResponseWriter, session *sessions.Session) error {\n\n\tvar err error\n\n\tif session.Options.MaxAge < 0 {\n\n\t\tif err = m.delete(session); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tm.Token.SetToken(w, session.Name(), \"\", session.Options)\n\t\treturn nil\n\t}\n\n\tif session.ID == \"\" {\n\t\tsession.ID = bson.NewObjectId().Hex()\n\t}\n\n\tif err = m.upsert(session); err != nil {\n\t\treturn err\n\t}\n\n\tvar encoded string\n\n\tif encoded, err = securecookie.EncodeMulti(session.Name(), session.ID, m.Codecs...); err != nil {\n\t\treturn err\n\t}\n\n\tm.Token.SetToken(w, session.Name(), encoded, session.Options)\n\n\treturn err\n}", "title": "" }, { "docid": "6f1de8f18f56838d987035b5f5123611", "score": "0.496521", "text": "func SaveToSession(id string) (string, error) {\n\ttoken := jwt.NewWithClaims(jwt.SigningMethodHS256, &LoginClaim{\n\t\tKey: id,\n\t\tStandardClaims: jwt.StandardClaims{\n\t\t\tExpiresAt: 15000,\n\t\t\tIssuer: \"shjp\",\n\t\t},\n\t})\n\n\tss, err := token.SignedString(signingKey)\n\tif err != nil {\n\t\tfmt.Printf(\"Cannot sign token: %s\\n\", err)\n\t\treturn \"\", errors.Wrap(err, \"cannot sign token\")\n\t}\n\n\tfmt.Printf(\"signed string is: %s\\n\", ss)\n\n\tsessionManager.Set(\"user\", ss, id)\n\treturn ss, nil\n}", "title": "" }, { "docid": "9ac8d8f1ca47d3ab0ddd57a10a2aab8b", "score": "0.49602008", "text": "func (s *Storage) CreateSession(ctx context.Context, session *influxdb.Session) error {\n\t// create session\n\tsessionBytes, err := json.Marshal(session)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// use a minute time just so the session will expire if we fail to set the expiration later\n\tsessionID := sessionID(session.ID)\n\tif err := s.store.Set(sessionID, string(sessionBytes), session.ExpiresAt); err != nil {\n\t\treturn err\n\t}\n\n\t// create index\n\tindexKey := sessionIndexKey(session.Key)\n\tif err := s.store.Set(indexKey, session.ID.String(), session.ExpiresAt); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9b675eee0448bece09a3ea26e6acdecd", "score": "0.49565664", "text": "func CreateSession(sessionID string, mode string, sessionName string, hosts []string, databaseName string, username string, password string) error {\n\n\tlog.Startedf(sessionID, \"CreateSession\", \"Mode[%s] SessionName[%s] Hosts[%s] DatabaseName[%s] Username[%s]\", mode, sessionName, hosts, databaseName, username)\n\n\t//Create the database object\n\tmongoSession := mongoSession{\n\t\tmongoDBDialInfo:&mgo.DialInfo{\n\t\t\tAddrs:hosts,\n\t\t\tTimeout:60 * time.Second,\n\t\t\tDatabase: databaseName,\n\t\t\tUsername: username,\n\t\t\tPassword: password,\n\t\t},\n\t}\n\n\t//Established the master session\n\tvar err error\n\tmongoSession.mongoSession, err = mgo.DialWithInfo(mongoSession.mongoDBDialInfo)\n\tif err != nil {\n\t\tlog.CompletedError(err, sessionID, \"CreateSession\")\n\t\treturn err\n\t}\n\n\tswitch mode {\n\tcase \"strong\":\n\t\tmongoSession.mongoSession.SetMode(mgo.Strong, true)\n\t\tbreak\n\tcase \"monotonic\":\n\t\tmongoSession.mongoSession.SetMode(mgo.Monotonic, true)\n\t\tbreak\n\t}\n\n\tmongoSession.mongoSession.SetSafe(&mgo.Safe{})\n\t// Add the database to the map.\n\tsingleton.sessions[sessionName] = mongoSession\n\tlog.Completed(sessionID, \"CreateSession\")\n\n\treturn nil\n}", "title": "" }, { "docid": "b3fb194ef8f05a2effe6d906dd0084b0", "score": "0.49488753", "text": "func (s FirestoreUserStore) CreateSession(email string, accessToken string) error {\n\tref := s.store.Collection(\"sessions\").NewDoc()\n\tsession := models.AuthSession{\n\t\tEmail: email,\n\t\tAccessToken: accessToken,\n\t\tID: ref.ID,\n\t}\n\t_, err := ref.Set(*s.context, session)\n\tif err != nil {\n\t\treturn status.Error(codes.Aborted, \"Fail to create login session.\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5c22be51fe3b5d1b29052f452691fc08", "score": "0.49476895", "text": "func SetSession(clientSessionId string, data primitive.M) error {\n\tif clientSessionId == \"\" {\n\t\treturn errors.New(\"clientSessionId not found\")\n\t}\n\n\tif !strings.Contains(clientSessionId, \":\") {\n\t\treturn errors.New(\"clientSessionId not valid\")\n\t}\n\tsplit := strings.Split(clientSessionId, \":\")\n\tuserId := split[0]\n\tshortId := split[1]\n\n\tctx, ctxCancel := context.WithTimeout(context.Background(), 10*time.Second)\n\tdefer ctxCancel()\n\n\tjsonData, err := json.Marshal(data)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = Client.HSet(ctx, \"sess\"+userId, shortId, jsonData).Err()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2bd957a87d51c29b7a08c333f9f702f2", "score": "0.49389175", "text": "func storeInSession(sessionName, key string, value string, req *http.Request, res http.ResponseWriter) error {\n\tsession, _ := Store.New(req, sessionName)\n\tsession.Options.SameSite = http.SameSiteNoneMode\n\tsession.Options.Secure = true\n\n\tif err := updateSessionValue(session, key, value); err != nil {\n\t\treturn err\n\t}\n\n\treturn session.Save(req, res)\n}", "title": "" }, { "docid": "ad0a27bdff079ed1df7b6a83fbe1ff1b", "score": "0.49379477", "text": "func PostMessage(db *bolt.DB, post Post) (postID uint64, err error) {\n\n\terr = db.Update(func(tx *bolt.Tx) error {\n\t\tb, err := tx.CreateBucketIfNotExists([]byte(backendBucketName))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tid, _ := b.NextSequence()\n\t\tpostID = uint64(id)\n\t\tpost.ID = postID\n\n\t\tbuf, err := json.Marshal(post)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\terr = b.Put(goboardutils.IToB(post.ID), buf)\n\n\t\treturn nil\n\t})\n\n\treturn\n}", "title": "" }, { "docid": "4a8cd57891922a66b63d94985aee15d6", "score": "0.49348474", "text": "func postSong(c *gin.Context) {\n\tcollection, ok := c.MustGet(\"databaseCollection\").(*mongo.Collection)\n\tif !ok {\n\t\tlog.Println(\"ERROR: Couldn't fetch database collection\")\n\t\tc.AbortWithStatus(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// Get the song from the request body\n\tvar newSong song\n\t// Call BindJSON to bind the received JSON to newSong\n\tif err := c.BindJSON(&newSong); err != nil {\n\t\treturn\n\t}\n\n\t// Insert into the database\n\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n\tdefer cancel()\n\tresult, err := collection.InsertOne(ctx, newSong)\n\tif err != nil {\n\t\tlog.Printf(\"ERROR: Failed to add song %v\", err)\n\t\tc.AbortWithStatus(http.StatusInternalServerError)\n\t}\n\tnewSong.Id = result.InsertedID.(primitive.ObjectID).Hex()\n\n\tc.IndentedJSON(http.StatusCreated, newSong)\n}", "title": "" }, { "docid": "40f6c83a75eeda036fa08826fca2d32f", "score": "0.49279878", "text": "func CreateSession(res *http.ResponseWriter, req *http.Request, user User) {\n\tnewUuid, err := uuid.NewV4()\n\tsessionId := newUuid.String()\n\tlog.LogError(err)\n\tmemcache.Store(sessionId, user, req)\n\tcreateCookie(res, SESSION_ID, sessionId)\n}", "title": "" }, { "docid": "43617c46712c56306267d4f36273a47c", "score": "0.49221435", "text": "func (s Session) Save(ctx echo.Context) error {\n\treturn s.Session.Save()\n}", "title": "" }, { "docid": "3b60f506681a887745bd09b63fe89eee", "score": "0.4918139", "text": "func (u *UtxoDBLedger) PostTransaction(tx *ledgerstate.Transaction) error {\n\terr := u.AddTransaction(tx)\n\tif err == nil {\n\t\tu.txConfirmedEvent.Trigger(tx)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "0f8ed86e41a1bc680bb9526aa0705c26", "score": "0.49167132", "text": "func (a *DefaultApiService) CreateNewSession(ctx _context.Context, newSession model.NewSession) (model.Session, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPost\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue model.Session\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/session\"\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{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = &newSession\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 201 {\n\t\t\tvar v model.Session\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\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": "e7932c0e813c771a06a59dae5e35699e", "score": "0.4893033", "text": "func LogoutPOST(w http.ResponseWriter, r *http.Request) {\n\tsess := session.GetSession(r)\n\tif sess.Values[\"username\"] == nil {\n\t\thttp.Error(w, \"You are not logged in.\", 409)\n\t\treturn\n\t}\n\t// session.ClearSessionByKey(\"username\", sess)\n\tsession.ClearAllSessionValues(sess)\n\tsess.AddFlash(\"Successfully logged out.\")\n\tsess.Save(r, w)\n\tw.Write([]byte(\"Successfully logged out.\"))\n}", "title": "" }, { "docid": "3140e638d448a3c59a354db9ca88c9c5", "score": "0.48925558", "text": "func PostSprint(data Sprint) Sprint {\n\tdatabase.SQL.Create(&data)\n\treturn data\n}", "title": "" }, { "docid": "968a66849ce5e92ea444f40d7a48b4e1", "score": "0.48898223", "text": "func createSession(sID string, userID primitive.ObjectID) model.Session {\n\tsess := model.Session{\n\t\tID: sID,\n\t\tUser: userID,\n\t\tLastActive: time.Now(),\n\t}\n\n\treturn sess\n}", "title": "" }, { "docid": "5ce4ae5bd692e3066f9d35bb8a6daf8c", "score": "0.4884683", "text": "func New(resp http.ResponseWriter, req *http.Request, sqlAcc string) error {\n\tlog.Traceln(\"Beginning to make a new session for the client\")\n\tlastcookie, _ := req.Cookie(\"session\")\n\tif lastcookie != nil {\n\t\treturn fmt.Errorf(\"SESSION_EXISTS\")\n\t}\n\texpiration := time.Now().Add(720 * time.Hour).Unix()\n\tallowedCharsSplit := strings.Split(allowedChars, \"\")\n\tvar session string\n\tvar x int\n\trand.Seed(time.Now().UnixNano())\n\tfor i := 0; i <= 128; i++ {\n\t\tx = rand.Intn(len(allowedChars)-0-1) + 0 // Not helpful name, but this generates a randon number from 0 to 84 to locate what we need for the session\n\t\tsession += allowedCharsSplit[x] // Using x to navigate the split for one character\n\t}\n\n\tcookie := http.Cookie{Name: \"session\", Value: session, Expires: time.Unix(expiration, 0), Path: \"/\", SameSite: 3}\n\n\tdb := startSQL(sqlAcc)\n\tdefer db.Close()\n\tvar token string\n\terr := db.QueryRow(\"SELECT * FROM sessions WHERE token=?\", session).Scan(&token)\n\tswitch {\n\tcase err == sql.ErrNoRows:\n\t\tlog.Debug(\"New session, adding..\")\n\t\t_, err := db.Exec(\"INSERT INTO sessions VALUES(?, ?, ?)\", session, expiration, req.FormValue(\"user\"))\n\t\tif err != nil {\n\t\t\tlog.Error(err)\n\t\t\treturn err\n\t\t}\n\t\tlog.Debug(\"Added token info to table\")\n\tcase err != nil:\n\t\tlog.Error(err)\n\t\treturn err\n\tdefault:\n\t\treturn fmt.Errorf(\"SQL_ROW_EXISTS\")\n\t}\n\n\thttp.SetCookie(resp, &cookie)\n\n\treturn nil\n}", "title": "" }, { "docid": "048cd2f9b6b28396d4c51e0b2366c321", "score": "0.48830503", "text": "func CloseDBSession(copiedSession *mgo.Session) {\n\n\tfmt.Println(\"Session Closed\")\n\tcopiedSession.Close()\n}", "title": "" }, { "docid": "cc01df3f9c98354682b5737c87aeb726", "score": "0.4882413", "text": "func FunPostUser(vUser ObjUserPost) error {\n\n\t// Open database connection\n\tvsessionSocial, err := config.FunOpenDatabaseConnection(CstrNinTable)\n\tdefer vsessionSocial.Close()\n\tif err != nil {\n\t\terr = errors.New(\"*ERROR FunPostGroup: couldn't connect database -> \" + err.Error())\n\t\treturn err\n\t}\n\n\t_, err = r.Table(CstrUserTable).Insert(vUser).RunWrite(vsessionSocial)\n\tif err != nil {\n\t\terr = errors.New(\"*ERROR FunPostGroup: could'n insert new group \" + vUser.Name + \" -> \" + err.Error())\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "cd1f4eff1ad52d887e76035bea1681f6", "score": "0.4882246", "text": "func postToServer(s string, c *net.UDPConn, t *uint32, key []byte) {\n\n if *t == 0 {\n util.PrintFailure(\"error#must_login_first\")\n return\n }\n\n /* Message to send. */\n var m util.Message\n\n /* Update opcode and magic numbers. */\n m.First = uint8('P')\n m.Second = uint8('O')\n m.Opcode = util.OP_POST\n m.Token = *t\n\n /* Make the payload the post. */\n m.Payload = util.FormatPayload(s)\n\n /* Update length of payload with the appropriate size. */\n m.PayloadLen = util.UpdatePayloadLen(m.Payload)\n\n /* Send login to the client and get back message*/\n err := util.ClientEncodeAndSendMessage(c, m, key)\n if err != nil {\n util.PrintFailure(\"ERROR! CANNOT SEND TO SERVER!\")\n fmt.Println(err)\n }\n}", "title": "" }, { "docid": "3049333fbf8276a3d65642d8e2a07685", "score": "0.48714295", "text": "func (r *outgoingHookModel) PostInsert(db gorp.SqlExecutor) error {\n\treturn r.PostUpdate(db)\n}", "title": "" }, { "docid": "a16ae2d141fe378e9b5d9afe7ade27c4", "score": "0.48646605", "text": "func (o *orm) CreateSession(sr SessionRequest) (string, error) {\n\tuser, err := o.FindUser()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif !constantTimeEmailCompare(sr.Email, user.Email) {\n\t\treturn \"\", errors.New(\"Invalid email\")\n\t}\n\n\tif utils.CheckPasswordHash(sr.Password, user.HashedPassword) {\n\t\tsession := NewSession()\n\t\t_, err := o.db.Exec(\"INSERT INTO sessions (id, last_used, created_at) VALUES ($1, now(), now())\", session.ID)\n\t\treturn session.ID, err\n\t}\n\treturn \"\", errors.New(\"Invalid password\")\n}", "title": "" }, { "docid": "db02292553c2aed20437d2aed58c086b", "score": "0.48633632", "text": "func PostStory(data Story) Story {\n\tdatabase.SQL.Create(&data)\n\treturn data\n}", "title": "" } ]
7d0cfc0d217398263e8f188545633054
NewEmptyARMValue returns an empty ARM value suitable for deserializing into
[ { "docid": "5dad477e9f901787cd57ddd65f6373e6", "score": "0.0", "text": "func (condition *DeliveryRuleQueryStringCondition_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &DeliveryRuleQueryStringCondition_STATUS_ARM{}\n}", "title": "" } ]
[ { "docid": "061c4bf847410ca43c97ae6a5b3891d3", "score": "0.78565747", "text": "func (record *TxtRecord) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &TxtRecord_ARM{}\n}", "title": "" }, { "docid": "56468f2034b87bc03879ce3cf7d96869", "score": "0.78463167", "text": "func (record *SoaRecord) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &SoaRecord_ARM{}\n}", "title": "" }, { "docid": "005bd0ecb7035e48a624c6e7ae259b04", "score": "0.7833926", "text": "func (record *AaaaRecord) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &AaaaRecord_ARM{}\n}", "title": "" }, { "docid": "a88a65351b0f8ca10a307af56e2c638a", "score": "0.7797802", "text": "func (record *MxRecord) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &MxRecord_ARM{}\n}", "title": "" }, { "docid": "30bdc525854e37ffb4d2c5c2056d7747", "score": "0.77649343", "text": "func (record *ARecord) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &ARecord_ARM{}\n}", "title": "" }, { "docid": "d9b5421540d3ee945cb216010e3d4f0d", "score": "0.77196825", "text": "func (namespace *Namespace_Spec) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &Namespace_Spec_ARM{}\n}", "title": "" }, { "docid": "adef1613abcbdbbfee59cd3784ce8dfd", "score": "0.7692994", "text": "func (record *SrvRecord) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &SrvRecord_ARM{}\n}", "title": "" }, { "docid": "fefa9d1380a2c44e17ee672b46e60d55", "score": "0.76839644", "text": "func (config *KubeletConfig) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &KubeletConfig_ARM{}\n}", "title": "" }, { "docid": "6ee26d016a310d9d26da22c6874e6e33", "score": "0.7656483", "text": "func (record *CnameRecord) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &CnameRecord_ARM{}\n}", "title": "" }, { "docid": "2bdaafcde20e57df3a9172ba9c2fd3fa", "score": "0.7656014", "text": "func (snapshot *Snapshot_Spec) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &Snapshot_Spec_ARM{}\n}", "title": "" }, { "docid": "9655503ce9120530da2a7c2f342fc52c", "score": "0.76396716", "text": "func (reference *ApiEntityReference) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &ApiEntityReference_ARM{}\n}", "title": "" }, { "docid": "9e612dbd21b21f90f082995c9b08b30b", "score": "0.7609846", "text": "func (workspace *Workspace_Spec) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &Workspace_Spec_ARM{}\n}", "title": "" }, { "docid": "9e612dbd21b21f90f082995c9b08b30b", "score": "0.7609846", "text": "func (workspace *Workspace_Spec) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &Workspace_Spec_ARM{}\n}", "title": "" }, { "docid": "68c5a305d71f36cee8bb62535163b149", "score": "0.7604352", "text": "func (record *TxtRecord_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &TxtRecord_STATUS_ARM{}\n}", "title": "" }, { "docid": "a1032d10cf1563cbc329f5592a3ee4bb", "score": "0.75833285", "text": "func (record *AaaaRecord_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &AaaaRecord_STATUS_ARM{}\n}", "title": "" }, { "docid": "9f9f5bb9cf31f930e0137ef08f0dcc05", "score": "0.7582206", "text": "func (configuration *PurviewConfiguration) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &PurviewConfiguration_ARM{}\n}", "title": "" }, { "docid": "d9b3d2d886498cef7628ad60e59221b8", "score": "0.7567184", "text": "func (capping *WorkspaceCapping) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &WorkspaceCapping_ARM{}\n}", "title": "" }, { "docid": "8fdb3bf9975ca5f604254c831b220916", "score": "0.7566711", "text": "func (encryption *Encryption) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &Encryption_ARM{}\n}", "title": "" }, { "docid": "76d7f12b69e80c2d3c4d073c98878b19", "score": "0.7544903", "text": "func (record *PtrRecord) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &PtrRecord_ARM{}\n}", "title": "" }, { "docid": "65235d574e0c1cb9b4894c870f8d2a95", "score": "0.75391567", "text": "func (sku *Sku) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &Sku_ARM{}\n}", "title": "" }, { "docid": "65235d574e0c1cb9b4894c870f8d2a95", "score": "0.75391567", "text": "func (sku *Sku) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &Sku_ARM{}\n}", "title": "" }, { "docid": "dadafb0d16bf8b74bcd3458e32a92a74", "score": "0.7536769", "text": "func (configuration *CacheConfiguration) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &CacheConfiguration_ARM{}\n}", "title": "" }, { "docid": "dadafb0d16bf8b74bcd3458e32a92a74", "score": "0.7536769", "text": "func (configuration *CacheConfiguration) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &CacheConfiguration_ARM{}\n}", "title": "" }, { "docid": "5d672dd89a273d06037f7a3db1f2e0b5", "score": "0.7533885", "text": "func (resource *SubResource) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &SubResource_ARM{}\n}", "title": "" }, { "docid": "5d672dd89a273d06037f7a3db1f2e0b5", "score": "0.7533885", "text": "func (resource *SubResource) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &SubResource_ARM{}\n}", "title": "" }, { "docid": "e530e742370e679c386365260d423187", "score": "0.7529735", "text": "func (database *FlexibleServers_Database_Spec) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &FlexibleServers_Database_Spec_ARM{}\n}", "title": "" }, { "docid": "9d4a936b868da0a977aeaa1c4e237621", "score": "0.75277466", "text": "func (config *KubeletConfig_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &KubeletConfig_STATUS_ARM{}\n}", "title": "" }, { "docid": "45ed2fb0563356bea11aacc0e7dead23", "score": "0.75245726", "text": "func (record *SoaRecord_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &SoaRecord_STATUS_ARM{}\n}", "title": "" }, { "docid": "f0b02343b2796077b9adf333ce5ca31b", "score": "0.7524402", "text": "func (identity *Identity) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &Identity_ARM{}\n}", "title": "" }, { "docid": "7aefd08a41fde229f83db14af291b2f2", "score": "0.7517017", "text": "func (resource *MongoDBDatabaseResource) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &MongoDBDatabaseResource_ARM{}\n}", "title": "" }, { "docid": "2193adc0a045b6d39b9635832d148039", "score": "0.7516934", "text": "func (record *ARecord_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &ARecord_STATUS_ARM{}\n}", "title": "" }, { "docid": "ea13f28346329c59c7c02d3577d04576", "score": "0.7515992", "text": "func (record *MxRecord_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &MxRecord_STATUS_ARM{}\n}", "title": "" }, { "docid": "67867305ced24120455a4befae62ae31", "score": "0.751273", "text": "func (definition *ManagementPolicyDefinition) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &ManagementPolicyDefinition_ARM{}\n}", "title": "" }, { "docid": "02aa2b2c0369474e191d1645a7459928", "score": "0.7505209", "text": "func (config *LinuxOSConfig) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &LinuxOSConfig_ARM{}\n}", "title": "" }, { "docid": "e6723930b6a8b3bf9bf4dece212a632b", "score": "0.7503774", "text": "func (features *WorkspaceFeatures) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &WorkspaceFeatures_ARM{}\n}", "title": "" }, { "docid": "edacd1c386d29da383327063333e0a60", "score": "0.7493414", "text": "func (properties *KeyVaultProperties) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &KeyVaultProperties_ARM{}\n}", "title": "" }, { "docid": "2db0eec17b2cbe14398f283388c8ebf7", "score": "0.7491459", "text": "func (scaleSet *VirtualMachineScaleSet_Spec) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &VirtualMachineScaleSet_Spec_ARM{}\n}", "title": "" }, { "docid": "e8623c71f33f63d7771d252f5cd3539b", "score": "0.7488418", "text": "func (configuration *Servers_Configuration_Spec) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &Servers_Configuration_Spec_ARM{}\n}", "title": "" }, { "docid": "4035ceeee1d3e15728f57c70e2cec2d7", "score": "0.7486196", "text": "func (zone *DnsZone_Spec) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &DnsZone_Spec_ARM{}\n}", "title": "" }, { "docid": "e901c2df23be485ac98d08fba24054b4", "score": "0.747564", "text": "func (record *PtrRecord_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &PtrRecord_STATUS_ARM{}\n}", "title": "" }, { "docid": "e0d5901347297f0a8c2338e46aa1680c", "score": "0.74720734", "text": "func (policy *StorageAccounts_ManagementPolicy_Spec) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &StorageAccounts_ManagementPolicy_Spec_ARM{}\n}", "title": "" }, { "docid": "93c8523d3b3899892912a8837782be10", "score": "0.7464191", "text": "func (record *SrvRecord_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &SrvRecord_STATUS_ARM{}\n}", "title": "" }, { "docid": "0717dbcf2a673185b2bf637d1c89a2f2", "score": "0.74607176", "text": "func (schema *ManagementPolicySchema) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &ManagementPolicySchema_ARM{}\n}", "title": "" }, { "docid": "f20a7bd6e754bb7572702306f0070364", "score": "0.7447864", "text": "func (workspaceSku *WorkspaceSku) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &WorkspaceSku_ARM{}\n}", "title": "" }, { "docid": "a77b886bedd5ca4c7c5a9dc58f725c65", "score": "0.7444119", "text": "func (record *CnameRecord_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &CnameRecord_STATUS_ARM{}\n}", "title": "" }, { "docid": "b6ecb5133872ac63eecd7e63fee4423d", "score": "0.74324924", "text": "func (capping *WorkspaceCapping_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &WorkspaceCapping_STATUS_ARM{}\n}", "title": "" }, { "docid": "1bfdd3a4163d0fc0be2ba3fdf80a1331", "score": "0.742387", "text": "func (resource *SqlStoredProcedureResource) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &SqlStoredProcedureResource_ARM{}\n}", "title": "" }, { "docid": "7bd75012a936849f929975df1276e9c0", "score": "0.7419149", "text": "func (parameters *KeyVaultSigningKeyParameters) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &KeyVaultSigningKeyParameters_ARM{}\n}", "title": "" }, { "docid": "7bd75012a936849f929975df1276e9c0", "score": "0.7419149", "text": "func (parameters *KeyVaultSigningKeyParameters) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &KeyVaultSigningKeyParameters_ARM{}\n}", "title": "" }, { "docid": "5bd0032f0714cff37cb7bb25be3e0f9c", "score": "0.74175954", "text": "func (configuration *CacheConfiguration_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &CacheConfiguration_STATUS_ARM{}\n}", "title": "" }, { "docid": "5bd0032f0714cff37cb7bb25be3e0f9c", "score": "0.74175954", "text": "func (configuration *CacheConfiguration_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &CacheConfiguration_STATUS_ARM{}\n}", "title": "" }, { "docid": "dce033a175da5cd17b432a8ce9925ed4", "score": "0.74161106", "text": "func (group *NetworkSecurityGroup_Spec) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &NetworkSecurityGroup_Spec_ARM{}\n}", "title": "" }, { "docid": "30881d6063cff18ff34e06f317a4f577", "score": "0.7416045", "text": "func (reference *ResourceReference) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &ResourceReference_ARM{}\n}", "title": "" }, { "docid": "30881d6063cff18ff34e06f317a4f577", "score": "0.7416045", "text": "func (reference *ResourceReference) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &ResourceReference_ARM{}\n}", "title": "" }, { "docid": "985757ab305f3234f89af3d04817ae4d", "score": "0.74144864", "text": "func (settings *AutoscaleSettings) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &AutoscaleSettings_ARM{}\n}", "title": "" }, { "docid": "3dd2af44d3751710e2e69f7fa21a898c", "score": "0.7409619", "text": "func (setting *Servers_AuditingSetting_Spec) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &Servers_AuditingSetting_Spec_ARM{}\n}", "title": "" }, { "docid": "c214313b7a0b40f25399c54d41f6250c", "score": "0.74076617", "text": "func (details *EncryptionDetails) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &EncryptionDetails_ARM{}\n}", "title": "" }, { "docid": "f1244069a02591980df5df56b9db15fb", "score": "0.7399328", "text": "func (namespace *Namespace_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &Namespace_STATUS_ARM{}\n}", "title": "" }, { "docid": "f08b877ba9977e84f9162a26f8d63c28", "score": "0.739628", "text": "func (details *DataLakeStorageAccountDetails) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &DataLakeStorageAccountDetails_ARM{}\n}", "title": "" }, { "docid": "51975c37be8de0588ec3bd2f065b1d9f", "score": "0.73923355", "text": "func (details *EncryptionDetails_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &EncryptionDetails_STATUS_ARM{}\n}", "title": "" }, { "docid": "0811fbfc9a80358c353dac86ed65686b", "score": "0.7390585", "text": "func (parameters *HeaderActionParameters) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &HeaderActionParameters_ARM{}\n}", "title": "" }, { "docid": "0811fbfc9a80358c353dac86ed65686b", "score": "0.7390585", "text": "func (parameters *HeaderActionParameters) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &HeaderActionParameters_ARM{}\n}", "title": "" }, { "docid": "9f60222d694d9cb8c6def8dd6ca01166", "score": "0.738585", "text": "func (blob *ManagementPolicyBaseBlob) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &ManagementPolicyBaseBlob_ARM{}\n}", "title": "" }, { "docid": "c233efe77797fcecde5be10673ca9d38", "score": "0.7383566", "text": "func (endpoint *Profiles_Endpoint_Spec) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &Profiles_Endpoint_Spec_ARM{}\n}", "title": "" }, { "docid": "c233efe77797fcecde5be10673ca9d38", "score": "0.7383566", "text": "func (endpoint *Profiles_Endpoint_Spec) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &Profiles_Endpoint_Spec_ARM{}\n}", "title": "" }, { "docid": "30519e433091e43d2cdc070927201db4", "score": "0.73822075", "text": "func (config *LinuxOSConfig_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &LinuxOSConfig_STATUS_ARM{}\n}", "title": "" }, { "docid": "132011d1c476c17db2f37d4746391813", "score": "0.73821497", "text": "func (parameters *KeyVaultSigningKeyParameters_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &KeyVaultSigningKeyParameters_STATUS_ARM{}\n}", "title": "" }, { "docid": "132011d1c476c17db2f37d4746391813", "score": "0.73821497", "text": "func (parameters *KeyVaultSigningKeyParameters_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &KeyVaultSigningKeyParameters_STATUS_ARM{}\n}", "title": "" }, { "docid": "b1b31d2c09dd845a122959ab5b61d1dd", "score": "0.7379152", "text": "func (snapshotSku *SnapshotSku) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &SnapshotSku_ARM{}\n}", "title": "" }, { "docid": "5dfaa2da9695a8a4b1c10e8dbeef688d", "score": "0.7377161", "text": "func (extension *VirtualMachineScaleSetExtension) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &VirtualMachineScaleSetExtension_ARM{}\n}", "title": "" }, { "docid": "8fd0441180855320109ff7f8066c87a9", "score": "0.73708344", "text": "func (parameters *HealthProbeParameters_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &HealthProbeParameters_STATUS_ARM{}\n}", "title": "" }, { "docid": "8fd0441180855320109ff7f8066c87a9", "score": "0.73708344", "text": "func (parameters *HealthProbeParameters_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &HealthProbeParameters_STATUS_ARM{}\n}", "title": "" }, { "docid": "2eb4f424e2ae02857d85d968e7042258", "score": "0.7367027", "text": "func (configuration *PurviewConfiguration_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &PurviewConfiguration_STATUS_ARM{}\n}", "title": "" }, { "docid": "e422db5b110661c2070dfd4c8c2e04a6", "score": "0.73665", "text": "func (identity *ManagedIdentity) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &ManagedIdentity_ARM{}\n}", "title": "" }, { "docid": "25b5f9cc008a505c158a324e6091e93c", "score": "0.73650897", "text": "func (encryption *Encryption_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &Encryption_STATUS_ARM{}\n}", "title": "" }, { "docid": "cbf26d1d4962293df795e7779bbcd478", "score": "0.7363612", "text": "func (parameters *CacheKeyQueryStringActionParameters_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &CacheKeyQueryStringActionParameters_STATUS_ARM{}\n}", "title": "" }, { "docid": "cbf26d1d4962293df795e7779bbcd478", "score": "0.7363612", "text": "func (parameters *CacheKeyQueryStringActionParameters_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &CacheKeyQueryStringActionParameters_STATUS_ARM{}\n}", "title": "" }, { "docid": "2598f1464166c6c6d7488395d1f81c19", "score": "0.7356426", "text": "func (properties *KeyVaultProperties_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &KeyVaultProperties_STATUS_ARM{}\n}", "title": "" }, { "docid": "cf053f689f83b652c5b0cb6fe3037404", "score": "0.73547935", "text": "func (route *RouteTables_Route_Spec) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &RouteTables_Route_Spec_ARM{}\n}", "title": "" }, { "docid": "33eadb4bf324298b9cacf09d60527918", "score": "0.7352681", "text": "func (reference *ApiEntityReference_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &ApiEntityReference_STATUS_ARM{}\n}", "title": "" }, { "docid": "5d12db381cc76458b8110b9fa5c24017", "score": "0.7352022", "text": "func (aaaa *PrivateDnsZones_AAAA_Spec) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &PrivateDnsZones_AAAA_Spec_ARM{}\n}", "title": "" }, { "docid": "3aa1723da504940fdc9394e71006ed0a", "score": "0.7350178", "text": "func (parameters *HealthProbeParameters) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &HealthProbeParameters_ARM{}\n}", "title": "" }, { "docid": "3aa1723da504940fdc9394e71006ed0a", "score": "0.7350178", "text": "func (parameters *HealthProbeParameters) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &HealthProbeParameters_ARM{}\n}", "title": "" }, { "docid": "19687d62c798b8d790494b11a44c81ee", "score": "0.7350032", "text": "func (pool *ManagedClusters_AgentPool_Spec) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &ManagedClusters_AgentPool_Spec_ARM{}\n}", "title": "" }, { "docid": "6762ae823704e15859aa6f7e2b9f5d24", "score": "0.7345957", "text": "func (version *ManagementPolicyVersion) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &ManagementPolicyVersion_ARM{}\n}", "title": "" }, { "docid": "004fccec5fb5159091f5c88c05a565d5", "score": "0.7344427", "text": "func (properties *KekIdentityProperties_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &KekIdentityProperties_STATUS_ARM{}\n}", "title": "" }, { "docid": "0b75a3aa6cbd5ab012f43121452779bb", "score": "0.7343796", "text": "func (settings *AutoscaleSettings_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &AutoscaleSettings_STATUS_ARM{}\n}", "title": "" }, { "docid": "2cba66974f29df4ec5f0659a4af14fb6", "score": "0.73422515", "text": "func (resource *OptionsResource_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &OptionsResource_STATUS_ARM{}\n}", "title": "" }, { "docid": "24bbe892ee1a958df10d141e342d08a9", "score": "0.73376364", "text": "func (data *SystemData_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &SystemData_STATUS_ARM{}\n}", "title": "" }, { "docid": "441e1bf93077d08251c862577288ec9c", "score": "0.7336923", "text": "func (database *DatabaseAccounts_MongodbDatabase_Spec) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &DatabaseAccounts_MongodbDatabase_Spec_ARM{}\n}", "title": "" }, { "docid": "f91f4d115e6e87d89ad06746d82a6dab", "score": "0.7334155", "text": "func (parameters *HeaderActionParameters_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &HeaderActionParameters_STATUS_ARM{}\n}", "title": "" }, { "docid": "f91f4d115e6e87d89ad06746d82a6dab", "score": "0.7334155", "text": "func (parameters *HeaderActionParameters_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &HeaderActionParameters_STATUS_ARM{}\n}", "title": "" }, { "docid": "a448620ebba38315cb3e68fe835e3f9d", "score": "0.7333251", "text": "func (config *SysctlConfig) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &SysctlConfig_ARM{}\n}", "title": "" }, { "docid": "29a5931c33cbf4ec663af62edde9ae0c", "score": "0.7332029", "text": "func (workspace *Workspace_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &Workspace_STATUS_ARM{}\n}", "title": "" }, { "docid": "29a5931c33cbf4ec663af62edde9ae0c", "score": "0.7332029", "text": "func (workspace *Workspace_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &Workspace_STATUS_ARM{}\n}", "title": "" }, { "docid": "d817841c81ce548ceadb28c93ea6d3ca", "score": "0.7331645", "text": "func (signingKey *UrlSigningKey_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &UrlSigningKey_STATUS_ARM{}\n}", "title": "" }, { "docid": "d817841c81ce548ceadb28c93ea6d3ca", "score": "0.7331645", "text": "func (signingKey *UrlSigningKey_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &UrlSigningKey_STATUS_ARM{}\n}", "title": "" }, { "docid": "f4da9b355d0b4fb7ad2e2cfe92471fd9", "score": "0.73275423", "text": "func (details *WorkspaceKeyDetails) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &WorkspaceKeyDetails_ARM{}\n}", "title": "" }, { "docid": "6228317657f0b2b8c284afe2e0ccb5d4", "score": "0.7324984", "text": "func (settings *AgentPoolUpgradeSettings) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &AgentPoolUpgradeSettings_ARM{}\n}", "title": "" }, { "docid": "3c7f8ebb08f335b66a084623be77bfa8", "score": "0.7321775", "text": "func (properties *KekIdentityProperties) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &KekIdentityProperties_ARM{}\n}", "title": "" }, { "docid": "ed5521f62ae9f30f2f5d6892e35c0690", "score": "0.73165184", "text": "func (snapshot *Snapshot_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {\n\treturn &Snapshot_STATUS_ARM{}\n}", "title": "" } ]
d45aaee8572833ecd566136ffcdbb408
apenas exibe o resultado
[ { "docid": "c83d085345c27cf5f025c977e3eb7e13", "score": "0.0", "text": "func Show(w http.ResponseWriter, r*http.Request){\n db := dbConn()\n\n //pega o ID do paramentro da URLs\n nId := r.URL.Query().Get(\"id\")\n\n //usa o ID para fazer a consulta e tratar erros\n selDB, err := db.Query(\"SELECT * FROM names WHERE id=?\", nId)\n \n if err != nil{\n panic(err.Error())\n }\n\n //Monta a struct para ser utilizada no template\n n := Names{}\n\n //pega os valores do BD\n for selDB.next(){\n var id int\n var name, email string\n\n //faz o scan do SELECT\n err = selDB.Scan(&id,&name,&email)\n if err != nil{\n panic(err.Error())\n }\n\n //envia os resultados para a struct\n\n n.Id = id\n n.Name = name\n n.Email = email \n } \n //mostra o template\n tmpl.ExecuteTemplate(w, \"Show\", n)\n\n //fecha a conexão\n defer db.Close()\n\n}", "title": "" } ]
[ { "docid": "4d5d69dc8b6dc7293a7e11e05a617ac1", "score": "0.58965033", "text": "func (s *server) ResultadoEntrega(ctx context.Context, in *pb.PaqueteRecibido) (*pb.OrdenRecibida, error) {\n\n\ti := 0\n\tvar nuevo finanzas\n\tfor i < len(allQueue) {\n\t\tif allQueue[i].id == in.GetId() {\n\t\t\tvar obj = allQueue[i]\n\t\t\tobj.estado = in.GetEstado()\n\t\t\tobj.intentos = in.GetIntentos()\n\t\t\tallQueue[i] = obj\n\n\t\t\tnuevo.ID = allQueue[i].id\n\t\t\tnuevo.Seguimiento = allQueue[i].seguimiento\n\t\t\tnuevo.Tipo = allQueue[i].tipo\n\t\t\tnuevo.Valor = allQueue[i].valor\n\t\t\tnuevo.Intentos = allQueue[i].intentos\n\t\t\tnuevo.Estado = allQueue[i].estado\n\t\t\tEnviarAFinanzas(nuevo)\n\t\t}\n\t\ti++\n\t}\n\n\tlog.Printf(\"Orden finaliza proceso de entrega id: %v intentos: %v Estado: %v \", in.GetId(), in.GetIntentos(), in.GetEstado())\n\treturn &pb.OrdenRecibida{Message: \"Recibido\"}, nil\n}", "title": "" }, { "docid": "bc68c8fa2db3e8a770836ecdb8d21803", "score": "0.5861904", "text": "func ViajesBuscar(documento models.ViajesFechas, audit string, req *http.Request) (string, string, string, int, []models.Viaje) {\n var documentos []models.Viaje\n coll := config.DB_Viaje\n empresaID := context.Get(req, \"Empresa_id\").(bson.ObjectId)\n\n // Genero una nueva sesión Mongo\n // *****************************\n session, err, httpStat := core.GetMongoSession()\n if err != nil {\n return \"ERROR\", \"GetMongoSession\", err.Error(), httpStat, documentos\n }\n defer session.Close()\n\n // Trato de traerlos\n // *****************\n selector := bson.M{\n \"empresa_id\": empresaID,\n \"fechaHora\": bson.M{\"$gte\": documento.FechaDesde, \"$lte\": documento.FechaHasta},\n }\n collection := session.DB(config.DB_Name).C(coll)\n collection.Find(selector).Select(bson.M{\"empresa_id\":0}).All(&documentos)\n\n // Si el resultado es vacío devuelvo ERROR\n // ***************************************\n if len(documentos) == 0 {\n s := []string{\"No encontré documentos\"}\n return \"ERROR\", audit, strings.Join(s, \"\"), http.StatusNonAuthoritativeInfo, documentos\n }\n\n // Está todo Ok\n // ************\n return \"OK\", audit, \"Ok\", http.StatusOK, documentos\n}", "title": "" }, { "docid": "4488bc48d110b68ae7c64556b718a61e", "score": "0.5773066", "text": "func (e *Exec) Ok(res reflow.Result) {\n\tselect {\n\tcase <-e.err:\n\t\tpanic(\"error defined\")\n\tdefault:\n\t}\n\n\tselect {\n\tcase e.resultc <- ExecResult{Result: res}:\n\tdefault:\n\t\tpanic(\"result already set\")\n\t}\n}", "title": "" }, { "docid": "e044bc29fd08191eb7de6032661d9ae2", "score": "0.57372844", "text": "func (this *XiCiDaiLi) Result(response *http.Response) ([]contract.ProxyList, error) {\n doc, err := goquery.NewDocumentFromResponse(response)\n\n if err != nil {\n return nil, err\n }\n\n var proxyList []contract.ProxyList\n\n proxyTable := doc.Find(\"table#ip_list\")\n proxyRows := proxyTable.Find(\"tr:nth-child(n+2)\")\n\n proxyRows.Each(func(i int, s *goquery.Selection) {\n country := s.Find(\"td:nth-child(2) img\").AttrOr(\"alt\", \"n/a\")\n ip := s.Find(\"td:nth-child(3)\").Text()\n port := s.Find(\"td:nth-child(4)\").Text()\n protocol := s.Find(\"td:nth-child(7)\").Text()\n\n if ip != \"\" && port != \"\" {\n proxyList = append(proxyList, contract.ProxyList{\n Ip : ip,\n Port : port,\n Protocol: protocol,\n Country : strings.ToLower(country),\n })\n }\n })\n\n return proxyList, nil\n}", "title": "" }, { "docid": "4c80ff37b58c340f817b2da5836509ce", "score": "0.5727002", "text": "func (c *Context) Result(msg string, code int, params ...interface{}) {\n\tvar data interface{}\n\tlength := len(params)\n\n\tswitch length {\n\tcase 1:\n\t\tdata = params[0]\n\tcase 2:\n\t\tdata = params[0]\n\t\tif headers, ok := params[1].(map[string]string); ok {\n\t\t\tfor key, value := range headers {\n\t\t\t\tc.Header(key, value)\n\t\t\t}\n\t\t}\n\t}\n\n\tresponseError := errors.HttpResponseError{\n\t\tHTTPCode: 200,\n\t\tData: gin.H{\n\t\t\t\"msg\": msg,\n\t\t\t\"data\": data,\n\t\t\t\"code\": code,\n\t\t},\n\t\tMessage: msg,\n\t\tType: \"JSON\",\n\t}\n\tpanic(responseError)\n}", "title": "" }, { "docid": "ab23d1ad1f8881ae2819a8eef2c61d95", "score": "0.55085206", "text": "func (rs *ClubsResultSet) Err() error {\n\treturn rs.lastErr\n}", "title": "" }, { "docid": "237ffb7cd59f5047e2db0f0fa11a6b0f", "score": "0.5462778", "text": "func (e *errorEnvoltorio) obtenerUbicacion() (string, string, int) {\n\treturn e.paquete, e.archivo, e.linea\n}", "title": "" }, { "docid": "9f26fc81f75c9f13e7daf5957cc7336b", "score": "0.5436703", "text": "func (rs *CountriesResultSet) Err() error {\n\treturn rs.lastErr\n}", "title": "" }, { "docid": "2ee579328b5a379595ef8f28cdb1242a", "score": "0.54084706", "text": "func (rs *TestModelResultSet) Err() error {\n\treturn rs.lastErr\n}", "title": "" }, { "docid": "a72dcfb88341d2890da09636faa8652d", "score": "0.54079074", "text": "func (m *Militar) Consultar() (jSon []byte, err error) {\n\tvar militar Militar\n\tvar msj Mensaje\n\tc := sys.MGOSession.DB(sys.CBASE).C(sys.CMILITAR)\n\n\terr = c.Find(bson.M{\"id\": m.Persona.DatoBasico.Cedula}).One(&militar)\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\tmsj.Tipo = 0\n\t\tjSon, err = json.Marshal(msj)\n\t} else {\n\t\tif militar.Persona.DatoBasico.Cedula == \"\" {\n\t\t\tmsj.Tipo = 0\n\t\t\tjSon, err = json.Marshal(msj)\n\t\t} else {\n\t\t\tmilitar.AplicarReglas()\n\t\t\tjSon, err = json.Marshal(militar)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "2c30a4948714eda58d0272266cc9f0f5", "score": "0.53962713", "text": "func (r Response) toResult() (result common.KYCResult, err error) {\n\tif r.Content.Data.TotalHits == 0 {\n\t\tresult.Status = common.Approved\n\t\treturn\n\t}\n\n\treasons := []string{fmt.Sprintf(\"Search ID: %d\", r.Content.Data.ID)}\n\n\tfor _, h := range r.Content.Data.Hits {\n\t\tif h.Doc.EntityType != \"person\" {\n\t\t\tcontinue\n\t\t}\n\n\t\treasons = append(reasons, \"[Name: \"+h.Doc.Name+\"] Match types: \"+strings.Join(h.MatchTypes, \"|\"))\n\t}\n\n\tif len(reasons) == 1 {\n\t\treasons = append(reasons, \"Possible false positive. Please, inspect case details on the ComplyAdvantage site.\")\n\t}\n\n\tresult.Status = common.Denied\n\tresult.Details = &common.KYCDetails{\n\t\tReasons: reasons,\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "07385b5ce7564035432e96b05e323ad6", "score": "0.53687316", "text": "func FirstDbResult(w http.ResponseWriter, r *http.Request, p httprouter.Params) {\n res, err := FindFirstTest()\n if err != nil {\n http.Error(w, err.Error(), 500)\n return\n }\n rjson, err := json.Marshal(res)\n if err != nil {\n http.Error(w, err.Error(), 500)\n return\n }\n w.Header().Set(\"Content-Type\", \"application/json\")\n w.Write(rjson)\n}", "title": "" }, { "docid": "288acc4b460015cebd11d0f04cd24caf", "score": "0.53630686", "text": "func GetPreguntasxRespuesta() ([]Response) {\n\tdb := database.GetConnection()\n\n\tsizerows, err := db.Query(\"select count(*) from (select * from pregunta p inner join respuesta r on p.id = r.idp) as x\")\n\tvar count int\n\tvar limit int\n\tfor sizerows.Next() {\n\t\tsizerows.Scan(&count)\n\t\tfmt.Println(count)\n\t}\n\t\n\tdefer sizerows.Close()\t\n\n\trows, err := db.Query(\"SELECT * FROM pregunta p inner join respuesta r on p.id=r.idp\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer rows.Close()\n\n\tpregunta := Pregunta{}\n\tresponsejoin := ResponseJoin{}//encapsula pregunta y arreglo respuesta\n\tres := Response{} //encapsula arreglo responsejoin\n\tvar respuestasArray []Respuesta\n\t//var responsejoinArray []ResponseJoin\n\tvar resArray []Response\n\t\n\tfor rows.Next() {\n\n\t\trespuestas := Respuesta{}\n\n\t\tvar ID int\n\t\tvar nombrep string\n\t\tvar descripcionp string\n\t\tvar respuesta string\n\n\t\tvar IDS int\n\t\tvar answer string\n\t\tvar idp int\n\n\t\terr := rows.Scan(&ID,&nombrep,&descripcionp,&respuesta, &IDS, &answer, &idp)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tlimit++\n\t\tfmt.Println(\"limit\")\n\t\tfmt.Println(limit)\n\n\t\t//Llena Objecto Pregunta solo si no esta el id repetido,\n\t\t//es decir descarta filas de pregunta repetidas por el join\n\t\t//id 1 == ID 1\n\t\t//asigne valores Objeto Pregunta, Objecto respuesta\n\t\t//guarde objeto Respuesta en arreglo de respuesta\n\t\t\n\t\tif (pregunta.ID == ID || pregunta.ID == 0) && limit != count {\n\t\t\tfmt.Println(\"Pregunta repetida\")\n\t\t\tpregunta.ID = ID\n\t\t\tpregunta.NombreP = nombrep\n\t\t\tpregunta.DescripcionP = descripcionp\n\t\t\tpregunta.Respuesta = respuesta\n\n\t\t\t//Llenar arreglo de respuestas por esta pregunta\n\t\t\trespuestas.ID = IDS\n\t\t\trespuestas.Respuesta = answer\n\t\t\trespuestas.Idp = idp\n\n\t\t\trespuestasArray = append(respuestasArray, respuestas)\n\t\t}else if pregunta.ID != ID && limit == count {\n\t\t\tfmt.Println(\"Pregunta diferente y final\")\n\t\t\t//antes de borrar guardar esto dentro del empaquetador la clase responsejoin\n\t\t\tresponsejoin.Pregunta = pregunta\n\t\t\tresponsejoin.Respuestas = respuestasArray\n\t\t\t//despues guardar responsejoin en la clase empaquetadora res\n\t\t\tres.Array = responsejoin\n\t\t\t//despues guardar esto dentro de un arreglo de la clase Response\n\t\t\tresArray = append(resArray,res)\n\n\t\t\trespuestasArray = nil\n\n\t\t\tpregunta.ID = ID\n\t\t\tpregunta.NombreP = nombrep\n\t\t\tpregunta.DescripcionP = descripcionp\n\t\t\tpregunta.Respuesta = respuesta\n\n\t\t\t//Llenar arreglo de respuestas por esta pregunta\n\t\t\trespuestas.ID = IDS\n\t\t\trespuestas.Respuesta = answer\n\t\t\trespuestas.Idp = idp\n\t\t\tfmt.Println(\"hi\")\n\t\t\trespuestasArray = append(respuestasArray, respuestas)\n\n\t\t\t//si el ide de una pregunta es igual a la ultima posicion\n\t\t\t//entonces debo guardar todo en el arreglo\n\t\t\tresponsejoin.Pregunta = pregunta\n\t\t\tresponsejoin.Respuestas = respuestasArray\n\t\t\t//despues guardar responsejoin en la clase empaquetadora res\n\t\t\tres.Array = responsejoin\n\t\t\t//despues guardar esto dentro de un arreglo de la clase Response\n\t\t\tresArray = append(resArray,res)\n\t\t\t\n\t\t}else if pregunta.ID != ID && limit != count {\n\t\t\tfmt.Println(\"Pregunta diferente\")\n\t\t\t//////////////////\n\t\t\tresponsejoin.Pregunta = pregunta\n\t\t\tresponsejoin.Respuestas = respuestasArray\n\t\t\t//despues guardar responsejoin en la clase empaquetadora res\n\t\t\tres.Array = responsejoin\n\t\t\t//despues guardar esto dentro de un arreglo de la clase Response\n\t\t\tresArray = append(resArray,res)\n\n\t\t\trespuestasArray = nil\n\n\t\t\tpregunta.ID = ID\n\t\t\tpregunta.NombreP = nombrep\n\t\t\tpregunta.DescripcionP = descripcionp\n\t\t\tpregunta.Respuesta = respuesta\n\n\t\t\t//Llenar arreglo de respuestas por esta pregunta\n\t\t\trespuestas.ID = IDS\n\t\t\trespuestas.Respuesta = answer\n\t\t\trespuestas.Idp = idp\n\t\t\trespuestasArray = append(respuestasArray, respuestas)\n\t\t}else if limit == count {\n\t\t\tfmt.Println(\"pregunta final\")\n\t\t\t//si el ide de una pregunta es igual a la ultima posicion\n\t\t\t//entonces debo guardar todo en el arreglo\n\t\t\tresponsejoin.Pregunta = pregunta\n\t\t\tresponsejoin.Respuestas = respuestasArray\n\t\t\t//despues guardar responsejoin en la clase empaquetadora res\n\t\t\tres.Array = responsejoin\n\t\t\t//despues guardar esto dentro de un arreglo de la clase Response\n\t\t\tresArray = append(resArray,res)\n\t\t}\n\n\t}\n\n\treturn resArray\n}", "title": "" }, { "docid": "2860ba4b5cde6c7ed3412b9600a8daf7", "score": "0.5351174", "text": "func (api *OssApi) query(req *request, resp interface{}) error {\n\thresp, err := api.rawQuery(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif resp != nil {\n\t\terr = xml.NewDecoder(hresp.Body).Decode(resp)\n\t}\n\tdefer hresp.Body.Close()\n\treturn err\n}", "title": "" }, { "docid": "4250e1977322d3267b8d75aef79dbac8", "score": "0.53402287", "text": "func (e *Executor) Ok(f *flow.Flow, res interface{}) {\n\tswitch arg := res.(type) {\n\tcase reflow.Fileset:\n\t\te.Exec(f).Ok(reflow.Result{Fileset: arg})\n\tcase error:\n\t\te.Exec(f).Ok(reflow.Result{Err: errors.Recover(arg)})\n\tdefault:\n\t\tpanic(\"invalid result\")\n\t}\n}", "title": "" }, { "docid": "6c8a844348ebba73b270f5808f783d17", "score": "0.5333269", "text": "func (rs *RepositoryResultSet) Err() error {\n\treturn rs.lastErr\n}", "title": "" }, { "docid": "24f0c4ea8e78890853f84b3d19734c83", "score": "0.5327384", "text": "func ottoResult(call otto.FunctionCall, result any, err error) otto.Value {\n\tif err == nil {\n\t\tval, _ := call.Otto.ToValue(result)\n\t\treturn val\n\t} else {\n\t\t// (javaScriptRunner.convertError clumsily takes these apart back into errors)\n\t\tif status, msg := base.ErrorAsHTTPStatus(err); status != 500 && status != 200 {\n\t\t\tpanic(call.Otto.MakeCustomError(\"HTTP\", fmt.Sprintf(\"%d %s\", status, msg)))\n\t\t} else {\n\t\t\tpanic(call.Otto.MakeCustomError(\"Go\", err.Error()))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "00b5e2f4a8a078787bdcf6144e53ad7c", "score": "0.5317025", "text": "func (rs *RegistrationResultSet) Err() error {\n\treturn rs.lastErr\n}", "title": "" }, { "docid": "780b119ab325598037dfc73b6132423b", "score": "0.5305163", "text": "func tratarRetornoRequest(interf interface{}, statusCode int, metodo string, err error) (int, error) {\n\tstatusCodeValido := http.StatusOK\n\tif metodo == \"POST\" {\n\t\tstatusCodeValido = http.StatusCreated\n\t}\n\treqBody, err := json.Marshal(interf)\n\tif err != nil {\n\t\tmensagem := fmt.Sprintf(\"%s: %s\", \"Erro ao converter JSON para []Byte\", err)\n\t\tlogger.Erro.Println(mensagem)\n\t\treturn http.StatusInternalServerError, err\n\t}\n\n\tif statusCode != statusCodeValido {\n\t\topenshisftErro := OpenshiftErro{}\n\t\tjson.Unmarshal(reqBody, &openshisftErro)\n\n\t\tmensagem := fmt.Sprintf(\"Erro [%v]: %v - %s\", statusCode, openshisftErro.Code, openshisftErro.Message)\n\t\tlogger.Erro.Println(mensagem)\n\t\terr := errors.New(mensagem)\n\t\treturn statusCode, err\n\t}\n\n\treturn statusCode, nil\n}", "title": "" }, { "docid": "b932dfebfe02605ffeddc5d06a795bea", "score": "0.5298466", "text": "func sendResult(result interface{}) {\n\n\tenc := json.NewEncoder(os.Stdout)\n\tenc.SetIndent(\"\", \" \")\n\n\tswitch v := result.(type) {\n\tcase error:\n\t\t// wrap all errors with error object for json output\n\t\te := v.(error).Error()\n\t\tenc.Encode(model.ErrorResponse{e})\n\tdefault:\n\t\tenc.Encode(result)\n\t}\n\n}", "title": "" }, { "docid": "3824b5778b0f1772fffd7a3f7c8a5e12", "score": "0.5292229", "text": "func ResultHandeler(w http.ResponseWriter, req *http.Request) {\n\t//TODO: check to make sure it is a post with results in it\n\t//and sanatize it so people can't push arbitray stuff to the client\n\tfmt.Println(\"result request \", req.URL.Path)\n\tid := path.Base(req.URL.Path)\n\tval, ok := WsRegistry[id]\n\tif ok {\n\t\tselect {\n\t\tcase val <- req.FormValue(\"results\"):\n\n\t\tcase <-time.After(5 * time.Second):\n\t\t\tfmt.Println(\"timed out streaming to task \", id)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9f3ac6841930cd6f2c7c566ef4175974", "score": "0.524441", "text": "func (rs *PlayersResultSet) Err() error {\n\treturn rs.lastErr\n}", "title": "" }, { "docid": "0a8054cade5e03b5dc69b9beb77e8e2a", "score": "0.52184397", "text": "func (o *clientExec) Result(ctx context.Context) (reflow.Result, error) {\n\tcall := o.Call(\"GET\", \"allocs/%s/execs/%s/result\", o.allocID, o.id)\n\tdefer call.Close()\n\tcode, err := call.Do(ctx, nil)\n\tif err != nil {\n\t\treturn reflow.Result{}, errors.E(\"value\", o.URI(), err)\n\t}\n\tif code != http.StatusOK {\n\t\treturn reflow.Result{}, call.Error()\n\t}\n\tvar r reflow.Result\n\tif err := call.Unmarshal(&r); err != nil {\n\t\treturn reflow.Result{}, errors.E(\"value\", o.URI(), err)\n\t}\n\treturn r, nil\n}", "title": "" }, { "docid": "65c2fd5ed12f27c9ac88f10c78efac30", "score": "0.5216301", "text": "func (mysql *MySQLInstance) readResult() (*MySQLResponse, error) {\n\tif mysql == nil {\n\t\tpanic(\"mysql undefined\")\n\t}\n\tph, err := readHeader(mysql.reader)\n\tif err != nil {\n\t\treturn nil, errors.New(fmt.Sprintf(\"readHeader error: %s\", err))\n\t} else if ph.Len < 1 {\n\t\t// Junk?\n\t}\n\tresponse := new(MySQLResponse)\n\tresponse.EOF = false\n\tresponse.FieldCount, _, err = unpackFieldCount(mysql.reader)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresponse.mysql = mysql\n\n\tif response.FieldCount == 0xff { // ERROR\n\t\treturn nil, readErrorPacket(mysql.reader, int(ph.Len))\n\n\t} else if response.FieldCount == 0x00 { // OK\n\t\tmsg_len := int(ph.Len - 1)\n\t\teb, _, num, err := unpackLength(mysql.reader)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.AffectedRows = eb\n\t\tmsg_len -= num\n\t\teb, _, num, err = unpackLength(mysql.reader)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.InsertId = eb\n\t\tmsg_len -= num\n\t\terr = binary.Read(mysql.reader, binary.LittleEndian, &response.ServerStatus)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\terr = binary.Read(mysql.reader, binary.LittleEndian, &response.WarningCount)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tmsg_len -= 4\n\t\tmBuf := make([]byte, msg_len)\n\t\terr = readFull(mysql.reader, mBuf)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.Message = string(mBuf)\n\t} else if response.FieldCount > 0x00 && response.FieldCount < 0xFB { //Result|Field|Row Data\n\t\trs, err := mysql.readResultSet(uint64(response.FieldCount))\n\t\tresponse.ResultSet = rs\n\t\treturn response, err\n\n\t} else if response.FieldCount == 0xFE { // EOF\n\t\terr = binary.Read(mysql.reader, binary.LittleEndian, &response.ServerStatus)\n\t\terr = binary.Read(mysql.reader, binary.LittleEndian, &response.WarningCount)\n\t\tresponse.EOF = true\n\t\treturn response, err\n\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn response, nil\n}", "title": "" }, { "docid": "5869397d1cf7e968d4f2f7c2447f0728", "score": "0.5197346", "text": "func (bc *BController) Result(code int, data interface{}, message string) Struct {\n\treturn Struct{Code: code, Data: data, Message: message}\n}", "title": "" }, { "docid": "175644b7cc593be7d7b070d1154cea95", "score": "0.51877344", "text": "func (r *EmptyResult) Ok() {}", "title": "" }, { "docid": "07a46bc3e058fb80a3658ff2e6328955", "score": "0.5179148", "text": "func (p *postgresDBAccess) returnSingleDBResult(result sql.Result, err error) error {\n\tif err != nil {\n\t\tp.logger.Debug(err)\n\t\treturn err\n\t}\n\n\trowsAffected, resultErr := result.RowsAffected()\n\n\tif resultErr != nil {\n\t\tp.logger.Error(resultErr)\n\t\treturn resultErr\n\t}\n\n\tif rowsAffected == 0 {\n\t\tnoRowsErr := errors.New(\"database operation failed: no rows match given key and etag\")\n\t\tp.logger.Error(noRowsErr)\n\t\treturn noRowsErr\n\t}\n\n\tif rowsAffected > 1 {\n\t\ttooManyRowsErr := errors.New(\"database operation failed: more than one row affected, expected one\")\n\t\tp.logger.Error(tooManyRowsErr)\n\t\treturn tooManyRowsErr\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "34789fa9f442766a447ea94c436d5e9c", "score": "0.51672775", "text": "func AllDbResults(w http.ResponseWriter, r *http.Request, p httprouter.Params) {\n res, err := GetAllTests()\n if err != nil {\n http.Error(w, err.Error(), 500)\n return\n }\n rjson, err := json.Marshal(res)\n if err != nil {\n http.Error(w, err.Error(), 500)\n return\n }\n w.Header().Set(\"Content-Type\", \"application/json\")\n w.Write(rjson)\n}", "title": "" }, { "docid": "7150981f6d7d95d9a8bbc9ba091c9c38", "score": "0.5159892", "text": "func (future *DatabasesExportFuture) result(client DatabasesClient) (ieor ImportExportOperationResult, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"sql.DatabasesExportFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tieor.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"sql.DatabasesExportFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif ieor.Response.Response, err = future.GetResult(sender); err == nil && ieor.Response.Response.StatusCode != http.StatusNoContent {\n\t\tieor, err = client.ExportResponder(ieor.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"sql.DatabasesExportFuture\", \"Result\", ieor.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "b0a09581f0607521e6ca25943ef3850d", "score": "0.51543784", "text": "func ResultHandeler(w http.ResponseWriter, req *http.Request) {\n\t//TODO: check to make sure it is a post with results in it\n\t//and sanatize it so people can't push arbitray stuff to the client\n\tfmt.Println(\"result request \", req.URL.Path)\n\tid := path.Base(req.URL.Path)\n\n\tRegistryRWMutex.RLock()\n\tval, ok := WsRegistry[id]\n\tRegistryRWMutex.RUnlock()\n\n\tif ok {\n\t\tselect {\n\t\tcase val <- req.FormValue(\"results\"):\n\n\t\tcase <-time.After(5 * time.Second):\n\t\t\tfmt.Println(\"timed out streaming to user \", id)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4651c1f647d2001f6910535cdb6a5907", "score": "0.51472664", "text": "func (s *Service) Result(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tkey := r.FormValue(\"key\")\n\tres := &Response{\n\t\tSuccess: false,\n\t}\n\n\tfmt.Println(\"result: key\", key)\n\tif s.GetResult == nil {\n\t\tjson.NewEncoder(w).Encode(res)\n\t\treturn\n\t}\n\tplayers, balances := s.GetResult(key)\n\tbalancesString := []string{}\n\tfor _, balance := range balances {\n\t\tbalancesString = append(balancesString, balance.String())\n\t}\n\tres.Players = players\n\tres.Balances = balancesString\n\tres.Success = true\n\tjson.NewEncoder(w).Encode(res)\n}", "title": "" }, { "docid": "53042f567c9251a711f1c60e14f865c6", "score": "0.5147103", "text": "func results(w http.ResponseWriter, r *http.Request) {\n\n\tif len(r.URL.Query()) != 0 {\n\t\tvar data VariantData\n\t\trsidList := strings.Split(r.URL.Query()[\"variant\"][0], \",\")\n\t\tdata.Variant = r.URL.Query()[\"variant\"][0]\n\t\tdata.Pthr, _ = strconv.ParseFloat(config.Pthr, 64)\n\t\ttmppthr, err := strconv.ParseFloat(r.URL.Query()[\"pthr\"][0], 64)\n\t\tif err == nil {\n\t\t\tdata.Pthr = tmppthr\n\t\t}\n\t\tstart := time.Now()\n\t\tvariants, combinedvariants, genorecs := godb.Getallvardata(config.VcfPrfx, rsidList, getAssaytypes(), data.Pthr)\n\t\telapsed := time.Since(start)\n\t\tlog.Printf(\"res: dbaccess took %s\", elapsed)\n\t\tdata.DataList = variants\n\t\tdata.ComboDataList = combinedvariants\n\t\tphenoName := r.URL.Query()[\"pheno\"][0]\n\n\t\tif phenoName == \"None\" {\n\t\t\tt := template.Must(template.ParseFiles(\n\t\t\t\tconfig.Templates+\"/results.html\",\n\t\t\t\tconfig.Templates+\"/vartables.html\",\n\t\t\t\tconfig.Templates+\"/navigation.html\"))\n\t\t\tt.ExecuteTemplate(w, \"results\", data)\n\t\t} else {\n\t\t\tdata.PhenoName = phenoName\n\t\t\tphenoMeta := ehrdb.GetPhenoMetaByName(phenoName)\n\t\t\tdata.PhenoSource = phenoMeta.Source\n\t\t\tdata.PhenoDesc = phenoMeta.Description\n\t\t\tdata.PhenoClass = phenoMeta.PhenoClass\n\t\t\t// Get phenotype data from ehrdb\n\t\t\tphenoData, pCount := ehrdb.GetPhenoByName(phenoName)\n\t\t\tdata.PhenoCount = pCount\n\t\t\tphenoFileName := config.PhenofilePath + \"/\" + phenoName + \".csv\"\n\t\t\twriteBufferedFile(phenoFileName, convertStringMapToCSV(phenoData))\n\t\t\tgenoFileName := config.OutfilePath + \"/temp.vcf\"\n\t\t\twriteBufferedFile(genoFileName, genorecs)\n\t\t\tcmd := exec.Command(config.AssocBinaryCmd, genoFileName, phenoFileName)\n\t\t\tif data.PhenoClass != \"Binary\" {\n\t\t\t\tcmd = exec.Command(config.AssocCmd, genoFileName, phenoFileName)\n\t\t\t}\n\t\t\t//err = cmd.Run()\n\t\t\tres, err := cmd.Output()\n\t\t\tcheck(err)\n\t\t\tdata.AssocResults = assocReformat(string(res))\n\t\t\t//fmt.Printf(\"%s\\n\", \"combined\"+\"\\t\"+colhdr_str)\n\t\t\tt := template.Must(template.ParseFiles(\n\t\t\t\tconfig.Templates+\"/assocresults.html\",\n\t\t\t\tconfig.Templates+\"/vartables.html\",\n\t\t\t\tconfig.Templates+\"/navigation.html\"))\n\t\t\telapsed := time.Since(start)\n\t\t\tlog.Printf(\"res: dbaccess + assoctest took %s\", elapsed)\n\t\t\tt.ExecuteTemplate(w, \"assocresults\", data)\n\t\t}\n\t} else {\n\t\turl := []string{\"/index\"}\n\t\thttp.Redirect(w, r, strings.Join(url, \"\"), 302)\n\t}\n}", "title": "" }, { "docid": "dc17491129e822bba528a8b93330bd3a", "score": "0.5139353", "text": "func (r *Result) Err() error {\n\treturn <-r.err\n}", "title": "" }, { "docid": "407f71d42475d2d97eb20aac8de5e2c2", "score": "0.51371235", "text": "func (future *DatabasesImportFuture) result(client DatabasesClient) (ieor ImportExportOperationResult, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"sql.DatabasesImportFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tieor.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"sql.DatabasesImportFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif ieor.Response.Response, err = future.GetResult(sender); err == nil && ieor.Response.Response.StatusCode != http.StatusNoContent {\n\t\tieor, err = client.ImportResponder(ieor.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"sql.DatabasesImportFuture\", \"Result\", ieor.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "fe791d921cdee964b8d6a0b8f08c5f8d", "score": "0.5124747", "text": "func ListaSQLGormNativo(w http.ResponseWriter, r *http.Request) {\n\n\t// ua := r.Header.Get(\"TOKEN\")\n\t// fmt.Println(ua)\n\n\t//validando o acesso\n\tpassou, token := utils.ValidaAcesso(r.Header.Get(\"USUARIO\"), r.Header.Get(\"SENHA\"), r.Header.Get(\"TOKEN\"))\n\tif passou == false {\n\t\tfmt.Fprint(w, `{\"SITUACAO\" : \"RESTRICAO\", \"DS_SITUACAO\": \"USUARIO SEM ACESSO!\"}`)\n\t\treturn\n\t}\n\n\tprintln(token)\n\n\tvar p []empresasm.ResultadoNativo\n\tvar err error\n\n\tp, err = empresasm.ListaSQLGormNativo()\n\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t// w.Header().Set(\"Content-Type\", \"application/json\")\n\t\t// json.NewEncoder(w).Encode(\"erro\")\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tjson.NewEncoder(w).Encode(p)\n\n}", "title": "" }, { "docid": "03427de1e59da642fafd11281b2089d4", "score": "0.5095979", "text": "func (future *ServersImportDatabaseFuture) result(client ServersClient) (ieor ImportExportOperationResult, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"sql.ServersImportDatabaseFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tieor.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"sql.ServersImportDatabaseFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif ieor.Response.Response, err = future.GetResult(sender); err == nil && ieor.Response.Response.StatusCode != http.StatusNoContent {\n\t\tieor, err = client.ImportDatabaseResponder(ieor.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"sql.ServersImportDatabaseFuture\", \"Result\", ieor.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "bd8b22c7a0cacc7cbd0bdafceb5bcf94", "score": "0.5084474", "text": "func (g *GroupSet) Result(query *Query) (string, int, error) {\n\treturn g.limitedResult(query, query.Limit, \"\\t\", \" \", false)\n}", "title": "" }, { "docid": "b22c7f29b52841e0d612688924832775", "score": "0.5081937", "text": "func toResult(pID string, status model.StatusResponse) (res common.KYCResult, err error) {\n\tswitch status.CurrentStatus {\n\tcase model.New, model.InProgress:\n\t\tres.Status = common.Unclear\n\t\tres.StatusCheck = &common.KYCStatusCheck{\n\t\t\tProvider: common.Coinfirm,\n\t\t\tReferenceID: pID,\n\t\t\tLastCheck: time.Now(),\n\t\t}\n\tcase model.Incomplete:\n\t\terr = errors.New(\"data provided by participant is incomplete or does not meet the requirements set in KYC form\")\n\tcase model.Low, model.Medium:\n\t\tres.Status = common.Approved\n\tcase model.High, model.Fail:\n\t\ts := string(status.CurrentStatus)\n\t\tif status.CurrentStatus == model.Fail {\n\t\t\ts = \"unacceptable\"\n\t\t}\n\t\tres.Status = common.Denied\n\t\tres.Details = &common.KYCDetails{\n\t\t\tReasons: []string{\n\t\t\t\t\"Coinfirm analysts evaluated the risk associated to participant as \" + s,\n\t\t\t},\n\t\t}\n\tdefault:\n\t\terr = errors.New(\"unexpected status value: \" + string(status.CurrentStatus))\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "c608347a730e7bb03822cfb39c8ac75a", "score": "0.50729114", "text": "func perform() ([]byte, int) {\n\n\tcontinentData, err := continent.GetContinentData()\n\tif err != nil {\n\t\tapplogger.Log(\"ERROR\", \"continentct\", \"perform\", err.Error())\n\t\tstatsErrJSONBody, _ := merror.SimpeErrorResponseWithStatus(500, err)\n\t\treturn statsErrJSONBody, 500\n\t}\n\n\tjsonBody, jsonBodyErr := json.Marshal(continentData)\n\tif jsonBodyErr != nil {\n\t\tapplogger.Log(\"ERROR\", \"continentct\", \"perform\", jsonBodyErr.Error())\n\t\terrorJSONBody, _ := merror.SimpeErrorResponseWithStatus(500, jsonBodyErr)\n\t\treturn errorJSONBody, 500\n\t}\n\n\treturn jsonBody, 200\n}", "title": "" }, { "docid": "764658c9f6f84058629f6e91db12d41d", "score": "0.5036967", "text": "func (h *HttpClient) processResult(r io.ReadCloser, f func(flux.Table) error, mem memory.Allocator) error {\n\tconfig := csv.ResultDecoderConfig{Allocator: mem}\n\tdec := csv.NewMultiResultDecoder(config)\n\tresults, err := dec.Decode(r)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer results.Release()\n\n\tif !results.More() {\n\t\treturn nil\n\t}\n\tres := results.Next()\n\tif err := res.Tables().Do(f); err != nil {\n\t\treturn err\n\t}\n\tresults.Release()\n\treturn results.Err()\n}", "title": "" }, { "docid": "7cf86ad9a0a1245b103cb7d6b3c5672f", "score": "0.5035922", "text": "func (rs *LoginResultSet) Err() error {\n\treturn rs.lastErr\n}", "title": "" }, { "docid": "48bfe9d20b94d035604fbb28f9d97d56", "score": "0.5031682", "text": "func ListResults(w http.ResponseWriter, r *http.Request) {\n\tCheckSession(w, r)\n\t//recebendo a sessão para buscar url's por empresa/usuario\n\tsession, _ := Store.Get(r, \"logado\")\n\tid := session.Values[\"ID\"]\n\n\tsql := \"SELECT u.url, u.token, u.shortenURL FROM url as u WHERE u.company = ? ORDER BY u.id DESC \"\n\trows, err := cone.Db.Queryx(sql, id)\n\tif err != nil {\n\t\tlog.Fatal(err.Error())\n\t\treturn\n\t}\n\n\tdefer rows.Close()\n\t//dadosB := BrowserReferer{}\n\t//var browser []BrowserReferer\n\tdadosURL := ListaURL{}\n\tvar listURL []ListaURL\n\tfor rows.Next() {\n\n\t\terr := rows.StructScan(&dadosURL)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err.Error())\n\t\t}\n\t\tdadosURL.Count = CountClicks(dadosURL.Tkn)\n\t\tlistURL = append(listURL, ListaURL{dadosURL.URL, dadosURL.Tkn, dadosURL.Count, dadosURL.ShrtenURL})\n\t}\n\tlistURLData, err := json.Marshal(listURL)\n\tif err != nil {\n\t\tlog.Fatal(err.Error())\n\t\treturn\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.Write(listURLData)\n}", "title": "" }, { "docid": "0ec76e36fd15d9a17c024ab55c208704", "score": "0.5031036", "text": "func consultaCliente()( clientes []cliente, err error){\n\n\tsqlStatement := ` select *\nfrom client`\n\n\tdb := conectaBD()\n\tdefer db.Close()\n\n\trows, err := db.Query(sqlStatement)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer rows.Close()\n\n\tfor rows.Next(){\n\t\tc := cliente{}\n\t\tvar id, nombre, apell, dni, email string\n\t\tvar valid bool\n\t\terr = rows.Scan(\n\t\t\t&id,\n\t\t\t&nombre,\n\t\t\t&apell,\n\t\t\t&dni,\n\t\t\t&email,\n\t\t\t&valid,\n\t\t)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\n\t\tc.id = id\n\t\tc.nomb = nombre\n\t\tc.ape = apell\n\t\tc.dni = dni\n\t\tc.ema = email\n\t\tc.val = valid\n\n\t\tclientes = append(clientes, c)\n\t}\n\n\treturn clientes, nil\n}", "title": "" }, { "docid": "dbf197608712d3ba760bf30f249771ab", "score": "0.5028693", "text": "func (in *Interface) Result(o interface{}) {\n\tif in.Level.Is(LevelQuiet) {\n\t\treturn\n\t}\n\n\tin.mu.Lock()\n\tdefer in.mu.Unlock()\n\n\tif in.handler == nil {\n\t\treturn\n\t}\n\n\tin.handler.Result(o)\n}", "title": "" }, { "docid": "0e81bd6e3ebf72dbd54b08a010d63a20", "score": "0.50281423", "text": "func ConsultarCep(cep string) {\n\n\tfmt.Println(\"\")\n\tfmt.Println(\"### Iniciando consulta ###\")\n\tfmt.Println(\"\")\n\n\tendpoint := fmt.Sprintf(\"http://api.postmon.com.br/v1/cep/%s\", url.QueryEscape(cep))\n\n\treq, err := http.NewRequest(\"GET\", endpoint, nil)\n\tif err != nil {\n\t\tlog.Fatal(\"NewRequest: \", err)\n\t}\n\n\tclient := &http.Client{}\n\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tlog.Fatal(\"Do: \", err)\n\t}\n\n\tdefer resp.Body.Close()\n\n\t// Fill the record with the data from the JSON\n\tvar endereco Endereco\n\n\t// Use json.Decode for reading streams of JSON data\n\tif err := json.NewDecoder(resp.Body).Decode(&endereco); err != nil {\n\t\tlog.Println(err)\n\t}\n\n\tfmt.Println(\"Logradouro:\", endereco.Logradouro)\n\tfmt.Println(\"Bairro:\", endereco.Bairro)\n\tfmt.Println(\"Cidade:\", endereco.Cidade)\n\tfmt.Println(\"Estado:\", endereco.Estado)\n\tfmt.Println(\"\")\n\tfmt.Println(\"### Consulta finalizada ###\")\n\tfmt.Println(\"\")\n}", "title": "" }, { "docid": "687ac1cb33c4eebd53042d51eb84be87", "score": "0.5028033", "text": "func ObtenerImagenes(w http.ResponseWriter, r *http.Request) {\n\n\tID := r.URL.Query().Get(\"id\")\n\n\tvar result models.Imagenes\n\tvar status bool\n\n\tresult, status, _ = bd.ConsultoImagenes(ID)\n\tif status == false {\n\t\thttp.Error(w, \"Error al leer registro de imagenes\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusCreated)\n\tjson.NewEncoder(w).Encode(result)\n}", "title": "" }, { "docid": "148d6a2d2c3ca1c8a367c2701e47f495", "score": "0.50228477", "text": "func EnterResult(msgData []byte) {\n\tvar msg message.ResEnterResultMessage\n\terr := json.Unmarshal(msgData, &msg)\n\tif err != nil {\n\t\tlog.Println(\"Json decode error: \", err)\n\t\treturn\n\t}\n\tfmt.Println(msg.Result)\n}", "title": "" }, { "docid": "aef32b3ab799b6e477135fa1d8dfaaf2", "score": "0.5015476", "text": "func GetResultF(id int64) bool {\n\tvar sid int64\n\terr := db.QueryRow(\"select sid FROM smd_data WHERE RequestID = ?\", id).Scan(&sid)\n\tif err != nil {\n\t\tif err != sql.ErrNoRows {\n\t\t\t// a real error happened! you should change your function return\n\t\t\t// to \"(bool, error)\" and return \"false, err\" here\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "1d20c8f82a79dd1da90b96912d2457c1", "score": "0.50020427", "text": "func (br *batchResults) Exec() (pgconn.CommandTag, error) {\n\tif br.err != nil {\n\t\treturn nil, br.err\n\t}\n\n\tif !br.mrr.NextResult() {\n\t\terr := br.mrr.Close()\n\t\tif err == nil {\n\t\t\terr = errors.New(\"no result\")\n\t\t}\n\t\treturn nil, err\n\t}\n\n\treturn br.mrr.ResultReader().Close()\n}", "title": "" }, { "docid": "9c645a4ed39d061562a80274989fa42c", "score": "0.4999078", "text": "func (v *Corge_NoContentNoException_Result) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [0]string\n\ti := 0\n\n\treturn fmt.Sprintf(\"Corge_NoContentNoException_Result{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "e57c8f15758bac46cb0ca4bdf046ccc1", "score": "0.49819723", "text": "func (o *insertar) Ejecutar() error {\r\n\tvar sentencia, err = o.generarSQL()\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\r\n\tvar errEjec = errorNuevo()\r\n\t// verificar que los valores no se encuentren vacíos\r\n\tif len(o.valores) == 0 {\r\n\t\terrEjec.asignarMotivoValoresVacios()\r\n\t}\r\n\t// verificar que la cantidad de campos coincida con la cantidad de valores recibidos\r\n\tif len(o.campos) != len(o.valores) {\r\n\t\terrEjec.asignarMotivoCamposValoresDiferenteCantidad()\r\n\t}\r\n\tif len(errEjec.mensajes) != 0 {\r\n\t\treturn errEjec\r\n\t}\r\n\r\n\tvar res sql.Result\r\n\tif o.tx == nil {\r\n\t\t// ejecución fuera de una transacción\r\n\t\tres, err = o.bd.db.Exec(sentencia, o.valores...)\r\n\t} else {\r\n\t\t// ejecución dentro de una transacción\r\n\t\tres, err = o.tx.Exec(sentencia, o.valores...)\r\n\t}\r\n\tif err != nil {\r\n\t\treturn resolverErrorMysql(err)\r\n\t}\r\n\r\n\t// obtener el último id insertado\r\n\tif o.idPtr != nil {\r\n\t\tif *o.idPtr, err = res.LastInsertId(); err != nil {\r\n\t\t\treturn resolverErrorMysql(err)\r\n\t\t}\r\n\t}\r\n\r\n\treturn nil\r\n}", "title": "" }, { "docid": "6e2d37a4b4efeb0bfa265ae81d800960", "score": "0.49795204", "text": "func (c *selectMailbox) execute(sess *session) *response {\n\n\t// Is the user authenticated?\n\tif sess.st < authenticated {\n\t\treturn mustAuthenticate(sess, c.tag, \"SELECT\")\n\t}\n\n\t// Select the mailbox\n\tmbox := pathToSlice(c.mailbox)\n\texists, err := sess.selectMailbox(mbox)\n\n\tif err != nil {\n\t\treturn internalError(sess, c.tag, \"SELECT\", err)\n\t}\n\n\tif !exists {\n\t\treturn no(c.tag, \"SELECT No such mailbox\")\n\t}\n\n\t// Build a response that includes mailbox information\n\tres := ok(c.tag, \"[READ-WRITE] SELECT completed\")\n\n\terr = sess.addMailboxInfo(res)\n\n\tif err != nil {\n\t\treturn internalError(sess, c.tag, \"SELECT\", err)\n\t}\n\n\treturn res\n}", "title": "" }, { "docid": "b9757a39f0dc491acfc5e1997b3d8891", "score": "0.49706262", "text": "func goodLookupResult(t string, e int, a int) {\n\n\tsuccessEvent := map[string]string{}\n\tsuccessEvent[\"target\"] = t\n\tsuccessEvent[\"expectedAddressCount\"] = fmt.Sprint(e)\n\tsuccessEvent[\"actualAddressCount\"] = fmt.Sprint(a)\n\t// log the success\n\temitStructuredEvent(successEvent, 3)\n}", "title": "" }, { "docid": "c0277a5acdbdc79a2ed8f9aa58695842", "score": "0.4970358", "text": "func ObtenerAniosPedido(w http.ResponseWriter, r *http.Request){\n\tfmt.Println(\"devolviendo años \")\n\t//ListaAnios := *ArbolPedidos.ReturnProductsOfTree()\n\tfmt.Println(*ArbolPedidos.ReturnProductsOfTree())\n\tjson.NewEncoder(w).Encode(*ArbolPedidos.ReturnProductsOfTree())\n}", "title": "" }, { "docid": "c99367fd05c9ee0ac4b456147f4adb86", "score": "0.4968692", "text": "func (r *response) Result(result interface{}) Response {\n\treturn r.Data(currentKeyFormat.ResultKey, result)\n}", "title": "" }, { "docid": "1fe2c6ed809cd0eaacafa5634f8619b6", "score": "0.49683383", "text": "func (r *Result) Err() error {\n\treturn r.err\n}", "title": "" }, { "docid": "bb289505c397b97c4935f410d733a34f", "score": "0.49594015", "text": "func ViewUser(response http.ResponseWriter, request *http.Request) {\n\t//var results ResultForm\t\n\tvar errorResponse = ErrorResponse{\n\t\tCode: http.StatusInternalServerError, Message: \"Internal Server Error.\",\n\t}\n\n\tcollection := Client.Database(\"alqolamdb\").Collection(\"users\")\n\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\t\t\n\tshowInfoCursor, err := collection.Find(context.TODO(), bson.M{})\t\n\tresults := []bson.M{}\t\t\n\tif err = showInfoCursor.All(ctx, &results); err != nil {\n\t\tpanic(err)\n\t}\t\n\tdefer cancel()\t\n\n\tif err != nil {\n\t\terrorResponse.Message = \"Document not found\"\n\t\treturnErrorResponse(response, request, errorResponse)\n\t} else {\t\t\n\n\t\tvar successResponse = SuccessResponse{\n\t\t\tCode: http.StatusOK,\n\t\t\tMessage: \"Success\",\n\t\t\tResponse: results,\n\t\t}\n\n\t\tsuccessJSONResponse, jsonError := json.Marshal(successResponse)\n\n\t\tif jsonError != nil {\n\t\t\treturnErrorResponse(response, request, errorResponse)\n\t\t}\n\t\tresponse.Header().Set(\"Content-Type\", \"application/json\")\n\t\tresponse.Write(successJSONResponse)\n\t}\n}", "title": "" }, { "docid": "b8db4703d8a16db8cb591bd10de765be", "score": "0.49535933", "text": "func (d *Distinct) Err() error { return d.err }", "title": "" }, { "docid": "780e6edded59a8784f2b4858c458fba2", "score": "0.49485287", "text": "func resultHandler(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != \"POST\" {\n\t\tsendJSON(w, `{\"error\": \"method not allowed\"}`, http.StatusMethodNotAllowed)\n\t\treturn\n\t}\n\n\tparts := strings.Split(r.URL.Path, \"/\")\n\n\tif len(parts) != 6 {\n\t\tsendJSON(w, `{\"error\": \"page not found\"}`, http.StatusNotFound)\n\t\treturn\n\t}\n\n\tctx := appengine.NewContext(r)\n\tid := parts[5]\n\n\tf, fh, err := extractImage(r)\n\tif err != nil {\n\t\tsendError(w, err)\n\t}\n\n\toauthClient, err = google.DefaultClient(ctx, cloudkms.CloudPlatformScope)\n\tif err != nil {\n\t\tsendError(w, err)\n\t}\n\n\turl, err := saveToGCS(ctx, f, fh, fmt.Sprintf(\"%s-result\", id))\n\tif err != nil {\n\t\tsendError(w, err)\n\t\treturn\n\t}\n\n\tresult := &resultImageResponse{URL: url}\n\tresultJSON, err := json.Marshal(result)\n\n\tsendJSON(w, string(resultJSON), http.StatusOK)\n}", "title": "" }, { "docid": "8195c36c257074ae8b6107455e99ec4c", "score": "0.4935913", "text": "func getMhs(nim string) response {\n\tdb, salahe := koneksi()\n\tif salahe != nil {\n\t\treturn response{\n\t\t\tStatus: false,\n\t\t\tPesan: \"Gagal Koneksi: \" + salahe.Error(),\n\t\t\tData: []mahasiswa{},\n\t\t}\n\t}\n\tdefer db.Close()\n\n\tdataMhs, salahe := db.Query(\"select * from mahasiswa where nim=?\", nim)\n\tif salahe != nil {\n\t\treturn response{\n\t\t\tStatus: false,\n\t\t\tPesan: \"Gagal Query: \" + salahe.Error(),\n\t\t\tData: []mahasiswa{},\n\t\t}\n\t}\n\tdefer dataMhs.Close()\n\n\tvar hasil []mahasiswa\n\n\tfor dataMhs.Next() {\n\t\tvar mhs = mahasiswa{}\n\t\tvar salahe = dataMhs.Scan(&mhs.Nim, &mhs.Nama, &mhs.Progdi, &mhs.Smt)\n\n\t\tif salahe != nil {\n\t\t\treturn response{\n\t\t\t\tStatus: false,\n\t\t\t\tPesan: \"Gagal Baca: \" + salahe.Error(),\n\t\t\t\tData: []mahasiswa{},\n\t\t\t}\n\t\t}\n\n\t\thasil = append(hasil, mhs)\n\t}\n\n\tsalahe = dataMhs.Err()\n\n\tif salahe != nil {\n\t\treturn response{\n\t\t\tStatus: false,\n\t\t\tPesan: \"Kesalahan: \" + salahe.Error(),\n\t\t\tData: []mahasiswa{},\n\t\t}\n\t}\n\n\treturn response{\n\t\tStatus: true,\n\t\tPesan: \"Berhasil Tampil\",\n\t\tData: hasil,\n\t}\n\n}", "title": "" }, { "docid": "3eff7bb2979b5a6044f8ca31e3d05975", "score": "0.493137", "text": "func getAsynchResults(w http.ResponseWriter, jobID string) {\n\toutpStr, err := redisGetResults(jobID)\n\tif err != nil {\n\t\tpzsvc.HTTPOut(w, `{\"Errors\":\"`+err.Error()+`\" }`, http.StatusInternalServerError)\n\t}\n\n\tpzsvc.HTTPOut(w, outpStr, http.StatusOK)\n\n}", "title": "" }, { "docid": "49bc752563b5d84d850e80117fda35fd", "score": "0.49241945", "text": "func (e *errorEnvoltorio) obtenerMensaje() string {\n\treturn e.mensaje\n}", "title": "" }, { "docid": "f92c9924933f4f769d22a6355e7d33f0", "score": "0.49212044", "text": "func (show *TvShow) getExceptions() []ShowExceptions {\n altNames := []ShowExceptions{}\n o := orm.NewOrm()\n o.QueryTable(&ShowExceptions{}).Filter(\"tvdb_id\", show.TvdbId).All(&altNames)\n return altNames\n}", "title": "" }, { "docid": "db7c29e778110fce51137a156602836b", "score": "0.4921165", "text": "func getIAResponse(w http.ResponseWriter, r *http.Request) {\n\tnewurl, _ := url.QueryUnescape(r.URL.String())\n\tlog := r.RemoteAddr + newurl + \" \" + r.Method\n\twriteFile(log)\n\n\turlPart := strings.Split(newurl, \"/getiaresponse/\")\n\n\tfmt.Printf(\"Du site web : \\n%s\\n\", urlPart[1])\n\tIA := ia{}\n\ttxt := map[string]string{\"text\": urlPart[1]}\n\tjsonval, _ := json.Marshal(txt)\n\tvar jsonstr = []byte(jsonval)\n\n\tfmt.Printf(\"Vers l'ia : %s\\n\", jsonstr)\n\tresponse, err := http.NewRequest(\"POST\", \"http://163.5.220.30:5000/ia\", bytes.NewBuffer(jsonstr))\n\tcheckError(err)\n\n\tif err != nil {\n\t\tIA.Error = \"Connexion impossible à l'IA.\"\n\t} else {\n\t\tIA.Error = \"none\"\n\t}\n\n\tclient := &http.Client{}\n\tresp, _ := client.Do(response)\n\tbody, _ := ioutil.ReadAll(resp.Body)\n\n\tjson.Unmarshal(body, &IA)\n\n\tfmt.Printf(\"L'IA renvoie : \\n%s\\n\", string(body))\n\t//\td := json.NewDecoder()\n\t//d.Decode(&IA)\n\n\tjson.NewEncoder(w).Encode(IA)\n\n\t// Envoie la phrase au client\n\t// if con != nil {\n\t// \tn, err := con.Write([]byte(urlPart[1] + \"\\n\"))\n\n\t// \tfmt.Println(n)\n\t// \tif err != nil {\n\t// \t\tIA.Error = \"Connexion impossible à l'IA.\"\n\t// \t\tcon.Close()\n\t// \t} else {\n\t// \t\tIA.Error = \"none\"\n\t// \t}\n\t// } else {\n\t// \tIA.Error = \"Connexion impossible à l'IA.\"\n\t// \tcon.Close()\n\t// }\n\n\t// if con != nil {\n\t// \td := json.NewDecoder(con)\n\t// \td.Decode(&IA)\n\t// }\n\t// json.NewEncoder(w).Encode(IA)\n\t// con.Close()\n}", "title": "" }, { "docid": "fe74cc7d6260cf4dda495d0137ded977", "score": "0.49184155", "text": "func httpRet(head string, content interface{}, err error) (int, []byte) {\n\tvar ret httpListRet\n\tvar code int\n\n\tif err != nil {\n\t\tret.Message = head + \" fail\"\n\t\tret.Content = err.Error()\n\t\tcode = http.StatusBadRequest\n\t} else {\n\t\tret.Message = head\n\t\tret.Content = content\n\t\tcode = http.StatusOK\n\t}\n\n\tresult, _ := json.Marshal(ret)\n\treturn code, result\n}", "title": "" }, { "docid": "42aeeecfd934c9f4cab6581a48668be8", "score": "0.49171707", "text": "func (c StoreReindexIndexByIDFuncCall) Results() []interface{} {\n\treturn []interface{}{c.Result0}\n}", "title": "" }, { "docid": "fade2ca4667701fcc58d08197db210f4", "score": "0.49139434", "text": "func readResult(done chan bool) {\n for result := range results {\n fmt.Printf(\"Job id %d, input random no %d , sum of digits %d\\n\",\n result.job.id, result.job.randomNum, result.res)\n }\n done <- true\n}", "title": "" }, { "docid": "44031c75ebc7ab700b59f52885d773b9", "score": "0.49125797", "text": "func (g *GlobalGroupSet) Result(query *Query, rowsLimit int) (string, int, error) {\n\tg.semaphore <- struct{}{}\n\tdefer func() { <-g.semaphore }()\n\treturn g.GroupSet.Result(query, rowsLimit)\n}", "title": "" }, { "docid": "f16b54af40b5ed7682e37334e6fc0aed", "score": "0.49115378", "text": "func getResult(request events.APIGatewayProxyRequest, isInternal bool, iLimit int) (*bytes.Buffer, string, int, error) {\n\t// Unmarshal the json request.\n\tvar rBody requestBody\n\terr := json.Unmarshal([]byte(request.Body), &rBody)\n\tif err != nil {\n\t\treturn nil, \"\", http.StatusBadRequest, errors.New(\"Error occur while unmarshalling body-json value. Check your request.\")\n\t}\n\n\tstatus, err := checkLimit(len(rBody.Values), isInternal, iLimit)\n\tif err != nil {\n\t\treturn nil, \"\", status, err\n\t}\n\n\tif rType == \"url\" {\n\t\tswitch format {\n\t\tcase \"excel\":\n\t\t\tf, status, err := getExcelResultForURLs(rBody)\n\t\t\treturn f, \"\", status, err\n\t\tcase \"sheet\":\n\t\t\tsheetURL, status, err := getSheetResultForURLs(rBody)\n\t\t\treturn nil, sheetURL, status, err\n\t\tdefault:\n\t\t\treturn nil, \"\", http.StatusBadRequest, errors.New(\"Format must be \\\"excel\\\" or \\\"sheet\\\"\")\n\t\t}\n\t} else if isInternal && rType == \"keyword\" {\n\t\tswitch format {\n\t\tcase \"excel\":\n\t\t\tf, status, err := getExcelResultForKeywords(rBody)\n\t\t\treturn f, \"\", status, err\n\t\tcase \"sheet\":\n\t\t\tsheetURL, status, err := getSheetResultForKeywords(rBody)\n\t\t\treturn nil, sheetURL, status, err\n\t\tdefault:\n\t\t\treturn nil, \"\", http.StatusBadRequest, errors.New(\"Format must be \\\"excel\\\" or \\\"sheet\\\"\")\n\t\t}\n\t} else {\n\t\terrText := \"Type must be \\\"url\\\".\"\n\t\tif isInternal {\n\t\t\terrText = \"Type must be \\\"url\\\" or \\\"keyword\\\".\"\n\t\t}\n\t\treturn nil, \"\", http.StatusBadRequest, errors.New(errText)\n\t}\n}", "title": "" }, { "docid": "ac5dd8997ee6c47ef93d88289e005e3c", "score": "0.49092263", "text": "func GetResponse(pid int) string {\n\tdb, err := sql.Open(sqlDriver, userDataPath)\n\tif err != nil {\n\t\tlog.Print(err)\n\t\treturn \"G101\"\n\t}\n\tdefer func() {\n\t\t_ = db.Close()\n\t}()\n\tvar result Responses\n\tstmtPost, err := db.Prepare(`SELECT uid,createtime,content FROM posts WHERE id = ?`)\n\tif err != nil {\n\t\tlog.Print(err)\n\t\treturn \"G102\"\n\t}\n\tdefer func() {\n\t\t_ = stmtPost.Close()\n\t}()\n\tvar uid int\n\tvar createtime, content string\n\terr = stmtPost.QueryRow(pid).Scan(&uid, &createtime, &content)\n\tif err != nil {\n\t\tlog.Print(err)\n\t\treturn \"G104\"\n\t}\n\ttheUserName := GetUserName(uid)\n\tif theUserName == \"@\" {\n\t\treturn \"Unknown Error\"\n\t} else if theUserName == \"!\" {\n\t\treturn \"G103\"\n\t}\n\tresult.Uid = uid\n\tresult.Username = theUserName\n\tresult.Createtime = createtime\n\tresult.Content = content\n\n\tstmtUsername, err := db.Prepare(`SELECT uid,createtime,content FROM response WHERE pid = ?`)\n\tif err != nil {\n\t\tlog.Print(err)\n\t\treturn \"G102\"\n\t}\n\tdefer func() {\n\t\t_ = stmtUsername.Close()\n\t}()\n\trows, err := stmtUsername.Query(pid)\n\tif err == sql.ErrNoRows {\n\t\tres, err := json.Marshal(result)\n\t\tif err != nil {\n\t\t\tlog.Print(err)\n\t\t\treturn \"G105\"\n\t\t}\n\t\treturn string(res)\n\t} else if err != nil {\n\t\tlog.Print(err)\n\t\treturn \"G103\"\n\t}\n\n\tdefer rows.Close()\n\tisNotEmpty := false\n\tfor rows.Next() {\n\t\tisNotEmpty = true\n\t\tvar uid int\n\t\tvar createtime, content string\n\t\terr = rows.Scan(&uid, &createtime, &content)\n\t\tif err != nil {\n\t\t\tlog.Print(err)\n\t\t\treturn \"Unkonwn Error\"\n\t\t}\n\t\ttheUserName := GetUserName(uid)\n\t\tif theUserName == \"@\" {\n\t\t\treturn \"Unknown Error\"\n\t\t} else if theUserName == \"!\" {\n\t\t\treturn \"G103\"\n\t\t}\n\t\tresult.Response = append(result.Response, Response{Uid: uid, Username: theUserName, Createtime: createtime, Content: content})\n\t}\n\tif !isNotEmpty {\n\t\tres, err := json.Marshal(result)\n\t\tif err != nil {\n\t\t\tlog.Print(err)\n\t\t\treturn \"G105\"\n\t\t}\n\t\treturn string(res)\n\t}\n\terr = rows.Err()\n\tif err != nil {\n\t\tlog.Print(err)\n\t\treturn \"Unkonwn Error\"\n\t}\n\n\tres, err := json.Marshal(result)\n\tif err != nil {\n\t\tlog.Print(err)\n\t\treturn \"G105\"\n\t}\n\treturn string(res)\n}", "title": "" }, { "docid": "dc4f8a2c0b2ff1225f5fac75483d438a", "score": "0.4908379", "text": "func getEmailVerif(w http.ResponseWriter, req *http.Request) {\n\tcanCrud := true\n\t//Declare data to return\n\ttype ReturnMessage struct {\n\t\tTheErr []string `json:\"TheErr\"`\n\t\tResultMsg []string `json:\"ResultMsg\"`\n\t\tSuccOrFail int `json:\"SuccOrFail\"`\n\t\tReturnedEmailVerify EmailVerify `json:\"ReturnedEmailVerify\"`\n\t}\n\ttheReturnMessage := ReturnMessage{}\n\ttheReturnMessage.SuccOrFail = 0 //Initially set to success\n\n\t//Unwrap from JSON\n\tbs, err := ioutil.ReadAll(req.Body)\n\tif err != nil {\n\t\ttheErr := \"Error reading the request from updateLearnOrg: \" + err.Error() + \"\\n\" + string(bs)\n\t\ttheReturnMessage.ResultMsg = append(theReturnMessage.ResultMsg, theErr)\n\t\ttheReturnMessage.TheErr = append(theReturnMessage.TheErr, theErr)\n\t\ttheReturnMessage.SuccOrFail = 1\n\t\tlogWriter(theErr)\n\t\tfmt.Println(theErr)\n\t\tcanCrud = false\n\t}\n\n\t//Decalre JSON we recieve\n\ttype EmailVerifID struct {\n\t\tTheEmailVerifID int `json:\"TheEmailVerifID\"`\n\t}\n\n\t//Marshal it into our type\n\tvar theEmailVerifGet EmailVerifID\n\tjson.Unmarshal(bs, &theEmailVerifGet)\n\n\t//If we successfully decoded, (and the Email Verif is not 0) we can get our Email Verification\n\tif canCrud && theEmailVerifGet.TheEmailVerifID > 0 {\n\t\t/* Find the Email Verif with the given ID */\n\t\tvar theEmailVerifReturned EmailVerify //Initialize value to be returned\n\t\tcollection := mongoClient.Database(\"learnR\").Collection(\"emailverifs\") //Here's our collection\n\t\ttheFilter := bson.M{\n\t\t\t\"id\": bson.M{\n\t\t\t\t\"$eq\": theEmailVerifGet.TheEmailVerifID, // check if bool field has value of 'false'\n\t\t\t},\n\t\t}\n\t\tfindOptions := options.Find()\n\t\tfind, err := collection.Find(theContext, theFilter, findOptions)\n\t\ttheFind := 0 //A counter to track how many users we find\n\t\tif find.Err() != nil || err != nil {\n\t\t\tif strings.Contains(err.Error(), \"no documents in result\") {\n\t\t\t\tstringUserID := strconv.Itoa(theEmailVerifGet.TheEmailVerifID)\n\t\t\t\treturnedErr := \"For \" + stringUserID + \", no Email Verify was returned: \" + err.Error()\n\t\t\t\tfmt.Println(returnedErr)\n\t\t\t\tlogWriter(returnedErr)\n\t\t\t\ttheReturnMessage.SuccOrFail = 1\n\t\t\t\ttheReturnMessage.ResultMsg = append(theReturnMessage.ResultMsg, returnedErr)\n\t\t\t\ttheReturnMessage.TheErr = append(theReturnMessage.TheErr, returnedErr)\n\t\t\t\ttheReturnMessage.ReturnedEmailVerify = EmailVerify{}\n\t\t\t} else {\n\t\t\t\tstringUserID := strconv.Itoa(theEmailVerifGet.TheEmailVerifID)\n\t\t\t\treturnedErr := \"For \" + stringUserID + \", there was a Mongo Error: \" + err.Error()\n\t\t\t\tfmt.Println(returnedErr)\n\t\t\t\tlogWriter(returnedErr)\n\t\t\t\ttheReturnMessage.SuccOrFail = 1\n\t\t\t\ttheReturnMessage.ResultMsg = append(theReturnMessage.ResultMsg, returnedErr)\n\t\t\t\ttheReturnMessage.TheErr = append(theReturnMessage.TheErr, returnedErr)\n\t\t\t\ttheReturnMessage.ReturnedEmailVerify = EmailVerify{}\n\t\t\t}\n\t\t} else {\n\t\t\t//Found EmailVerif, decode to return\n\t\t\tfor find.Next(theContext) {\n\t\t\t\tstringUserID := strconv.Itoa(theEmailVerifGet.TheEmailVerifID)\n\t\t\t\terr := find.Decode(&theEmailVerifReturned)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturnedErr := \"For \" + stringUserID +\n\t\t\t\t\t\t\", there was an error decoding document from Mongo: \" + err.Error()\n\t\t\t\t\tfmt.Println(returnedErr)\n\t\t\t\t\tlogWriter(returnedErr)\n\t\t\t\t\ttheReturnMessage.SuccOrFail = 1\n\t\t\t\t\ttheReturnMessage.ResultMsg = append(theReturnMessage.ResultMsg, returnedErr)\n\t\t\t\t\ttheReturnMessage.TheErr = append(theReturnMessage.TheErr, returnedErr)\n\t\t\t\t\ttheReturnMessage.ReturnedEmailVerify = EmailVerify{}\n\t\t\t\t} else if theEmailVerifReturned.ID <= 1 {\n\t\t\t\t\treturnedErr := \"For \" + stringUserID +\n\t\t\t\t\t\t\", there was an no document from Mongo: \" + err.Error()\n\t\t\t\t\tfmt.Println(returnedErr)\n\t\t\t\t\tlogWriter(returnedErr)\n\t\t\t\t\ttheReturnMessage.SuccOrFail = 1\n\t\t\t\t\ttheReturnMessage.ResultMsg = append(theReturnMessage.ResultMsg, returnedErr)\n\t\t\t\t\ttheReturnMessage.TheErr = append(theReturnMessage.TheErr, returnedErr)\n\t\t\t\t\ttheReturnMessage.ReturnedEmailVerify = EmailVerify{}\n\t\t\t\t} else {\n\t\t\t\t\t//Successful decode, do nothing\n\t\t\t\t}\n\t\t\t\ttheFind = theFind + 1\n\t\t\t}\n\t\t\tfind.Close(theContext)\n\t\t}\n\n\t\tif theFind <= 0 {\n\t\t\t//Error, return an error back and log it\n\t\t\tstringUserID := strconv.Itoa(theEmailVerifGet.TheEmailVerifID)\n\t\t\treturnedErr := \"For \" + stringUserID +\n\t\t\t\t\", No Email Verify was returned.\"\n\t\t\tlogWriter(returnedErr)\n\t\t\ttheReturnMessage.SuccOrFail = 1\n\t\t\ttheReturnMessage.ResultMsg = append(theReturnMessage.ResultMsg, returnedErr)\n\t\t\ttheReturnMessage.TheErr = append(theReturnMessage.TheErr, returnedErr)\n\t\t\ttheReturnMessage.ReturnedEmailVerify = EmailVerify{}\n\t\t} else {\n\t\t\t//Success, log the success and return User\n\t\t\tstringUserID := strconv.Itoa(theEmailVerifGet.TheEmailVerifID)\n\t\t\treturnedErr := \"For \" + stringUserID +\n\t\t\t\t\", Email Verify should be successfully decoded.\"\n\t\t\t//fmt.Println(returnedErr)\n\t\t\tlogWriter(returnedErr)\n\t\t\ttheReturnMessage.SuccOrFail = 0\n\t\t\ttheReturnMessage.ResultMsg = append(theReturnMessage.ResultMsg, returnedErr)\n\t\t\ttheReturnMessage.TheErr = append(theReturnMessage.TheErr, \"\")\n\t\t\ttheReturnMessage.ReturnedEmailVerify = theEmailVerifReturned\n\t\t}\n\t} else {\n\t\t//Error, return an error back and log it\n\t\tstringUserID := strconv.Itoa(theEmailVerifGet.TheEmailVerifID)\n\t\treturnedErr := \"For \" + stringUserID +\n\t\t\t\", No Email Verify was returned. Email Verify was also not accepted: \" + stringUserID\n\t\tlogWriter(returnedErr)\n\t\ttheReturnMessage.SuccOrFail = 1\n\t\ttheReturnMessage.ResultMsg = append(theReturnMessage.ResultMsg, returnedErr)\n\t\ttheReturnMessage.TheErr = append(theReturnMessage.TheErr, returnedErr)\n\t\ttheReturnMessage.ReturnedEmailVerify = EmailVerify{}\n\t}\n\n\t//Format the JSON map for returning our results\n\ttheJSONMessage, err := json.Marshal(theReturnMessage)\n\t//Send the response back\n\tif err != nil {\n\t\terrIs := \"Error formatting JSON for return in getUser: \" + err.Error()\n\t\tlogWriter(errIs)\n\t}\n\tfmt.Fprint(w, string(theJSONMessage))\n}", "title": "" }, { "docid": "55d7e5aa229a8d1d279b27c82765ab63", "score": "0.4899169", "text": "func (r *MySQLRequest) performQuery() Response {\n\tlogreport.Printf(\"Params are %v\", r.Parameters)\n\n\tif r.conn == nil {\n\t\treturn NewSQLErrorResponse(errors.New(\"nil database connection\"), \"nil database connection\")\n\t}\n\n\tq, err := r.conn.Preparex(r.Query)\n\tif q != nil {\n\t\tdefer q.Close()\n\t}\n\n\tif err != nil {\n\t\treturn NewSQLErrorResponse(err, \"failed to prepare SQL query\")\n\t}\n\n\trows, err := q.Queryx(r.Parameters...)\n\tif rows != nil {\n\t\tdefer rows.Close()\n\t}\n\n\tif err != nil {\n\t\treturn NewSQLErrorResponse(err, \"failed to execute SQL query\")\n\t}\n\n\tvar dataRows []map[string]interface{}\n\n\tfor rowNum := 0; rows.Next(); rowNum++ {\n\t\tnewMap := make(map[string]interface{})\n\n\t\terr = rows.MapScan(newMap)\n\t\tif err != nil {\n\t\t\treturn NewSQLErrorResponse(err, \"failed to extract results of SQL query\")\n\t\t}\n\n\t\tdataRows = append(dataRows, newMap)\n\t}\n\n\terr = rows.Err()\n\tif err != nil {\n\t\treturn NewSQLErrorResponse(err, \"failed to iterate over rows in SQL query response\")\n\t}\n\n\treturn &sqlResponse{Data: dataRows}\n}", "title": "" }, { "docid": "77907ee3eb0bd12508a5a5fd79cb8e6a", "score": "0.48964867", "text": "func (c AutoIndexingServiceGetIndexByIDFuncCall) Results() []interface{} {\n\treturn []interface{}{c.Result0, c.Result1, c.Result2}\n}", "title": "" }, { "docid": "3bed0d783e169e1bfb965c2c48a402bc", "score": "0.4890034", "text": "func (me *MultiError) Result() error {\n\tif len(me.errors) == 0 {\n\t\treturn nil\n\t}\n\treturn me\n}", "title": "" }, { "docid": "8c526738d6249813e03dfe52a45d8e95", "score": "0.48767987", "text": "func TestHandler_Query_MergeEmptyResults(t *testing.T) {\n\th := NewHandler(false)\n\th.StatementExecutor.ExecuteStatementFn = func(stmt influxql.Statement, ctx *influxql.ExecutionContext) error {\n\t\tctx.Results <- &influxql.Result{StatementID: 1, Series: models.Rows{}}\n\t\tctx.Results <- &influxql.Result{StatementID: 1, Series: models.Rows([]*models.Row{{Name: \"series1\"}})}\n\t\treturn nil\n\t}\n\n\tw := httptest.NewRecorder()\n\th.ServeHTTP(w, MustNewJSONRequest(\"GET\", \"/query?db=foo&q=SELECT+*+FROM+bar\", nil))\n\tif w.Code != http.StatusOK {\n\t\tt.Fatalf(\"unexpected status: %d\", w.Code)\n\t} else if w.Body.String() != `{\"results\":[{\"series\":[{\"name\":\"series1\"}]}]}` {\n\t\tt.Fatalf(\"unexpected body: %s\", w.Body.String())\n\t}\n}", "title": "" }, { "docid": "8dc0cc33263031758d2b2f2e12066ce2", "score": "0.48764074", "text": "func BuscarEnElastic(texto string) *elastic.SearchResult {\n\ttextoTilde, textoQuotes := MoGeneral.ConstruirCadenas(texto)\n\n\tqueryTilde := elastic.NewQueryStringQuery(textoTilde)\n\tqueryQuotes := elastic.NewQueryStringQuery(textoQuotes)\n\n\tqueryTilde = queryTilde.Field(\"IDExpresion\")\n\tqueryQuotes = queryQuotes.Field(\"IDExpresion\")\n\n\tqueryTilde = queryTilde.Field(\"Clase\")\n\tqueryQuotes = queryQuotes.Field(\"Clase\")\n\n\tqueryTilde = queryTilde.Field(\"Expresion\")\n\tqueryQuotes = queryQuotes.Field(\"Expresion\")\n\n\tvar docs *elastic.SearchResult\n\t// var err bool\n\n\t// docs, err = MoConexion.BuscaElastic(MoVar.TipoExpresion, queryTilde)\n\t// if err {\n\t// \tfmt.Println(\"No Match 1st Try\")\n\t// }\n\n\t// if docs.Hits.TotalHits == 0 {\n\t// \tdocs, err = MoConexion.BuscaElastic(MoVar.TipoExpresion, queryQuotes)\n\t// \tif err {\n\t// \t\tfmt.Println(\"No Match 2nd Try\")\n\t// \t}\n\t// }\n\n\treturn docs\n}", "title": "" }, { "docid": "f8c77c298787556a02f33f13c2acb3c8", "score": "0.4874862", "text": "func getTudo(w http.ResponseWriter, db *sql.DB, s string) {\n\tcols := []string{\"*\"}\n\tcond := []string{\"none\"}\n\tstr, err := GetDados(db, s, cols, cond)\n\tif err != nil {\n\t\tbadRequest(w)\n\t\treturn\n\t}\n\ttoJSON(str, w)\n}", "title": "" }, { "docid": "11e33b3f0bccc6086a55b0ab1ed3770f", "score": "0.48748264", "text": "func searchByIdResponseGet(sReq *SearchRequest, ids []string) (SearchIdResponse, error) {\n\tvar ch SearchIdResponse\n\n\tfmt.Println(\"searchByIdResponseGet start...\\n\")\n\n\t//Fill the id, req might not have ID\n\tch.ID = \"ekstep.content.find\"\n\t//Fill the version, req might not have ID (may be api version)\n\tch.Ver = 3.0\n\t//TODO: Fill the timestamp\n\n\t//redData is \"request:\" data in the body\n\tvar err error\n\tvar reqData CommonUtilPageSectionsSearch\n\treqData = sReq.Request\n\tlog.Printf(\"%s\", toJson(reqData))\n\n\t//docs, err := SearchStandardQuery(&reqData)\n\tdocs, err := SearchEcarByIdentifier(ids)\n\tif err != nil {\n\t\tfmt.Println(\"Error to serve standard search...\")\n\t\treturn ch, err\n\t}\n\n\tch.Result.Content = docs\n\t//for _, d := range docs {\n\t//\tch.Result.Content = append(ch.Result.Content, d)\n\t//\tch.Result.Count++\n\t//}\n\n\t//TODO: Fill the \"params:\"\n\tch.Params.Resmsgid = UUIDGet()\n\t//\tch.Params.Msgid = \"ff305d54-85b4-341b-da2f-eb6b9e5460fa\"\n\tch.Params.Status = \"successful\"\n\t//\tch.Params.Err = \"\"\n\t//\tch.Params.Errmsg = \"\"\n\n\tch.ResponseCode = \"OK\"\n\n\treturn ch, err\n}", "title": "" }, { "docid": "890ca78fb5780067714b6ee99e07c96e", "score": "0.4873704", "text": "func returnOne(c <-chan Result) (any bool, firstOffset uint32, e error) {\n\tif result, ok := <-c; ok {\n\t\tif result.Error == nil {\n\t\t\tif _, ok = <-c; ok {\n\t\t\t\tpanic(\"got more than one result\")\n\t\t\t}\n\t\t\treturn true, result.Offset, nil\n\t\t} else {\n\t\t\tif _, ok = <-c; ok {\n\t\t\t\tpanic(\"got more than one result\")\n\t\t\t}\n\t\t\treturn false, result.Offset, result.Error\n\t\t}\n\t}\n\treturn false, 0, nil\n}", "title": "" }, { "docid": "d3a2069c762ef70016ccd45c3951210d", "score": "0.4868781", "text": "func queryDB(clnt client.Client, cmd string) (res []client.Result, err error) {\n q := client.Query{\n Command: cmd,\n Database: MyDB,\n }\n if response, err := clnt.Query(q); err == nil {\n if response.Error() != nil {\n return res, response.Error()\n }\n res = response.Results\n }\n return res, nil\n}", "title": "" }, { "docid": "7f86de66d980c0ed3c7523948ed78785", "score": "0.48650053", "text": "func TestHandler_Query_MergeResults(t *testing.T) {\n\th := NewHandler(false)\n\th.StatementExecutor.ExecuteStatementFn = func(stmt influxql.Statement, ctx *influxql.ExecutionContext) error {\n\t\tctx.Results <- &influxql.Result{StatementID: 1, Series: models.Rows([]*models.Row{{Name: \"series0\"}})}\n\t\tctx.Results <- &influxql.Result{StatementID: 1, Series: models.Rows([]*models.Row{{Name: \"series1\"}})}\n\t\treturn nil\n\t}\n\n\tw := httptest.NewRecorder()\n\th.ServeHTTP(w, MustNewJSONRequest(\"GET\", \"/query?db=foo&q=SELECT+*+FROM+bar\", nil))\n\tif w.Code != http.StatusOK {\n\t\tt.Fatalf(\"unexpected status: %d\", w.Code)\n\t} else if w.Body.String() != `{\"results\":[{\"series\":[{\"name\":\"series0\"},{\"name\":\"series1\"}]}]}` {\n\t\tt.Fatalf(\"unexpected body: %s\", w.Body.String())\n\t}\n}", "title": "" }, { "docid": "5cb4054dacddfd86f026ef15af0bca3a", "score": "0.4852935", "text": "func (ac *AzureClient) Result(ctx context.Context, future azureautorest.FutureAPI, futureType string) (result interface{}, err error) {\n\t// Result is a no-op for resource groups as only Delete operations return a future.\n\treturn nil, nil\n}", "title": "" }, { "docid": "5384a4f6bdfe83db4cded72e88a6a8fb", "score": "0.4849036", "text": "func (dao *AmigosDAO) EnviarSolicitudAmistad(u Usuario, amigo string) mensajes.JsonData {\n\tvar idAmigo int\n\tvar numSolicitudes int\n\n\t// Comprobar si el usuario al que se le quiere enviar la solicitud existe\n\terr := dao.bd.QueryRow(obtenerIdUsuario, amigo).Scan(&idAmigo)\n\tif err == sql.ErrNoRows {\n\t\treturn mensajes.ErrorJson(\"No existe ningún usuario con el nombre indicado\",\n\t\t\tmensajes.ErrorPeticion)\n\t}\n\tif err != nil {\n\t\treturn mensajes.ErrorJson(err.Error(), mensajes.ErrorPeticion)\n\t}\n\n\tid1 := min(u.Id, idAmigo)\n\tid2 := max(u.Id, idAmigo)\n\n\t// Comprobar si los usuarios no son amigos ya\n\terr = dao.bd.QueryRow(consultaAmistad, id1, id2).Scan(&id1)\n\tif err == nil {\n\t\treturn mensajes.ErrorJson(\"Los usuarios ya son amigos\", mensajes.ErrorPeticion)\n\t}\n\tif err != sql.ErrNoRows {\n\t\treturn mensajes.ErrorJson(err.Error(), mensajes.ErrorPeticion)\n\t}\n\n\t// Comprobar si existe una solicitud de amistad del otro usuario\n\terr = dao.bd.QueryRow(consultarSolicitudAmistad, idAmigo, u.Id).Scan(&numSolicitudes)\n\tif err != nil {\n\t\treturn mensajes.ErrorJson(err.Error(), mensajes.ErrorPeticion)\n\t}\n\tif numSolicitudes == 0 {\n\t\t// No había solicitud previa, enviar la nueva\n\t\t// Guardar en la base de datos que se ha enviado la solicitud\n\t\t_, err = dao.bd.Exec(solicitarAmistad, u.Id, idAmigo)\n\t\tif err != nil {\n\t\t\tif e, ok := err.(*pq.Error); ok {\n\t\t\t\tif e.Code.Name() == violacionUnicidad {\n\t\t\t\t\tif strings.Contains(e.Error(), \"solicitudamistad_pkey\") {\n\t\t\t\t\t\treturn mensajes.ErrorJson(\"Ya has enviado una solicitud de \"+\n\t\t\t\t\t\t\t\"amistad a este usuario\", mensajes.ErrorPeticion)\n\t\t\t\t\t}\n\t\t\t\t} else if e.Code.Name() == violacionRestricciones {\n\t\t\t\t\tif strings.Contains(e.Error(), \"solicitudamistad_check\") {\n\t\t\t\t\t\treturn mensajes.ErrorJson(\"No puedes enviarte una solicitud\"+\n\t\t\t\t\t\t\t\" de amistad a ti mismo\", mensajes.ErrorPeticion)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn mensajes.ErrorJson(err.Error(), mensajes.ErrorPeticion)\n\t\t}\n\t} else {\n\t\t// Había solicitud previa, aceptarla\n\t\treturn dao.AceptarSolicitudAmistad(u, idAmigo)\n\t}\n\n\treturn mensajes.ErrorJson(\"\", mensajes.NoError)\n}", "title": "" }, { "docid": "d38274948795884387ce63d308a16e6e", "score": "0.48486984", "text": "func (tk *TestKit) QueryToErr(sql string, args ...interface{}) error {\n\tcomment := fmt.Sprintf(\"sql:%s, args:%v\", sql, args)\n\tres, err := tk.Exec(sql, args...)\n\ttk.require.NoError(err, comment)\n\ttk.require.NotNil(res, comment)\n\t_, resErr := session.GetRows4Test(context.Background(), tk.session, res)\n\ttk.require.NoError(res.Close())\n\treturn resErr\n}", "title": "" }, { "docid": "bcab9e0808c5877d07ba8382677be329", "score": "0.4843244", "text": "func (e *Exec) Result(ctx context.Context) (reflow.Result, error) {\n\tr, err := e.result(ctx)\n\treturn r.Result, err\n}", "title": "" }, { "docid": "892ba877c560f8a7051dfbf4e40d5a5f", "score": "0.48416728", "text": "func (c *Cursor) Err() error { return c.err }", "title": "" }, { "docid": "4f00a9399a3794efd1b5d4f302e7b8f7", "score": "0.48377395", "text": "func (p Pessoas) retornaInfo() string {\n\n\treturn fmt.Sprintf(\"Nome: %s Idade: %d\", p.Nome, p.Idade)\n\n}", "title": "" }, { "docid": "a19c0637343399865f9fcf8a8754854c", "score": "0.48374507", "text": "func (a *account) sendResult(result error, waiting int) {\n\tfor i := 0; i < waiting; i++ {\n\t\tpersistResult := a.persistResults[i]\n\t\terr := errors.AddContext(result, ErrAccountPersist.Error())\n\t\tpersistResult.externErr = err\n\t\tclose(persistResult.errAvail)\n\t}\n\ta.persistResults = a.persistResults[waiting:]\n}", "title": "" }, { "docid": "96242e5ff5f07a2c62fb7c3125b71793", "score": "0.4832386", "text": "func response(w http.ResponseWriter, status int, results User) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(200)\n\tjson.NewEncoder(w).Encode(results)\n}", "title": "" }, { "docid": "0e4f441a30b4be1a53e020caa777fc90", "score": "0.48313934", "text": "func sendResultJSON(res []CardInfo, w http.ResponseWriter,\n\tsearchCache *SearchCache, query *SearchQuery) {\n\t// Add result to cache.\n\tsearchCache.AddResult(query.Query, res)\n\ttotalResults := len(res)\n\t// Set headers (cors and json)\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\") // TODO: do without \"*\"?\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\tif len(res) == 0 {\n\t\tjson.NewEncoder(w).Encode(QueryResult{\n\t\t\tResults: []CardInfo{},\n\t\t\tCount: 0,\n\t\t\tTotal: 0,\n\t\t})\n\t\treturn\n\t}\n\t// Slice result to get page we require.\n\tif query.Page*query.PageSize > (len(res) - 1) {\n\t\thttp.Error(w, \"Page size too high.\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tlastIndex := (query.Page * query.PageSize) + query.PageSize\n\tif lastIndex > (len(res) - 1) {\n\t\tlastIndex = len(res) - 1\n\t}\n\tres = res[query.Page*query.PageSize : lastIndex]\n\tres = HighlightCards(res)\n\t// Add some metadata to the result for the UI.\n\toutput := QueryResult{\n\t\tResults: res,\n\t\tCount: len(res),\n\t\tTotal: totalResults,\n\t}\n\tjson.NewEncoder(w).Encode(output)\n}", "title": "" }, { "docid": "152baa2a6d6e3c6126895a9fc21a705b", "score": "0.483088", "text": "func streamExistingResult(psr tlsmodel.PersistedScanRequest,\n\tcallback func(progress int, result []tlsmodel.HumanScanResult, narrative string)) {\n\tdbDir := filepath.Join(baseScanDBDirectory, psr.Request.Day, psr.Request.ScanID)\n\topts := badger.DefaultOptions(dbDir)\n\topts.Logger = myLogger\n\topts.ReadOnly = true\n\tdb, err := badger.Open(opts)\n\tif err != nil {\n\t\tlog.Print(err)\n\t\treturn\n\t}\n\tdefer db.Close()\n\n\thostResults := make(map[string][]tlsmodel.ScanResult)\n\ttotal := 0\n\tfor _, gs := range psr.GroupedHosts {\n\t\ttotal += len(gs.Hosts)\n\t}\n\n\tposition := 0\n\n\tdb.View(func(txn *badger.Txn) error {\n\n\t\topts := badger.DefaultIteratorOptions\n\t\topts.PrefetchSize = 100\n\t\tit := txn.NewIterator(opts)\n\t\tdefer it.Close()\n\n\t\tfor it.Rewind(); it.Valid(); it.Next() {\n\t\t\titem := it.Item()\n\t\t\thost := string(item.Key())\n\t\t\tif _, present := hostResults[host]; !present {\n\t\t\t\tres, err := item.ValueCopy(nil)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tresult, err := tlsmodel.UnmarsharlScanResult(res)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tposition++\n\t\t\t\tnarrative := fmt.Sprintf(\"Finished scan of %s. Progress %f%% %d hosts of a total of %d in %f seconds\\n\",\n\t\t\t\t\thost, 100*float32(position)/float32(total), position, total, time.Since(psr.ScanStart).Seconds())\n\t\t\t\tcallback(position, result, narrative)\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n\n}", "title": "" }, { "docid": "79d0f6e994c2af486b9ac2af8b952ed3", "score": "0.48304158", "text": "func (sit *seriesIterator) Err() error { return nil }", "title": "" }, { "docid": "932b4303e529a0d0513ffcbb510497c8", "score": "0.48273176", "text": "func (c AutoIndexingServiceGetUnsafeDBFuncCall) Results() []interface{} {\n\treturn []interface{}{c.Result0}\n}", "title": "" }, { "docid": "7eebd2560ee78518f208701fe5d21097", "score": "0.48168173", "text": "func (tk *TestKit) QueryToErr(sql string, args ...interface{}) error {\n\tcomment := check.Commentf(\"sql:%s, args:%v\", sql, args)\n\tres, err := tk.Exec(sql, args...)\n\ttk.c.Assert(errors.ErrorStack(err), check.Equals, \"\", comment)\n\ttk.c.Assert(res, check.NotNil, comment)\n\t_, resErr := session.GetRows4Test(context.Background(), tk.Se, res)\n\ttk.c.Assert(res.Close(), check.IsNil)\n\treturn resErr\n}", "title": "" }, { "docid": "aa957e0a51ef10ae44c5910cb45d6223", "score": "0.48117426", "text": "func (v *Corge_NoContentOnException_Result) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [2]string\n\ti := 0\n\tif v.Success != nil {\n\t\tfields[i] = fmt.Sprintf(\"Success: %v\", v.Success)\n\t\ti++\n\t}\n\tif v.NotModified != nil {\n\t\tfields[i] = fmt.Sprintf(\"NotModified: %v\", v.NotModified)\n\t\ti++\n\t}\n\n\treturn fmt.Sprintf(\"Corge_NoContentOnException_Result{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "21797f7cd5b52c101a644d40eca134f1", "score": "0.48111603", "text": "func (ctx *SearchV4Context) OK(r []*MeMakotiaMatsuyaV4) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "title": "" }, { "docid": "f8fa1aecbce666982a71d53c66efadf6", "score": "0.48082632", "text": "func (it *dummyIterator) Err() error { return nil }", "title": "" }, { "docid": "b010a5f76f84e1ab8a077c39658491cc", "score": "0.48056197", "text": "func (ev *Internal) Result() error {\n\tfor atomic.CompareAndSwapUint32(&ev.complete, 1, 1) {\n\t\tif atomic.CompareAndSwapUint32(&ev.complete, 2, 2) {\n\t\t\treturn ev.err\n\t\t}\n\t}\n\t<-ev.ch\n\n\treturn ev.err\n}", "title": "" }, { "docid": "ce923ca988ab26daae6145bfa0a0c3d8", "score": "0.48041874", "text": "func (r *Row) Err() error {\n return r.err\n}", "title": "" }, { "docid": "2f9956ab9b6590059ca6b7cc791ed409", "score": "0.48019138", "text": "func (res *resultContainer) render(w http.ResponseWriter) {\n\tif res == nil {\n\t\tres = &resultContainer{\n\t\t\tStatus: http.StatusInternalServerError,\n\t\t\tSuccess: false,\n\t\t\tMessage: \"Some internal error occurred\",\n\t\t\tComments: nil,\n\t\t}\n\t}\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\tif res.Status == 0 {\n\t\tres.Status = 200\n\t}\n\tw.WriteHeader(res.Status)\n\n\tjson, err := json.Marshal(res)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tw.Write([]byte(`{\"Success\":false,\"Message\":\"Internal Server Error\"}`))\n\t\treturn\n\t}\n\tw.Write(json)\n}", "title": "" }, { "docid": "019627e57231356d8c4a964ba0e2f20b", "score": "0.47996432", "text": "func (c StoreInsertIndexesFuncCall) Results() []interface{} {\n\treturn []interface{}{c.Result0, c.Result1}\n}", "title": "" } ]
a683431afe070276606ca4cf00c987ec
Heartbeat delegates to the next hook function in the queue and stores the parameter and result values of this invocation.
[ { "docid": "8f1fc0e0d56fc3a6d7b702b7c74c6f9c", "score": "0.59341186", "text": "func (m *MockClient) Heartbeat(v0 context.Context, v1 []int) error {\n\tr0 := m.HeartbeatFunc.nextHook()(v0, v1)\n\tm.HeartbeatFunc.appendCall(ClientHeartbeatFuncCall{v0, v1, r0})\n\treturn r0\n}", "title": "" } ]
[ { "docid": "791cddc633ea71a921a3a19162187ec4", "score": "0.63621753", "text": "func (this *DefaultLoopHandler) OnHeartbeat() {\n log.Debug(\"OnHeartbeat\")\n}", "title": "" }, { "docid": "f3696c84ed5e8678d5ae72ea2f7d87b6", "score": "0.5964642", "text": "func (m *MockWorkerStore) Heartbeat(v0 context.Context, v1 []int, v2 store.HeartbeatOptions) ([]int, error) {\n\tr0, r1 := m.HeartbeatFunc.nextHook()(v0, v1, v2)\n\tm.HeartbeatFunc.appendCall(WorkerStoreHeartbeatFuncCall{v0, v1, v2, r0, r1})\n\treturn r0, r1\n}", "title": "" }, { "docid": "03209b997147d6c0e5c1d61ebe9fcdcf", "score": "0.5783149", "text": "func (f *WorkerStoreHeartbeatFunc) PushHook(hook func(context.Context, []int, store.HeartbeatOptions) ([]int, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "e323d85d768d3c00c73a15a75afe56e3", "score": "0.56094915", "text": "func (c *LiveConnection) OnHeartbeat(cb LiveListener) { c.On(HeartbeatResponse, cb) }", "title": "" }, { "docid": "d604600a5bd7efb903a1b429f0b9a416", "score": "0.5569977", "text": "func (f *ClientHeartbeatFunc) PushHook(hook func(context.Context, []int) error) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "fdc2fbf26eb22c8c9746cb4a3f1124e0", "score": "0.556835", "text": "func dispatchHeartbeats() {\n for PID := range heartbeats {\n if _, ok := self.MemberMap[PID]; !ok {\n config.LogIf(\n fmt.Sprintf(\"[HEARTBEATERR] Tried heartbeating to dead node [PID=%d].\", PID),\n config.C.LogHeartbeats,\n )\n return\n } else {\n go func(PID int) {\n config.LogIf(\n fmt.Sprintf(\"[TERM=%d] [HEARTBEAT->]: to [PID=%d]\", raft.CurrentTerm, PID),\n config.C.LogHeartbeatsLead,\n )\n r := CallAppendEntries(PID, raft.GetAppendEntriesArgs(&self))\n if !r.Success && r.Error == responses.MISSINGLOGENTRY {\n config.LogIf(fmt.Sprintf(\"[RETRYAPPENDENTRY] [PID=%d]\", PID), config.C.LogConflictingEntries)\n r = appendEntriesUntilSuccess(raft, PID)\n }\n config.LogIf(\n fmt.Sprintf(\"[TERM=%d] [HEARTBEAT->]: DONE FROM [PID=%d]\", raft.CurrentTerm, PID),\n (config.C.LogHeartbeatsLead && r.Error != responses.CONNERROR),\n )\n }(PID)\n }\n }\n\n}", "title": "" }, { "docid": "aa3c572cc35dbac9c8bee56d89a699fd", "score": "0.55313444", "text": "func (c *Common) Heartbeat(ctx context.Context, status func() sdk.MonitoringStatus, cfg interface{}) error {\n\t// no heartbeat for api\n\tif c.Type == \"api\" {\n\t\treturn nil\n\t}\n\n\tticker := time.NewTicker(30 * time.Second)\n\n\tvar cancel context.CancelFunc\n\tctx, cancel = context.WithCancel(ctx)\n\tdefer cancel()\n\n\tvar heartbeatFailures int\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn ctx.Err()\n\t\tcase <-ticker.C:\n\t\t\t// try to register, on success reset the failure count\n\t\t\tif err := c.Register(status, cfg); err != nil {\n\t\t\t\theartbeatFailures++\n\t\t\t\tlog.Error(\"%s> Heartbeat> Register failed %d/%d\", c.Name,\n\t\t\t\t\theartbeatFailures, c.MaxHeartbeatFailures)\n\t\t\t} else {\n\t\t\t\theartbeatFailures = 0\n\t\t\t}\n\n\t\t\t// if register failed too many time, stop heartbeat\n\t\t\tif heartbeatFailures > c.MaxHeartbeatFailures {\n\t\t\t\treturn fmt.Errorf(\"%s> Heartbeat> Register failed excedeed\", c.Name)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "58452e400537471922479b01fa88a1e5", "score": "0.55001426", "text": "func (r *Raft) handleHeartbeat(m pb.Message) {\n\t// Your Code Here (2A).\n\tif r.State != StateFollower {\n\t\t//log.Panicf(\"Node %v got %v\", r.id, m)\n\t\tr.becomeFollower(m.Term, m.From)\n\t}\n\n\tr.Lead = m.From\n\n\tr.electionElapsed = 0\n\tr.Lead = m.From\n\tr.send(pb.Message{\n\t\tTo: m.From,\n\t\tMsgType: pb.MessageType_MsgHeartbeatResponse,\n\t})\n}", "title": "" }, { "docid": "53e9bc0a68ed3b259dfc08d582b0b98b", "score": "0.53836703", "text": "func (rf *Raft) doHeartbeat() {\n\tfmt.Println(\"doHeartBeat @:\", rf.me)\n\tfor index := range rf.peers {\n\t\tif index == rf.me {\n\t\t\tgo func() {\n\t\t\t\theartbeatTimer := time.NewTimer(RaftHeartbeatPeriod)\n\t\t\t\tfor rf.role == Leader {\n\t\t\t\t\trf.chanHeartbeat <- true\n\t\t\t\t\trf.updateLeaderCommit()\n\t\t\t\t\theartbeatTimer.Reset(RaftHeartbeatPeriod)\n\t\t\t\t\t<-heartbeatTimer.C\n\t\t\t\t}\n\t\t\t}()\n\t\t} else {\n\t\t\tgo func(server int) {\n\t\t\t\theartbeatTimer := time.NewTimer(RaftHeartbeatPeriod)\n\t\t\t\tfor rf.role == Leader {\n\t\t\t\t\trf.doAppendEntries(server)\n\t\t\t\t\theartbeatTimer.Reset(RaftHeartbeatPeriod)\n\t\t\t\t\t<-heartbeatTimer.C\n\t\t\t\t}\n\t\t\t}(index)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "bca2b8e724f4154e2dcb9b6b5bd4fccb", "score": "0.53195214", "text": "func (f *WorkerStoreHeartbeatFunc) PushReturn(r0 []int, r1 error) {\n\tf.PushHook(func(context.Context, []int, store.HeartbeatOptions) ([]int, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "b01ff5442650286ed03944289c8cef96", "score": "0.52979136", "text": "func (m *ThetafdModule) onHeartbeat(senderID int) {\n\tm.Vector[senderID] = 0\n\tfor idx := range m.Vector {\n\t\tif idx == senderID || idx == m.ID {\n\t\t\tm.Vector[idx] = 0\n\t\t} else {\n\t\t\tm.Vector[idx]++\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ec8c85caf19cd126caca8fb5dc7b625c", "score": "0.52372044", "text": "func tickHeartbeat() {\n\tmemberStore_.lock.Lock()\n\tmemberStore_.members[memberStore_.position].Heartbeat++\n\tif memberStore_.members[memberStore_.position].Heartbeat%5 == 0 {\n\t\tkvstore.PrintKVStoreSize()\n\t}\n\tmemberStore_.lock.Unlock()\n}", "title": "" }, { "docid": "8bc78194b1612dbbc3bc1049131ce137", "score": "0.5229709", "text": "func (r *Raft) tick() {\n\t// Your Code Here (2A).\n\tif r.State == StateLeader {\n\t\tr.heartbeatElapsed++\n\t\tr.electionElapsed++\n\t\tif r.electionTimeout >= r.electionTimeout && r.IsMember(r.leadTransferee) {\n\t\t\tlog.Infof(\"Aborting leader ship transfer %v -> %v\", r.id, r.leadTransferee)\n\t\t\tr.abortLeaderTransfer()\n\t\t}\n\t\tif r.heartbeatElapsed >= r.heartbeatTimeout {\n\t\t\tr.broadcastHeartBeat()\n\t\t\tr.heartbeatElapsed = 0\n\t\t}\n\t} else {\n\t\tr.electionElapsed++\n\t\tif r.electionElapsed >= r.electionTimeout {\n\t\t\tif r.Lead != None {\n\t\t\t\tlog.Errorf(\"!!Node %v lost leader %v, campagining\", r.id, r.Lead)\n\t\t\t}\n\t\t\tr.Step(pb.Message{MsgType: pb.MessageType_MsgHup})\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7d507a5957d343db322321c0c959b9ec", "score": "0.5213169", "text": "func (rf *Raft) heartbeat() {\n\tDPrintf(\"%v starts broadcasting heartbeat\", rf)\n\n\tsendTerm := rf.currentTerm\n\n\tfor server := range rf.peers {\n\t\tif server == rf.me {\n\t\t\tcontinue\n\t\t}\n\n\t\t// send every entry not being replicated\n\t\tnextIndex := rf.nextIndex[server]\n\t\tprevLogIndex := nextIndex - 1\n\t\tprevLogTerm := rf.log[prevLogIndex].Term\n\n\t\t// in case of race condition\n\t\tentries := make([]LogEntry, len(rf.log)-nextIndex)\n\t\tcopy(entries, rf.log[nextIndex:])\n\t\targs := &AppendEntriesArgs{\n\t\t\tTerm: rf.currentTerm,\n\t\t\tLeaderId: rf.me,\n\t\t\tPrevLogIndex: prevLogIndex,\n\t\t\tPrevLogTerm: prevLogTerm,\n\t\t\tEntries: entries,\n\t\t\tLeaderCommit: rf.commitIndex,\n\t\t}\n\n\t\treply := &AppendEntriesReply{}\n\n\t\t//\n\t\t// Leader handles a AppendEntries reply\n\t\t//\n\t\thandler := func(server int, args *AppendEntriesArgs, reply *AppendEntriesReply) {\n\t\t\trf.lock(\"Raft.heartbeat().AppendEntriesReplyHandler()\")\n\t\t\tdefer rf.unlock(\"Raft.heartbeat().AppendEntriesReplyHandler()\")\n\n\t\t\t// if message has been delayed, discard this replay\n\t\t\tif rf.currentTerm > sendTerm || rf.state != Leader {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// better leader has been elected, go back to Follower\n\t\t\tif reply.Term > rf.currentTerm {\n\t\t\t\tDPrintf(\"%v knows a better leader has been elected and goes back to [%v]\", rf, stateName[Follower])\n\t\t\t\trf.convertToFollower(reply.Term)\n\t\t\t\trf.persist()\n\t\t\t\trf.resetElectionTimer()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif reply.Success {\n\t\t\t\trf.matchIndex[server] = max(rf.matchIndex[server], args.PrevLogIndex+len(args.Entries))\n\t\t\t\trf.nextIndex[server] = rf.matchIndex[server] + 1\n\n\t\t\t\tDPrintf(\"%v gets a success AppendEntries reply from (%v) and sets its nextIndex to %v\", rf, server, rf.nextIndex[server])\n\n\t\t\t\t// update commitIndex, n^2 solution\n\t\t\t\tfor index := rf.lastLogIndex(); index > rf.commitIndex; index-- {\n\t\t\t\t\t// Figure 8\n\t\t\t\t\tif rf.log[index].Term != rf.currentTerm {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\n\t\t\t\t\tcnt := 0\n\t\t\t\t\tfor _, matched := range rf.matchIndex {\n\t\t\t\t\t\tif matched >= index {\n\t\t\t\t\t\t\tcnt++\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif rf.isMajority(cnt) {\n\t\t\t\t\t\trf.applyEntries(index)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t//rf.nextIndex[server]--\n\t\t\t\trf.nextIndex[server] = max(rf.nextIndex[server]-1, rf.matchIndex[server]+1)\n\t\t\t\t//rf.nextIndex[server] = reply.ConflictIndex\n\t\t\t\t//rf.nextIndex[server] = max(min(rf.nextIndex[server]-1, reply.ConflictIndex), rf.matchIndex[server]+1)\n\t\t\t\tDPrintf(\"%v gets a fail AppendEntries reply from (%v) and sets its nextIndex to %v\", rf, server, rf.nextIndex[server])\n\t\t\t}\n\t\t}\n\n\t\trf.unlock(\"Raft.heartbeat()\")\n\t\tgo func(server int) {\n\t\t\tif rf.sendAppendEntries(server, args, reply) {\n\t\t\t\thandler(server, args, reply)\n\t\t\t}\n\t\t}(server)\n\t\trf.lock(\"Raft.heartbeat()\")\n\t}\n}", "title": "" }, { "docid": "347133216bac68714231df23d343b028", "score": "0.5190973", "text": "func (c *Consumer) runHeartbeat(ctx context.Context) {\n\tdefer c.processes.Done()\n\n\tc.opts.Logger.Debug(\"Heartbeat: process starting\")\n\tdefer c.opts.Logger.Debug(\"Heartbeat: process finished\")\n\n\tticker := time.NewTicker(c.opts.HeartbeatPollInterval)\n\tdefer ticker.Stop()\n\n\tattempts := 0\n\tfor {\n\t\tif ctx.Err() != nil {\n\t\t\treturn\n\t\t}\n\n\t\tc.opts.Logger.Debug(\"Heartbeat: updating consumer...\")\n\t\terr := c.registerConsumer()\n\t\tif err != nil {\n\t\t\tattempts++\n\t\t\tc.opts.Logger.Warn(\"Heartbeat: failed to update\", \"attempt\", attempts, \"error\", err)\n\t\t\tc.backoff(ctx, \"Heartbeat\", attempts, c.opts.HeartbeatMaxBackoff, c.opts.HeartbeatMaxAttempts)\n\t\t\tcontinue\n\t\t} else {\n\t\t\tattempts = 0\n\t\t\tc.opts.Logger.Debug(\"Heartbeat: update successful\")\n\t\t}\n\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\t\tcase <-ticker.C:\n\t\t\tcontinue\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0ef0f136472e2f0e53ce3fc3ad533715", "score": "0.51479197", "text": "func (f *ClientHeartbeatFunc) PushReturn(r0 error) {\n\tf.PushHook(func(context.Context, []int) error {\n\t\treturn r0\n\t})\n}", "title": "" }, { "docid": "2197c3e33c42e2f8cde31e010511fe65", "score": "0.5135124", "text": "func (rf *Raft) heartbeatTicker(ctx *Context) {\n\tfor !rf.killed() {\n\t\trf.mu.Lock()\n\t\tif ctx.IsCancelled() || rf.role != Leader {\n\t\t\trf.mu.Unlock()\n\t\t\treturn\n\t\t}\n\t\trf.heartbeat()\n\t\trf.mu.Unlock()\n\t\ttime.Sleep(HEARTBEAT_INTERVAL)\n\t}\n}", "title": "" }, { "docid": "782ca1e22a30e9df3d0f6bbb6be70ffa", "score": "0.51329595", "text": "func heartbeat(c echo.Context) error {\n\tlogging.Logger.Info(\"Heartbeat hit\")\n\treturn c.String(200, \"ok\")\n}", "title": "" }, { "docid": "b7de644ebc780815f2cd4e05153165a0", "score": "0.502015", "text": "func (f *WorkerStoreResetStalledFunc) PushHook(hook func(context.Context) (map[int]time.Duration, map[int]time.Duration, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "99914ce9e09690a6e330293b57081a24", "score": "0.5018883", "text": "func (pb *PBServer) tick() {\n // Your code here.\n pb.mu.Lock()\n defer pb.mu.Unlock()\n\n v, err := pb.vs.Ping(pb.view.Viewnum)\n if err == nil {\n\t if pb.me == v.Primary && v.Backup != \"\" && v.Backup != pb.view.Backup {\n\t\t //args_init := &InitArgs{pb.key_value, pb.view.Primary}\n\t\t //reply_init := InitReply{}\n\t\t //ok := call(v.Backup, \"PBServer.Init\", args_init, &reply_init)\n\t\t //if !ok || reply_init.Err != OK {\n\t\t //\tfmt.Printf(\"%v\", ok)\n\t\t //\tfmt.Printf(\"%v\", reply_init.Err)\n\t\t //\tlog.Fatal(\"Error: Initial Backup failed\\n\")\n\t\t ok := false\n\t\t reply_init := InitReply{}\n\t\t for !ok || reply_init.Err != OK {\n\t\t \targs_init := &InitArgs{pb.key_value, pb.view.Primary}\n\t\t \treply_init = InitReply{}\n\t\t \tok = call(v.Backup, \"PBServer.Init\", args_init, &reply_init)\n\t\t }\n\t }\n }\n pb.view = v\n}", "title": "" }, { "docid": "5137db44eaac8da66cb32740c61b46d4", "score": "0.50081307", "text": "func (m *Master) HeartBeatNotify(Heartbeatinfo *HeartBeatInfo, reply *bool) error {\r\n\r\n\tGNodeLiveCount.Store((*Heartbeatinfo).NodeName, (*Heartbeatinfo).NodeLiveCount)\r\n\r\n\t//\tlog.Printf(\" %s beat heart..........\", (*Heartbeatinfo).NodeName)\r\n\r\n\t*reply = gNodesNotify\r\n\r\n\treturn nil\r\n}", "title": "" }, { "docid": "ffdd2b781f46128360323ecfa715153d", "score": "0.49994472", "text": "func (f *WorkerStoreMaxDurationInQueueFunc) PushHook(hook func(context.Context) (time.Duration, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "541755837d9bcd09572cf953f7048400", "score": "0.4983623", "text": "func (m *Manager) heartbeat(ctx context.Context) {\n\tif m.config.HeartbeatInterval <= 0 {\n\t\treturn\n\t}\n\t_ = utils.Pool.Submit(func() { m.nodeStatusReport(ctx) })\n\n\ttick := time.NewTicker(time.Duration(m.config.HeartbeatInterval) * time.Second)\n\tdefer tick.Stop()\n\n\tfor {\n\t\tselect {\n\t\tcase <-tick.C:\n\t\t\t_ = utils.Pool.Submit(func() { m.nodeStatusReport(ctx) })\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "95855431babd77ceee10366ce2a973e1", "score": "0.49835894", "text": "func hookWait() {\n\ttime.Sleep(time.Millisecond * 50)\n}", "title": "" }, { "docid": "b0986b53b8e2f0caccf7fdb90531c5b8", "score": "0.49719286", "text": "func EmitHeartbeat(log *logrus.Entry, m metrics.Emitter, metricName string, stop <-chan struct{}, checkFunc func() bool) {\n\tdefer recover.Panic(log)\n\n\tt := time.NewTicker(time.Minute)\n\tdefer t.Stop()\n\n\tlog.Print(\"starting heartbeat\")\n\n\tfor {\n\t\tif checkFunc() {\n\t\t\tm.EmitGauge(metricName, 1, nil)\n\t\t}\n\n\t\tselect {\n\t\tcase <-t.C:\n\t\tcase <-stop:\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4388d29e733b67cfdde394e27b1f9d30", "score": "0.49691316", "text": "func (q *QueueHook) Hook(conf *ProxySettings, wg *sync.WaitGroup) error {\n\tdefer wg.Done()\n\treadParams := sqs.ReceiveMessageInput{\n\t\tMaxNumberOfMessages: aws.Int64(10),\n\t\tQueueUrl: aws.String(conf.Src),\n\t\tWaitTimeSeconds: aws.Int64(20),\n\t}\n\tfor {\n\t\tif err := q.Move(&readParams, conf.Dest); err != nil {\n\t\t\terrIntro := fmt.Sprintf(\"Proxying from Queue %s has failed with error:\", conf.Src)\n\t\t\tlog.Println(errIntro, err)\n\t\t\treturn err\n\t\t}\n\t\ttime.Sleep(conf.Interval * time.Second)\n\t}\n}", "title": "" }, { "docid": "64c506a18e90a5d69e7cf9237efd6e87", "score": "0.49688283", "text": "func (rf *Raft) heartbeatTimer() {\n\t//rf.mu.Lock()\n\t//DPrintf(\"[%d-%s-%d] start heartbeat\", rf.me, rf.state, rf.currentTerm)\n\t//rf.mu.Unlock()\n\tfor {\n\t\trf.mu.Lock()\n\t\tif rf.killed() {\n\t\t\tdefer rf.mu.Unlock()\n\t\t\t//DPrintf(\"[%d-%s-%d] is killed\", rf.me, rf.state, rf.currentTerm)\n\t\t\treturn\n\t\t}\n\t\tif rf.state != LEADER {\t\t// when this peer is no longer a leader, stop heartbeat timer\n\t\t\tdefer rf.mu.Unlock()\n\t\t\treturn\n\t\t}\n\t\trf.sendAppendEntriesToFollower()\n\t\trf.mu.Unlock()\n\t\ttime.Sleep(time.Duration(HEARTBEAT_INTERVAL) * time.Millisecond)\n\t}\n}", "title": "" }, { "docid": "9a4b94dc9b6af9e83c50d96d600c8c46", "score": "0.49616474", "text": "func (m *ThetafdModule) sendHeartbeat(receiverID int) {\n\tmessage := models.Message{Type: models.THETAheartbeat, Sender: m.ID, Data: nil}\n\tgo SendToProcessor(receiverID, &message)\n}", "title": "" }, { "docid": "035267fee2c695e7ddae09042f3565ba", "score": "0.4959547", "text": "func (f *WorkerStoreRequeueFunc) PushHook(hook func(context.Context, int, time.Time) error) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "9fc375f5115390430fc790d71efd30d3", "score": "0.49554455", "text": "func processMetricHeartbeatPacket(data []byte) {\n\thb, err := packet.ParseMetricHeartbeat(data)\n\tif err != nil {\n\t\tif !errors.Is(err, packet.ErrInvalidMetricHeartbeatVersion) {\n\t\t\tEvents.Error.Trigger(err)\n\t\t}\n\t\treturn\n\t}\n\tEvents.MetricHeartbeat.Trigger(hb)\n}", "title": "" }, { "docid": "610a3e92f39f6f160d8e801768fe2955", "score": "0.4946412", "text": "func (pb *PBServer) tick() {\n\n\t// Your code here.\n\tpb.mu.Lock()\n\tdefer pb.mu.Unlock()\n\n\tview, err := pb.vs.Ping(pb.view.Viewnum)\n\tif err == nil {\n\t\tvar oldBackup = pb.view.Backup\n\t\tpb.view = view\n\t\tif view.Backup != oldBackup && pb.isPrimary() {\n\t\t\tpb.ForwardToBackup(&ForwardArgs{Me: pb.me, Content: pb.content, Client: pb.client})\n\t\t}\n\t} else {\n\t\tpb.view = view\n\t}\n}", "title": "" }, { "docid": "03e70d22c1d8bdea2488b321c3641126", "score": "0.49082747", "text": "func (whMgr *WebHookMgr) InvokeNewWebHooks() {\n\t// get the webhooks that should be invoked\n\twebhooks, err := whMgr.DB.GetAllInvokeWebhooks()\n\tif err != nil {\n\t\treturn\n\t}\n\t// loop through the webhooks and invoke them\n\tfor _, v := range webhooks {\n\t\tstartTime := time.Now()\n\n\t\ttickerResp, err := whMgr.Ticker.GetTickerByTimeStamp(v.LatestTimestamp)\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\tcontinue\n\t\t}\n\n\t\tvar trackIdsString string\n\t\tnOfNewTrack := len(tickerResp.TrackIDs)\n\n\t\tif nOfNewTrack <= 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\ttrackIdsString = tickerResp.TrackIDs[0].Hex()\n\t\tfor i := 1; i < nOfNewTrack; i++ {\n\t\t\ttrackIdsString += \", \" + tickerResp.TrackIDs[i].Hex()\n\t\t}\n\n\t\tareOrIsString := \"is: \"\n\t\tif nOfNewTrack > 1 {\n\t\t\tareOrIsString = \"are: \"\n\t\t}\n\n\t\tv.LatestTimestamp = tickerResp.TLatest\n\t\treponseString := \"latest timestamp: \" + strconv.FormatInt(tickerResp.TLatest, 10) +\n\t\t\t\", \" + strconv.Itoa(len(tickerResp.TrackIDs)) + \" new tracks \" + areOrIsString +\n\t\t\ttrackIdsString + \". (processing: \" + strconv.FormatFloat(float64(time.Since(startTime))/float64(time.Millisecond), 'f', 2, 64) + \"ms)\"\n\n\t\tvar jsonStr = []byte(`{\"content\":\"` + reponseString + `\"}`)\n\t\t// post the request\n\t\t_, postErr := http.Post(v.WebhookURL, \"application/json\", bytes.NewBuffer(jsonStr))\n\t\tif postErr != nil {\n\t\t\tfmt.Println(postErr)\n\t\t}\n\t\twhMgr.Ticker.DB.ResetWebhookCounter(v)\n\n\t}\n\n}", "title": "" }, { "docid": "320414e72d0aa44c7de58911b84f0cf4", "score": "0.489725", "text": "func (r *raft) bcastHeartbeat() {\n\tlastCtx := r.readOnly.lastPendingRequestCtx()\n\tif len(lastCtx) == 0 {\n\t\tr.bcastHeartbeatWithCtx(nil)\n\t} else {\n\t\tr.bcastHeartbeatWithCtx([]byte(lastCtx))\n\t}\n}", "title": "" }, { "docid": "4a81c5e140c02c7635d91e772c4f10b5", "score": "0.48943058", "text": "func (a *HeartbeatInjector) Run() {\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-a.CloseChan:\n\t\t\t\treturn\n\t\t\tdefault:\n\t\t\t\tcurTime := time.Now().Format(\"15:04\")\n\t\t\t\tfor _, timeVal := range a.Times {\n\t\t\t\t\tif curTime == timeVal {\n\t\t\t\t\t\tev := makeHeartbeatEvent(\"http\")\n\t\t\t\t\t\ta.Logger.Infof(\"creating heartbeat HTTP event for %s: %s\",\n\t\t\t\t\t\t\tcurTime, string(ev.JSONLine))\n\t\t\t\t\t\ta.ForwardHandler.Consume(&ev)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor _, timeVal := range a.AlertTimes {\n\t\t\t\t\tif curTime == timeVal {\n\t\t\t\t\t\tev := makeHeartbeatEvent(\"alert\")\n\t\t\t\t\t\ta.Logger.Infof(\"creating heartbeat alert event for %s: %s\",\n\t\t\t\t\t\t\tcurTime, string(ev.JSONLine))\n\t\t\t\t\t\ta.ForwardHandler.Consume(&ev)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ttime.Sleep(injectTimeCheckTick)\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "dc6661e9539ff4e781992d7e45707bb1", "score": "0.48935717", "text": "func (pb *PBServer) tick() {\n pb.kvLock.Lock()\n defer pb.kvLock.Unlock()\n\n // ping viewservice to get the newest p&b\n view, err := pb.vs.Ping(pb.currentView.Viewnum)\n if err != nil {\n log.Println(\"receive error from Ping: \", err)\n return\n }\n\n amPrimary := (pb.currentView.Primary == pb.me)\n // amBackup := (pb.currentView.Backup == pb.me)\n\n if amPrimary && (view.Viewnum != pb.currentView.Viewnum) && (view.Backup != \"\") {\n // we should update the backup cause me just bacame primary or backup changed\n pb.updateBackup = true\n }\n\n pb.currentView = view\n\n if pb.updateBackup {\n pb.UpdateBackupDatabase(pb.currentView.Backup)\n }\n}", "title": "" }, { "docid": "8e37d22f7cc970b92d8cb91a25b218bd", "score": "0.48882172", "text": "func Heartbeat(registry,addr string,duration time.Duration) {\n\tif duration==0{\n\t\t// make sure there is enough time to send heart beat\n\t\t// before it's removed from registry\n\t\tduration = defaultTimeout - time.Duration(1)*time.Minute\n\t}\n\tvar err error\n\terr=sendHeartbeat(registry,addr)\n\n\tgo func() {\n\t\tt:=time.NewTicker(duration)\n\t\tfor err==nil{\n\t\t\t<-t.C\n\t\t\terr=sendHeartbeat(registry,addr)\n\t\t}\n\t}()\n\n}", "title": "" }, { "docid": "16721f9368597b4a4586cb14d723bdad", "score": "0.48870584", "text": "func (l *BasicLifecycler) heartbeat(ctx context.Context) {\n\terr := l.updateInstance(ctx, func(r *Desc, i *InstanceDesc) bool {\n\t\tl.delegate.OnRingInstanceHeartbeat(l, r, i)\n\t\ti.Timestamp = time.Now().Unix()\n\t\treturn true\n\t})\n\n\tif err != nil {\n\t\tlevel.Warn(l.logger).Log(\"msg\", \"failed to heartbeat instance in the ring\", \"ring\", l.ringName, \"err\", err)\n\t\treturn\n\t}\n\n\tl.metrics.heartbeats.Inc()\n}", "title": "" }, { "docid": "daf7ff31eeac4d9a7a62b29f8a323059", "score": "0.48801318", "text": "func countHeartbeat() {\n\tfor {\n\t\ttime.Sleep(10 * time.Second)\n\t\tserviceHeartbeat.Inc()\n\t}\n}", "title": "" }, { "docid": "9c20387bba13ba9f251ca6769823ee0d", "score": "0.48752317", "text": "func (l *Lock) hb() {\n\tvar ctx context.Context\n\tctx, l.cancel = context.WithCancel(context.Background())\n\tgo func() {\n\t\ttk := time.NewTicker(l.hbRate)\n\t\tdefer tk.Stop()\n\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-tk.C:\n\t\t\t\terr := l.beat()\n\t\t\t\tif err != nil {\n\t\t\t\t\tl.p.log.Error(string(l.Type), \"\", l.OPID, *l.Epoch, \"send lock heartbeat: %v\", err)\n\t\t\t\t}\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "d1d74ab6377ed0011b7e9797fe61f085", "score": "0.48512334", "text": "func (c *Dispatcher) GenerateHeartbeat(ctx context.Context, seqNum int) (wsapi.WSMessage, error) {\n\tctx, span := c.deps.Telemetry().StartSpan(ctx, \"dispatcher\", \"GenerateHeartbeat\")\n\tdefer span.End()\n\n\tvar m wsapi.WSMessage\n\n\tm, err := ETFPayloadToMessage(ctx, &etfapi.HeartbeatPayload{\n\t\tSequence: seqNum,\n\t})\n\tif err != nil {\n\t\tlevel.Error(logging.WithContext(ctx, c.deps.Logger())).Err(\"error formatting heartbeat\", err)\n\t\treturn m, errors.Wrap(err, \"error formatting heartbeat\")\n\t}\n\n\terr = c.deps.MessageRateLimiter().Wait(ctx)\n\tif err != nil {\n\t\tlevel.Error(logging.WithContext(ctx, c.deps.Logger())).Err(\"error rate limiting\", err)\n\t\treturn m, errors.Wrap(err, \"error rate limiting\")\n\t}\n\n\treturn m, nil\n}", "title": "" }, { "docid": "cd065bfb85390559f31746aef4f33ce5", "score": "0.4830115", "text": "func (i *InmemTransport) SetHeartbeatHandler(cb func(RPC)) {\n}", "title": "" }, { "docid": "654679717eadf9123c9bb48dee9796c4", "score": "0.48190683", "text": "func onNotify(w http.ResponseWriter, r *http.Request) {\n\tif ctype := r.Header.Get(\"Content-Type\"); ctype == \"application/json\" || ctype == \"application/ld+json\" {\n\t\t//var context []interface{}\n\t\t//context = append(context, DEFAULT_CONTEXT)\n\t\t mutex.Lock()\n\t count = count + 1\n\t\t mutex.Unlock()\n\n\t\tif flagv == 0 {\n\t\t\tticker = time.NewTicker(1 * time.Second)\n\t\t\tflagv = 1\n\t\t}\n\t\tfor _ = range ticker.C {\n\t\t\t// execute in one sec\n\t\t\tfmt.Println(count)\n\t\t\tmutex.Lock()\n\t\t\tcount = 0\n\t\t\tmutex.Unlock()\n\t\t}\n\t\tw.WriteHeader(200)\n\t}\n}", "title": "" }, { "docid": "987097985ea1cf9ffbf1ba55b435ee20", "score": "0.48160595", "text": "func (f *StoreRequeueFunc) PushHook(hook func(context.Context, int, time.Time) error) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "4179d1fdbedb6a82489a78e388fd6675", "score": "0.4798502", "text": "func heartbeat() {\n for {\n if raft.Role == spec.LEADER {\n // Send empty append entries to every member as goroutines\n for PID := range self.MemberMap {\n if PID != self.PID {\n heartbeats <- PID\n }\n }\n time.Sleep(time.Duration(config.C.HeartbeatInterval) * time.Millisecond * time.Duration(config.C.Timescale))\n } else {\n // Watch for election timer timeouts\n select {\n case <-raft.ElectTimer.C:\n if raft.Role == spec.CANDIDATE {\n config.LogIf(fmt.Sprintf(\"[ELECTTIMEOUT] CANDIDATE timed out while waiting for votes\"), config.C.LogElections)\n } else {\n log.Println(\"[ELECTTIMEOUT]\")\n }\n go InitiateElection()\n\n default:\n continue\n }\n }\n }\n}", "title": "" }, { "docid": "4f6ff90e38b7958d6c9da199ea92d97f", "score": "0.4793496", "text": "func (l HTTPReporter) Heartbeat(cmd CommandUsage) {\n\tl.post(\"/usage\", cmd)\n}", "title": "" }, { "docid": "710248aa5205ff5c46e924864c3e58a7", "score": "0.4780265", "text": "func (r *Raft) sendHeartbeat(to uint64) {\n\tif r.State != StateLeader {\n\t\tpanic(r.id)\n\t}\n\t// Your Code Here (2A).\n\tr.send(pb.Message{\n\t\tMsgType: pb.MessageType_MsgHeartbeat,\n\t\tTo: to,\n\t\tCommit: util.RaftInvalidIndex,\n\t})\n}", "title": "" }, { "docid": "d6c7096866bf2a4ea66c2cb132c9bdc9", "score": "0.47795314", "text": "func heartbeatHandler(w http.ResponseWriter, req *http.Request) {\n\tmuActive.Lock()\n\tprogress := -1\n\tif worker.Active {\n\t\tprogress = worker.Progress\n\t}\n\tmuActive.Unlock()\n\tworker.NotifyParty(progress)\n}", "title": "" }, { "docid": "caf21e7d983630e6470eab820cdd5f21", "score": "0.4777649", "text": "func heartbeatHandler(timer *time.Timer, heartbeatTimeout, heartbeatJitter time.Duration) func(*ecstcs.HeartbeatMessage) {\n\treturn func(*ecstcs.HeartbeatMessage) {\n\t\tlogger.Debug(\"Received HeartbeatMessage from tcs\")\n\t\ttimer.Reset(retry.AddJitter(heartbeatTimeout, heartbeatJitter))\n\t}\n}", "title": "" }, { "docid": "a7583a53931fed528627bd5844f8ad05", "score": "0.47749135", "text": "func (m Monitor) LastHeartbeat() time.Time { return m.lastHeartbeat }", "title": "" }, { "docid": "9b1073453902eccb33693334a12e57fa", "score": "0.47709537", "text": "func (gs *GameServer) heartbeat(pulse mudtime.PulseCount, delta float64) {\n\t//log.Printf(\"pulse %d hb %d\", pulse, delta)\n\t// mobs, scripts, ...\n\n\t// pulse zone\n\t// (zone reset ...)\n\tif pulse.CheckInterval(mudtime.PULSE_ZONE) {\n\t\tgs.World.DoZoneActivity()\n\t}\n\n\t// pulse mobs\n\t// (mobs walk around, initiate attack?)\n\tif pulse.CheckInterval(mudtime.PULSE_MOBILE) {\n\t\tgs.World.DoMobileActivity()\n\t}\n\n\t// perform violence\n\t// do the attacking (players and mobs and everybody)\n\tif pulse.CheckInterval(mudtime.PULSE_VIOLENCE) {\n\t\tgs.World.DoViolence(pulse)\n\t}\n\n\t// mud-hour (\"player tick\")\n\t// affect weather, regen ..\n\n\t// handle an incoming message if one exists\n\t// TODO tick time: figure out how many incoming messages we can handle\n\t// see issue #4\n\t// for now, just process until buffer is empty...\n\n\t// not really infinite as the method will return false if there was\n\t// nothing to do.\n\t//noinspection GoInfiniteFor\n\tfor gs.processIncomingMessage() {\n\t}\n}", "title": "" }, { "docid": "ed641f76cd39e2e4a79d65f4d65f98aa", "score": "0.47679618", "text": "func (f *WorkerStoreMaxDurationInQueueFunc) PushReturn(r0 time.Duration, r1 error) {\n\tf.PushHook(func(context.Context) (time.Duration, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "83e46b7438ef72074732e6bd2bd6c992", "score": "0.47654787", "text": "func (f *WorkerStoreDequeueFunc) PushHook(hook func(context.Context, string, []*sqlf.Query) (workerutil.Record, bool, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "75f170b184b4c07cfdd9d07c5dde83f9", "score": "0.47535905", "text": "func PeriodicHeartbeat() {\n\tfor {\n\t\tRunHeartbeat()\n\t\ttime.Sleep(10 * time.Second)\n\t}\n}", "title": "" }, { "docid": "8d0d922cb824aea4ded82204632c1aa6", "score": "0.47443303", "text": "func (r *Raft) sendHeartbeat(to uint64) {\n\t// Your Code Here (2A).\n\t// 从 raft 论文来看,心跳应该只是比 append 少了日志条目,不过测试的实现好像只是纯粹的心跳\n\tif _, ok := r.Prs[to]; !ok {\n\t\treturn\n\t}\n\tm := pb.Message{\n\t\tMsgType: pb.MessageType_MsgHeartbeat,\n\t\tTo: to,\n\t\tFrom: r.id,\n\t\tTerm: r.Term,\n\t}\n\tr.send(m)\n}", "title": "" }, { "docid": "fb208ca8faa3dfd919dca3edc4dbe2d5", "score": "0.47195843", "text": "func (l *Loop) Heartbeat() <-chan LatencySample {\n\tl.mu.Lock()\n\tdefer l.mu.Unlock()\n\treturn l.heartbeat\n}", "title": "" }, { "docid": "a154905410d3d1bdcf329bc93c13af23", "score": "0.47189945", "text": "func (f *StoreMarkQueuedFunc) PushHook(hook func(context.Context, int, *int) error) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "a240b62ec278643ef09e160c3144cc6e", "score": "0.47179848", "text": "func newHeartbeat(ctx context.Context) (*linechart.LineChart, error) {\n\tvar inputs []float64\n\tfor i := 0; i < 100; i++ {\n\t\tv := math.Pow(math.Sin(float64(i)), 63) * math.Sin(float64(i)+1.5) * 8\n\t\tinputs = append(inputs, v)\n\t}\n\n\tlc, err := linechart.New(\n\t\tlinechart.AxesCellOpts(cell.FgColor(cell.ColorRed)),\n\t\tlinechart.YLabelCellOpts(cell.FgColor(cell.ColorGreen)),\n\t\tlinechart.XLabelCellOpts(cell.FgColor(cell.ColorGreen)),\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tstep := 0\n\tgo periodic(ctx, redrawInterval/3, func() error {\n\t\tstep = (step + 1) % len(inputs)\n\t\treturn lc.Series(\"heartbeat\", rotateFloats(inputs, step),\n\t\t\tlinechart.SeriesCellOpts(cell.FgColor(cell.ColorNumber(87))),\n\t\t\tlinechart.SeriesXLabels(map[int]string{\n\t\t\t\t0: \"zero\",\n\t\t\t}),\n\t\t)\n\t})\n\treturn lc, nil\n}", "title": "" }, { "docid": "094f5d8c6c0d60f110b7fc3a75578a26", "score": "0.47110868", "text": "func (c WorkerStoreHeartbeatFuncCall) Results() []interface{} {\n\treturn []interface{}{c.Result0, c.Result1}\n}", "title": "" }, { "docid": "18b0dbe496cf34afc35df02ba0ce08ee", "score": "0.47078046", "text": "func MetricsHook(stats stat.Stat) HookFunc {\n\tif stats == nil {\n\t\tstats = stat.DB\n\t}\n\treturn func(ctx context.Context, call hrpc.Call, customName string) func(err error) {\n\t\tnow := time.Now()\n\t\tif customName == \"\" {\n\t\t\tcustomName = call.Name()\n\t\t}\n\t\tmethod := \"hbase:\" + customName\n\t\treturn func(err error) {\n\t\t\tdurationMs := int64(time.Since(now) / time.Millisecond)\n\t\t\tstats.Timing(method, durationMs)\n\t\t\tif err != nil && err != io.EOF {\n\t\t\t\tstats.Incr(method, codeFromErr(err))\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6c1a30a727805df7244fc86457032ed8", "score": "0.47061986", "text": "func (*HeartbeatCommand) Op() ws.OpCode { return 1 }", "title": "" }, { "docid": "6921a7932ce1f65e119d6d88f0b0b9ac", "score": "0.46989587", "text": "func hookProcessor(ctx context.Context, client *pubsub.Client, envars *EnvironmentVars, eventCh <-chan hookEvent) {\n\t// Ranging over a channel will read events sent to the channell\n\t// or block if there's no events to read.\n\tfor event := range eventCh {\n\t\tlogInfo(\"Recieved a new event to process\", \"event-type\",event.gitHubEvent)\n\t\t\n\t\t//validate we can parse the webhook\n\t\tgEvent, err := github.ParseWebHook(event.gitHubEvent, event.payload)\n\t\tif err != nil {\n\t\t\tlogError(err,\"Error process parsing incoming webhook\")\n\t\t continue\n\t\t}\n\t\tswitch gEvent.(type) {\n\t\tcase *github.PushEvent:\n\t\t\t//try and send on to Jenkins\n\t\t\twebhookSendErr := retry(envars.RetryCount, envars.RetryInterval, func() (err error) {\n\t\t\t\tJenkinsErr := sendToJenkins(event.payload, event.gitHubEvent, envars.JenkinsWebhookURL + \"?token=\" + event.invokeKey)\n\t\t\t\tif JenkinsErr != nil {\n\t\t\t\t\tlogError(JenkinsErr, \"Jenkins Transport Error\")\n\t\t\t\t\treturn JenkinsErr\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t})\n\t\t\t//if jenkins send/retries are exhausted then we need to add the X-Github-Event and Token to the message and send to Topic\n\t\t\tif webhookSendErr != nil {\n\t\t\t\tlogError(webhookSendErr,\"Something went wrong with webhook forward to Jenkins. Sending to topic\")\n\t\t\t\tcontentPlus, constructErr := constructPubSubMsg(event.payload, event.gitHubEvent, event.invokeKey)\n\t\t\t\tif constructErr != nil {\n\t\t\t\t\tlogError(constructErr,\"Pubsub msg construction error\")\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\terr := sendToTopic(ctx, client, contentPlus, envars.TopicName)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogFatal(err, \"Could not publish message to topic\")\n\t\t\t\t}\n\t\t\t} else { //log successful Jenkins send\n\t\t\t\tlogInfo(\"Webhook forwarded to Jenkins\", \"jenkins-url\",envars.JenkinsWebhookURL + \"?token=\" + event.invokeKey)\n\t\t\t}\n\t\tdefault:\n\t\t\tlogInfo(\"Currently we ignore this event-type\", \"event-type\", event.gitHubEvent)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4ac4190f97e6c8f72204de52fac134f6", "score": "0.46767703", "text": "func (as *AutoScaling) RecordLifecycleActionHeartbeat(asgName, lifecycleActionToken, hookName string) (\n\tresp *SimpleResp, err error) {\n\tparams := makeParams(\"RecordLifecycleActionHeartbeat\")\n\tparams[\"AutoScalingGroupName\"] = asgName\n\tparams[\"LifecycleActionToken\"] = lifecycleActionToken\n\tparams[\"LifecycleHookName\"] = hookName\n\n\tresp = new(SimpleResp)\n\tif err := as.query(params, resp); err != nil {\n\t\treturn nil, err\n\t}\n\treturn resp, nil\n}", "title": "" }, { "docid": "3157332e2257728cd6e8bf6356ceb112", "score": "0.46678945", "text": "func (kv *DisKV) tick() {\n\tkv.mu.Lock()\n\n\tif kv.isdead() { \t// if server is dead\n\t\treturn \t\t\t// ignore this tick\n\t}\n\n\t// if Decided, execute the operation at the top of the log\n\n\tstatus, op := kv.px.Status(kv.top) \t\t\n\tif status == paxos.Decided {\n\t decided_op := op.(Op)\n \tkv.execute(decided_op, kv.top) \n\t}\n\n\tqconfig := kv.sm.Query(-1) // query the SM\n\n\tif kv.config.Num < qconfig.Num {\t\t\t // if this server is behind\n\t\tnextConfig := kv.sm.Query(kv.config.Num + 1) // query for next config\n\t\tkv.proposeAdvance(nextConfig) \t // propose advance op to the replica group\n\t}\n\n\tkv.mu.Unlock()\n}", "title": "" }, { "docid": "055c0540fe8effd96e73d25801889b4a", "score": "0.46581295", "text": "func Invoke(params Params) {\n\tparams.Lifecycle.Append(fx.Hook{\n\t\tOnStart: StartServer(params.Server, params.Logger),\n\t\tOnStop: StopServer(params.Server, params.Logger),\n\t})\n}", "title": "" }, { "docid": "e4769c3d0cf5a82e69fc1638ad961762", "score": "0.465758", "text": "func (m MuxReporter) Heartbeat(cmd CommandUsage) {\n\tfor i := range m.reporters {\n\t\tm.reporters[i].Heartbeat(cmd)\n\t}\n}", "title": "" }, { "docid": "aa87d0bde5519a1fe701f44217c50213", "score": "0.4657176", "text": "func HandleCallback(w http.ResponseWriter, r *http.Request) {\n req := CaptureResponseBody(r.Body)\n var body SlackResponse\n json.Unmarshal([]byte(req), &body)\n if body.Type == \"url_verification\" {\n w.Write([]byte(body.Challenge))\n log.Println(\"Slack API Callback Url Verified\")\n return\n } else if body.Type == \"event_callback\" && body.Event.Type == \"message\" {\n w.Write([]byte(\"Message Received\"))\n name, err := GetUsername(body.Event.User)\n if name == BOT_NAME {\n return\n }\n log.Printf(\"Handle Message Callback for user: %s\\n\", body.Event.User)\n threadId := GetThreadId()\n if threadId == \"\" {\n MessageUser(body.Event.User, \"There is currently no open checkin session. Please try again later.\")\n return\n }\n\n if !UpdateUser(body.Event.User) {\n MessageUser(body.Event.User, \"Cannot change body once sent, please go to thread and post followup.\")\n return\n }\n\n if err != nil {\n log.Println(\"Error in HandleCallback:\")\n log.Println(err)\n }\n MessageUser(body.Event.User, fmt.Sprintf(\"Hey, thanks for your response! You should soon see it in <#%s> under the most recent thread. Hope the rest of your day goes well ;)\", MAIN_CHANNEL_ID))\n log.Printf(\"%s's Response: %s\", name, body.Event.Text)\n messageResp, err := SendMessage(fmt.Sprintf(\"%s's Response: %s\", name, body.Event.Text), MAIN_CHANNEL_ID, threadId)\n log.Println(messageResp.Error)\n } else if body.Type == \"event_callback\" && body.Event.Type == \"app_mention\" {\n MTX.Lock()\n if !IsCutoffOK() {\n log.Println(\"Cutoff too soon in app mention callback\")\n w.Write([]byte(\"Cutoff too soon in app mention callback\"))\n MTX.Unlock()\n return\n }\n LAST_MESSAGE = time.Now()\n\n if strings.Contains(body.Event.Text, OPEN_CHECKIN_STR) {\n OpenCheckin()\n log.Println(\"Checkin Opened by Event Callback\")\n w.Write([]byte(\"Checkin opened\"))\n } else if strings.Contains(body.Event.Text, CLOSE_CHECKIN_STR) {\n CloseCheckin()\n log.Println(\"Checkin Closed by Event Callback\")\n w.Write([]byte(\"Checkin closed\"))\n } else if strings.Contains(body.Event.Text, REMIND_CHECKIN_STR) { \n RemindCheckin()\n log.Println(\"Remind Awaiting by Event Callback\")\n w.Write([]byte(\"Checkin reminded\"))\n } else {\n log.Println(\"No action performed in app mention callback\")\n w.Write([]byte(\"No action performed in app mention callback\"))\n }\n MTX.Unlock()\n } else {\n log.Println(\"Unknown callback:\")\n log.Println(req)\n w.Write([]byte(\"HandleCallback but no valid condition found\"))\n }\n}", "title": "" }, { "docid": "8a4f0263e0fd266f38824cdef0678827", "score": "0.4649731", "text": "func (rf *Raft) sendHeartbeats() {\n\n\tfor p, _ := range rf.peers {\n\n\t\tif p == rf.me {\n\t\t\tcontinue\n\t\t}\n\n\t\tDPrintf(\"Term: %v, server %v send heartbeat to server %v\", rf.currentTerm, rf.me, p)\n\t\tgo func(idx int) {\n\n\t\t\tDPrintf(\"0. rf.nextIndex to server %v is %v, rf.lastIncludedIndex: %v, logLen: %v\", idx, rf.nextIndex[idx], rf.lastIncludedIndex, rf.getLogLen())\n\n\t\t\t//\n\t\t\trf.mu.Lock()\n\t\t\tif rf.state != LEADER {\n\t\t\t\tDPrintf(\"Term: %v, server %v not leader anymore!!!!!!!!!!!!!!!!!!!!!!.\", rf.currentTerm, rf.me)\n\t\t\t\trf.mu.Unlock()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tDPrintf(\"0-1. rf.nextIndex to server %v is %v, logLen: %v\", idx, rf.nextIndex[idx], rf.getLogLen())\n\n\t\t\t//\n\t\t\tif rf.nextIndex[idx] <= rf.lastIncludedIndex {\n\t\t\t\trf.sendSnapshot(idx)\n\t\t\t\tDPrintf(\"5. rf.nextIndex to server %v is %v\", idx, rf.nextIndex[idx])\n\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Upon election: send initial empty AppendEntries RPCs (heartbeat) to each server;\n\t\t\t// repeat during idle periods to prevent election timeouts (§5.2)\n\t\t\t// Attention! rf.log[]'s index!\n\t\t\tentries := append(make([]LogEntry, 0), rf.log[rf.nextIndex[idx]-rf.lastIncludedIndex:]...)\n\t\t\targs := &AppendEntriesArgs{\n\t\t\t\tTerm: rf.currentTerm,\n\t\t\t\tLeaderId: rf.me,\n\t\t\t\tPrevLogIndex: rf.getPrevLogIndex(idx),\n\t\t\t\tPrevLogTerm: rf.getPrevLogTerm(idx),\n\t\t\t\tEntries: entries,\n\t\t\t\tLeaderCommit: rf.commitIndex,\n\t\t\t}\n\t\t\trf.mu.Unlock()\n\n\t\t\treply := &AppendEntriesReply{}\n\n\t\t\tDPrintf(\"dduduuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu\")\n\t\t\tDPrintf(\"Term: %v, server %v log: %v, rf.nextIndex[idx]:%v, args.Entries: %v\", rf.currentTerm, rf.me, rf.log, rf.nextIndex[idx], len(entries))\n\n\t\t\tok := rf.sendAppendEntries(idx, args, reply)\n\n\t\t\t// lock attention\n\t\t\trf.mu.Lock()\n\t\t\tdefer rf.mu.Unlock()\n\t\t\tif !ok || rf.state != LEADER {\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// All server: If RPC request or response contains term T > currentTerm:\n\t\t\t// set currentTerm = T, convert to follower (§5.1)\n\t\t\tif reply.Term > rf.currentTerm {\n\t\t\t\trf.beFollower(reply.Term)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// If last log index ≥ nextIndex for a follower: send\n\t\t\t// AppendEntries RPC with log entries starting at nextIndex\n\t\t\t//• If successful: update nextIndex and matchIndex for\n\t\t\t// follower (§5.3)\n\t\t\t//• If AppendEntries fails because of log inconsistency:\n\t\t\t// decrement nextIndex and retry (§5.3)\n\t\t\t// accelerated log backtracking optimization\n\t\t\tif !reply.Success {\n\t\t\t\tif len(args.Entries) == 0 {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\t// when reply.ConflictTerm == -1 which means follower'log length is shorter than args.prevLogIndex\n\t\t\t\trf.nextIndex[idx] = reply.ConflictIndex\n\t\t\t\tif reply.ConflictTerm != -1 {\n\t\t\t\t\tfor i := reply.ConflictIndex; i > rf.lastIncludedIndex; i-- {\n\t\t\t\t\t\tif rf.getLog(i-1).Term == reply.ConflictTerm {\n\t\t\t\t\t\t\trf.nextIndex[idx] = i\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\treturn\n\t\t\t}\n\n\t\t\t// reply success\n\t\t\trf.updateNextMatchIdx(idx, args.PrevLogIndex+len(args.Entries))\n\n\t\t}(p)\n\t}\n\n}", "title": "" }, { "docid": "d8b6f5030858c10502d28caa333a75d4", "score": "0.46442428", "text": "func (pb *PBServer) tick() {\n\t// Your code here.\n\tpb.mu.Lock()\n\t// @amaliujia call Clerk's functions ditrectly.\n\tv, err := pb.vs.Ping(pb.view.Viewnum)\n\tif err != nil {\n\t\tfmt.Println(\"Cannot get view from %v\", pb.vs.GetServer());\n\t}\n\t// if Backup != change, send the copy of db to new backup\n\tsign := (v.Backup != pb.view.Backup && pb.IsPrimary())\n\n\tpb.view = v\n\tif sign {\n\t\tpb.Forward(&ForwardArgs{DB:pb.db})\n\t}\n\tpb.mu.Unlock()\n}", "title": "" }, { "docid": "4884956922d626bc92a7c5da8b8ba3de", "score": "0.4631778", "text": "func (sn *monitorNode) HeartBeat(args *monitorrpc.HeartBeatArgs, reply *monitorrpc.HeartBeatReply) error {\n\tif args.Type == monitorrpc.Master {\n\t\tsn.masterHeartBeatMap[args.Id] += 1\n\t\tfmt.Println(\"Received heartbeat from server\", args.Id)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "24cfef6d705ee680c35c46d5c739914b", "score": "0.46232587", "text": "func (e *EvtFailureDetector) DeliverHeartbeat(hb Heartbeat) {\n\te.hbIn <- hb\n}", "title": "" }, { "docid": "5ab72bfc7664c5d433f23c600036bdee", "score": "0.46195218", "text": "func (f *WorkerStoreQueuedCountFunc) PushHook(hook func(context.Context, bool) (int, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "2b7b26b02924c5011ca36f1c8aebc003", "score": "0.4618241", "text": "func (f *EventLogStoreLatestPingFunc) PushHook(hook func(context.Context) (*Event, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "a4b3e8db111ea0e8a46986c9f6668608", "score": "0.46116585", "text": "func (f *StoreResetStalledFunc) PushHook(hook func(context.Context, time.Time) ([]int, []int, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "5fa4ae2cc109a44964fd229960cc5bd2", "score": "0.46073967", "text": "func (pb *PBServer) tick() {\n // Your code here.\n pb.mu.Lock()\n defer pb.mu.Unlock()\n \n args := &viewservice.PingArgs{}\n args.Me = pb.me\n args.Viewnum = pb.viewnum\n \n var reply viewservice.PingReply\n\n // send an RPC request, wait for the reply.\n ok := call(pb.vshost, \"ViewServer.Ping\", args, &reply)\n \n pb.viewnum = reply.View.Viewnum\n\t//fmt.Printf(\"ping %d %t\\n\", pb.viewnum, ok)\n\t\n\tif reply.View.Primary == pb.me && reply.View.Backup != \"\" {\n\t\t// i am the primary and has a backup\n\t\t// check if that backup is new (needs stMap)\n\t\tcknArgs := &CheckNewArgs{}\n\t\t\n\t\tvar cknReply CheckNewReply\n\t\t\n\t\tif !pb.forcedTransfer {\n\t\t\tfor count := 0; count < 5; count++ {\n\t\t\t\tok = call(reply.View.Backup, \"PBServer.Check\", cknArgs, &cknReply)\n\t\t\t\tfmt.Printf(\"call check %s %t\\n\", reply.View.Backup, ok)\n\t\t\t\tif ok {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tfmt.Println(\"-----forced transfer-----\")\n\t\t}\n\t\t\n\t\tif pb.forcedTransfer || cknReply.New {\n\t\t\t// is new\n\t\t\t// transfer the stMap to backup\n\t\t\ttmArgs := &TransferMapArgs{}\n\t\t\t\n\t\t\ttargetMap := make(map[string] string)\n\t\t\tfor key, value := range pb.stMap {\n\t\t\t\ttargetMap[key] = value\n\t\t\t}\n\t\t\ttmArgs.StMap = targetMap\n\t\t\t\n\t\t\ttargetMap2 := make(map[int64] string)\n\t\t\tfor key, value := range pb.uidMap {\n\t\t\t\ttargetMap2[key] = value\n\t\t\t}\n\t\t\ttmArgs.UIDMap = targetMap2\n\t\t\t\n\t\t\tvar tmReply TransferMapReply\n\t\t\tfor count := 0; count < 5; count++ {\n\t\t\t\tok = call(reply.View.Backup, \"PBServer.TransferMap\", tmArgs, &tmReply)\n\t\t\t\tif !ok || !tmReply.Received {\n\t\t\t\t\tfmt.Println(\"Transfer failed!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\")\n\t\t\t\t} else {\n\t\t\t\t\tfmt.Println(\"Transfer successed ***********\")\n\t\t\t\t\tpb.forcedTransfer = false\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t}\n}", "title": "" }, { "docid": "48291d02a53e8fe44bd9a694280bd333", "score": "0.45945835", "text": "func (f *WorkerStoreRequeueFunc) PushReturn(r0 error) {\n\tf.PushHook(func(context.Context, int, time.Time) error {\n\t\treturn r0\n\t})\n}", "title": "" }, { "docid": "ad675db73540e768f06f4a4953d622c0", "score": "0.4580618", "text": "func AddLongRunningStack() {\n}", "title": "" }, { "docid": "05f142b45e0c5b02a66a92c86276106d", "score": "0.45781872", "text": "func (pb *PBServer) tick() {\n\n // Your code here.\n pb.mu.Lock()\n defer pb.mu.Unlock()\n //var vsview viewservice.View\n //var err error\n vsview, err := pb.vs.Ping(pb.myview.Viewnum) \n if err != nil {\n //fmt.Printf(\"ERROR: pb.tick.ping: myview%t, vs view %t, err%t\\n\",pb.myview, vsview, err)\n return\n }\n\n if pb.myview != vsview {\n if pb.me == vsview.Primary && vsview.Backup != \"\" {\n // send pri's key/value to bak\n //fmt.Println(\"prisrv send KV to bak\")\n //fmt.Printf(\"ps:tick FISRT: prisrv %s send KV to bak %s \\n\", vsview.Primary, vsview.Backup)\n args := &KVArgs{}\n args.KV = pb.kv\n var reply KVReply\n // rpc call backsrv KV may fail\n for !call(vsview.Backup, \"PBServer.KV\", args, &reply) {\n //fmt.Printf(\"ps:tick TRY AGAIN: prisrv %s send KV to bak %s \\n\", vsview.Primary, vsview.Backup)\n newview, newerr := pb.vs.Ping(pb.myview.Viewnum)\n if newerr != nil || vsview != newview {\n break\n }\n } \n }\n\n pb.myview = vsview\n } \n}", "title": "" }, { "docid": "7a0a99685a5f35e1489a5a767b057819", "score": "0.4577716", "text": "func mainLoop(ctx context.Context, invocationClient *client.InvocationClient, batch *telemetry.Batch, telemetryChan chan []byte, logServer *logserver.LogServer, telemetryClient *telemetry.Client) (int, string) {\n\tvar (\n\t\tinvokedFunctionARN string\n\t\tlastEventStart time.Time\n\t\tlastRequestId string\n\t)\n\n\teventCounter := 0\n\tprobablyTimeout := false\n\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\t// We're already done\n\t\t\treturn eventCounter, \"\"\n\t\tdefault:\n\t\t\t// Our call to next blocks. It is likely that the container is frozen immediately after we call NextEvent.\n\t\t\tevent, err := invocationClient.NextEvent(ctx)\n\n\t\t\t// We've thawed.\n\t\t\teventStart := time.Now()\n\n\t\t\tif err != nil {\n\t\t\t\tutil.Logln(err)\n\t\t\t\terr = invocationClient.ExitError(ctx, \"NextEventError.Main\", err)\n\t\t\t\tif err != nil {\n\t\t\t\t\tutil.Logln(err)\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\teventCounter++\n\n\t\t\tif probablyTimeout {\n\t\t\t\t// We suspect a timeout. Either way, we've gotten to the next event, so telemetry will\n\t\t\t\t// have arrived for the last request if it's going to. Non-blocking poll for telemetry.\n\t\t\t\t// If we have indeed timed out, there's a chance we got telemetry out anyway. If we haven't\n\t\t\t\t// timed out, this will catch us up to the current state of telemetry, allowing us to resume.\n\t\t\t\tselect {\n\t\t\t\tcase telemetryBytes := <-telemetryChan:\n\t\t\t\t\t// We received telemetry\n\t\t\t\t\tbatch.AddTelemetry(lastRequestId, telemetryBytes)\n\t\t\t\t\tutil.Logf(\"We suspected a timeout for request %s but got telemetry anyway\", lastRequestId)\n\t\t\t\tdefault:\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tinvokedFunctionARN = event.InvokedFunctionARN\n\t\t\tlastRequestId = event.RequestID\n\n\t\t\tif event.EventType == api.Shutdown {\n\t\t\t\tif event.ShutdownReason == api.Timeout && lastRequestId != \"\" {\n\t\t\t\t\t// Synthesize the timeout error message that the platform produces, and LLC parses\n\t\t\t\t\ttimestamp := eventStart.UTC()\n\t\t\t\t\ttimeoutSecs := eventStart.Sub(lastEventStart).Seconds()\n\t\t\t\t\ttimeoutMessage := fmt.Sprintf(\n\t\t\t\t\t\t\"%s %s Task timed out after %.2f seconds\",\n\t\t\t\t\t\ttimestamp.Format(time.RFC3339),\n\t\t\t\t\t\tlastRequestId,\n\t\t\t\t\t\ttimeoutSecs,\n\t\t\t\t\t)\n\t\t\t\t\tbatch.AddTelemetry(lastRequestId, []byte(timeoutMessage))\n\t\t\t\t} else if event.ShutdownReason == api.Failure && lastRequestId != \"\" {\n\t\t\t\t\t// Synthesize a generic platform error. Probably an OOM, though it could be any runtime crash.\n\t\t\t\t\terrorMessage := fmt.Sprintf(\"RequestId: %s A platform error caused a shutdown\", lastRequestId)\n\t\t\t\t\tbatch.AddTelemetry(lastRequestId, []byte(errorMessage))\n\t\t\t\t}\n\n\t\t\t\treturn eventCounter, invokedFunctionARN\n\t\t\t}\n\n\t\t\t// Create an invocation record to hold telemetry\n\t\t\tbatch.AddInvocation(lastRequestId, eventStart)\n\n\t\t\t// Await agent telemetry. This may time out\n\t\t\t// timeoutInstant is when the invocation will time out\n\t\t\ttimeoutInstant := time.Unix(0, event.DeadlineMs*int64(time.Millisecond))\n\n\t\t\t// Set the timeout timer for a smidge before the actual timeout;\n\t\t\t// we can recover from early.\n\t\t\ttimeoutWatchBegins := 100 * time.Millisecond\n\t\t\thardTimeout := timeoutInstant.Sub(time.Now())\n\t\t\tsoftTimeout := hardTimeout - timeoutWatchBegins\n\n\t\t\thardCtx, hardCancel := context.WithTimeout(ctx, hardTimeout)\n\t\t\tdefer hardCancel()\n\n\t\t\tsoftCtx, softCancel := context.WithTimeout(hardCtx, softTimeout)\n\t\t\tdefer softCancel()\n\n\t\t\tselect {\n\t\t\tcase <-softCtx.Done():\n\t\t\t\t// We are about to timeout\n\t\t\t\tprobablyTimeout = true\n\t\t\t\tcontinue\n\t\t\tcase telemetryBytes := <-telemetryChan:\n\t\t\t\t// We received telemetry\n\t\t\t\tutil.Debugf(\"Agent telemetry bytes: %s\", base64.URLEncoding.EncodeToString(telemetryBytes))\n\t\t\t\tinv := batch.AddTelemetry(lastRequestId, telemetryBytes)\n\t\t\t\tif inv == nil {\n\t\t\t\t\tutil.Logf(\"Failed to add telemetry for request %v\", lastRequestId)\n\t\t\t\t}\n\n\t\t\t\tpollLogServer(logServer, batch)\n\t\t\t\tharvested := batch.Harvest(time.Now())\n\t\t\t\tshipHarvest(hardCtx, harvested, telemetryClient, invokedFunctionARN)\n\t\t\t}\n\n\t\t\tlastEventStart = eventStart\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1387a3710f2f55043074d9192efa0808", "score": "0.45775446", "text": "func (f *StoreRequeueIndexFunc) PushHook(hook func(context.Context, int, time.Time) error) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "4a5c4d5a7ad34fe0e8e70ebb8a9bce6f", "score": "0.457312", "text": "func (f *BundleClientMonikerResultsFunc) PushHook(hook func(context.Context, string, string, string, int, int) ([]client.Location, int, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "3bb50ee1eacabb47f16d4b973445e9c7", "score": "0.45730907", "text": "func (c WorkerStoreHeartbeatFuncCall) Args() []interface{} {\n\treturn []interface{}{c.Arg0, c.Arg1, c.Arg2}\n}", "title": "" }, { "docid": "ecd01a015b2b3d95ed45ac1bb7bc7240", "score": "0.4572448", "text": "func (r Redis) heartbeat() {\n\ttick := time.Tick(beat)\n\t// write timeout set in connection pool so each 'beat' ensures we can talk to redis (network partition) (rather than create new connection)\n\tconn := pool.Get()\n\tdefer conn.Close()\n\n\tfor _ = range tick {\n\t\tconfig.Log.Trace(\"[cluster] - Heartbeat...\")\n\t\t_, err := conn.Do(\"SET\", self, \"alive\", \"EX\", ttl)\n\t\tif err != nil {\n\t\t\tconn.Close()\n\t\t\tconfig.Log.Error(\"[cluster] - Failed to heartbeat - %s\", err)\n\t\t\t// clear balancer rules (\"stop balancing if we are 'dead'\")\n\t\t\tbalance.SetServices(make([]core.Service, 0, 0))\n\t\t\tos.Exit(1)\n\t\t}\n\t\t// re-add ourself to member list (just in case)\n\t\t_, err = conn.Do(\"SADD\", \"members\", self)\n\t\tif err != nil {\n\t\t\tconn.Close()\n\t\t\tconfig.Log.Error(\"[cluster] - Failed to add myself to list of members - %s\", err)\n\t\t\t// clear balancer rules (\"stop balancing if we are 'dead'\")\n\t\t\tbalance.SetServices(make([]core.Service, 0, 0))\n\t\t\tos.Exit(1)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ad8b0af229babf331b28f9438a5aab9d", "score": "0.4571283", "text": "func (s *Service) Heartbeat(id int64, legacyapiheartbeatrequestbodymessage *LegacyApiHeartbeatRequestBodyMessage) *HeartbeatCall {\n\tc := &HeartbeatCall{s: s, urlParams_: make(gensupport.URLParams)}\n\tc.id = id\n\tc.legacyapiheartbeatrequestbodymessage = legacyapiheartbeatrequestbodymessage\n\treturn c\n}", "title": "" }, { "docid": "872fe09651048ca7268fc981601eaebb", "score": "0.45685148", "text": "func processHeartbeatPacket(data []byte) {\n\theartbeatPacket, err := packet.ParseHeartbeat(data)\n\tif err != nil {\n\t\tif !errors.Is(err, packet.ErrInvalidHeartbeatNetworkVersion) {\n\t\t\tEvents.Error.Trigger(err)\n\t\t}\n\t\treturn\n\t}\n\tupdateAutopeeringMap(heartbeatPacket)\n}", "title": "" }, { "docid": "60644f1d92e528141fd8eec48efc21e7", "score": "0.456227", "text": "func heartbeat() {\n\t// Loop forever\n\tfor true {\n\t\tloggingClient.Info(configuration.HeartBeatMsg, \"\")\n\t\ttime.Sleep(time.Millisecond * time.Duration(configuration.HeartBeatTime)) // Sleep based on configuration\n\t}\n}", "title": "" }, { "docid": "6a558e62622bcae10db8bf109213db55", "score": "0.45531282", "text": "func (rf *Raft) sendAllHeartbeat() {\n\tDPrintf(\"num-%v sendding heartbeat\", rf.me)\n\trf.sendAllAppendEntries()\n}", "title": "" }, { "docid": "9e524091bdc1e80c8054666156a96f5f", "score": "0.45484874", "text": "func (b *broker) sendHeartbeat() {\n\tfor _ = range time.Tick(time.Duration(*connectionTimeout*b.timeoutBuffer) * time.Second) {\n\t\tctx, cancel := context.WithTimeout(context.Background(), time.Duration(*timeout)*time.Second)\n\t\tdefer cancel()\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"broker\": b.brokerId,\n\t\t\t\"address\": *brokerAddress,\n\t\t}).Debug(\"Sending heartbeat.\")\n\t\tresp, err := b.hbClient.Heartbeat(ctx, &pbHB.HeartbeatRequest{\n\t\t\tId: string(b.brokerId),\n\t\t\tAddress: *brokerAddress,\n\t\t})\n\t\tif err != nil {\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"broker\": b.brokerId,\n\t\t\t\t\"nameserver\": *nameserverAddress,\n\t\t\t\t\"error\": err,\n\t\t\t}).Error(\"Encountered error with nameserver.\")\n\t\t}\n\n\t\tif resp.GetReregister() {\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"broker\": b.brokerId,\n\t\t\t\t\"nameserver\": *nameserverAddress,\n\t\t\t}).Debug(\"Received re-register request.\")\n\t\t\terr = b.registerWithNameserver()\n\t\t\tif err != nil {\n\t\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\t\"broker\": b.brokerId,\n\t\t\t\t\t\"nameserver\": *nameserverAddress,\n\t\t\t\t\t\"error\": err,\n\t\t\t\t}).Error(\"Failed to re-register with nameserver.\")\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c01695b13a98bda7b69dbc821c12b925", "score": "0.45457345", "text": "func (f *ClientDequeueFunc) PushHook(hook func(context.Context) (store.Index, bool, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "af2e0bc6e657b788b12b166dff80945e", "score": "0.4542549", "text": "func ping(c *bm.Context) {}", "title": "" }, { "docid": "1b9172f7c9eb6ad6fdbe6a62540c6988", "score": "0.45359313", "text": "func (s *Service) WebHook(c context.Context, data []byte) (err error) {\n\twh := &blocked.WebHook{}\n\tif err = json.Unmarshal(data, &wh); err != nil {\n\t\terr = ecode.RequestErr\n\t\tlog.Error(\"webhook json rawmessage(%s) error(%v)\", string(data), err)\n\t\treturn\n\t}\n\tif wh.Verb == \"chall.SetResult\" || wh.Verb == \"chall.BatchSetResult\" {\n\t\tif wh.Target == nil || wh.Object == nil {\n\t\t\tlog.Warn(\"wh.Target or wh.Object is nil %v,%v\", wh.Target, wh.Object)\n\t\t\treturn\n\t\t}\n\t\t// appeal state not changed .\n\t\tif wh.Target.State == wh.Object.State {\n\t\t\tlog.Warn(\"appeal state not changed target=%d object=%d\", wh.Target.State, wh.Object.State)\n\t\t\treturn\n\t\t}\n\t\tswitch wh.Object.State {\n\t\tcase blocked.AppealStateSucc:\n\t\t\tif err = s.blockedDao.DB.Model(&blocked.Info{}).Where(\"case_id =?\", wh.Target.OID).Update(\"status\", blocked.BlockStateClose).Error; err != nil {\n\t\t\t\tlog.Error(\"s.blockedDao.DB error(%v)\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\ts.MsgCh <- &blocked.SysMsg{Type: blocked.MsgTypeAppealSucc, MID: wh.Target.Mid, CID: wh.Target.OID, RemoteIP: metadata.String(c, metadata.RemoteIP)}\n\t\tcase blocked.AppealStateFail:\n\t\t\ts.MsgCh <- &blocked.SysMsg{Type: blocked.MsgTypeAppealFail, MID: wh.Target.Mid, CID: wh.Target.OID, RemoteIP: metadata.String(c, metadata.RemoteIP)}\n\t\tdefault:\n\t\t\tlog.Warn(\"unknown webhook state(%d) \", wh.Object.State)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "952994a715af176b6a8ced5d37f2a256", "score": "0.45309687", "text": "func (h *HeartbeatHandler) Init(msg []byte) ([]byte, storjtelehash.HandleMessage, error) {\n\th.status = &Proving\n\tlogging.Println(h.status.Desc)\n\n\trecv := struct {\n\t\tChallenge string\n\t\tFileHash string\n\t}{}\n\terr := json.Unmarshal(msg, &recv)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\thash, err := hex.DecodeString(recv.FileHash)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\th.fileHash = hash\n\tuhandler, ok := StoredFiles.GetHandler(hash).(*UploadHandler)\n\tif ok {\n\t\th.tagHash = uhandler.tagHash\n\t}\n\thhandler, ok := StoredFiles.GetHandler(hash).(*HeartbeatHandler)\n\tif ok {\n\t\th.tagHash = hhandler.tagHash\n\t}\n\tStoredFiles.SetStatus(hash, h)\n\tvar ch heartbeat.SwizzleChallenge\n\terr = json.Unmarshal([]byte(recv.Challenge), &ch)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tt, err := os.Open(DownloadDir + \"/\" + hex.EncodeToString(h.tagHash))\n\tdefer t.Close()\n\tif err != nil {\n\t\th.status = &HeartbeatFailed\n\t\tlogging.Println(err.Error())\n\t\treturn nil, nil, err\n\t}\n\tf, err := os.Open(DownloadDir + \"/\" + hex.EncodeToString(h.fileHash))\n\tdefer f.Close()\n\tif err != nil {\n\t\th.status = &HeartbeatFailed\n\t\tlogging.Println(err.Error())\n\t\treturn nil, nil, err\n\t}\n\ttag := &heartbeat.SwizzleTag{}\n\ttag.Load(t)\n\tpv, err := ch.Prove(f, tag)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tproof, err := json.Marshal(pv)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\trpacket := struct {\n\t\tProof string\n\t}{\n\t\tstring(proof),\n\t}\n\tres, err := json.Marshal(rpacket)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\treturn res, h.ConfirmVerification, nil\n}", "title": "" }, { "docid": "b5435bb83c6a63219ac660380f2576a6", "score": "0.45278117", "text": "func (f *StoreMarkQueuedFunc) PushReturn(r0 error) {\n\tf.PushHook(func(context.Context, int, *int) error {\n\t\treturn r0\n\t})\n}", "title": "" }, { "docid": "38c10019fa870df2455505f8793f121a", "score": "0.4525668", "text": "func (f *WorkerStoreQueuedCountFunc) PushReturn(r0 int, r1 error) {\n\tf.PushHook(func(context.Context, bool) (int, error) {\n\t\treturn r0, r1\n\t})\n}", "title": "" }, { "docid": "3709ae72cf35531fed96fb7eefa02bac", "score": "0.45198208", "text": "func (monitor *extentStateMonitor) RecvStoreExtentHeartbeat(hostID string, extID string, status shared.ExtentStatus) {\n\tkey := buildExtentCacheKey(hostID, extID)\n\tmonitor.storeExtents.Put(key, &extentCacheEntry{status: status})\n}", "title": "" }, { "docid": "edb81cd1d07d841c9a69205d93dc6c3b", "score": "0.45197254", "text": "func (m *MockWorkerStore) Requeue(v0 context.Context, v1 int, v2 time.Time) error {\n\tr0 := m.RequeueFunc.nextHook()(v0, v1, v2)\n\tm.RequeueFunc.appendCall(WorkerStoreRequeueFuncCall{v0, v1, v2, r0})\n\treturn r0\n}", "title": "" }, { "docid": "edd01ddfc3f7d85dd094761fa1713bfc", "score": "0.45160234", "text": "func TestNewHeartbeat(t *testing.T) {\n\tf := libtesting.NewFixtures(t)\n\tdefer f.Cleanup()\n\n\tf.Bootstrap()\n\tf.Grow()\n\tf.Grow()\n\n\tleader := f.Leader()\n\tleaderState := f.State(leader)\n\n\t// Artificially mark all nodes as down\n\terr := leaderState.Cluster().Transaction(func(tx *db.ClusterTx) error {\n\t\tnodes, err := tx.Nodes()\n\t\tif err != nil {\n\t\t\tt.Error(err)\n\t\t}\n\t\tfor _, node := range nodes {\n\t\t\terr := tx.NodeHeartbeat(node.Address, time.Now().Add(-time.Minute))\n\t\t\tif err != nil {\n\t\t\t\tt.Error(err)\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\t// Perform the heartbeat requests.\n\theartbeatTask := heartbeat.New(\n\t\tlibtesting.NewHeartbeatGatewayShim(leader),\n\t\tleaderState.Cluster(),\n\t\theartbeat.DatabaseEndpoint,\n\t)\n\theartbeat, _ := heartbeatTask.Run()\n\tctx := context.Background()\n\theartbeat(ctx)\n\n\t// The heartbeat timestamps of all nodes got updated\n\terr = leaderState.Cluster().Transaction(func(tx *db.ClusterTx) error {\n\t\tnodes, err := tx.Nodes()\n\t\tif err != nil {\n\t\t\tt.Error(err)\n\t\t}\n\n\t\tofflineThreshold, err := tx.NodeOfflineThreshold()\n\t\tif err != nil {\n\t\t\tt.Error(err)\n\t\t}\n\n\t\tfor _, node := range nodes {\n\t\t\toffline := node.IsOffline(clock.New(), offlineThreshold)\n\t\t\tif expected, actual := false, offline; expected != actual {\n\t\t\t\tt.Errorf(\"expected: %v, actual: %v\", expected, actual)\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n}", "title": "" }, { "docid": "0743572ae96766ab18e92e1e3397b731", "score": "0.45155483", "text": "func (f *StoreDequeueFunc) PushHook(hook func(context.Context, int64) (store.Upload, store.Store, bool, error)) {\n\tf.mutex.Lock()\n\tf.hooks = append(f.hooks, hook)\n\tf.mutex.Unlock()\n}", "title": "" }, { "docid": "c4aa43801ae4b15b97103f72fed84b4f", "score": "0.4514648", "text": "func (NilEWMA) Tick() {}", "title": "" }, { "docid": "fd462ceff3ceb0035dae748fcf2baa14", "score": "0.45095533", "text": "func (h DefaultExecutorHook) AfterUpdate(ctx context.Context, query string, args ...interface{}) {}", "title": "" }, { "docid": "835c2ac5f2c0ba3c82e0596720568fda", "score": "0.4508307", "text": "func (*HeartbeatTxnRequest) Method() Method { return HeartbeatTxn }", "title": "" } ]
9211083d7688a721a199aadb75719491
Deprecated: Use Order.ProtoReflect.Descriptor instead.
[ { "docid": "bffee58454da547cc58da7f55683b2d7", "score": "0.7013984", "text": "func (*Order) Descriptor() ([]byte, []int) {\n\treturn file_proto_orders_proto_rawDescGZIP(), []int{0}\n}", "title": "" } ]
[ { "docid": "52f2dfbec203198586e45a18bcef642d", "score": "0.71197194", "text": "func (*Order) Descriptor() ([]byte, []int) {\n\treturn file_OrderProto_orderpb_order_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "c459b100fea8cdd8df99362a6063a7f3", "score": "0.70984685", "text": "func (*CreateOrderReq) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_order_GrpcOrder_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "5ec91dff44f1d77293f9485836071a78", "score": "0.7073313", "text": "func (*Order) Descriptor() ([]byte, []int) {\n\treturn file_pkg_proto_orders_orders_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "340db4baf29d974274c711386fa746af", "score": "0.7071283", "text": "func (*Order) Descriptor() ([]byte, []int) {\n\treturn file_proto_order_service_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "b7cf0a7b740ef28dacbbef142f498cfc", "score": "0.7046574", "text": "func (*SpecificOrderRequest) Descriptor() ([]byte, []int) {\n\treturn file_OrderProto_orderpb_order_proto_rawDescGZIP(), []int{16}\n}", "title": "" }, { "docid": "2cdfc55479962f4d7f84158e1972fcaa", "score": "0.700983", "text": "func (*OrderRequest) Descriptor() ([]byte, []int) {\n\treturn file_OrderProto_orderpb_order_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "bb1de0342402b144035e224e75bffe24", "score": "0.70001245", "text": "func (*GetOrderMessageReq) Descriptor() ([]byte, []int) {\n\treturn file_order_ext_proto_rawDescGZIP(), []int{12}\n}", "title": "" }, { "docid": "de7d3c3bcbbe5a972d00568f089dbb8c", "score": "0.69837654", "text": "func (*ExistingOrder) Descriptor() ([]byte, []int) {\n\treturn file_dictybase_order_order_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "ad73ee13d72041e3229b8795eb6a0551", "score": "0.6969079", "text": "func (*Order) Descriptor() ([]byte, []int) {\n\treturn file_proto_order_order_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "897b63c92dc5cc2499ef0be4a5f8f92d", "score": "0.69669044", "text": "func (*NewOrder) Descriptor() ([]byte, []int) {\n\treturn file_dictybase_order_order_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "f6cb6a640b175e811a05f73e5332a475", "score": "0.6966529", "text": "func (desc *immutable) DescriptorProto() *descpb.Descriptor {\n\treturn &descpb.Descriptor{\n\t\tUnion: &descpb.Descriptor_Schema{\n\t\t\tSchema: &desc.SchemaDescriptor,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "d2ed4f5df53a4f58685b4fa072a6e7ad", "score": "0.6962976", "text": "func (*CreateOrderResp) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_order_GrpcOrder_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "e1f26bbde98234449fa17a3fa6f8b5d2", "score": "0.69487953", "text": "func (*OrderRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_order_order_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "94dc3ecc45fb1d6be34999182793903f", "score": "0.69468427", "text": "func (*Order) Descriptor() ([]byte, []int) {\n\treturn file_idl_order_order_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "d88cb0d0267ba6c5b75384ed1e8cccd4", "score": "0.6931862", "text": "func (*OrderUpdate) Descriptor() ([]byte, []int) {\n\treturn file_dictybase_order_order_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "7b5eae051ad43ed53507f13382c9b0df", "score": "0.6923977", "text": "func (*OrderDetail) Descriptor() ([]byte, []int) {\n\treturn file_models_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "5cb40ff024c3a2270cc640151706da73", "score": "0.6921011", "text": "func (*Order) Descriptor() ([]byte, []int) {\n\treturn file_dictybase_order_order_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "e7c4a9bae29bf0cc86adc54dd0b19634", "score": "0.69180024", "text": "func (*DeprecationStatus) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "52b68ec9b826709fca1db1bf642fb1f3", "score": "0.6905647", "text": "func (*OrderID) Descriptor() ([]byte, []int) {\n\treturn file_proto_order_order_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "35406fd493528f0d1560c86c61e2ba75", "score": "0.68896604", "text": "func (*OrderCreated) Descriptor() ([]byte, []int) {\n\treturn file_internal_pkg_pb_orders_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "37ee27d252a62aa9d25e61e1a2e71da0", "score": "0.6888754", "text": "func (*CreateOrderRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuff_orderpb_pb_order_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "acaa485af04c8ee9f2598fdf03e62d84", "score": "0.6887671", "text": "func (*GetSpecificOrderRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_proto_orders_orders_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "b8ce890c7d7349de741b1c44dd8f68f3", "score": "0.6878736", "text": "func (*OrderUpdateRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_order_order_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "f4bebc4f4ea6c8969a02a80347f319d6", "score": "0.6865301", "text": "func (*GetOrderRequest) Descriptor() ([]byte, []int) {\n\treturn file_idl_order_order_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "f428292262268d489729a23f3df027b9", "score": "0.68569875", "text": "func (*DescriptorProto) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "ad704094cf65622a8f0fc5d1f05d30f9", "score": "0.685195", "text": "func (*Order) Descriptor() ([]byte, []int) {\n\treturn file_order_ext_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "5bf201597be02f94c4c0233c589a572c", "score": "0.6841693", "text": "func (*OrderId) Descriptor() ([]byte, []int) {\n\treturn file_dictybase_order_order_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "670e0e44706e85cf822ee39c1dcb0b80", "score": "0.683016", "text": "func (*DeleteOrderRequest) Descriptor() ([]byte, []int) {\n\treturn file_idl_order_order_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "7515b75896d5a3328e1194e6a175e552", "score": "0.6827663", "text": "func (*FileDescriptorProto) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "12bc29dac6ccf1265248727552e8b3fb", "score": "0.6826206", "text": "func (*GetOrderMessageRsp) Descriptor() ([]byte, []int) {\n\treturn file_order_ext_proto_rawDescGZIP(), []int{13}\n}", "title": "" }, { "docid": "a8e038f8434b318e4d9465390ffda5b4", "score": "0.68049973", "text": "func (*UpdateOrderRequest) Descriptor() ([]byte, []int) {\n\treturn file_idl_order_order_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "74f9b2f3ae9cb46dc1c7e9d0d55af63b", "score": "0.6802207", "text": "func (*OperatorContactsProto) Descriptor() ([]byte, []int) {\n\treturn file_master_proto_rawDescGZIP(), []int{14}\n}", "title": "" }, { "docid": "793fe9331f81c9e620292861b437b9b5", "score": "0.6788567", "text": "func (*EnumOptions) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{14}\n}", "title": "" }, { "docid": "858051769b76827c8882a3920f0c7aa1", "score": "0.6783239", "text": "func (*ReqSolveGooglePlayOrder) Descriptor() ([]byte, []int) {\n\treturn file_ex_proto_rawDescGZIP(), []int{355}\n}", "title": "" }, { "docid": "c0bbdb90687a8dabbff254203320d029", "score": "0.6782429", "text": "func (*OrderUpdateAttributes) Descriptor() ([]byte, []int) {\n\treturn file_dictybase_order_order_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "489391f28bfdc73c0bfa76c616345b54", "score": "0.6779647", "text": "func (*NewOrderAttributes) Descriptor() ([]byte, []int) {\n\treturn file_dictybase_order_order_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "ae5cf538b68ba8b3dfbcf4cb94fd6a2f", "score": "0.6779339", "text": "func (*NewOrder_Data) Descriptor() ([]byte, []int) {\n\treturn file_dictybase_order_order_proto_rawDescGZIP(), []int{3, 0}\n}", "title": "" }, { "docid": "ba338294db79909047563cae214d2df6", "score": "0.67729115", "text": "func (*Proto) Descriptor() ([]byte, []int) {\n\treturn file_base_base_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "1ba9cb21e75510ec55797c26974eebdc", "score": "0.6770966", "text": "func (*Extension) Descriptor() ([]byte, []int) {\n\treturn file_reflection_grpc_testing_proto2_ext_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "538185adfeb6072f68c1e7f0df26bc85", "score": "0.6762935", "text": "func (*Customer) Descriptor() ([]byte, []int) {\n\treturn file_OrderProto_orderpb_order_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "2f2e5fe76cefd0b652d95eb872aaad62", "score": "0.676266", "text": "func (*Legacy) Descriptor() ([]byte, []int) {\n\treturn file_internal_testprotos_legacy_legacy_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "ccedd94dc0435ca7fc07e208b85a4fa6", "score": "0.67529273", "text": "func (*ProtoMsg) Descriptor() ([]byte, []int) {\n\treturn file_proto_msg_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "a5add2c0f10a9c68f4e037408539b1a3", "score": "0.674613", "text": "func (*OrderAttributes) Descriptor() ([]byte, []int) {\n\treturn file_dictybase_order_order_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "6d9ac10728eb3e37fe6223dc3496f5fd", "score": "0.6740089", "text": "func (*RequestModifyOrder) Descriptor() ([]byte, []int) {\n\treturn file_request_modify_order_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "a8f18a9a9b4d281df66d2f955a691318", "score": "0.6736151", "text": "func (*CreateOrderRequest) Descriptor() ([]byte, []int) {\n\treturn file_idl_order_order_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "eafc710b36fa855f95af951cdb7457bf", "score": "0.6730781", "text": "func (sd *ServiceDescriptor) AsProto() proto.Message {\n\treturn sd.proto\n}", "title": "" }, { "docid": "bc526f88c2d486966245edbaa6352297", "score": "0.6730067", "text": "func (*ExistingOrderAttributes) Descriptor() ([]byte, []int) {\n\treturn file_dictybase_order_order_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "d244309ac44d4f3549471348874c3e05", "score": "0.6726629", "text": "func (*UpdateChannelOrderRequest) Descriptor() ([]byte, []int) {\n\treturn file_core_v1_core_proto_rawDescGZIP(), []int{34}\n}", "title": "" }, { "docid": "7f83094471aa731aee13382e800a25a1", "score": "0.6723653", "text": "func (*OrderCommentReq) Descriptor() ([]byte, []int) {\n\treturn file_order_ext_proto_rawDescGZIP(), []int{18}\n}", "title": "" }, { "docid": "327e34214088eb56011c153d9362894b", "score": "0.67190015", "text": "func (*DeleteOrderResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_order_order_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "930a138896ad594088ec5aaf787bd866", "score": "0.6710209", "text": "func (*OrderCollection) Descriptor() ([]byte, []int) {\n\treturn file_dictybase_order_order_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "320582e343575671299260e506fc95f0", "score": "0.67082655", "text": "func (*ReqCreateAlipayOrder) Descriptor() ([]byte, []int) {\n\treturn file_ex_proto_rawDescGZIP(), []int{231}\n}", "title": "" }, { "docid": "90a1f8be447b2acce7ae401acc7fdf00", "score": "0.6705773", "text": "func (*VehicleProto) Descriptor() ([]byte, []int) {\n\treturn file_master_proto_rawDescGZIP(), []int{17}\n}", "title": "" }, { "docid": "d8d920fe90ae56772a0119577ded24fd", "score": "0.6704968", "text": "func (*Order_Payload) Descriptor() ([]byte, []int) {\n\treturn file_order_proto_rawDescGZIP(), []int{0, 0}\n}", "title": "" }, { "docid": "6db6605d6227894d6e69ac62079a7c65", "score": "0.6702044", "text": "func (*OrderRequest) Descriptor() ([]byte, []int) {\n\treturn file_order_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "2771229e589ad6bdf467b99fb150ab3d", "score": "0.6699834", "text": "func (*CreateOrderResponse) Descriptor() ([]byte, []int) {\n\treturn file_protobuff_orderpb_pb_order_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "e1162b163843ed479822c4f74a46119a", "score": "0.6699023", "text": "func (*ReqCancelGooglePlayOrder) Descriptor() ([]byte, []int) {\n\treturn file_ex_proto_rawDescGZIP(), []int{214}\n}", "title": "" }, { "docid": "9236521b11cbae0ee9ca4c2a96fea161", "score": "0.6697433", "text": "func (*PayOrderReq) Descriptor() ([]byte, []int) {\n\treturn file_order_ext_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "8bb94fb0bbd2ddbf34fe6194d7b1e39f", "score": "0.66949475", "text": "func (*Order) Descriptor() ([]byte, []int) {\n\treturn file_order_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "1d0e15b60496a373954848fc7877cd98", "score": "0.6694394", "text": "func (*EnumDescriptorProto) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "4d6571ddf2eda6eb4e085500ffdbe13d", "score": "0.6692654", "text": "func (*Type) Descriptor() ([]byte, []int) {\n\treturn file_protos_krpc_proto_rawDescGZIP(), []int{18}\n}", "title": "" }, { "docid": "b5f94ac11a8e36a44812f357ee68d2ee", "score": "0.66881526", "text": "func (*ReqCreateENPaypalOrder) Descriptor() ([]byte, []int) {\n\treturn file_ex_proto_rawDescGZIP(), []int{238}\n}", "title": "" }, { "docid": "dec748cd90aec4fb2913e6137b52564b", "score": "0.6686873", "text": "func (*ReqSolveGooglePlayOrderV3) Descriptor() ([]byte, []int) {\n\treturn file_ex_proto_rawDescGZIP(), []int{356}\n}", "title": "" }, { "docid": "78fc4a47a79cdbcb31f22c0dc914b8e5", "score": "0.6684263", "text": "func (*VehicleHistoryProto) Descriptor() ([]byte, []int) {\n\treturn file_master_proto_rawDescGZIP(), []int{18}\n}", "title": "" }, { "docid": "5bc098405d45accf357de985636b5907", "score": "0.66807574", "text": "func (*Todo) Descriptor() ([]byte, []int) {\n\treturn file_src_delivery_grpc_todo_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "08769e5a10cf269650ed11f006f7aa3b", "score": "0.66783214", "text": "func (*FleetContactProto) Descriptor() ([]byte, []int) {\n\treturn file_master_proto_rawDescGZIP(), []int{19}\n}", "title": "" }, { "docid": "4d2d04da5c636a4c8cba777ffb27e37b", "score": "0.6677056", "text": "func (*OperatorProto) Descriptor() ([]byte, []int) {\n\treturn file_master_proto_rawDescGZIP(), []int{12}\n}", "title": "" }, { "docid": "4731e0fd9a56e4a87a5073869f72b8fc", "score": "0.66729486", "text": "func (*FleetProto) Descriptor() ([]byte, []int) {\n\treturn file_master_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "d1675157efd42c264d78684989d90597", "score": "0.6659779", "text": "func (*GetOrderHistoryRequest) Descriptor() ([]byte, []int) {\n\treturn file_orderhistoryapi_pb_service_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "cf0fc925318c60c1a2379269b1fcb36a", "score": "0.66592366", "text": "func (*LegacyMessage) Descriptor() ([]byte, []int) {\n\treturn file_protos_p2p_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "09ab03585ccec1c7f88c1e607b523c0a", "score": "0.6658759", "text": "func (*TargetGrpcProxy) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{476}\n}", "title": "" }, { "docid": "6a6cd4a25208b66c659e564deb01760c", "score": "0.66576415", "text": "func (*LookAlreadyOrdersReq) Descriptor() ([]byte, []int) {\n\treturn file_order_ext_proto_rawDescGZIP(), []int{15}\n}", "title": "" }, { "docid": "f94d4359ba95a50d07c5cf7eda36ffde", "score": "0.66559935", "text": "func (*Enum) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_type_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "e75e263d9b92be4a0477b0d0b63f864a", "score": "0.66551346", "text": "func (*ReqCreateENVisaOrder) Descriptor() ([]byte, []int) {\n\treturn file_ex_proto_rawDescGZIP(), []int{239}\n}", "title": "" }, { "docid": "5a09b143c0c440591666bc50ab740130", "score": "0.66538846", "text": "func (*PayOrder) Descriptor() ([]byte, []int) {\n\treturn file_pay_db_service_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "f5f04f9b7ce98b24571e8ed640b8c28a", "score": "0.6648606", "text": "func (*LookOrdersReq) Descriptor() ([]byte, []int) {\n\treturn file_order_ext_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "9578ecd7e15a7364c9173df4197dfdcd", "score": "0.6647764", "text": "func (*Msg) Descriptor() ([]byte, []int) {\n\treturn file_grpc_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "000f583364878e06987bb3ed7a5fad32", "score": "0.6644158", "text": "func (*OrderCommentRsp) Descriptor() ([]byte, []int) {\n\treturn file_order_ext_proto_rawDescGZIP(), []int{19}\n}", "title": "" }, { "docid": "325b89e27e06fa761e8e193b6f3c8add", "score": "0.6635497", "text": "func (*LineDelta) Descriptor() ([]byte, []int) {\n\treturn file_internal_proto_lines_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "80ffe6ddd684e280f1a1e80ebc5dcf49", "score": "0.6630458", "text": "func (*SpecificOrderResponse) Descriptor() ([]byte, []int) {\n\treturn file_OrderProto_orderpb_order_proto_rawDescGZIP(), []int{17}\n}", "title": "" }, { "docid": "65e659b2e51f9c026f870ce68e88870c", "score": "0.66299504", "text": "func (*OrderUpdate_Data) Descriptor() ([]byte, []int) {\n\treturn file_dictybase_order_order_proto_rawDescGZIP(), []int{7, 0}\n}", "title": "" }, { "docid": "1476ac87895f6bf388dd07f857a0b18f", "score": "0.66275895", "text": "func (*SomeMsg) Descriptor() ([]byte, []int) {\n\treturn file_example_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "5df2c2817cf50609bc1187c31c0b2b8d", "score": "0.6616966", "text": "func (*VehicleAddressProto) Descriptor() ([]byte, []int) {\n\treturn file_master_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "76535508fb55a38f6c7280587e9aa1a7", "score": "0.6615495", "text": "func (*TradeInfo) Descriptor() ([]byte, []int) {\n\treturn file_operator_proto_rawDescGZIP(), []int{43}\n}", "title": "" }, { "docid": "b7b6c428a2dc97e812c8af6b11a41263", "score": "0.66127664", "text": "func (*FamilyMsg) Descriptor() ([]byte, []int) {\n\treturn file_proto_demo_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "13d7828e4a7cdeb47f4e79d78e1371d1", "score": "0.6612735", "text": "func (*Order_Data) Descriptor() ([]byte, []int) {\n\treturn file_dictybase_order_order_proto_rawDescGZIP(), []int{1, 0}\n}", "title": "" }, { "docid": "c45864bb735ca8aad5cbee6843f3b3c2", "score": "0.66118634", "text": "func (*PeerElement) Descriptor() ([]byte, []int) {\n\treturn file_p2p_rpc_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "9f46918a67a6a0f23bc6077e09c34efc", "score": "0.66115683", "text": "func (*ReqCreatePaypalOrder) Descriptor() ([]byte, []int) {\n\treturn file_ex_proto_rawDescGZIP(), []int{251}\n}", "title": "" }, { "docid": "4adac2cea5c7c2e45a00b1c70d5d7b79", "score": "0.661108", "text": "func (*AddPeerReq) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "7cd4c288fec6be2578a25c8e5ae7ad7c", "score": "0.66109043", "text": "func (*GeneratedCodeInfo) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{20}\n}", "title": "" }, { "docid": "9a30c79746b1ef2dea1c9d6e257aaa42", "score": "0.66084737", "text": "func (*MMessage) Descriptor() ([]byte, []int) {\n\treturn file_proto_order_order_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "894bf4416f1f70326a11e5305a17e4b0", "score": "0.6605974", "text": "func (*ReqCreateENAlipayOrder) Descriptor() ([]byte, []int) {\n\treturn file_ex_proto_rawDescGZIP(), []int{235}\n}", "title": "" }, { "docid": "b4c2a83a70d3be2a708339ae9fe7825d", "score": "0.6605182", "text": "func (*Embed) Descriptor() ([]byte, []int) {\n\treturn file_chat_v1_messages_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "b84d869d53c6e0e8e804f7fa038d02f6", "score": "0.660013", "text": "func (*OrderResponse) Descriptor() ([]byte, []int) {\n\treturn file_OrderProto_orderpb_order_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "a0452d311d21ac6aeb888577c970ec8d", "score": "0.6596445", "text": "func (*MessageInfo) Descriptor() ([]byte, []int) {\n\treturn file_common_proto_rawDescGZIP(), []int{20}\n}", "title": "" }, { "docid": "3f7e1f50c0ae4ea9a87980be96424732", "score": "0.6594962", "text": "func (*ExistingOrder_Data) Descriptor() ([]byte, []int) {\n\treturn file_dictybase_order_order_proto_rawDescGZIP(), []int{5, 0}\n}", "title": "" }, { "docid": "e12ce259e362e50fd437fc44800ef4af", "score": "0.65923065", "text": "func (*OrderRequest) Descriptor() ([]byte, []int) {\n\treturn file_messageStream_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "cfd2a0feb4d3be8b1b646b04f769f512", "score": "0.65903515", "text": "func (*Message) Descriptor() ([]byte, []int) {\n\treturn file_internal_module_reverse_tunnel_rpc_rpc_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "47e74bd1e866e2ee8bc22786dea1f09e", "score": "0.6587145", "text": "func (*LookOrdersRsp) Descriptor() ([]byte, []int) {\n\treturn file_order_ext_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "84562b170f4a5b6b2aa3686e44d44409", "score": "0.65850776", "text": "func (*OrderResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_order_order_proto_rawDescGZIP(), []int{2}\n}", "title": "" } ]
d35edd664dcfdb62d2358d3d99869b8a
GetDeploymentFailJSONMocked test mocked function
[ { "docid": "8a0de9d74530098921718c81408d9861", "score": "0.80652183", "text": "func GetDeploymentFailJSONMocked(\n\tt *testing.T,\n\tcloudSpecificExtensionDeploymentIn *types.CloudSpecificExtensionDeployment,\n) *types.CloudSpecificExtensionDeployment {\n\n\tassert := assert.New(t)\n\n\t// wire up\n\tcs := &utils.MockConcertoService{}\n\tds, err := NewCloudSpecificExtensionDeploymentService(cs)\n\tassert.Nil(err, \"Couldn't load cloudSpecificExtensionDeployment service\")\n\tassert.NotNil(ds, \"CloudSpecificExtensionDeployment service not instanced\")\n\n\t// wrong json\n\tdIn := []byte{10, 20, 30}\n\n\t// call service\n\tcs.On(\"Get\", fmt.Sprintf(APIPathCseDeployment, cloudSpecificExtensionDeploymentIn.ID)).Return(dIn, 200, nil)\n\tcloudSpecificExtensionDeploymentOut, err := ds.GetDeployment(cloudSpecificExtensionDeploymentIn.ID)\n\n\tassert.NotNil(err, \"We are expecting a marshalling error\")\n\tassert.Nil(cloudSpecificExtensionDeploymentOut, \"Expecting nil output\")\n\tassert.Contains(err.Error(), \"invalid character\", \"Error message should include the string 'invalid character'\")\n\n\treturn cloudSpecificExtensionDeploymentOut\n}", "title": "" } ]
[ { "docid": "7854bda1551833978330088de0c7bc64", "score": "0.7155801", "text": "func CreateDeploymentFailJSONMocked(\n\tt *testing.T,\n\ttemplateID string,\n\tcloudSpecificExtensionDeploymentIn *types.CloudSpecificExtensionDeployment,\n) *types.CloudSpecificExtensionDeployment {\n\n\tassert := assert.New(t)\n\n\t// wire up\n\tcs := &utils.MockConcertoService{}\n\tds, err := NewCloudSpecificExtensionDeploymentService(cs)\n\tassert.Nil(err, \"Couldn't load cloudSpecificExtensionDeployment service\")\n\tassert.NotNil(ds, \"CloudSpecificExtensionDeployment service not instanced\")\n\n\t// convertMap\n\tmapIn, err := utils.ItemConvertParams(*cloudSpecificExtensionDeploymentIn)\n\tassert.Nil(err, \"CloudSpecificExtensionDeployment test data corrupted\")\n\n\t// wrong json\n\tdIn := []byte{10, 20, 30}\n\n\t// call service\n\tcs.On(\"Post\", fmt.Sprintf(APIPathCseTemplateDeployments, templateID), mapIn).Return(dIn, 200, nil)\n\tcloudSpecificExtensionDeploymentOut, err := ds.CreateDeployment(templateID, mapIn)\n\n\tassert.NotNil(err, \"We are expecting a marshalling error\")\n\tassert.Nil(cloudSpecificExtensionDeploymentOut, \"Expecting nil output\")\n\tassert.Contains(err.Error(), \"invalid character\", \"Error message should include the string 'invalid character'\")\n\n\treturn cloudSpecificExtensionDeploymentOut\n}", "title": "" }, { "docid": "7a16366f178ac712cb6166bcf35e3d3b", "score": "0.69997764", "text": "func GetDeploymentFailStatusMocked(\n\tt *testing.T,\n\tcloudSpecificExtensionDeploymentIn *types.CloudSpecificExtensionDeployment,\n) *types.CloudSpecificExtensionDeployment {\n\n\tassert := assert.New(t)\n\n\t// wire up\n\tcs := &utils.MockConcertoService{}\n\tds, err := NewCloudSpecificExtensionDeploymentService(cs)\n\tassert.Nil(err, \"Couldn't load cloudSpecificExtensionDeployment service\")\n\tassert.NotNil(ds, \"CloudSpecificExtensionDeployment service not instanced\")\n\n\t// to json\n\tdIn, err := json.Marshal(cloudSpecificExtensionDeploymentIn)\n\tassert.Nil(err, \"CloudSpecificExtensionDeployment test data corrupted\")\n\n\t// call service\n\tcs.On(\"Get\", fmt.Sprintf(APIPathCseDeployment, cloudSpecificExtensionDeploymentIn.ID)).Return(dIn, 499, nil)\n\tcloudSpecificExtensionDeploymentOut, err := ds.GetDeployment(cloudSpecificExtensionDeploymentIn.ID)\n\n\tassert.NotNil(err, \"We are expecting an status code error\")\n\tassert.Nil(cloudSpecificExtensionDeploymentOut, \"Expecting nil output\")\n\tassert.Contains(err.Error(), \"499\", \"Error should contain http code 499\")\n\n\treturn cloudSpecificExtensionDeploymentOut\n}", "title": "" }, { "docid": "873312946849bf5f6a38bb8237fd76f0", "score": "0.6894558", "text": "func UpdateDeploymentFailJSONMocked(\n\tt *testing.T,\n\tcloudSpecificExtensionDeploymentIn *types.CloudSpecificExtensionDeployment,\n) *types.CloudSpecificExtensionDeployment {\n\n\tassert := assert.New(t)\n\n\t// wire up\n\tcs := &utils.MockConcertoService{}\n\tds, err := NewCloudSpecificExtensionDeploymentService(cs)\n\tassert.Nil(err, \"Couldn't load cloudSpecificExtensionDeployment service\")\n\tassert.NotNil(ds, \"CloudSpecificExtensionDeployment service not instanced\")\n\n\t// convertMap\n\tmapIn, err := utils.ItemConvertParams(*cloudSpecificExtensionDeploymentIn)\n\tassert.Nil(err, \"CloudSpecificExtensionDeployment test data corrupted\")\n\n\t// wrong json\n\tdIn := []byte{10, 20, 30}\n\n\t// call service\n\tcs.On(\"Put\", fmt.Sprintf(APIPathCseDeployment, cloudSpecificExtensionDeploymentIn.ID), mapIn).Return(dIn, 200, nil)\n\tcloudSpecificExtensionDeploymentOut, err := ds.UpdateDeployment(cloudSpecificExtensionDeploymentIn.ID, mapIn)\n\n\tassert.NotNil(err, \"We are expecting a marshalling error\")\n\tassert.Nil(cloudSpecificExtensionDeploymentOut, \"Expecting nil output\")\n\tassert.Contains(err.Error(), \"invalid character\", \"Error message should include the string 'invalid character'\")\n\n\treturn cloudSpecificExtensionDeploymentOut\n}", "title": "" }, { "docid": "93ea061ba86c42c05bde78ee84490010", "score": "0.6727257", "text": "func GetDeploymentFailErrMocked(\n\tt *testing.T,\n\tcloudSpecificExtensionDeploymentIn *types.CloudSpecificExtensionDeployment,\n) *types.CloudSpecificExtensionDeployment {\n\n\tassert := assert.New(t)\n\n\t// wire up\n\tcs := &utils.MockConcertoService{}\n\tds, err := NewCloudSpecificExtensionDeploymentService(cs)\n\tassert.Nil(err, \"Couldn't load cloudSpecificExtensionDeployment service\")\n\tassert.NotNil(ds, \"CloudSpecificExtensionDeployment service not instanced\")\n\n\t// to json\n\tdIn, err := json.Marshal(cloudSpecificExtensionDeploymentIn)\n\tassert.Nil(err, \"CloudSpecificExtensionDeployment test data corrupted\")\n\n\t// call service\n\tcs.On(\"Get\", fmt.Sprintf(APIPathCseDeployment, cloudSpecificExtensionDeploymentIn.ID)).\n\t\tReturn(dIn, 200, fmt.Errorf(\"mocked error\"))\n\tcloudSpecificExtensionDeploymentOut, err := ds.GetDeployment(cloudSpecificExtensionDeploymentIn.ID)\n\n\tassert.NotNil(err, \"We are expecting an error\")\n\tassert.Nil(cloudSpecificExtensionDeploymentOut, \"Expecting nil output\")\n\tassert.Equal(err.Error(), \"mocked error\", \"Error should be 'mocked error'\")\n\n\treturn cloudSpecificExtensionDeploymentOut\n}", "title": "" }, { "docid": "24584c0363eac3f1dbb4b8c9348ba0c1", "score": "0.672011", "text": "func ListDeploymentsFailJSONMocked(\n\tt *testing.T,\n\tcloudSpecificExtensionDeploymentsIn []*types.CloudSpecificExtensionDeployment,\n) []*types.CloudSpecificExtensionDeployment {\n\n\tassert := assert.New(t)\n\n\t// wire up\n\tcs := &utils.MockConcertoService{}\n\tds, err := NewCloudSpecificExtensionDeploymentService(cs)\n\tassert.Nil(err, \"Couldn't load cloudSpecificExtensionDeployment service\")\n\tassert.NotNil(ds, \"CloudSpecificExtensionDeployment service not instanced\")\n\n\t// wrong json\n\tdIn := []byte{10, 20, 30}\n\n\t// call service\n\tcs.On(\"Get\", APIPathCseDeployments).Return(dIn, 200, nil)\n\tcloudSpecificExtensionDeploymentsOut, err := ds.ListDeployments()\n\n\tassert.NotNil(err, \"We are expecting a marshalling error\")\n\tassert.Nil(cloudSpecificExtensionDeploymentsOut, \"Expecting nil output\")\n\tassert.Contains(err.Error(), \"invalid character\", \"Error message should include the string 'invalid character'\")\n\n\treturn cloudSpecificExtensionDeploymentsOut\n}", "title": "" }, { "docid": "5b4f89b9f787007352d24c2170e0e690", "score": "0.6688932", "text": "func DeleteDeploymentFailJSONMocked(\n\tt *testing.T,\n\tcloudSpecificExtensionDeploymentIn *types.CloudSpecificExtensionDeployment,\n) *types.CloudSpecificExtensionDeployment {\n\n\tassert := assert.New(t)\n\n\t// wire up\n\tcs := &utils.MockConcertoService{}\n\tds, err := NewCloudSpecificExtensionDeploymentService(cs)\n\tassert.Nil(err, \"Couldn't load cloudSpecificExtensionDeployment service\")\n\tassert.NotNil(ds, \"CloudSpecificExtensionDeployment service not instanced\")\n\n\t// wrong json\n\tdIn := []byte{10, 20, 30}\n\n\t// call service\n\tcs.On(\"Delete\", fmt.Sprintf(APIPathCseDeployment, cloudSpecificExtensionDeploymentIn.ID)).Return(dIn, 200, nil)\n\tcloudSpecificExtensionDeploymentOut, err := ds.DeleteDeployment(cloudSpecificExtensionDeploymentIn.ID)\n\n\tassert.NotNil(err, \"We are expecting a marshalling error\")\n\tassert.Nil(cloudSpecificExtensionDeploymentOut, \"Expecting nil output\")\n\tassert.Contains(err.Error(), \"invalid character\", \"Error message should include the string 'invalid character'\")\n\n\treturn cloudSpecificExtensionDeploymentOut\n}", "title": "" }, { "docid": "74b87f2aa239adec7cd32f274f588ca3", "score": "0.64035153", "text": "func GetLoadBalancerPlanFailJSONMocked(\n\tt *testing.T,\n\tloadBalancerPlanID string,\n\tloadBalancerPlanIn *types.LoadBalancerPlan,\n) *types.LoadBalancerPlan {\n\n\tassert := assert.New(t)\n\n\t// wire up\n\tcs := &utils.MockConcertoService{}\n\tds, err := NewLoadBalancerService(cs)\n\tassert.Nil(err, \"Couldn't load loadBalancer service\")\n\tassert.NotNil(ds, \"LoadBalancer service not instanced\")\n\n\t// wrong json\n\tdIn := []byte{10, 20, 30}\n\n\t// call service\n\tcs.On(\"Get\", fmt.Sprintf(APIPathNetworkLoadBalancerPlan, loadBalancerPlanID)).Return(dIn, 200, nil)\n\tloadBalancerPlanOut, err := ds.GetLoadBalancerPlan(loadBalancerPlanID)\n\n\tassert.NotNil(err, \"We are expecting a marshalling error\")\n\tassert.Nil(loadBalancerPlanOut, \"Expecting nil output\")\n\tassert.Contains(err.Error(), \"invalid character\", \"Error message should include the string 'invalid character'\")\n\n\treturn loadBalancerPlanOut\n}", "title": "" }, { "docid": "53eef0575421c9f49de417c1c5c4c733", "score": "0.63967043", "text": "func GetLoadBalancerFailJSONMocked(t *testing.T, loadBalancerIn *types.LoadBalancer) *types.LoadBalancer {\n\n\tassert := assert.New(t)\n\n\t// wire up\n\tcs := &utils.MockConcertoService{}\n\tds, err := NewLoadBalancerService(cs)\n\tassert.Nil(err, \"Couldn't load loadBalancer service\")\n\tassert.NotNil(ds, \"LoadBalancer service not instanced\")\n\n\t// wrong json\n\tdIn := []byte{10, 20, 30}\n\n\t// call service\n\tcs.On(\"Get\", fmt.Sprintf(APIPathNetworkLoadBalancer, loadBalancerIn.ID)).Return(dIn, 200, nil)\n\tloadBalancerOut, err := ds.GetLoadBalancer(loadBalancerIn.ID)\n\n\tassert.NotNil(err, \"We are expecting a marshalling error\")\n\tassert.Nil(loadBalancerOut, \"Expecting nil output\")\n\tassert.Contains(err.Error(), \"invalid character\", \"Error message should include the string 'invalid character'\")\n\n\treturn loadBalancerOut\n}", "title": "" }, { "docid": "f8e0ce015355a8079edc50a42a3751a8", "score": "0.6344738", "text": "func CreateDeploymentFailErrMocked(\n\tt *testing.T,\n\ttemplateID string,\n\tcloudSpecificExtensionDeploymentIn *types.CloudSpecificExtensionDeployment,\n) *types.CloudSpecificExtensionDeployment {\n\n\tassert := assert.New(t)\n\n\t// wire up\n\tcs := &utils.MockConcertoService{}\n\tds, err := NewCloudSpecificExtensionDeploymentService(cs)\n\tassert.Nil(err, \"Couldn't load cloudSpecificExtensionDeployment service\")\n\tassert.NotNil(ds, \"CloudSpecificExtensionDeployment service not instanced\")\n\n\t// convertMap\n\tmapIn, err := utils.ItemConvertParams(*cloudSpecificExtensionDeploymentIn)\n\tassert.Nil(err, \"CloudSpecificExtensionDeployment test data corrupted\")\n\n\t// to json\n\tdOut, err := json.Marshal(cloudSpecificExtensionDeploymentIn)\n\tassert.Nil(err, \"CloudSpecificExtensionDeployment test data corrupted\")\n\n\t// call service\n\tcs.On(\"Post\", fmt.Sprintf(APIPathCseTemplateDeployments, templateID), mapIn).\n\t\tReturn(dOut, 200, fmt.Errorf(\"mocked error\"))\n\tcloudSpecificExtensionDeploymentOut, err := ds.CreateDeployment(templateID, mapIn)\n\n\tassert.NotNil(err, \"We are expecting an error\")\n\tassert.Nil(cloudSpecificExtensionDeploymentOut, \"Expecting nil output\")\n\tassert.Equal(err.Error(), \"mocked error\", \"Error should be 'mocked error'\")\n\n\treturn cloudSpecificExtensionDeploymentOut\n}", "title": "" }, { "docid": "8b48106e59fe6118fae450d1e5ea9f02", "score": "0.63269097", "text": "func FailJson(responseBody ModuleResponse) {\n\tif responseBody.Failed != false {\n\t\tpanic(\"Failed response expected in FailJson call!\")\n\t}\n\trtrn(responseBody)\n}", "title": "" }, { "docid": "3102dcca4a610f8b0fd676d22cc2b22b", "score": "0.6311445", "text": "func CreateDeploymentFailStatusMocked(\n\tt *testing.T,\n\ttemplateID string,\n\tcloudSpecificExtensionDeploymentIn *types.CloudSpecificExtensionDeployment,\n) *types.CloudSpecificExtensionDeployment {\n\n\tassert := assert.New(t)\n\n\t// wire up\n\tcs := &utils.MockConcertoService{}\n\tds, err := NewCloudSpecificExtensionDeploymentService(cs)\n\tassert.Nil(err, \"Couldn't load cloudSpecificExtensionDeployment service\")\n\tassert.NotNil(ds, \"CloudSpecificExtensionDeployment service not instanced\")\n\n\t// convertMap\n\tmapIn, err := utils.ItemConvertParams(*cloudSpecificExtensionDeploymentIn)\n\tassert.Nil(err, \"CloudSpecificExtensionDeployment test data corrupted\")\n\n\t// to json\n\tdOut, err := json.Marshal(cloudSpecificExtensionDeploymentIn)\n\tassert.Nil(err, \"CloudSpecificExtensionDeployment test data corrupted\")\n\n\t// call service\n\tcs.On(\"Post\", fmt.Sprintf(APIPathCseTemplateDeployments, templateID), mapIn).Return(dOut, 499, nil)\n\tcloudSpecificExtensionDeploymentOut, err := ds.CreateDeployment(templateID, mapIn)\n\n\tassert.NotNil(err, \"We are expecting an status code error\")\n\tassert.Nil(cloudSpecificExtensionDeploymentOut, \"Expecting nil output\")\n\tassert.Contains(err.Error(), \"499\", \"Error should contain http code 499\")\n\n\treturn cloudSpecificExtensionDeploymentOut\n}", "title": "" }, { "docid": "be20518453dd56008b142ca0446b842c", "score": "0.6123767", "text": "func UpdateDeploymentFailStatusMocked(\n\tt *testing.T,\n\tcloudSpecificExtensionDeploymentIn *types.CloudSpecificExtensionDeployment,\n) *types.CloudSpecificExtensionDeployment {\n\n\tassert := assert.New(t)\n\n\t// wire up\n\tcs := &utils.MockConcertoService{}\n\tds, err := NewCloudSpecificExtensionDeploymentService(cs)\n\tassert.Nil(err, \"Couldn't load cloudSpecificExtensionDeployment service\")\n\tassert.NotNil(ds, \"CloudSpecificExtensionDeployment service not instanced\")\n\n\t// convertMap\n\tmapIn, err := utils.ItemConvertParams(*cloudSpecificExtensionDeploymentIn)\n\tassert.Nil(err, \"CloudSpecificExtensionDeployment test data corrupted\")\n\n\t// to json\n\tdOut, err := json.Marshal(cloudSpecificExtensionDeploymentIn)\n\tassert.Nil(err, \"CloudSpecificExtensionDeployment test data corrupted\")\n\n\t// call service\n\tcs.On(\"Put\", fmt.Sprintf(APIPathCseDeployment, cloudSpecificExtensionDeploymentIn.ID), mapIn).\n\t\tReturn(dOut, 499, nil)\n\tcloudSpecificExtensionDeploymentOut, err := ds.UpdateDeployment(cloudSpecificExtensionDeploymentIn.ID, mapIn)\n\n\tassert.NotNil(err, \"We are expecting an status code error\")\n\tassert.Nil(cloudSpecificExtensionDeploymentOut, \"Expecting nil output\")\n\tassert.Contains(err.Error(), \"499\", \"Error should contain http code 499\")\n\n\treturn cloudSpecificExtensionDeploymentOut\n}", "title": "" }, { "docid": "ba1992d6608ef35055958e2401914410", "score": "0.6108437", "text": "func UpdateDeploymentFailErrMocked(\n\tt *testing.T,\n\tcloudSpecificExtensionDeploymentIn *types.CloudSpecificExtensionDeployment,\n) *types.CloudSpecificExtensionDeployment {\n\n\tassert := assert.New(t)\n\n\t// wire up\n\tcs := &utils.MockConcertoService{}\n\tds, err := NewCloudSpecificExtensionDeploymentService(cs)\n\tassert.Nil(err, \"Couldn't load cloudSpecificExtensionDeployment service\")\n\tassert.NotNil(ds, \"CloudSpecificExtensionDeployment service not instanced\")\n\n\t// convertMap\n\tmapIn, err := utils.ItemConvertParams(*cloudSpecificExtensionDeploymentIn)\n\tassert.Nil(err, \"CloudSpecificExtensionDeployment test data corrupted\")\n\n\t// to json\n\tdOut, err := json.Marshal(cloudSpecificExtensionDeploymentIn)\n\tassert.Nil(err, \"CloudSpecificExtensionDeployment test data corrupted\")\n\n\t// call service\n\tcs.On(\"Put\", fmt.Sprintf(APIPathCseDeployment, cloudSpecificExtensionDeploymentIn.ID), mapIn).\n\t\tReturn(dOut, 200, fmt.Errorf(\"mocked error\"))\n\tcloudSpecificExtensionDeploymentOut, err := ds.UpdateDeployment(cloudSpecificExtensionDeploymentIn.ID, mapIn)\n\n\tassert.NotNil(err, \"We are expecting an error\")\n\tassert.Nil(cloudSpecificExtensionDeploymentOut, \"Expecting nil output\")\n\tassert.Equal(err.Error(), \"mocked error\", \"Error should be 'mocked error'\")\n\n\treturn cloudSpecificExtensionDeploymentOut\n}", "title": "" }, { "docid": "c52446472bb01d0500a2fbe4e74992f6", "score": "0.60205406", "text": "func ListDeploymentsFailErrMocked(\n\tt *testing.T,\n\tcloudSpecificExtensionDeploymentsIn []*types.CloudSpecificExtensionDeployment,\n) []*types.CloudSpecificExtensionDeployment {\n\n\tassert := assert.New(t)\n\n\t// wire up\n\tcs := &utils.MockConcertoService{}\n\tds, err := NewCloudSpecificExtensionDeploymentService(cs)\n\tassert.Nil(err, \"Couldn't load cloudSpecificExtensionDeployment service\")\n\tassert.NotNil(ds, \"CloudSpecificExtensionDeployment service not instanced\")\n\n\t// to json\n\tdIn, err := json.Marshal(cloudSpecificExtensionDeploymentsIn)\n\tassert.Nil(err, \"CloudSpecificExtensionDeployments test data corrupted\")\n\n\t// call service\n\tcs.On(\"Get\", APIPathCseDeployments).Return(dIn, 200, fmt.Errorf(\"mocked error\"))\n\tcloudSpecificExtensionDeploymentsOut, err := ds.ListDeployments()\n\n\tassert.NotNil(err, \"We are expecting an error\")\n\tassert.Nil(cloudSpecificExtensionDeploymentsOut, \"Expecting nil output\")\n\tassert.Equal(err.Error(), \"mocked error\", \"Error should be 'mocked error'\")\n\n\treturn cloudSpecificExtensionDeploymentsOut\n}", "title": "" }, { "docid": "3b992bcd8d221260d8edd4046504d57c", "score": "0.59481114", "text": "func GetDeploymentMocked(\n\tt *testing.T,\n\tcloudSpecificExtensionDeploymentIn *types.CloudSpecificExtensionDeployment,\n) *types.CloudSpecificExtensionDeployment {\n\n\tassert := assert.New(t)\n\n\t// wire up\n\tcs := &utils.MockConcertoService{}\n\tds, err := NewCloudSpecificExtensionDeploymentService(cs)\n\tassert.Nil(err, \"Couldn't load cloudSpecificExtensionDeployment service\")\n\tassert.NotNil(ds, \"CloudSpecificExtensionDeployment service not instanced\")\n\n\t// to json\n\tdIn, err := json.Marshal(cloudSpecificExtensionDeploymentIn)\n\tassert.Nil(err, \"CloudSpecificExtensionDeployment test data corrupted\")\n\n\t// call service\n\tcs.On(\"Get\", fmt.Sprintf(APIPathCseDeployment, cloudSpecificExtensionDeploymentIn.ID)).Return(dIn, 200, nil)\n\tcloudSpecificExtensionDeploymentOut, err := ds.GetDeployment(cloudSpecificExtensionDeploymentIn.ID)\n\n\tassert.Nil(err, \"Error getting cloud specific extension deployment\")\n\tassert.Equal(\n\t\t*cloudSpecificExtensionDeploymentIn,\n\t\t*cloudSpecificExtensionDeploymentOut,\n\t\t\"GetDeployment returned different cloud specific extension deployment\",\n\t)\n\n\treturn cloudSpecificExtensionDeploymentOut\n}", "title": "" }, { "docid": "5e18b07ca787d70203c086b87aab1ee1", "score": "0.58508134", "text": "func ListDeploymentsFailStatusMocked(\n\tt *testing.T,\n\tcloudSpecificExtensionDeploymentsIn []*types.CloudSpecificExtensionDeployment,\n) []*types.CloudSpecificExtensionDeployment {\n\n\tassert := assert.New(t)\n\n\t// wire up\n\tcs := &utils.MockConcertoService{}\n\tds, err := NewCloudSpecificExtensionDeploymentService(cs)\n\tassert.Nil(err, \"Couldn't load cloudSpecificExtensionDeployment service\")\n\tassert.NotNil(ds, \"CloudSpecificExtensionDeployment service not instanced\")\n\n\t// to json\n\tdIn, err := json.Marshal(cloudSpecificExtensionDeploymentsIn)\n\tassert.Nil(err, \"CloudSpecificExtensionDeployments test data corrupted\")\n\n\t// call service\n\tcs.On(\"Get\", APIPathCseDeployments).Return(dIn, 499, nil)\n\tcloudSpecificExtensionDeploymentsOut, err := ds.ListDeployments()\n\n\tassert.NotNil(err, \"We are expecting an status code error\")\n\tassert.Nil(cloudSpecificExtensionDeploymentsOut, \"Expecting nil output\")\n\tassert.Contains(err.Error(), \"499\", \"Error should contain http code 499\")\n\n\treturn cloudSpecificExtensionDeploymentsOut\n}", "title": "" }, { "docid": "5054cd64b5d4b8b3e629043abf917b0f", "score": "0.5805878", "text": "func TestGetJsonResponse(t *testing.T) {\n\tendapi := beego.AppConfig.String(\"weatherprovider\")\n\tfiles := beego.AppConfig.String(\"fileprovider\")\n\ttables := []struct {\n\t\tprov string\n\t\tcity string\n\t\tcountry string\n\t\tmlogs string\n\t}{\n\t\t{endapi, \"bogota\", \"co\", \"Getting response from endpoint\"},\n\t\t{files, \"mexico\", \"mx\", \"Getting response from file\"},\n\t}\n\tfor _, table := range tables {\n\t\tjres := libraries.GetJsonResponse(table.prov, table.city, table.country)\n\t\tConvey(table.mlogs, t, func() {\n\t\t\tConvey(\"Response from GetJsonResponse should not return a nil value\", func() {\n\t\t\t\tSo(jres, ShouldNotBeNil)\n\t\t\t})\n\t\t})\n\t}\n}", "title": "" }, { "docid": "2a22c943809f22d7816fd724c9991ec9", "score": "0.575746", "text": "func DeleteDeploymentFailStatusMocked(\n\tt *testing.T,\n\tcloudSpecificExtensionDeploymentIn *types.CloudSpecificExtensionDeployment,\n) {\n\n\tassert := assert.New(t)\n\n\t// wire up\n\tcs := &utils.MockConcertoService{}\n\tds, err := NewCloudSpecificExtensionDeploymentService(cs)\n\tassert.Nil(err, \"Couldn't load cloudSpecificExtensionDeployment service\")\n\tassert.NotNil(ds, \"CloudSpecificExtensionDeployment service not instanced\")\n\n\t// to json\n\tdIn, err := json.Marshal(cloudSpecificExtensionDeploymentIn)\n\tassert.Nil(err, \"CloudSpecificExtensionDeployment test data corrupted\")\n\n\t// call service\n\tcs.On(\"Delete\", fmt.Sprintf(APIPathCseDeployment, cloudSpecificExtensionDeploymentIn.ID)).Return(dIn, 499, nil)\n\tcloudSpecificExtensionDeploymentOut, err := ds.DeleteDeployment(cloudSpecificExtensionDeploymentIn.ID)\n\n\tassert.NotNil(err, \"We are expecting an status code error\")\n\tassert.Nil(cloudSpecificExtensionDeploymentOut, \"Expecting nil output\")\n\tassert.Contains(err.Error(), \"499\", \"Error should contain http code 499\")\n}", "title": "" }, { "docid": "4fb2c895cab77d023c3a19015b995b9b", "score": "0.5713562", "text": "func TestGetBoxJSONFail(t *testing.T) {\n\t_, err := getBoxJSON(\"http://\")\n\tif err == nil {\n\t\tt.Fatal(\"It should've failed\")\n\t}\n}", "title": "" }, { "docid": "280d2eec7528bcac4282c5d3489ee811", "score": "0.5704613", "text": "func (m *MockKV) MockGetFailure(key string) *mock.Call {\n\treturn m.On(\"Get\", key, (*api.QueryOptions)(nil)).Return(nil, nil, errors.New(\"failed\"))\n}", "title": "" }, { "docid": "fbde80d1b0107c69eb3a7017cf589379", "score": "0.5665171", "text": "func RetryLoadBalancerFailJSONMocked(t *testing.T, loadBalancerIn *types.LoadBalancer) *types.LoadBalancer {\n\n\tassert := assert.New(t)\n\n\t// wire up\n\tcs := &utils.MockConcertoService{}\n\tds, err := NewLoadBalancerService(cs)\n\tassert.Nil(err, \"Couldn't load loadBalancer service\")\n\tassert.NotNil(ds, \"LoadBalancer service not instanced\")\n\n\t// convertMap\n\tmapIn, err := utils.ItemConvertParams(*loadBalancerIn)\n\tassert.Nil(err, \"LoadBalancer test data corrupted\")\n\n\t// wrong json\n\tdIn := []byte{10, 20, 30}\n\n\t// call service\n\tcs.On(\"Put\", fmt.Sprintf(APIPathNetworkLoadBalancerRetry, loadBalancerIn.ID), mapIn).Return(dIn, 200, nil)\n\tloadBalancerOut, err := ds.RetryLoadBalancer(loadBalancerIn.ID, mapIn)\n\n\tassert.NotNil(err, \"We are expecting a marshalling error\")\n\tassert.Nil(loadBalancerOut, \"Expecting nil output\")\n\tassert.Contains(err.Error(), \"invalid character\", \"Error message should include the string 'invalid character'\")\n\n\treturn loadBalancerOut\n}", "title": "" }, { "docid": "3d305366e86310f8c2c1f3d88868552d", "score": "0.5621217", "text": "func GetIntegrationArtifactGetMplStatusCommandMockResponse(testType string) (*http.Response, error) {\n\tif testType == \"Positive\" {\n\t\tres := http.Response{\n\t\t\tStatusCode: 200,\n\t\t\tBody: ioutil.NopCloser(bytes.NewReader([]byte(`{\n\t\t\t\t\"d\": {\n\t\t\t\t\t\"results\": [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"__metadata\": {\n\t\t\t\t\t\t\t\t\"id\": \"https://roverpoc.it-accd002.cfapps.sap.hana.ondemand.com:443/api/v1/MessageProcessingLogs('AGAS1GcWkfBv-ZtpS6j7TKjReO7t')\",\n\t\t\t\t\t\t\t\t\"uri\": \"https://roverpoc.it-accd002.cfapps.sap.hana.ondemand.com:443/api/v1/MessageProcessingLogs('AGAS1GcWkfBv-ZtpS6j7TKjReO7t')\",\n\t\t\t\t\t\t\t\t\"type\": \"com.sap.hci.api.MessageProcessingLog\"\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"MessageGuid\": \"AGAS1GcWkfBv-ZtpS6j7TKjReO7t\",\n\t\t\t\t\t\t\t\"CorrelationId\": \"AGAS1GevYrPodxieoYf4YSY4jd-8\",\n\t\t\t\t\t\t\t\"ApplicationMessageId\": null,\n\t\t\t\t\t\t\t\"ApplicationMessageType\": null,\n\t\t\t\t\t\t\t\"LogStart\": \"/Date(1611846759005)/\",\n\t\t\t\t\t\t\t\"LogEnd\": \"/Date(1611846759032)/\",\n\t\t\t\t\t\t\t\"Sender\": null,\n\t\t\t\t\t\t\t\"Receiver\": null,\n\t\t\t\t\t\t\t\"IntegrationFlowName\": \"flow1\",\n\t\t\t\t\t\t\t\"Status\": \"COMPLETED\",\n\t\t\t\t\t\t\t\"LogLevel\": \"INFO\",\n\t\t\t\t\t\t\t\"CustomStatus\": \"COMPLETED\",\n\t\t\t\t\t\t\t\"TransactionId\": \"aa220151116748eeae69db3e88f2bbc8\"\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\treturn &res, nil\n\t}\n\tres := http.Response{\n\t\tStatusCode: 400,\n\t\tBody: ioutil.NopCloser(bytes.NewReader([]byte(`{\n\t\t\t\t\t\"code\": \"Bad Request\",\n\t\t\t\t\t\"message\": {\n\t\t\t\t\t\"@lang\": \"en\",\n\t\t\t\t\t\"#text\": \"Invalid order by expression\"\n\t\t\t\t\t}\n\t\t\t\t}`))),\n\t}\n\treturn &res, errors.New(\"Unable to get integration flow MPL status, Response Status code:400\")\n}", "title": "" }, { "docid": "77b8e416a698ff1fcdcafaaa940fd0c9", "score": "0.5606808", "text": "func CreateLoadBalancerFailJSONMocked(t *testing.T, loadBalancerIn *types.LoadBalancer) *types.LoadBalancer {\n\n\tassert := assert.New(t)\n\n\t// wire up\n\tcs := &utils.MockConcertoService{}\n\tds, err := NewLoadBalancerService(cs)\n\tassert.Nil(err, \"Couldn't load loadBalancer service\")\n\tassert.NotNil(ds, \"LoadBalancer service not instanced\")\n\n\t// convertMap\n\tmapIn, err := utils.ItemConvertParams(*loadBalancerIn)\n\tassert.Nil(err, \"LoadBalancer test data corrupted\")\n\n\t// wrong json\n\tdIn := []byte{10, 20, 30}\n\n\t// call service\n\tcs.On(\"Post\", APIPathNetworkLoadBalancers, mapIn).Return(dIn, 200, nil)\n\tloadBalancerOut, err := ds.CreateLoadBalancer(mapIn)\n\n\tassert.NotNil(err, \"We are expecting a marshalling error\")\n\tassert.Nil(loadBalancerOut, \"Expecting nil output\")\n\tassert.Contains(err.Error(), \"invalid character\", \"Error message should include the string 'invalid character'\")\n\n\treturn loadBalancerOut\n}", "title": "" }, { "docid": "c6fc14ceb90531592a94b6fedbe95e02", "score": "0.5577491", "text": "func DeleteDeploymentFailErrMocked(\n\tt *testing.T,\n\tcloudSpecificExtensionDeploymentIn *types.CloudSpecificExtensionDeployment,\n) {\n\n\tassert := assert.New(t)\n\n\t// wire up\n\tcs := &utils.MockConcertoService{}\n\tds, err := NewCloudSpecificExtensionDeploymentService(cs)\n\tassert.Nil(err, \"Couldn't load cloudSpecificExtensionDeployment service\")\n\tassert.NotNil(ds, \"CloudSpecificExtensionDeployment service not instanced\")\n\n\t// to json\n\tdIn, err := json.Marshal(cloudSpecificExtensionDeploymentIn)\n\tassert.Nil(err, \"CloudSpecificExtensionDeployment test data corrupted\")\n\n\t// call service\n\tcs.On(\"Delete\", fmt.Sprintf(APIPathCseDeployment, cloudSpecificExtensionDeploymentIn.ID)).\n\t\tReturn(dIn, 200, fmt.Errorf(\"mocked error\"))\n\tcloudSpecificExtensionDeploymentOut, err := ds.DeleteDeployment(cloudSpecificExtensionDeploymentIn.ID)\n\n\tassert.NotNil(err, \"We are expecting an error\")\n\tassert.Nil(cloudSpecificExtensionDeploymentOut, \"Expecting nil output\")\n\tassert.Equal(err.Error(), \"mocked error\", \"Error should be 'mocked error'\")\n}", "title": "" }, { "docid": "129084c4d9000ae08433312de47f70da", "score": "0.55175495", "text": "func GetCPIFunctionMockResponse(functionName, testType string) (*http.Response, error) {\n\tswitch functionName {\n\tcase \"IntegrationArtifactDeploy\":\n\t\tif testType == \"Positive\" {\n\t\t\treturn GetEmptyHTTPResponseBodyAndErrorNil()\n\t\t}\n\t\tres := http.Response{\n\t\t\tStatusCode: 500,\n\t\t\tBody: ioutil.NopCloser(bytes.NewReader([]byte(`{\n\t\t\t\t\t\t\"code\": \"Internal Server Error\",\n\t\t\t\t\t\t\"message\": {\n\t\t\t\t\t\t\"@lang\": \"en\",\n\t\t\t\t\t\t\"#text\": \"Cannot deploy artifact with Id 'flow1'!\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}`))),\n\t\t}\n\t\treturn &res, errors.New(\"Internal Server Error\")\n\tcase \"IntegrationArtifactUpdateConfiguration\":\n\t\tif testType == \"Positive\" {\n\t\t\treturn GetEmptyHTTPResponseBodyAndErrorNil()\n\t\t}\n\t\tif testType == \"Negative_With_ResponseBody\" {\n\t\t\treturn GetNegativeCaseHTTPResponseBodyAndErrorNil()\n\t\t}\n\t\tres := http.Response{\n\t\t\tStatusCode: 404,\n\t\t\tBody: ioutil.NopCloser(bytes.NewReader([]byte(`{\n\t\t\t\t\t\t\"code\": \"Not Found\",\n\t\t\t\t\t\t\"message\": {\n\t\t\t\t\t\t\"@lang\": \"en\",\n\t\t\t\t\t\t\"#text\": \"Parameter key 'Parameter1' not found.\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}`))),\n\t\t}\n\t\treturn &res, errors.New(\"Not found - either wrong version for the given Id or wrong parameter key\")\n\tcase \"IntegrationArtifactGetMplStatus\":\n\t\treturn GetIntegrationArtifactGetMplStatusCommandMockResponse(testType)\n\tcase \"IntegrationArtifactGetServiceEndpoint\":\n\t\treturn GetIntegrationArtifactGetServiceEndpointCommandMockResponse(testType)\n\tcase \"IntegrationArtifactDownload\":\n\t\treturn IntegrationArtifactDownloadCommandMockResponse(testType)\n\tdefault:\n\t\tres := http.Response{\n\t\t\tStatusCode: 404,\n\t\t\tBody: ioutil.NopCloser(bytes.NewReader([]byte(``))),\n\t\t}\n\t\treturn &res, errors.New(\"Service not Found\")\n\t}\n}", "title": "" }, { "docid": "b4425def5ad177d3bb2f116a93e8f1fc", "score": "0.54859823", "text": "func GetExpectedDeployment(t *testing.T, fileName string) *appsv1.Deployment {\n\tobj := getKubernetesObject(t, fileName)\n\tdeployment, ok := obj.(*appsv1.Deployment)\n\tassert.True(t, ok, \"Expected Deployment object\")\n\treturn deployment\n}", "title": "" }, { "docid": "ad8a6970dfcdf29ddc1b4845ae8f2b90", "score": "0.5421205", "text": "func IntegrationArtifactDownloadCommandMockResponse(testType string) (*http.Response, error) {\n\n\tresponse, error := GetPositiveCaseResponseByTestType(testType)\n\n\tif response == nil && error == nil {\n\n\t\tres := http.Response{\n\t\t\tStatusCode: 400,\n\t\t\tBody: ioutil.NopCloser(bytes.NewReader([]byte(`{\n\t\t\t\t\t\"code\": \"Bad Request\",\n\t\t\t\t\t\"message\": {\n\t\t\t\t\t\"@lang\": \"en\",\n\t\t\t\t\t\"#text\": \"invalid request\"\n\t\t\t\t\t}\n\t\t\t\t}`))),\n\t\t}\n\t\treturn &res, errors.New(\"Unable to download integration artifact, Response Status code:400\")\n\t}\n\treturn response, error\n}", "title": "" }, { "docid": "680c82d73d45628efa03e7581972e798", "score": "0.53965604", "text": "func (KymaPackagesMock) GetPackage(version string) (KymaPackage, error) { panic(\"call\") }", "title": "" }, { "docid": "148ffb5d58d19aade4f880d3d8e21ca8", "score": "0.5388983", "text": "func TestInvalidJSON(tester *testing.T) {\n\n\tt := test.New(tester)\n\n\tdir := os.TempDir()\n\tname := filepath.Join(dir, \"config.json\")\n\n\tt.AssertNil(ioutil.WriteFile(name, []byte(\"xyz\"), perm), \"ioutil.WriteFile\")\n\tdefer os.Remove(name)\n\n\t_, err := Init(name)\n\tt.AssertNotNil(err, \"Init\")\n\n}", "title": "" }, { "docid": "dc020890f732097a00f8dac941793d83", "score": "0.5370668", "text": "func DeleteLoadBalancerFailJSONMocked(t *testing.T, loadBalancerIn *types.LoadBalancer) {\n\n\tassert := assert.New(t)\n\n\t// wire up\n\tcs := &utils.MockConcertoService{}\n\tds, err := NewLoadBalancerService(cs)\n\tassert.Nil(err, \"Couldn't load loadBalancer service\")\n\tassert.NotNil(ds, \"LoadBalancer service not instanced\")\n\n\t// wrong json\n\tdIn := []byte{10, 20, 30}\n\n\t// call service\n\tcs.On(\"Delete\", fmt.Sprintf(APIPathNetworkLoadBalancer, loadBalancerIn.ID)).Return(dIn, 200, nil)\n\tloadBalancerOut, err := ds.DeleteLoadBalancer(loadBalancerIn.ID)\n\n\tassert.NotNil(err, \"We are expecting a marshalling error\")\n\tassert.Nil(loadBalancerOut, \"Expecting nil output\")\n\tassert.Contains(err.Error(), \"invalid character\", \"Error message should include the string 'invalid character'\")\n}", "title": "" }, { "docid": "8a8931a852287d11b0db716e5c6b5103", "score": "0.53605163", "text": "func ListLoadBalancersFailJSONMocked(t *testing.T, loadBalancersIn []*types.LoadBalancer) []*types.LoadBalancer {\n\n\tassert := assert.New(t)\n\n\t// wire up\n\tcs := &utils.MockConcertoService{}\n\tds, err := NewLoadBalancerService(cs)\n\tassert.Nil(err, \"Couldn't load loadBalancer service\")\n\tassert.NotNil(ds, \"LoadBalancer service not instanced\")\n\n\t// wrong json\n\tdIn := []byte{10, 20, 30}\n\n\t// call service\n\tcs.On(\"Get\", APIPathNetworkLoadBalancers).Return(dIn, 200, nil)\n\tloadBalancersOut, err := ds.ListLoadBalancers()\n\n\tassert.NotNil(err, \"We are expecting a marshalling error\")\n\tassert.Nil(loadBalancersOut, \"Expecting nil output\")\n\tassert.Contains(err.Error(), \"invalid character\", \"Error message should include the string 'invalid character'\")\n\n\treturn loadBalancersOut\n}", "title": "" }, { "docid": "fed86ea7a42657c95820e655ae5fe869", "score": "0.5342433", "text": "func CreateDeploymentMocked(\n\tt *testing.T,\n\ttemplateID string,\n\tcloudSpecificExtensionDeploymentIn *types.CloudSpecificExtensionDeployment,\n) *types.CloudSpecificExtensionDeployment {\n\n\tassert := assert.New(t)\n\n\t// wire up\n\tcs := &utils.MockConcertoService{}\n\tds, err := NewCloudSpecificExtensionDeploymentService(cs)\n\tassert.Nil(err, \"Couldn't load cloudSpecificExtensionDeployment service\")\n\tassert.NotNil(ds, \"CloudSpecificExtensionDeployment service not instanced\")\n\n\t// convertMap\n\tmapIn, err := utils.ItemConvertParams(*cloudSpecificExtensionDeploymentIn)\n\tassert.Nil(err, \"CloudSpecificExtensionDeployment test data corrupted\")\n\n\t// to json\n\tdOut, err := json.Marshal(cloudSpecificExtensionDeploymentIn)\n\tassert.Nil(err, \"CloudSpecificExtensionDeployment test data corrupted\")\n\n\t// call service\n\tcs.On(\"Post\", fmt.Sprintf(APIPathCseTemplateDeployments, templateID), mapIn).Return(dOut, 200, nil)\n\tcloudSpecificExtensionDeploymentOut, err := ds.CreateDeployment(templateID, mapIn)\n\n\tassert.Nil(err, \"Error creating cloud specific extension deployment\")\n\tassert.Equal(\n\t\tcloudSpecificExtensionDeploymentIn,\n\t\tcloudSpecificExtensionDeploymentOut,\n\t\t\"CreateDeployment returned different cloud specific extension deployment\",\n\t)\n\n\treturn cloudSpecificExtensionDeploymentOut\n}", "title": "" }, { "docid": "c6854e9119c5f8bd10ebf74bccb5c547", "score": "0.5339599", "text": "func UpdateLoadBalancerFailJSONMocked(t *testing.T, loadBalancerIn *types.LoadBalancer) *types.LoadBalancer {\n\n\tassert := assert.New(t)\n\n\t// wire up\n\tcs := &utils.MockConcertoService{}\n\tds, err := NewLoadBalancerService(cs)\n\tassert.Nil(err, \"Couldn't load loadBalancer service\")\n\tassert.NotNil(ds, \"LoadBalancer service not instanced\")\n\n\t// convertMap\n\tmapIn, err := utils.ItemConvertParams(*loadBalancerIn)\n\tassert.Nil(err, \"LoadBalancer test data corrupted\")\n\n\t// wrong json\n\tdIn := []byte{10, 20, 30}\n\n\t// call service\n\tcs.On(\"Put\", fmt.Sprintf(APIPathNetworkLoadBalancer, loadBalancerIn.ID), mapIn).Return(dIn, 200, nil)\n\tloadBalancerOut, err := ds.UpdateLoadBalancer(loadBalancerIn.ID, mapIn)\n\n\tassert.NotNil(err, \"We are expecting a marshalling error\")\n\tassert.Nil(loadBalancerOut, \"Expecting nil output\")\n\tassert.Contains(err.Error(), \"invalid character\", \"Error message should include the string 'invalid character'\")\n\n\treturn loadBalancerOut\n}", "title": "" }, { "docid": "175c199f42a488a6886951b3ac288fc4", "score": "0.532486", "text": "func RetrieveSecretVersionFailErrMocked(t *testing.T, svID, filePath string) {\n\n\tassert := assert.New(t)\n\n\t// wire up\n\tcs := &utils.MockConcertoService{}\n\tapiEndpoint := \"https://clients.example.com\"\n\tss, err := NewSecretService(cs, apiEndpoint)\n\tassert.Nil(err, \"Couldn't load secret service\")\n\tassert.NotNil(ss, \"Secret service not instanced\")\n\n\turlPath := fmt.Sprintf(\"/secret/secret_versions/%s\", svID)\n\turl := fmt.Sprintf(\"%s%s\", apiEndpoint, urlPath)\n\n\t// call service\n\tcs.On(\"GetFile\", url, filePath).Return(\"\", 499, fmt.Errorf(\"mocked error\"))\n\tstatus, err := ss.RetrieveSecretVersion(svID, filePath)\n\tassert.NotNil(err, \"We are expecting an error\")\n\tassert.Equal(status, 499, \"RetrieveSecretVersion returned an unexpected status code\")\n\tassert.Equal(err.Error(), \"mocked error\", \"Error should be 'mocked error'\")\n}", "title": "" }, { "docid": "dc51c4268f7b88629964cdca736cf80e", "score": "0.5309995", "text": "func (m *ManagerMock) GetProductionUsageJSON(ctx context.Context, repoName, pkgName string) ([]byte, error) {\n\targs := m.Called(ctx, repoName, pkgName)\n\tdata, _ := args.Get(0).([]byte)\n\treturn data, args.Error(1)\n}", "title": "" }, { "docid": "c869cd500fea269fece9e2bcd9e531a7", "score": "0.52875787", "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": "b43d7af0baf56f497b573814cd3e1fd7", "score": "0.5284371", "text": "func TestGetFilesJSON(t *testing.T) {\n\tlog.Println(\"TestGetFilesJSON()\")\n\n\t// Load config\n\tconfig, err := common.LoadConfig()\n\tif err != nil {\n\t\tt.Fatalf(\"Could not load configuration: %s\", err.Error())\n\t}\n\tcommon.Static.Config = config\n\n\t// Generate mock data.FileRecord\n\tfile := data.FileRecord{\n\t\tInfoHash: \"deadbeef\",\n\t\tVerified: true,\n\t}\n\n\t// Save mock file\n\tif err := file.Save(); err != nil {\n\t\tt.Fatalf(\"Failed to save mock file: %s\", err.Error())\n\t}\n\n\t// Load mock file to fetch ID\n\tfile, err = file.Load(file.InfoHash, \"info_hash\")\n\tif file == (data.FileRecord{}) || err != nil {\n\t\tt.Fatalf(\"Failed to load mock file: %s\", err.Error())\n\t}\n\n\t// Request output JSON from API for this file\n\tres, err := getFilesJSON(file.ID)\n\tif err != nil {\n\t\tt.Fatalf(\"Failed to retrieve files JSON: %s\", err.Error())\n\t}\n\n\t// Unmarshal output JSON\n\tvar file2 data.FileRecord\n\terr = json.Unmarshal(res, &file2)\n\tif err != nil {\n\t\tt.Fatalf(\"Failed to unmarshal result JSON for single file: %s\", err.Error())\n\t}\n\n\t// Verify objects are the same\n\tif file.ID != file2.ID {\n\t\tt.Fatalf(\"ID, expected %d, got %d\", file.ID, file2.ID)\n\t}\n\n\t// Request output JSON from API for all files\n\tres, err = getFilesJSON(-1)\n\tif err != nil {\n\t\tt.Fatalf(\"Failed to retrieve all files JSON: %s\", err.Error())\n\t}\n\n\t// Unmarshal all output JSON\n\tvar allFiles []data.FileRecord\n\terr = json.Unmarshal(res, &allFiles)\n\tif err != nil {\n\t\tt.Fatalf(\"Failed to unmarshal result JSON for all files: %s\", err.Error())\n\t}\n\n\t// Verify known file is in result set\n\tfound := false\n\tfor _, f := range allFiles {\n\t\tif f.ID == file.ID {\n\t\t\tfound = true\n\t\t}\n\t}\n\n\tif !found {\n\t\tt.Fatalf(\"Expected file not found in all files result set\")\n\t}\n\n\t// Delete mock file\n\tif err := file.Delete(); err != nil {\n\t\tt.Fatalf(\"Failed to delete mock file: %s\", err.Error())\n\t}\n}", "title": "" }, { "docid": "f337c8d7d57db873ec29ff105fd1be1f", "score": "0.5277983", "text": "func TestGetManifestDetails(t *testing.T) {\n\tdefer os.Remove(TempManifest)\n\tc := NewMockClient(t, nil)\n\trd := &ReleaseData{\n\t\tName: \"test\",\n\t\tNamespace: \"default\",\n\t\tManifest: TestManifest,\n\t}\n\t_, err := c.getManifestDetails(rd)\n\tassert.Nil(t, err)\n}", "title": "" }, { "docid": "597ce04351741bf671596e0b6187d5b8", "score": "0.52596843", "text": "func (mock *ClientMock) GetDeploymentCalls() []struct {\n\tName string\n} {\n\tvar calls []struct {\n\t\tName string\n\t}\n\tlockClientMockGetDeployment.RLock()\n\tcalls = mock.calls.GetDeployment\n\tlockClientMockGetDeployment.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "40aa022c28edd484e15b1f0a47c128c7", "score": "0.52574044", "text": "func (e bscManager) GetTestJson() []byte {\n\treturn e.ethManager.GetTestJson()\n}", "title": "" }, { "docid": "b16d0758eb95a12c5cfbd1c8fe07a0bb", "score": "0.5254652", "text": "func (m *ManagerMock) GetHelmExporterDumpJSON(ctx context.Context) ([]byte, error) {\n\targs := m.Called(ctx)\n\tdata, _ := args.Get(0).([]byte)\n\treturn data, args.Error(1)\n}", "title": "" }, { "docid": "d58ba8a6e5e56c5b4f3ae2bba5684e35", "score": "0.52354866", "text": "func (KymaPackagesMock) GetBundledPackage() (KymaPackage, error) { panic(\"call\") }", "title": "" }, { "docid": "7aa8e2549d57d9318e2692b3aa002d42", "score": "0.5217971", "text": "func (c *Client) GetDeploymentsJSON() (string, []error) { return c.getJSON(\"deployments\") }", "title": "" }, { "docid": "c163fee1de818d68a2943d17f229d5cc", "score": "0.5211251", "text": "func TestIncorrectJson(t *testing.T) {\n\tvar gf GinFixture\n\tgf.init()\n\n\trandomMap := map[string]float32{\"apple\": 5.1, \"lettuce\": 7.11, \"pear\": 8.77}\n\n\terr := gf.testRequest(randomMap, http.StatusBadRequest, \"\")\n\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n}", "title": "" }, { "docid": "c17684929c3c8549284ba04d5964758e", "score": "0.5211008", "text": "func (m *MockAPI) DeploymentList(arg0 string) ([]*go_scalingo.Deployment, error) {\n\tret := m.ctrl.Call(m, \"DeploymentList\", arg0)\n\tret0, _ := ret[0].([]*go_scalingo.Deployment)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "103327a74e44b8c3f9479b524dab14a2", "score": "0.5198616", "text": "func TestGetKubeResources(t *testing.T) {\n\tdefer os.Remove(TempManifest)\n\tc := NewMockClient(t, nil)\n\tmanifest := `---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: nginx-deployment\n\n---\napiVersion: v1\nkind: Service\nmetadata:\n name: my-service\n\n---\napiVersion: v1\nkind: Service\nmetadata:\n name: lb-service\n spec:\n type: LoadBalancer`\n\texpectedMap := map[string]interface{}{\n\t\t\"Deployment\": map[string]interface{}{\n\t\t\t\"nginx-deployment\": map[string]interface{}{\n\t\t\t\t\"Namespace\": \"default\", \"Spec\": interface{}(nil), \"Status\": map[string]interface{}{\n\t\t\t\t\t\"ReadyReplicas\": \"1\",\n\t\t\t\t},\n\t\t\t},\n\t\t}, \"Service\": map[string]interface{}{\n\t\t\t\"lb-service\": map[string]interface{}{\n\t\t\t\t\"Namespace\": \"default\", \"Spec\": map[string]interface{}{\n\t\t\t\t\t\"ClusterIP\": \"127.0.0.1\", \"Type\": \"LoadBalancer\",\n\t\t\t\t}, \"Status\": map[string]interface{}{\n\t\t\t\t\t\"LoadBalancer\": map[string]interface{}{\n\t\t\t\t\t\t\"Ingress\": []interface{}{\n\t\t\t\t\t\t\tmap[string]interface{}{\n\t\t\t\t\t\t\t\t\"Hostname\": \"elb.test.com\",\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}, \"my-service\": map[string]interface{}{\n\t\t\t\t\"Namespace\": \"default\", \"Spec\": map[string]interface{}{\n\t\t\t\t\t\"ClusterIP\": \"127.0.0.1\", \"Type\": \"ClusterIP\",\n\t\t\t\t}, \"Status\": interface{}(nil),\n\t\t\t},\n\t\t},\n\t}\n\trd := &ReleaseData{\n\t\tName: \"test\",\n\t\tNamespace: \"default\",\n\t\tManifest: manifest,\n\t}\n\tresult, err := c.GetKubeResources(rd)\n\tassert.Nil(t, err)\n\tassert.EqualValues(t, expectedMap, result)\n}", "title": "" }, { "docid": "03d123a92c3f90fcbede35592725ddd9", "score": "0.5164729", "text": "func apiFail(w http.ResponseWriter, r *http.Request, message string) {\n\tresp := apiFailureResponse{\n\t\tSuccess: false,\n\t\tMessage: message,\n\t}\n\tb, _ := json.Marshal(resp)\n\tfmt.Fprint(w, string(b))\n\tw.WriteHeader(http.StatusNoContent)\n}", "title": "" }, { "docid": "30fbaeaaa187b768b63e675466638d79", "score": "0.5164013", "text": "func FailJSON(ctx iris.Context, statusCode int, err error, format string, args ...interface{}) HTTPError {\n\thttpErr := newError(statusCode, err, format, args...)\n\thttpErr.writeHeaders(ctx)\n\n\tctx.JSON(httpErr)\n\n\treturn httpErr\n}", "title": "" }, { "docid": "21fd7d9cad107e4d23f07a73361ad7eb", "score": "0.5163114", "text": "func (m *ManagerMock) GetRandomJSON(ctx context.Context) ([]byte, error) {\n\targs := m.Called(ctx)\n\tdata, _ := args.Get(0).([]byte)\n\treturn data, args.Error(1)\n}", "title": "" }, { "docid": "48b23ff2038453da4b86992a7483b681", "score": "0.51597416", "text": "func TestDescribeInstances(t *testing.T) {\n\texpectedJson := RemoveWhitespaces(`\n{\n \"limit\": 10,\n \"status\": [\"pending\", \"running\", \"stopped\", \"suspended\"],\n \"search_word\":\"wet\",\n \"token\":\"E5I9QKJF1O2B5PXE68LG\",\n \"verbose\":1,\n \"zone\": \"ac1\",\n \"action\": \"DescribeInstances\",\n \"instances\":[\"i-HNFNPM56\"]\n}\n`)\n\n\tfakeResponse := RemoveWhitespaces(`\n{\n \"ret_code\": 0,\n \"action\": \"DescribeInstancesResponse\",\n \"item_set\": [\n {\n \"vcpus_current\": 1,\n \"instance_id\": \"i-GQZBQ6CP\",\n \"memory_current\": 1024,\n \"instance_name\": \"gao_cent\",\n \"description\": \"\",\n \"status\": \"running\",\n \"status_time\": \"2015-02-15 11:10:37\",\n \"create_time\": \"2015-02-15 11:10:37\",\n \"transition_status\": \"\",\n \"vxnets\": [\n {\n \"nic_id\": \"52:54:be:c5:38:12\",\n \"private_ip\": \"10.57.20.131\",\n \"vxnet_id\": \"vxnet-0\",\n \"vxnet_name\": \"vxnet1\",\n \"systype\": \"pub\",\n \"vxnet_type\": 1\n },\n {\n \"nic_id\": \"52:54:ed:23:99:30\",\n \"private_ip\": \"\",\n \"vxnet_id\": \"vxnet-VD3VL0YT\",\n \"vxnet_name\": \"vxnet2\",\n \"systype\": \"priv\",\n \"vxnet_type\": 0\n },\n {\n \"nic_id\": \"52:54:c1:c5:18:79\",\n \"private_ip\": \"\",\n \"vxnet_id\": \"vxnet-MTQX70SU\",\n \"vxnet_name\": \"vxnet3\",\n \"systype\": \"priv\",\n \"vxnet_type\": 0\n }\n ],\n \"eip\": {\n \"eip_addr\": \"103.21.116.122\",\n \"eip_id\": \"eip-2Q76L2B9\",\n \"eip_name\": \"103.21.116.122\"\n },\n \"image\": {\n \"image_id\": \"centos65x64d\",\n \"image_name\": \"CentOS 6.5 64bit\",\n \"os_family\": \"centos\",\n \"platform\": \"linux\",\n \"processor_type\": \"64bit\",\n \"provider\": \"system\",\n \"image_size\": 20\n },\n \"volumes\": [\n {\n \"volume_id\": \"vom-QBU4NHSP\",\n \"volume_name\": \"gao\",\n \"size\": \"10\",\n \"volume_type\": \"1\"\n }\n ],\n \"security_group\": {\n \"attachon\": 634824,\n \"is_default\": 1,\n \"security_group_id\": \"sg-ZEVKCIAT\",\n \"security_group_name\": \"default_fireware\"\n },\n \"volume_ids\": [\n \"vom-QBU4NHSP\"\n ]\n }\n ],\n \"code\": 0,\n \"total_count\": 1\n}\n`)\n\n\ttestServer := httptest.NewServer(&FakeHandler{t: t, ExpectedJson: expectedJson, FakeResponse: fakeResponse})\n\tdefer testServer.Close()\n\n\tc, err := NewClient(testServer.URL, &AuthConfiguration{PublicKey: \"E5I9QKJF1O2B5PXE68LG\", PrivateKey: \"secret\"})\n\tif err != nil {\n\t\tt.Errorf(\"Unexpected non-nil error %v\", err)\n\t}\n\n\trequest := DescribeInstancesRequest{\n\t\tInstanceIDs: []string{\"i-HNFNPM56\"},\n\t\tVerbose: 1,\n\t\tOffset: 0,\n\t\tSearchWord: \"wet\",\n\t\tLimit: 10,\n\t\tStatus: []InstanceStatus{InstanceStatusPending, InstanceStatusRunning, InstanceStatusStopped, InstanceStatusSuspended},\n\t}\n\tvar response DescribeInstancesResponse\n\n\terr = c.SendRequest(request, &response)\n\tif err != nil {\n\t\tt.Errorf(\"Unexpected non-nil error %v\", err)\n\t}\n\n\texpectedResponse := DescribeInstancesResponse{\n\t\tResponseCommon: ResponseCommon{\n\t\t\tAction: \"DescribeInstancesResponse\",\n\t\t\tCode: 0,\n\t\t\tRetCode: 0,\n\t\t\tMessage: \"\",\n\t\t},\n\t\tTotalCount: 1,\n\t\tItemSet: []DescribeInstancesItem{\n\t\t\t{\n\t\t\t\tInstanceID: \"i-GQZBQ6CP\",\n\t\t\t\tInstanceName: \"gao_cent\",\n\t\t\t\tDescription: \"\",\n\t\t\t\tStatus: InstanceStatusRunning,\n\t\t\t\tVcpusCurrent: 1,\n\t\t\t\tMemoryCurrent: 1024,\n\t\t\t\tStatusTime: \"2015-02-1511:10:37\",\n\t\t\t\tCreateTime: \"2015-02-1511:10:37\",\n\t\t\t\tVxnets: []DescribeInstancesVxnet{\n\t\t\t\t\t{\n\t\t\t\t\t\tVxnetID: \"vxnet-0\",\n\t\t\t\t\t\tVxnetName: \"vxnet1\",\n\t\t\t\t\t\tVxnetType: 1,\n\t\t\t\t\t\tNicID: \"52:54:be:c5:38:12\",\n\t\t\t\t\t\tPrivateIP: \"10.57.20.131\",\n\t\t\t\t\t\tSystype: \"pub\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tVxnetID: \"vxnet-VD3VL0YT\",\n\t\t\t\t\t\tVxnetName: \"vxnet2\",\n\t\t\t\t\t\tVxnetType: 0,\n\t\t\t\t\t\tNicID: \"52:54:ed:23:99:30\",\n\t\t\t\t\t\tPrivateIP: \"\",\n\t\t\t\t\t\tSystype: \"priv\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tVxnetID: \"vxnet-MTQX70SU\",\n\t\t\t\t\t\tVxnetName: \"vxnet3\",\n\t\t\t\t\t\tVxnetType: 0,\n\t\t\t\t\t\tNicID: \"52:54:c1:c5:18:79\",\n\t\t\t\t\t\tPrivateIP: \"\",\n\t\t\t\t\t\tSystype: \"priv\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tEIP: DescribeInstancesEIP{\n\t\t\t\t\tEipID: \"eip-2Q76L2B9\",\n\t\t\t\t\tEipName: \"103.21.116.122\",\n\t\t\t\t\tEipAddr: \"103.21.116.122\",\n\t\t\t\t},\n\t\t\t\tImage: DescribeInstancesImage{\n\t\t\t\t\tImageID: \"centos65x64d\",\n\t\t\t\t\tImageName: \"CentOS6.564bit\",\n\t\t\t\t\tImageSize: 20,\n\t\t\t\t\tOsFamily: \"centos\",\n\t\t\t\t\tPlatform: \"linux\",\n\t\t\t\t\tProcessorType: \"64bit\",\n\t\t\t\t\tProvider: \"system\"},\n\t\t\t\tVolumeIDs: []string{\"vom-QBU4NHSP\"},\n\t\t\t\tVolumes: []DescribeInstancesVolume{\n\t\t\t\t\t{\n\t\t\t\t\t\tSize: \"10\",\n\t\t\t\t\t\tVolumeID: \"vom-QBU4NHSP\",\n\t\t\t\t\t\tVolumeName: \"gao\",\n\t\t\t\t\t\tVolumeType: \"1\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tSecurityGroup: DescribeInstancesSecurityGroup{\n\t\t\t\t\tAttachon: 634824,\n\t\t\t\t\tIsDefault: 1,\n\t\t\t\t\tSecurityGroupID: \"sg-ZEVKCIAT\",\n\t\t\t\t\tSecurityGroupName: \"default_fireware\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tif !reflect.DeepEqual(expectedResponse, response) {\n\t\tt.Errorf(\"Error: expected \\n%v, got \\n%v\", expectedResponse, response)\n\t}\n}", "title": "" }, { "docid": "7db2a2c4d605cbc6c2ac7e55360cfe8d", "score": "0.5157836", "text": "func (m *MockHttpCommunications) GetJSON(arg0 string) ([]byte, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetJSON\", arg0)\n\tret0, _ := ret[0].([]byte)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "088df3eb0268d78533b07beb52984e0f", "score": "0.51573944", "text": "func GetLoadBalancerFailStatusMocked(t *testing.T, loadBalancerIn *types.LoadBalancer) *types.LoadBalancer {\n\n\tassert := assert.New(t)\n\n\t// wire up\n\tcs := &utils.MockConcertoService{}\n\tds, err := NewLoadBalancerService(cs)\n\tassert.Nil(err, \"Couldn't load loadBalancer service\")\n\tassert.NotNil(ds, \"LoadBalancer service not instanced\")\n\n\t// to json\n\tdIn, err := json.Marshal(loadBalancerIn)\n\tassert.Nil(err, \"LoadBalancer test data corrupted\")\n\n\t// call service\n\tcs.On(\"Get\", fmt.Sprintf(APIPathNetworkLoadBalancer, loadBalancerIn.ID)).Return(dIn, 499, nil)\n\tloadBalancerOut, err := ds.GetLoadBalancer(loadBalancerIn.ID)\n\n\tassert.NotNil(err, \"We are expecting an status code error\")\n\tassert.Nil(loadBalancerOut, \"Expecting nil output\")\n\tassert.Contains(err.Error(), \"499\", \"Error should contain http code 499\")\n\n\treturn loadBalancerOut\n}", "title": "" }, { "docid": "5e79b93476e602cae8f632d03fd7d5fe", "score": "0.51378393", "text": "func logFailure(t *testing.T, resp *morpheus.Response, err error) {\n\t// logResponse(t, resp)\n\tt.Logf(\"API FAILURE: %v\", resp)\n\tif err != nil {\n\t\tt.Logf(\"ERROR: %v\", err)\n\t}\n}", "title": "" }, { "docid": "a40b8bd46e10e3edce64ad9f4434de02", "score": "0.5124973", "text": "func (m *MockProvider) GetDeployments() map[string][]string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetDeployments\")\n\tret0, _ := ret[0].(map[string][]string)\n\treturn ret0\n}", "title": "" }, { "docid": "2aa23440bd96f990049d67a92c291397", "score": "0.5118433", "text": "func GetIntegrationArtifactGetServiceEndpointCommandMockResponse(testCaseType string) (*http.Response, error) {\n\tif testCaseType == \"PositiveAndGetetIntegrationArtifactGetServiceResBody\" {\n\t\treturn GetIntegrationArtifactGetServiceEndpointPositiveCaseRespBody()\n\t}\n\tres := http.Response{\n\t\tStatusCode: 400,\n\t\tBody: ioutil.NopCloser(bytes.NewReader([]byte(`{\n\t\t\t\t\t\"code\": \"Bad Request\",\n\t\t\t\t\t\"message\": {\n\t\t\t\t\t\"@lang\": \"en\",\n\t\t\t\t\t\"#text\": \"invalid service endpoint query\"\n\t\t\t\t\t}\n\t\t\t\t}`))),\n\t}\n\treturn &res, errors.New(\"Unable to get integration flow service endpoint, Response Status code:400\")\n}", "title": "" }, { "docid": "3fe2d05e49f236feabbd9ecf297a8a62", "score": "0.5105101", "text": "func BuildAPIResponseFail(message string, data interface{}) APIResponse {\n\tvar api APIResponse\n\tapi.Code = 400\n\tapi.Message = message\n\tapi.Data = data\n\treturn api\n}", "title": "" }, { "docid": "f8c1033db9567f283b0c64358ce0f48c", "score": "0.5102883", "text": "func (suite *MockDatastoreTestSuite) TestDataStoreFailureGetTaskRuntime() {\n\t_, err := suite.store.GetTaskRuntimesForJobByRange(\n\t\tcontext.Background(), suite.testJobID, &task.InstanceRange{\n\t\t\tFrom: uint32(0),\n\t\t\tTo: uint32(3),\n\t\t})\n\tsuite.Error(err)\n\n\t_, err = suite.store.GetTaskRuntime(\n\t\tcontext.Background(), suite.testJobID, 0)\n\tsuite.Error(err)\n\n\t_, err = suite.store.getTaskRuntimeRecord(context.Background(), testJob, 0)\n\tsuite.Error(err)\n}", "title": "" }, { "docid": "94dc21c2ba0f74987f278d4202420ef1", "score": "0.50955003", "text": "func GetLoadBalancerPlanFailStatusMocked(\n\tt *testing.T,\n\tloadBalancerPlanID string,\n\tloadBalancerPlanIn *types.LoadBalancerPlan,\n) *types.LoadBalancerPlan {\n\n\tassert := assert.New(t)\n\n\t// wire up\n\tcs := &utils.MockConcertoService{}\n\tds, err := NewLoadBalancerService(cs)\n\tassert.Nil(err, \"Couldn't load loadBalancer service\")\n\tassert.NotNil(ds, \"LoadBalancer service not instanced\")\n\n\t// to json\n\tdIn, err := json.Marshal(loadBalancerPlanIn)\n\tassert.Nil(err, \"LoadBalancerPlan test data corrupted\")\n\n\t// call service\n\tcs.On(\"Get\", fmt.Sprintf(APIPathNetworkLoadBalancerPlan, loadBalancerPlanID)).Return(dIn, 499, nil)\n\tloadBalancerPlanOut, err := ds.GetLoadBalancerPlan(loadBalancerPlanID)\n\n\tassert.NotNil(err, \"We are expecting an status code error\")\n\tassert.Nil(loadBalancerPlanOut, \"Expecting nil output\")\n\tassert.Contains(err.Error(), \"499\", \"Error should contain http code 499\")\n\n\treturn loadBalancerPlanOut\n}", "title": "" }, { "docid": "766711d6db9655f8402f5982b6136b9a", "score": "0.50925606", "text": "func (suite *MockDatastoreTestSuite) TestDataStoreFailureGetTaskConfigs() {\n\tctx := context.Background()\n\tvar result datastore.ResultSet\n\n\tsuite.mockedDataStore.EXPECT().Execute(ctx, gomock.Any()).\n\t\tReturn(result, nil)\n\tsuite.mockedDataStore.EXPECT().Execute(ctx, gomock.Any()).\n\t\tReturn(result, errors.New(\"my-error\"))\n\t_, _, err := suite.store.GetTaskConfigs(ctx, suite.testJobID, []uint32{0}, 0)\n\tsuite.Error(err)\n}", "title": "" }, { "docid": "9f30860d2000818578b7d0fd7a6d4a6a", "score": "0.50790745", "text": "func TestDoBadResponse(t *testing.T) {\n\tassert := assert.New(t)\n\tts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.WriteHeader(http.StatusOK)\n\t\tw.Write([]byte(`{\"foo\":`))\n\t}))\n\tdefer ts.Close()\n\n\t_, err := do(http.DefaultClient, httpGet, ts.URL, nil, nil)\n\n\tassert.NotNil(err)\n}", "title": "" }, { "docid": "0459ad1608049fc66a31b9839ff9e6ba", "score": "0.50703067", "text": "func TestHttpInvalidJson(t *testing.T) {\n\tjolokia := genJolokiaClientStub(invalidJSON, 200, Servers, []Metric{UsedHeapMetric})\n\n\tvar acc testutil.Accumulator\n\tacc.SetDebug(true)\n\terr := acc.GatherError(jolokia.Gather)\n\n\trequire.Error(t, err)\n\trequire.Equal(t, 0, len(acc.Metrics))\n\trequire.Contains(t, err.Error(), \"error decoding JSON response\")\n}", "title": "" }, { "docid": "b46b494694c067421941a0ebbc7f6b4d", "score": "0.5063773", "text": "func GetLoadBalancerFailErrMocked(t *testing.T, loadBalancerIn *types.LoadBalancer) *types.LoadBalancer {\n\n\tassert := assert.New(t)\n\n\t// wire up\n\tcs := &utils.MockConcertoService{}\n\tds, err := NewLoadBalancerService(cs)\n\tassert.Nil(err, \"Couldn't load loadBalancer service\")\n\tassert.NotNil(ds, \"LoadBalancer service not instanced\")\n\n\t// to json\n\tdIn, err := json.Marshal(loadBalancerIn)\n\tassert.Nil(err, \"LoadBalancer test data corrupted\")\n\n\t// call service\n\tcs.On(\"Get\", fmt.Sprintf(APIPathNetworkLoadBalancer, loadBalancerIn.ID)).\n\t\tReturn(dIn, 200, fmt.Errorf(\"mocked error\"))\n\tloadBalancerOut, err := ds.GetLoadBalancer(loadBalancerIn.ID)\n\n\tassert.NotNil(err, \"We are expecting an error\")\n\tassert.Nil(loadBalancerOut, \"Expecting nil output\")\n\tassert.Equal(err.Error(), \"mocked error\", \"Error should be 'mocked error'\")\n\n\treturn loadBalancerOut\n}", "title": "" }, { "docid": "4e3733f5709726ead6acd97e6dcf4175", "score": "0.50593716", "text": "func (suite *privateHandlerTestSuite) TestGetJobCacheGetRuntimeFail() {\n\tsuite.jobFactory.EXPECT().\n\t\tGetJob(&peloton.JobID{Value: testJobID}).\n\t\tReturn(suite.cachedJob)\n\n\tsuite.cachedJob.EXPECT().\n\t\tGetRuntime(gomock.Any()).\n\t\tReturn(nil, yarpcerrors.InternalErrorf(\"test error\"))\n\n\tresp, err := suite.handler.GetJobCache(context.Background(),\n\t\t&jobmgrsvc.GetJobCacheRequest{\n\t\t\tJobId: &v1alphapeloton.JobID{Value: testJobID},\n\t\t})\n\tsuite.Error(err)\n\tsuite.Nil(resp)\n}", "title": "" }, { "docid": "8ae3b3d23982c8642846ce967876068a", "score": "0.5056712", "text": "func TestValidPayload(t *testing.T) {\n\tjson := `[{\n\t\t\"message\" : {\n\t\t \"reqHost\" : \"www.example.com\",\n\t\t \"respLen\" : \"276248\",\n\t\t \"cliIP\" : \"123.123.123.123\",\n\t\t \"status\" : \"503\",\n\t\t \"bytes\" : \"123440\",\n\t\t \"protoVer\" : \"1.1\",\n\t\t \"respCT\" : \"text/html\",\n\t\t \"UA\" : \"Mozilla%2f5.0%20(Macintosh%3b%20Intel%20Mac%20OS%20X%2010.9%3b%20rv%3a28.0)%20Gecko%2f20100101%20Firefox%2f28.0%20(FlipboardProxy%2f1.1%3b%20+http%3a%2f%2fflipboard.com%2fbrowserproxy)\",\n\t\t \"reqMethod\" : \"POST\",\n\t\t \"fwdHost\" : \"www.example.com\",\n\t\t \"proto\" : \"http\",\n\t\t \"reqPort\" : \"80\",\n\t\t \"reqPath\" : \"%2f\"\n\t\t},\n\t\t\"netPerf\" : {\n\t\t \"asnum\" : \"8523\",\n\t\t \"downloadTime\" : \"1\",\n\t\t \"edgeIP\" : \"165.254.92.141\",\n\t\t \"lastByte\" : \"0\",\n\t\t \"lastMileRTT\" : \"102\",\n\t\t \"firstByte\" : \"0\",\n\t\t \"cacheStatus\" : \"0\"\n\t\t},\n\t\t\"network\" : {\n\t\t \"asnum\" : \"8523\",\n\t\t \"edgeIP\" : \"165.254.92.141\",\n\t\t \"networkType\" : \"\",\n\t\t \"network\" : \"\"\n\t\t},\n\t\t\"cp\" : \"123456\",\n\t\t\"id\" : \"915cfea5570f824cc27112-a\",\n\t\t\"version\" : \"1.0\",\n\t\t\"start\" : \"1460634188.565\",\n\t\t\"type\" : \"cloud_monitor\",\n\t\t\"format\" : \"default\",\n\t\t\"respHdr\" : {\n\t\t \"server\" : \"Microsoft-IIS/8.5\",\n\t\t \"contEnc\" : \"identity\"\n\t\t},\n\t\t\"geo\" : {\n\t\t \"lat\" : \"59.33\",\n\t\t \"region\" : \"AB\",\n\t\t \"long\" : \"18.05\",\n\t\t \"country\" : \"DE\",\n\t\t \"city\" : \"dummy\"\n\t\t},\n\t\t\"reqHdr\" : {\n\t\t \"cookie\" : \"drbanan%3d1\"\n\t\t}\n\t }]`\n\n\tpayloads, err := CreateObjects([]byte(json))\n\tif err != nil {\n\t\tt.Errorf(\"Error while trying to decode valid JSON payload: %s\", err)\n\t}\n\n\tif len(payloads) != 1 {\n\t\tt.Errorf(\"Unexpected number of payloads in JSON: Should be 1, is %d\", len(payloads))\n\t}\n\n\tpayload := payloads[0]\n\tif payload.CP != \"123456\" {\n\t\tt.Errorf(\"CP not correct in payload. Should be 123456, is %s\", payload.CP)\n\t}\n\tif payload.ID != \"915cfea5570f824cc27112-a\" {\n\t\tt.Errorf(\"ID not correct in payload. Should be 915cfea5570f824cc27112-a, is %s\", payload.ID)\n\t}\n\tif payload.Geo.Country != \"DE\" {\n\t\tt.Errorf(\"Country not correct in payload. Should be DE, is %s\", payload.Geo.Country)\n\t}\n}", "title": "" }, { "docid": "f78d1f7f2add367b9ca22eb01d208edf", "score": "0.5048006", "text": "func Fail(w http.ResponseWriter, status, code int, details string) {\n\tresponse := &Response{\n\t\tStatus: StatusNOk,\n\t\tError: &CustomError{\n\t\t\tCode: code,\n\t\t\tDetails: details,\n\t\t},\n\t}\n\tresult, err := json.Marshal(response)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), 400)\n\t\treturn\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(status)\n\tw.Write(result)\n}", "title": "" }, { "docid": "ef5e4ecaede6dd4d5d15167a5f703031", "score": "0.5047832", "text": "func TestRejectCommInvalidJSON(t *testing.T) {\n\thelloFile := common.GetTestActionFilename(\"hello.js\")\n\tvar invalidJSONInputs = []string{\n\t\t\"{\\\"invalid1\\\": }\",\n\t\t\"{\\\"invalid2\\\": bogus}\",\n\t\t\"{\\\"invalid1\\\": \\\"aKey\\\"\",\n\t\t\"invalid \\\"string\\\"\",\n\t\t\"{\\\"invalid1\\\": [1, 2, \\\"invalid\\\"\\\"arr\\\"]}\",\n\t}\n\tvar invalidJSONFiles = []string{\n\t\tcommon.GetTestActionFilename(\"malformed.js\"),\n\t\tcommon.GetTestActionFilename(\"invalidInput1.json\"),\n\t\tcommon.GetTestActionFilename(\"invalidInput2.json\"),\n\t\tcommon.GetTestActionFilename(\"invalidInput3.json\"),\n\t\tcommon.GetTestActionFilename(\"invalidInput4.json\"),\n\t}\n\tvar invalidParamArg = \"Invalid parameter argument\"\n\tvar invalidAnnoArg = \"Invalid annotation argument\"\n\tvar paramCmds = []common.InvalidArg{\n\t\t{\n\t\t\tCmd: []string{\"action\", \"create\", \"actionName\", helloFile},\n\t\t\tErr: invalidParamArg,\n\t\t},\n\t\t{\n\t\t\tCmd: []string{\"action\", \"update\", \"actionName\", helloFile},\n\t\t\tErr: invalidParamArg,\n\t\t},\n\t\t{\n\t\t\tCmd: []string{\"action\", \"invoke\", \"actionName\"},\n\t\t\tErr: invalidParamArg,\n\t\t},\n\t\t{\n\t\t\tCmd: []string{\"package\", \"create\", \"packageName\"},\n\t\t\tErr: invalidParamArg,\n\t\t},\n\t\t{\n\t\t\tCmd: []string{\"package\", \"update\", \"packageName\"},\n\t\t\tErr: invalidParamArg,\n\t\t},\n\t\t{\n\t\t\tCmd: []string{\"package\", \"bind\", \"packageName\", \"boundPackageName\"},\n\t\t\tErr: invalidParamArg,\n\t\t},\n\t\t{\n\t\t\tCmd: []string{\"trigger\", \"create\", \"triggerName\"},\n\t\t\tErr: invalidParamArg,\n\t\t},\n\t\t{\n\t\t\tCmd: []string{\"trigger\", \"update\", \"triggerName\"},\n\t\t\tErr: invalidParamArg,\n\t\t},\n\t\t{\n\t\t\tCmd: []string{\"trigger\", \"fire\", \"triggerName\"},\n\t\t\tErr: invalidParamArg,\n\t\t},\n\t}\n\n\tvar annotCmds = []common.InvalidArg{\n\t\t{\n\t\t\tCmd: []string{\"action\", \"create\", \"actionName\", helloFile},\n\t\t\tErr: invalidAnnoArg,\n\t\t},\n\t\t{\n\t\t\tCmd: []string{\"action\", \"update\", \"actionName\", helloFile},\n\t\t\tErr: invalidAnnoArg,\n\t\t},\n\t\t{\n\t\t\tCmd: []string{\"package\", \"create\", \"packageName\"},\n\t\t\tErr: invalidAnnoArg,\n\t\t},\n\t\t{\n\t\t\tCmd: []string{\"package\", \"update\", \"packageName\"},\n\t\t\tErr: invalidAnnoArg,\n\t\t},\n\t\t{\n\t\t\tCmd: []string{\"package\", \"bind\", \"packageName\", \"boundPackageName\"},\n\t\t\tErr: invalidAnnoArg,\n\t\t},\n\t\t{\n\t\t\tCmd: []string{\"trigger\", \"create\", \"triggerName\"},\n\t\t\tErr: invalidAnnoArg,\n\t\t},\n\t\t{\n\t\t\tCmd: []string{\"trigger\", \"update\", \"triggerName\"},\n\t\t\tErr: invalidAnnoArg,\n\t\t},\n\t}\n\n\tfor _, cmd := range paramCmds {\n\t\tfor _, invalid := range invalidJSONInputs {\n\t\t\tcs := cmd.Cmd\n\t\t\tcs = append(cs, \"-p\", \"key\", invalid, \"--apihost\", wsk.Wskprops.APIHost)\n\t\t\tstdout, err := wsk.RunCommand(cs...)\n\t\t\toutputString := string(stdout)\n\t\t\tassert.NotEqual(t, nil, err, \"The command should fail to run.\")\n\t\t\tassert.Equal(t, \"exit status 1\", err.Error(), \"The error should be exit status 1.\")\n\t\t\tassert.Contains(t, outputString, cmd.Err,\n\t\t\t\t\"The output of the command does not contain \"+cmd.Err+\" .\")\n\t\t}\n\t\tfor _, invalid := range invalidJSONFiles {\n\t\t\tcs := cmd.Cmd\n\t\t\tcs = append(cs, \"-P\", invalid, \"--apihost\", wsk.Wskprops.APIHost)\n\t\t\tstdout, err := wsk.RunCommand(cs...)\n\t\t\toutputString := string(stdout)\n\t\t\tassert.NotEqual(t, nil, err, \"The command should fail to run.\")\n\t\t\tassert.Equal(t, \"exit status 1\", err.Error(), \"The error should be exit status 1.\")\n\t\t\tassert.Contains(t, outputString, cmd.Err,\n\t\t\t\t\"The output of the command does not contain \"+cmd.Err+\" .\")\n\t\t}\n\t}\n\n\tfor _, cmd := range annotCmds {\n\t\tfor _, invalid := range invalidJSONInputs {\n\t\t\tcs := cmd.Cmd\n\t\t\tcs = append(cs, \"-a\", \"key\", invalid, \"--apihost\", wsk.Wskprops.APIHost)\n\t\t\tstdout, err := wsk.RunCommand(cs...)\n\t\t\toutputString := string(stdout)\n\t\t\tassert.NotEqual(t, nil, err, \"The command should fail to run.\")\n\t\t\tassert.Equal(t, \"exit status 1\", err.Error(), \"The error should be exit status 1.\")\n\t\t\tassert.Contains(t, outputString, cmd.Err,\n\t\t\t\t\"The output of the command does not contain \"+cmd.Err+\" .\")\n\t\t}\n\t\tfor _, invalid := range invalidJSONFiles {\n\t\t\tcs := cmd.Cmd\n\t\t\tcs = append(cs, \"-A\", invalid, \"--apihost\", wsk.Wskprops.APIHost)\n\t\t\tstdout, err := wsk.RunCommand(cs...)\n\t\t\toutputString := string(stdout)\n\t\t\tassert.NotEqual(t, nil, err, \"The command should fail to run.\")\n\t\t\tassert.Equal(t, \"exit status 1\", err.Error(), \"The error should be exit status 1.\")\n\t\t\tassert.Contains(t, outputString, cmd.Err,\n\t\t\t\t\"The output of the command does not contain \"+cmd.Err+\" .\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "02d2959fc97dc95bdd0397147a77843f", "score": "0.5045506", "text": "func (m *MockAPI) DeploymentLogs(arg0 string) (*http.Response, error) {\n\tret := m.ctrl.Call(m, \"DeploymentLogs\", arg0)\n\tret0, _ := ret[0].(*http.Response)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "166ed71b7b489a59f928484ea639cea8", "score": "0.5037649", "text": "func UpdateDeploymentMocked(\n\tt *testing.T,\n\tcloudSpecificExtensionDeploymentIn *types.CloudSpecificExtensionDeployment,\n) *types.CloudSpecificExtensionDeployment {\n\n\tassert := assert.New(t)\n\n\t// wire up\n\tcs := &utils.MockConcertoService{}\n\tds, err := NewCloudSpecificExtensionDeploymentService(cs)\n\tassert.Nil(err, \"Couldn't load cloudSpecificExtensionDeployment service\")\n\tassert.NotNil(ds, \"CloudSpecificExtensionDeployment service not instanced\")\n\n\t// convertMap\n\tmapIn, err := utils.ItemConvertParams(*cloudSpecificExtensionDeploymentIn)\n\tassert.Nil(err, \"CloudSpecificExtensionDeployment test data corrupted\")\n\n\t// to json\n\tdOut, err := json.Marshal(cloudSpecificExtensionDeploymentIn)\n\tassert.Nil(err, \"CloudSpecificExtensionDeployment test data corrupted\")\n\n\t// call service\n\tcs.On(\"Put\", fmt.Sprintf(APIPathCseDeployment, cloudSpecificExtensionDeploymentIn.ID), mapIn).\n\t\tReturn(dOut, 200, nil)\n\tcloudSpecificExtensionDeploymentOut, err := ds.UpdateDeployment(cloudSpecificExtensionDeploymentIn.ID, mapIn)\n\n\tassert.Nil(err, \"Error updating cloud specific extension deployment\")\n\tassert.Equal(\n\t\tcloudSpecificExtensionDeploymentIn,\n\t\tcloudSpecificExtensionDeploymentOut,\n\t\t\"UpdateDeployment returned different cloud specific extension deployment\",\n\t)\n\n\treturn cloudSpecificExtensionDeploymentOut\n}", "title": "" }, { "docid": "95805500b75e3b0fc1b0462c31d78678", "score": "0.5032402", "text": "func (suite *MockDatastoreTestSuite) TestDataStoreFailureGetTaskConfig() {\n\t_, _, err := suite.store.GetTaskConfigs(\n\t\tcontext.Background(), suite.testJobID, []uint32{0}, 0)\n\tsuite.Error(err)\n}", "title": "" }, { "docid": "9f6c44391a56590961d50c7b942a16f9", "score": "0.5031024", "text": "func assertDeployRequestMade(target string, client *mockHttpClient, t *testing.T) {\n assert.Equal(t, target + \"/application/v2/tenant/default/prepareandactivate\", client.lastRequest.URL.String())\n assert.Equal(t, \"application/zip\", client.lastRequest.Header.Get(\"Content-Type\"))\n assert.Equal(t, \"POST\", client.lastRequest.Method)\n var body = client.lastRequest.Body\n assert.NotNil(t, body)\n buf := make([]byte, 7) // Just check the first few bytes\n body.Read(buf)\n assert.Equal(t, \"PK\\x03\\x04\\x14\\x00\\b\", string(buf))\n}", "title": "" }, { "docid": "8a4b14b2221071e1c0d03d2ebf859e7e", "score": "0.49982023", "text": "func testGatePipelineGetMalformed() *httptest.Server {\n\treturn httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tfmt.Fprintln(w, strings.TrimSpace(malformedPipelineGetJson))\n\t}))\n}", "title": "" }, { "docid": "7e31512cf4988cd776485061929f8a7b", "score": "0.49918172", "text": "func (tc *tCustomTesting) FailNow() {}", "title": "" }, { "docid": "4bd74b80245d2916abb2cac5a10ead4e", "score": "0.49814475", "text": "func GetLoadBalancerPlanFailErrMocked(\n\tt *testing.T,\n\tloadBalancerPlanID string,\n\tloadBalancerPlanIn *types.LoadBalancerPlan,\n) *types.LoadBalancerPlan {\n\n\tassert := assert.New(t)\n\n\t// wire up\n\tcs := &utils.MockConcertoService{}\n\tds, err := NewLoadBalancerService(cs)\n\tassert.Nil(err, \"Couldn't load loadBalancer service\")\n\tassert.NotNil(ds, \"LoadBalancer service not instanced\")\n\n\t// to json\n\tdIn, err := json.Marshal(loadBalancerPlanIn)\n\tassert.Nil(err, \"LoadBalancerPlan test data corrupted\")\n\n\t// call service\n\tcs.On(\"Get\", fmt.Sprintf(APIPathNetworkLoadBalancerPlan, loadBalancerPlanID)).\n\t\tReturn(dIn, 200, fmt.Errorf(\"mocked error\"))\n\tloadBalancerPlanOut, err := ds.GetLoadBalancerPlan(loadBalancerPlanID)\n\n\tassert.NotNil(err, \"We are expecting an error\")\n\tassert.Nil(loadBalancerPlanOut, \"Expecting nil output\")\n\tassert.Equal(err.Error(), \"mocked error\", \"Error should be 'mocked error'\")\n\n\treturn loadBalancerPlanOut\n}", "title": "" }, { "docid": "33699987da47b1463c37b47b9be0b46a", "score": "0.49770135", "text": "func (m *MockGravatarRepository) JSONURL() (string, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"JSONURL\")\n\tret0, _ := ret[0].(string)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "9bea9605395333fb672684beb1d8379e", "score": "0.49670896", "text": "func (suite *MockDatastoreTestSuite) TestDataStoreFailureGetJob() {\n\t_, err := suite.store.GetMaxJobConfigVersion(\n\t\tcontext.Background(), suite.testJobID.GetValue())\n\tsuite.Error(err)\n}", "title": "" }, { "docid": "0dbdbd1eda995a696fff3911ab2fee26", "score": "0.496467", "text": "func TestNewReportPassFail(t *testing.T) {\n\tunittest.MediumTest(t)\n\n\twd, cleanup := testutils.TempDir(t)\n\tdefer cleanup()\n\n\timgData := []byte(\"some bytes\")\n\timgHash := types.Digest(\"9d0568469d206c1aedf1b71f12f474bc\")\n\ttestName := types.TestName(\"TestNotSeenBefore\")\n\n\tauth, httpClient, uploader, _ := makeMocks()\n\tdefer httpClient.AssertExpectations(t)\n\tdefer uploader.AssertExpectations(t)\n\n\thashesResp := httpResponse([]byte(\"none\"), \"200 OK\", http.StatusOK)\n\thttpClient.On(\"Get\", \"https://testing-gold.skia.org/json/hashes\").Return(hashesResp, nil)\n\n\texp := httpResponse([]byte(\"{}\"), \"200 OK\", http.StatusOK)\n\thttpClient.On(\"Get\", \"https://testing-gold.skia.org/json/expectations?issue=867\").Return(exp, nil)\n\n\texpectedUploadPath := string(\"gs://skia-gold-testing/dm-images-v1/\" + imgHash + \".png\")\n\tuploader.On(\"UploadBytes\", testutils.AnyContext, imgData, testImgPath, expectedUploadPath).Return(nil)\n\n\texpectedJSONPath := \"skia-gold-testing/trybot/dm-json-v1/2019/04/02/19/abcd1234/117/1554234843/dm-1554234843000000000.json\"\n\tcheckResults := func(g *jsonio.GoldResults) bool {\n\t\t// spot check some of the properties\n\t\tassert.Equal(t, \"abcd1234\", g.GitHash)\n\t\tassert.Equal(t, testBuildBucketID, g.TryJobID)\n\t\tassert.Equal(t, map[string]string{\n\t\t\t\"os\": \"WinTest\",\n\t\t\t\"gpu\": \"GPUTest\",\n\t\t}, g.Key)\n\n\t\tresults := g.Results\n\t\tassert.Len(t, results, 1)\n\t\tr := results[0]\n\t\tassert.Equal(t, &jsonio.Result{\n\t\t\tDigest: imgHash,\n\t\t\tOptions: map[string]string{\n\t\t\t\t\"ext\": \"png\",\n\t\t\t},\n\t\t\tKey: map[string]string{\n\t\t\t\t\"name\": string(testName),\n\t\t\t\t// Since we did not specify a source_type it defaults to the instance name, which is\n\t\t\t\t// \"testing\"\n\t\t\t\t\"source_type\": \"testing\",\n\t\t\t},\n\t\t}, r)\n\t\treturn true\n\t}\n\n\tuploader.On(\"UploadJSON\", testutils.AnyContext, mock.MatchedBy(checkResults), filepath.Join(wd, jsonTempFile), expectedJSONPath).Return(nil)\n\n\tgoldClient, err := makeGoldClient(auth, true /*=passFail*/, false /*=uploadOnly*/, wd)\n\tassert.NoError(t, err)\n\terr = goldClient.SetSharedConfig(makeTestSharedConfig(), false)\n\tassert.NoError(t, err)\n\n\toverrideLoadAndHashImage(goldClient, func(path string) ([]byte, types.Digest, error) {\n\t\tassert.Equal(t, testImgPath, path)\n\t\treturn imgData, imgHash, nil\n\t})\n\n\tpass, err := goldClient.Test(testName, testImgPath, nil)\n\tassert.NoError(t, err)\n\t// Returns false because the test name has never been seen before\n\t// (and the digest is brand new)\n\tassert.False(t, pass)\n\n\tb, err := ioutil.ReadFile(filepath.Join(wd, failureLog))\n\tassert.NoError(t, err)\n\tassert.Equal(t, \"https://testing-gold.skia.org/detail?test=TestNotSeenBefore&digest=9d0568469d206c1aedf1b71f12f474bc&issue=867\\n\", string(b))\n}", "title": "" }, { "docid": "49dc159700087dbdc3bade611da890a7", "score": "0.4958221", "text": "func DeleteDeploymentMocked(t *testing.T, cloudSpecificExtensionDeploymentIn *types.CloudSpecificExtensionDeployment) {\n\n\tassert := assert.New(t)\n\n\t// wire up\n\tcs := &utils.MockConcertoService{}\n\tds, err := NewCloudSpecificExtensionDeploymentService(cs)\n\tassert.Nil(err, \"Couldn't load cloudSpecificExtensionDeployment service\")\n\tassert.NotNil(ds, \"CloudSpecificExtensionDeployment service not instanced\")\n\n\t// to json\n\tdIn, err := json.Marshal(cloudSpecificExtensionDeploymentIn)\n\tassert.Nil(err, \"CloudSpecificExtensionDeployment test data corrupted\")\n\n\t// call service\n\tcs.On(\"Delete\", fmt.Sprintf(APIPathCseDeployment, cloudSpecificExtensionDeploymentIn.ID)).Return(dIn, 200, nil)\n\tcloudSpecificExtensionDeploymentOut, err := ds.DeleteDeployment(cloudSpecificExtensionDeploymentIn.ID)\n\n\tassert.Nil(err, \"Error deleting cloud specific extension template\")\n\tassert.Equal(\n\t\tcloudSpecificExtensionDeploymentIn,\n\t\tcloudSpecificExtensionDeploymentOut,\n\t\t\"DeleteDeployment returned different cloud specific extension deployment\",\n\t)\n}", "title": "" }, { "docid": "3526288344665d4cacb8e1c78713d434", "score": "0.49443826", "text": "func TestDeployment(t *testing.T) {\n\tclientSet := fake.NewSimpleClientset()\n\tdeployDate := &DeployData{\n\t\tName: \"hello-world\",\n\t\tNameSpace: \"demo-dev\",\n\t\tReplicas: int32(1),\n\t\tLabels: map[string]string{\"app\": \"hello-world\"},\n\t\tImage: \"demo:0.1\",\n\t\tPorts: []int{8080},\n\t\tEnvs: map[string]string{\"ENVTEST\": \"ENVTEST\"},\n\t\tNodeName: \"1\",\n\t}\n\n\tdeploy := Deployment{\n\t\tclientSet: clientSet,\n\t}\n\n\t_, err := deploy.DeployNode(deployDate)\n\tassert.Equal(t, nil, err)\n\n}", "title": "" }, { "docid": "03dd4e6713d5d092caf4184b4bbb70b4", "score": "0.49412543", "text": "func (m *MockAPI) Deployment(arg0, arg1 string) (*go_scalingo.Deployment, error) {\n\tret := m.ctrl.Call(m, \"Deployment\", arg0, arg1)\n\tret0, _ := ret[0].(*go_scalingo.Deployment)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "cecec8650994e05d5e0ed2aaeee6cf41", "score": "0.49386027", "text": "func TestGetTokenInvalidErrorInterface(t *testing.T) {\n\tunexpectedJSONResponse := `{\"code\": 405, \"message\":\"RESTEASY003650: No resource method found for GET, return 405 with Allow header\"}`\n\tpostRequestFunc = func(url string, data url.Values) (*http.Response, error) {\n\t\treturn &http.Response{\n\t\t\tStatusCode: http.StatusMethodNotAllowed,\n\t\t\tBody: ioutil.NopCloser(strings.NewReader(unexpectedJSONResponse)),\n\t\t}, nil\n\t}\n\trestclient.AuthHTTPClient = &postClientMock{} //without this line, the real api is fired\n\n\tresponse, err := AuthProvider.GetToken(auth_domain.AuthRequest{Token: \"this_is_my_token\"})\n\tassert.NotNil(t, err)\n\tassert.Nil(t, response)\n\tassert.NotNil(t, err.Error)\n\tassert.EqualValues(t, unexpectedJSONResponse, err.Response)\n}", "title": "" }, { "docid": "c87c10d1af8e0ca1c7f149a5716a5c40", "score": "0.4934954", "text": "func (m *ManagerMock) GetJSON(ctx context.Context, input *hub.GetPackageInput) ([]byte, error) {\n\targs := m.Called(ctx, input)\n\tdata, _ := args.Get(0).([]byte)\n\treturn data, args.Error(1)\n}", "title": "" }, { "docid": "4d0882113a175d90b49e0f8fbdfd6e29", "score": "0.49343568", "text": "func shouldCreateTransactionJSON(actual interface{}, expected ...interface{}) string {\n\ttx, ok := actual.(*train.Transaction)\n\tif !ok {\n\t\treturn \"expected *train.Transaction for expected arg[0]\"\n\t}\n\n\tpath := filepath.Join(tx.GetPath(), \"transaction.json\")\n\tf, err := os.Open(path)\n\tif err != nil {\n\t\treturn \"unexpected error while reading transaction.json file \" + err.Error()\n\t}\n\n\tdefer f.Close()\n\n\tvar txJson train.Transaction\n\tif err := json.NewDecoder(f).Decode(&txJson); err != nil {\n\t\treturn \"unexpected error while marshalling transaction.json file \" + err.Error()\n\t}\n\n\tif txJson.ID != tx.ID {\n\t\treturn fmt.Sprintf(\"incorrect transaction.ID expected %q but was %q\", tx.ID, txJson.ID)\n\t}\n\n\tif txJson.Status != \"started\" {\n\t\treturn fmt.Sprintf(\"incorrect transaction.status expected %q but was %q\", \"started\", txJson.Status)\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "4147dd3ac3986c862523aac94a8232d7", "score": "0.49309975", "text": "func TestGet(t *testing.T) {\n\n\t// Override the download function, but restore it when we're done\n\tdownloadGet = fakeDownload\n\tdefer func() {\n\t\tdownloadGet = origDownloadGet\n\t}()\n\n\t// Store the actual slice of manifest items that `Get` returns\n\tactualManifests, _ := Get(cfg)\n\n\t// Define the slice of manifest items we expect it to return\n\texpectedManifests := []Item{exampleManifest, includedManifest, localManifest}\n\t// \t{\n\t// \t\tName: \"example_manifest\",\n\t// \t\tIncludes: []string{\"included_manifest\"},\n\t// \t\tInstalls: []string{\"Chocolatey\", \"GoogleChrome\"},\n\t// \t\tUninstalls: []string{\"AdobeFlash\"},\n\t// \t\tUpdates: []string{\"ChefClient\", \"CanonDrivers\"},\n\t// \t},\n\t// \t{\n\t// \t\tName: \"included_manifest\",\n\t// \t\tIncludes: []string(nil),\n\t// \t\tInstalls: []string{\"TestInstall1\", \"TestInstall2\"},\n\t// \t\tUninstalls: []string{\"TestUninstall1\", \"TestUninstall2\"},\n\t// \t\tUpdates: []string{\"TestUpdate1\", \"TestUpdate2\"},\n\t// \t},\n\t// }\n\n\t// Compare the actual result with our expectations\n\tstructsMatch := reflect.DeepEqual(expectedManifests, actualManifests)\n\n\tif !structsMatch {\n\t\tt.Errorf(\"\\nExpected: %#v\\nActual: %#v\", expectedManifests, actualManifests)\n\t}\n}", "title": "" }, { "docid": "7ddfb19f60bac4cbdb22d869c2d19595", "score": "0.49279004", "text": "func jsonResponse(endpoint string) []byte {\n\n\tjsonResponsesMap := map[string]string{\n\t\t\"/redfish/v1/\": fixturesDir + \"/v1/serviceroot.json\",\n\t\t\"/redfish/v1/UpdateService\": fixturesDir + \"/v1/updateservice.json\",\n\t\t\"/redfish/v1/Systems\": fixturesDir + \"/v1/systems.json\",\n\n\t\t\"/redfish/v1/Systems/System.Embedded.1\": fixturesDir + \"/v1/dell/system.embedded.1.json\",\n\t\t\"/redfish/v1/Managers/iDRAC.Embedded.1/Oem/Dell/Jobs?$expand=*($levels=1)\": fixturesDir + \"/v1/dell/jobs.json\",\n\t\t\"/redfish/v1/Managers/iDRAC.Embedded.1/Oem/Dell/Jobs/JID_467762674724\": fixturesDir + \"/v1/dell/job_delete_ok.json\",\n\t}\n\n\tfh, err := os.Open(jsonResponsesMap[endpoint])\n\tif err != nil {\n\t\tlog.Fatalf(\"%s, failed to open fixture: %s for endpoint: %s\", err.Error(), jsonResponsesMap[endpoint], endpoint)\n\t}\n\n\tdefer fh.Close()\n\n\tb, err := ioutil.ReadAll(fh)\n\tif err != nil {\n\t\tlog.Fatalf(\"%s, failed to read fixture: %s for endpoint: %s\", err.Error(), jsonResponsesMap[endpoint], endpoint)\n\t}\n\n\treturn b\n}", "title": "" }, { "docid": "23cdd0d60503520c2d1246ab7ad5dec4", "score": "0.49230888", "text": "func CreateLoadBalancerFailErrMocked(t *testing.T, loadBalancerIn *types.LoadBalancer) *types.LoadBalancer {\n\n\tassert := assert.New(t)\n\n\t// wire up\n\tcs := &utils.MockConcertoService{}\n\tds, err := NewLoadBalancerService(cs)\n\tassert.Nil(err, \"Couldn't load loadBalancer service\")\n\tassert.NotNil(ds, \"LoadBalancer service not instanced\")\n\n\t// convertMap\n\tmapIn, err := utils.ItemConvertParams(*loadBalancerIn)\n\tassert.Nil(err, \"LoadBalancer test data corrupted\")\n\n\t// to json\n\tdOut, err := json.Marshal(loadBalancerIn)\n\tassert.Nil(err, \"LoadBalancer test data corrupted\")\n\n\t// call service\n\tcs.On(\"Post\", APIPathNetworkLoadBalancers, mapIn).Return(dOut, 200, fmt.Errorf(\"mocked error\"))\n\tloadBalancerOut, err := ds.CreateLoadBalancer(mapIn)\n\n\tassert.NotNil(err, \"We are expecting an error\")\n\tassert.Nil(loadBalancerOut, \"Expecting nil output\")\n\tassert.Equal(err.Error(), \"mocked error\", \"Error should be 'mocked error'\")\n\n\treturn loadBalancerOut\n}", "title": "" }, { "docid": "a4bc087e871ea34b297f6531385ff4f4", "score": "0.49189582", "text": "func (m *MockAPI) DeploymentList(arg0 context.Context, arg1 string) ([]*scalingo.Deployment, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"DeploymentList\", arg0, arg1)\n\tret0, _ := ret[0].([]*scalingo.Deployment)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "cd91fb30b80942dbd08b38874300c5c7", "score": "0.49138224", "text": "func TestFailShowAPIBuildVersion(t *testing.T) {\n\tcommon.CreateFile(tmpProp)\n\n\tos.Setenv(\"WSK_CONFIG_FILE\", tmpProp)\n\tassert.Equal(t, os.Getenv(\"WSK_CONFIG_FILE\"), tmpProp, \"The environment variable WSK_CONFIG_FILE has not been set.\")\n\n\t_, err := wsk.RunCommand(\"property\", \"set\", \"--apihost\", \"xxxx.yyyy\")\n\tassert.Equal(t, nil, err, \"The command property set --apihost failed to run.\")\n\tstdout, err := wsk.RunCommand(\"property\", \"get\", \"-i\", \"--apibuild\")\n\tassert.NotEqual(t, nil, err, \"The command property get -i --apibuild does not raise any error.\")\n\tassert.Contains(t, common.RemoveRedundantSpaces(string(stdout)), common.PropDisplayAPIBuild+\" Unknown\",\n\t\t\"The output of the command property get --apibuild does not contain\"+common.PropDisplayAPIBuild+\" Unknown\")\n\tassert.Contains(t, common.RemoveRedundantSpaces(string(stdout)), \"Unable to obtain API build information\",\n\t\t\"The output of the command property get --apibuild does not contain \\\"Unable to obtain API build information\\\".\")\n}", "title": "" }, { "docid": "24487e4ea1842325da68f8b274238858", "score": "0.49111775", "text": "func TestGithubApiErrorUnmarshaling(t *testing.T) {\n\trestclient.FlushMockUp()\n\n\trestclient.AddMockUp(restclient.Mock{\n\t\tUrl: \"https://api.github.com/user/repos\",\n\t\tHttpMethod: http.MethodPost,\n\t\tResponse: &http.Response{\n\t\t\tStatusCode: http.StatusInternalServerError,\n\t\t\tBody: ioutil.NopCloser(strings.NewReader(`{\"message\": 1}`)),\n\t\t},\n\t})\n\n\tresponse, err := CreateRepo(\"\", github.CreateRepoRequest{})\n\tassert.Nil(t, response)\n\tassert.NotNil(t, err)\n\tassert.EqualValues(t, http.StatusBadRequest, err.StatusCode)\n\tassert.EqualValues(t, \"invalid json response body\", err.Message)\n}", "title": "" }, { "docid": "9033fed05d73cd10142120dab4d7aafa", "score": "0.48985273", "text": "func (client DictionaryClient) GetInvalidResponder(resp *http.Response) (result SetString, 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": "a43eddd0f761c2ca63b61f4686f9cdae", "score": "0.48940274", "text": "func responseJson(jsonIso Transaction) PaymentResponse {\n\tvar response PaymentResponse\n\n\t// Initiate request body\n\trequestBody, err := json.Marshal(jsonIso)\n\tif err != nil {\n\t\tlog.Fatalf(\"Preparing body request failed. Error: %v\\n\", err)\n\t}\n\n\t// Client setup for custom http request\n\tclient := &http.Client{}\n\n\n\tlog.Printf(\"Request to https://tiruan.herokuapp.com/biller\\n\")\n\n\t// Request to mock server\n\treq, err := http.NewRequest(\"GET\", \"https://tiruan.herokuapp.com/biller\", bytes.NewBuffer(requestBody))\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to sent request to https://tiruan.herokuapp.com/biller. Error: %v\\n\", err)\n\t}\n\n\t// Check response from mock server\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to get response from https://tiruan.herokuapp.com/biller. Error: %v\\n\", err)\n\t}\n\n\tdefer resp.Body.Close()\n\n\tlog.Printf(\"Response from https://tiruan.herokuapp.com/biller\\n\")\n\n\t// Read response from mock server\n\tbody, _ := ioutil.ReadAll(resp.Body)\n\tjson.Unmarshal(body, &response)\n\n\t// Get transactionData from mock server response\n\n\treturn response\n}", "title": "" }, { "docid": "5f788acbf459874c3eb4e6b012a65d4e", "score": "0.4888998", "text": "func assertJSONResponseWas(t *testing.T, status int, body string, w *httptest.ResponseRecorder) {\n\tresp := w.Result()\n\tassert.Equal(t, status, resp.StatusCode)\n\tassert.Equal(t, jsonContentType, resp.Header.Get(contentTypeHeader))\n\tassert.Equal(t, allowAllOrigins, resp.Header.Get(accessControlHeader))\n\tassert.Equal(t, noSniffContent, resp.Header.Get(contentTypeOptionsHeader))\n\trespBody, err := ioutil.ReadAll(resp.Body)\n\trequire.NoError(t, err)\n\t// The JSON encoder includes a newline \"\\n\" at the end of the body, which is awkward to include\n\t// in the literals passed in above, so we add that here\n\tassert.Equal(t, body+\"\\n\", string(respBody))\n}", "title": "" }, { "docid": "f713cc7f0572cb2b057812f489faf772", "score": "0.48863277", "text": "func TestRestGet(t *testing.T) {\n\tts := initTestApi(t)\n\tdefer ts.Close()\n\n\tresp, err := http.Get(ts.URL + \"/_ah/api/test_service/v1/test\")\n\tassert.NoError(t, err)\n\tassert.Equal(t, resp.StatusCode, 200)\n\tassert.Equal(t, resp.Header.Get(\"Content-Type\"), \"application/json\")\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tassert.NoError(t, err)\n\n\tvar responseJson map[string]interface{}\n\terr = json.Unmarshal(body, &responseJson)\n\tassert.NoError(t, err)\n\n\texpected := map[string]interface{}{\"text\": \"Test response\"}\n\tassert.Equal(t, expected, responseJson)\n}", "title": "" }, { "docid": "ea0e5e5f4178d02b0ad1efed7a48dd26", "score": "0.4882969", "text": "func (r *tRepository) GetValidDeployment(name string) (*common.Deployment, error) {\n\td, err := r.GetDeployment(name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif d.State.Status == common.DeletedStatus {\n\t\treturn nil, fmt.Errorf(\"deployment %s is deleted\", name)\n\t}\n\n\treturn d, nil\n}", "title": "" }, { "docid": "415bf2454084efd87a38a200d062e64a", "score": "0.4867265", "text": "func (reg *ZKRegistry) Failure(name, version, endpoint string, err error) {\n\t// Would be used to remove an endpoint from the rotation, log the failure, etc.\n\treg.logger.Printf(\"Error accessing %s/%s (%s): %s\", name, version, endpoint, err)\n}", "title": "" }, { "docid": "6226524a61400bc17123723f309291ef", "score": "0.48581287", "text": "func ListDeploymentsMocked(\n\tt *testing.T,\n\tcloudSpecificExtensionDeploymentsIn []*types.CloudSpecificExtensionDeployment,\n) []*types.CloudSpecificExtensionDeployment {\n\n\tassert := assert.New(t)\n\n\t// wire up\n\tcs := &utils.MockConcertoService{}\n\tds, err := NewCloudSpecificExtensionDeploymentService(cs)\n\tassert.Nil(err, \"Couldn't load cloudSpecificExtensionDeployment service\")\n\tassert.NotNil(ds, \"CloudSpecificExtensionDeployment service not instanced\")\n\n\t// to json\n\tdIn, err := json.Marshal(cloudSpecificExtensionDeploymentsIn)\n\tassert.Nil(err, \"CloudSpecificExtensionDeployments test data corrupted\")\n\n\t// call service\n\tcs.On(\"Get\", APIPathCseDeployments).Return(dIn, 200, nil)\n\tcloudSpecificExtensionDeploymentsOut, err := ds.ListDeployments()\n\n\tassert.Nil(err, \"Error getting cloud specific extension deployments\")\n\tassert.Equal(\n\t\tcloudSpecificExtensionDeploymentsIn,\n\t\tcloudSpecificExtensionDeploymentsOut,\n\t\t\"ListDeployments returned different cloud specific extension deployments\",\n\t)\n\n\treturn cloudSpecificExtensionDeploymentsOut\n}", "title": "" }, { "docid": "ff36999c8f5c3ed2fecc0e0a4a6ae4ab", "score": "0.48568264", "text": "func RunJSONSerializationTestForBackup_STATUS_ARM(subject Backup_STATUS_ARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual Backup_STATUS_ARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "a0790c71f993ff769fee46c4ae69c90b", "score": "0.48444343", "text": "func (d *FakeLogger) Fail(args ...interface{}) {}", "title": "" }, { "docid": "9d3e2d1588aca1fc05ca9a092a4ca595", "score": "0.48442677", "text": "func RunJSONSerializationTestForVirtualHardDiskStatusARM(subject VirtualHardDisk_StatusARM) string {\n\t// Serialize to JSON\n\tbin, err := json.Marshal(subject)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Deserialize back into memory\n\tvar actual VirtualHardDisk_StatusARM\n\terr = json.Unmarshal(bin, &actual)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\t// Check for outcome\n\tmatch := cmp.Equal(subject, actual, cmpopts.EquateEmpty())\n\tif !match {\n\t\tactualFmt := pretty.Sprint(actual)\n\t\tsubjectFmt := pretty.Sprint(subject)\n\t\tresult := diff.Diff(subjectFmt, actualFmt)\n\t\treturn result\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "84d744c6afbfcb319cd398e7d4c00857", "score": "0.4828073", "text": "func TestErrorReportingOfEmptyJSONArrays(t *testing.T) {\n\ty := `\n---\n- name: Testing whitespace sensitivity\n request:\n uri: /hello\n method: POST\n body: '{\"email\":\"foo@bar.com\",\"password\":\"xxx\"}'\n response:\n code: 200\n body: '{\"stuff\": [{\"foo\":\"bar\"}]}'\n`\n\n\tfakeEndPoints, err := mockingjay.NewFakeEndpoints([]byte(y))\n\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\trealServer := makeFakeDownstreamServer(`{\"stuff\":[]}`, noSleep)\n\n\tif checker.CheckCompatability(fakeEndPoints, realServer.URL) {\n\t\tt.Error(\"Checker shouldn't have found it compatible because its got an empty array downstream\")\n\t}\n}", "title": "" }, { "docid": "22cd2cf87114519149f4eac38b2dc433", "score": "0.48245248", "text": "func (c *Mock) GetVersion(ctx context.Context, taskData TaskData) (*version.Version, error) {\n\tvar err error\n\tvar data []byte\n\n\tswitch taskData.ID {\n\tcase \"shellexec\":\n\t\tdata, err = ioutil.ReadFile(filepath.Join(testutil.GetDirectoryOfFile(), \"testdata\", \"shellexec.yaml\"))\n\tcase \"s3copy\":\n\t\tdata, err = ioutil.ReadFile(filepath.Join(testutil.GetDirectoryOfFile(), \"testdata\", \"s3copy.yaml\"))\n\t}\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tconfig := string(data)\n\treturn &version.Version{\n\t\tId: \"mock_version_id\",\n\t\tConfig: config,\n\t}, nil\n}", "title": "" } ]
85667f20719a256bc9e29d59fab440b2
List returns a list of pods that match the given selector.
[ { "docid": "29e4c479c08675b662cab58c7d22fed7", "score": "0.5547106", "text": "func ListPVC(ctx context.Context, c client.Client, namespace string, selector map[string]string) ([]corev1.PersistentVolumeClaim, error) {\n\tlist := &corev1.PersistentVolumeClaimList{}\n\topts := []client.ListOption{\n\t\tclient.InNamespace(namespace),\n\t\tclient.MatchingLabels(selector),\n\t}\n\tif err := c.List(ctx, list, opts...); err != nil {\n\t\treturn nil, kverrors.Wrap(err, \"failed to list persistentvolumeclaim\",\n\t\t\t\"namespace\", namespace,\n\t\t)\n\t}\n\n\treturn list.Items, nil\n}", "title": "" } ]
[ { "docid": "121eb2a953a21dad2c71b5c71ce8dcda", "score": "0.7790241", "text": "func (c *Client) ListPods(selector string) ([]Pod, error) {\n\tc.log(\"ListPods\", selector)\n\tvar pl struct {\n\t\tItems []Pod `json:\"items\"`\n\t}\n\terr := c.request(&request{\n\t\tpath: fmt.Sprintf(\"/api/v1/namespaces/%s/pods\", c.namespace),\n\t\tquery: map[string]string{\"labelSelector\": selector},\n\t}, &pl)\n\treturn pl.Items, err\n}", "title": "" }, { "docid": "1e73a7670fde28b5d9981765b6166ac5", "score": "0.775568", "text": "func List(ctx context.Context, c client.Client, namespace string, selector map[string]string) ([]corev1.Pod, error) {\n\tlist := &corev1.PodList{}\n\topts := []client.ListOption{\n\t\tclient.InNamespace(namespace),\n\t\tclient.MatchingLabels(selector),\n\t}\n\tif err := c.List(ctx, list, opts...); err != nil {\n\t\treturn nil, kverrors.Wrap(err, \"failed to list pods\",\n\t\t\t\"namespace\", namespace,\n\t\t)\n\t}\n\n\treturn list.Items, nil\n}", "title": "" }, { "docid": "a1ca0272d924553b68df73935338d673", "score": "0.7261233", "text": "func (impl *Impl) getPodsFromSelector(ctx context.Context, namespace string, labelSelector map[string]string) ([]v1.Pod, error) {\n\tlSelector := labels.SelectorFromSet(labelSelector)\n\tlistOptions := &client.ListOptions{\n\t\tNamespace: namespace,\n\t\tLabelSelector: lSelector,\n\t}\n\tpodsList := &v1.PodList{}\n\terr := impl.Client.List(ctx, podsList, listOptions)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn podsList.Items, nil\n}", "title": "" }, { "docid": "8ea9a34cd69f88b4048124398dcbad89", "score": "0.7200082", "text": "func (f *PodLister) List(selector labels.Selector) (ret []*corev1.Pod, err error) {\n\treturn f.ListReactor(selector)\n}", "title": "" }, { "docid": "78eefb9f8fbf8f245c15bb805282cc62", "score": "0.6995623", "text": "func CommandPodListBySelector(namespace string, selector []string) *KubeCall {\n\tselectorList := strings.Join(selector, \",\")\n\tp := newParser()\n\tc := newCommand([]string{\n\t\tfmt.Sprintf(\"--namespace=%s\", formatNamespace(namespace)),\n\t\t\"get\",\n\t\t\"pods\",\n\t\tfmt.Sprintf(\"--selector=%s\", selectorList),\n\t\t\"-o\",\n\t\t\"yaml\",\n\t})\n\n\treturn &KubeCall{\n\t\tCmd: c,\n\t\tParser: p,\n\t}\n}", "title": "" }, { "docid": "1cedd7e93b0beb80e27a7ef4fecb70c5", "score": "0.679487", "text": "func (k *KubernetesScheduler) ListPods(selector labels.Selector) (*api.PodList, error) {\n\tlog.V(2).Infof(\"List pods for '%v'\\n\", selector)\n\n\tk.RLock()\n\tdefer k.RUnlock()\n\n\tvar result []api.Pod\n\tfor _, task := range k.runningTasks {\n\t\tpod := task.Pod\n\n\t\tvar l labels.Set = pod.Labels\n\t\tif selector.Matches(l) || selector.Empty() {\n\t\t\tresult = append(result, *pod)\n\t\t}\n\t}\n\n\t// TODO(nnielsen): Refactor tasks append for the three lists.\n\tfor _, task := range k.pendingTasks {\n\t\tpod := task.Pod\n\n\t\tvar l labels.Set = pod.Labels\n\t\tif selector.Matches(l) || selector.Empty() {\n\t\t\tresult = append(result, *pod)\n\t\t}\n\t}\n\n\t// TODO(nnielsen): Wire up check in finished tasks\n\n\tmatches := &api.PodList{Items: result}\n\tlog.V(2).Infof(\"Returning pods: '%v'\\n\", matches)\n\n\treturn matches, nil\n}", "title": "" }, { "docid": "1b59eb616c0163e146b1376e4a3c684a", "score": "0.6788644", "text": "func ListPodsWithLabelSelector(k8s kubernetes.Interface, namespace, selector string) ([]corev1.Pod, error) {\n\topts := metav1.ListOptions{LabelSelector: selector}\n\n\tlist, err := k8s.CoreV1().Pods(namespace).List(context.TODO(), opts)\n\tif err != nil {\n\t\treturn []corev1.Pod{}, err\n\t}\n\n\treturn list.Items, nil\n}", "title": "" }, { "docid": "6336a7a3f049fcf62e474e710f4fe215", "score": "0.6771924", "text": "func ListPodsWithLabelSelector(k8s kubernetes.Interface, namespace, selector string) ([]corev1.Pod, error) {\n\topts := metav1.ListOptions{LabelSelector: selector}\n\n\tlist, err := k8s.CoreV1().Pods(namespace).List(opts)\n\tif err != nil {\n\t\treturn []corev1.Pod{}, err\n\t}\n\n\treturn list.Items, nil\n}", "title": "" }, { "docid": "32746585126ab5a0fc3347c7fd6d1773", "score": "0.66183114", "text": "func (t *terraformer) listPods(ctx context.Context) (*corev1.PodList, error) {\n\tvar (\n\t\tpodList = &corev1.PodList{}\n\t\tlabels = map[string]string{LabelKeyName: t.name, LabelKeyPurpose: t.purpose}\n\t)\n\n\tif err := t.client.List(ctx, podList, client.InNamespace(t.namespace), client.MatchingLabels(labels)); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn podList, nil\n}", "title": "" }, { "docid": "8546ef40a05a86a2ff373900fd31c74a", "score": "0.64366937", "text": "func (f *PodNamespaceLister) List(selector labels.Selector) (ret []*corev1.Pod, err error) {\n\treturn f.ListReactor(selector)\n}", "title": "" }, { "docid": "60b52d2dd2b2c458fb2ae1c541413ec4", "score": "0.6402972", "text": "func PodsByLabel(context string, verbose bool, label string) []string {\n\tgpC := PrepKC(context, \"get\", \"pod\", `-o=jsonpath={range .items[*]}{@.metadata.name}{\"\\n\"}{end}`, \"--selector\", label)\n\tr, w := io.Pipe()\n\tgpC.Stdout = w\n\tscanner := bufio.NewScanner(r)\n\tnames := []string{}\n\tgo func() {\n\t\tex, err := Run(gpC, verbose)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error fetching pod %s\\n\", err)\n\t\t\tos.Exit(ex)\n\t\t}\n\t\tw.Close()\n\t}()\n\tfor scanner.Scan() {\n\t\tname := scanner.Text()\n\t\tif strings.TrimSpace(name) != \"\" {\n\t\t\tnames = append(names, name)\n\t\t}\n\t}\n\n\tif err := scanner.Err(); err != nil {\n\t\t//done\n\t\tlog.Printf(\"Error scanning output %s\\n\", err)\n\t\tos.Exit(1)\n\t}\n\n\treturn names\n}", "title": "" }, { "docid": "3f1790cf87630aa02adea32ded5c5bc0", "score": "0.63312054", "text": "func SelectPods(ctx context.Context, c client.Client, r client.Reader, selector v1alpha1.PodSelectorSpec, clusterScoped bool, targetNamespace string, enableFilterNamespace bool) ([]v1.Pod, error) {\n\t// TODO: refactor: make different selectors to replace if-else logics\n\tvar pods []v1.Pod\n\n\t// pods are specifically specified\n\tif len(selector.Pods) > 0 {\n\t\tfor ns, names := range selector.Pods {\n\t\t\tif !clusterScoped {\n\t\t\t\tif targetNamespace != ns {\n\t\t\t\t\tlog.Info(\"skip namespace because ns is out of scope within namespace scoped mode\", \"namespace\", ns)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor _, name := range names {\n\t\t\t\tvar pod v1.Pod\n\t\t\t\terr := c.Get(ctx, types.NamespacedName{\n\t\t\t\t\tNamespace: ns,\n\t\t\t\t\tName: name,\n\t\t\t\t}, &pod)\n\t\t\t\tif err == nil {\n\t\t\t\t\tpods = append(pods, pod)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tif apierrors.IsNotFound(err) {\n\t\t\t\t\tlog.Error(err, \"Pod is not found\", \"namespace\", ns, \"pod name\", name)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\n\t\treturn pods, nil\n\t}\n\n\tif !clusterScoped {\n\t\tif len(selector.Namespaces) > 1 {\n\t\t\treturn nil, fmt.Errorf(\"could NOT use more than 1 namespace selector within namespace scoped mode\")\n\t\t} else if len(selector.Namespaces) == 1 {\n\t\t\tif selector.Namespaces[0] != targetNamespace {\n\t\t\t\treturn nil, fmt.Errorf(\"could NOT list pods from out of scoped namespace: %s\", selector.Namespaces[0])\n\t\t\t}\n\t\t}\n\t}\n\n\tvar listOptions = client.ListOptions{}\n\tif !clusterScoped {\n\t\tlistOptions.Namespace = targetNamespace\n\t}\n\tif len(selector.LabelSelectors) > 0 || len(selector.ExpressionSelectors) > 0 {\n\t\tmetav1Ls := &metav1.LabelSelector{\n\t\t\tMatchLabels: selector.LabelSelectors,\n\t\t\tMatchExpressions: selector.ExpressionSelectors,\n\t\t}\n\t\tls, err := metav1.LabelSelectorAsSelector(metav1Ls)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tlistOptions.LabelSelector = ls\n\t}\n\n\tlistFunc := c.List\n\n\tif len(selector.FieldSelectors) > 0 {\n\t\tlistOptions.FieldSelector = fields.SelectorFromSet(selector.FieldSelectors)\n\n\t\t// Since FieldSelectors need to implement index creation, Reader.List is used to get the pod list.\n\t\t// Otherwise, just call Client.List directly, which can be obtained through cache.\n\t\tif r != nil {\n\t\t\tlistFunc = r.List\n\t\t}\n\t}\n\n\tvar podList v1.PodList\n\tif len(selector.Namespaces) > 0 {\n\t\tfor _, namespace := range selector.Namespaces {\n\t\t\tlistOptions.Namespace = namespace\n\n\t\t\tif err := listFunc(ctx, &podList, &listOptions); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tpods = append(pods, podList.Items...)\n\t\t}\n\t} else {\n\t\tif err := listFunc(ctx, &podList, &listOptions); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tpods = append(pods, podList.Items...)\n\t}\n\n\tvar (\n\t\tnodes []v1.Node\n\t\tnodeList v1.NodeList\n\t\tnodeListOptions = client.ListOptions{}\n\t)\n\t// if both setting Nodes and NodeSelectors, the node list will be combined.\n\tif len(selector.Nodes) > 0 || len(selector.NodeSelectors) > 0 {\n\t\tif len(selector.Nodes) > 0 {\n\t\t\tfor _, nodename := range selector.Nodes {\n\t\t\t\tvar node v1.Node\n\t\t\t\tif err := c.Get(ctx, types.NamespacedName{Name: nodename}, &node); err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tnodes = append(nodes, node)\n\t\t\t}\n\t\t}\n\t\tif len(selector.NodeSelectors) > 0 {\n\t\t\tnodeListOptions.LabelSelector = labels.SelectorFromSet(selector.NodeSelectors)\n\t\t\tif err := c.List(ctx, &nodeList, &nodeListOptions); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tnodes = append(nodes, nodeList.Items...)\n\t\t}\n\t\tpods = filterPodByNode(pods, nodes)\n\t}\n\tif enableFilterNamespace {\n\t\tpods = filterByNamespaces(ctx, c, pods)\n\t}\n\n\tnamespaceSelector, err := parseSelector(strings.Join(selector.Namespaces, \",\"))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpods, err = filterByNamespaceSelector(pods, namespaceSelector)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tannotationsSelector, err := parseSelector(label.Label(selector.AnnotationSelectors).String())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpods = filterByAnnotations(pods, annotationsSelector)\n\n\tphaseSelector, err := parseSelector(strings.Join(selector.PodPhaseSelectors, \",\"))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpods, err = filterByPhaseSelector(pods, phaseSelector)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn pods, nil\n}", "title": "" }, { "docid": "252e3f63c087c5932cfb0f80b58b36d7", "score": "0.63289595", "text": "func (pw *PodWatcher) List() ([]*v1.Pod, error) {\n\tvar svcs []*v1.Pod\n\tfor _, obj := range pw.store.List() {\n\t\tsvc, ok := obj.(*v1.Pod)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"unexpected object in store: %+v\", obj)\n\t\t}\n\t\tsvcs = append(svcs, svc)\n\t}\n\treturn svcs, nil\n}", "title": "" }, { "docid": "a30feaf03bef97f92f63ba0aed8d2e26", "score": "0.6303023", "text": "func (lw *podLW) List(options kapi.ListOptions) (runtime.Object, error) {\n\treturn listPods(lw.client)\n}", "title": "" }, { "docid": "e93a08a2e617adbfcdce4ed9e4e22782", "score": "0.6284849", "text": "func (k *Kubernetes) ListPods(ns, p string) ([]core.Pod, error) {\n\tif p != \"\" {\n\t\tpod, err := k.Pod(ns, p)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn []core.Pod{*pod}, nil\n\t}\n\n\tps, err := k.Pods(ns)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn ps, nil\n}", "title": "" }, { "docid": "24b492397272af8c094271541ac609b5", "score": "0.6241221", "text": "func (oc *OpenshiftClient) ListPods(projectName string) (*corev1.PodList, error) {\n\tpath := fmt.Sprintf(OpenshiftPathListPods, projectName)\n\tresp, err := oc.GetRequest(path)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error occurred performing oc get request : %w\", err)\n\t}\n\tdefer resp.Body.Close()\n\n\trespBody, err := ioutil.ReadAll(resp.Body)\n\tfoundPods := &corev1.PodList{}\n\tif err = json.Unmarshal(respBody, &foundPods); err != nil {\n\t\treturn nil, fmt.Errorf(\"error occurred while unmarshalling pod list: %w\", err)\n\t}\n\n\treturn foundPods, nil\n}", "title": "" }, { "docid": "e154ab70df3a3437b5ac1f44c0ccd286", "score": "0.61880505", "text": "func podList() *corev1.PodList {\n\treturn &corev1.PodList{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: \"Pod\",\n\t\t\tAPIVersion: \"v1\",\n\t\t},\n\t}\n}", "title": "" }, { "docid": "e154ab70df3a3437b5ac1f44c0ccd286", "score": "0.61880505", "text": "func podList() *corev1.PodList {\n\treturn &corev1.PodList{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: \"Pod\",\n\t\t\tAPIVersion: \"v1\",\n\t\t},\n\t}\n}", "title": "" }, { "docid": "6292dd6bee5485105faa899e5d64c618", "score": "0.6112746", "text": "func listPods(ctx context.Context, c client.Client, nginx *nginxv1alpha1.Nginx) ([]nginxv1alpha1.PodStatus, error) {\n\tpodList := &corev1.PodList{}\n\tlabelSelector := labels.SelectorFromSet(k8s.LabelsForNginx(nginx.Name))\n\tlistOps := &client.ListOptions{Namespace: nginx.Namespace, LabelSelector: labelSelector}\n\terr := c.List(ctx, podList, listOps)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar pods []nginxv1alpha1.PodStatus\n\n\tfor _, p := range podList.Items {\n\t\tif p.Status.PodIP == \"\" {\n\t\t\tp.Status.PodIP = \"<pending>\"\n\t\t}\n\n\t\tif p.Status.HostIP == \"\" {\n\t\t\tp.Status.HostIP = \"<pending>\"\n\t\t}\n\n\t\tpods = append(pods, nginxv1alpha1.PodStatus{\n\t\t\tName: p.Name,\n\t\t\tPodIP: p.Status.PodIP,\n\t\t\tHostIP: p.Status.HostIP,\n\t\t})\n\t}\n\tsort.Slice(pods, func(i, j int) bool {\n\t\treturn pods[i].Name < pods[j].Name\n\t})\n\n\treturn pods, nil\n}", "title": "" }, { "docid": "fd0a8580cc42931e38287ab25a16b632", "score": "0.60921466", "text": "func (s *podWatchLister) List(selector labels.Selector) (ret []*v1alpha1.PodWatch, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.PodWatch))\n\t})\n\treturn ret, err\n}", "title": "" }, { "docid": "7fb3ce276e5099d4eac3c427a9b348ab", "score": "0.60821134", "text": "func (apiClient *APIDirectClient) ListPods(cntxt context.Context, namespace, node string) (*corev1.PodList, error) {\n\tvar (\n\t\tpods *corev1.PodList\n\t\terr error\n\t)\n\n\tpods, err = apiClient.clientset.CoreV1().Pods(namespace).List(cntxt, metav1.ListOptions{\n\t\tFieldSelector: \"spec.nodeName=\" + node,\n\t})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn pods, nil\n}", "title": "" }, { "docid": "e0f7c3b746f018906d458f492887663a", "score": "0.6080561", "text": "func listPods(clientset *kubernetes.Clientset, namespace string) ([]v1.Pod, error) {\n\tpods := []v1.Pod{}\n\toptions := metav1.ListOptions{}\n\tfor ok := true; ok; ok = (options.Continue != \"\") {\n\t\tpodList, listErr := clientset.CoreV1().Pods(namespace).List(options)\n\t\tif listErr != nil {\n\t\t\treturn nil, listErr\n\t\t}\n\t\tpods = append(pods, podList.Items...)\n\t\toptions.Continue = podList.Continue\n\t}\n\treturn pods, nil\n}", "title": "" }, { "docid": "c72ef9d7b46f2b8b75c083372f9836b5", "score": "0.60358584", "text": "func (p *podTemplateListerMock) List(selector labels.Selector) (ret []*apiv1.PodTemplate, err error) {\n\targs := p.Called()\n\treturn args.Get(0).([]*apiv1.PodTemplate), args.Error(1)\n}", "title": "" }, { "docid": "0e56ebbbbb2940997951563baecf8c60", "score": "0.6020436", "text": "func getPods(clientset *kubernetes.Clientset, namespace string, selector string) (*v1.PodList, error) {\n\tpods, err := clientset.CoreV1().Pods(namespace).List(metav1.ListOptions{LabelSelector: selector})\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"Failed to list pods\")\n\t}\n\treturn pods, nil\n}", "title": "" }, { "docid": "bb1a21ee1f8d7884d809e289927ef805", "score": "0.5962461", "text": "func ListPods(c client.Client, humioClusterNamespace string, matchingLabels client.MatchingLabels) ([]corev1.Pod, error) {\n\tvar foundPodList corev1.PodList\n\terr := c.List(context.TODO(), &foundPodList, client.InNamespace(humioClusterNamespace), matchingLabels)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn foundPodList.Items, nil\n}", "title": "" }, { "docid": "e6de0bd0e2050f33a8f80e11c7ee6f5d", "score": "0.59359634", "text": "func SelectPods(ctx context.Context, c client.Client, r client.Reader, selector v1alpha1.PodSelectorSpec, clusterScoped bool, targetNamespace string, enableFilterNamespace bool) ([]v1.Pod, error) {\n\t// pods are specifically specified\n\tif len(selector.Pods) > 0 {\n\t\treturn selectSpecifiedPods(ctx, c, selector, clusterScoped, targetNamespace, enableFilterNamespace)\n\t}\n\n\tselectorRegistry := newSelectorRegistry(ctx, c, selector)\n\tselectorChain, err := registry.Parse(selectorRegistry, selector.GenericSelectorSpec, generic.Option{\n\t\tClusterScoped: clusterScoped,\n\t\tTargetNamespace: targetNamespace,\n\t\tEnableFilterNamespace: enableFilterNamespace,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn listPods(ctx, c, r, selector, selectorChain, enableFilterNamespace)\n}", "title": "" }, { "docid": "7f5c3ae5ef0005f5bd6c68b06a68f35b", "score": "0.5921634", "text": "func (pc *podListCollector) listPods() ([]corev1.Pod, error) {\n\tpc.Info(\"listing Pods on node\")\n\n\tvar podList corev1.PodList\n\tif err := pc.cache.List(pc, &podList); err != nil {\n\t\treturn nil, err\n\t}\n\n\tpodsOnNode := util.RetrievePodsOnNode(podList.Items, pc.nodeName)\n\n\treturn podsOnNode, nil\n}", "title": "" }, { "docid": "170f6e7cb7a3cc38e8baa2e9f461bd6a", "score": "0.5920242", "text": "func listCheckerPods(client *kubernetes.Clientset, namespace string) (map[string]v1.Pod, error) {\n\tlog.Infoln(\"Listing checker pods\")\n\n\tReapCheckerPods = make(map[string]v1.Pod)\n\n\tpods, err := client.CoreV1().Pods(namespace).List(metav1.ListOptions{LabelSelector: \"kuberhealthy-check-name\"})\n\tif err != nil {\n\t\tlog.Errorln(\"Failed to list checker pods\")\n\t\treturn ReapCheckerPods, err\n\t}\n\n\tlog.Infoln(\"Found:\", len(pods.Items), \"checker pods\")\n\n\tfor _, p := range pods.Items {\n\t\tif p.Status.Phase == v1.PodSucceeded || p.Status.Phase == v1.PodFailed {\n\t\t\t//log.Infoln(\"Checker pod: \", p.Name, \"found in namespace: \", p.Namespace)\n\t\t\tReapCheckerPods[p.Name] = p\n\t\t}\n\t}\n\n\treturn ReapCheckerPods, err\n}", "title": "" }, { "docid": "5d3908b5a4d5ecbbd607d9a1125effa9", "score": "0.59159505", "text": "func ListPods(deployment *appsv1.Deployment, rsList []*appsv1.ReplicaSet, getPodList PodListFunc) (*corev1.PodList, error) {\n\tnamespace := deployment.Namespace\n\tselector, err := metav1.LabelSelectorAsSelector(deployment.Spec.Selector)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\toptions := metav1.ListOptions{LabelSelector: selector.String()}\n\tall, err := getPodList(namespace, options)\n\tif err != nil {\n\t\treturn all, err\n\t}\n\t// Only include those whose ControllerRef points to a ReplicaSet that is in\n\t// turn owned by this Deployment.\n\trsMap := make(map[types.UID]bool, len(rsList))\n\tfor _, rs := range rsList {\n\t\trsMap[rs.UID] = true\n\t}\n\towned := &corev1.PodList{Items: make([]corev1.Pod, 0, len(all.Items))}\n\tfor i := range all.Items {\n\t\tpod := &all.Items[i]\n\t\tcontrollerRef := metav1.GetControllerOf(pod)\n\t\tif controllerRef != nil && rsMap[controllerRef.UID] {\n\t\t\towned.Items = append(owned.Items, *pod)\n\t\t}\n\t}\n\treturn owned, nil\n}", "title": "" }, { "docid": "a57d501d4ec3bb899a58707bd2e1d6bb", "score": "0.5886447", "text": "func (c *K8sClient) ListPods(namespace string) (*v1.PodList, error) {\n\tpods, err := c.clientSet.Core().Pods(namespace).List(v1.ListOptions{})\n\tif err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\n\treturn pods, nil\n}", "title": "" }, { "docid": "71078a9f662615bb874bbcb3812b9179", "score": "0.58230877", "text": "func ListPodsPerPolicy(np *networking.NetworkPolicy, allPods *api.PodList) (*api.PodList, error) {\n\n\tselector, err := metav1.LabelSelectorAsSelector(&np.Spec.PodSelector)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmatchedPods := api.PodList{\n\t\tItems: []api.Pod{},\n\t}\n\n\t// Match pods based on the Label Selector that came with the policy\n\tfor _, pod := range allPods.Items {\n\t\tif selector.Matches(labels.Set(pod.GetLabels())) {\n\t\t\tmatchedPods.Items = append(matchedPods.Items, pod)\n\t\t}\n\t}\n\n\treturn &matchedPods, nil\n}", "title": "" }, { "docid": "fa58896a39eb025093db1202dcb3d909", "score": "0.5815184", "text": "func CommandDeploymentListBySelector(namespace string, selector []string) *KubeCall {\n\tselectorList := strings.Join(selector, \",\")\n\tp := newParser()\n\tc := newCommand([]string{\n\t\tfmt.Sprintf(\"--namespace=%s\", formatNamespace(namespace)),\n\t\t\"get\",\n\t\t\"deployment\",\n\t\tfmt.Sprintf(\"--selector=%s\", selectorList),\n\t\t\"-o\",\n\t\t\"yaml\",\n\t})\n\n\treturn &KubeCall{\n\t\tCmd: c,\n\t\tParser: p,\n\t}\n}", "title": "" }, { "docid": "394287c08ca38eac4c23e5ef0197cff6", "score": "0.5808108", "text": "func (c *FakePodCounters) List(opts v1.ListOptions) (result *podcounter_v1.PodCounterList, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewListAction(podcountersResource, podcountersKind, c.ns, opts), &podcounter_v1.PodCounterList{})\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 := &podcounter_v1.PodCounterList{ListMeta: obj.(*podcounter_v1.PodCounterList).ListMeta}\n\tfor _, item := range obj.(*podcounter_v1.PodCounterList).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": "b7a9cbcbf370e18be042fc3b226641af", "score": "0.5797543", "text": "func List() ([]*Podcast, error) {\n\tpods, err := readPods()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tres := make([]*Podcast, 0, len(pods))\n\tfor _, p := range pods {\n\t\tres = append(res, p)\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "04d175157bc5c19aa35cbcb7a2ee6581", "score": "0.5792507", "text": "func List(ctx context.Context, namespace, labels string, c kubernetes.Interface) ([]apiv1.Service, error) {\n\tsvcList, err := c.CoreV1().Services(namespace).List(\n\t\tctx,\n\t\tmetav1.ListOptions{\n\t\t\tLabelSelector: labels,\n\t\t},\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn svcList.Items, nil\n}", "title": "" }, { "docid": "a608e821be04f42dd308b215f2788b8c", "score": "0.5732292", "text": "func WaitForPodsWithSelector(k8s kubernetes.Interface, namespace, selector string, retryInterval, timeout time.Duration) ([]corev1.Pod, error) {\n\tvar pods []corev1.Pod\n\n\terr := wait.Poll(retryInterval, timeout, func() (done bool, err error) {\n\t\tpods, err = ListPodsWithLabelSelector(k8s, namespace, selector)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\t\treturn len(pods) > 0, nil\n\t})\n\treturn pods, err\n}", "title": "" }, { "docid": "a608e821be04f42dd308b215f2788b8c", "score": "0.5732292", "text": "func WaitForPodsWithSelector(k8s kubernetes.Interface, namespace, selector string, retryInterval, timeout time.Duration) ([]corev1.Pod, error) {\n\tvar pods []corev1.Pod\n\n\terr := wait.Poll(retryInterval, timeout, func() (done bool, err error) {\n\t\tpods, err = ListPodsWithLabelSelector(k8s, namespace, selector)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\t\treturn len(pods) > 0, nil\n\t})\n\treturn pods, err\n}", "title": "" }, { "docid": "5b07f739bb03a0e4e291e6afddeacf3f", "score": "0.57300794", "text": "func (k k8sApi) getPods(listOptions metav1.ListOptions) ([]v1.Pod, error) {\n\tpodList, err := k.Client.CoreV1().Pods(\"\").List(context.TODO(), listOptions)\n\treturn podList.Items, err\n}", "title": "" }, { "docid": "343253538f00b132f05cb49c13874343", "score": "0.5700725", "text": "func (c *Client) ListPods(namespace string) (*v1.PodList, error) {\n\tpods, err := c.clientset.Core().Pods(namespace).List(v1.ListOptions{})\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to retrieve Pods\")\n\t}\n\n\treturn pods, nil\n}", "title": "" }, { "docid": "6a4fe1dc226fadfee66fa8d0d6870a59", "score": "0.56692463", "text": "func WithPodSelector(opts metav1.ListOptions) Option {\n\treturn func(hac *haController) {\n\t\thac.podListOpts = opts\n\t}\n}", "title": "" }, { "docid": "38db53648262055d218f1dbc0b2a3ae8", "score": "0.56544507", "text": "func (c *FakePruneServices) List(opts v1.ListOptions) (result *v1alpha1.PruneServiceList, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewListAction(pruneservicesResource, pruneservicesKind, c.ns, opts), &v1alpha1.PruneServiceList{})\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.PruneServiceList{ListMeta: obj.(*v1alpha1.PruneServiceList).ListMeta}\n\tfor _, item := range obj.(*v1alpha1.PruneServiceList).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": "f6adac8e9806bb63429d501e21b801e5", "score": "0.56284165", "text": "func Getpods(c *gin.Context) {\n\t// kubeconfig에서 현재 콘텍스트를 사용한다\n\t// path-to-kubeconfig -- 예를 들어, /root/.kube/config\n\tconfig, _ := clientcmd.BuildConfigFromFlags(\"\", \"/root/.kube/config\")\n\t// clientset을 생성한다\n\tclientset, _ := kubernetes.NewForConfig(config)\n\t//test, err := \"\"\n\n\tpods, err := clientset.CoreV1().Pods(\"\").List(context.TODO(), metav1.ListOptions{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\n\t// fmt.Printf(\"There are %d pods in the cluster\\n\", len(pods.Items))\n\tfmt.Printf(\"There are %d pods in the cluster\\n\", len(pods.Items))\n\tpodnames := []string{} //sliece\n\tfor i := 0; i < len(pods.Items); i++ {\n\t\tfmt.Printf(\"Found pod %s \\n\", pods.Items[i].GetObjectMeta().GetName())\n\t\tpodnames = append(podnames, pods.Items[i].GetObjectMeta().GetName())\n\t}\n\t// Examples for error handling:\n\t// - Use helper functions like e.g. errors.IsNotFound()\n\t// - And/or cast to StatusError and use its properties like e.g. ErrStatus.Message\n\t// namespace := \"\"\n\t// pod := \"kuard\"\n\t// _, err = clientset.CoreV1().Pods(namespace).Get(context.TODO(), pod, metav1.GetOptions{})\n\t// if errors.IsNotFound(err) {\n\t// \tfmt.Printf(\"Pod %s in namespace %s not found\\n\", pod, namespace)\n\t// } else if statusError, isStatus := err.(*errors.StatusError); isStatus {\n\t// \tfmt.Printf(\"Error getting pod %s in namespace %s: %v\\n\",\n\t// \t\tpod, namespace, statusError.ErrStatus.Message)\n\t// } else if err != nil {\n\t// \tpanic(err.Error())\n\t// } else {\n\t// \tfmt.Printf(\"Found pod %s in namespace %s\\n\", pod, namespace)\n\t// }\n\t//time.Sleep(10 * time.Second)\n\n\tc.JSON(200, podnames)\n}", "title": "" }, { "docid": "f9798813355a8e7225ad812bf7625d70", "score": "0.5616945", "text": "func (s *RedisKVStore) List(selector string, options *ListOptions) (map[string]string, error) {\n\tif selector == \"\" {\n\t\tselector = \"*\"\n\t}\n\tif !strings.HasPrefix(selector, s.prefix) {\n\t\tselector = s.prefix + selector\n\t}\n\tvar allKeys []string\n\tvar cursor uint64\n\tfor {\n\t\tkeys, next, err := s.client.Scan(cursor, selector, 0).Result()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tallKeys = append(allKeys, keys...)\n\t\tcursor = next\n\t\tif cursor == 0 {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn s.GetAll(allKeys, options)\n}", "title": "" }, { "docid": "66a695f129bd0685c7ccd62c7cabd38c", "score": "0.56104547", "text": "func (s podWatchNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.PodWatch, err error) {\n\terr = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.PodWatch))\n\t})\n\treturn ret, err\n}", "title": "" }, { "docid": "2596cc933b771fd3223fa2c614801dd6", "score": "0.5574796", "text": "func (this *VMTPodGetter) GetPods(namespace string, label labels.Selector, field fields.Selector) ([]*api.Pod, error) {\n\tpodList, err := this.kubeClient.Pods(namespace).List(label, field)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error getting all the desired pods from Kubernetes cluster: %s\", err)\n\t}\n\tvar podItems []*api.Pod\n\tfor _, pod := range podList.Items {\n\t\tp := pod\n\t\thostIP := p.Status.PodIP\n\t\tpodIP2PodMap[hostIP] = &p\n\t\tpodItems = append(podItems, &p)\n\t}\n\tglog.V(3).Infof(\"Discovering Pods, now the cluster has \" + strconv.Itoa(len(podItems)) + \" pods\")\n\n\treturn podItems, nil\n}", "title": "" }, { "docid": "8af9e26c17493e41e63b8913fbd8b9f2", "score": "0.5565609", "text": "func (s *RedisMapStore) List(selector string, options *ListOptions) ([]interface{}, error) {\n\tif selector == \"\" {\n\t\tselector = \"*\"\n\t}\n\tif !strings.HasPrefix(selector, s.prefix) {\n\t\tselector = s.prefix + selector\n\t}\n\tvar allKeys []string\n\tvar cursor uint64\n\tfor {\n\t\tkeys, next, err := s.client.Scan(cursor, selector, 0).Result()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tallKeys = append(allKeys, keys...)\n\t\tcursor = next\n\t\tif cursor == 0 {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn s.GetAll(allKeys, options)\n}", "title": "" }, { "docid": "75559f14561562b898dc68d58e0a547d", "score": "0.55270547", "text": "func GetPodList(targetPods string, podAffPerc int, clients clients.ClientSets, chaosDetails *types.ChaosDetails) (core_v1.PodList, error) {\n\tfinalPods := core_v1.PodList{}\n\tisPodsAvailable, err := VerifyExistanceOfPods(chaosDetails.AppDetail.Namespace, targetPods, clients)\n\tif err != nil {\n\t\treturn core_v1.PodList{}, err\n\t}\n\n\t// getting the pod, if the target pods is defined\n\t// else select a random target pod from the specified labels\n\tswitch isPodsAvailable {\n\tcase true:\n\t\tpodList, err := GetTargetPodsWhenTargetPodsENVSet(targetPods, clients, chaosDetails)\n\t\tif err != nil {\n\t\t\treturn core_v1.PodList{}, err\n\t\t}\n\t\tfinalPods.Items = append(finalPods.Items, podList.Items...)\n\tdefault:\n\t\tnonChaosPods, err := FilterNonChaosPods(clients, chaosDetails)\n\t\tif err != nil {\n\t\t\treturn core_v1.PodList{}, err\n\t\t}\n\t\tpodList, err := GetTargetPodsWhenTargetPodsENVNotSet(podAffPerc, clients, nonChaosPods, chaosDetails)\n\t\tif err != nil {\n\t\t\treturn core_v1.PodList{}, err\n\t\t}\n\t\tfinalPods.Items = append(finalPods.Items, podList.Items...)\n\t}\n\tlog.Infof(\"[Chaos]:Number of pods targeted: %v\", len(finalPods.Items))\n\treturn finalPods, nil\n}", "title": "" }, { "docid": "965c0e6a4db3ea417ab5c4255a95ba54", "score": "0.550183", "text": "func List(client *golangsdk.ServiceClient, opts ListOptsBuilder, ns string) pagination.Pager {\n\turl := rootURL(client, ns)\n\tif opts != nil {\n\t\tquery, err := opts.ToPVCListQuery()\n\t\tif err != nil {\n\t\t\treturn pagination.Pager{Err: err}\n\t\t}\n\t\turl += query\n\t}\n\n\treturn pagination.NewPager(client, url, func(r pagination.PageResult) pagination.Page {\n\t\treturn PersistentVolumeClaimPage{pagination.SinglePageBase(r)}\n\t})\n}", "title": "" }, { "docid": "11ed9011c2a6ffc096a0adda8c218472", "score": "0.5500612", "text": "func ListPodsWithOptions(c clientset.Interface, namespace string, listOpts metav1.ListOptions) ([]apiv1.Pod, error) {\n\tvar pods []apiv1.Pod\n\tlistFunc := func() error {\n\t\tctx, cancel := context.WithTimeout(context.Background(), time.Minute)\n\t\tpodsList, err := c.CoreV1().Pods(namespace).List(ctx, listOpts)\n\t\tcancel()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpods = podsList.Items\n\t\treturn nil\n\t}\n\tif err := RetryWithExponentialBackOff(RetryFunction(listFunc)); err != nil {\n\t\treturn pods, err\n\t}\n\treturn pods, nil\n}", "title": "" }, { "docid": "cb1d9a4723ee0ef7fbb7b4b87ea31216", "score": "0.5483714", "text": "func listPods(client cri.RuntimeServiceClient) ([]*cri.PodSandbox, error) {\n\trequest := &cri.ListPodSandboxRequest{}\n\tr, err := client.ListPodSandbox(context.Background(), request)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn r.Items, nil\n}", "title": "" }, { "docid": "530cad903fc630e5e231f79a13b34c17", "score": "0.54803866", "text": "func (c *KubeClient) List(l model.ListInterface) ([]*model.KVPair, error) {\n\tlog.Debugf(\"Performing 'List' for %+v\", l)\n\tswitch l.(type) {\n\tcase model.ProfileListOptions:\n\t\treturn c.listProfiles(l.(model.ProfileListOptions))\n\tcase model.WorkloadEndpointListOptions:\n\t\treturn c.listWorkloadEndpoints(l.(model.WorkloadEndpointListOptions))\n\tcase model.PolicyListOptions:\n\t\treturn c.listPolicies(l.(model.PolicyListOptions))\n\tcase model.HostConfigListOptions:\n\t\treturn c.listHostConfig(l.(model.HostConfigListOptions))\n\tcase model.IPPoolListOptions:\n\t\tk, _, err := c.ipPoolClient.List(l)\n\t\treturn k, err\n\tcase model.NodeListOptions:\n\t\tk, _, err := c.nodeClient.List(l)\n\t\treturn k, err\n\tcase model.GlobalBGPPeerListOptions:\n\t\tk, _, err := c.globalBgpPeerClient.List(l)\n\t\treturn k, err\n\tcase model.NodeBGPPeerListOptions:\n\t\tk, _, err := c.nodeBgpPeerClient.List(l)\n\t\treturn k, err\n\tcase model.GlobalConfigListOptions:\n\t\tk, _, err := c.globalFelixConfigClient.List(l)\n\t\treturn k, err\n\tcase model.GlobalBGPConfigListOptions:\n\t\tk, _, err := c.globalBgpConfigClient.List(l)\n\t\treturn k, err\n\tcase model.NodeBGPConfigListOptions:\n\t\tk, _, err := c.nodeBgpConfigClient.List(l)\n\t\treturn k, err\n\tdefault:\n\t\treturn []*model.KVPair{}, nil\n\t}\n}", "title": "" }, { "docid": "37ae0589dbc79ea3b39e841e56c6b797", "score": "0.5448273", "text": "func getPods() *apiv1.PodList {\n\treturn &apiv1.PodList{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: \"Pod\",\n\t\t\tAPIVersion: \"v1\",\n\t\t},\n\t}\n}", "title": "" }, { "docid": "abbe90aabb99bc45c1b3191050198a94", "score": "0.5427448", "text": "func (m *MetricsHandler) Pods(label string) ([]PodMetrics, error) {\n\t//podMetricsList, err := m.clientset.MetricsV1beta1.PodMetricses(m.namespace).List()\n\tpodMetricsList, err := m.clientset.MetricsV1beta1().PodMetricses(m.namespace).List(m.ctx, metav1.ListOptions{LabelSelector: label})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpms := []PodMetrics{}\n\tfor _, podMetrics := range podMetricsList.Items {\n\t\tpm := convertPodMetrics(&podMetrics)\n\t\tpms = append(pms, *pm)\n\t}\n\treturn pms, nil\n}", "title": "" }, { "docid": "cffae5d494c17b8157df89336cebd675", "score": "0.54033107", "text": "func (p *Processor) getSelectedPods(ctx context.Context, namespaces []string, selector labels.Selector) (relatedPods []*corev1.Pod, err error) {\n\t// DisableDeepCopy:true, indicates must be deep copy before update pod objection\n\tlistOpts := &client.ListOptions{LabelSelector: selector}\n\tfor _, ns := range namespaces {\n\t\tallPods := &corev1.PodList{}\n\t\tlistOpts.Namespace = ns\n\t\tif listErr := p.Client.List(ctx, allPods, listOpts); listErr != nil {\n\t\t\terr = fmt.Errorf(\"ProbeAssistant list pods by ns error, ns[%s], err:%v\", ns, listErr)\n\t\t\treturn\n\t\t}\n\t\tfor i := range allPods.Items {\n\t\t\trelatedPods = append(relatedPods, &allPods.Items[i])\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "d87c51ae6966f20c3013f6cd80497c50", "score": "0.5397973", "text": "func ListOperatorPods(client kubernetes.Interface, namespace string) ([]corev1.Pod, error) {\n\treturn ListPodsWithLabelSelector(client, namespace, operatorPodSelector)\n}", "title": "" }, { "docid": "d87c51ae6966f20c3013f6cd80497c50", "score": "0.5397973", "text": "func ListOperatorPods(client kubernetes.Interface, namespace string) ([]corev1.Pod, error) {\n\treturn ListPodsWithLabelSelector(client, namespace, operatorPodSelector)\n}", "title": "" }, { "docid": "fdbbd3f96b354ba58588af0f119114bc", "score": "0.5369161", "text": "func (p servicePlugin) List(gvk schema.GroupVersionKind, namespace string, client plugin.KubernetesConnector) ([]helm.KubernetesResource, error) {\n\tif namespace == \"\" {\n\t\tnamespace = \"default\"\n\t}\n\n\topts := metaV1.ListOptions{\n\t\tLimit: utils.ResourcesListLimit,\n\t}\n\n\tlist, err := client.GetStandardClient().CoreV1().Services(namespace).List(context.TODO(), opts)\n\tif err != nil {\n\t\treturn nil, pkgerrors.Wrap(err, \"Get Service list error\")\n\t}\n\n\tresult := make([]helm.KubernetesResource, 0, utils.ResourcesListLimit)\n\tif list != nil {\n\t\tfor _, service := range list.Items {\n\t\t\tlog.Printf(\"%v\", service.Name)\n\t\t\tresult = append(result,\n\t\t\t\thelm.KubernetesResource{\n\t\t\t\t\tGVK: schema.GroupVersionKind{\n\t\t\t\t\t\tGroup: \"\",\n\t\t\t\t\t\tVersion: \"v1\",\n\t\t\t\t\t\tKind: \"Service\",\n\t\t\t\t\t},\n\t\t\t\t\tName: service.GetName(),\n\t\t\t\t})\n\t\t}\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "43cbc541383a27ac4af0a7a9a3cd0e80", "score": "0.53502357", "text": "func CmdList(c *cli.Context) {\n\tvar fqdns []string\n\tup := 0\n\tkubernetes, err := webservice.NewKubeClient()\n\tutils.CheckError(err)\n\t// Get all services to extract their kubeware labels\n\tlog.Debug(\"Get all services to extract their kubeware labels ...\")\n\tserviceList, err := kubernetes.GetServices()\n\tutils.CheckError(err)\n\t// Get all controllers to extract their kubeware labels\n\tlog.Debug(\"Get all controllers to extract their kubeware labels ...\")\n\tcontrollersList, err := kubernetes.GetControllers()\n\tutils.CheckError(err)\n\t// build the list to be printed\n\tkubeList := models.BuildKubeList(serviceList, controllersList)\n\n\tif len(kubeList) > 0 {\n\t\tw := tabwriter.NewWriter(os.Stdout, 10, 1, 5, ' ', 0)\n\n\t\tif c.Bool(\"all\") || (!c.Bool(\"services\") && !c.Bool(\"controllers\")) {\n\t\t\tfmt.Fprintln(w, \"KUBEWARE\\tNAMESPACE\\tVERSION\\tSVC\\tRC\\tUP\\tFQDN\\r\")\n\t\t\tfor _, kubeware := range kubeList {\n\t\t\t\tfor _, service := range kubeware.Services {\n\t\t\t\t\tif service.GetFQDN() != \"\" {\n\t\t\t\t\t\tfqdns = append(fqdns, service.GetFQDN())\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor _, controller := range kubeware.ReplicaControllers {\n\t\t\t\t\tup = up + controller.GetUpStats()\n\t\t\t\t}\n\t\t\t\tif len(kubeware.Services) > 0 {\n\t\t\t\t\tup = up / len(kubeware.Services)\n\t\t\t\t}\n\n\t\t\t\tif len(fqdns) > 0 {\n\t\t\t\t\tfmt.Fprintf(w, \"%s\\t%s\\t%s\\t%d\\t%d\\t%d%%\\t%s\\n\", kubeware.GetKube(), kubeware.GetNamespace(), kubeware.GetVersion(), len(kubeware.Services), len(kubeware.ReplicaControllers), up, strings.Join(fqdns, \",\"))\n\t\t\t\t} else {\n\t\t\t\t\tfmt.Fprintf(w, \"%s\\t%s\\t%s\\t%d\\t%d%%\\t%d\\n\", kubeware.GetKube(), kubeware.GetNamespace(), kubeware.GetVersion(), len(kubeware.Services), up, len(kubeware.ReplicaControllers))\n\t\t\t\t}\n\t\t\t\tup = 0\n\t\t\t\tfqdns = []string{}\n\t\t\t}\n\t\t}\n\t\tif c.Bool(\"all\") {\n\t\t\tfmt.Fprintf(w, \"\\n\")\n\t\t}\n\t\tif c.Bool(\"all\") || c.Bool(\"services\") {\n\t\t\tfmt.Fprintln(w, \"KUBEWARE\\tNAMESPACE\\tSVC\\tINTERNAL IP\\tFQDN\\r\")\n\t\t\tfor _, kubeware := range kubeList {\n\t\t\t\tfor _, service := range kubeware.Services {\n\t\t\t\t\tif service.GetFQDN() != \"\" {\n\t\t\t\t\t\tfmt.Fprintf(w, \"%s\\t%s\\t%s\\t%s\\t%s\\n\", kubeware.GetKube(), service.GetNamespace(), service.GetName(), service.GetInternalIp(), service.GetFQDN())\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfmt.Fprintf(w, \"%s\\t%s\\t%s\\t%s\\n\", kubeware.GetKube(), service.GetNamespace(), service.GetName(), service.GetInternalIp())\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif c.Bool(\"all\") {\n\t\t\tfmt.Fprintf(w, \"\\n\")\n\t\t}\n\t\tif c.Bool(\"all\") || c.Bool(\"controllers\") {\n\t\t\tfmt.Fprintln(w, \"KUBEWARE\\tNAMESPACE\\tRC\\tREPLICAS\\tUP\\r\")\n\t\t\tfor _, kubeware := range kubeList {\n\t\t\t\tfor _, replicaController := range kubeware.ReplicaControllers {\n\t\t\t\t\tfmt.Fprintf(w, \"%s\\t%s\\t%s\\t%d\\t%d%%\\n\", kubeware.GetKube(), kubeware.GetNamespace(), replicaController.GetName(), replicaController.GetReplicas(), replicaController.GetUpStats())\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tw.Flush()\n\t} else {\n\t\tlog.Infof(\"No Kubeware deployed\")\n\t}\n}", "title": "" }, { "docid": "74a8ed7d34c8d4d5df9185c891743a04", "score": "0.53418523", "text": "func (k TestKubernetes) GetPods(clusterName, namespace string) []v1.Pod {\n\t// TODO getting list of infinispan resources is also done in controller (refactor)\n\tlabelSelector := labels.SelectorFromSet(ispnctrl.PodLabels(clusterName))\n\tlistOps := &client.ListOptions{Namespace: namespace, LabelSelector: labelSelector}\n\tpods := &v1.PodList{}\n\terr := k.Kubernetes.Client.List(context.TODO(), pods, listOps)\n\tutils.ExpectNoError(err)\n\n\treturn pods.Items\n}", "title": "" }, { "docid": "e2d38a9b1f30a90dd037662ae744527a", "score": "0.5321419", "text": "func GetPods(apiserver, label string) (v1.PodList, error) {\n\tvar pods v1.PodList\n\tvar resp *http.Response\n\tvar err error\n\n\tif len(label) > 0 {\n\t\tresp, err = SendHTTPRequest(http.MethodGet, apiserver+podLabelSelector+label)\n\t} else {\n\t\tresp, err = SendHTTPRequest(http.MethodGet, apiserver)\n\t}\n\tif err != nil {\n\t\tFatalf(\"Frame HTTP request failed: %v\", err)\n\t\treturn pods, nil\n\t}\n\tdefer resp.Body.Close()\n\tcontents, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tFatalf(\"HTTP Response reading has failed: %v\", err)\n\t\treturn pods, nil\n\t}\n\terr = json.Unmarshal(contents, &pods)\n\tif err != nil {\n\t\tFatalf(\"Unmarshal HTTP Response has failed: %v\", err)\n\t\treturn pods, nil\n\t}\n\treturn pods, nil\n}", "title": "" }, { "docid": "696cef524f6bcb49d9429a56c8dd923a", "score": "0.5312794", "text": "func List(ctx context.Context, kubeClient *kubernetes.Cluster, org string) (interfaces.ServiceList, error) {\n\n\tcustomServices, err := CustomServiceList(ctx, kubeClient, org)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcatalogServices, err := CatalogServiceList(ctx, kubeClient, org)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn append(customServices, catalogServices...), nil\n}", "title": "" }, { "docid": "76815015a65a0956c48cc25e6227e07f", "score": "0.5294912", "text": "func (s *serviceLister) List(selector labels.Selector) (ret []*v1.Service, err error) {\r\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\r\n\t\tret = append(ret, m.(*v1.Service))\r\n\t})\r\n\treturn ret, err\r\n}", "title": "" }, { "docid": "78d91763306d687241b915d0d58415d1", "score": "0.52895355", "text": "func CommandReplicaSetListBySelector(namespace string, selector []string) *KubeCall {\n\tselectorList := strings.Join(selector, \",\")\n\tp := newParser()\n\tc := newCommand([]string{\n\t\tfmt.Sprintf(\"--namespace=%s\", formatNamespace(namespace)),\n\t\t\"get\",\n\t\t\"replicasets\",\n\t\tfmt.Sprintf(\"--selector=%s\", selectorList),\n\t\t\"-o\",\n\t\t\"yaml\",\n\t})\n\n\treturn &KubeCall{\n\t\tCmd: c,\n\t\tParser: p,\n\t}\n}", "title": "" }, { "docid": "fa48ad6e778fb32b06fe6af79a3f177a", "score": "0.52748466", "text": "func (h *PulseHealth) List(ctx context.Context, ns string) ([]runtime.Object, error) {\n\tgvrs := []string{\n\t\t\"v1/pods\",\n\t\t\"v1/events\",\n\t\t\"apps/v1/replicasets\",\n\t\t\"apps/v1/deployments\",\n\t\t\"apps/v1/statefulsets\",\n\t\t\"apps/v1/daemonsets\",\n\t\t\"batch/v1/jobs\",\n\t\t\"v1/persistentvolumes\",\n\t}\n\n\thh := make([]runtime.Object, 0, 10)\n\tfor _, gvr := range gvrs {\n\t\tc, err := h.check(ctx, ns, gvr)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\thh = append(hh, c)\n\t}\n\n\tmm, err := h.checkMetrics(ctx)\n\tif err != nil {\n\t\treturn hh, err\n\t}\n\tfor _, m := range mm {\n\t\thh = append(hh, m)\n\t}\n\n\treturn hh, nil\n}", "title": "" }, { "docid": "efd13514a9568145b124dd7c58770392", "score": "0.52538246", "text": "func (env *Env) pods(c echo.Context) error {\n\tvar flavorID int\n\tvar sizeID int\n\tvar err error\n\tvar pods []models.Pod\n\n\tq := c.QueryParams()\n\tif q[\"flavor_id\"] != nil {\n\t\tflavorID, err = strconv.Atoi(q[\"flavor_id\"][0])\n\t\tif err != nil {\n\t\t\tinvalidIDErr := fmt.Errorf(\"(%s) flavor_id is in an invalid format please provide an integer :description -> (%+v)\", q[\"flavor_id\"], err)\n\t\t\tlog.Printf(\"Error: %v\", invalidIDErr)\n\t\t\treturn handleErr(c, http.StatusBadRequest, invalidIDErr)\n\t\t}\n\t}\n\tif q[\"size_id\"] != nil {\n\t\tsizeID, err = strconv.Atoi(q[\"size_id\"][0])\n\t\tif err != nil {\n\t\t\tinvalidIDErr := fmt.Errorf(\"(%s) size_id is in an invalid format please provide an integer :description -> (%+v)\", q[\"size_id\"], err)\n\t\t\tlog.Printf(\"Error: %v\", invalidIDErr)\n\t\t\treturn handleErr(c, http.StatusBadRequest, invalidIDErr)\n\t\t}\n\t}\n\tpods, err = env.DS.Pods(flavorID, sizeID)\n\tif err != nil {\n\t\tdbErr := fmt.Errorf(\"Unable to fetch Pods for flavor_id (%d) , size_id (%d) description-> (%+v)\", flavorID, sizeID, err)\n\t\tlog.Printf(\"Error %v\", dbErr)\n\t\treturn handleErr(c, http.StatusInternalServerError, dbErr)\n\t}\n\n\tdata, err := json.Marshal(pods)\n\tif err != nil {\n\t\tif err != nil {\n\t\t\tparseError := fmt.Errorf(\"Error marshaling Pods description -> (%+v)\", err)\n\t\t\tlog.Printf(\"Error %v\", parseError)\n\t\t\treturn handleErr(c, http.StatusInternalServerError, parseError)\n\t\t}\n\t}\n\treturn c.JSON(http.StatusOK, string(data))\n}", "title": "" }, { "docid": "247d0c6fdf7fadd137e5e6e63da1510e", "score": "0.5249884", "text": "func newPodList(store cache.Store, count int, status v1.PodPhase, labelMap map[string]string, rs *apps.ReplicaSet, name string) *v1.PodList {\n\tpods := []v1.Pod{}\n\tvar trueVar = true\n\tcontrollerReference := metav1.OwnerReference{UID: rs.UID, APIVersion: \"v1beta1\", Kind: \"ReplicaSet\", Name: rs.Name, Controller: &trueVar}\n\tfor i := 0; i < count; i++ {\n\t\tpod := newPod(fmt.Sprintf(\"%s%d\", name, i), rs, status, nil, false)\n\t\tpod.ObjectMeta.Labels = labelMap\n\t\tpod.OwnerReferences = []metav1.OwnerReference{controllerReference}\n\t\tif store != nil {\n\t\t\tstore.Add(pod)\n\t\t}\n\t\tpods = append(pods, *pod)\n\t}\n\treturn &v1.PodList{\n\t\tItems: pods,\n\t}\n}", "title": "" }, { "docid": "25e81698abc4b5524a109e6f84e5fdba", "score": "0.524842", "text": "func filterByNamespaceSelector(pods []v1.Pod, namespaces labels.Selector) ([]v1.Pod, error) {\n\t// empty filter returns original list\n\tif namespaces.Empty() {\n\t\treturn pods, nil\n\t}\n\n\t// split requirements into including and excluding groups\n\treqs, _ := namespaces.Requirements()\n\n\tvar (\n\t\treqIncl []labels.Requirement\n\t\treqExcl []labels.Requirement\n\n\t\tfilteredList []v1.Pod\n\t)\n\n\tfor _, req := range reqs {\n\t\tswitch req.Operator() {\n\t\tcase selection.Exists:\n\t\t\treqIncl = append(reqIncl, req)\n\t\tcase selection.DoesNotExist:\n\t\t\treqExcl = append(reqExcl, req)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unsupported operator: %s\", req.Operator())\n\t\t}\n\t}\n\n\tfor _, pod := range pods {\n\t\t// if there aren't any including requirements, we're in by default\n\t\tincluded := len(reqIncl) == 0\n\n\t\t// convert the pod's namespace to an equivalent label selector\n\t\tselector := labels.Set{pod.Namespace: \"\"}\n\n\t\t// include pod if one including requirement matches\n\t\tfor _, req := range reqIncl {\n\t\t\tif req.Matches(selector) {\n\t\t\t\tincluded = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\t// exclude pod if it is filtered out by at least one excluding requirement\n\t\tfor _, req := range reqExcl {\n\t\t\tif !req.Matches(selector) {\n\t\t\t\tincluded = false\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif included {\n\t\t\tfilteredList = append(filteredList, pod)\n\t\t}\n\t}\n\n\treturn filteredList, nil\n}", "title": "" }, { "docid": "285e8a5c3f2b13279e3c551aa7eba817", "score": "0.5245969", "text": "func (c *datakits) List(ctx context.Context, opts metav1.ListOptions) (*DatakitList, error) {\n\tvar timeout time.Duration\n\tif opts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*opts.TimeoutSeconds) * time.Second\n\t}\n\tresult := DatakitList{}\n\terr := c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"datakits\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tDo(ctx).\n\t\tInto(&result)\n\treturn &result, err\n}", "title": "" }, { "docid": "a47538911344128fa46a816e51f2aed2", "score": "0.52440965", "text": "func (k *k8sOrchestrator) getPods(vsm string, volProProfile volProfile.VolumeProvisionerProfile) (*k8sApiV1.PodList, error) {\n\n\tif strings.TrimSpace(vsm) == \"\" {\n\t\treturn nil, fmt.Errorf(\"VSM name is required to get Pods\")\n\t}\n\n\tk8sUtl := k8sOrchUtil(k, volProProfile)\n\n\tkc, supported := k8sUtl.K8sClient()\n\tif !supported {\n\t\treturn nil, fmt.Errorf(\"K8s client not supported by '%s'\", k8sUtl.Name())\n\t}\n\n\t// fetch k8s Pod operations\n\tpOps, err := kc.Pods()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trps, err := k.getReplicaPods(vsm, pOps)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcps, err := k.getControllerPods(vsm, pOps)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Merge the Replica & Controller Pods\n\tfor _, rPod := range rps.Items {\n\t\tcps.Items = append(cps.Items, rPod)\n\t}\n\n\treturn cps, nil\n}", "title": "" }, { "docid": "265f321e1885def2e497747fb6156c45", "score": "0.5240994", "text": "func (f *k8sFixture) AllPodsReady(ctx context.Context, selector string) (bool, string, []string) {\n\tcmd := exec.Command(\"kubectl\", \"get\", \"pods\",\n\t\tnamespaceFlag, \"--selector=\"+selector, \"-o=template\",\n\t\t\"--template\", \"{{range .items}}{{.metadata.name}} {{.status.phase}}{{println}}{{end}}\")\n\tout, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\tf.t.Fatal(errors.Wrap(err, \"get pods\"))\n\t}\n\n\toutStr := string(out)\n\tlines := strings.Split(outStr, \"\\n\")\n\tpodNames := []string{}\n\thasOneRunningPod := false\n\tfor _, line := range lines {\n\t\tline = strings.TrimSpace(line)\n\t\tif line == \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\telements := strings.Split(line, \" \")\n\t\tif len(elements) < 2 {\n\t\t\tf.t.Fatalf(\"Unexpected output of kubect get pods: %s\", outStr)\n\t\t}\n\n\t\tname, phase := elements[0], elements[1]\n\t\tif phase == \"Running\" {\n\t\t\thasOneRunningPod = true\n\t\t} else {\n\t\t\treturn false, outStr, nil\n\t\t}\n\n\t\tpodNames = append(podNames, name)\n\t}\n\treturn hasOneRunningPod, outStr, podNames\n}", "title": "" }, { "docid": "4ffe0e18f38eb22aec521fe3b1016414", "score": "0.5240602", "text": "func (c *ClientGoUtils) ListPodsByDeployment(name string) (*corev1.PodList, error) {\n\tdeployment, err := c.ClientSet.AppsV1().Deployments(c.namespace).Get(c.ctx, name, metav1.GetOptions{})\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"\")\n\t}\n\tset := labels.Set(deployment.Spec.Selector.MatchLabels)\n\tpods, err := c.ClientSet.CoreV1().Pods(c.namespace).List(\n\t\tc.ctx, metav1.ListOptions{LabelSelector: set.AsSelector().String()},\n\t)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"\")\n\t}\n\treturn pods, nil\n}", "title": "" }, { "docid": "6aaf30a6ae11f0067fe15dc3383a238a", "score": "0.5235924", "text": "func (c *appawareHorizontalPodAutoscalers) List(ctx context.Context, opts metav1.ListOptions) (result *v1.AppawareHorizontalPodAutoscalerList, 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 = &v1.AppawareHorizontalPodAutoscalerList{}\n\terr = c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"appawarehorizontalpodautoscalers\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tDo(ctx).\n\t\tInto(result)\n\treturn\n}", "title": "" }, { "docid": "81c85e7e2b59e48788ab06fb3525eb2a", "score": "0.5233462", "text": "func GetPods(ctx context.Context, status v1alpha1.ChaosStatus, selectorSpec v1alpha1.PodSelectorSpec, c client.Client) ([]v1.Pod, []v1.Pod, error) {\n\tpods, err := pod.SelectPods(ctx, c, c, selectorSpec, ctrlconfig.ControllerCfg.ClusterScoped, ctrlconfig.ControllerCfg.TargetNamespace, false)\n\tif err != nil {\n\t\treturn nil, nil, errors.Wrap(err, \"failed to SelectPods\")\n\t}\n\tif len(pods) == 0 {\n\t\treturn nil, nil, nil\n\t}\n\n\tdaemonMap, err := getDaemonMap(ctx, c)\n\tif err != nil {\n\t\treturn nil, nil, errors.Wrap(err, \"get daemon map\")\n\t}\n\n\tvar chaosDaemons []v1.Pod\n\t// get chaos daemon\n\tfor _, chaosPod := range pods {\n\t\tdaemon, exist := daemonMap[chaosPod.Spec.NodeName]\n\t\tif !exist {\n\t\t\treturn nil, nil, errors.Errorf(\"no daemons found for pod %s\", chaosPod.GetName())\n\t\t}\n\t\tchaosDaemons = append(chaosDaemons, daemon)\n\t}\n\n\treturn pods, chaosDaemons, nil\n}", "title": "" }, { "docid": "58b1204e673aace931edf9bb181112fe", "score": "0.52226764", "text": "func (k RunningK8sMockData) Pods() ([]*models.K8sResource, error) {\n\t// TODO: implement\n\treturn []*models.K8sResource{}, nil\n}", "title": "" }, { "docid": "11cf1407e8db16ecae890c20bf41913a", "score": "0.5220196", "text": "func WaitForPodsWithLabel(k8s kubernetes.Interface, namespace, selector string, count int, retryInterval, timeout time.Duration) ([]corev1.Pod, error) {\n\tvar pods []corev1.Pod\n\n\terr := wait.Poll(retryInterval, timeout, func() (done bool, err error) {\n\t\tpods, err = ListPodsWithLabelSelector(k8s, namespace, selector)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"Waiting for at least %d Pods with label selector '%s' - failed due to %s\\n\", count, selector, err.Error())\n\t\t\treturn false, err\n\t\t}\n\t\tfound := len(pods) >= count\n\t\tif !found {\n\t\t\tfmt.Printf(\"Waiting for at least %d Pods with label selector '%s' - found %d\\n\", count, selector, len(pods))\n\t\t}\n\t\treturn found, nil\n\t})\n\n\treturn pods, err\n}", "title": "" }, { "docid": "11cf1407e8db16ecae890c20bf41913a", "score": "0.5220196", "text": "func WaitForPodsWithLabel(k8s kubernetes.Interface, namespace, selector string, count int, retryInterval, timeout time.Duration) ([]corev1.Pod, error) {\n\tvar pods []corev1.Pod\n\n\terr := wait.Poll(retryInterval, timeout, func() (done bool, err error) {\n\t\tpods, err = ListPodsWithLabelSelector(k8s, namespace, selector)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"Waiting for at least %d Pods with label selector '%s' - failed due to %s\\n\", count, selector, err.Error())\n\t\t\treturn false, err\n\t\t}\n\t\tfound := len(pods) >= count\n\t\tif !found {\n\t\t\tfmt.Printf(\"Waiting for at least %d Pods with label selector '%s' - found %d\\n\", count, selector, len(pods))\n\t\t}\n\t\treturn found, nil\n\t})\n\n\treturn pods, err\n}", "title": "" }, { "docid": "b5f633db87b910ebcc70a7c9900c998f", "score": "0.52097803", "text": "func (r *SecretProviderClassPodStatusReconciler) ListOptionsLabelSelector() client.ListOption {\n\treturn client.MatchingLabels(map[string]string{\n\t\tsecretsstorev1.InternalNodeLabel: r.nodeID,\n\t})\n}", "title": "" }, { "docid": "80931a386ec0b3cf53925f1dd32af2e6", "score": "0.5201776", "text": "func (k *Kubernetes) Pods(ns string) ([]core.Pod, error) {\n\tpods, err := k.cli.CoreV1().Pods(ns).List(meta.ListOptions{})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error listing the namespaces: %w\", err)\n\t}\n\n\treturn pods.Items, nil\n}", "title": "" }, { "docid": "6ae0cb48fb0c7e11d3d84c04fbdce889", "score": "0.5198883", "text": "func (c *NonNamespacedCache[T]) List(selector labels.Selector) (ret []T, err error) {\n\treturn c.CacheInterface.List(metav1.NamespaceAll, selector)\n}", "title": "" }, { "docid": "6d916a5d6345b3e63c11c1da1865aec4", "score": "0.5183865", "text": "func pods(kubeClient *client.Client, podName, podNamespace string) {\n\tif podName == \"\" {\n\t\tpodName = \"my-nginx-u7lek\"\n\t}\n\tif podNamespace == \"\" {\n\t\tpodNamespace = \"default\"\n\t}\n\tpodsClient := kubeClient.Pods(podNamespace)\n\tfmt.Printf(\"Kubeclient %+v, pods %+v\", kubeClient, podsClient)\n\tpod, _ := podsClient.Get(podName)\n\tpod.Status.Phase = \"Running\"\n\tpod, _ = podsClient.UpdateStatus(pod)\n\tfmt.Printf(\"\\n\\nPod %+v\\n\\n\", pod)\n}", "title": "" }, { "docid": "fb6b36e327c74f684c5eb10e32288841", "score": "0.5179044", "text": "func (c *cluster) List(ctx context.Context, option ...ListOption) ([]*node.Node, error) {\n\tvar opt ListOption\n\tif len(option) > 0 {\n\t\topt = option[0]\n\t}\n\titems, err := c.clusterState.Scan(ctx, nodeNs)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"scan etcd\")\n\t}\n\n\tvar nodes []*node.Node\n\tfor _, item := range items {\n\t\tn := new(node.Node)\n\t\tif err := item.Unmarshal(n); err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"unmarshal item %s\", item.Key)\n\t\t}\n\t\tif opt.Type != \"\" && n.Type != opt.Type {\n\t\t\tcontinue\n\t\t}\n\t\tif opt.Tag != nil && !n.TagMatches(opt.Tag) {\n\t\t\tcontinue\n\t\t}\n\t\tnodes = append(nodes, n)\n\t}\n\treturn nodes, nil\n}", "title": "" }, { "docid": "bfc365472332c09f53f0fde0c6eea814", "score": "0.5162123", "text": "func (s computeInstanceFromTemplateNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.ComputeInstanceFromTemplate, err error) {\n\terr = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.ComputeInstanceFromTemplate))\n\t})\n\treturn ret, err\n}", "title": "" }, { "docid": "039aa10c2122eccd0e0da906cb087ab6", "score": "0.5157705", "text": "func (d *Deployment) GetPodSelector() []string {\n\tselectorList := make([]string, 0)\n\tfor key, value := range d.Spec.Template.Metadata.Labels {\n\t\tselectorList = append(selectorList, fmt.Sprintf(\"%s=%s\", key, value))\n\t}\n\n\treturn selectorList\n}", "title": "" }, { "docid": "b941201cd1fc2fc86aab09a11d167ffd", "score": "0.51531976", "text": "func (pc *PolicyCache) LookupPodsByLabelSelector(\n\tnamespaceLabelSelector *policymodel.Policy_LabelSelector) (pods []podmodel.ID) {\n\t// An empty namespace selector matches all namespaces.\n\tif len(namespaceLabelSelector.MatchExpression) == 0 && len(namespaceLabelSelector.MatchLabel) == 0 {\n\t\tallPods := pc.configuredPods.ListAll()\n\t\tkubeSystemPods := pc.configuredPods.LookupPodsByNamespace(\"kube-system\")\n\t\tpods := utils.Difference(allPods, kubeSystemPods)\n\n\t\tpc.Log.WithField(\"LookupPodsByNSLabelSelector\", namespaceLabelSelector).\n\t\t\tInfof(\"Empty namespace selector returning pods: %+v\", pods)\n\t\treturn utils.UnstringPodID(pods)\n\t}\n\t// List of match labels and match expressions.\n\tmatchLabels := namespaceLabelSelector.MatchLabel\n\n\tnamespaceSelectorPods := pc.getPodsByLabelSelector(matchLabels)\n\tif len(namespaceSelectorPods) == 0 {\n\t\treturn []podmodel.ID{}\n\t}\n\treturn utils.UnstringPodID(namespaceSelectorPods)\n}", "title": "" }, { "docid": "c6454267e36eeceff25f25678b0aba56", "score": "0.51520455", "text": "func (f *PodLister) Pods(namespace string) corelisters.PodNamespaceLister {\n\treturn f.PodsReactor(namespace)\n}", "title": "" }, { "docid": "54a1962d604c7d35bad69f50da9559af", "score": "0.51372415", "text": "func (m *MockClientInterface) ListPVCs(selector string) ([]v10.PersistentVolumeClaim, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListPVCs\", selector)\n\tret0, _ := ret[0].([]v10.PersistentVolumeClaim)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "3c9cae793434407c7f8726e5efb222af", "score": "0.51360977", "text": "func (c *Client) FindPods(contexts []string, namespace string, names []string, options ListOptions) ([]types.PodDiscovery, error) {\n\tif len(contexts) == 0 {\n\t\tcontexts = c.GetFilteredContexts(options.LabelMatch)\n\t} else {\n\t\tcontexts = c.FilterContexts(contexts, options.LabelMatch)\n\t}\n\t// Creating set of names\n\tpositive := make(map[string]struct{})\n\tfor _, name := range names {\n\t\tpositive[name] = struct{}{}\n\t}\n\n\tall, err := c.ListPodsOverContexts(contexts, namespace, options)\n\n\tvar ret []types.PodDiscovery\n\n\tfor _, p := range all {\n\t\tif _, ok := positive[p.Name]; ok {\n\t\t\tret = append(ret, p)\n\t\t}\n\t}\n\n\treturn ret, err\n}", "title": "" }, { "docid": "cf1a47a072ea55f62806fdc05da06c35", "score": "0.51355314", "text": "func (container *Container) ListPredictedPods(scalerNS, scalerName string, isPredicted bool) ([]*datahub_resource_v1alpha2.Pod, error) {\n\tcontainerRepository := influxdb_repository_cluster_status.NewContainerRepository(&container.InfluxDBConfig)\n\treturn containerRepository.ListPredictedContainers(scalerNS, scalerName, isPredicted)\n}", "title": "" }, { "docid": "e9e53d271b1c824c6f320b873e87cc42", "score": "0.5119641", "text": "func (lw *buildPodDeleteLW) List(options kapi.ListOptions) (runtime.Object, error) {\n\tglog.V(5).Info(\"Checking for deleted build pods\")\n\tbuildList, err := lw.Client.Builds(kapi.NamespaceAll).List(options)\n\tif err != nil {\n\t\tglog.V(4).Infof(\"Failed to find any builds due to error %v\", err)\n\t\treturn nil, err\n\t}\n\tfor _, build := range buildList.Items {\n\t\tglog.V(5).Infof(\"Found build %s/%s\", build.Namespace, build.Name)\n\t\tif buildutil.IsBuildComplete(&build) {\n\t\t\tglog.V(5).Infof(\"Ignoring build %s/%s because it is complete\", build.Namespace, build.Name)\n\t\t\tcontinue\n\t\t}\n\t\tif build.Spec.Strategy.JenkinsPipelineStrategy != nil {\n\t\t\tglog.V(5).Infof(\"Ignoring build %s/%s because it is a pipeline build\", build.Namespace, build.Name)\n\t\t\tcontinue\n\t\t}\n\t\tpod, err := lw.KubeClient.Pods(build.Namespace).Get(buildapi.GetBuildPodName(&build))\n\t\tif err != nil {\n\t\t\tif !kerrors.IsNotFound(err) {\n\t\t\t\tglog.V(4).Infof(\"Error getting pod for build %s/%s: %v\", build.Namespace, build.Name, err)\n\t\t\t\treturn nil, err\n\t\t\t} else {\n\t\t\t\tpod = nil\n\t\t\t}\n\t\t} else {\n\t\t\tif buildName := buildapi.GetBuildName(pod); buildName != build.Name {\n\t\t\t\tpod = nil\n\t\t\t}\n\t\t}\n\t\tif pod == nil {\n\t\t\tdeletedPod := &kapi.Pod{\n\t\t\t\tObjectMeta: kapi.ObjectMeta{\n\t\t\t\t\tName: buildapi.GetBuildPodName(&build),\n\t\t\t\t\tNamespace: build.Namespace,\n\t\t\t\t},\n\t\t\t}\n\t\t\tglog.V(4).Infof(\"No build pod found for build %s/%s, sending delete event for build pod\", build.Namespace, build.Name)\n\t\t\terr := lw.store.Delete(deletedPod)\n\t\t\tif err != nil {\n\t\t\t\tglog.V(4).Infof(\"Error queuing delete event: %v\", err)\n\t\t\t}\n\t\t} else {\n\t\t\tglog.V(5).Infof(\"Found build pod %s/%s for build %s\", pod.Namespace, pod.Name, build.Name)\n\t\t}\n\t}\n\treturn &kapi.PodList{}, nil\n}", "title": "" }, { "docid": "7403d3c0727abc50e9642e5ca10d2e74", "score": "0.5113719", "text": "func (s *computeInstanceFromTemplateLister) List(selector labels.Selector) (ret []*v1alpha1.ComputeInstanceFromTemplate, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.ComputeInstanceFromTemplate))\n\t})\n\treturn ret, err\n}", "title": "" }, { "docid": "9b780fc3d392ee9a5e7f17f29797589a", "score": "0.51086295", "text": "func (c *Cache[T]) List(namespace string, selector labels.Selector) (ret []T, err error) {\n\terr = cache.ListAllByNamespace(c.indexer, namespace, selector, func(m interface{}) {\n\t\tret = append(ret, m.(T))\n\t})\n\n\treturn ret, err\n}", "title": "" }, { "docid": "ee7749cd855f975591bb27e8acbf39df", "score": "0.51074886", "text": "func (p *Provider) GetPods(ctx context.Context) ([]*corev1.Pod, error) {\n\tl := &corev1.PodList{}\n\tif err := p.remote.List(ctx, l, client.HasLabels([]string{remote.LabelKeyNodeName})); err != nil {\n\t\treturn nil, errors.Wrap(err, \"cannot list pods\")\n\t}\n\n\tpods := make([]*corev1.Pod, len(l.Items))\n\tfor i := range l.Items {\n\t\tpod := l.Items[i].DeepCopy()\n\t\tremote.RecoverPod(pod)\n\t\tpods[i] = pod\n\t}\n\n\treturn pods, nil\n}", "title": "" }, { "docid": "e8768d6bcfbae47db7a73dcc0b0ad05c", "score": "0.5103655", "text": "func List(args []string, kubeConfig, kubeContext, outputFormat, subjectKind string, enableGke bool) {\n\n\tclientConfig := getClientConfig(kubeConfig, kubeContext)\n\n\tkubeconfig, err := clientConfig.ClientConfig()\n\tif err != nil {\n\t\tfmt.Printf(\"Error getting Kubernetes config: %v\\n\", err)\n\t\tos.Exit(1)\n\t}\n\n\tclientset, err := kubernetes.NewForConfig(kubeconfig)\n\tif err != nil {\n\t\tfmt.Printf(\"Error generating Kubernetes clientset from kubeconfig: %v\\n\", err)\n\t\tos.Exit(2)\n\t}\n\n\tfilter := \"\"\n\tif len(args) > 0 {\n\t\tfilter = args[0]\n\t}\n\n\tl := lister{\n\t\tfilter: filter,\n\t\tsubjectKind: subjectKind,\n\t\tclientset: clientset,\n\t\trbacSubjectsByScope: make(map[string]rbacSubject),\n\t}\n\n\tif enableGke {\n\t\trawConfig, err := clientConfig.RawConfig()\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"Error getting Kubernetes raw config: %v\\n\", err)\n\t\t\tos.Exit(3)\n\t\t}\n\n\t\tci := getClusterInfo(&rawConfig, kubeContext)\n\t\tl.gkeParsedProjectName = ci.ParsedProjectName\n\t}\n\n\tloadErr := l.loadAll()\n\tif loadErr != nil {\n\t\tfmt.Printf(\"Error loading RBAC Bindings: %v\\n\", loadErr)\n\t\tos.Exit(4)\n\t}\n\n\tl.printRbacBindings(outputFormat)\n}", "title": "" }, { "docid": "642eec6cc9ef3cf0f5676acb9269ab50", "score": "0.510122", "text": "func ListPodNames(cell, component string) ([]string, error) {\n\tpods, err := GetPods(cell, component)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn GetPodNames(pods), nil\n}", "title": "" }, { "docid": "be2069fa8742fa9e389f7474bd10ee51", "score": "0.5098639", "text": "func countPods(ctx context.Context, kubeClient kubernetes.Interface, ns string, labelz map[string]string) int {\n\tpods, err := kubeClient.CoreV1().Pods(ns).List(ctx, metav1.ListOptions{\n\t\tLabelSelector: labels.Set(labelz).AsSelector().String(),\n\t})\n\tif err != nil {\n\t\tlog.Panicf(\"Failed to list pods: %v\", err)\n\t}\n\treturn len(pods.Items)\n}", "title": "" }, { "docid": "c090d291c09c1c1a84982ff76e6b01eb", "score": "0.50930446", "text": "func (c *Client) List(p string) ([]string, error) {\n\tif c.Version == 2 {\n\t\tp = FixPath(p, c.Mount, ListPrefix)\n\t}\n\ts, err := c.client.Logical().List(p)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif s == nil || s.Data == nil {\n\t\treturn nil, nil\n\t}\n\tkeys := []string{}\n\tfor _, v := range s.Data[\"keys\"].([]interface{}) {\n\t\tkeys = append(keys, v.(string))\n\t}\n\treturn keys, nil\n}", "title": "" }, { "docid": "f81706e443befcaaaa9367304b7b4f76", "score": "0.5090593", "text": "func (p *Processor) getMatchingPods(ctx context.Context, pa *appsv1alpha1.ProbeAssistant) ([]*corev1.Pod, error) {\n\t// get more faster selector\n\tselector, err := util.GetFastLabelSelector(pa.Spec.Selector)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// If ProbeAssistant.Spec.Namespace is empty, then select in cluster\n\tscopedNamespaces := []string{pa.Spec.Namespace}\n\tselectedPods, err := p.getSelectedPods(ctx, scopedNamespaces, selector)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// filter out pods that don't require updated, include the following:\n\t// 1. Deletion pod\n\t// 2. Already has binding ProbeAssis\n\tvar filteredPods []*corev1.Pod\n\tfor _, pod := range selectedPods {\n\t\tif probeassistant.IsActivePod(pod) && isPodBindProbeAssistant(pod) {\n\t\t\tfilteredPods = append(filteredPods, pod)\n\t\t}\n\t}\n\treturn filteredPods, nil\n}", "title": "" }, { "docid": "fc6a2d51e11a5ca3883c6ad4bed27fe3", "score": "0.50883144", "text": "func List(client *occlient.Client, applicationName string) ([]ServiceInfo, error) {\n\tlabels := map[string]string{\n\t\tapplabels.ApplicationLabel: applicationName,\n\t}\n\n\t//since, service is associated with application, it consist of application label as well\n\t// which we can give as a selector\n\tapplicationSelector := util.ConvertLabelsToSelector(labels)\n\n\t// get service instance list based on given selector\n\tserviceInstanceList, err := client.GetServiceInstanceList(applicationSelector)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"unable to list services\")\n\t}\n\n\tvar services []ServiceInfo\n\t// Iterate through serviceInstanceList and add to service\n\tfor _, elem := range serviceInstanceList {\n\t\tconditions := elem.Status.Conditions\n\t\tvar status string\n\t\tif len(conditions) == 0 {\n\t\t\tglog.Warningf(\"no condition in status for %+v, marking it as Unknown\", elem)\n\t\t\tstatus = \"Unknown\"\n\t\t} else {\n\t\t\tstatus = conditions[0].Reason\n\t\t}\n\n\t\tservices = append(services, ServiceInfo{Name: elem.Labels[componentlabels.ComponentLabel], Type: elem.Labels[componentlabels.ComponentTypeLabel], Status: status})\n\t}\n\n\treturn services, nil\n}", "title": "" }, { "docid": "5f2396d3bc33dab5b03c8c499739e866", "score": "0.50829816", "text": "func newPodList(store cache.Store, count int, status v1.PodPhase, rc *v1.ReplicationController, name string) *v1.PodList {\n\tpods := []v1.Pod{}\n\tvar trueVar = true\n\tcontrollerReference := metav1.OwnerReference{UID: rc.UID, APIVersion: \"v1\", Kind: \"ReplicationController\", Name: rc.Name, Controller: &trueVar}\n\tfor i := 0; i < count; i++ {\n\t\tpod := newPod(fmt.Sprintf(\"%s%d\", name, i), rc, status, nil, false)\n\t\tpod.OwnerReferences = []metav1.OwnerReference{controllerReference}\n\t\tif store != nil {\n\t\t\tstore.Add(pod)\n\t\t}\n\t\tpods = append(pods, *pod)\n\t}\n\treturn &v1.PodList{\n\t\tItems: pods,\n\t}\n}", "title": "" }, { "docid": "3f64f6bef0530bc8a91101a65b4fee2a", "score": "0.50773233", "text": "func (c *Client) List(prefix string) ([]string, error) {\n\tvlt := c.Client.Logical()\n\tresp, err := vlt.List(c.getListPath(prefix))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlist, _ := extractListData(resp)\n\treturn list, nil\n}", "title": "" } ]
e5642b534be99418a096d7b2df3267de
GetWorkloads returns all active workloads on RMD instance
[ { "docid": "224be78cc2bbe2fcc4cca43d5bec6d02", "score": "0.72575974", "text": "func (rc *OperatorRmdClient) GetWorkloads(address string) ([]*rmdtypes.RDTWorkLoad, error) {\n\thttpString := fmt.Sprintf(\"%s%s\", address, \"/v1/workloads\")\n\tresp, err := rc.client.Get(httpString)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treceivedJSON, err := ioutil.ReadAll(resp.Body) //This reads raw request body\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tallWorkloads := make([]*rmdtypes.RDTWorkLoad, 0)\n\terr = json.Unmarshal([]byte(receivedJSON), &allWorkloads)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp.Body.Close()\n\treturn allWorkloads, nil\n}", "title": "" } ]
[ { "docid": "6f303f14b6c696b08373343885a1e4f5", "score": "0.75860685", "text": "func (h *H) GetWorkloads() map[string]bool {\n\treturn h.installedWorkloads\n}", "title": "" }, { "docid": "e8deae343bdcb83c0857edac2d48ed8a", "score": "0.7145783", "text": "func GetWorkloads(w http.ResponseWriter, r *http.Request, p httprouter.Params) {\n\t// Enable CORS\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\tw.Header().Set(\"Access-Control-Allow-Headers\", \"Content-Type\")\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\tns := p.ByName(\"namespace\")\n\tkubeCli, err := kube.NewClient()\n\tif err != nil {\n\t\tlog.Println(err)\n\t\thttp.Error(w, fmt.Sprintf(\"Failed to access Kubernetes cluster. Error: %s\", err.Error()), http.StatusInternalServerError)\n\t\treturn\n\t}\n\twl, err := kubeCli.GetWorkloads(context.TODO(), ns)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\thttp.Error(w, fmt.Sprintf(\"Failed to access Kubernetes cluster. Error: %s\", err.Error()), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tif err := json.NewEncoder(w).Encode(wl); err != nil {\n\t\tlog.Println(err)\n\t\thttp.Error(w, fmt.Sprintf(\"Failed to create response. Error: %s\", err.Error()), http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "162b64e818876fc808f796e2247a9659", "score": "0.70898986", "text": "func (ds *Datastore) GetWorkloads(tenantID string) ([]types.Workload, error) {\n\tvar workloads []types.Workload\n\n\t// check the cache first\n\tds.tenantsLock.RLock()\n\tdefer ds.tenantsLock.RUnlock()\n\n\t// get any public workloads. These are part of our\n\t// dummy tenant \"public\".\n\tpublic, ok := ds.tenants[\"public\"]\n\tif ok {\n\t\tfor _, wl := range public.workloads {\n\t\t\tworkloads = append(workloads, wl)\n\t\t}\n\t}\n\n\t// if there isn't a tenant here, it isn't necessarily an\n\t// error.\n\ttenant, ok := ds.tenants[tenantID]\n\tif !ok {\n\t\treturn workloads, nil\n\t}\n\n\tworkloads = append(workloads, tenant.workloads...)\n\n\treturn workloads, nil\n}", "title": "" }, { "docid": "a88197f9409d374943770e5bfbe7d891", "score": "0.6596546", "text": "func (client *Client) ListWorkloads() ([]types.Workload, error) {\n\tvar wls []types.Workload\n\n\tvar url string\n\tif client.IsPrivileged() {\n\t\turl = client.buildCiaoURL(\"workloads\")\n\t} else {\n\t\turl = client.buildCiaoURL(\"%s/workloads\", client.TenantID)\n\t}\n\n\terr := client.getResource(url, api.WorkloadsV1, nil, &wls)\n\treturn wls, err\n}", "title": "" }, { "docid": "40555d18787054c9206013533ddd9cf8", "score": "0.6394198", "text": "func WorkloadList(w http.ResponseWriter, r *http.Request) {\n\tp := workloadParams{}\n\tp.extract(r)\n\n\tcriteria := business.WorkloadCriteria{Namespace: p.Namespace, IncludeHealth: p.IncludeHealth,\n\t\tIncludeIstioResources: p.IncludeIstioResources, RateInterval: p.RateInterval, QueryTime: p.QueryTime}\n\n\t// Get business layer\n\tbusinessLayer, err := getBusiness(r)\n\tif err != nil {\n\t\tRespondWithError(w, http.StatusInternalServerError, \"Workloads initialization error: \"+err.Error())\n\t\treturn\n\t}\n\n\tif criteria.IncludeHealth {\n\t\t// When the cluster is not specified, we need to get it. If there are more than one,\n\t\t// get the one for which the namespace creation time is oldest\n\t\tnamespaces, _ := businessLayer.Namespace.GetNamespaceClusters(r.Context(), p.Namespace)\n\t\tif len(namespaces) == 0 {\n\t\t\terr = fmt.Errorf(\"No clusters found for namespace [%s]\", p.Namespace)\n\t\t\thandleErrorResponse(w, err, \"Error looking for cluster: \"+err.Error())\n\t\t\treturn\n\t\t}\n\t\tns := GetOldestNamespace(namespaces)\n\n\t\trateInterval, err := adjustRateInterval(r.Context(), businessLayer, p.Namespace, p.RateInterval, p.QueryTime, ns.Cluster)\n\t\tif err != nil {\n\t\t\thandleErrorResponse(w, err, \"Adjust rate interval error: \"+err.Error())\n\t\t\treturn\n\t\t}\n\t\tcriteria.RateInterval = rateInterval\n\t}\n\n\t// Fetch and build workloads\n\t// Criteria does not include cluster, so it will look workloads from all the clusters\n\tworkloadList, err := businessLayer.Workload.GetWorkloadList(r.Context(), criteria)\n\tif err != nil {\n\t\thandleErrorResponse(w, err)\n\t\treturn\n\t}\n\n\tRespondWithJSON(w, http.StatusOK, workloadList)\n}", "title": "" }, { "docid": "dc8a206f1e79e05d4ce9e2be5afa34bc", "score": "0.62757033", "text": "func GetAll() ([]wltypes.RDTWorkLoad, error) {\n\tws := []wltypes.RDTWorkLoad{}\n\tif workloadDatabase == nil {\n\t\treturn ws, rmderror.NewAppError(http.StatusInternalServerError, \"Service database not initialized\")\n\t}\n\tws, err := workloadDatabase.GetAllWorkload()\n\tif err != nil {\n\t\treturn ws, rmderror.NewAppError(http.StatusInternalServerError, err.Error())\n\t}\n\treturn ws, nil\n}", "title": "" }, { "docid": "f51ce82eb575074248e3d04d984b44ff", "score": "0.58680207", "text": "func (c *Clientset) Workloads() workloadsv1alpha1.WorkloadsV1alpha1Interface {\n\treturn c.workloadsV1alpha1\n}", "title": "" }, { "docid": "1a8fcc10ceb3a6e4c27e50b78478529e", "score": "0.57530457", "text": "func (c *Client) GetWorkSpaces() ([]WorkSpace, error) {\n\tvar res []WorkSpace\n\n\treturn res, c.Get(\"/services/workspaces\", &res)\n}", "title": "" }, { "docid": "e1c6377157a81fe2b2c5b3c8889fa831", "score": "0.5668492", "text": "func (b *BoltDB) GetAllWorkload() ([]wltypes.RDTWorkLoad, error) {\n\tws := []wltypes.RDTWorkLoad{}\n\terr := b.session.View(func(tx *bolt.Tx) error {\n\t\tbucket := tx.Bucket([]byte(WorkloadTableName))\n\t\tif bucket == nil {\n\t\t\treturn errors.New(\"Bucket fetching failed\")\n\t\t}\n\t\tcursor := bucket.Cursor()\n\t\tif cursor == nil {\n\t\t\treturn errors.New(\"Cursor creation failed\")\n\t\t}\n\t\tfor k, v := cursor.First(); k != nil; k, v = cursor.Next() {\n\t\t\tw := wltypes.RDTWorkLoad{}\n\t\t\terr := json.Unmarshal(v, &w)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tws = append(ws, w)\n\t\t}\n\t\treturn nil\n\t})\n\treturn ws, err\n}", "title": "" }, { "docid": "53a904fb6b01a12bb99fdccb8f482d83", "score": "0.5343603", "text": "func (ds *Datastore) GetWorkload(tenantID string, ID string) (types.Workload, error) {\n\tif ID == ds.cnciWorkload.ID {\n\t\treturn ds.cnciWorkload, nil\n\t}\n\n\tds.tenantsLock.RLock()\n\tdefer ds.tenantsLock.RUnlock()\n\n\t// get any public workloads. These are part of our\n\t// dummy tenant \"public\".\n\tpublic, ok := ds.tenants[\"public\"]\n\tif ok {\n\t\tfor _, wl := range public.workloads {\n\t\t\tif wl.ID == ID {\n\t\t\t\treturn wl, nil\n\t\t\t}\n\t\t}\n\t}\n\n\ttenant, ok := ds.tenants[tenantID]\n\tif !ok {\n\t\treturn types.Workload{}, ErrNoTenant\n\t}\n\n\tfor _, wl := range tenant.workloads {\n\t\tif wl.ID == ID {\n\t\t\treturn wl, nil\n\t\t}\n\t}\n\n\treturn types.Workload{}, types.ErrWorkloadNotFound\n}", "title": "" }, { "docid": "e3cb199fb2c0e5aab11d9344625806a0", "score": "0.5301374", "text": "func (m *ManagementTemplate) GetWorkloadActions()([]WorkloadActionable) {\n val, err := m.GetBackingStore().Get(\"workloadActions\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]WorkloadActionable)\n }\n return nil\n}", "title": "" }, { "docid": "a5236da1d50319377ac22b71791bb703", "score": "0.52934545", "text": "func (c *Calcium) ListNodeWorkloads(ctx context.Context, nodename string, labels map[string]string) (workloads []*types.Workload, err error) {\n\tlogger := log.WithField(\"Calcium\", \"ListNodeWorkloads\").WithField(\"nodename\", nodename).WithField(\"labels\", labels)\n\tif nodename == \"\" {\n\t\treturn workloads, logger.Err(ctx, errors.WithStack(types.ErrEmptyNodeName))\n\t}\n\tworkloads, err = c.store.ListNodeWorkloads(ctx, nodename, labels)\n\treturn workloads, logger.Err(ctx, errors.WithStack(err))\n}", "title": "" }, { "docid": "3842149f9ebadfc7344ee00b649aadb4", "score": "0.5223583", "text": "func (s *APIServer) ListWorkload(c *gin.Context) {\n\tvar workloadDefinitionList []apis.WorkloadMeta\n\tworkloads, err := plugins.LoadInstalledCapabilityWithType(types.TypeWorkload)\n\tif err != nil {\n\t\tutil.HandleError(c, util.StatusInternalServerError, err)\n\t\treturn\n\t}\n\tfor _, w := range workloads {\n\t\tworkloadDefinitionList = append(workloadDefinitionList, apis.WorkloadMeta{\n\t\t\tName: w.Name,\n\t\t\tParameters: w.Parameters,\n\t\t\tDescription: w.Description,\n\t\t})\n\t}\n\tutil.AssembleResponse(c, workloadDefinitionList, err)\n}", "title": "" }, { "docid": "ec2d5deccb7b87a349b0d55c1b7828f8", "score": "0.52135617", "text": "func (sm *VcenterSysModel) deleteAllWorkloads() error {\n\n\t// first get a list of all existing.Workloads from iota\n\tgwlm := &iota.WorkloadMsg{\n\t\tApiResponse: &iota.IotaAPIResponse{},\n\t\tWorkloadOp: iota.Op_GET,\n\t}\n\ttopoClient := iota.NewTopologyApiClient(sm.Tb.Client().Client)\n\tgetResp, err := topoClient.GetWorkloads(context.Background(), gwlm)\n\tlog.Debugf(\"Got get workload resp: %+v, err: %v\", getResp, err)\n\tif err != nil {\n\t\tlog.Errorf(\"Failed to instantiate Apps. Err: %v\", err)\n\t\treturn fmt.Errorf(\"Error creating IOTA workload. err: %v\", err)\n\t} else if getResp.ApiResponse.ApiStatus != iota.APIResponseType_API_STATUS_OK {\n\t\tlog.Errorf(\"Failed to instantiate Apps. resp: %+v.\", getResp.ApiResponse)\n\t\treturn fmt.Errorf(\"Error creating IOTA workload. Resp: %+v\", getResp.ApiResponse)\n\t}\n\n\tif len(getResp.Workloads) != 0 {\n\t\tgetResp.WorkloadOp = iota.Op_DELETE\n\t\tdelResp, err := topoClient.DeleteWorkloads(context.Background(), getResp)\n\t\tlog.Debugf(\"Got get workload delete resp: %+v, err: %v\", delResp, err)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Failed to delete old workloads. Err: %v\", err)\n\t\t\treturn fmt.Errorf(\"Error deleting IOTA workload. err: %v\", err)\n\t\t}\n\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e2bf7fbdcba3ccec5ec38819ccc9afd2", "score": "0.51644254", "text": "func (c *Client) Workspaces(ctx context.Context) ([]Workspace, error) {\n\treq, err := http.NewRequestWithContext(ctx, http.MethodGet, \"https://api.twist.com/api/v3/workspaces/get\", nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsetAuthHeader(req, c.token)\n\tbody, err := doRequestWithRetries(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer body.Close()\n\tvar out []Workspace\n\tif err := json.NewDecoder(body).Decode(&out); err != nil {\n\t\treturn nil, err\n\t}\n\treturn out, nil\n}", "title": "" }, { "docid": "0c209d70d9bf1cc5278fab8bc18210d9", "score": "0.51267165", "text": "func (cc *CalicoClientStub) WorkloadEndpoints() clientv3.WorkloadEndpointInterface {\n\tpanic(\"not implemented\")\n}", "title": "" }, { "docid": "ab1b08adb30fc650cfa91b68c9eb881a", "score": "0.51122546", "text": "func getWorkflowRunsFromGithub() {\n\tfor {\n\t\tfor _, repo := range config.Github.Repositories.Value() {\n\t\t\tr := strings.Split(repo, \"/\")\n\t\t\tresp, _, err := client.Actions.ListRepositoryWorkflowRuns(context.Background(), r[0], r[1], nil)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"ListRepositoryWorkflowRuns error for %s: %s\", repo, err.Error())\n\t\t\t} else {\n\t\t\t\tfor _, run := range resp.WorkflowRuns {\n\t\t\t\t\tvar s float64 = 0\n\t\t\t\t\tif run.GetConclusion() == \"success\" {\n\t\t\t\t\t\ts = 1\n\t\t\t\t\t} else if run.GetConclusion() == \"skipped\" {\n\t\t\t\t\t\ts = 2\n\t\t\t\t\t} else if run.GetConclusion() == \"in_progress\" {\n\t\t\t\t\t\ts = 3\n\t\t\t\t\t} else if run.GetConclusion() == \"queued\" {\n\t\t\t\t\t\ts = 4\n\t\t\t\t\t}\n\n\t\t\t\t\tfields := getRelevantFields(repo, run)\n\n\t\t\t\t\tworkflowRunStatusGauge.WithLabelValues(fields...).Set(s)\n\n\t\t\t\t\tresp, _, err := client.Actions.GetWorkflowRunUsageByID(context.Background(), r[0], r[1], *run.ID)\n\t\t\t\t\tif err != nil { // Fallback for Github Enterprise\n\t\t\t\t\t\tcreated := run.CreatedAt.Time.Unix()\n\t\t\t\t\t\tupdated := run.UpdatedAt.Time.Unix()\n\t\t\t\t\t\telapsed := updated - created\n\t\t\t\t\t\tworkflowRunDurationGauge.WithLabelValues(fields...).Set(float64(elapsed * 1000))\n\t\t\t\t\t} else {\n\t\t\t\t\t\tworkflowRunDurationGauge.WithLabelValues(fields...).Set(float64(resp.GetRunDurationMS()))\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\ttime.Sleep(time.Duration(config.Github.Refresh) * time.Second)\n\t}\n}", "title": "" }, { "docid": "d5236c6dc5faef00d2de46465572ecf6", "score": "0.50772154", "text": "func (p *Pool) GetRunningWorkers() uint64 {\n\treturn atomic.LoadUint64(&p.runningWorkers)\n}", "title": "" }, { "docid": "7bcfa21a77e77dabae82c82cc97f0f0b", "score": "0.50758195", "text": "func (d *Deployment) GetWorkers() []*DeploymentWorker {\n\tif d == nil {\n\t\treturn nil\n\t}\n\treturn d.Workers\n}", "title": "" }, { "docid": "6aff6749f9adadb2edfe56a0e9f05571", "score": "0.5072042", "text": "func (m *MockwlStore) ListWorkloads(appName string) ([]*config.Workload, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListWorkloads\", appName)\n\tret0, _ := ret[0].([]*config.Workload)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "10e94de586ec80b268ff14ff790e15a6", "score": "0.50692195", "text": "func RegisterWorkloads(runtime, host string) error {\n\tworkloads := []string{\n\t\t\"istiomesh\",\n\t\t\"grafanaistioaddon\",\n\t\t\"prometheusistioaddon\",\n\t\t\"zipkinistioaddon\",\n\t\t\"jaegeristioaddon\",\n\t\t\"virtualservice\",\n\t\t\"envoyfilter\",\n\t}\n\n\toamRDP := []adapter.OAMRegistrantDefinitionPath{}\n\n\tfor _, workload := range workloads {\n\t\tdefintionPath, schemaPath := generatePaths(workloadPath, workload)\n\n\t\tmetadata := map[string]string{\n\t\t\tconfig.OAMAdapterNameMetadataKey: config.IstioOperation,\n\t\t}\n\n\t\tif strings.HasSuffix(workload, \"addon\") {\n\t\t\tmetadata[config.OAMComponentCategoryMetadataKey] = \"addon\"\n\t\t}\n\n\t\toamRDP = append(oamRDP, adapter.OAMRegistrantDefinitionPath{\n\t\t\tOAMDefintionPath: defintionPath,\n\t\t\tOAMRefSchemaPath: schemaPath,\n\t\t\tHost: host,\n\t\t\tMetadata: metadata,\n\t\t})\n\t}\n\n\treturn adapter.\n\t\tNewOAMRegistrant(oamRDP, fmt.Sprintf(\"%s/api/oam/workload\", runtime)).\n\t\tRegister()\n}", "title": "" }, { "docid": "986994cd0e4b5e28799a17d005d56d1a", "score": "0.5044374", "text": "func GetWorkerList(groupID string) ([]string, error) {\n\tdata, err := ioutil.ReadFile(\"./cluster.yaml\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tm := make(map[interface{}]interface{})\n\n\terr = yaml.Unmarshal(data, &m)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// If there's no worker in cluster.yaml (e.g. only master), the node group will be\n\t// initialized with 0 workers.\n\t// And automatic scale up later should not add workers in this node group, the node state\n\t// will be maintained in autoscaler with node lister. The target size is the only thing\n\t// been updated during scaling.\n\tmachines := []string{}\n\tif machineMap, ok := m[\"machines\"]; ok {\n\t\tfor vm, roleMap := range machineMap.(map[interface{}]interface{}) {\n\t\t\tif roleMap.(map[interface{}]interface{})[\"role\"] == \"worker\" &&\n\t\t\t\troleMap.(map[interface{}]interface{})[\"node-group\"] == groupID {\n\t\t\t\tmachines = append(machines, vm.(string))\n\t\t\t}\n\t\t}\n\t}\n\treturn machines, nil\n}", "title": "" }, { "docid": "649a2bf9379923ef32594ba1e1fab106", "score": "0.50330865", "text": "func (e *Work) GetAll(ctx context.Context) interface{} {\n\tq := datastore.NewQuery(\"work\")\n\n\t// Get All Works\n\tvar entities Works\n\tGetAll(ctx, q, &entities, \"date_in\", true)\n\n\te.GetImages(ctx, entities)\n\n\treturn entities\n}", "title": "" }, { "docid": "5bc046f17ebe518a84566f4e21a86e1e", "score": "0.50150144", "text": "func (s *APIServer) GetWorkload(c *gin.Context) {\n\tvar workloadType = c.Param(\"workloadName\")\n\tvar capability types.Capability\n\tvar err error\n\n\tif capability, err = plugins.GetInstalledCapabilityWithCapName(types.TypeWorkload, workloadType); err != nil {\n\t\tutil.HandleError(c, util.StatusInternalServerError, err)\n\t\treturn\n\t}\n\tutil.AssembleResponse(c, capability, err)\n}", "title": "" }, { "docid": "aab0c2bcb2c1a8c7778c0371eb0d0ac8", "score": "0.49876627", "text": "func receiveWorkloads() {\n\tvar sock mangos.Socket\n\tvar err error\n\tvar msg []byte\n\n\tif sock, err = pull.NewSocket(); err != nil {\n\t\tdie(\"can't get new pull socket: %s\", err)\n\t}\n\tif err = sock.Listen(workloadsUrl); err != nil {\n\t\tdie(\"can't listen on pull socket: %s\", err.Error())\n\t}\n\tfor {\n\t\t// Could also use sock.RecvMsg to get header\n\t\tmsg, err = sock.Recv()\n\t\tif err != nil {\n\t\t\tdie(\"cannot receive from mangos Socket: %s\", err.Error())\n\t\t}\n\n\t\t// after getting json string, convert it to workload struct\n\t\t// and add it to the fake database\n\t\tvar workload Workload\n\t\terr = json.Unmarshal(msg, &workload)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"[ERROR] controller couldnt parse to image\\n\" +\n\t\t\t\t\"bad json sent\")\n\t\t}\n\t\tinstertWorkload(workload)\n\n\t\tjob := checkForWork(workload)\n\t\tjob.Workers = Workers\n\t\tjobStr, err := json.Marshal(job)\n\t\tif err != nil {\n\t\t\tdie(\"cannot parse job to json string: %s\", err.Error())\n\t\t}\n\t\tpushJob(schedulerUrl, string(jobStr))\n\t}\n}", "title": "" }, { "docid": "7d1c6009ea4bb56c6949286bd1e0310a", "score": "0.4981454", "text": "func (c *Client) GetInstances(stack *Stack, workload *Workload) ([]Instance, error) {\n\treq, err := http.NewRequest(\n\t\thttp.MethodGet,\n\t\tfmt.Sprintf(baseURL+\"/workload/v1/stacks/%s/workloads/%s/instances\", stack.Slug, workload.Slug),\n\t\tnil,\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tres, err := c.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresBody, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = res.Body.Close()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tinstanceRes := struct {\n\t\tResults []Instance `json:\"results\"`\n\t}{}\n\terr = json.Unmarshal(resBody, &instanceRes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn instanceRes.Results, nil\n}", "title": "" }, { "docid": "ec552e109e119974118b1b9ccecce2ef", "score": "0.4977369", "text": "func (d *Director) GetStarted() []*worker.Work {\n\td.Lock()\n\tdefer d.Unlock()\n\tstarted := []*worker.Work{}\n\tfor work, _ := range d.started {\n\t\tstarted = append(started, work)\n\t}\n\treturn started\n}", "title": "" }, { "docid": "56da3941285e4fa881c4e89b9d59b546", "score": "0.4973496", "text": "func (m *Mockstore) ListWorkloads(appName string) ([]*config.Workload, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListWorkloads\", appName)\n\tret0, _ := ret[0].([]*config.Workload)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "ce6151bfbd12156410355e441f1bf520", "score": "0.49721396", "text": "func ListWorkload(cmd *cobra.Command, args []string) {\n\treq := &bcsdatamanager.GetWorkloadInfoListRequest{}\n\treq.ClusterID = flagCluster\n\treq.Dimension = flagDimension\n\treq.Page = flagPage\n\treq.Size = flagSize\n\treq.Namespace = flagNamespace\n\tif flagWorkloadType == \"\" {\n\t\tfmt.Printf(\"get workload data need specific workloadType, use -t {workloadType}\\n\")\n\t\tos.Exit(1)\n\t}\n\treq.WorkloadType = flagWorkloadType\n\tctx := context.Background()\n\tclient, cliCtx, err := pkg.NewClientWithConfiguration(ctx)\n\tif err != nil {\n\t\tfmt.Printf(\"init datamanger conn error:%v\\n\", err)\n\t\tos.Exit(1)\n\t}\n\trsp, err := client.GetWorkloadInfoList(cliCtx, req)\n\tif err != nil {\n\t\tfmt.Printf(\"get workload list data err:%v\\n\", err)\n\t\tos.Exit(1)\n\t}\n\n\tif rsp != nil && rsp.Code != 0 {\n\t\tfmt.Printf(rsp.Message)\n\t\tos.Exit(1)\n\t}\n\tfmt.Printf(\"total: %d\\n\", rsp.Total)\n\tif flagOutput == outputTypeJSON {\n\t\tprinter.PrintWorkloadListInJSON(rsp.Data)\n\t\treturn\n\t}\n\tprinter.PrintWorkloadListInTable(flagOutput == outputTypeWide, rsp.Data)\n}", "title": "" }, { "docid": "cda895e978f29f2e98f304a47b028bbc", "score": "0.49659443", "text": "func (h *H) GetWorkload(name string) bool {\n\t_, ok := h.installedWorkloads[name]\n\treturn ok\n}", "title": "" }, { "docid": "64d21d5a1a7526c8c200394117962884", "score": "0.49569917", "text": "func (nc *Client) GetWork(params ...interface{}) (work *Work, err error) {\n\trpcResp, err := nc.Call(\"getWork\", params)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Unmarshal result\n\tvar result Work\n\terr = rpcResp.GetObject(&result)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%v: %v\", ErrResultUnexpected, err)\n\t}\n\n\tif result.Data == \"\" {\n\t\treturn nil, nil\n\t}\n\n\treturn &result, nil\n}", "title": "" }, { "docid": "e680c67dfee3167ec136b7ab35f84ba1", "score": "0.4947491", "text": "func (c *Calcium) GetWorkload(ctx context.Context, id string) (workload *types.Workload, err error) {\n\tlogger := log.WithField(\"Calcium\", \"GetWorkload\").WithField(\"id\", id)\n\tif id == \"\" {\n\t\treturn workload, logger.Err(ctx, errors.WithStack(types.ErrEmptyWorkloadID))\n\t}\n\tworkload, err = c.store.GetWorkload(ctx, id)\n\treturn workload, logger.Err(ctx, errors.WithStack(err))\n}", "title": "" }, { "docid": "40a5c5ccfd7bc9d06b1fa7bc8da3acce", "score": "0.49314702", "text": "func ListWorkers(cfg *SchedCtlConfig) error {\n\treturn runRPC(func(client pb.SchedulerClient) error {\n\t\tctx, cancel := context.WithTimeout(context.Background(),\n\t\t\tcfg.ConnectionTimeout)\n\n\t\tlog.Debug(\"Calling ListWorkers RPC\")\n\t\twl, err := client.GetWorkerList(ctx, &pb.DummyReq{\n\t\t\tId: \"dummy\",\n\t\t})\n\t\tcancel()\n\n\t\tif err != nil {\n\t\t\treturn trace.Errorf(\"Connection problems: %s\\n\", err.Error())\n\t\t}\n\n\t\tw := tabwriter.NewWriter(os.Stdout, 0, 0, 1, ' ', tabwriter.Debug)\n\t\tfmt.Fprintln(w, WorkersHeader)\n\t\tfor _, v := range wl.Nodes {\n\t\t\tfmt.Fprintf(w, WorkersLineTemplate, v.Id, v.Address, v.State)\n\t\t}\n\t\tw.Flush()\n\n\t\treturn nil\n\t}, cfg)\n}", "title": "" }, { "docid": "35040a7b83a715fd29d7eb833d87f959", "score": "0.4913018", "text": "func (r *RPCClient) GetWork() (*Work, error) {\n\t// jsonRpc and id are static in docs\n\thttpResp, err := api.Post(r.Url, \"2.0\", \"eth_getWork\", nil, 0)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar resp *RPCResponse\n\terr = json.NewDecoder(httpResp.Body).Decode(&resp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar work *Work\n\terr = json.Unmarshal(*resp.Result, &work)\n\n\treturn work, err\n}", "title": "" }, { "docid": "dc096f3b248fadfceb774e22d3ec09f1", "score": "0.49003264", "text": "func getWorkloadServiceMemberships(serviceLister cache.Indexer, workload *workloadv1a1.Workload) []string {\n\tret := make([]string, 0)\n\tfor _, obj := range serviceLister.List() {\n\t\tservice := obj.(*corev1.Service)\n\t\tif service.Namespace != workload.Namespace {\n\t\t\tcontinue\n\t\t}\n\n\t\tselector := labels.Set(service.Spec.Selector).AsSelectorPreValidated()\n\t\tif !selector.Matches(labels.Set(workload.Labels)) {\n\t\t\tcontinue\n\t\t}\n\n\t\tkey, err := cache.MetaNamespaceKeyFunc(service)\n\t\tif err != nil {\n\t\t\tklog.Errorf(\"failed to get the key of Service %q: %v\", service.GetName(), err)\n\t\t\tcontinue\n\t\t}\n\n\t\tret = append(ret, key)\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "5f732c89f169be5cef13a4b40ef2ab66", "score": "0.48677248", "text": "func (cfg *Config) getStaticScrapeWork() []ScrapeWork {\n\tvar dst []ScrapeWork\n\tfor i := range cfg.ScrapeConfigs {\n\t\tsc := &cfg.ScrapeConfigs[i]\n\t\tfor j := range sc.StaticConfigs {\n\t\t\tstc := &sc.StaticConfigs[j]\n\t\t\tdst = stc.appendScrapeWork(dst, sc.swc, nil)\n\t\t}\n\t}\n\treturn dst\n}", "title": "" }, { "docid": "97aeee899d4e183e4d0dbf966e7529ef", "score": "0.4843681", "text": "func (r *GormWorkItemRepository) List(ctx context.Context, criteria criteria.Expression, start *int, limit *int) ([]*app.WorkItem, error) {\n\twhere, parameters, err := Compile(criteria)\n\tif err != nil {\n\t\treturn nil, BadParameterError{\"expression\", criteria}\n\t}\n\n\tlog.Printf(\"executing query: '%s' with params %v\", where, parameters)\n\n\tvar rows []WorkItem\n\tdb := r.ts.TX().Where(where, parameters)\n\tif start != nil {\n\t\tdb = db.Offset(*start)\n\t}\n\tif limit != nil {\n\t\tdb = db.Limit(*limit)\n\t}\n\tif err := db.Find(&rows).Error; err != nil {\n\t\treturn nil, err\n\t}\n\tresult := make([]*app.WorkItem, len(rows))\n\n\tfor index, value := range rows {\n\t\tvar err error\n\t\twiType, err := r.wir.loadTypeFromDB(ctx, value.Type)\n\t\tif err != nil {\n\t\t\treturn nil, InternalError{simpleError{err.Error()}}\n\t\t}\n\t\tresult[index], err = convertFromModel(*wiType, value)\n\t\tif err != nil {\n\t\t\treturn nil, ConversionError{simpleError{err.Error()}}\n\t\t}\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "5a8f278d7c27823e7405509b17d08d65", "score": "0.48250952", "text": "func (client KamClient) listWorkRequests(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {\n\thttpRequest, err := request.HTTPRequest(http.MethodGet, \"/workRequests\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response ListWorkRequestsResponse\n\tvar httpResponse *http.Response\n\thttpResponse, err = client.Call(ctx, &httpRequest)\n\tdefer common.CloseBodyIfValid(httpResponse)\n\tresponse.RawResponse = httpResponse\n\tif err != nil {\n\t\treturn response, err\n\t}\n\n\terr = common.UnmarshalResponse(httpResponse, &response)\n\treturn response, err\n}", "title": "" }, { "docid": "d880e3505dbb58a6b3c710f3e147c1b7", "score": "0.48192224", "text": "func (r *Reconciler) extractWorkloads(ctx context.Context, componentList []string, targetApp,\n\tsourceApp *corev1alpha2.ApplicationConfiguration) (*unstructured.Unstructured, *unstructured.Unstructured, error) {\n\tvar componentName string\n\tif len(componentList) == 0 {\n\t\t// we need to find a default component\n\t\tcommons := appUtil.FindCommonComponent(targetApp, sourceApp)\n\t\tif len(commons) != 1 {\n\t\t\treturn nil, nil, fmt.Errorf(\"cannot find a default component, too many common components: %+v\", commons)\n\t\t}\n\t\tcomponentName = commons[0]\n\t} else {\n\t\t// assume that the validator webhook has already guaranteed that there is no more than one component for now\n\t\t// and the component exists in both the target and source app\n\t\tcomponentName = componentList[0]\n\t}\n\t// get the workload definition\n\t// the validator webhook has checked that source and the target are the same type\n\ttargetWorkload, err := r.fetchWorkload(ctx, componentName, targetApp)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tklog.InfoS(\"successfully get the target workload we need to work on\", \"targetWorkload\", klog.KObj(targetWorkload))\n\tif sourceApp != nil {\n\t\tsourceWorkload, err := r.fetchWorkload(ctx, componentName, sourceApp)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\tklog.InfoS(\"successfully get the source workload we need to work on\", \"sourceWorkload\",\n\t\t\tklog.KObj(sourceWorkload))\n\t\treturn targetWorkload, sourceWorkload, nil\n\t}\n\treturn targetWorkload, nil, nil\n}", "title": "" }, { "docid": "44ff5e5e6f2cd6ec314bf9b32ffc5c58", "score": "0.48166797", "text": "func (sqlStore *SQLStore) GetUnlockedInstallationsPendingWork() ([]*model.Installation, error) {\n\tbuilder := installationSelect.\n\t\tWhere(sq.Eq{\n\t\t\t\"State\": model.AllInstallationStatesPendingWork,\n\t\t}).\n\t\tWhere(\"LockAcquiredAt = 0\").\n\t\tOrderBy(\"CreateAt ASC\")\n\n\tvar rawInstallations rawInstallations\n\terr := sqlStore.selectBuilder(sqlStore.db, &rawInstallations, builder)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to get installations pending work\")\n\t}\n\n\tinstallations, err := rawInstallations.toInstallations()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, installation := range installations {\n\t\tif !installation.IsInGroup() {\n\t\t\tcontinue\n\t\t}\n\n\t\tgroup, err := sqlStore.GetGroup(*installation.GroupID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tinstallation.MergeWithGroup(group, false)\n\t}\n\n\treturn installations, nil\n}", "title": "" }, { "docid": "fa8be313c37c9d903ee76c83fd9cd19a", "score": "0.48132288", "text": "func (s *appliedManifestWorkLister) List(selector labels.Selector) (ret []*v1.AppliedManifestWork, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1.AppliedManifestWork))\n\t})\n\treturn ret, err\n}", "title": "" }, { "docid": "26013379becdccc82e64e0b41a1f5efe", "score": "0.48099932", "text": "func (a *AppSpec) GetWorkers() []*AppWorkerSpec {\n\tif a == nil {\n\t\treturn nil\n\t}\n\treturn a.Workers\n}", "title": "" }, { "docid": "13a09d6be45d483a2ae6f4c7790a49cb", "score": "0.48071617", "text": "func (p *Pipeline) getWorkSpace(project int64, branch string) (string, error) {\n\trules, err := p.branchRuleSvc.Query(apistructs.ProjectScope, project)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tbranchRule := diceworkspace.GetValidBranchByGitReference(branch, rules)\n\treturn branchRule.Workspace, nil\n}", "title": "" }, { "docid": "fe090e0d28852b5dbe166edec42b59d1", "score": "0.48010194", "text": "func (c *Client) Workspaces() *Workspaces {\n\treturn &Workspaces{\n\t\tClient: c,\n\t\tPath: DefaultWorkspacesPath,\n\t}\n}", "title": "" }, { "docid": "bc56863d8ea81aa0641ed6b8fd97c559", "score": "0.47763214", "text": "func (client *RegistryClient) WorkItemList(params url.Values) *RegistryResponse {\n\t// Set up the response object\n\tresp := NewRegistryResponse(RegistryWorkItem)\n\tresp.workItems = make([]*registry.WorkItem, 0)\n\n\t// Build the url and the request object\n\trelativeURL := fmt.Sprintf(\"/%s/%s/items?%s\", client.apiPrefix, client.APIVersion, encodeParams(params))\n\tabsoluteURL := client.BuildURL(relativeURL)\n\n\t// Run the request\n\tclient.DoRequest(resp, \"GET\", absoluteURL, nil)\n\tif resp.Error != nil {\n\t\treturn resp\n\t}\n\n\t// Parse the JSON from the response body.\n\t// If there's an error, it will be recorded in resp.Error\n\tresp.UnmarshalJSONList()\n\treturn resp\n}", "title": "" }, { "docid": "76dadaa0d6b26026e475f1d3e5b32465", "score": "0.47527602", "text": "func (c *WorkStatusController) getGVRsFromWork(work *workv1alpha1.Work) (map[schema.GroupVersionResource]bool, error) {\n\tgvrTargets := map[schema.GroupVersionResource]bool{}\n\tfor _, manifest := range work.Spec.Workload.Manifests {\n\t\tworkload := &unstructured.Unstructured{}\n\t\terr := workload.UnmarshalJSON(manifest.Raw)\n\t\tif err != nil {\n\t\t\tklog.Errorf(\"Failed to unmarshal workload. Error: %v.\", err)\n\t\t\treturn nil, err\n\t\t}\n\t\tgvr, err := restmapper.GetGroupVersionResource(c.RESTMapper, workload.GroupVersionKind())\n\t\tif err != nil {\n\t\t\tklog.Errorf(\"Failed to get GVR from GVK for resource %s/%s. Error: %v.\", workload.GetNamespace(), workload.GetName(), err)\n\t\t\treturn nil, err\n\t\t}\n\t\tgvrTargets[gvr] = true\n\t}\n\treturn gvrTargets, nil\n}", "title": "" }, { "docid": "240c676b649834c5d191987ba3dde50a", "score": "0.4751783", "text": "func (DB *BlanketBoltDB) GetWorkers() ([]worker.WorkerConf, error) {\n\tvar err error\n\tws := []worker.WorkerConf{}\n\n\terr = DB.db.View(func(tx *bolt.Tx) error {\n\t\tvar err error\n\n\t\tb := tx.Bucket([]byte(BOLTDB_WORKER_BUCKET))\n\t\tif b == nil {\n\t\t\treturn MakeBucketDNEError(BOLTDB_WORKER_BUCKET)\n\t\t}\n\n\t\tc := b.Cursor()\n\t\tfor k, v := c.First(); k != nil; k, v = c.Next() {\n\t\t\tw := worker.WorkerConf{}\n\t\t\terr = json.Unmarshal(v, &w)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tws = append(ws, w)\n\t\t}\n\t\treturn nil\n\t})\n\n\treturn ws, err\n}", "title": "" }, { "docid": "c9a03c4dee9c1e5eb945c0e7dfe06955", "score": "0.4742629", "text": "func (t *ProcurementChaincode) QueryWorkFlowList(stub shim.ChaincodeStubInterface, ponumber string) pb.Response {\n\t//queryString := fmt.Sprintf(\"{\\\"selector\\\":{\\\"doctype\\\":\\\"WORKFLOW\\\",\\\"ponumber\\\":\\\"%s\\\"}}\", ponumber)\n\tqueryString := fmt.Sprintf(\"{\\\"selector\\\":{\\\"doctype\\\":\\\"WORKFLOW\\\"}}\")\n\tqueryResults, err := itpProcUtils.GetQueryResultForQueryString(stub, queryString)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\n\treturn shim.Success(queryResults)\n\n}", "title": "" }, { "docid": "7587001e1b04e4c82276f45aaeccade0", "score": "0.4741872", "text": "func (c *networkLoadbalancer) ListWorkRequests(ctx context.Context, compartmentId, nlbId string) ([]*GenericWorkRequest, error) {\n\tvar genericWorkRequests []*GenericWorkRequest\n\tvar page *string\n\tfor {\n\t\tif !c.rateLimiter.Reader.TryAccept() {\n\t\t\treturn nil, RateLimitError(false, \"ListWorkRequest\")\n\t\t}\n\t\tresp, err := c.networkloadbalancer.ListWorkRequests(ctx, networkloadbalancer.ListWorkRequestsRequest{\n\t\t\tCompartmentId: &compartmentId,\n\t\t\tPage: page,\n\t\t\tLimit: common.Int(ListWorkRequestLimit),\n\t\t\tRequestMetadata: c.requestMetadata,\n\t\t})\n\t\tincRequestCounter(err, listVerb, workRequestResource)\n\t\tif err != nil {\n\t\t\treturn nil, errors.WithStack(err)\n\t\t}\n\t\tfor _, wr := range resp.Items {\n\t\t\tfor _, r := range wr.Resources {\n\t\t\t\tif r.Identifier != nil && *r.Identifier == nlbId {\n\t\t\t\t\tgenericWorkRequests = append(genericWorkRequests, c.workRequestToGenericWorkRequest((*networkloadbalancer.WorkRequest)(&wr)))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif page = resp.OpcNextPage; page == nil {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn genericWorkRequests, nil\n}", "title": "" }, { "docid": "addb8ce7f11c8a666c21ef1af170eef9", "score": "0.47416222", "text": "func NewWorkloadsCommand(c types.Args, ioStreams cmdutil.IOStreams) *cobra.Command {\n\tvar enforceRefresh bool\n\tctx := context.Background()\n\tcmd := &cobra.Command{\n\t\tUse: \"workloads\",\n\t\tDisableFlagsInUseLine: true,\n\t\tShort: \"List workloads\",\n\t\tLong: \"List workloads\",\n\t\tExample: `vela workloads`,\n\t\tPersistentPreRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\treturn c.SetConfig()\n\t\t},\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\n\t\t\tif err := RefreshDefinitions(ctx, c, ioStreams, true, enforceRefresh); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tworkloads, err := plugins.LoadInstalledCapabilityWithType(types.TypeWorkload)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn printWorkloadList(workloads, ioStreams)\n\t\t},\n\t\tAnnotations: map[string]string{\n\t\t\ttypes.TagCommandType: types.TypeCap,\n\t\t},\n\t}\n\tcmd.SetOut(ioStreams.Out)\n\tcmd.Flags().BoolVarP(&enforceRefresh, \"\", \"r\", false, \"Enforce refresh from cluster even if cache is not expired\")\n\treturn cmd\n}", "title": "" }, { "docid": "fe32a1e18ace911fc98fd9e7120a323a", "score": "0.47303587", "text": "func (p *Work) Global() []Work {\n\treturn globalwork\n}", "title": "" }, { "docid": "c2cce8369ea0203e62643058f93c3644", "score": "0.47221574", "text": "func (d *Director) GetPending() []*worker.Work {\n\td.Lock()\n\tdefer d.Unlock()\n\tpending := []*worker.Work{}\n\tfor work, _ := range d.pending {\n\t\tpending = append(pending, work)\n\t}\n\treturn pending\n}", "title": "" }, { "docid": "1a104bf8833f65b22779aa3eb3c6d200", "score": "0.47218984", "text": "func (in *AppService) fetchWorkloadsPerApp(namespace, labelSelector string) (appsWorkload, error) {\n\tcfg := config.Get()\n\n\tws, err := fetchWorkloads(in.k8s, namespace, labelSelector)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tapps := make(appsWorkload)\n\tfor _, w := range ws {\n\t\tif appLabel, ok := w.Labels[cfg.IstioLabels.AppLabelName]; ok {\n\t\t\tapps[appLabel] = append(apps[appLabel], w)\n\t\t}\n\t}\n\treturn apps, nil\n}", "title": "" }, { "docid": "23025bacd23b49278ae5f358364d1b35", "score": "0.47199866", "text": "func (m *WorkflowTemplate) GetExecutionConditions()(WorkflowExecutionConditionsable) {\n val, err := m.GetBackingStore().Get(\"executionConditions\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(WorkflowExecutionConditionsable)\n }\n return nil\n}", "title": "" }, { "docid": "e07cd489f3bd3dd8543b89251df538b6", "score": "0.47074518", "text": "func (bq *InMemoryBuildQueue) ListWorkers(ctx context.Context, request *buildqueuestate.ListWorkersRequest) (*buildqueuestate.ListWorkersResponse, error) {\n\tvar startAfterWorkerKey *string\n\tif startAfter := request.StartAfter; startAfter != nil {\n\t\tworkerKey := string(newWorkerKey(startAfter.WorkerId))\n\t\tstartAfterWorkerKey = &workerKey\n\t}\n\n\tbq.enter(bq.clock.Now())\n\tdefer bq.leave()\n\n\t// Obtain IDs of all workers in sorted order.\n\tvar scq *sizeClassQueue\n\tvar keyList []string\n\tswitch filter := request.Filter.GetType().(type) {\n\tcase *buildqueuestate.ListWorkersRequest_Filter_All:\n\t\tvar err error\n\t\tscq, err = bq.getSizeClassQueueByName(filter.All)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor workerKey := range scq.workers {\n\t\t\tkeyList = append(keyList, string(workerKey))\n\t\t}\n\tcase *buildqueuestate.ListWorkersRequest_Filter_Executing:\n\t\tvar i *invocation\n\t\tvar err error\n\t\ti, scq, err = bq.getInvocationByName(filter.Executing)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor w := range i.executingWorkers {\n\t\t\tkeyList = append(keyList, string(w.workerKey))\n\t\t}\n\tcase *buildqueuestate.ListWorkersRequest_Filter_IdleSynchronizing:\n\t\tvar i *invocation\n\t\tvar err error\n\t\ti, scq, err = bq.getInvocationByName(filter.IdleSynchronizing)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor _, entry := range i.idleSynchronizingWorkers {\n\t\t\tkeyList = append(keyList, string(entry.worker.workerKey))\n\t\t}\n\tdefault:\n\t\treturn nil, status.Error(codes.InvalidArgument, \"Unknown filter provided\")\n\t}\n\tsort.Strings(keyList)\n\tpaginationInfo, endIndex := getPaginationInfo(len(keyList), request.PageSize, func(i int) bool {\n\t\treturn startAfterWorkerKey == nil || keyList[i] > *startAfterWorkerKey\n\t})\n\n\t// Extract status.\n\tkeyListRegion := keyList[paginationInfo.StartIndex:endIndex]\n\tworkers := make([]*buildqueuestate.WorkerState, 0, len(keyListRegion))\n\tfor _, key := range keyListRegion {\n\t\tworkerKey := workerKey(key)\n\t\tw := scq.workers[workerKey]\n\t\tvar currentOperation *buildqueuestate.OperationState\n\t\tif t := w.currentTask; t != nil {\n\t\t\t// A task may have more than one operation\n\t\t\t// associated with it, in case deduplication of\n\t\t\t// in-flight requests occurred. For the time\n\t\t\t// being, let's not expose the concept of tasks\n\t\t\t// through the web UI yet. Just show one of the\n\t\t\t// operations.\n\t\t\t//\n\t\t\t// Do make this deterministic by picking the\n\t\t\t// operation with the lowest name,\n\t\t\t// alphabetically.\n\t\t\tvar o *operation\n\t\t\tfor _, oCheck := range t.operations {\n\t\t\t\tif o == nil || o.name > oCheck.name {\n\t\t\t\t\to = oCheck\n\t\t\t\t}\n\t\t\t}\n\t\t\tcurrentOperation = o.getOperationState(bq)\n\t\t\tcurrentOperation.InvocationName = nil\n\t\t\tcurrentOperation.Stage = nil\n\t\t}\n\t\tworkerID := workerKey.getWorkerID()\n\t\tworkers = append(workers, &buildqueuestate.WorkerState{\n\t\t\tId: workerID,\n\t\t\tTimeout: bq.cleanupQueue.getTimestamp(w.cleanupKey),\n\t\t\tCurrentOperation: currentOperation,\n\t\t\tDrained: w.isDrained(scq, workerID),\n\t\t})\n\t}\n\treturn &buildqueuestate.ListWorkersResponse{\n\t\tWorkers: workers,\n\t\tPaginationInfo: paginationInfo,\n\t}, nil\n}", "title": "" }, { "docid": "ef9da627ebaf0dfd6bee3ba6fe399078", "score": "0.47030106", "text": "func (t Topic) Workload() string { return t.wkld }", "title": "" }, { "docid": "8fd2d13fc01ed10095e2f716e6512262", "score": "0.4702891", "text": "func getWork() ([]string, bool) {\n\tvar r []string\n\tvar ok bool\n\n\tselect {\n\tcase <-closed:\n\t\t// peculiar to increasing load test, refactor\n\t\tif conf.Debug {\n\t\t\tlog.Print(\"pipe closed, no more requests to process.\\n\")\n\t\t}\n\t\treturn nil, true\n\tcase r, ok = <-pipe:\n\t\tif !ok {\n\t\t\t// We're at eof\n\t\t\treturn nil, true\n\t\t}\n\t\tif conf.Debug {\n\t\t\tlog.Printf(\"got %v\\n\", r)\n\t\t}\n\t\treturn r, false\n\t}\n}", "title": "" }, { "docid": "5fd595552c603ca9bdc31c3cd6715c6e", "score": "0.4699377", "text": "func (p *PovApi) GetWork(minerAddr types.Address, algoName string) (*PovApiGetWork, error) {\n\tvar rspData PovApiGetWork\n\terr := p.client.getClient().Call(&rspData, \"pov_getWork\", minerAddr, algoName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &rspData, nil\n}", "title": "" }, { "docid": "575b16ad46e4b8fa7c2b9ff1fb1ebce5", "score": "0.46951208", "text": "func (s *Swamp) GetWorkers() (int, int, int) {\n\ts.mu.RLock()\n\tdefer s.mu.RUnlock()\n\treturn s.pool.MaxWorkers(), s.pool.RunningWorkers(), s.pool.IdleWorkers()\n}", "title": "" }, { "docid": "b6b465d97a954d86849feb9b2074c2f1", "score": "0.46870646", "text": "func GetCPU() ([]PartInfo, error) {\n\treturn genDownload(cpuURL)\n}", "title": "" }, { "docid": "71d255fe781c15020e136009a12d06c4", "score": "0.468683", "text": "func (rsc *RunCatalog) getRunJobs() (JobServiceState, []string, []RunJob, []string, []RunJob, []string, []historyJobFile, []computeItem) {\n\n\trsc.rscLock.Lock()\n\tdefer rsc.rscLock.Unlock()\n\n\t// jobs queue: sort in order of submission stamps, which user may change through UI\n\tqKeys := make([]string, len(rsc.queueKeys))\n\tqJobs := make([]RunJob, len(rsc.queueKeys))\n\tfor k, stamp := range rsc.queueKeys {\n\t\tqKeys[k] = stamp\n\t\tqJobs[k] = rsc.queueJobs[stamp].RunJob\n\t}\n\n\t// active jobs: sort by submission time\n\taKeys := make([]string, len(rsc.activeJobs))\n\tn := 0\n\tfor stamp := range rsc.activeJobs {\n\t\taKeys[n] = stamp\n\t\tn++\n\t}\n\tsort.Strings(aKeys)\n\n\taJobs := make([]RunJob, len(aKeys))\n\tfor k, stamp := range aKeys {\n\t\taJobs[k] = rsc.activeJobs[stamp].RunJob\n\t}\n\n\t// history jobs: sort by submission time\n\thKeys := make([]string, len(rsc.historyJobs))\n\tn = 0\n\tfor stamp := range rsc.historyJobs {\n\t\thKeys[n] = stamp\n\t\tn++\n\t}\n\tsort.Strings(hKeys)\n\n\thJobs := make([]historyJobFile, len(hKeys))\n\tfor k, stamp := range hKeys {\n\t\thJobs[k] = rsc.historyJobs[stamp]\n\t}\n\n\t// get computational servers state, sorted by name\n\tcN := make([]string, len(rsc.computeState))\n\n\tnp := 0\n\tfor name := range rsc.computeState {\n\t\tcN[np] = name\n\t\tnp++\n\t}\n\tsort.Strings(cN)\n\n\tcState := make([]computeItem, len(rsc.computeState))\n\n\tfor k := 0; k < len(cN); k++ {\n\t\tcs := rsc.computeState[cN[k]]\n\t\tcState[k] = cs\n\t\tcState[k].startArgs = []string{}\n\t\tcState[k].stopArgs = []string{}\n\t}\n\n\treturn rsc.JobServiceState, qKeys, qJobs, aKeys, aJobs, hKeys, hJobs, cState\n}", "title": "" }, { "docid": "41fba945dbe3b20f8dc7043d0c3af8a3", "score": "0.46848303", "text": "func (m *WorkflowTemplate) GetTasks()([]Taskable) {\n val, err := m.GetBackingStore().Get(\"tasks\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]Taskable)\n }\n return nil\n}", "title": "" }, { "docid": "7cbaf287f3cf347b74eb8fbf72c63fd0", "score": "0.46762612", "text": "func (client KamClient) ListWorkRequests(ctx context.Context, request ListWorkRequestsRequest) (response ListWorkRequestsResponse, err error) {\n\tvar ociResponse common.OCIResponse\n\tpolicy := common.NoRetryPolicy()\n\tif client.RetryPolicy() != nil {\n\t\tpolicy = *client.RetryPolicy()\n\t}\n\tif request.RetryPolicy() != nil {\n\t\tpolicy = *request.RetryPolicy()\n\t}\n\tociResponse, err = common.Retry(ctx, request, client.listWorkRequests, policy)\n\tif err != nil {\n\t\tif ociResponse != nil {\n\t\t\tif httpResponse := ociResponse.HTTPResponse(); httpResponse != nil {\n\t\t\t\topcRequestId := httpResponse.Header.Get(\"opc-request-id\")\n\t\t\t\tresponse = ListWorkRequestsResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId}\n\t\t\t} else {\n\t\t\t\tresponse = ListWorkRequestsResponse{}\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\tif convertedResponse, ok := ociResponse.(ListWorkRequestsResponse); ok {\n\t\tresponse = convertedResponse\n\t} else {\n\t\terr = fmt.Errorf(\"failed to convert OCIResponse into ListWorkRequestsResponse\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "b65a8a9aa3da6998dfeac0f77007ce64", "score": "0.46760014", "text": "func (ws *WorkflowStore) GetWorkflows(ctx context.Context, name *string) []*domain.Workflow {\n\tresult := []*domain.Workflow{}\n\tif name != nil {\n\t\twf := &domain.Workflow{}\n\t\terr := ws.store.Get(name, wf)\n\t\tif err == nil {\n\t\t\tresult = append(result, wf)\n\t\t}\n\t\treturn result\n\t}\n\n\terr := ws.store.Find(&result, nil)\n\tif err != nil {\n\t\treturn result\n\t}\n\treturn result\n}", "title": "" }, { "docid": "1c8653eae30aa08755666c0c57a7360c", "score": "0.4668264", "text": "func getHeavyWorkload(t *testing.T) vfs.FS {\n\theavyWorkload.Once.Do(func() {\n\t\tt.Run(\"buildHeavyWorkload\", func(t *testing.T) {\n\t\t\theavyWorkload.fs = buildHeavyWorkload(t)\n\t\t})\n\t})\n\treturn heavyWorkload.fs\n}", "title": "" }, { "docid": "6852eb97702d562d7143eac804c08855", "score": "0.4667894", "text": "func (a *Client) ListWorkstations(params *ListWorkstationsParams) (*ListWorkstationsOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewListWorkstationsParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"listWorkstations\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/fleet/tenant/{tenantId}/brand/{brandId}/country/{countryId}/store/{storeId}/workstation\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &ListWorkstationsReader{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.(*ListWorkstationsOK), nil\n\n}", "title": "" }, { "docid": "c6386658978c118fb492851230b43835", "score": "0.4658973", "text": "func (w *WorkflowBackend) GetWorkflowRuns(ctx context.Context, wf *domain.Workflow, filter *domain.WorkflowRunFilter) ([]*domain.WorkflowRun, error) {\n\tlabelSelector := fmt.Sprintf(\"%s=%s\", LabelWorkflowRef, wf.Name)\n\tif filter.CodesetName != \"\" {\n\t\tlabelSelector = fmt.Sprintf(\"%s,%s=%s\", labelSelector, LabelCodesetName, filter.CodesetName)\n\t}\n\tif filter.CodesetProject != \"\" {\n\t\tlabelSelector = fmt.Sprintf(\"%s,%s=%s\", labelSelector, LabelCodesetProject, filter.CodesetProject)\n\t}\n\truns, err := w.tektonClients.PipelineRunClient.List(ctx, metav1.ListOptions{LabelSelector: labelSelector})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error getting tekton pipeline run %q: %w\", wf.Name, err)\n\t}\n\tworkflowRuns := []*domain.WorkflowRun{}\n\n\tif filter.Status != nil && len(filter.Status) > 0 {\n\t\tfor _, run := range runs.Items {\n\t\t\tif len(run.Status.Conditions) > 0 && util.StringInSlice(\n\t\t\t\tpipelineReasonToWorkflowStatus(run.Status.Conditions[0].Reason), filter.Status) {\n\t\t\t\tworkflowRuns = append(workflowRuns, w.toWorkflowRun(wf, run))\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfor _, run := range runs.Items {\n\t\t\tworkflowRuns = append(workflowRuns, w.toWorkflowRun(wf, run))\n\t\t}\n\t}\n\treturn workflowRuns, nil\n}", "title": "" }, { "docid": "41da64d07c53a72b6b4dabdda3a442bc", "score": "0.4644971", "text": "func (p *OnPrem) GetInstances(ctx *lepton.Context) (instances []lepton.CloudInstance, err error) {\n\topshome := lepton.GetOpsHome()\n\tinstancesPath := path.Join(opshome, \"instances\")\n\n\tfiles, err := ioutil.ReadDir(instancesPath)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor _, f := range files {\n\t\tfullpath := path.Join(instancesPath, f.Name())\n\n\t\tpid, err := strconv.ParseInt(f.Name(), 10, 32)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tprocess, err := os.FindProcess(int(pid))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif err = process.Signal(syscall.Signal(0)); err != nil {\n\t\t\terrMsg := strings.ToLower(err.Error())\n\t\t\tif strings.Contains(errMsg, \"already finished\") ||\n\t\t\t\tstrings.Contains(errMsg, \"already released\") ||\n\t\t\t\tstrings.Contains(errMsg, \"not initialized\") {\n\t\t\t\tos.Remove(fullpath)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tbody, err := ioutil.ReadFile(fullpath)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tvar i instance\n\t\tif err := json.Unmarshal(body, &i); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tinstances = append(instances, lepton.CloudInstance{\n\t\t\tID: f.Name(),\n\t\t\tName: i.Instance,\n\t\t\tImage: i.Image,\n\t\t\tStatus: \"Running\",\n\t\t\tCreated: lepton.Time2Human(f.ModTime()),\n\t\t\tPrivateIps: []string{\"127.0.0.1\"},\n\t\t\tPublicIps: strings.Split(i.portList(), \",\"),\n\t\t})\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "fa67e4fbc99b08d521e89ee81f403aea", "score": "0.4629613", "text": "func (r *Reconciler) getCurrentMachinePools(ctx context.Context, s *scope.Scope) (sets.Set[string], error) {\n\t// TODO: We should consider using PartialObjectMetadataList here. Currently this doesn't work as our\n\t// implementation for topology dryrun doesn't support PartialObjectMetadataList.\n\tmpList := &expv1.MachinePoolList{}\n\terr := r.APIReader.List(ctx, mpList,\n\t\tclient.MatchingLabels{\n\t\t\tclusterv1.ClusterNameLabel: s.Current.Cluster.Name,\n\t\t\tclusterv1.ClusterTopologyOwnedLabel: \"\",\n\t\t},\n\t\tclient.InNamespace(s.Current.Cluster.Namespace),\n\t)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to read MachinePools for managed topology\")\n\t}\n\n\tcurrentMPs := sets.Set[string]{}\n\tfor _, mp := range mpList.Items {\n\t\tmpTopologyName, ok := mp.ObjectMeta.Labels[clusterv1.ClusterTopologyMachinePoolNameLabel]\n\t\tif ok || mpTopologyName != \"\" {\n\t\t\tcurrentMPs.Insert(mpTopologyName)\n\t\t}\n\t}\n\treturn currentMPs, nil\n}", "title": "" }, { "docid": "31d879e0665386dae7f73aa88ab8419f", "score": "0.4626197", "text": "func WorkloadGroup_Of(c constructs.IConstruct) cdk8s.ApiObject {\n\t_init_.Initialize()\n\n\tvar returns cdk8s.ApiObject\n\n\t_jsii_.StaticInvoke(\n\t\t\"networkingistioio.WorkloadGroup\",\n\t\t\"of\",\n\t\t[]interface{}{c},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "f53b92a290740a6e345e2366fab79d62", "score": "0.46187663", "text": "func (d *DispatcherPool) RetriveWorker() []*Worker {\n\treturn d.workers\n}", "title": "" }, { "docid": "809e5febc3cd45e17fdeeafe4a65a393", "score": "0.46174213", "text": "func (client *Client) GetWorkload(workloadID string) (types.Workload, error) {\n\tvar wl types.Workload\n\n\turl, err := client.getCiaoWorkloadsResource()\n\tif err != nil {\n\t\treturn wl, errors.Wrap(err, \"Error getting workloads resource\")\n\t}\n\n\turl = fmt.Sprintf(\"%s/%s\", url, workloadID)\n\terr = client.getResource(url, api.WorkloadsV1, nil, &wl)\n\n\treturn wl, err\n}", "title": "" }, { "docid": "915401f3ae43c2947e35765b5d3e32df", "score": "0.46173808", "text": "func (pr Result) GetJobs() []*repository.Job {\n return pr.jobs\n}", "title": "" }, { "docid": "3c0cdae04e64d119891c653742530cca", "score": "0.4616464", "text": "func GetWorksheets() {\n\n\tfiles, err := ioutil.ReadDir(sourcePath)\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfor _, file := range files {\n\n\t\tif IsPDF(file) && IsNumber(file) {\n\n\t\t\tAppendToWorksheets(file)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "71dfbd0354741b491d0867e5ad840454", "score": "0.4604632", "text": "func (c *criOClient) IgnoreRunningWorkloads() {\n\tc.cri.IgnoreRunningWorkloads()\n}", "title": "" }, { "docid": "43da41d32ae4c10b97d598d7221b1b1a", "score": "0.46021622", "text": "func (h *HatcheryLocal) WorkersStarted() []string {\n\th.Mutex.Lock()\n\tdefer h.Mutex.Unlock()\n\tworkers := make([]string, len(h.workers))\n\tvar i int\n\tfor n := range h.workers {\n\t\tworkers[i] = n\n\t\ti++\n\t}\n\treturn workers\n}", "title": "" }, { "docid": "15fefda3833ea61ecb1903e0fa6d354d", "score": "0.45928115", "text": "func (jobL) LoadWorksFors(e boil.Executor, singular bool, maybeJob interface{}) error {\n\tvar slice []*Job\n\tvar object *Job\n\n\tcount := 1\n\tif singular {\n\t\tobject = maybeJob.(*Job)\n\t} else {\n\t\tslice = *maybeJob.(*JobSlice)\n\t\tcount = len(slice)\n\t}\n\n\targs := make([]interface{}, count)\n\tif singular {\n\t\tif object.R == nil {\n\t\t\tobject.R = &jobR{}\n\t\t}\n\t\targs[0] = object.JobID\n\t} else {\n\t\tfor i, obj := range slice {\n\t\t\tif obj.R == nil {\n\t\t\t\tobj.R = &jobR{}\n\t\t\t}\n\t\t\targs[i] = obj.JobID\n\t\t}\n\t}\n\n\tquery := fmt.Sprintf(\n\t\t\"select * from \\\"works_for\\\" where \\\"job_id\\\" in (%s)\",\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, count, 1, 1),\n\t)\n\tif boil.DebugMode {\n\t\tfmt.Fprintf(boil.DebugWriter, \"%s\\n%v\\n\", query, args)\n\t}\n\n\tresults, err := e.Query(query, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to eager load works_for\")\n\t}\n\tdefer results.Close()\n\n\tvar resultSlice []*WorksFor\n\tif err = queries.Bind(results, &resultSlice); err != nil {\n\t\treturn errors.Wrap(err, \"failed to bind eager loaded slice works_for\")\n\t}\n\n\tif len(worksForAfterSelectHooks) != 0 {\n\t\tfor _, obj := range resultSlice {\n\t\t\tif err := obj.doAfterSelectHooks(e); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\tif singular {\n\t\tobject.R.WorksFors = resultSlice\n\t\treturn nil\n\t}\n\n\tfor _, foreign := range resultSlice {\n\t\tfor _, local := range slice {\n\t\t\tif local.JobID == foreign.JobID {\n\t\t\t\tlocal.R.WorksFors = append(local.R.WorksFors, foreign)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f4b03ad31e4417b55169aae92e43602a", "score": "0.45673352", "text": "func (s *Server) loadWorkingSet() error {\n\tworkingMutex.Lock()\n\tdefer workingMutex.Unlock()\n\n\taddedCount := 0\n\terr := s.store.Working().Each(func(_ int, _ []byte, data []byte) error {\n\t\tvar res Reservation\n\t\terr := json.Unmarshal(data, &res)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tworkingMap[res.Job.Jid] = &res\n\t\taddedCount++\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tif addedCount > 0 {\n\t\tutil.Debugf(\"Bootstrapped working set, loaded %d\", addedCount)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "e6ac4ed591d2b65a8bebafb8db69f23d", "score": "0.45619628", "text": "func GetRunningJobs(cluster string) ([]*model.Job, error) {\n\t// Check if database connection is open\n\tif database == nil {\n\t\treturn nil, errors.New(\"database connection is not open\")\n\t}\n\n\t// Query jobs\n\tquery := `SELECT ID, CreationTimestamp, ExecutablePath, Type, Status, Priority,\n\t\t\tPredictedDuration, FailureProbability, Arguments, PlatformDependentID \n\t\t\t\tFROM Job WHERE Status='running' AND ClusterName=$1`\n\trows, err := database.Query(query, cluster)\n\tdefer rows.Close()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn extractJobsFromRows(rows)\n}", "title": "" }, { "docid": "02f4415932700d393c9a73c73827d58a", "score": "0.45465192", "text": "func Work() {\n\twork(context.Background(), 0)\n}", "title": "" }, { "docid": "dc178167efc6641b0d7f254204bb7af4", "score": "0.45424294", "text": "func WorkloadDetails(w http.ResponseWriter, r *http.Request) {\n\tp := workloadParams{}\n\tp.extract(r)\n\n\tcriteria := business.WorkloadCriteria{Namespace: p.Namespace, WorkloadName: p.WorkloadName,\n\t\tWorkloadType: p.WorkloadType, IncludeIstioResources: true, IncludeServices: true, IncludeHealth: p.IncludeHealth, RateInterval: p.RateInterval,\n\t\tQueryTime: p.QueryTime, Cluster: p.ClusterName}\n\n\t// Get business layer\n\tbusiness, err := getBusiness(r)\n\tif err != nil {\n\t\tRespondWithError(w, http.StatusInternalServerError, \"Workloads initialization error: \"+err.Error())\n\t\treturn\n\t}\n\n\tincludeValidations := false\n\tif p.IncludeIstioResources {\n\t\tincludeValidations = true\n\t}\n\n\tistioConfigValidations := models.IstioValidations{}\n\tvar errValidations error\n\n\twg := sync.WaitGroup{}\n\tif includeValidations {\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tdefer wg.Done()\n\t\t\tistioConfigValidations, errValidations = business.Validations.GetValidations(r.Context(), criteria.Cluster, criteria.Namespace, \"\", criteria.WorkloadName)\n\t\t}()\n\t}\n\n\t// Fetch and build workload\n\tworkloadDetails, err := business.Workload.GetWorkload(r.Context(), criteria)\n\tif includeValidations && err == nil {\n\t\twg.Wait()\n\t\tworkloadDetails.Validations = istioConfigValidations\n\t\terr = errValidations\n\t}\n\n\tif criteria.IncludeHealth && err == nil {\n\t\tworkloadDetails.Health, err = business.Health.GetWorkloadHealth(r.Context(), criteria.Namespace, criteria.Cluster, criteria.WorkloadName, criteria.RateInterval, criteria.QueryTime, workloadDetails)\n\t\tif err != nil {\n\t\t\thandleErrorResponse(w, err)\n\t\t}\n\t}\n\n\tif err != nil {\n\t\thandleErrorResponse(w, err)\n\t\treturn\n\t}\n\n\tRespondWithJSON(w, http.StatusOK, workloadDetails)\n}", "title": "" }, { "docid": "719740607708408ccd868a120769d7bd", "score": "0.45400602", "text": "func (t *MServer) GetWorkers(req *GetWorkersReq, res *GetWorkersRes) error {\n\tres.WorkerIPsList = workers\n\treturn nil\n}", "title": "" }, { "docid": "4295f9535d22ed44a2d0bd02466e3df9", "score": "0.4534184", "text": "func All(ctx context.Context, retryInterval time.Duration, workers map[string]Worker, maxGs int) map[string]Result {\n\tresults := make(map[string]Result)\n\n\tswitch {\n\tcase maxGs <= 0 || maxGs >= len(workers):\n\t\tfor result := range workMap(ctx, retryInterval, workers) {\n\t\t\tresults[result.name] = result.Result\n\t\t}\n\tdefault:\n\t\tfor result := range workPool(ctx, retryInterval, workers, maxGs) {\n\t\t\tresults[result.name] = result.Result\n\t\t}\n\t}\n\n\treturn results\n}", "title": "" }, { "docid": "e96a6ea2ad6527adb33352c44f0ddc01", "score": "0.45296738", "text": "func GetWorkerNodes(c client.Client) ([]corev1.Node, error) {\n\tworkerNodes := &corev1.NodeList{}\n\terr := c.List(\n\t\tcontext.TODO(),\n\t\tworkerNodes,\n\t\tclient.InNamespace(NamespaceOpenShiftMachineAPI),\n\t\tclient.MatchingLabels(map[string]string{WorkerNodeRoleLabel: \"\"}),\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn workerNodes.Items, nil\n}", "title": "" }, { "docid": "89fb1bc6477f54ac1e4a585e7efd960f", "score": "0.45285267", "text": "func (qm *CQMgr) popWorks(req CoReq) (client_specific_workunits []*Workunit, err error) {\n\n\tclient_id := req.fromclient\n\n\tclient, ok, err := qm.clientMap.Get(client_id, true) // locks the clientmap\n\tif err != nil {\n\t\treturn\n\t}\n\tif !ok {\n\t\terr = fmt.Errorf(\"(popWorks) Client %s not found\", client_id)\n\t\treturn\n\t}\n\n\tlogger.Debug(3, \"(popWorks) starting for client: %s\", client_id)\n\n\tfiltered, stats, err := qm.filterWorkByClient(client)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"(popWorks) filterWorkByClient returned: %s\", err.Error())\n\t\treturn\n\t}\n\n\tif len(filtered) == 0 {\n\t\tvar stat_json_byte []byte\n\t\tstat_json_byte, err = json.Marshal(stats)\n\t\tif err != nil {\n\t\t\tstat_json_byte = []byte(\"failed\")\n\t\t}\n\t\tclient_group := \"\"\n\t\tclient_group, err = client.Get_Group(false)\n\t\tif err != nil {\n\t\t\tclient_group = \"\"\n\t\t}\n\t\tlogger.Error(\"(popWorks) filterWorkByClient returned no workunits for client %s (%s), stats: %s\", client_id, client_group, stat_json_byte)\n\t\terr = errors.New(e.NoEligibleWorkunitFound)\n\n\t\treturn\n\t}\n\tclient_specific_workunits, err = qm.workQueue.selectWorkunits(filtered, req.policy, req.available, req.count)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"(popWorks) selectWorkunits returned: %s\", err.Error())\n\t\treturn\n\t}\n\t//get workunits successfully, put them into coWorkMap\n\tfor _, work := range client_specific_workunits {\n\t\twork.Client = client_id\n\t\twork.CheckoutTime = time.Now()\n\t\t//qm.workQueue.Put(work) TODO isn't that already in the queue ?\n\t\tqm.workQueue.StatusChange(work.Workunit_Unique_Identifier, work, WORK_STAT_CHECKOUT, \"\")\n\t}\n\n\tlogger.Debug(3, \"(popWorks) done with client: %s \", client_id)\n\treturn\n}", "title": "" }, { "docid": "7f114e050d8d6b90a21aff8d0d580107", "score": "0.4527028", "text": "func (h *HatcheryOpenstack) WorkersStarted(ctx context.Context) ([]string, error) {\n\tsrvs := h.getServers(ctx)\n\tres := make([]string, len(srvs))\n\tfor i, s := range srvs {\n\t\tres[i] = s.Metadata[\"worker\"]\n\t}\n\treturn res, nil\n}", "title": "" }, { "docid": "5a7e13b6af1d3f8b0ff7e094bfe992de", "score": "0.45203185", "text": "func WorkflowRunsPath() string {\n\treturn \"workflowruns\"\n}", "title": "" }, { "docid": "aac1e1a39f88194685c1f2e423a225f3", "score": "0.45199633", "text": "func GetWorkerNodes(c client.Client) ([]corev1.Node, error) {\n\tworkerNodes := &corev1.NodeList{}\n\terr := c.List(context.TODO(), workerNodes,\n\t\tclient.InNamespace(MachineAPINamespace),\n\t\tclient.MatchingLabels(map[string]string{WorkerNodeRoleLabel: \"\"}),\n\t)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn workerNodes.Items, nil\n}", "title": "" }, { "docid": "876e79636b1a5df9bda38c33ad819c8b", "score": "0.4514289", "text": "func GetJobs() (jobs []string) {\n\tjobPaths, _ := ioutil.ReadDir(filepath.Join(configCtlHome, \"jobs\"))\n\tfor _, c := range jobPaths {\n\t\tjobs = append(jobs, filepath.Base(c.Name()))\n\t}\n\n\treturn jobs\n}", "title": "" }, { "docid": "d687f38d54f5ced4eb9b86faca6079cf", "score": "0.45078635", "text": "func (s storage) workflowList(sess *xorm.Session, pipeline *model.Pipeline) ([]*model.Workflow, error) {\n\tvar wfList []*model.Workflow\n\terr := sess.Where(\"workflow_pipeline_id = ?\", pipeline.ID).\n\t\tOrderBy(\"workflow_pid\").\n\t\tFind(&wfList)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn wfList, nil\n}", "title": "" }, { "docid": "be0d4000ffaef4b9786565ea8e6ce7b7", "score": "0.45077813", "text": "func (m *PlannerBucket) GetTasks()([]PlannerTaskable) {\n val, err := m.GetBackingStore().Get(\"tasks\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]PlannerTaskable)\n }\n return nil\n}", "title": "" }, { "docid": "df66623ae513e7c5b81f1272206cfdde", "score": "0.4501319", "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:databricks/v20210401preview:Workspace\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "55ae889a23a5c145c997320639c7c4a3", "score": "0.44921476", "text": "func (p *Plugin) Workers(name string) []*process.State {\n\tsvc, ok := p.withWorkers[name]\n\tif !ok {\n\t\treturn nil\n\t}\n\n\treturn svc.Workers()\n}", "title": "" }, { "docid": "96921d84cd17fe3af3e66014e478b397", "score": "0.4476579", "text": "func (d *Deployment) Get(name Name) (*WorkloadWithID, error) {\n\tif err := IsValidName(name); err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor i := range d.Workloads {\n\t\twl := &d.Workloads[i]\n\t\tif wl.Name == name {\n\t\t\tid, _ := NewWorkloadID(d.TwinID, d.ContractID, name)\n\t\t\treturn &WorkloadWithID{\n\t\t\t\tWorkload: wl,\n\t\t\t\tID: id,\n\t\t\t}, nil\n\t\t}\n\t}\n\n\treturn nil, errors.Wrapf(ErrWorkloadNotFound, \"no workload with name '%s'\", name)\n}", "title": "" }, { "docid": "9db4f6073b015d3d878b1f1d2524120b", "score": "0.44718242", "text": "func Work() error {\n\tvar err error\n\tlogger, err = seelog.LoggerFromWriterWithMinLevel(os.Stdout, seelog.InfoLvl)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := flags(); err != nil {\n\t\treturn err\n\t}\n\n\tquit := Signals()\n\n\tpool := newRedisPool(uri, connections, connections, time.Minute)\n\tdefer pool.Close()\n\n\tpoller, err := newPoller(queues, isStrict)\n\tif err != nil {\n\t\treturn err\n\t}\n\tjobs := poller.poll(pool, time.Duration(interval), quit)\n\n\tvar monitor sync.WaitGroup\n\n\tfor id := 0; id < concurrency; id++ {\n\t\tworker, err := newWorker(strconv.Itoa(id), queues)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tworker.work(pool, jobs, &monitor)\n\t}\n\n\tmonitor.Wait()\n\n\treturn nil\n}", "title": "" }, { "docid": "a48e013747dc6a7bfa97eba5adc49ce6", "score": "0.44712892", "text": "func (m *EntitiesSummary) GetWorkloadCount()(*int64) {\n val, err := m.GetBackingStore().Get(\"workloadCount\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*int64)\n }\n return nil\n}", "title": "" }, { "docid": "8946d46fdc246c22792002c4325fa45e", "score": "0.44646832", "text": "func (b *gosBackend) List(c *Context) {\n b.RunDefaultWorker(c, b.storage.List, b.upstream.List)\n}", "title": "" }, { "docid": "7cdd62f1d18f03f21d232efd9efd7238", "score": "0.44631577", "text": "func (o *InlineResponse200120) GetWorkload() []InlineResponse200120Workload {\n\tif o == nil || o.Workload == nil {\n\t\tvar ret []InlineResponse200120Workload\n\t\treturn ret\n\t}\n\treturn *o.Workload\n}", "title": "" }, { "docid": "825a65af8c681442733a7e820fa1d093", "score": "0.44403532", "text": "func loadAll(db gorp.SqlExecutor, withPassword bool, query string, args ...interface{}) ([]sdk.Model, error) {\n\twms := []dbResultWMS{}\n\tif _, err := db.Select(&wms, query, args...); err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\treturn nil, sdk.WithStack(sdk.ErrNoWorkerModel)\n\t\t}\n\t\treturn nil, sdk.WithStack(err)\n\t}\n\tif len(wms) == 0 {\n\t\treturn []sdk.Model{}, nil\n\t}\n\tr, err := scanAll(db, wms, withPassword)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn r, nil\n}", "title": "" }, { "docid": "6d4fa1626f5334f2452a77eed77357c6", "score": "0.4439175", "text": "func (self *Rsync) StartWork() {\n\tif self.recycler != nil {\n\t\tgo func() {\n\t\t\tself.recycler()\n\t\t}()\n\t}\n\tfor i := 0; i < self.Workers.maxProcesses; i++ {\n\t\tgo func() {\n\t\t\tfor{\n\t\t\t\tselect {\n\t\t\t\tcase rt,ok := <- self.Workers.TaskPool: // Task\n\t\t\t\t\tif ok {\n\t\t\t\t\t\tself.Sync(rt)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t}\n}", "title": "" } ]
8f1d79978ee7f386f141855bbabf5804
Ipv6NEQ applies the NEQ predicate on the "ipv6" field.
[ { "docid": "6abcbf203f742efae89f233e0b635c88", "score": "0.86292416", "text": "func Ipv6NEQ(v string) predicate.Node {\n\treturn predicate.Node(func(s *sql.Selector) {\n\t\ts.Where(sql.NEQ(s.C(FieldIpv6), v))\n\t})\n}", "title": "" } ]
[ { "docid": "6850c39696896a671603ad8afff48cb4", "score": "0.8065442", "text": "func PublicIpv6NEQ(v string) predicate.Node {\n\treturn predicate.Node(func(s *sql.Selector) {\n\t\ts.Where(sql.NEQ(s.C(FieldPublicIpv6), v))\n\t})\n}", "title": "" }, { "docid": "fdfd9591c0c92b8a26c6f666e9a98156", "score": "0.7867992", "text": "func Ipv6EQ(v string) predicate.Node {\n\treturn predicate.Node(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldIpv6), v))\n\t})\n}", "title": "" }, { "docid": "f76f21d5b818bf249dd3ca5fe15e21cc", "score": "0.7452253", "text": "func Ipv6(v string) predicate.Node {\n\treturn predicate.Node(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldIpv6), v))\n\t})\n}", "title": "" }, { "docid": "6a33f46a15f112eeea01de510ea4bda7", "score": "0.73077387", "text": "func Ipv6EqualFold(v string) predicate.Node {\n\treturn predicate.Node(func(s *sql.Selector) {\n\t\ts.Where(sql.EqualFold(s.C(FieldIpv6), v))\n\t})\n}", "title": "" }, { "docid": "dcc2ed3ed5bd9d9fd9089cb0119d9ec0", "score": "0.7233731", "text": "func Ipv6NotIn(vs ...string) predicate.Node {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Node(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(FieldIpv6), v...))\n\t})\n}", "title": "" }, { "docid": "56edfd8e895e712cf274e6759395a86b", "score": "0.70047635", "text": "func PublicIpv6EQ(v string) predicate.Node {\n\treturn predicate.Node(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldPublicIpv6), v))\n\t})\n}", "title": "" }, { "docid": "28f38c7ded15e403fba93b7bf28702e9", "score": "0.69100523", "text": "func Ipv6LTE(v string) predicate.Node {\n\treturn predicate.Node(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldIpv6), v))\n\t})\n}", "title": "" }, { "docid": "3d9cab7149d85dcb79dd777ba7a9e157", "score": "0.6777252", "text": "func PublicIpv6NotIn(vs ...string) predicate.Node {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Node(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(FieldPublicIpv6), v...))\n\t})\n}", "title": "" }, { "docid": "0b3a8ab9955b475f9a7d4c36db53a714", "score": "0.67215216", "text": "func Ipv6GTE(v string) predicate.Node {\n\treturn predicate.Node(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldIpv6), v))\n\t})\n}", "title": "" }, { "docid": "5749b6ec792b3a3eb10f2aa48cdc03d2", "score": "0.6692678", "text": "func Ipv6ContainsFold(v string) predicate.Node {\n\treturn predicate.Node(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldIpv6), v))\n\t})\n}", "title": "" }, { "docid": "aab4fa70bd03ad5b3d9658aec013466d", "score": "0.6654524", "text": "func Ipv4NEQ(v string) predicate.Node {\n\treturn predicate.Node(func(s *sql.Selector) {\n\t\ts.Where(sql.NEQ(s.C(FieldIpv4), v))\n\t})\n}", "title": "" }, { "docid": "e091cdfe239031280402af71ab04cf9a", "score": "0.6611118", "text": "func PublicIpv6EqualFold(v string) predicate.Node {\n\treturn predicate.Node(func(s *sql.Selector) {\n\t\ts.Where(sql.EqualFold(s.C(FieldPublicIpv6), v))\n\t})\n}", "title": "" }, { "docid": "f9b2af1cec1ebc44a318f6ba4e38be97", "score": "0.6585096", "text": "func Ipv6Contains(v string) predicate.Node {\n\treturn predicate.Node(func(s *sql.Selector) {\n\t\ts.Where(sql.Contains(s.C(FieldIpv6), v))\n\t})\n}", "title": "" }, { "docid": "f16c1a57c483f26b105efbf7ebec886d", "score": "0.65399534", "text": "func Ipv6In(vs ...string) predicate.Node {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Node(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(FieldIpv6), v...))\n\t})\n}", "title": "" }, { "docid": "2fbe62818593987fd9b425f2e226366f", "score": "0.6521617", "text": "func IPV6(message string) *Rule {\n\treturn NewRule(func(field string, value *gjson.Result, parent *gjson.Result, source *gjson.Result, violations *Violations, validator *Validator) {\n\t\tif IsEmpty(value) {\n\t\t\treturn\n\t\t}\n\n\t\tif !IsString(value) || !govalidator.IsIPv6(value.String()) {\n\t\t\tviolations.Add(field, message)\n\t\t}\n\t})\n}", "title": "" }, { "docid": "6b51564c60502a93ab774d21f6438977", "score": "0.6437021", "text": "func Ipv6GT(v string) predicate.Node {\n\treturn predicate.Node(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldIpv6), v))\n\t})\n}", "title": "" }, { "docid": "9bd73581735c912c1c371e96dcdc741b", "score": "0.6434069", "text": "func Ipv6HasSuffix(v string) predicate.Node {\n\treturn predicate.Node(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldIpv6), v))\n\t})\n}", "title": "" }, { "docid": "2a1e82b8d6ce4e41f4dae201c0154040", "score": "0.642633", "text": "func (o LookupNodeBalancerResultOutput) Ipv6() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupNodeBalancerResult) string { return v.Ipv6 }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "761cc8682bd16eda5c299d3a3a9479c6", "score": "0.63839245", "text": "func (c *Chance) Ipv6() string {\n\tsections := []string{}\n\tfor i := 0; i < 8; i++ {\n\t\tsections = append(sections, c.stringFromPool(4, data.Characters[\"hex\"]))\n\t}\n\treturn strings.Join(sections, \":\")\n}", "title": "" }, { "docid": "0e65659fe3f6f41d74fb1d73e517b5b2", "score": "0.6265834", "text": "func (g *GCETarget) IPv6() (*net.IPAddr, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "91dc0adf04daae1e3c69b429540023d3", "score": "0.62593913", "text": "func (f *Interface) V6() netip.Addr { return f.pickIP(netip.Addr.Is6) }", "title": "" }, { "docid": "8b443a6ef7b67043405c82486d35d500", "score": "0.6249676", "text": "func isIPv6(fl FieldLevel) bool {\n\n\tip := net.ParseIP(fl.Field().String())\n\n\treturn ip != nil && ip.To4() == nil\n}", "title": "" }, { "docid": "1b0d66ffac9471bddf7eea20dcefd8c2", "score": "0.62454426", "text": "func IsIPv6(netIP net.IP) bool {\n\treturn netIP != nil && netIP.To4() == nil\n}", "title": "" }, { "docid": "1b0d66ffac9471bddf7eea20dcefd8c2", "score": "0.62454426", "text": "func IsIPv6(netIP net.IP) bool {\n\treturn netIP != nil && netIP.To4() == nil\n}", "title": "" }, { "docid": "1b0d66ffac9471bddf7eea20dcefd8c2", "score": "0.62454426", "text": "func IsIPv6(netIP net.IP) bool {\n\treturn netIP != nil && netIP.To4() == nil\n}", "title": "" }, { "docid": "f74843cb8c114ab6395d246318c64d92", "score": "0.6236457", "text": "func checkIP6NetAddresses(direction filterDirection, addr net.IP, mask net.IPMask, fail, succeed uint8) []bpf.Instruction {\n\treturn checkIP6Addresses(direction, addr, mask, fail, succeed)\n}", "title": "" }, { "docid": "83121b62d89fa3bf20cee4bb249b14fb", "score": "0.62356204", "text": "func (o RouterBgpPeerOutput) Ipv6NexthopAddress() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v RouterBgpPeer) *string { return v.Ipv6NexthopAddress }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "fd07376e69e5346c8656e953f766bedf", "score": "0.6234608", "text": "func (t Testnet) IPv6() bool {\n\treturn t.IP.IP.To4() == nil\n}", "title": "" }, { "docid": "013403de5669a666d90cf9c6c8216615", "score": "0.62293816", "text": "func validateIPv6Network(fl validator.FieldLevel) bool {\n\tn := fl.Field().String()\n\tlog.Debugf(\"Validate IPv6 network: %s\", n)\n\terr := ValidateIPv6Network(n)\n\tif err != nil {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "7b9eeffa0070322763519f73e8e7b8fd", "score": "0.6159534", "text": "func (cn *connection) ipv6() bool {\n\tip := cn.remoteAddr.IP\n\tif ip.To4() != nil {\n\t\treturn false\n\t}\n\treturn len(ip) == net.IPv6len\n}", "title": "" }, { "docid": "fe8c2ca6055c123da968ee504cdb7daf", "score": "0.6148569", "text": "func (o RouterBgpPeerResponseOutput) Ipv6NexthopAddress() pulumi.StringOutput {\n\treturn o.ApplyT(func(v RouterBgpPeerResponse) string { return v.Ipv6NexthopAddress }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "610d6e44b0880ca883d131e9fe73a405", "score": "0.61380315", "text": "func PublicIpv6LTE(v string) predicate.Node {\n\treturn predicate.Node(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldPublicIpv6), v))\n\t})\n}", "title": "" }, { "docid": "9ac095f9079555305edc68ca4608102a", "score": "0.6122374", "text": "func PublicIpv6ContainsFold(v string) predicate.Node {\n\treturn predicate.Node(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldPublicIpv6), v))\n\t})\n}", "title": "" }, { "docid": "30f1dc46eb7f5282f55c268328b10a3d", "score": "0.6121135", "text": "func (c *Chip8) Opcode6XNN(ins uint16) {\n\tc.v[ArgX(ins)] = ArgNN(ins)\n}", "title": "" }, { "docid": "02472d7904cbed3d499f01e93f145f41", "score": "0.6106048", "text": "func NewNet6(ip net.IP, netmasklen, hostmasklen int) Net6 {\n\tvar maskMax = 128\n\tif Version(ip) != IP6Version {\n\t\treturn Net6{IPNet: net.IPNet{}, Hostmask: HostMask{}}\n\t}\n\n\tif (netmasklen == 127 || netmasklen == 128) && hostmasklen == 0 {\n\t\tnetmask := net.CIDRMask(netmasklen, maskMax)\n\t\tn := net.IPNet{IP: ip.Mask(netmask), Mask: netmask}\n\t\treturn Net6{IPNet: n, Hostmask: NewHostMask(0)}\n\t}\n\n\tif netmasklen+hostmasklen >= maskMax {\n\t\treturn Net6{IPNet: net.IPNet{}, Hostmask: HostMask{}}\n\t}\n\n\tnetmask := net.CIDRMask(netmasklen, maskMax)\n\n\tn := net.IPNet{IP: ip.Mask(netmask), Mask: netmask}\n\treturn Net6{IPNet: n, Hostmask: NewHostMask(hostmasklen)}\n}", "title": "" }, { "docid": "f8f846ef1f61f96c862881631e92a434", "score": "0.6082455", "text": "func validateCIDRv6(fl validator.FieldLevel) bool {\n\tn := fl.Field().String()\n\tlog.Debugf(\"Validate IPv6 network: %s\", n)\n\terr := ValidateCIDRv6(n)\n\tif err != nil {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "05e67142dc048921ba86b0b8916d9d6b", "score": "0.60777473", "text": "func (chip8 *Chip8) Opcode6XNN(opcode uint16) {\n\tchip8.V[chip8.ArgX(opcode)] = byte(chip8.ArgNN(opcode))\n}", "title": "" }, { "docid": "7680c7c9197850ec0867f312b528f040", "score": "0.6072642", "text": "func PublicIpv6GTE(v string) predicate.Node {\n\treturn predicate.Node(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldPublicIpv6), v))\n\t})\n}", "title": "" }, { "docid": "72227a32e603cbc9c568ebac907ec134", "score": "0.60610837", "text": "func (o RouterBgpPeerOutput) PeerIpv6NexthopAddress() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v RouterBgpPeer) *string { return v.PeerIpv6NexthopAddress }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "0e5886df46a4f5ce34538282844afb23", "score": "0.6061019", "text": "func PublicIpv6GT(v string) predicate.Node {\n\treturn predicate.Node(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldPublicIpv6), v))\n\t})\n}", "title": "" }, { "docid": "25ad7d9cfbe9d91db188c052657e0e69", "score": "0.60568595", "text": "func PublicIpv6HasSuffix(v string) predicate.Node {\n\treturn predicate.Node(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldPublicIpv6), v))\n\t})\n}", "title": "" }, { "docid": "6b96667bad72a51899b13891609449b8", "score": "0.60396147", "text": "func AddressNEQ(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.NEQ(s.C(FieldAddress), v))\n\t})\n}", "title": "" }, { "docid": "bca94682c7cbc1aac06038909cb27ae9", "score": "0.6034662", "text": "func HostNEQ(v string) predicate.Node {\n\treturn predicate.Node(func(s *sql.Selector) {\n\t\ts.Where(sql.NEQ(s.C(FieldHost), v))\n\t})\n}", "title": "" }, { "docid": "d15a91d2152533d7e58f3646d96e50fc", "score": "0.60329974", "text": "func (o LookupInternetResultOutput) Ipv6NetworkAddress() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupInternetResult) string { return v.Ipv6NetworkAddress }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "492d6b0310feee1968d5e81753fb14da", "score": "0.6030632", "text": "func isIP6AddrResolvable(fl FieldLevel) bool {\n\n\tif !isIPv6(fl) {\n\t\treturn false\n\t}\n\n\t_, err := net.ResolveIPAddr(\"ip6\", fl.Field().String())\n\n\treturn err == nil\n}", "title": "" }, { "docid": "19d853716e67a31c9bcf1e662ce57139", "score": "0.60305446", "text": "func (o LookupInternetResultOutput) Ipv6Prefix() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupInternetResult) string { return v.Ipv6Prefix }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "31784d1c71eca9df19822ab008ea3981", "score": "0.6030284", "text": "func (o NetworkInterfaceOutput) Ipv6Address() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v NetworkInterface) *string { return v.Ipv6Address }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "d89152eb8b1e627be511f3e59a6a0869", "score": "0.6003297", "text": "func (ip1 IP6) Eq(ip2 IP6) bool {\n\treturn ip1.N.Eq(ip2.N)\n}", "title": "" }, { "docid": "c02ec7b185278d7bca284b92f412d0d5", "score": "0.59978557", "text": "func EmailNEQ(v string) predicate.Invitee {\n\treturn predicate.Invitee(func(s *sql.Selector) {\n\t\ts.Where(sql.NEQ(s.C(FieldEmail), v))\n\t})\n}", "title": "" }, { "docid": "d33eeb00729b498de302039c2827017a", "score": "0.5997704", "text": "func (o RouterBgpPeerResponseOutput) PeerIpv6NexthopAddress() pulumi.StringOutput {\n\treturn o.ApplyT(func(v RouterBgpPeerResponse) string { return v.PeerIpv6NexthopAddress }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "fa2c11ebcfd7c3d1271e079befb5532e", "score": "0.5983077", "text": "func PublicIpv6(v string) predicate.Node {\n\treturn predicate.Node(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldPublicIpv6), v))\n\t})\n}", "title": "" }, { "docid": "01277ec8b148cd64b57e1d28af1f15c3", "score": "0.59819025", "text": "func NewIPv6NetTracer(in sacloud.IPv6NetAPI) sacloud.IPv6NetAPI {\n\treturn &IPv6NetTracer{\n\t\tInternal: in,\n\t}\n}", "title": "" }, { "docid": "d3fb486802cbfc3abc229f079ae071bd", "score": "0.5976861", "text": "func IPv6() string {\n\tsize := 16\n\tip := make([]byte, size)\n\tfor i := 0; i < size; i++ {\n\t\tip[i] = byte(r.Intn(256))\n\t}\n\treturn net.IP(ip).To16().String()\n}", "title": "" }, { "docid": "e514c97dc6b5112ec259923a3e987ff0", "score": "0.59536195", "text": "func NicknameNEQ(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.NEQ(s.C(FieldNickname), v))\n\t})\n}", "title": "" }, { "docid": "e514c97dc6b5112ec259923a3e987ff0", "score": "0.59536195", "text": "func NicknameNEQ(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.NEQ(s.C(FieldNickname), v))\n\t})\n}", "title": "" }, { "docid": "e514c97dc6b5112ec259923a3e987ff0", "score": "0.59536195", "text": "func NicknameNEQ(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.NEQ(s.C(FieldNickname), v))\n\t})\n}", "title": "" }, { "docid": "f63f864e24bfc7fc2aeb3b2b7b5d4e1d", "score": "0.59475523", "text": "func (u PeerAddressIp) GetIpv6() (result [16]byte, ok bool) {\n\tarmName, _ := u.ArmForSwitch(int32(u.Type))\n\n\tif armName == \"Ipv6\" {\n\t\tresult = *u.Ipv6\n\t\tok = true\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "26ab1489a36dda151809bb6d76863806", "score": "0.59469175", "text": "func (f *NumberOfUEIPAddressesFields) HasNumIPv6() bool {\n\treturn has2ndBit(f.Flags)\n}", "title": "" }, { "docid": "32e08069297172a2c328788eab6d1636", "score": "0.59315884", "text": "func (o InstanceNetworkOutput) FixedIpV6() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v InstanceNetwork) *string { return v.FixedIpV6 }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "dd56ab6cd0cbeaa398b5780619d15060", "score": "0.5930806", "text": "func EmailNEQ(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.NEQ(s.C(FieldEmail), v))\n\t})\n}", "title": "" }, { "docid": "dd56ab6cd0cbeaa398b5780619d15060", "score": "0.5930806", "text": "func EmailNEQ(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.NEQ(s.C(FieldEmail), v))\n\t})\n}", "title": "" }, { "docid": "e4990c7926bdcc0debb876123f689d13", "score": "0.5913911", "text": "func PasswordHashNEQ(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.NEQ(s.C(FieldPasswordHash), v))\n\t})\n}", "title": "" }, { "docid": "a2422464bfb66c941ed29b67d57edc74", "score": "0.5911737", "text": "func AddressCountryNEQ(v string) predicate.Invitee {\n\treturn predicate.Invitee(func(s *sql.Selector) {\n\t\ts.Where(sql.NEQ(s.C(FieldAddressCountry), v))\n\t})\n}", "title": "" }, { "docid": "80fcd9c1bf82c1c252ad635bd6fae489", "score": "0.59044856", "text": "func AnnotationNEQ(v string) predicate.DrugAllergy {\n\treturn predicate.DrugAllergy(func(s *sql.Selector) {\n\t\ts.Where(sql.NEQ(s.C(FieldAnnotation), v))\n\t})\n}", "title": "" }, { "docid": "3ce85f7e77eab4e4f6f476962b6c9cda", "score": "0.589995", "text": "func (dev *EthernetDevice) IPv6() (addr, netmask IPv6, ok bool) {\n\tdev.mu.RLock()\n\taddr, netmask, ok = dev.addr6, dev.netmask6, dev.addr6Set\n\tdev.mu.RUnlock()\n\treturn addr, netmask, ok\n}", "title": "" }, { "docid": "106a72289c4547e92eae9c31c17c8406", "score": "0.5891706", "text": "func TestTrieIPv6(t *testing.T) {\n\ta := &Peer{}\n\tb := &Peer{}\n\tc := &Peer{}\n\td := &Peer{}\n\te := &Peer{}\n\tf := &Peer{}\n\tg := &Peer{}\n\th := &Peer{}\n\n\tvar allowedIPs AllowedIPs\n\n\texpand := func(a uint32) []byte {\n\t\tvar out [4]byte\n\t\tout[0] = byte(a >> 24 & 0xff)\n\t\tout[1] = byte(a >> 16 & 0xff)\n\t\tout[2] = byte(a >> 8 & 0xff)\n\t\tout[3] = byte(a & 0xff)\n\t\treturn out[:]\n\t}\n\n\tinsert := func(peer *Peer, a, b, c, d uint32, cidr uint8) {\n\t\tvar addr []byte\n\t\taddr = append(addr, expand(a)...)\n\t\taddr = append(addr, expand(b)...)\n\t\taddr = append(addr, expand(c)...)\n\t\taddr = append(addr, expand(d)...)\n\t\tallowedIPs.Insert(netip.PrefixFrom(netip.AddrFrom16(*(*[16]byte)(addr)), int(cidr)), peer)\n\t}\n\n\tassertEQ := func(peer *Peer, a, b, c, d uint32) {\n\t\tvar addr []byte\n\t\taddr = append(addr, expand(a)...)\n\t\taddr = append(addr, expand(b)...)\n\t\taddr = append(addr, expand(c)...)\n\t\taddr = append(addr, expand(d)...)\n\t\tp := allowedIPs.Lookup(addr)\n\t\tif p != peer {\n\t\t\tt.Error(\"Assert EQ failed\")\n\t\t}\n\t}\n\n\tinsert(d, 0x26075300, 0x60006b00, 0, 0xc05f0543, 128)\n\tinsert(c, 0x26075300, 0x60006b00, 0, 0, 64)\n\tinsert(e, 0, 0, 0, 0, 0)\n\tinsert(f, 0, 0, 0, 0, 0)\n\tinsert(g, 0x24046800, 0, 0, 0, 32)\n\tinsert(h, 0x24046800, 0x40040800, 0xdeadbeef, 0xdeadbeef, 64)\n\tinsert(a, 0x24046800, 0x40040800, 0xdeadbeef, 0xdeadbeef, 128)\n\tinsert(c, 0x24446800, 0x40e40800, 0xdeaebeef, 0xdefbeef, 128)\n\tinsert(b, 0x24446800, 0xf0e40800, 0xeeaebeef, 0, 98)\n\n\tassertEQ(d, 0x26075300, 0x60006b00, 0, 0xc05f0543)\n\tassertEQ(c, 0x26075300, 0x60006b00, 0, 0xc02e01ee)\n\tassertEQ(f, 0x26075300, 0x60006b01, 0, 0)\n\tassertEQ(g, 0x24046800, 0x40040806, 0, 0x1006)\n\tassertEQ(g, 0x24046800, 0x40040806, 0x1234, 0x5678)\n\tassertEQ(f, 0x240467ff, 0x40040806, 0x1234, 0x5678)\n\tassertEQ(f, 0x24046801, 0x40040806, 0x1234, 0x5678)\n\tassertEQ(h, 0x24046800, 0x40040800, 0x1234, 0x5678)\n\tassertEQ(h, 0x24046800, 0x40040800, 0, 0)\n\tassertEQ(h, 0x24046800, 0x40040800, 0x10101010, 0x10101010)\n\tassertEQ(a, 0x24046800, 0x40040800, 0xdeadbeef, 0xdeadbeef)\n}", "title": "" }, { "docid": "152ff05f933c84850672c4c64c2d9eb9", "score": "0.5880204", "text": "func (a Attribute) IPv6Addr() (net.IP, error) {\n\tif len(a) != net.IPv6len {\n\t\treturn nil, errors.New(\"invalid length\")\n\t}\n\tb := make([]byte, net.IPv6len)\n\tcopy(b, []byte(a))\n\treturn b, nil\n}", "title": "" }, { "docid": "8730a077fa87a2408b392330e917c7de", "score": "0.5879518", "text": "func (eni *ENI) GetIPV6Addresses() []string {\n\tvar addresses []string\n\tfor _, addr := range eni.IPV6Addresses {\n\t\taddresses = append(addresses, addr.Address)\n\t}\n\n\treturn addresses\n}", "title": "" }, { "docid": "f3b702ac1abdba3422b2898e11eb51e2", "score": "0.5877923", "text": "func NetPriceNEQ(v int) predicate.Product {\n\treturn predicate.Product(func(s *sql.Selector) {\n\t\ts.Where(sql.NEQ(s.C(FieldNetPrice), v))\n\t})\n}", "title": "" }, { "docid": "39066f4ed1bf837aaf3c39d5624377cc", "score": "0.5875595", "text": "func (c *Client) IPv6() *NetRegistry {\n\tc.init()\n\tc.freshenFromCache(ServiceProvider)\n\n\ts, _ := c.registries[IPv6].(*NetRegistry)\n\treturn s\n}", "title": "" }, { "docid": "1767263b268a7ca5e58ec8c4efb7dfb4", "score": "0.58710396", "text": "func NicknameNEQ(v string) predicate.Group {\n\treturn predicate.Group(func(s *sql.Selector) {\n\t\ts.Where(sql.NEQ(s.C(FieldNickname), v))\n\t})\n}", "title": "" }, { "docid": "ab9e9abcedce1a4966d488b9f4f09761", "score": "0.5868602", "text": "func IsIPv6(ip net.IP) bool {\n\treturn ip != nil && ip.To4() == nil\n}", "title": "" }, { "docid": "0fb3c28b2130d0afd154a0b8cc1cd846", "score": "0.5853902", "text": "func IPv6ReservedIPNet() []*net.IPNet {\n\tr := []*net.IPNet{}\n\tfor _, entry := range [][2]string{\n\t\t{\"00000000000000000000000000000000\", \"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\"},\n\t\t{\"00000000000000000000000000000001\", \"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\"},\n\t\t{\"01000000000000000000000000000000\", \"FFFFFFFFFFFFFFFF0000000000000000\"},\n\t\t{\"0064FF9B000000000000000000000000\", \"FFFFFFFFFFFFFFFFFFFFFFFF00000000\"},\n\t\t{\"20010000000000000000000000000000\", \"FFFFFFFF000000000000000000000000\"},\n\t\t{\"20010010000000000000000000000000\", \"FFFFFFF0000000000000000000000000\"},\n\t\t{\"20010020000000000000000000000000\", \"FFFFFFF0000000000000000000000000\"},\n\t\t{\"20010DB8000000000000000000000000\", \"FFFFFFFF000000000000000000000000\"},\n\t\t{\"20020000000000000000000000000000\", \"FFFF0000000000000000000000000000\"},\n\t\t{\"FC000000000000000000000000000000\", \"FE000000000000000000000000000000\"},\n\t\t{\"FE800000000000000000000000000000\", \"FFC00000000000000000000000000000\"},\n\t\t{\"FF000000000000000000000000000000\", \"FF000000000000000000000000000000\"},\n\t} {\n\t\ti, _ := hex.DecodeString(entry[0])\n\t\tm, _ := hex.DecodeString(entry[1])\n\t\tr = append(r, &net.IPNet{IP: i, Mask: m})\n\t}\n\treturn r\n}", "title": "" }, { "docid": "47391a7383f8ae2f8e103f29be9823cc", "score": "0.58437884", "text": "func UUIDNEQ(v string) predicate.Node {\n\treturn predicate.Node(func(s *sql.Selector) {\n\t\ts.Where(sql.NEQ(s.C(FieldUUID), v))\n\t})\n}", "title": "" }, { "docid": "9e515f3c460e98a1f583ad1c475c9f14", "score": "0.58424294", "text": "func Ipv6LT(v string) predicate.Node {\n\treturn predicate.Node(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldIpv6), v))\n\t})\n}", "title": "" }, { "docid": "934dd3410d3c9522557d50a02af11264", "score": "0.5833506", "text": "func PrefixIs6(p netaddr.IPPrefix) bool { return p.IP().Is6() }", "title": "" }, { "docid": "cf542819203d9758228cea2a8c35449a", "score": "0.5828192", "text": "func (m *TiIndicator) SetNetworkDestinationIPv6(value *string)() {\n err := m.GetBackingStore().Set(\"networkDestinationIPv6\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "7b939ad98ac19e53a32308fef715ba13", "score": "0.58269054", "text": "func UIDNEQ(v string) predicate.Product {\n\treturn predicate.Product(func(s *sql.Selector) {\n\t\ts.Where(sql.NEQ(s.C(FieldUID), v))\n\t})\n}", "title": "" }, { "docid": "b3a2e0d461d04876bbfa042ee95861b5", "score": "0.5820565", "text": "func PublicIpv6Contains(v string) predicate.Node {\n\treturn predicate.Node(func(s *sql.Selector) {\n\t\ts.Where(sql.Contains(s.C(FieldPublicIpv6), v))\n\t})\n}", "title": "" }, { "docid": "3ee1692d1408c957f105b5f1edc142bb", "score": "0.5816814", "text": "func NewIPv6(netId, hostId uint64) *IPv6 {\n\treturn &IPv6{netId: netId, hostId: hostId}\n}", "title": "" }, { "docid": "7db2f09ddbf8bf54f019227e47ca424f", "score": "0.5812031", "text": "func GetIPV6IP() (string, error) {\n\treturn getExternalIP(\"ipv6\")\n}", "title": "" }, { "docid": "f30c6a717ac715c046a1351847cb9aa1", "score": "0.5810651", "text": "func ExampleIPAddress_ipv6() {\n\tfmt.Println(IPAddress(\" 2602:305:bceb:1bd0:44ef:fedb:4f8f:da4f \"))\n\t// Output: 2602:305:bceb:1bd0:44ef:fedb:4f8f:da4f\n}", "title": "" }, { "docid": "0314d1fef66c93165d3ffbd68d327267", "score": "0.58057636", "text": "func RuleNEQ(v string) predicate.HttpRule {\n\treturn predicate.HttpRule(func(s *sql.Selector) {\n\t\ts.Where(sql.NEQ(s.C(FieldRule), v))\n\t})\n}", "title": "" }, { "docid": "36bba2d030d7efddbf777d0295e6e87d", "score": "0.5801471", "text": "func (o LookupInternetResultOutput) EnableIpv6() pulumi.BoolOutput {\n\treturn o.ApplyT(func(v LookupInternetResult) bool { return v.EnableIpv6 }).(pulumi.BoolOutput)\n}", "title": "" }, { "docid": "e6aa77c2753b0753138fdb284fcb36a6", "score": "0.5779786", "text": "func WorkplaceNEQ(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.NEQ(s.C(FieldWorkplace), v))\n\t})\n}", "title": "" }, { "docid": "9c625285fde0c454d8a65fd74e35c4d3", "score": "0.57777923", "text": "func PublicIpv6In(vs ...string) predicate.Node {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Node(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(FieldPublicIpv6), v...))\n\t})\n}", "title": "" }, { "docid": "e09137ce4c7c97afd431f1e7c5851606", "score": "0.57771754", "text": "func (o AccessConfigOutput) ExternalIpv6() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v AccessConfig) *string { return v.ExternalIpv6 }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "5d042679395f6c925b280a1d12cc3f8c", "score": "0.5769431", "text": "func IPv6Raw(addr [16]byte) IP {\n\treturn IP{\n\t\taddr: uint128{\n\t\t\tbinary.BigEndian.Uint64(addr[:8]),\n\t\t\tbinary.BigEndian.Uint64(addr[8:]),\n\t\t},\n\t\tz: z6noz,\n\t}\n}", "title": "" }, { "docid": "3bff6cd01d498c9f809b16452f2f2583", "score": "0.57683367", "text": "func (m *Measurement) Ipv6() bool {\n return m.data.Ipv6\n}", "title": "" }, { "docid": "d7ba07c79355aff409e191e787baf22f", "score": "0.57679844", "text": "func (m *TiIndicator) SetNetworkIPv6(value *string)() {\n err := m.GetBackingStore().Set(\"networkIPv6\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "7104ec0fa6ff898d9e7621c9e221c219", "score": "0.5766133", "text": "func IsIPv6(s string) bool {\n\tip := net.ParseIP(s)\n\treturn ip != nil && ip.To4() == nil\n}", "title": "" }, { "docid": "33dcf6bbc3894618000eff7b62112f48", "score": "0.5765386", "text": "func IsUnicastIPv6(a Address) bool {\n\tif ip := AsIP(a); ip != nil && ip.To4() == nil {\n\t\treturn !ip.IsUnspecified() && !(ip.IsLinkLocalMulticast() || ip.IsInterfaceLocalMulticast())\n\t}\n\treturn false\n}", "title": "" }, { "docid": "18a924143237e115db69469f99b353b1", "score": "0.5760835", "text": "func isTCP6AddrResolvable(fl FieldLevel) bool {\n\n\tif !isIP6Addr(fl) {\n\t\treturn false\n\t}\n\n\t_, err := net.ResolveTCPAddr(\"tcp6\", fl.Field().String())\n\n\treturn err == nil\n}", "title": "" }, { "docid": "5a275652d0aec6920a380e1c6191249e", "score": "0.57495654", "text": "func (f *CPPFCPEntityIPAddressFields) HasIPv6() bool {\n\treturn has1stBit(f.Flags)\n}", "title": "" }, { "docid": "686ffe60fe6dcfd96b4c2ce6a8d5df91", "score": "0.5745737", "text": "func (o ExternalVpnGatewayInterfaceOutput) Ipv6Address() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ExternalVpnGatewayInterface) *string { return v.Ipv6Address }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "8975a5f89720eab84b09a1d3e8f7a421", "score": "0.57389796", "text": "func (c *Client) IPsV6() (IPAddrs, error) {\n\t_, v6, err := c.AllIPs()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn v6, nil\n}", "title": "" }, { "docid": "e6a0b2dd1c721784bc94a11637b01ae4", "score": "0.57378924", "text": "func (o RouterBgpPeerOutput) EnableIpv6() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v RouterBgpPeer) *bool { return v.EnableIpv6 }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "9c97d55da81973c9b2340ce42a71e2ab", "score": "0.57348543", "text": "func ImageURLNEQ(v string) predicate.Product {\n\treturn predicate.Product(func(s *sql.Selector) {\n\t\ts.Where(sql.NEQ(s.C(FieldImageURL), v))\n\t})\n}", "title": "" }, { "docid": "55e36a05dcf428e400fa0463d41767dc", "score": "0.57341826", "text": "func (*networkManager) addIpv6SnatRule(extIf *externalInterface, nwInfo *NetworkInfo) error {\n\tvar (\n\t\tipv6SnatRuleSet bool\n\t\tipv6SubnetPrefix net.IPNet\n\t)\n\n\tfor _, subnet := range nwInfo.Subnets {\n\t\tif subnet.Family == platform.AfINET6 {\n\t\t\tipv6SubnetPrefix = subnet.Prefix\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif len(ipv6SubnetPrefix.IP) == 0 {\n\t\treturn errSubnetV6NotFound\n\t}\n\n\tfor _, ipAddr := range extIf.IPAddresses {\n\t\tif ipAddr.IP.To4() == nil {\n\t\t\tlog.Printf(\"[net] Adding ipv6 snat rule\")\n\t\t\tmatchSrcPrefix := fmt.Sprintf(\"-s %s\", ipv6SubnetPrefix.String())\n\t\t\tif err := networkutils.AddSnatRule(matchSrcPrefix, ipAddr.IP); err != nil {\n\t\t\t\treturn fmt.Errorf(\"Adding iptable snat rule failed:%w\", err)\n\t\t\t}\n\t\t\tipv6SnatRuleSet = true\n\t\t}\n\t}\n\n\tif !ipv6SnatRuleSet {\n\t\treturn errV6SnatRuleNotSet\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6162f3f66d4acd55c61a3a30ea9a8347", "score": "0.57336414", "text": "func EmailNEQ(v string) predicate.Employee {\n\treturn predicate.Employee(func(s *sql.Selector) {\n\t\ts.Where(sql.NEQ(s.C(FieldEmail), v))\n\t})\n}", "title": "" } ]
c1905bc6e81346f9cf0e871e23d98cca
If the WalkHandlers.XsdGoPkgHasElems_WeatherRelatedRoadConditionTypesequenceextensioncomplexContentRoadSurfaceConditionInformationschema_WeatherRelatedRoadConditionType_TWeatherRelatedRoadConditionTypeEnum_ function is not nil (ie. was set by outside code), calls it with this XsdGoPkgHasElems_WeatherRelatedRoadConditionTypesequenceextensioncomplexContentRoadSurfaceConditionInformationschema_WeatherRelatedRoadConditionType_TWeatherRelatedRoadConditionTypeEnum_ instance as the single argument. Then calls the Walk() method on 0/0 embed(s) and 0/1 field(s) belonging to this XsdGoPkgHasElems_WeatherRelatedRoadConditionTypesequenceextensioncomplexContentRoadSurfaceConditionInformationschema_WeatherRelatedRoadConditionType_TWeatherRelatedRoadConditionTypeEnum_ instance.
[ { "docid": "ab3ae7de5ab6b5e9c1f46f9e77fbc0a0", "score": "0.8108304", "text": "func (me *XsdGoPkgHasElems_WeatherRelatedRoadConditionTypesequenceextensioncomplexContentRoadSurfaceConditionInformationschema_WeatherRelatedRoadConditionType_TWeatherRelatedRoadConditionTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElems_WeatherRelatedRoadConditionTypesequenceextensioncomplexContentRoadSurfaceConditionInformationschema_WeatherRelatedRoadConditionType_TWeatherRelatedRoadConditionTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" } ]
[ { "docid": "53238d20caa1237ccbf635967fc7fafa", "score": "0.8131625", "text": "func (me *XsdGoPkgHasElem_WeatherRelatedRoadConditionTypesequenceextensioncomplexContentRoadSurfaceConditionInformationschema_WeatherRelatedRoadConditionType_TWeatherRelatedRoadConditionTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_WeatherRelatedRoadConditionTypesequenceextensioncomplexContentRoadSurfaceConditionInformationschema_WeatherRelatedRoadConditionType_TWeatherRelatedRoadConditionTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "b91adf1fcebca23f6c5398d79b0d318a", "score": "0.73286486", "text": "func (me *XsdGoPkgHasElem_NonWeatherRelatedRoadConditionTypesequenceextensioncomplexContentNonWeatherRelatedRoadConditionsschema_NonWeatherRelatedRoadConditionType_TNonWeatherRelatedRoadConditionTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_NonWeatherRelatedRoadConditionTypesequenceextensioncomplexContentNonWeatherRelatedRoadConditionsschema_NonWeatherRelatedRoadConditionType_TNonWeatherRelatedRoadConditionTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "370b18c26d13e5cd42603e650fd321a2", "score": "0.71738774", "text": "func (me *XsdGoPkgHasElems_NonWeatherRelatedRoadConditionTypesequenceextensioncomplexContentNonWeatherRelatedRoadConditionsschema_NonWeatherRelatedRoadConditionType_TNonWeatherRelatedRoadConditionTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElems_NonWeatherRelatedRoadConditionTypesequenceextensioncomplexContentNonWeatherRelatedRoadConditionsschema_NonWeatherRelatedRoadConditionType_TNonWeatherRelatedRoadConditionTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "7368d6915858970ef64049725a8f2c08", "score": "0.6701447", "text": "func (me *XsdGoPkgHasElem_DrivingConditionTypesequenceextensioncomplexContentConditionsschema_DrivingConditionType_TDrivingConditionTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_DrivingConditionTypesequenceextensioncomplexContentConditionsschema_DrivingConditionType_TDrivingConditionTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "856ec09764301fc76df83f3ae097d0a8", "score": "0.64578044", "text": "func (me *XsdGoPkgHasElems_DrivingConditionTypesequenceextensioncomplexContentConditionsschema_DrivingConditionType_TDrivingConditionTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElems_DrivingConditionTypesequenceextensioncomplexContentConditionsschema_DrivingConditionType_TDrivingConditionTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "ada09b226282d4fa34ad9b519ce722a1", "score": "0.62937206", "text": "func (me *XsdGoPkgHasElem_EquipmentOrSystemFaultTypesequenceextensioncomplexContentEquipmentOrSystemFaultschema_EquipmentOrSystemFaultType_TEquipmentOrSystemFaultTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_EquipmentOrSystemFaultTypesequenceextensioncomplexContentEquipmentOrSystemFaultschema_EquipmentOrSystemFaultType_TEquipmentOrSystemFaultTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "14d5d0b22fccb29e02bb2a17f9634a97", "score": "0.62716293", "text": "func (me *XsdGoPkgHasElem_RoadOrCarriagewayOrLaneManagementTypesequenceextensioncomplexContentRoadOrCarriagewayOrLaneManagementschema_RoadOrCarriagewayOrLaneManagementType_TRoadOrCarriagewayOrLaneManagementTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_RoadOrCarriagewayOrLaneManagementTypesequenceextensioncomplexContentRoadOrCarriagewayOrLaneManagementschema_RoadOrCarriagewayOrLaneManagementType_TRoadOrCarriagewayOrLaneManagementTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "78cb5305e0e5bcaf9154998e934bba89", "score": "0.6266535", "text": "func (me *XsdGoPkgHasElem_TravelTimeTrendTypesequenceextensioncomplexContentTravelTimeDataschema_TravelTimeTrendType_TravelTimeTrendTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_TravelTimeTrendTypesequenceextensioncomplexContentTravelTimeDataschema_TravelTimeTrendType_TravelTimeTrendTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "7124d70d7529b0d3db580d24506164eb", "score": "0.62471896", "text": "func (me *XsdGoPkgHasElem_RoadsideAssistanceTypesequenceextensioncomplexContentRoadsideAssistanceschema_RoadsideAssistanceType_TRoadsideAssistanceTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_RoadsideAssistanceTypesequenceextensioncomplexContentRoadsideAssistanceschema_RoadsideAssistanceType_TRoadsideAssistanceTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "d1f2c14ade039c1a2bd0fa4f8c54a8cb", "score": "0.617956", "text": "func (me *XsdGoPkgHasElem_WinterEquipmentManagementTypesequenceextensioncomplexContentWinterDrivingManagementschema_WinterEquipmentManagementType_TWinterEquipmentManagementTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_WinterEquipmentManagementTypesequenceextensioncomplexContentWinterDrivingManagementschema_WinterEquipmentManagementType_TWinterEquipmentManagementTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "96695ae7b60cb67f34fb78e745480941", "score": "0.6147826", "text": "func (me *XsdGoPkgHasElems_RoadOrCarriagewayOrLaneManagementTypesequenceextensioncomplexContentRoadOrCarriagewayOrLaneManagementschema_RoadOrCarriagewayOrLaneManagementType_TRoadOrCarriagewayOrLaneManagementTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElems_RoadOrCarriagewayOrLaneManagementTypesequenceextensioncomplexContentRoadOrCarriagewayOrLaneManagementschema_RoadOrCarriagewayOrLaneManagementType_TRoadOrCarriagewayOrLaneManagementTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "a4143c7d451ae8d665dd468973d76382", "score": "0.61443865", "text": "func (me *XsdGoPkgHasElem_FaultyEquipmentOrSystemTypesequenceextensioncomplexContentEquipmentOrSystemFaultschema_FaultyEquipmentOrSystemType_TEquipmentOrSystemTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_FaultyEquipmentOrSystemTypesequenceextensioncomplexContentEquipmentOrSystemFaultschema_FaultyEquipmentOrSystemType_TEquipmentOrSystemTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "b33d21896934c0742799c489c8bdb0ed", "score": "0.61159277", "text": "func (me *XsdGoPkgHasElem_TrafficTrendTypesequenceextensioncomplexContentAbnormalTrafficschema_TrafficTrendType_TrafficTrendTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_TrafficTrendTypesequenceextensioncomplexContentAbnormalTrafficschema_TrafficTrendType_TrafficTrendTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "b93ccd575f917cf00a56f80d4e6e8c5c", "score": "0.61147225", "text": "func (me *XsdGoPkgHasElem_PoorEnvironmentTypesequenceextensioncomplexContentPoorEnvironmentConditionsschema_PoorEnvironmentType_TPoorEnvironmentTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_PoorEnvironmentTypesequenceextensioncomplexContentPoorEnvironmentConditionsschema_PoorEnvironmentType_TPoorEnvironmentTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "6f513bf1ea28f5463fd65dfff9d13d38", "score": "0.60706806", "text": "func (me *XsdGoPkgHasElem_TravelTimeTypesequenceextensioncomplexContentTravelTimeDataschema_TravelTimeType_TravelTimeTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_TravelTimeTypesequenceextensioncomplexContentTravelTimeDataschema_TravelTimeType_TravelTimeTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "f8c840cfc2eb606f0c928518f7101b2f", "score": "0.6063825", "text": "func (me *XsdGoPkgHasElems_RoadsideAssistanceTypesequenceextensioncomplexContentRoadsideAssistanceschema_RoadsideAssistanceType_TRoadsideAssistanceTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElems_RoadsideAssistanceTypesequenceextensioncomplexContentRoadsideAssistanceschema_RoadsideAssistanceType_TRoadsideAssistanceTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "72704ce45b8380ad7f4b3e2704ebec89", "score": "0.6046383", "text": "func (me *XsdGoPkgHasElem_VehicleObstructionTypesequenceextensioncomplexContentVehicleObstructionschema_VehicleObstructionType_TVehicleObstructionTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_VehicleObstructionTypesequenceextensioncomplexContentVehicleObstructionschema_VehicleObstructionType_TVehicleObstructionTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "990d524a9be5c079cca66f7f34748ea8", "score": "0.6043074", "text": "func (me *XsdGoPkgHasElem_RoadsideServiceDisruptionTypesequenceextensioncomplexContentRoadsideServiceDisruptionschema_RoadsideServiceDisruptionType_TRoadsideServiceDisruptionTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_RoadsideServiceDisruptionTypesequenceextensioncomplexContentRoadsideServiceDisruptionschema_RoadsideServiceDisruptionType_TRoadsideServiceDisruptionTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "afae63041b4ca854a3fc235a775bc776", "score": "0.60098714", "text": "func (me *XsdGoPkgHasElems_EquipmentOrSystemFaultTypesequenceextensioncomplexContentEquipmentOrSystemFaultschema_EquipmentOrSystemFaultType_TEquipmentOrSystemFaultTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElems_EquipmentOrSystemFaultTypesequenceextensioncomplexContentEquipmentOrSystemFaultschema_EquipmentOrSystemFaultType_TEquipmentOrSystemFaultTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "b566efca5415da03b6952dd7b84b0e45", "score": "0.5988734", "text": "func (me *XsdGoPkgHasElems_TravelTimeTrendTypesequenceextensioncomplexContentTravelTimeDataschema_TravelTimeTrendType_TravelTimeTrendTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElems_TravelTimeTrendTypesequenceextensioncomplexContentTravelTimeDataschema_TravelTimeTrendType_TravelTimeTrendTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "a42e550bbee6a0bb393bd28a3a23b104", "score": "0.59801865", "text": "func (me *XsdGoPkgHasElem_RoadOperatorServiceDisruptionTypesequenceextensioncomplexContentRoadOperatorServiceDisruptionschema_RoadOperatorServiceDisruptionType_TRoadOperatorServiceDisruptionTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_RoadOperatorServiceDisruptionTypesequenceextensioncomplexContentRoadOperatorServiceDisruptionschema_RoadOperatorServiceDisruptionType_TRoadOperatorServiceDisruptionTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "3e517270a394f68433cec793ddfb8b7e", "score": "0.59234893", "text": "func (me *XsdGoPkgHasElem_EnvironmentalObstructionTypesequenceextensioncomplexContentEnvironmentalObstructionschema_EnvironmentalObstructionType_TEnvironmentalObstructionTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_EnvironmentalObstructionTypesequenceextensioncomplexContentEnvironmentalObstructionschema_EnvironmentalObstructionType_TEnvironmentalObstructionTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "1deef6cbeba14c96d6c98d804174338e", "score": "0.59019315", "text": "func (me *XsdGoPkgHasElem_ObstructionTypesequenceextensioncomplexContentGeneralObstructionschema_ObstructionType_TObstructionTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_ObstructionTypesequenceextensioncomplexContentGeneralObstructionschema_ObstructionType_TObstructionTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "562bd6e2cf333985f2988d4e3df68c99", "score": "0.5895582", "text": "func (me *XsdGoPkgHasElems_PoorEnvironmentTypesequenceextensioncomplexContentPoorEnvironmentConditionsschema_PoorEnvironmentType_TPoorEnvironmentTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElems_PoorEnvironmentTypesequenceextensioncomplexContentPoorEnvironmentConditionsschema_PoorEnvironmentType_TPoorEnvironmentTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "9587fc7e1d87898422a7bb15a4197428", "score": "0.58778536", "text": "func (me *XsdGoPkgHasElems_WinterEquipmentManagementTypesequenceextensioncomplexContentWinterDrivingManagementschema_WinterEquipmentManagementType_TWinterEquipmentManagementTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElems_WinterEquipmentManagementTypesequenceextensioncomplexContentWinterDrivingManagementschema_WinterEquipmentManagementType_TWinterEquipmentManagementTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "e5a0e594117ae5fa509590ae407a1218", "score": "0.5853333", "text": "func (me *XsdGoPkgHasElem_InfrastructureDamageTypesequenceextensioncomplexContentInfrastructureDamageObstructionschema_InfrastructureDamageType_TInfrastructureDamageTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_InfrastructureDamageTypesequenceextensioncomplexContentInfrastructureDamageObstructionschema_InfrastructureDamageType_TInfrastructureDamageTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "697de9d65972b74dbbc10e5407528018", "score": "0.5836477", "text": "func (me *XsdGoPkgHasElems_FaultyEquipmentOrSystemTypesequenceextensioncomplexContentEquipmentOrSystemFaultschema_FaultyEquipmentOrSystemType_TEquipmentOrSystemTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElems_FaultyEquipmentOrSystemTypesequenceextensioncomplexContentEquipmentOrSystemFaultschema_FaultyEquipmentOrSystemType_TEquipmentOrSystemTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "724d6b4988ca19cef0e846ebd56c5ff3", "score": "0.5817215", "text": "func (me TWeatherRelatedRoadConditionTypeEnum) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "88c22373148de20163ee785d271d5ef0", "score": "0.5800336", "text": "func (me *XsdGoPkgHasElems_VehicleObstructionTypesequenceextensioncomplexContentVehicleObstructionschema_VehicleObstructionType_TVehicleObstructionTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElems_VehicleObstructionTypesequenceextensioncomplexContentVehicleObstructionschema_VehicleObstructionType_TVehicleObstructionTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "165d31bf9b909d35f11e06d85cc930ad", "score": "0.5777433", "text": "func (me *XsdGoPkgHasElems_TravelTimeTypesequenceextensioncomplexContentTravelTimeDataschema_TravelTimeType_TravelTimeTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElems_TravelTimeTypesequenceextensioncomplexContentTravelTimeDataschema_TravelTimeType_TravelTimeTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "8050a35697e5cc9736cb992e72b91b57", "score": "0.57583505", "text": "func (me *XsdGoPkgHasElem_WeatherRelatedRoadConditionsExtensionsequenceextensioncomplexContentWeatherRelatedRoadConditionsschema_WeatherRelatedRoadConditionsExtension_TExtensionType_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_WeatherRelatedRoadConditionsExtensionsequenceextensioncomplexContentWeatherRelatedRoadConditionsschema_WeatherRelatedRoadConditionsExtension_TExtensionType_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif err = me.WeatherRelatedRoadConditionsExtension.Walk(); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\treturn\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "6efa3ada9a5d846b7687d6bfe2c8b184", "score": "0.57377553", "text": "func (me *XsdGoPkgHasElems_RoadOperatorServiceDisruptionTypesequenceextensioncomplexContentRoadOperatorServiceDisruptionschema_RoadOperatorServiceDisruptionType_TRoadOperatorServiceDisruptionTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElems_RoadOperatorServiceDisruptionTypesequenceextensioncomplexContentRoadOperatorServiceDisruptionschema_RoadOperatorServiceDisruptionType_TRoadOperatorServiceDisruptionTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "de19661ec7cb1d74834eeb97c7f48c86", "score": "0.57309914", "text": "func (me *XsdGoPkgHasElems_RoadsideServiceDisruptionTypesequenceextensioncomplexContentRoadsideServiceDisruptionschema_RoadsideServiceDisruptionType_TRoadsideServiceDisruptionTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElems_RoadsideServiceDisruptionTypesequenceextensioncomplexContentRoadsideServiceDisruptionschema_RoadsideServiceDisruptionType_TRoadsideServiceDisruptionTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "10e523a9dd214bc0fec40c464662a7b5", "score": "0.56883734", "text": "func (me *XsdGoPkgHasElem_RoadSurfaceConditionInformationExtensionsequenceextensioncomplexContentRoadSurfaceConditionInformationschema_RoadSurfaceConditionInformationExtension_TExtensionType_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_RoadSurfaceConditionInformationExtensionsequenceextensioncomplexContentRoadSurfaceConditionInformationschema_RoadSurfaceConditionInformationExtension_TExtensionType_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif err = me.RoadSurfaceConditionInformationExtension.Walk(); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\treturn\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "7c0dedd5135660ac89b08e98dd82d362", "score": "0.568763", "text": "func (me *XsdGoPkgHasElems_TrafficTrendTypesequenceextensioncomplexContentTrafficStatusschema_TrafficTrendType_TrafficTrendTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElems_TrafficTrendTypesequenceextensioncomplexContentTrafficStatusschema_TrafficTrendType_TrafficTrendTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "daab3ec4400815dd8ab3c08d2deac92f", "score": "0.56852657", "text": "func (me *TWeatherRelatedRoadConditionTypeEnum) Set(s string) { (*xsdt.String)(me).Set(s) }", "title": "" }, { "docid": "183716262aeea5e5aa3768db391d1ddf", "score": "0.5675691", "text": "func (me TWeatherRelatedRoadConditionTypeEnum) IsWet() bool { return me.String() == \"wet\" }", "title": "" }, { "docid": "8c00b1fc1092914ab4e4df7f41e5709f", "score": "0.565297", "text": "func (me *XsdGoPkgHasElems_EnvironmentalObstructionTypesequenceextensioncomplexContentEnvironmentalObstructionschema_EnvironmentalObstructionType_TEnvironmentalObstructionTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElems_EnvironmentalObstructionTypesequenceextensioncomplexContentEnvironmentalObstructionschema_EnvironmentalObstructionType_TEnvironmentalObstructionTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "ef50bf7574e9a4a1b346c9079a54f790", "score": "0.5649501", "text": "func (me *XsdGoPkgHasElems_ObstructionTypesequenceextensioncomplexContentGeneralObstructionschema_ObstructionType_TObstructionTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElems_ObstructionTypesequenceextensioncomplexContentGeneralObstructionschema_ObstructionType_TObstructionTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "0ff0d2dea167dc30472d3591220cba40", "score": "0.5648855", "text": "func (me TNonWeatherRelatedRoadConditionTypeEnum) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "0d10c0a7aebd056de71a37a452a18dc1", "score": "0.5640793", "text": "func (me *XsdGoPkgHasElems_InfrastructureDamageTypesequenceextensioncomplexContentInfrastructureDamageObstructionschema_InfrastructureDamageType_TInfrastructureDamageTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElems_InfrastructureDamageTypesequenceextensioncomplexContentInfrastructureDamageObstructionschema_InfrastructureDamageType_TInfrastructureDamageTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "43f7e7737cd0581fc43f1480f55453ba", "score": "0.5625874", "text": "func (me *XsdGoPkgHasElem_RoadMaintenanceTypesequenceextensioncomplexContentMaintenanceWorksschema_RoadMaintenanceType_TRoadMaintenanceTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_RoadMaintenanceTypesequenceextensioncomplexContentMaintenanceWorksschema_RoadMaintenanceType_TRoadMaintenanceTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "ce1846a745460c1147abf9b80e2eaacb", "score": "0.56063837", "text": "func (me *XsdGoPkgHasElem_ReroutingManagementTypesequenceextensioncomplexContentReroutingManagementschema_ReroutingManagementType_TReroutingManagementTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_ReroutingManagementTypesequenceextensioncomplexContentReroutingManagementschema_ReroutingManagementType_TReroutingManagementTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "131541316e0b69cbd6bdd0b7a7b99e8d", "score": "0.5571882", "text": "func (me *XsdGoPkgHasElem_SpeedManagementTypesequenceextensioncomplexContentSpeedManagementschema_SpeedManagementType_TSpeedManagementTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_SpeedManagementTypesequenceextensioncomplexContentSpeedManagementschema_SpeedManagementType_TSpeedManagementTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "88e733d6a4a6586dd494fd9f4ae1e5bf", "score": "0.5494426", "text": "func (me *XsdGoPkgHasElem_TrafficConstrictionTypesequenceImpactschema_TrafficConstrictionType_TrafficConstrictionTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_TrafficConstrictionTypesequenceImpactschema_TrafficConstrictionType_TrafficConstrictionTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "c100e8b5a5c22fd913075f732926ae84", "score": "0.54857355", "text": "func (me *XsdGoPkgHasElems_ReroutingManagementTypesequenceextensioncomplexContentReroutingManagementschema_ReroutingManagementType_TReroutingManagementTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElems_ReroutingManagementTypesequenceextensioncomplexContentReroutingManagementschema_ReroutingManagementType_TReroutingManagementTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "5c712d50f513429b0984f2cf4bee757d", "score": "0.54829353", "text": "func (me TWeatherRelatedRoadConditionTypeEnum) IsOther() bool { return me.String() == \"other\" }", "title": "" }, { "docid": "1c493d6e456cc5d4cbd30adfb888a146", "score": "0.5477758", "text": "func (me *XsdGoPkgHasElems_SpeedManagementTypesequenceextensioncomplexContentSpeedManagementschema_SpeedManagementType_TSpeedManagementTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElems_SpeedManagementTypesequenceextensioncomplexContentSpeedManagementschema_SpeedManagementType_TSpeedManagementTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "975d71ddb55cadb62f426ec973da1d1f", "score": "0.5470425", "text": "func (me *XsdGoPkgHasElems_WeatherRelatedRoadConditionsExtensionsequenceextensioncomplexContentWeatherRelatedRoadConditionsschema_WeatherRelatedRoadConditionsExtension_TExtensionType_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElems_WeatherRelatedRoadConditionsExtensionsequenceextensioncomplexContentWeatherRelatedRoadConditionsschema_WeatherRelatedRoadConditionsExtension_TExtensionType_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tfor _, x := range me.WeatherRelatedRoadConditionsExtensions {\n\t\t\tif err = x.Walk(); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "d7b9baf4485b169c3c4275dc38995190", "score": "0.54645574", "text": "func (me *TNonWeatherRelatedRoadConditionTypeEnum) Set(s string) { (*xsdt.String)(me).Set(s) }", "title": "" }, { "docid": "204693b7233afab608a14d874aa08a4a", "score": "0.5457887", "text": "func (me *TWeatherRelatedRoadConditions) Walk() (err error) {\n\tif fn := WalkHandlers.TWeatherRelatedRoadConditions; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif err = me.TRoadConditions.Walk(); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\treturn\n\t\t}\n\t\tif err = me.XsdGoPkgHasElems_WeatherRelatedRoadConditionTypesequenceextensioncomplexContentRoadSurfaceConditionInformationschema_WeatherRelatedRoadConditionType_TWeatherRelatedRoadConditionTypeEnum_.Walk(); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\treturn\n\t\t}\n\t\tif err = me.XsdGoPkgHasElem_RoadSurfaceConditionMeasurementssequenceextensioncomplexContentRoadSurfaceConditionInformationschema_RoadSurfaceConditionMeasurements_TRoadSurfaceConditionMeasurements_.Walk(); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\treturn\n\t\t}\n\t\tif err = me.XsdGoPkgHasElem_WeatherRelatedRoadConditionsExtensionsequenceextensioncomplexContentWeatherRelatedRoadConditionsschema_WeatherRelatedRoadConditionsExtension_TExtensionType_.Walk(); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\treturn\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "4bd31ec3f32d03f1a6e350881b575cec", "score": "0.5422332", "text": "func (me *XsdGoPkgHasElems_RoadMaintenanceTypesequenceextensioncomplexContentMaintenanceWorksschema_RoadMaintenanceType_TRoadMaintenanceTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElems_RoadMaintenanceTypesequenceextensioncomplexContentMaintenanceWorksschema_RoadMaintenanceType_TRoadMaintenanceTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "536fa2a97cfd6e585249b53602802c81", "score": "0.5420965", "text": "func (me *XsdGoPkgHasElem_InjuryStatussequenceGroupOfPeopleInvolvedschema_InjuryStatus_TInjuryStatusTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_InjuryStatussequenceGroupOfPeopleInvolvedschema_InjuryStatus_TInjuryStatusTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "936d63b5902a03f6f89df0e4dd5f61c0", "score": "0.53833884", "text": "func (me *XsdGoPkgHasElem_ConstructionWorkTypesequenceextensioncomplexContentConstructionWorksschema_ConstructionWorkType_TConstructionWorkTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_ConstructionWorkTypesequenceextensioncomplexContentConstructionWorksschema_ConstructionWorkType_TConstructionWorkTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "4a8440610b5e8792f260d17cfa324c81", "score": "0.53756374", "text": "func (me *XsdGoPkgHasElem_NonWeatherRelatedRoadConditionsExtensionsequenceextensioncomplexContentNonWeatherRelatedRoadConditionsschema_NonWeatherRelatedRoadConditionsExtension_TExtensionType_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_NonWeatherRelatedRoadConditionsExtensionsequenceextensioncomplexContentNonWeatherRelatedRoadConditionsschema_NonWeatherRelatedRoadConditionsExtension_TExtensionType_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif err = me.NonWeatherRelatedRoadConditionsExtension.Walk(); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\treturn\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "e61c52eecc5de91e55309716e5b9111f", "score": "0.5358504", "text": "func (me *XsdGoPkgHasElem_RoadSurfaceConditionMeasurementsExtensionsequenceRoadSurfaceConditionMeasurementsschema_RoadSurfaceConditionMeasurementsExtension_TExtensionType_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_RoadSurfaceConditionMeasurementsExtensionsequenceRoadSurfaceConditionMeasurementsschema_RoadSurfaceConditionMeasurementsExtension_TExtensionType_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif err = me.RoadSurfaceConditionMeasurementsExtension.Walk(); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\treturn\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "7da5d3da57500b6e82d817f1cba17ad1", "score": "0.5346627", "text": "func (me TNonWeatherRelatedRoadConditionTypeEnum) IsOther() bool { return me.String() == \"other\" }", "title": "" }, { "docid": "f801d78dbbfeef20da15c3c581797163", "score": "0.53312016", "text": "func (me TWeatherRelatedRoadConditionTypeEnum) IsWetAndIcyRoad() bool {\n\treturn me.String() == \"wetAndIcyRoad\"\n}", "title": "" }, { "docid": "db496c65a10aaa2d86ade40ec26b9f42", "score": "0.5323209", "text": "func (me TDrivingConditionTypeEnum) IsWinterConditions() bool {\n\treturn me.String() == \"winterConditions\"\n}", "title": "" }, { "docid": "91e64ce98fab010e93a847407ff209ef", "score": "0.5313022", "text": "func (me *XsdGoPkgHasElems_RoadSurfaceConditionInformationExtensionsequenceextensioncomplexContentRoadSurfaceConditionInformationschema_RoadSurfaceConditionInformationExtension_TExtensionType_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElems_RoadSurfaceConditionInformationExtensionsequenceextensioncomplexContentRoadSurfaceConditionInformationschema_RoadSurfaceConditionInformationExtension_TExtensionType_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tfor _, x := range me.RoadSurfaceConditionInformationExtensions {\n\t\t\tif err = x.Walk(); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "367d7b80fad5c6038cecdd73f0bb65d1", "score": "0.5284883", "text": "func (me *XsdGoPkgHasElem_ApplicableForTrafficTypesequenceextensioncomplexContentNetworkManagementschema_ApplicableForTrafficType_TrafficTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_ApplicableForTrafficTypesequenceextensioncomplexContentNetworkManagementschema_ApplicableForTrafficType_TrafficTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "bc22b56c9e13d414c499b4e2573a1b5b", "score": "0.52824765", "text": "func (me *XsdGoPkgHasElems_TrafficConstrictionTypesequenceImpactschema_TrafficConstrictionType_TrafficConstrictionTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElems_TrafficConstrictionTypesequenceImpactschema_TrafficConstrictionType_TrafficConstrictionTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "4f74133c0cd33ade11eee6631cb7b076", "score": "0.5281751", "text": "func (me TMeasuredOrDerivedDataTypeEnum) IsRoadSurfaceConditionInformation() bool {\n\treturn me.String() == \"roadSurfaceConditionInformation\"\n}", "title": "" }, { "docid": "e035e851987978ac5858d73512d5cf4c", "score": "0.5278996", "text": "func (me *XsdGoPkgHasElem_GeneralDayTypesequenceDayTypeschema_GeneralDayType_TGeneralDayTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_GeneralDayTypesequenceDayTypeschema_GeneralDayType_TGeneralDayTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "c57b99f13c383b1c510d020eb2cd4371", "score": "0.5274537", "text": "func (me *XsdGoPkgHasElem_AnimalPresenceTypesequenceextensioncomplexContentAnimalPresenceObstructionschema_AnimalPresenceType_TAnimalPresenceTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_AnimalPresenceTypesequenceextensioncomplexContentAnimalPresenceObstructionschema_AnimalPresenceType_TAnimalPresenceTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "852b06710ff148b5759e6f59bafe4071", "score": "0.5252969", "text": "func (me *XsdGoPkgHasElem_RoadworksDurationsequenceextensioncomplexContentRoadworksschema_RoadworksDuration_TRoadworksDurationEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_RoadworksDurationsequenceextensioncomplexContentRoadworksschema_RoadworksDuration_TRoadworksDurationEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "229af1df4540c8e89b14f6252821716d", "score": "0.52457446", "text": "func (me *XsdGoPkgHasElem_AbnormalTrafficTypesequenceextensioncomplexContentAbnormalTrafficschema_AbnormalTrafficType_TAbnormalTrafficTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_AbnormalTrafficTypesequenceextensioncomplexContentAbnormalTrafficschema_AbnormalTrafficType_TAbnormalTrafficTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "081f9583ad8e6ce32a569ae82cc52ea5", "score": "0.5224012", "text": "func (me TNonWeatherRelatedRoadConditionTypeEnum) IsRoadSurfaceInPoorCondition() bool {\n\treturn me.String() == \"roadSurfaceInPoorCondition\"\n}", "title": "" }, { "docid": "4d246efbfa2e9baf13b0fd83729c4a10", "score": "0.52181464", "text": "func (me *XsdGoPkgHasElem_RoadConditionsExtensionsequenceextensioncomplexContentRoadConditionsschema_RoadConditionsExtension_TExtensionType_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_RoadConditionsExtensionsequenceextensioncomplexContentRoadConditionsschema_RoadConditionsExtension_TExtensionType_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif err = me.RoadConditionsExtension.Walk(); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\treturn\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "0e0403bdbf362b056a594fbb17d49b9f", "score": "0.5214849", "text": "func (me TGeneralDayTypeEnum) IsRaceMeetingDay() bool { return me.String() == \"raceMeetingDay\" }", "title": "" }, { "docid": "f87ea89d543192d3f64fada07117ba25", "score": "0.52085876", "text": "func (me *XsdGoPkgHasElems_ConstructionWorkTypesequenceextensioncomplexContentConstructionWorksschema_ConstructionWorkType_TConstructionWorkTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElems_ConstructionWorkTypesequenceextensioncomplexContentConstructionWorksschema_ConstructionWorkType_TConstructionWorkTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "b04c103ef833f131a3ca145a46ad7695", "score": "0.5197223", "text": "func (me *XsdGoPkgHasElem_FuelTypesequenceVehicleCharacteristicsschema_FuelType_TFuelTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_FuelTypesequenceVehicleCharacteristicsschema_FuelType_TFuelTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "51d33306e2fb93b0608bd56edfb45ebc", "score": "0.5188134", "text": "func (me *XsdGoPkgHasElems_InjuryStatussequenceGroupOfPeopleInvolvedschema_InjuryStatus_TInjuryStatusTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElems_InjuryStatussequenceGroupOfPeopleInvolvedschema_InjuryStatus_TInjuryStatusTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "d0dfcbbd37a1e53a3306b375ec602344", "score": "0.51674", "text": "func (me *XsdGoPkgHasElem_PublicHolidayTypesequencePublicHolidayschema_PublicHolidayType_TPublicHolidayTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_PublicHolidayTypesequencePublicHolidayschema_PublicHolidayType_TPublicHolidayTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "75a036fad7a05c5144b0f35ce1def9da", "score": "0.51360023", "text": "func (me *XsdGoPkgHasElem_VehicleTypesequenceVehicleCharacteristicsschema_VehicleType_TVehicleTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_VehicleTypesequenceVehicleCharacteristicsschema_VehicleType_TVehicleTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "a8c69ed65dea304eb2ba3f3ff14aad70", "score": "0.5134127", "text": "func (me *XsdGoPkgHasElem_GeneralNetworkManagementTypesequenceextensioncomplexContentGeneralNetworkManagementschema_GeneralNetworkManagementType_TGeneralNetworkManagementTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_GeneralNetworkManagementTypesequenceextensioncomplexContentGeneralNetworkManagementschema_GeneralNetworkManagementType_TGeneralNetworkManagementTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "9974e501f5437a44e4041f62eb99b34d", "score": "0.5091917", "text": "func (me *XsdGoPkgHasElems_ApplicableForTrafficTypesequenceextensioncomplexContentNetworkManagementschema_ApplicableForTrafficType_TrafficTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElems_ApplicableForTrafficTypesequenceextensioncomplexContentNetworkManagementschema_ApplicableForTrafficType_TrafficTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "3e9de7d0ebc531d0268e27a0fbf08950", "score": "0.50825906", "text": "func (me *XsdGoPkgHasElem_CarriagewaysequenceAffectedCarriagewayAndLanesschema_Carriageway_TCarriagewayEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_CarriagewaysequenceAffectedCarriagewayAndLanesschema_Carriageway_TCarriagewayEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "8a1a8a5d383f7cc5aebc3a61551eb269", "score": "0.5080863", "text": "func (me *XsdGoPkgHasElems_NonWeatherRelatedRoadConditionsExtensionsequenceextensioncomplexContentNonWeatherRelatedRoadConditionsschema_NonWeatherRelatedRoadConditionsExtension_TExtensionType_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElems_NonWeatherRelatedRoadConditionsExtensionsequenceextensioncomplexContentNonWeatherRelatedRoadConditionsschema_NonWeatherRelatedRoadConditionsExtension_TExtensionType_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tfor _, x := range me.NonWeatherRelatedRoadConditionsExtensions {\n\t\t\tif err = x.Walk(); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "299011278c8a3a3590d65bf26b6e58fd", "score": "0.50789475", "text": "func (me TObstructionTypeEnum) IsClearanceWork() bool { return me.String() == \"clearanceWork\" }", "title": "" }, { "docid": "dbc8fe3fcbda6b453b025000fbd69c78", "score": "0.50658625", "text": "func (me *XsdGoPkgHasElems_RoadworksDurationsequenceextensioncomplexContentRoadworksschema_RoadworksDuration_TRoadworksDurationEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElems_RoadworksDurationsequenceextensioncomplexContentRoadworksschema_RoadworksDuration_TRoadworksDurationEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "440c6703325635abc38354170a490428", "score": "0.50649744", "text": "func (me *XsdGoPkgHasElem_SpecificMeasurementValueTypesequenceMeasurementSpecificCharacteristicsschema_SpecificMeasurementValueType_TMeasuredOrDerivedDataTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_SpecificMeasurementValueTypesequenceMeasurementSpecificCharacteristicsschema_SpecificMeasurementValueType_TMeasuredOrDerivedDataTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "999c0aa6a2b90aa78d5c5ca14275fc32", "score": "0.50599444", "text": "func (f Field) IsEnum() bool { return f.Type != nil && f.Type.Type == field.TypeEnum }", "title": "" }, { "docid": "dc7ff182d190ea21e710013c6a0c6a6a", "score": "0.5044417", "text": "func (me TGeneralDayTypeEnum) IsBicycleRaceDay() bool { return me.String() == \"bicycleRaceDay\" }", "title": "" }, { "docid": "aa88d9876351438e51eabc1dd66a6008", "score": "0.5043512", "text": "func (me TSubjectTypeOfWorksEnum) IsRoad() bool { return me.String() == \"road\" }", "title": "" }, { "docid": "86a107ee3727245bc8f92d4a8106416a", "score": "0.50292003", "text": "func (me *XsdGoPkgHasElems_GeneralDayTypesequenceDayTypeschema_GeneralDayType_TGeneralDayTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElems_GeneralDayTypesequenceDayTypeschema_GeneralDayType_TGeneralDayTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "038b0f9dc16ad7d1fb1bd521ddab4d28", "score": "0.5026852", "text": "func (me *XsdGoPkgHasElem_DisturbanceActivityTypesequenceextensioncomplexContentDisturbanceActivityschema_DisturbanceActivityType_TDisturbanceActivityTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_DisturbanceActivityTypesequenceextensioncomplexContentDisturbanceActivityschema_DisturbanceActivityType_TDisturbanceActivityTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "91bb226755209a71ae878de527de2388", "score": "0.5015692", "text": "func (me *XsdGoPkgHasElem_TransitServiceTypesequenceextensioncomplexContentTransitInformationschema_TransitServiceType_TransitServiceTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_TransitServiceTypesequenceextensioncomplexContentTransitInformationschema_TransitServiceType_TransitServiceTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "c5cbda0c580791c2ac0f7e25f369c6c1", "score": "0.50105196", "text": "func (me *XsdGoPkgHasElems_AnimalPresenceTypesequenceextensioncomplexContentAnimalPresenceObstructionschema_AnimalPresenceType_TAnimalPresenceTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElems_AnimalPresenceTypesequenceextensioncomplexContentAnimalPresenceObstructionschema_AnimalPresenceType_TAnimalPresenceTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "c93cf20865d8265897f06f35620e14ce", "score": "0.4994792", "text": "func (me TWeatherRelatedRoadConditionTypeEnum) IsIce() bool { return me.String() == \"ice\" }", "title": "" }, { "docid": "bf6e8f4adac122050d783ccfc0ce884b", "score": "0.49926746", "text": "func (me TWeatherRelatedRoadConditionTypeEnum) IsRoadSurfaceMelting() bool {\n\treturn me.String() == \"roadSurfaceMelting\"\n}", "title": "" }, { "docid": "9e004a8ac2828295049461d893003b89", "score": "0.49922162", "text": "func (me TCauseTypeEnum) IsPoorWeather() bool { return me.String() == \"poorWeather\" }", "title": "" }, { "docid": "61f4002a5e302e14105438bbaa573d6a", "score": "0.49802968", "text": "func (me *XsdGoPkgHasElem_TrafficStatusValuesequenceextensioncomplexContentTrafficStatusValueschema_TrafficStatusValue_TrafficStatusEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_TrafficStatusValuesequenceextensioncomplexContentTrafficStatusValueschema_TrafficStatusValue_TrafficStatusEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "aa091be1352e8a090bf90f0e9f6a4e92", "score": "0.4979294", "text": "func (me *XsdGoPkgHasElems_GeneralNetworkManagementTypesequenceextensioncomplexContentGeneralNetworkManagementschema_GeneralNetworkManagementType_TGeneralNetworkManagementTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElems_GeneralNetworkManagementTypesequenceextensioncomplexContentGeneralNetworkManagementschema_GeneralNetworkManagementType_TGeneralNetworkManagementTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "09e8d36e62e6f6fb21e3ace07b2043f1", "score": "0.49764314", "text": "func (me TWeatherRelatedRoadConditionTypeEnum) IsSurfaceWater() bool {\n\treturn me.String() == \"surfaceWater\"\n}", "title": "" }, { "docid": "532c5798a84cf16e5ecaef35234c9104", "score": "0.49755722", "text": "func (me *XsdGoPkgHasElems_FuelTypesequenceVehicleCharacteristicsschema_FuelType_TFuelTypeEnum_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElems_FuelTypesequenceVehicleCharacteristicsschema_FuelType_TFuelTypeEnum_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "d76d8691722ef51690e29f1e8c5aeb82", "score": "0.49621418", "text": "func (E_OpenconfigTransportTypes_LOGICAL_ELEMENT_PROTOCOL_TYPE) IsYANGGoEnum() {}", "title": "" }, { "docid": "d76d8691722ef51690e29f1e8c5aeb82", "score": "0.496066", "text": "func (E_OpenconfigTransportTypes_LOGICAL_ELEMENT_PROTOCOL_TYPE) IsYANGGoEnum() {}", "title": "" }, { "docid": "d76d8691722ef51690e29f1e8c5aeb82", "score": "0.496066", "text": "func (E_OpenconfigTransportTypes_LOGICAL_ELEMENT_PROTOCOL_TYPE) IsYANGGoEnum() {}", "title": "" }, { "docid": "213925901bd2eec17f1aa331a42a60dd", "score": "0.49570468", "text": "func (me *TNonWeatherRelatedRoadConditions) Walk() (err error) {\n\tif fn := WalkHandlers.TNonWeatherRelatedRoadConditions; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif err = me.TRoadConditions.Walk(); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\treturn\n\t\t}\n\t\tif err = me.XsdGoPkgHasElems_NonWeatherRelatedRoadConditionTypesequenceextensioncomplexContentNonWeatherRelatedRoadConditionsschema_NonWeatherRelatedRoadConditionType_TNonWeatherRelatedRoadConditionTypeEnum_.Walk(); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\treturn\n\t\t}\n\t\tif err = me.XsdGoPkgHasElem_NonWeatherRelatedRoadConditionsExtensionsequenceextensioncomplexContentNonWeatherRelatedRoadConditionsschema_NonWeatherRelatedRoadConditionsExtension_TExtensionType_.Walk(); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\treturn\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" } ]
11be0900194f1e965f2b80900e3bb097
EnterV is called when production v is entered.
[ { "docid": "786cd2b86a50bd92de9ce650c2f335cc", "score": "0.82752734", "text": "func (s *BasemorsecodeListener) EnterV(ctx *VContext) {}", "title": "" } ]
[ { "docid": "0514447cb0add7ab0fc0f52cf81da4c5", "score": "0.6472549", "text": "func (s *BasemorsecodeListener) ExitV(ctx *VContext) {}", "title": "" }, { "docid": "aa9bc991d48150574d990722ca6d837e", "score": "0.606808", "text": "func (p *SProcChain) PushV(f SProc, v gripcrypto.SignInf) {\r\n\tp.funcs = append(p.funcs, sProcElm{f, v})\r\n}", "title": "" }, { "docid": "c61646f817e3f0a9185877f77556e7e8", "score": "0.5878222", "text": "func (sem Semaphore) V() {\n\t<-sem\n}", "title": "" }, { "docid": "0cd8f835cc02f2c7f60b406f73923a47", "score": "0.5853079", "text": "func (s *BaseHiveParserListener) EnterVirtualTableSource(ctx *VirtualTableSourceContext) {}", "title": "" }, { "docid": "259845e428522b9283b4b743930d4feb", "score": "0.58176374", "text": "func (s *BasePowerBuilderParserListener) EnterValue(ctx *ValueContext) {}", "title": "" }, { "docid": "f7523a0365caacfab4ed3dfed9fe4703", "score": "0.5811952", "text": "func (s *BaseONCRPCv2Listener) EnterVersionDef(ctx *VersionDefContext) {}", "title": "" }, { "docid": "72e71a644e892281c205392a39ddc297", "score": "0.57808167", "text": "func (s *BaseorwellListener) EnterVar_(ctx *Var_Context) {}", "title": "" }, { "docid": "54ea21e860dbde164d9969a40b8d791d", "score": "0.5762031", "text": "func (s *BaseONCRPCv2Listener) EnterValue(ctx *ValueContext) {}", "title": "" }, { "docid": "607b7468a443da9f19e48948ace7fedb", "score": "0.57473814", "text": "func (s *BaseCQL3Listener) EnterVariable(ctx *VariableContext) {}", "title": "" }, { "docid": "7d9f80f7ce02695e9d646404a7ed19b1", "score": "0.57246107", "text": "func (s *BasecayenneListener) EnterVis(ctx *VisContext) {}", "title": "" }, { "docid": "5f32ccfae6c2dbb425cb5a3e64da0440", "score": "0.57114965", "text": "func (s *BasevinLangListener) EnterFunctionCall(ctx *FunctionCallContext) {}", "title": "" }, { "docid": "6b537d7b1b28d46aa7074989d3a2d56a", "score": "0.57041156", "text": "func (s *BaseBODLParserListener) EnterValutaionExpression(ctx *ValutaionExpressionContext) {}", "title": "" }, { "docid": "bb13c70c518f17207e7b0529572e6c7d", "score": "0.5692333", "text": "func (t *Traversal) InV(args ...any) *Traversal {\n\treturn t.Add(Dot, NewFunc(\"inV\", args...))\n}", "title": "" }, { "docid": "5901da41b24bf70166e393d01324d514", "score": "0.56788075", "text": "func (t *Traversal) V(args ...any) *Traversal {\n\tt.Add(Dot, NewFunc(\"V\", args...))\n\treturn t\n}", "title": "" }, { "docid": "448c765477408410c06d0962b3012dcc", "score": "0.5632481", "text": "func (s *BaseapexListener) EnterVariableModifier(ctx *VariableModifierContext) {}", "title": "" }, { "docid": "13c3db5f3811d1cc1be0049a071f2336", "score": "0.5632355", "text": "func (s *BaseArgParseListener) EnterVal(ctx *ValContext) {}", "title": "" }, { "docid": "86b69267d4157f3c4d71b3e8eb49e7fa", "score": "0.5624393", "text": "func (s *BasevinLangListener) EnterExpression(ctx *ExpressionContext) {}", "title": "" }, { "docid": "bd73f33e5323e90ce78f6098cc96ffdf", "score": "0.56162333", "text": "func (s *BasetsqlListener) EnterNvf_call(ctx *Nvf_callContext) {}", "title": "" }, { "docid": "acb512884701cc2c67fede22bb20ecb2", "score": "0.5612806", "text": "func (s *Baseasm8086Listener) EnterEqu(ctx *EquContext) {}", "title": "" }, { "docid": "4cd7543c432ac78f1cdce9c53b0453a3", "score": "0.5583329", "text": "func (s *BasevinLangListener) EnterStatement(ctx *StatementContext) {}", "title": "" }, { "docid": "1ab6b4fe586705a481af217165e14a7a", "score": "0.558268", "text": "func (s *BasevinLangListener) EnterProgram(ctx *ProgramContext) {}", "title": "" }, { "docid": "ee7abf0ac6c720305a4986c8a812cceb", "score": "0.5574478", "text": "func (s *BaseASLListener) EnterVariable(ctx *VariableContext) {}", "title": "" }, { "docid": "3203f123d799f6faa411dee3c0c3a01c", "score": "0.55625427", "text": "func (s *BaseabbParserListener) EnterProcedure(ctx *ProcedureContext) {}", "title": "" }, { "docid": "9aab6dea3583e7f816e929509266d328", "score": "0.55620295", "text": "func (s *BaseJPAListener) EnterNew_value(ctx *New_valueContext) {}", "title": "" }, { "docid": "f2cd307aad9724f5d48744fb5f4c3183", "score": "0.55378103", "text": "func (s *BaseAgeListener) EnterVertex(ctx *VertexContext) {}", "title": "" }, { "docid": "568332f5d33158cf253552e9a0c5c2d1", "score": "0.5532729", "text": "func (s *BasemorsecodeListener) EnterS(ctx *SContext) {}", "title": "" }, { "docid": "ff293b39f74989ba92405f0bbbd6985f", "score": "0.5522462", "text": "func (s *InfoCollector) EnterVar_(ctx *parser.Var_Context) {}", "title": "" }, { "docid": "43c2e4e50a6fb044070aa40a29caf44a", "score": "0.5519063", "text": "func (c Cmd) V(y svg.Number) Cmd {\n\treturn c + V(y)\n}", "title": "" }, { "docid": "785c882cbf7c6ad53a6689baf27c4074", "score": "0.5518534", "text": "func (s *BasepropertiesListener) EnterKey(ctx *KeyContext) {}", "title": "" }, { "docid": "fa0bbb630a467e9ab8df3b7296e50e45", "score": "0.55167574", "text": "func (s *BaseAgeListener) EnterValue(ctx *ValueContext) {}", "title": "" }, { "docid": "9facd4d02cb329658ca7b13e807a8fce", "score": "0.55106896", "text": "func (o *WlSurface) ServeEnter(output *WlOutput) error {\n\tif o.enterHandler == nil {\n\t\treturn nil\n\t}\n\treturn o.enterHandler(output)\n}", "title": "" }, { "docid": "65dfdc355c4b36b514f73f947ba914b5", "score": "0.5500182", "text": "func (s *BasefolListener) EnterVariable(ctx *VariableContext) {}", "title": "" }, { "docid": "82f091943ad1f9bb9103b5b0b2fc5e77", "score": "0.54993635", "text": "func (s *BaseCLIFListener) EnterEquation(ctx *EquationContext) {}", "title": "" }, { "docid": "6cb463d89ae386a1b36fb47b20cd3638", "score": "0.54805356", "text": "func (s *binarySemaphore) V() {\n\tselect {\n\tcase s.ch <- struct{}{}:\n\tdefault: // Don't block if the semaphore count is already 1.\n\t}\n}", "title": "" }, { "docid": "33da5e41c2f72ad53f9ddb1848b5007d", "score": "0.547659", "text": "func (s *BaseHiveParserListener) EnterVectorizatonDetail(ctx *VectorizatonDetailContext) {}", "title": "" }, { "docid": "5286e12c7d44c58f1edfd7f4a4cb9f55", "score": "0.5467501", "text": "func (s *BasemorsecodeListener) EnterP(ctx *PContext) {}", "title": "" }, { "docid": "b6acfcd4ba8fcbdfcb48f433afd04b93", "score": "0.5463085", "text": "func (s *BaseGolangListener) EnterKey(ctx *KeyContext) {}", "title": "" }, { "docid": "93b75403fccab10cca1f43318c2b3aa1", "score": "0.54574007", "text": "func (s *BaseBODLParserListener) EnterValuationDefinition(ctx *ValuationDefinitionContext) {}", "title": "" }, { "docid": "f69c85ab4677fb8481a47a855eaa83ec", "score": "0.5432846", "text": "func (s *BasemorsecodeListener) EnterN(ctx *NContext) {}", "title": "" }, { "docid": "80d941c8e6cc1b0d7463a2a332ec8cba", "score": "0.54206866", "text": "func (s *Baseasm8086Listener) EnterOpcode(ctx *OpcodeContext) {}", "title": "" }, { "docid": "dd97df05e5e623c601830bd54810713c", "score": "0.54145896", "text": "func (s *BaseWavefrontOBJListener) EnterVertex(ctx *VertexContext) {}", "title": "" }, { "docid": "7190f04a26be76719bcf8a058f5243de", "score": "0.54102516", "text": "func V(y svg.Number) Cmd {\n\treturn Cmd(\"V \" + internal.Stringify(y, \" \"))\n\n}", "title": "" }, { "docid": "27d5688e935ab412fe367520ae8f7fd6", "score": "0.53651685", "text": "func (s *BasepropertiesListener) EnterValue(ctx *ValueContext) {}", "title": "" }, { "docid": "182db1a29010d0799dd432b89c7bcb02", "score": "0.5360453", "text": "func (s *BasemorsecodeListener) EnterH(ctx *HContext) {}", "title": "" }, { "docid": "9a5574f2e40ff371f983c11c7b8a4b94", "score": "0.5343821", "text": "func (s *BaseabbParserListener) EnterProcParameter(ctx *ProcParameterContext) {}", "title": "" }, { "docid": "3b094995f203f33acde53151f65c4d5d", "score": "0.53394616", "text": "func (s *BaserefalListener) EnterEvar(ctx *EvarContext) {}", "title": "" }, { "docid": "14d46728a77faa3ae4dc858a94021794", "score": "0.53361624", "text": "func (s *BasefilterListener) EnterValue(ctx *ValueContext) {}", "title": "" }, { "docid": "b944584b9b14331201d84ed8ed0f2074", "score": "0.53263277", "text": "func (s *BaseHiveParserListener) EnterKeyValueProperty(ctx *KeyValuePropertyContext) {}", "title": "" }, { "docid": "68c2a233ffa5ac1538764e56397d9a16", "score": "0.53232485", "text": "func (s *BaseHiveParserListener) EnterPartitionVal(ctx *PartitionValContext) {}", "title": "" }, { "docid": "00817441b5ca45118b43e135c381258b", "score": "0.53205365", "text": "func (s *BasemorsecodeListener) EnterK(ctx *KContext) {}", "title": "" }, { "docid": "bba4a180ec8fcc8045406c75d4b136c0", "score": "0.53108335", "text": "func (s *BasemorsecodeListener) EnterC(ctx *CContext) {}", "title": "" }, { "docid": "5e01b897ff713fdaef977bb58c88d58f", "score": "0.53015804", "text": "func (s *BaseCQL3Listener) EnterTerm(ctx *TermContext) {}", "title": "" }, { "docid": "63aeac7541a945f7095e9b6fc9e0e47a", "score": "0.5299752", "text": "func (s *BaseIniListener) EnterValue(ctx *ValueContext) {}", "title": "" }, { "docid": "e5ae19d47746d09e5679fe15a9a0b5f5", "score": "0.52959836", "text": "func (d *CountAvgAggregator) Enter(e Event, w Window) {\n\tval := d.getValue(e.Value)\n\td.sum += val\n\td.sqSum += val * val\n\td.count++\n}", "title": "" }, { "docid": "ba92863499855bda4a288dea84d705ba", "score": "0.52944386", "text": "func (s *BaseArgParseListener) EnterKey(ctx *KeyContext) {}", "title": "" }, { "docid": "73fcb43c8c95ece52258cdb6fd533a21", "score": "0.5293833", "text": "func (s *BasemorsecodeListener) EnterU(ctx *UContext) {}", "title": "" }, { "docid": "f07271d7b1ce400a94dbb444e70a3f03", "score": "0.5288646", "text": "func (s *Baseasm8086Listener) EnterLine(ctx *LineContext) {}", "title": "" }, { "docid": "8fc032b497259e2abaae365e2ead6ea1", "score": "0.52829903", "text": "func (s *BasemorsecodeListener) EnterE(ctx *EContext) {}", "title": "" }, { "docid": "356051320ebbf9374fcb690e3106b8c5", "score": "0.5280339", "text": "func (s *BasemorsecodeListener) EnterW(ctx *WContext) {}", "title": "" }, { "docid": "eeda4ae5576ba4c2be4c3e67d81464fc", "score": "0.52792114", "text": "func (s *BaserefalListener) EnterVariable(ctx *VariableContext) {}", "title": "" }, { "docid": "33bdf94eeb9900d9a71133449726e651", "score": "0.52707934", "text": "func (s *BaseIniListener) EnterValueLine(ctx *ValueLineContext) {}", "title": "" }, { "docid": "a19e2570a5140dd9958e5c0d5f809b76", "score": "0.52691966", "text": "func (s *BaseExprListener) EnterE(ctx *EContext) {}", "title": "" }, { "docid": "a90240315251b7b9b28891969ec524d5", "score": "0.5262936", "text": "func (s *BasemorsecodeListener) EnterZ(ctx *ZContext) {}", "title": "" }, { "docid": "d3d879301322a30306e432c36aebf748", "score": "0.5262135", "text": "func (s *BasekarelListener) EnterCondition(ctx *ConditionContext) {}", "title": "" }, { "docid": "88c04a55c267688a78d70fc2739c98a6", "score": "0.526203", "text": "func (s *BasemorsecodeListener) EnterNine(ctx *NineContext) {}", "title": "" }, { "docid": "7f69402aee9887fc471e5ba2836c5d51", "score": "0.5255799", "text": "func (s *BaseLessParserListener) EnterValues(ctx *ValuesContext) {}", "title": "" }, { "docid": "94ccf4d7f49f1fed74c60b5a86eaeea0", "score": "0.52536297", "text": "func (s *BaseapexListener) EnterViewClause(ctx *ViewClauseContext) {}", "title": "" }, { "docid": "8d2d3189a5eb4542bb89373b60db9c6f", "score": "0.52529293", "text": "func (s *BaseABSLParserListener) EnterVarModifier(ctx *VarModifierContext) {}", "title": "" }, { "docid": "fcb7cce2fba759db24eac11e110c22d8", "score": "0.5246596", "text": "func (s *BaseapexListener) EnterModifier(ctx *ModifierContext) {}", "title": "" }, { "docid": "6134e34d78a3537ab04476652e18112a", "score": "0.5242519", "text": "func (s *Baseasm8086Listener) EnterNumber(ctx *NumberContext) {}", "title": "" }, { "docid": "a4cbe41c37ab8cb192178f6b8dc5601f", "score": "0.5231867", "text": "func (s *BaseFmtParserListener) EnterValue(ctx *ValueContext) {}", "title": "" }, { "docid": "ef9e4c9250c79412d5a72e90bd9b061c", "score": "0.52262294", "text": "func (o *WlDataDevice) ServeEnter(serial wire.Uint, surface *WlSurface, x wire.Fixed, y wire.Fixed, id *WlDataOffer) error {\n\tif o.enterHandler == nil {\n\t\treturn nil\n\t}\n\treturn o.enterHandler(serial, surface, x, y, id)\n}", "title": "" }, { "docid": "b94b52c6503766ebeb082254f566815a", "score": "0.5224636", "text": "func (s *BaseapexListener) EnterStatement(ctx *StatementContext) {}", "title": "" }, { "docid": "a3a916e1a3e105d91afec676bb138e9c", "score": "0.5215685", "text": "func Enter(format string, v ...interface{}) {\n if TrcLg.enabled {\n TrcLg.Printf(\"--> \" + format, v...)\n indent += \" \"\n calldepth += 2\n }\n}", "title": "" }, { "docid": "0dae60ff8cce147adaa77df01c421f51", "score": "0.52156615", "text": "func (s *BasevinLangListener) EnterAssign(ctx *AssignContext) {}", "title": "" }, { "docid": "1246c63c4778891a65c3e6cd3ce1e0bb", "score": "0.52145857", "text": "func (s *BasetsqlListener) EnterOption(ctx *OptionContext) {}", "title": "" }, { "docid": "b1c1313aa23ca2e8e85cb141573114bf", "score": "0.5211958", "text": "func (t *Traversal) AddV(args ...any) *Traversal {\n\tt.Add(Dot, NewFunc(\"addV\", args...))\n\treturn t\n}", "title": "" }, { "docid": "b17a79df59225e3e9c05d4d0863a5d1d", "score": "0.52102333", "text": "func (s *BasefolListener) EnterCondition(ctx *ConditionContext) {}", "title": "" }, { "docid": "c2d7dd3d04278278e55fe8e21b480494", "score": "0.52045465", "text": "func (s *BasecayenneListener) EnterVarid(ctx *VaridContext) {}", "title": "" }, { "docid": "5e7a4051d935e61993e60fb2df53a425", "score": "0.51916736", "text": "func (s *BaseorwellListener) EnterTyvar(ctx *TyvarContext) {}", "title": "" }, { "docid": "6e02101cedb1cfede0a40123510901fd", "score": "0.5191336", "text": "func (s *BaseHiveParserListener) EnterCaseExpression(ctx *CaseExpressionContext) {}", "title": "" }, { "docid": "82f64a27c68cabcb7437cba6df293129", "score": "0.5180425", "text": "func (s CaptionScreen) Enter() {\n}", "title": "" }, { "docid": "53622f454a0dfca243d760b7d685275d", "score": "0.5176144", "text": "func (s *Baseasm8086Listener) EnterRb(ctx *RbContext) {}", "title": "" }, { "docid": "b83da619f2a42947168fb2287d73973a", "score": "0.5175895", "text": "func (s *BasemorsecodeListener) EnterF(ctx *FContext) {}", "title": "" }, { "docid": "24df146b54b3b9dddb607a7c0bcf2146", "score": "0.51753217", "text": "func (s *BaserefalListener) EnterSvar(ctx *SvarContext) {}", "title": "" }, { "docid": "932bb8b19e6e0aa223bf91a4eec8e7b6", "score": "0.5172249", "text": "func (s *BaseapexListener) EnterSoqlValue(ctx *SoqlValueContext) {}", "title": "" }, { "docid": "82f98e01752186de07021d15c646f542", "score": "0.5170043", "text": "func (s *BasePMMNListener) EnterCommand(ctx *CommandContext) {}", "title": "" }, { "docid": "85d1d9fb439a8f0262293bdbbcd9f0c2", "score": "0.5164556", "text": "func (s *BasetsqlListener) EnterIndex_value(ctx *Index_valueContext) {}", "title": "" }, { "docid": "647b2d7c1886185fff7a88fe58bbda7e", "score": "0.5152616", "text": "func (s *BasemorsecodeListener) EnterSeven(ctx *SevenContext) {}", "title": "" }, { "docid": "4e18fd65028eefcd5e5fc23103fce6e6", "score": "0.51522565", "text": "func (s *BaseapexListener) EnterElementValue(ctx *ElementValueContext) {}", "title": "" }, { "docid": "6280efd906dabe396dbf4d39953dc912", "score": "0.5152116", "text": "func (s *BaseHiveParserListener) EnterWithReplace(ctx *WithReplaceContext) {}", "title": "" }, { "docid": "f47be85b4b586820698ef1c15fc40ec8", "score": "0.51481414", "text": "func (s *BaseapexListener) EnterVariableInitializer(ctx *VariableInitializerContext) {}", "title": "" }, { "docid": "753d763f950e45af6143845acb94a54b", "score": "0.5144769", "text": "func (s *Baseasm8086Listener) EnterExpression(ctx *ExpressionContext) {}", "title": "" }, { "docid": "6598d6de90db87b67451a2371339e233", "score": "0.51293486", "text": "func (s *BasetsqlListener) EnterProcedure_option(ctx *Procedure_optionContext) {}", "title": "" }, { "docid": "034c5e00054d6294cfa6ed3817f93a02", "score": "0.51271045", "text": "func (this *Tracer) Enter() uintptr {\n\tif (this.TraceLevel & Frame) == 0 {\n\t\treturn 0\n\t}\n\treturn this.trace(2, \"enter\", this.FrameSource)\n}", "title": "" }, { "docid": "9ed8a9eff7a491c0cfaca6dd3461440f", "score": "0.51253015", "text": "func (s *BaseSimpleExprListener) EnterStart(ctx *StartContext) {}", "title": "" }, { "docid": "c2145a83843abe49d845d98dc0269638", "score": "0.5123866", "text": "func (s *Baseasm8086Listener) EnterIf_(ctx *If_Context) {}", "title": "" }, { "docid": "460e26bcb2eb74cfdc036824e6f0ea16", "score": "0.5123641", "text": "func (s *BaseHiveParserListener) EnterActivate(ctx *ActivateContext) {}", "title": "" }, { "docid": "bf7f02f426e3e67966cd32f0f48798a0", "score": "0.5121656", "text": "func (s *BaseapexListener) EnterForControl(ctx *ForControlContext) {}", "title": "" }, { "docid": "edcdbb908ad70301755ca0cf0f999c62", "score": "0.5111312", "text": "func (s *BasePowerBuilderParserListener) EnterStatement(ctx *StatementContext) {}", "title": "" } ]
ead3651ca3fca5922b5342e293b1ca64
GpkjSubmissions is a free data retrieval call binding the contract method 0xfef001a9. Solidity: function gpkj_submissions(address , uint256 ) view returns(uint256)
[ { "docid": "10d1022243cda0cd664d766b7e79a132", "score": "0.80540985", "text": "func (_ETHDKGCompletion *ETHDKGCompletionCaller) GpkjSubmissions(opts *bind.CallOpts, arg0 common.Address, arg1 *big.Int) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ETHDKGCompletion.contract.Call(opts, out, \"gpkj_submissions\", arg0, arg1)\n\treturn *ret0, err\n}", "title": "" } ]
[ { "docid": "846cfabad4048921b5d4e5ee3cfbeb86", "score": "0.80635655", "text": "func (_ETHDKG *ETHDKGCaller) GpkjSubmissions(opts *bind.CallOpts, arg0 common.Address, arg1 *big.Int) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ETHDKG.contract.Call(opts, out, \"gpkj_submissions\", arg0, arg1)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "e6faa4dddac18346602b74a90987df4d", "score": "0.804865", "text": "func (_ETHDKGStorage *ETHDKGStorageCaller) GpkjSubmissions(opts *bind.CallOpts, arg0 common.Address, arg1 *big.Int) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ETHDKGStorage.contract.Call(opts, out, \"gpkj_submissions\", arg0, arg1)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "4d476a34a48012355bc2ab41e44eb300", "score": "0.79517597", "text": "func (_ETHDKGGroupAccusation *ETHDKGGroupAccusationCaller) GpkjSubmissions(opts *bind.CallOpts, arg0 common.Address, arg1 *big.Int) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ETHDKGGroupAccusation.contract.Call(opts, out, \"gpkj_submissions\", arg0, arg1)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "6340d10ba74030061634337c835a270f", "score": "0.79151773", "text": "func (_ETHDKGSubmitMPK *ETHDKGSubmitMPKCaller) GpkjSubmissions(opts *bind.CallOpts, arg0 common.Address, arg1 *big.Int) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ETHDKGSubmitMPK.contract.Call(opts, out, \"gpkj_submissions\", arg0, arg1)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "e7d88fe01ea768c8d422442491d7439f", "score": "0.77897334", "text": "func (_ETHDKGCompletion *ETHDKGCompletionSession) GpkjSubmissions(arg0 common.Address, arg1 *big.Int) (*big.Int, error) {\n\treturn _ETHDKGCompletion.Contract.GpkjSubmissions(&_ETHDKGCompletion.CallOpts, arg0, arg1)\n}", "title": "" }, { "docid": "1fc4454dd16ec4497e5bd44c391d8009", "score": "0.77533287", "text": "func (_ETHDKGCompletion *ETHDKGCompletionCallerSession) GpkjSubmissions(arg0 common.Address, arg1 *big.Int) (*big.Int, error) {\n\treturn _ETHDKGCompletion.Contract.GpkjSubmissions(&_ETHDKGCompletion.CallOpts, arg0, arg1)\n}", "title": "" }, { "docid": "2324c83a60462375b694c76eb86df29a", "score": "0.770561", "text": "func (_ETHDKG *ETHDKGSession) GpkjSubmissions(arg0 common.Address, arg1 *big.Int) (*big.Int, error) {\n\treturn _ETHDKG.Contract.GpkjSubmissions(&_ETHDKG.CallOpts, arg0, arg1)\n}", "title": "" }, { "docid": "1b07a13eca282207e38bf180cb2a4899", "score": "0.76579267", "text": "func (_ETHDKG *ETHDKGCallerSession) GpkjSubmissions(arg0 common.Address, arg1 *big.Int) (*big.Int, error) {\n\treturn _ETHDKG.Contract.GpkjSubmissions(&_ETHDKG.CallOpts, arg0, arg1)\n}", "title": "" }, { "docid": "241df93e293f9f1929a58c069b37147f", "score": "0.7654787", "text": "func (_ETHDKGStorage *ETHDKGStorageSession) GpkjSubmissions(arg0 common.Address, arg1 *big.Int) (*big.Int, error) {\n\treturn _ETHDKGStorage.Contract.GpkjSubmissions(&_ETHDKGStorage.CallOpts, arg0, arg1)\n}", "title": "" }, { "docid": "2b5c7c59087750d151dae67cd27cac47", "score": "0.76108074", "text": "func (_ETHDKGStorage *ETHDKGStorageCallerSession) GpkjSubmissions(arg0 common.Address, arg1 *big.Int) (*big.Int, error) {\n\treturn _ETHDKGStorage.Contract.GpkjSubmissions(&_ETHDKGStorage.CallOpts, arg0, arg1)\n}", "title": "" }, { "docid": "dfc5eef225e1c206d5ef613f042546d3", "score": "0.7535131", "text": "func (_ETHDKGGroupAccusation *ETHDKGGroupAccusationSession) GpkjSubmissions(arg0 common.Address, arg1 *big.Int) (*big.Int, error) {\n\treturn _ETHDKGGroupAccusation.Contract.GpkjSubmissions(&_ETHDKGGroupAccusation.CallOpts, arg0, arg1)\n}", "title": "" }, { "docid": "1436bfab7e03c1043d7e7584f98a0780", "score": "0.75027055", "text": "func (_ETHDKGGroupAccusation *ETHDKGGroupAccusationCallerSession) GpkjSubmissions(arg0 common.Address, arg1 *big.Int) (*big.Int, error) {\n\treturn _ETHDKGGroupAccusation.Contract.GpkjSubmissions(&_ETHDKGGroupAccusation.CallOpts, arg0, arg1)\n}", "title": "" }, { "docid": "1836ac062afed4691c31109d10d8cc9e", "score": "0.7496988", "text": "func (_ETHDKGSubmitMPK *ETHDKGSubmitMPKSession) GpkjSubmissions(arg0 common.Address, arg1 *big.Int) (*big.Int, error) {\n\treturn _ETHDKGSubmitMPK.Contract.GpkjSubmissions(&_ETHDKGSubmitMPK.CallOpts, arg0, arg1)\n}", "title": "" }, { "docid": "a710d45fea3c0f4915d5e0a270392c47", "score": "0.7493511", "text": "func (_ETHDKGSubmitMPK *ETHDKGSubmitMPKCallerSession) GpkjSubmissions(arg0 common.Address, arg1 *big.Int) (*big.Int, error) {\n\treturn _ETHDKGSubmitMPK.Contract.GpkjSubmissions(&_ETHDKGSubmitMPK.CallOpts, arg0, arg1)\n}", "title": "" }, { "docid": "df0e2b1c7979737a8ba222e21a8f79a1", "score": "0.57425684", "text": "func (_ETHDKG *ETHDKGTransactor) SubmitGPKj(opts *bind.TransactOpts, gpkj [4]*big.Int, sig [2]*big.Int) (*types.Transaction, error) {\n\treturn _ETHDKG.contract.Transact(opts, \"Submit_GPKj\", gpkj, sig)\n}", "title": "" }, { "docid": "718e717e24271acf5d8c2243e5fdc00e", "score": "0.5737249", "text": "func TestSubmitGPKjFailResubmit(t *testing.T) {\n\tn := 4\n\tthreshold, _ := thresholdFromUsers(n) // threshold, k are return values\n\t_ = threshold // for linter\n\t//c, sim, keyArray, authArray, privKArray, pubKArray := InitialTestSetup(t, n)\n\tc, _, sim, _, authArray, privKArray, pubKArray := InitialTestSetup(t, n)\n\tdefer sim.Close()\n\tregistrationEnd, err := c.TREGISTRATIONEND(&bind.CallOpts{})\n\tif err != nil {\n\t\tt.Fatal(\"Error in getting RegistrationEnd\")\n\t}\n\tAdvanceBlocksUntil(sim, registrationEnd)\n\t// Current block number is now 22 > 21 == T_REGISTRATION_END;\n\t// in Share Distribution phase\n\n\t// These are the standard secrets be used for testing purposes\n\tsecretValuesArray := make([]*big.Int, n)\n\tsecretBase := big.NewInt(100)\n\tfor j := 0; j < n; j++ {\n\t\tsecretValuesArray[j] = new(big.Int).Add(secretBase, big.NewInt(int64(j)))\n\t}\n\n\t// These are the standard private polynomial coefs for testing purposes\n\tbasePrivatePolynomialCoefs := make([]*big.Int, threshold+1)\n\tfor j := 1; j < threshold+1; j++ {\n\t\tbasePrivatePolynomialCoefs[j] = big.NewInt(int64(j))\n\t}\n\n\t// Create private polynomials for all users\n\tprivPolyCoefsArray := make([][]*big.Int, n)\n\tfor ell := 0; ell < n; ell++ {\n\t\tprivPolyCoefsArray[ell] = make([]*big.Int, threshold+1)\n\t\tprivPolyCoefsArray[ell][0] = secretValuesArray[ell]\n\t\tfor j := 1; j < threshold+1; j++ {\n\t\t\tprivPolyCoefsArray[ell][j] = basePrivatePolynomialCoefs[j]\n\t\t}\n\t}\n\n\t// Create public coefficients for all users\n\tpubCoefsArray := make([][]*cloudflare.G1, n)\n\tfor ell := 0; ell < n; ell++ {\n\t\tpubCoefsArray[ell] = make([]*cloudflare.G1, threshold+1)\n\t\tpubCoefsArray[ell] = cloudflare.GeneratePublicCoefs(privPolyCoefsArray[ell])\n\t}\n\n\t// Create big.Int version of public coefficients\n\tpubCoefsBigArray := make([][][2]*big.Int, n)\n\tfor ell := 0; ell < n; ell++ {\n\t\tpubCoefsBigArray[ell] = make([][2]*big.Int, threshold+1)\n\t\tfor j := 0; j < threshold+1; j++ {\n\t\t\tpubCoefsBigArray[ell][j] = G1ToBigIntArray(pubCoefsArray[ell][j])\n\t\t}\n\t}\n\n\t// Create encrypted shares to submit\n\tencSharesArray := make([][]*big.Int, n)\n\tfor ell := 0; ell < n; ell++ {\n\t\tprivK := privKArray[ell]\n\t\tpubK := pubKArray[ell]\n\t\tencSharesArray[ell] = make([]*big.Int, n-1)\n\t\tsecretsArray, err := cloudflare.GenerateSecretShares(pubK, privPolyCoefsArray[ell], pubKArray)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error occurred while generating sharing secrets\")\n\t\t}\n\t\tencSharesArray[ell], err = cloudflare.GenerateEncryptedShares(secretsArray, privK, pubKArray)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error occurred while generating commitments\")\n\t\t}\n\t}\n\n\t// Create arrays to hold submitted information\n\t// First index is participant receiving (n), then who from (n), then values (n-1);\n\t// note that this would have to be changed in practice\n\trcvdEncShares := make([][][]*big.Int, n)\n\tfor ell := 0; ell < n; ell++ {\n\t\trcvdEncShares[ell] = make([][]*big.Int, n)\n\t\tfor j := 0; j < n; j++ {\n\t\t\trcvdEncShares[ell][j] = make([]*big.Int, n-1)\n\t\t}\n\t}\n\trcvdCommitments := make([][][][2]*big.Int, n)\n\tfor ell := 0; ell < n; ell++ {\n\t\trcvdCommitments[ell] = make([][][2]*big.Int, n)\n\t\tfor j := 0; j < n; j++ {\n\t\t\trcvdCommitments[ell][j] = make([][2]*big.Int, threshold+1)\n\t\t}\n\t}\n\n\tbig0 := big.NewInt(0)\n\tbig1 := big.NewInt(1)\n\tbig2 := big.NewInt(2)\n\tbig3 := big.NewInt(3)\n\n\t// Submit encrypted shares and commitments\n\tfor ell := 0; ell < n; ell++ {\n\t\tauth := authArray[ell]\n\t\tencShares := encSharesArray[ell]\n\t\tpubCoefs := pubCoefsBigArray[ell]\n\t\ttxOpt := &bind.TransactOpts{\n\t\t\tFrom: auth.From,\n\t\t\tNonce: nil,\n\t\t\tSigner: auth.Signer,\n\t\t\tValue: nil,\n\t\t\tGasPrice: nil,\n\t\t\tGasLimit: gasLim,\n\t\t\tContext: nil,\n\t\t}\n\t\t// Check public_key to ensure registered\n\t\tpubKBigRcvd0, err := c.PublicKeys(&bind.CallOpts{}, auth.From, big0)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Something went wrong with c.PublicKeys (0)\")\n\t\t}\n\t\tpubKBigRcvd1, err := c.PublicKeys(&bind.CallOpts{}, auth.From, big1)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Something went wrong with c.PublicKeys (1)\")\n\t\t}\n\t\tregisteredPubK := (pubKBigRcvd0.Cmp(big0) != 0) || (pubKBigRcvd1.Cmp(big0) != 0)\n\t\tif !registeredPubK {\n\t\t\tt.Fatal(\"Public Key already exists\")\n\t\t}\n\t\ttxn, err := c.DistributeShares(txOpt, encShares, pubCoefs)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Unexpected error arose in DistributeShares submission\")\n\t\t}\n\t\tsim.Commit()\n\t\treceipt, err := sim.WaitForReceipt(context.Background(), txn)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Unexpected error in TransactionReceipt\")\n\t\t}\n\t\tshareDistEvent, err := c.ETHDKGFilterer.ParseShareDistribution(*receipt.Logs[0])\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Unexpected error in ParseShareDistribution\")\n\t\t}\n\t\t// Save values in arrays for everyone\n\t\tfor j := 0; j < n; j++ {\n\t\t\tif j == ell {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\trcvdEncShares[j][ell] = shareDistEvent.EncryptedShares\n\t\t\trcvdCommitments[j][ell] = shareDistEvent.Commitments\n\t\t}\n\t}\n\t// Everything above is good but now we want to check stuff like events and logs\n\n\tssArrayAll := make([][]*big.Int, n)\n\tfor ell := 0; ell < n; ell++ {\n\t\tssArrayAll[ell] = make([]*big.Int, n-1)\n\t}\n\n\t// HERE WE GO\n\tfor ell := 0; ell < n; ell++ {\n\t\trcvdEncSharesEll := rcvdEncShares[ell]\n\t\tpubK := pubKArray[ell]\n\t\tprivK := privKArray[ell]\n\t\tsharedEncryptedArray, err := cloudflare.CondenseCommitments(pubK, rcvdEncSharesEll, pubKArray)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Unexpected error occurred when condensing commitments\")\n\t\t}\n\t\tsharedSecretsArray, err := cloudflare.GenerateDecryptedShares(privK, sharedEncryptedArray, pubKArray)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Unexpected error occurred when decrypting secrets\")\n\t\t}\n\t\tssArrayAll[ell] = sharedSecretsArray\n\t}\n\n\tgskjArray := make([]*big.Int, n)\n\tfor ell := 0; ell < n; ell++ {\n\t\tsharedSecretsArray := ssArrayAll[ell]\n\t\tprivPolyCoefs := privPolyCoefsArray[ell]\n\t\tidx := ell + 1\n\t\tselfSecret := cloudflare.PrivatePolyEval(privPolyCoefs, idx)\n\t\tgskj := new(big.Int).Set(selfSecret)\n\t\tfor j := 0; j < n-1; j++ {\n\t\t\tsharedSecret := sharedSecretsArray[j]\n\t\t\tgskj.Add(gskj, sharedSecret)\n\t\t}\n\t\tgskjArray[ell] = gskj\n\t}\n\n\tshareDistributionEnd, err := c.TSHAREDISTRIBUTIONEND(&bind.CallOpts{})\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error in getting ShareDistributionEnd\")\n\t}\n\tAdvanceBlocksUntil(sim, shareDistributionEnd)\n\t// Current block number is now 47 > 46 == T_SHARE_DISTRIBUTION_END;\n\t// in Dispute phase\n\tdisputeEnd, err := c.TDISPUTEEND(&bind.CallOpts{})\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error in getting DisputeEnd\")\n\t}\n\tAdvanceBlocksUntil(sim, disputeEnd)\n\t// Current block number is now 72 > 71 == T_DISPUTE_END;\n\t// in Key Derivation phase\n\n\t// Check block number here\n\tcurBlock := CurrentBlock(sim)\n\tkeyShareSubmissionEnd, err := c.TKEYSHARESUBMISSIONEND(&bind.CallOpts{})\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error in getting KeyShareSubmissionEnd\")\n\t}\n\tvalidBlockNumber := (disputeEnd.Cmp(curBlock) < 0) && (curBlock.Cmp(keyShareSubmissionEnd) <= 0)\n\tif !validBlockNumber {\n\t\tt.Fatal(\"Unexpected error; in Key Share Submission Phase\")\n\t}\n\n\t// Now to submit key shares\n\tkeyShareArrayG1 := make([]*cloudflare.G1, n)\n\tkeyShareArrayG2 := make([]*cloudflare.G2, n)\n\tkeyShareArrayDLEQProof := make([][2]*big.Int, n)\n\n\th1BaseMsg := []byte(\"MadHive Rocks!\")\n\tg1Base := new(cloudflare.G1).ScalarBaseMult(big.NewInt(1))\n\th1Base, err := cloudflare.HashToG1(h1BaseMsg)\n\tif err != nil {\n\t\tt.Fatal(\"Error when computing HashToG1([]byte(\\\"MadHive Rock!\\\"))\")\n\t}\n\th2Base := new(cloudflare.G2).ScalarBaseMult(big.NewInt(1))\n\torderMinus1, _ := new(big.Int).SetString(\"21888242871839275222246405745257275088548364400416034343698204186575808495616\", 10)\n\th2Neg := new(cloudflare.G2).ScalarBaseMult(orderMinus1)\n\n\tfor ell := 0; ell < n; ell++ {\n\t\tsecretValue := secretValuesArray[ell]\n\t\tg1Value := new(cloudflare.G1).ScalarBaseMult(secretValue)\n\t\tkeyShareG1 := new(cloudflare.G1).ScalarMult(h1Base, secretValue)\n\t\tkeyShareG2 := new(cloudflare.G2).ScalarMult(h2Base, secretValue)\n\n\t\t// Generate and Verify DLEQ Proof\n\t\tkeyShareDLEQProof, err := cloudflare.GenerateDLEQProofG1(h1Base, keyShareG1, g1Base, g1Value, secretValue, rand.Reader)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error when generating DLEQ Proof\")\n\t\t}\n\t\terr = cloudflare.VerifyDLEQProofG1(h1Base, keyShareG1, g1Base, g1Value, keyShareDLEQProof)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Invalid DLEQ h1Value proof\")\n\t\t}\n\n\t\t// PairingCheck to ensure keyShareG1 and keyShareG2 form valid pair\n\t\tvalidPair := cloudflare.PairingCheck([]*cloudflare.G1{keyShareG1, h1Base}, []*cloudflare.G2{h2Neg, keyShareG2})\n\t\tif !validPair {\n\t\t\tt.Fatal(\"Error in PairingCheck\")\n\t\t}\n\n\t\tauth := authArray[ell]\n\t\ttxOpt := &bind.TransactOpts{\n\t\t\tFrom: auth.From,\n\t\t\tNonce: nil,\n\t\t\tSigner: auth.Signer,\n\t\t\tValue: nil,\n\t\t\tGasPrice: nil,\n\t\t\tGasLimit: gasLim,\n\t\t\tContext: nil,\n\t\t}\n\n\t\t// Check Key Shares to ensure not submitted\n\t\tkeyShareBig0, err := c.KeyShares(&bind.CallOpts{}, auth.From, big0)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error occurred when calling c.KeyShares (0)\")\n\t\t}\n\t\tkeyShareBig1, err := c.KeyShares(&bind.CallOpts{}, auth.From, big1)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error occurred when calling c.KeyShares (1)\")\n\t\t}\n\t\tzeroKeyShare := (keyShareBig0.Cmp(big0) == 0) && (keyShareBig1.Cmp(big0) == 0)\n\t\tif !zeroKeyShare {\n\t\t\tt.Fatal(\"Unexpected error: KeyShare is nonzero and already present\")\n\t\t}\n\n\t\t// Check Share Distribution Hashes\n\t\tauthHash, err := c.ShareDistributionHashes(&bind.CallOpts{}, auth.From)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error when calling ShareDistributionHashes\")\n\t\t}\n\t\tzeroBytes := make([]byte, numBytes)\n\t\tvalidHash := !bytes.Equal(authHash[:], zeroBytes)\n\t\tif !validHash {\n\t\t\tt.Fatal(\"Unexpected error: invalid hash\")\n\t\t}\n\n\t\tkeyShareG1Big := G1ToBigIntArray(keyShareG1)\n\t\tkeyShareG2Big := G2ToBigIntArray(keyShareG2)\n\n\t\t_, err = c.SubmitKeyShare(txOpt, auth.From, keyShareG1Big, keyShareDLEQProof, keyShareG2Big)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Unexpected error occurred when submitting key shares\")\n\t\t}\n\n\t\tkeyShareArrayG1[ell] = keyShareG1\n\t\tkeyShareArrayG2[ell] = keyShareG2\n\t\tkeyShareArrayDLEQProof[ell] = keyShareDLEQProof\n\t}\n\tsim.Commit()\n\n\t// Need to check key share submission and confirm validity\n\tfor ell := 0; ell < n; ell++ {\n\t\tauth := authArray[ell]\n\t\tkeyShareG1 := keyShareArrayG1[ell]\n\t\tkeyShareBig0, err := c.KeyShares(&bind.CallOpts{}, auth.From, big0)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error occurred when calling c.KeyShares (0)\")\n\t\t}\n\t\tkeyShareBig1, err := c.KeyShares(&bind.CallOpts{}, auth.From, big1)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error occurred when calling c.KeyShares (1)\")\n\t\t}\n\t\tkeyShareG1Rcvd, err := BigIntArrayToG1([2]*big.Int{keyShareBig0, keyShareBig1})\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error in BigIntArrayToG1 call\")\n\t\t}\n\t\tif !keyShareG1.IsEqual(keyShareG1Rcvd) {\n\t\t\tt.Fatal(\"KeyShareG1 mismatch between submission and received!\")\n\t\t}\n\t}\n\n\tAdvanceBlocksUntil(sim, keyShareSubmissionEnd)\n\t// Check block number here\n\tcurBlock = CurrentBlock(sim)\n\tmpkSubmissionEnd, err := c.TMPKSUBMISSIONEND(&bind.CallOpts{})\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error in getting MPKSubmissionEnd\")\n\t}\n\tvalidBlockNumber = (keyShareSubmissionEnd.Cmp(curBlock) < 0) && (curBlock.Cmp(mpkSubmissionEnd) <= 0)\n\tif !validBlockNumber {\n\t\tt.Fatal(\"Unexpected error; in MPK Submission Phase\")\n\t}\n\n\t// Make Master Public Key (this is not how you would actually do this)\n\tmpk := new(cloudflare.G2).Add(keyShareArrayG2[0], keyShareArrayG2[1])\n\tfor ell := 2; ell < n; ell++ {\n\t\tmpk.Add(mpk, keyShareArrayG2[ell])\n\t}\n\tmpkBig := G2ToBigIntArray(mpk)\n\n\t// For G1 version\n\tmpkG1 := new(cloudflare.G1).Add(keyShareArrayG1[0], keyShareArrayG1[1])\n\tfor ell := 2; ell < n; ell++ {\n\t\tmpkG1.Add(mpkG1, keyShareArrayG1[ell])\n\t}\n\n\t// Perform PairingCheck on mpk and mpkG1 to ensure valid pair\n\tvalidPair := cloudflare.PairingCheck([]*cloudflare.G1{mpkG1, h1Base}, []*cloudflare.G2{h2Neg, mpk})\n\tif !validPair {\n\t\tt.Fatal(\"Error in PairingCheck for mpk\")\n\t}\n\n\tauth := authArray[0]\n\ttxOpt := &bind.TransactOpts{\n\t\tFrom: auth.From,\n\t\tNonce: nil,\n\t\tSigner: auth.Signer,\n\t\tValue: nil,\n\t\tGasPrice: nil,\n\t\tGasLimit: gasLim,\n\t\tContext: nil,\n\t}\n\n\t_, err = c.SubmitMasterPublicKey(txOpt, mpkBig)\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error occurred when submitting master public key\")\n\t}\n\tsim.Commit()\n\n\tmpkRcvd0, err := c.MasterPublicKey(&bind.CallOpts{}, big0)\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error when calling mpk (0)\")\n\t}\n\tmpkRcvd1, err := c.MasterPublicKey(&bind.CallOpts{}, big1)\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error when calling mpk (1)\")\n\t}\n\tmpkRcvd2, err := c.MasterPublicKey(&bind.CallOpts{}, big2)\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error when calling mpk (2)\")\n\t}\n\tmpkRcvd3, err := c.MasterPublicKey(&bind.CallOpts{}, big3)\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error when calling mpk (3)\")\n\t}\n\tmpkSubmittedMatchesRcvd := (mpkBig[0].Cmp(mpkRcvd0) == 0) && (mpkBig[1].Cmp(mpkRcvd1) == 0) && (mpkBig[2].Cmp(mpkRcvd2) == 0) && (mpkBig[3].Cmp(mpkRcvd3) == 0)\n\tif !mpkSubmittedMatchesRcvd {\n\t\tt.Fatal(\"mpk submitted does not match received!\")\n\t}\n\n\t// We now proceed to submit gpkj's; they were created above\n\n\t// Check block number here\n\tAdvanceBlocksUntil(sim, mpkSubmissionEnd)\n\tgpkjSubmissionEnd, err := c.TGPKJSUBMISSIONEND(&bind.CallOpts{})\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error in getting GPKJSubmissionEnd\")\n\t}\n\tcurBlock = CurrentBlock(sim)\n\tvalidBlockNumber = (mpkSubmissionEnd.Cmp(curBlock) < 0) && (curBlock.Cmp(gpkjSubmissionEnd) <= 0)\n\tif !validBlockNumber {\n\t\tt.Fatal(\"Unexpected error; in GPKj Submission Phase\")\n\t}\n\n\tinitialMessage, err := c.InitialMessage(&bind.CallOpts{})\n\tif err != nil {\n\t\tt.Fatal(\"Error when getting InitialMessage for gpkj signature\")\n\t}\n\n\t// Make and submit gpkj's\n\tidx := 0\n\tgskj := gskjArray[idx]\n\tgpkj := new(cloudflare.G2).ScalarBaseMult(gskj)\n\tinitialSig, err := cloudflare.Sign(initialMessage, gskj, cloudflare.HashToG1)\n\tif err != nil {\n\t\tt.Fatal(\"Error occurred in cloudflare.Sign when signing initialMessage\")\n\t}\n\tgpkjBig := G2ToBigIntArray(gpkj)\n\tinitialSigBig := G1ToBigIntArray(initialSig)\n\n\tauth = authArray[idx]\n\ttxOpt = &bind.TransactOpts{\n\t\tFrom: auth.From,\n\t\tNonce: nil,\n\t\tSigner: auth.Signer,\n\t\tValue: nil,\n\t\tGasPrice: nil,\n\t\tGasLimit: gasLim,\n\t\tContext: nil,\n\t}\n\n\t// Ensure no previous submission\n\tgpkjSubmission0, err := c.GpkjSubmissions(&bind.CallOpts{}, auth.From, big0)\n\tif err != nil {\n\t\tt.Fatal(\"Error when calling GpkjSubmission0\")\n\t}\n\tgpkjSubmission1, err := c.GpkjSubmissions(&bind.CallOpts{}, auth.From, big1)\n\tif err != nil {\n\t\tt.Fatal(\"Error when calling GpkjSubmission1\")\n\t}\n\tgpkjSubmission2, err := c.GpkjSubmissions(&bind.CallOpts{}, auth.From, big2)\n\tif err != nil {\n\t\tt.Fatal(\"Error when calling GpkjSubmission2\")\n\t}\n\tgpkjSubmission3, err := c.GpkjSubmissions(&bind.CallOpts{}, auth.From, big3)\n\tif err != nil {\n\t\tt.Fatal(\"Error when calling GpkjSubmission3\")\n\t}\n\temptyGPKjSub := (gpkjSubmission0.Cmp(big0) == 0) && (gpkjSubmission1.Cmp(big0) == 0) && (gpkjSubmission2.Cmp(big0) == 0) && (gpkjSubmission3.Cmp(big0) == 0)\n\tif !emptyGPKjSub {\n\t\tt.Fatal(\"Unexpected error; gpkj already submitted\")\n\t}\n\n\t// Verify signature\n\tvalidSig, err := cloudflare.Verify(initialMessage, initialSig, gpkj, cloudflare.HashToG1)\n\tif err != nil {\n\t\tt.Fatal(\"Error when calling cloudflare.Verify for (initialSig, gpkj) verification\")\n\t}\n\tif !validSig {\n\t\tt.Fatal(\"Unexpected error; initialSig fails cloudflare.Verify\")\n\t}\n\n\t_, err = c.SubmitGPKj(txOpt, gpkjBig, initialSigBig)\n\tif err != nil {\n\t\tt.Fatal(\"Error occurred when submitting gpkj\")\n\t}\n\tsim.Commit()\n\n\t// Check submission\n\tgpkjRcvd0, err := c.GpkjSubmissions(&bind.CallOpts{}, auth.From, big0)\n\tif err != nil {\n\t\tt.Fatal(\"Error when calling GpkjSubmission0\")\n\t}\n\tgpkjRcvd1, err := c.GpkjSubmissions(&bind.CallOpts{}, auth.From, big1)\n\tif err != nil {\n\t\tt.Fatal(\"Error when calling GpkjSubmission1\")\n\t}\n\tgpkjRcvd2, err := c.GpkjSubmissions(&bind.CallOpts{}, auth.From, big2)\n\tif err != nil {\n\t\tt.Fatal(\"Error when calling GpkjSubmission2\")\n\t}\n\tgpkjRcvd3, err := c.GpkjSubmissions(&bind.CallOpts{}, auth.From, big3)\n\tif err != nil {\n\t\tt.Fatal(\"Error when calling GpkjSubmission3\")\n\t}\n\tmatchGPKjSub := (gpkjRcvd0.Cmp(gpkjBig[0]) == 0) && (gpkjRcvd1.Cmp(gpkjBig[1]) == 0) && (gpkjRcvd2.Cmp(gpkjBig[2]) == 0) && (gpkjRcvd3.Cmp(gpkjBig[3]) == 0)\n\tif !matchGPKjSub {\n\t\tt.Fatal(\"Unexpected error; gpkj does not match submission\")\n\t}\n\n\t// Make and submit (new) gpkj\n\tgskjNew := new(big.Int).Add(gskj, big1)\n\tgpkjNew := new(cloudflare.G2).ScalarBaseMult(gskjNew)\n\tinitialSigNew, err := cloudflare.Sign(initialMessage, gskjNew, cloudflare.HashToG1)\n\tif err != nil {\n\t\tt.Fatal(\"Error occurred in cloudflare.Sign when signing initialMessage (new)\")\n\t}\n\tgpkjNewBig := G2ToBigIntArray(gpkjNew)\n\tinitialSigNewBig := G1ToBigIntArray(initialSigNew)\n\n\t_, err = c.SubmitGPKj(txOpt, gpkjNewBig, initialSigNewBig)\n\tif err != nil {\n\t\tt.Fatal(\"Error occurred when submitting gpkj\")\n\t}\n\tsim.Commit()\n\n\t// Attempt to resubmit; should fail\n\tgpkjRcvd0, err = c.GpkjSubmissions(&bind.CallOpts{}, auth.From, big0)\n\tif err != nil {\n\t\tt.Fatal(\"Error when calling GpkjSubmission0\")\n\t}\n\tgpkjRcvd1, err = c.GpkjSubmissions(&bind.CallOpts{}, auth.From, big1)\n\tif err != nil {\n\t\tt.Fatal(\"Error when calling GpkjSubmission1\")\n\t}\n\tgpkjRcvd2, err = c.GpkjSubmissions(&bind.CallOpts{}, auth.From, big2)\n\tif err != nil {\n\t\tt.Fatal(\"Error when calling GpkjSubmission2\")\n\t}\n\tgpkjRcvd3, err = c.GpkjSubmissions(&bind.CallOpts{}, auth.From, big3)\n\tif err != nil {\n\t\tt.Fatal(\"Error when calling GpkjSubmission3\")\n\t}\n\tmatchGPKjNewSub := (gpkjRcvd0.Cmp(gpkjNewBig[0]) == 0) && (gpkjRcvd1.Cmp(gpkjNewBig[1]) == 0) && (gpkjRcvd2.Cmp(gpkjNewBig[2]) == 0) && (gpkjRcvd3.Cmp(gpkjNewBig[3]) == 0)\n\tif matchGPKjNewSub {\n\t\tt.Fatal(\"Unexpected error; gpkj should not match resubmission\")\n\t}\n}", "title": "" }, { "docid": "a26b65acb74c1e60edec1cde8e0a2d39", "score": "0.5647536", "text": "func (a *AccountService) Submissions(page string) {\n\tpath := fmt.Sprintf(\"/account/me/submissions/%s\", page)\n\n\tresp, err := a.client.Get(path, NoOptions)\n\n\tif err != nil {\n\t\trespError(path)\n\n\t}\n\n\tdefer resp.Body.Close()\n\n\tprintBytes(resp.Body, a.client)\n}", "title": "" }, { "docid": "c38c1732ee9b4a71e0c1533b6e31ac5f", "score": "0.56329304", "text": "func TestSubmitGPKjSuccess(t *testing.T) {\n\tn := 4\n\tthreshold, _ := thresholdFromUsers(n) // threshold, k are return values\n\t_ = threshold // for linter\n\t//c, sim, keyArray, authArray, privKArray, pubKArray := InitialTestSetup(t, n)\n\tc, _, sim, _, authArray, privKArray, pubKArray := InitialTestSetup(t, n)\n\tdefer sim.Close()\n\tregistrationEnd, err := c.TREGISTRATIONEND(&bind.CallOpts{})\n\tif err != nil {\n\t\tt.Fatal(\"Error in getting RegistrationEnd\")\n\t}\n\tAdvanceBlocksUntil(sim, registrationEnd)\n\t// Current block number is now 22 > 21 == T_REGISTRATION_END;\n\t// in Share Distribution phase\n\n\t// These are the standard secrets be used for testing purposes\n\tsecretValuesArray := make([]*big.Int, n)\n\tsecretBase := big.NewInt(100)\n\tfor j := 0; j < n; j++ {\n\t\tsecretValuesArray[j] = new(big.Int).Add(secretBase, big.NewInt(int64(j)))\n\t}\n\n\t// These are the standard private polynomial coefs for testing purposes\n\tbasePrivatePolynomialCoefs := make([]*big.Int, threshold+1)\n\tfor j := 1; j < threshold+1; j++ {\n\t\tbasePrivatePolynomialCoefs[j] = big.NewInt(int64(j))\n\t}\n\n\t// Create private polynomials for all users\n\tprivPolyCoefsArray := make([][]*big.Int, n)\n\tfor ell := 0; ell < n; ell++ {\n\t\tprivPolyCoefsArray[ell] = make([]*big.Int, threshold+1)\n\t\tprivPolyCoefsArray[ell][0] = secretValuesArray[ell]\n\t\tfor j := 1; j < threshold+1; j++ {\n\t\t\tprivPolyCoefsArray[ell][j] = basePrivatePolynomialCoefs[j]\n\t\t}\n\t}\n\n\t// Create public coefficients for all users\n\tpubCoefsArray := make([][]*cloudflare.G1, n)\n\tfor ell := 0; ell < n; ell++ {\n\t\tpubCoefsArray[ell] = make([]*cloudflare.G1, threshold+1)\n\t\tpubCoefsArray[ell] = cloudflare.GeneratePublicCoefs(privPolyCoefsArray[ell])\n\t}\n\n\t// Create big.Int version of public coefficients\n\tpubCoefsBigArray := make([][][2]*big.Int, n)\n\tfor ell := 0; ell < n; ell++ {\n\t\tpubCoefsBigArray[ell] = make([][2]*big.Int, threshold+1)\n\t\tfor j := 0; j < threshold+1; j++ {\n\t\t\tpubCoefsBigArray[ell][j] = G1ToBigIntArray(pubCoefsArray[ell][j])\n\t\t}\n\t}\n\n\t// Create encrypted shares to submit\n\tencSharesArray := make([][]*big.Int, n)\n\tfor ell := 0; ell < n; ell++ {\n\t\tprivK := privKArray[ell]\n\t\tpubK := pubKArray[ell]\n\t\tencSharesArray[ell] = make([]*big.Int, n-1)\n\t\tsecretsArray, err := cloudflare.GenerateSecretShares(pubK, privPolyCoefsArray[ell], pubKArray)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error occurred while generating sharing secrets\")\n\t\t}\n\t\tencSharesArray[ell], err = cloudflare.GenerateEncryptedShares(secretsArray, privK, pubKArray)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error occurred while generating commitments\")\n\t\t}\n\t}\n\n\t// Create arrays to hold submitted information\n\t// First index is participant receiving (n), then who from (n), then values (n-1);\n\t// note that this would have to be changed in practice\n\trcvdEncShares := make([][][]*big.Int, n)\n\tfor ell := 0; ell < n; ell++ {\n\t\trcvdEncShares[ell] = make([][]*big.Int, n)\n\t\tfor j := 0; j < n; j++ {\n\t\t\trcvdEncShares[ell][j] = make([]*big.Int, n-1)\n\t\t}\n\t}\n\trcvdCommitments := make([][][][2]*big.Int, n)\n\tfor ell := 0; ell < n; ell++ {\n\t\trcvdCommitments[ell] = make([][][2]*big.Int, n)\n\t\tfor j := 0; j < n; j++ {\n\t\t\trcvdCommitments[ell][j] = make([][2]*big.Int, threshold+1)\n\t\t}\n\t}\n\n\tbig0 := big.NewInt(0)\n\tbig1 := big.NewInt(1)\n\tbig2 := big.NewInt(2)\n\tbig3 := big.NewInt(3)\n\n\t// Submit encrypted shares and commitments\n\tfor ell := 0; ell < n; ell++ {\n\t\tauth := authArray[ell]\n\t\tencShares := encSharesArray[ell]\n\t\tpubCoefs := pubCoefsBigArray[ell]\n\t\ttxOpt := &bind.TransactOpts{\n\t\t\tFrom: auth.From,\n\t\t\tNonce: nil,\n\t\t\tSigner: auth.Signer,\n\t\t\tValue: nil,\n\t\t\tGasPrice: nil,\n\t\t\tGasLimit: gasLim,\n\t\t\tContext: nil,\n\t\t}\n\t\t// Check public_key to ensure registered\n\t\tpubKBigRcvd0, err := c.PublicKeys(&bind.CallOpts{}, auth.From, big0)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Something went wrong with c.PublicKeys (0)\")\n\t\t}\n\t\tpubKBigRcvd1, err := c.PublicKeys(&bind.CallOpts{}, auth.From, big1)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Something went wrong with c.PublicKeys (1)\")\n\t\t}\n\t\tregisteredPubK := (pubKBigRcvd0.Cmp(big0) != 0) || (pubKBigRcvd1.Cmp(big0) != 0)\n\t\tif !registeredPubK {\n\t\t\tt.Fatal(\"Public Key already exists\")\n\t\t}\n\t\ttxn, err := c.DistributeShares(txOpt, encShares, pubCoefs)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Unexpected error arose in DistributeShares submission\")\n\t\t}\n\t\tsim.Commit()\n\t\treceipt, err := sim.WaitForReceipt(context.Background(), txn)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Unexpected error in TransactionReceipt\")\n\t\t}\n\t\tshareDistEvent, err := c.ETHDKGFilterer.ParseShareDistribution(*receipt.Logs[0])\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Unexpected error in ParseShareDistribution\")\n\t\t}\n\t\t// Save values in arrays for everyone\n\t\tfor j := 0; j < n; j++ {\n\t\t\tif j == ell {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\trcvdEncShares[j][ell] = shareDistEvent.EncryptedShares\n\t\t\trcvdCommitments[j][ell] = shareDistEvent.Commitments\n\t\t}\n\t}\n\t// Everything above is good but now we want to check stuff like events and logs\n\n\tssArrayAll := make([][]*big.Int, n)\n\tfor ell := 0; ell < n; ell++ {\n\t\tssArrayAll[ell] = make([]*big.Int, n-1)\n\t}\n\n\t// HERE WE GO\n\tfor ell := 0; ell < n; ell++ {\n\t\trcvdEncSharesEll := rcvdEncShares[ell]\n\t\tpubK := pubKArray[ell]\n\t\tprivK := privKArray[ell]\n\t\tsharedEncryptedArray, err := cloudflare.CondenseCommitments(pubK, rcvdEncSharesEll, pubKArray)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Unexpected error occurred when condensing commitments\")\n\t\t}\n\t\tsharedSecretsArray, err := cloudflare.GenerateDecryptedShares(privK, sharedEncryptedArray, pubKArray)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Unexpected error occurred when decrypting secrets\")\n\t\t}\n\t\tssArrayAll[ell] = sharedSecretsArray\n\t}\n\n\tgskjArray := make([]*big.Int, n)\n\tfor ell := 0; ell < n; ell++ {\n\t\tsharedSecretsArray := ssArrayAll[ell]\n\t\tprivPolyCoefs := privPolyCoefsArray[ell]\n\t\tidx := ell + 1\n\t\tselfSecret := cloudflare.PrivatePolyEval(privPolyCoefs, idx)\n\t\tgskj := new(big.Int).Set(selfSecret)\n\t\tfor j := 0; j < n-1; j++ {\n\t\t\tsharedSecret := sharedSecretsArray[j]\n\t\t\tgskj.Add(gskj, sharedSecret)\n\t\t}\n\t\tgskjArray[ell] = gskj\n\t}\n\n\tshareDistributionEnd, err := c.TSHAREDISTRIBUTIONEND(&bind.CallOpts{})\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error in getting ShareDistributionEnd\")\n\t}\n\tAdvanceBlocksUntil(sim, shareDistributionEnd)\n\t// Current block number is now 47 > 46 == T_SHARE_DISTRIBUTION_END;\n\t// in Dispute phase\n\tdisputeEnd, err := c.TDISPUTEEND(&bind.CallOpts{})\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error in getting DisputeEnd\")\n\t}\n\tAdvanceBlocksUntil(sim, disputeEnd)\n\t// Current block number is now 72 > 71 == T_DISPUTE_END;\n\t// in Key Derivation phase\n\n\t// Check block number here\n\tcurBlock := CurrentBlock(sim)\n\tkeyShareSubmissionEnd, err := c.TKEYSHARESUBMISSIONEND(&bind.CallOpts{})\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error in getting KeyShareSubmissionEnd\")\n\t}\n\tvalidBlockNumber := (disputeEnd.Cmp(curBlock) < 0) && (curBlock.Cmp(keyShareSubmissionEnd) <= 0)\n\tif !validBlockNumber {\n\t\tt.Fatal(\"Unexpected error; in Key Share Submission Phase\")\n\t}\n\n\t// Now to submit key shares\n\tkeyShareArrayG1 := make([]*cloudflare.G1, n)\n\tkeyShareArrayG2 := make([]*cloudflare.G2, n)\n\tkeyShareArrayDLEQProof := make([][2]*big.Int, n)\n\n\th1BaseMsg := []byte(\"MadHive Rocks!\")\n\tg1Base := new(cloudflare.G1).ScalarBaseMult(big.NewInt(1))\n\th1Base, err := cloudflare.HashToG1(h1BaseMsg)\n\tif err != nil {\n\t\tt.Fatal(\"Error when computing HashToG1([]byte(\\\"MadHive Rock!\\\"))\")\n\t}\n\th2Base := new(cloudflare.G2).ScalarBaseMult(big.NewInt(1))\n\torderMinus1, _ := new(big.Int).SetString(\"21888242871839275222246405745257275088548364400416034343698204186575808495616\", 10)\n\th2Neg := new(cloudflare.G2).ScalarBaseMult(orderMinus1)\n\n\tfor ell := 0; ell < n; ell++ {\n\t\tsecretValue := secretValuesArray[ell]\n\t\tg1Value := new(cloudflare.G1).ScalarBaseMult(secretValue)\n\t\tkeyShareG1 := new(cloudflare.G1).ScalarMult(h1Base, secretValue)\n\t\tkeyShareG2 := new(cloudflare.G2).ScalarMult(h2Base, secretValue)\n\n\t\t// Generate and Verify DLEQ Proof\n\t\tkeyShareDLEQProof, err := cloudflare.GenerateDLEQProofG1(h1Base, keyShareG1, g1Base, g1Value, secretValue, rand.Reader)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error when generating DLEQ Proof\")\n\t\t}\n\t\terr = cloudflare.VerifyDLEQProofG1(h1Base, keyShareG1, g1Base, g1Value, keyShareDLEQProof)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Invalid DLEQ h1Value proof\")\n\t\t}\n\n\t\t// PairingCheck to ensure keyShareG1 and keyShareG2 form valid pair\n\t\tvalidPair := cloudflare.PairingCheck([]*cloudflare.G1{keyShareG1, h1Base}, []*cloudflare.G2{h2Neg, keyShareG2})\n\t\tif !validPair {\n\t\t\tt.Fatal(\"Error in PairingCheck\")\n\t\t}\n\n\t\tauth := authArray[ell]\n\t\ttxOpt := &bind.TransactOpts{\n\t\t\tFrom: auth.From,\n\t\t\tNonce: nil,\n\t\t\tSigner: auth.Signer,\n\t\t\tValue: nil,\n\t\t\tGasPrice: nil,\n\t\t\tGasLimit: gasLim,\n\t\t\tContext: nil,\n\t\t}\n\n\t\t// Check Key Shares to ensure not submitted\n\t\tkeyShareBig0, err := c.KeyShares(&bind.CallOpts{}, auth.From, big0)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error occurred when calling c.KeyShares (0)\")\n\t\t}\n\t\tkeyShareBig1, err := c.KeyShares(&bind.CallOpts{}, auth.From, big1)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error occurred when calling c.KeyShares (1)\")\n\t\t}\n\t\tzeroKeyShare := (keyShareBig0.Cmp(big0) == 0) && (keyShareBig1.Cmp(big0) == 0)\n\t\tif !zeroKeyShare {\n\t\t\tt.Fatal(\"Unexpected error: KeyShare is nonzero and already present\")\n\t\t}\n\n\t\t// Check Share Distribution Hashes\n\t\tauthHash, err := c.ShareDistributionHashes(&bind.CallOpts{}, auth.From)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error when calling ShareDistributionHashes\")\n\t\t}\n\t\tzeroBytes := make([]byte, numBytes)\n\t\tvalidHash := !bytes.Equal(authHash[:], zeroBytes)\n\t\tif !validHash {\n\t\t\tt.Fatal(\"Unexpected error: invalid hash\")\n\t\t}\n\n\t\tkeyShareG1Big := G1ToBigIntArray(keyShareG1)\n\t\tkeyShareG2Big := G2ToBigIntArray(keyShareG2)\n\n\t\t_, err = c.SubmitKeyShare(txOpt, auth.From, keyShareG1Big, keyShareDLEQProof, keyShareG2Big)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Unexpected error occurred when submitting key shares\")\n\t\t}\n\n\t\tkeyShareArrayG1[ell] = keyShareG1\n\t\tkeyShareArrayG2[ell] = keyShareG2\n\t\tkeyShareArrayDLEQProof[ell] = keyShareDLEQProof\n\t}\n\tsim.Commit()\n\n\t// Need to check key share submission and confirm validity\n\tfor ell := 0; ell < n; ell++ {\n\t\tauth := authArray[ell]\n\t\tkeyShareG1 := keyShareArrayG1[ell]\n\t\tkeyShareBig0, err := c.KeyShares(&bind.CallOpts{}, auth.From, big0)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error occurred when calling c.KeyShares (0)\")\n\t\t}\n\t\tkeyShareBig1, err := c.KeyShares(&bind.CallOpts{}, auth.From, big1)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error occurred when calling c.KeyShares (1)\")\n\t\t}\n\t\tkeyShareG1Rcvd, err := BigIntArrayToG1([2]*big.Int{keyShareBig0, keyShareBig1})\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error in BigIntArrayToG1 call\")\n\t\t}\n\t\tif !keyShareG1.IsEqual(keyShareG1Rcvd) {\n\t\t\tt.Fatal(\"KeyShareG1 mismatch between submission and received!\")\n\t\t}\n\t}\n\n\tAdvanceBlocksUntil(sim, keyShareSubmissionEnd)\n\t// Check block number here\n\tcurBlock = CurrentBlock(sim)\n\tmpkSubmissionEnd, err := c.TMPKSUBMISSIONEND(&bind.CallOpts{})\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error in getting MPKSubmissionEnd\")\n\t}\n\tvalidBlockNumber = (keyShareSubmissionEnd.Cmp(curBlock) < 0) && (curBlock.Cmp(mpkSubmissionEnd) <= 0)\n\tif !validBlockNumber {\n\t\tt.Fatal(\"Unexpected error; in MPK Submission Phase\")\n\t}\n\n\t// Make Master Public Key (this is not how you would actually do this)\n\tmpk := new(cloudflare.G2).Add(keyShareArrayG2[0], keyShareArrayG2[1])\n\tfor ell := 2; ell < n; ell++ {\n\t\tmpk.Add(mpk, keyShareArrayG2[ell])\n\t}\n\tmpkBig := G2ToBigIntArray(mpk)\n\n\t// For G1 version\n\tmpkG1 := new(cloudflare.G1).Add(keyShareArrayG1[0], keyShareArrayG1[1])\n\tfor ell := 2; ell < n; ell++ {\n\t\tmpkG1.Add(mpkG1, keyShareArrayG1[ell])\n\t}\n\n\t// Perform PairingCheck on mpk and mpkG1 to ensure valid pair\n\tvalidPair := cloudflare.PairingCheck([]*cloudflare.G1{mpkG1, h1Base}, []*cloudflare.G2{h2Neg, mpk})\n\tif !validPair {\n\t\tt.Fatal(\"Error in PairingCheck for mpk\")\n\t}\n\n\tauth := authArray[0]\n\ttxOpt := &bind.TransactOpts{\n\t\tFrom: auth.From,\n\t\tNonce: nil,\n\t\tSigner: auth.Signer,\n\t\tValue: nil,\n\t\tGasPrice: nil,\n\t\tGasLimit: gasLim,\n\t\tContext: nil,\n\t}\n\n\t_, err = c.SubmitMasterPublicKey(txOpt, mpkBig)\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error occurred when submitting master public key\")\n\t}\n\tsim.Commit()\n\n\tmpkRcvd0, err := c.MasterPublicKey(&bind.CallOpts{}, big0)\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error when calling mpk (0)\")\n\t}\n\tmpkRcvd1, err := c.MasterPublicKey(&bind.CallOpts{}, big1)\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error when calling mpk (1)\")\n\t}\n\tmpkRcvd2, err := c.MasterPublicKey(&bind.CallOpts{}, big2)\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error when calling mpk (2)\")\n\t}\n\tmpkRcvd3, err := c.MasterPublicKey(&bind.CallOpts{}, big3)\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error when calling mpk (3)\")\n\t}\n\tmpkSubmittedMatchesRcvd := (mpkBig[0].Cmp(mpkRcvd0) == 0) && (mpkBig[1].Cmp(mpkRcvd1) == 0) && (mpkBig[2].Cmp(mpkRcvd2) == 0) && (mpkBig[3].Cmp(mpkRcvd3) == 0)\n\tif !mpkSubmittedMatchesRcvd {\n\t\tt.Fatal(\"mpk submitted does not match received!\")\n\t}\n\n\t// We now proceed to submit gpkj's; they were created above\n\n\t// Check block number here\n\tAdvanceBlocksUntil(sim, mpkSubmissionEnd)\n\tgpkjSubmissionEnd, err := c.TGPKJSUBMISSIONEND(&bind.CallOpts{})\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error in getting GPKJSubmissionEnd\")\n\t}\n\tcurBlock = CurrentBlock(sim)\n\tvalidBlockNumber = (mpkSubmissionEnd.Cmp(curBlock) < 0) && (curBlock.Cmp(gpkjSubmissionEnd) <= 0)\n\tif !validBlockNumber {\n\t\tt.Fatal(\"Unexpected error; in GPKj Submission Phase\")\n\t}\n\n\tinitialMessage, err := c.InitialMessage(&bind.CallOpts{})\n\tif err != nil {\n\t\tt.Fatal(\"Error when getting InitialMessage for gpkj signature\")\n\t}\n\n\t// Make and submit gpkj's\n\tinitialSigArray := make([]*cloudflare.G1, n)\n\tgpkjArray := make([]*cloudflare.G2, n)\n\tfor ell := 0; ell < n; ell++ {\n\t\tgskj := gskjArray[ell]\n\t\tgpkj := new(cloudflare.G2).ScalarBaseMult(gskj)\n\t\tinitialSig, err := cloudflare.Sign(initialMessage, gskj, cloudflare.HashToG1)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error occurred in cloudflare.Sign when signing initialMessage\")\n\t\t}\n\t\tgpkjBig := G2ToBigIntArray(gpkj)\n\t\tinitialSigBig := G1ToBigIntArray(initialSig)\n\n\t\tauth := authArray[ell]\n\t\ttxOpt := &bind.TransactOpts{\n\t\t\tFrom: auth.From,\n\t\t\tNonce: nil,\n\t\t\tSigner: auth.Signer,\n\t\t\tValue: nil,\n\t\t\tGasPrice: nil,\n\t\t\tGasLimit: gasLim,\n\t\t\tContext: nil,\n\t\t}\n\n\t\t// Ensure no previous submission\n\t\tgpkjSubmission0, err := c.GpkjSubmissions(&bind.CallOpts{}, auth.From, big0)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error when calling GpkjSubmission0\")\n\t\t}\n\t\tgpkjSubmission1, err := c.GpkjSubmissions(&bind.CallOpts{}, auth.From, big1)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error when calling GpkjSubmission1\")\n\t\t}\n\t\tgpkjSubmission2, err := c.GpkjSubmissions(&bind.CallOpts{}, auth.From, big2)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error when calling GpkjSubmission2\")\n\t\t}\n\t\tgpkjSubmission3, err := c.GpkjSubmissions(&bind.CallOpts{}, auth.From, big3)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error when calling GpkjSubmission3\")\n\t\t}\n\t\temptyGPKjSub := (gpkjSubmission0.Cmp(big0) == 0) && (gpkjSubmission1.Cmp(big0) == 0) && (gpkjSubmission2.Cmp(big0) == 0) && (gpkjSubmission3.Cmp(big0) == 0)\n\t\tif !emptyGPKjSub {\n\t\t\tt.Fatal(\"Unexpected error; gpkj already submitted\")\n\t\t}\n\n\t\t// Verify signature\n\t\tvalidSig, err := cloudflare.Verify(initialMessage, initialSig, gpkj, cloudflare.HashToG1)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error when calling cloudflare.Verify for (initialSig, gpkj) verification\")\n\t\t}\n\t\tif !validSig {\n\t\t\tt.Fatal(\"Unexpected error; initialSig fails cloudflare.Verify\")\n\t\t}\n\n\t\t_, err = c.SubmitGPKj(txOpt, gpkjBig, initialSigBig)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error occurred when submitting gpkj\")\n\t\t}\n\n\t\tinitialSigArray[ell] = initialSig\n\t\tgpkjArray[ell] = gpkj\n\t}\n\tsim.Commit()\n\n\t// Confirm submissions\n\tfor ell := 0; ell < n; ell++ {\n\t\tauth := authArray[ell]\n\t\tinitialSig := initialSigArray[ell]\n\t\tinitialSigBig := G1ToBigIntArray(initialSig)\n\t\tgpkj := gpkjArray[ell]\n\t\tgpkjBig := G2ToBigIntArray(gpkj)\n\n\t\t// Get Submission for gpkj and confirm\n\t\tgpkjRcvd0, err := c.GpkjSubmissions(&bind.CallOpts{}, auth.From, big0)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error when calling GpkjSubmission0\")\n\t\t}\n\t\tgpkjRcvd1, err := c.GpkjSubmissions(&bind.CallOpts{}, auth.From, big1)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error when calling GpkjSubmission1\")\n\t\t}\n\t\tgpkjRcvd2, err := c.GpkjSubmissions(&bind.CallOpts{}, auth.From, big2)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error when calling GpkjSubmission2\")\n\t\t}\n\t\tgpkjRcvd3, err := c.GpkjSubmissions(&bind.CallOpts{}, auth.From, big3)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error when calling GpkjSubmission3\")\n\t\t}\n\t\tmatchGPKjSub := (gpkjRcvd0.Cmp(gpkjBig[0]) == 0) && (gpkjRcvd1.Cmp(gpkjBig[1]) == 0) && (gpkjRcvd2.Cmp(gpkjBig[2]) == 0) && (gpkjRcvd3.Cmp(gpkjBig[3]) == 0)\n\t\tif !matchGPKjSub {\n\t\t\tt.Fatal(\"Unexpected error; gpkjRcvd does not match submission\")\n\t\t}\n\n\t\t// Get Submission for initialSig and confirm\n\t\tiSigRcvd0, err := c.InitialSignatures(&bind.CallOpts{}, auth.From, big0)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error when calling GpkjSubmission0\")\n\t\t}\n\t\tiSigRcvd1, err := c.InitialSignatures(&bind.CallOpts{}, auth.From, big1)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error when calling GpkjSubmission1\")\n\t\t}\n\t\tmatchISigSub := (iSigRcvd0.Cmp(initialSigBig[0]) == 0) && (iSigRcvd1.Cmp(initialSigBig[1]) == 0)\n\t\tif !matchISigSub {\n\t\t\tt.Fatal(\"Unexpected error; iSigRcvd does not match submission\")\n\t\t}\n\t}\n\n\t// Validate gpkj's by looking at aggregate signatures\n\n\t// Test first batch\n\tfbSigs := make([]*cloudflare.G1, threshold+1)\n\tfbIndices := make([]int, threshold+1)\n\tfor ell := 0; ell < threshold+1; ell++ {\n\t\tfbSigs[ell] = initialSigArray[ell]\n\t\tfbIndices[ell] = ell + 1\n\t}\n\tfbGrpsig, err := cloudflare.AggregateSignatures(fbSigs, fbIndices, threshold)\n\tif err != nil {\n\t\tt.Fatal(\"Error in cloudflare.AggregateSignatures\")\n\t}\n\tvalidGrpsigFB, err := cloudflare.Verify(initialMessage, fbGrpsig, mpk, cloudflare.HashToG1)\n\tif err != nil {\n\t\tt.Fatal(\"Error in cloudflare.Verify\")\n\t}\n\tif !validGrpsigFB {\n\t\tt.Fatal(\"First batch failed to form valid group signature\")\n\t}\n\n\t// Test second batch\n\tsbSigs := make([]*cloudflare.G1, threshold+1)\n\tsbIndices := make([]int, threshold+1)\n\tfor ell := 0; ell < threshold+1; ell++ {\n\t\tsbSigs[ell] = initialSigArray[ell+n-threshold-1]\n\t\tsbIndices[ell] = ell + n - threshold\n\t}\n\tsbGrpsig, err := cloudflare.AggregateSignatures(sbSigs, sbIndices, threshold)\n\tif err != nil {\n\t\tt.Fatal(\"Error in cloudflare.AggregateSignatures\")\n\t}\n\tvalidGrpsigSB, err := cloudflare.Verify(initialMessage, sbGrpsig, mpk, cloudflare.HashToG1)\n\tif err != nil {\n\t\tt.Fatal(\"Error in cloudflare.Verify\")\n\t}\n\tif !validGrpsigSB {\n\t\tt.Fatal(\"Second batch failed to form valid group signature\")\n\t}\n}", "title": "" }, { "docid": "e661d5d0ce6b641259c11e917bab831f", "score": "0.55391985", "text": "func SubmissionsHandler(view *View) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\t\t// Get the problem ID from the URI\n\t\tvars := mux.Vars(r)\n\t\tproblemId := vars[\"problem-id\"]\n\n\t\t// Get the problem from the storage\n\t\tif problem, err := view.Controller.GetProblemWithId(problemId); err != nil {\n\t\t\tlog.Println(err)\n\t\t\thttp.Error(w, err.Error(), 500)\n\t\t} else {\n\t\t\t// Get the sender ID from the request\n\t\t\tsenderId := context.Get(r, \"senderId\").(string)\n\n\t\t\t// Get the contest ID from the problem\n\t\t\tcontestId := problem.ContestId\n\n\t\t\t// Verify if the contest is public or if the sender is the owner of the contest\n\t\t\tif !view.Controller.IsPublic(contestId) && !view.Controller.IsMyContest(senderId, contestId) {\n\t\t\t\terr := \"Not an owner of the contest\"\n\t\t\t\tlog.Println(err)\n\t\t\t\thttp.Error(w, err, 403)\n\t\t\t} else {\n\t\t\t\t// Get the submissions from the storage\n\t\t\t\tif submissions, err := view.Controller.GetSubmissionsForProblem(problemId); err != nil {\n\t\t\t\t\tlog.Println(err)\n\t\t\t\t\thttp.Error(w, err.Error(), 500)\n\t\t\t\t} else {\n\t\t\t\t\tpayload, _ := json.Marshal(submissions)\n\t\t\t\t\tw.Write([]byte(payload))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t})\n}", "title": "" }, { "docid": "a3ba3abbbd5a0e8a81110efe39e02bd3", "score": "0.55069923", "text": "func (_ETHDKG *ETHDKGTransactorSession) SubmitGPKj(gpkj [4]*big.Int, sig [2]*big.Int) (*types.Transaction, error) {\n\treturn _ETHDKG.Contract.SubmitGPKj(&_ETHDKG.TransactOpts, gpkj, sig)\n}", "title": "" }, { "docid": "26dbe8e9d77382bac9a221225143b208", "score": "0.54681695", "text": "func (_ETHDKG *ETHDKGSession) SubmitGPKj(gpkj [4]*big.Int, sig [2]*big.Int) (*types.Transaction, error) {\n\treturn _ETHDKG.Contract.SubmitGPKj(&_ETHDKG.TransactOpts, gpkj, sig)\n}", "title": "" }, { "docid": "ea0789a1126b10f282028695e8f43f6d", "score": "0.5436483", "text": "func TestSubmitGPKjFailInvalidSignature(t *testing.T) {\n\tn := 4\n\tthreshold, _ := thresholdFromUsers(n) // threshold, k are return values\n\t_ = threshold // for linter\n\t//c, sim, keyArray, authArray, privKArray, pubKArray := InitialTestSetup(t, n)\n\tc, _, sim, _, authArray, privKArray, pubKArray := InitialTestSetup(t, n)\n\tdefer sim.Close()\n\tregistrationEnd, err := c.TREGISTRATIONEND(&bind.CallOpts{})\n\tif err != nil {\n\t\tt.Fatal(\"Error in getting RegistrationEnd\")\n\t}\n\tAdvanceBlocksUntil(sim, registrationEnd)\n\t// Current block number is now 22 > 21 == T_REGISTRATION_END;\n\t// in Share Distribution phase\n\n\t// These are the standard secrets be used for testing purposes\n\tsecretValuesArray := make([]*big.Int, n)\n\tsecretBase := big.NewInt(100)\n\tfor j := 0; j < n; j++ {\n\t\tsecretValuesArray[j] = new(big.Int).Add(secretBase, big.NewInt(int64(j)))\n\t}\n\n\t// These are the standard private polynomial coefs for testing purposes\n\tbasePrivatePolynomialCoefs := make([]*big.Int, threshold+1)\n\tfor j := 1; j < threshold+1; j++ {\n\t\tbasePrivatePolynomialCoefs[j] = big.NewInt(int64(j))\n\t}\n\n\t// Create private polynomials for all users\n\tprivPolyCoefsArray := make([][]*big.Int, n)\n\tfor ell := 0; ell < n; ell++ {\n\t\tprivPolyCoefsArray[ell] = make([]*big.Int, threshold+1)\n\t\tprivPolyCoefsArray[ell][0] = secretValuesArray[ell]\n\t\tfor j := 1; j < threshold+1; j++ {\n\t\t\tprivPolyCoefsArray[ell][j] = basePrivatePolynomialCoefs[j]\n\t\t}\n\t}\n\n\t// Create public coefficients for all users\n\tpubCoefsArray := make([][]*cloudflare.G1, n)\n\tfor ell := 0; ell < n; ell++ {\n\t\tpubCoefsArray[ell] = make([]*cloudflare.G1, threshold+1)\n\t\tpubCoefsArray[ell] = cloudflare.GeneratePublicCoefs(privPolyCoefsArray[ell])\n\t}\n\n\t// Create big.Int version of public coefficients\n\tpubCoefsBigArray := make([][][2]*big.Int, n)\n\tfor ell := 0; ell < n; ell++ {\n\t\tpubCoefsBigArray[ell] = make([][2]*big.Int, threshold+1)\n\t\tfor j := 0; j < threshold+1; j++ {\n\t\t\tpubCoefsBigArray[ell][j] = G1ToBigIntArray(pubCoefsArray[ell][j])\n\t\t}\n\t}\n\n\t// Create encrypted shares to submit\n\tencSharesArray := make([][]*big.Int, n)\n\tfor ell := 0; ell < n; ell++ {\n\t\tprivK := privKArray[ell]\n\t\tpubK := pubKArray[ell]\n\t\tencSharesArray[ell] = make([]*big.Int, n-1)\n\t\tsecretsArray, err := cloudflare.GenerateSecretShares(pubK, privPolyCoefsArray[ell], pubKArray)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error occurred while generating sharing secrets\")\n\t\t}\n\t\tencSharesArray[ell], err = cloudflare.GenerateEncryptedShares(secretsArray, privK, pubKArray)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error occurred while generating commitments\")\n\t\t}\n\t}\n\n\t// Create arrays to hold submitted information\n\t// First index is participant receiving (n), then who from (n), then values (n-1);\n\t// note that this would have to be changed in practice\n\trcvdEncShares := make([][][]*big.Int, n)\n\tfor ell := 0; ell < n; ell++ {\n\t\trcvdEncShares[ell] = make([][]*big.Int, n)\n\t\tfor j := 0; j < n; j++ {\n\t\t\trcvdEncShares[ell][j] = make([]*big.Int, n-1)\n\t\t}\n\t}\n\trcvdCommitments := make([][][][2]*big.Int, n)\n\tfor ell := 0; ell < n; ell++ {\n\t\trcvdCommitments[ell] = make([][][2]*big.Int, n)\n\t\tfor j := 0; j < n; j++ {\n\t\t\trcvdCommitments[ell][j] = make([][2]*big.Int, threshold+1)\n\t\t}\n\t}\n\n\tbig0 := big.NewInt(0)\n\tbig1 := big.NewInt(1)\n\tbig2 := big.NewInt(2)\n\tbig3 := big.NewInt(3)\n\n\t// Submit encrypted shares and commitments\n\tfor ell := 0; ell < n; ell++ {\n\t\tauth := authArray[ell]\n\t\tencShares := encSharesArray[ell]\n\t\tpubCoefs := pubCoefsBigArray[ell]\n\t\ttxOpt := &bind.TransactOpts{\n\t\t\tFrom: auth.From,\n\t\t\tNonce: nil,\n\t\t\tSigner: auth.Signer,\n\t\t\tValue: nil,\n\t\t\tGasPrice: nil,\n\t\t\tGasLimit: gasLim,\n\t\t\tContext: nil,\n\t\t}\n\t\t// Check public_key to ensure registered\n\t\tpubKBigRcvd0, err := c.PublicKeys(&bind.CallOpts{}, auth.From, big0)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Something went wrong with c.PublicKeys (0)\")\n\t\t}\n\t\tpubKBigRcvd1, err := c.PublicKeys(&bind.CallOpts{}, auth.From, big1)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Something went wrong with c.PublicKeys (1)\")\n\t\t}\n\t\tregisteredPubK := (pubKBigRcvd0.Cmp(big0) != 0) || (pubKBigRcvd1.Cmp(big0) != 0)\n\t\tif !registeredPubK {\n\t\t\tt.Fatal(\"Public Key already exists\")\n\t\t}\n\t\ttxn, err := c.DistributeShares(txOpt, encShares, pubCoefs)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Unexpected error arose in DistributeShares submission\")\n\t\t}\n\t\tsim.Commit()\n\t\treceipt, err := sim.WaitForReceipt(context.Background(), txn)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Unexpected error in TransactionReceipt\")\n\t\t}\n\t\tshareDistEvent, err := c.ETHDKGFilterer.ParseShareDistribution(*receipt.Logs[0])\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Unexpected error in ParseShareDistribution\")\n\t\t}\n\t\t// Save values in arrays for everyone\n\t\tfor j := 0; j < n; j++ {\n\t\t\tif j == ell {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\trcvdEncShares[j][ell] = shareDistEvent.EncryptedShares\n\t\t\trcvdCommitments[j][ell] = shareDistEvent.Commitments\n\t\t}\n\t}\n\t// Everything above is good but now we want to check stuff like events and logs\n\n\tssArrayAll := make([][]*big.Int, n)\n\tfor ell := 0; ell < n; ell++ {\n\t\tssArrayAll[ell] = make([]*big.Int, n-1)\n\t}\n\n\t// HERE WE GO\n\tfor ell := 0; ell < n; ell++ {\n\t\trcvdEncSharesEll := rcvdEncShares[ell]\n\t\tpubK := pubKArray[ell]\n\t\tprivK := privKArray[ell]\n\t\tsharedEncryptedArray, err := cloudflare.CondenseCommitments(pubK, rcvdEncSharesEll, pubKArray)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Unexpected error occurred when condensing commitments\")\n\t\t}\n\t\tsharedSecretsArray, err := cloudflare.GenerateDecryptedShares(privK, sharedEncryptedArray, pubKArray)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Unexpected error occurred when decrypting secrets\")\n\t\t}\n\t\tssArrayAll[ell] = sharedSecretsArray\n\t}\n\n\tgskjArray := make([]*big.Int, n)\n\tfor ell := 0; ell < n; ell++ {\n\t\tsharedSecretsArray := ssArrayAll[ell]\n\t\tprivPolyCoefs := privPolyCoefsArray[ell]\n\t\tidx := ell + 1\n\t\tselfSecret := cloudflare.PrivatePolyEval(privPolyCoefs, idx)\n\t\tgskj := new(big.Int).Set(selfSecret)\n\t\tfor j := 0; j < n-1; j++ {\n\t\t\tsharedSecret := sharedSecretsArray[j]\n\t\t\tgskj.Add(gskj, sharedSecret)\n\t\t}\n\t\tgskjArray[ell] = gskj\n\t}\n\n\tshareDistributionEnd, err := c.TSHAREDISTRIBUTIONEND(&bind.CallOpts{})\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error in getting ShareDistributionEnd\")\n\t}\n\tAdvanceBlocksUntil(sim, shareDistributionEnd)\n\t// Current block number is now 47 > 46 == T_SHARE_DISTRIBUTION_END;\n\t// in Dispute phase\n\tdisputeEnd, err := c.TDISPUTEEND(&bind.CallOpts{})\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error in getting DisputeEnd\")\n\t}\n\tAdvanceBlocksUntil(sim, disputeEnd)\n\t// Current block number is now 72 > 71 == T_DISPUTE_END;\n\t// in Key Derivation phase\n\n\t// Check block number here\n\tcurBlock := CurrentBlock(sim)\n\tkeyShareSubmissionEnd, err := c.TKEYSHARESUBMISSIONEND(&bind.CallOpts{})\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error in getting KeyShareSubmissionEnd\")\n\t}\n\tvalidBlockNumber := (disputeEnd.Cmp(curBlock) < 0) && (curBlock.Cmp(keyShareSubmissionEnd) <= 0)\n\tif !validBlockNumber {\n\t\tt.Fatal(\"Unexpected error; in Key Share Submission Phase\")\n\t}\n\n\t// Now to submit key shares\n\tkeyShareArrayG1 := make([]*cloudflare.G1, n)\n\tkeyShareArrayG2 := make([]*cloudflare.G2, n)\n\tkeyShareArrayDLEQProof := make([][2]*big.Int, n)\n\n\th1BaseMsg := []byte(\"MadHive Rocks!\")\n\tg1Base := new(cloudflare.G1).ScalarBaseMult(big.NewInt(1))\n\th1Base, err := cloudflare.HashToG1(h1BaseMsg)\n\tif err != nil {\n\t\tt.Fatal(\"Error when computing HashToG1([]byte(\\\"MadHive Rock!\\\"))\")\n\t}\n\th2Base := new(cloudflare.G2).ScalarBaseMult(big.NewInt(1))\n\torderMinus1, _ := new(big.Int).SetString(\"21888242871839275222246405745257275088548364400416034343698204186575808495616\", 10)\n\th2Neg := new(cloudflare.G2).ScalarBaseMult(orderMinus1)\n\n\tfor ell := 0; ell < n; ell++ {\n\t\tsecretValue := secretValuesArray[ell]\n\t\tg1Value := new(cloudflare.G1).ScalarBaseMult(secretValue)\n\t\tkeyShareG1 := new(cloudflare.G1).ScalarMult(h1Base, secretValue)\n\t\tkeyShareG2 := new(cloudflare.G2).ScalarMult(h2Base, secretValue)\n\n\t\t// Generate and Verify DLEQ Proof\n\t\tkeyShareDLEQProof, err := cloudflare.GenerateDLEQProofG1(h1Base, keyShareG1, g1Base, g1Value, secretValue, rand.Reader)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error when generating DLEQ Proof\")\n\t\t}\n\t\terr = cloudflare.VerifyDLEQProofG1(h1Base, keyShareG1, g1Base, g1Value, keyShareDLEQProof)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Invalid DLEQ h1Value proof\")\n\t\t}\n\n\t\t// PairingCheck to ensure keyShareG1 and keyShareG2 form valid pair\n\t\tvalidPair := cloudflare.PairingCheck([]*cloudflare.G1{keyShareG1, h1Base}, []*cloudflare.G2{h2Neg, keyShareG2})\n\t\tif !validPair {\n\t\t\tt.Fatal(\"Error in PairingCheck\")\n\t\t}\n\n\t\tauth := authArray[ell]\n\t\ttxOpt := &bind.TransactOpts{\n\t\t\tFrom: auth.From,\n\t\t\tNonce: nil,\n\t\t\tSigner: auth.Signer,\n\t\t\tValue: nil,\n\t\t\tGasPrice: nil,\n\t\t\tGasLimit: gasLim,\n\t\t\tContext: nil,\n\t\t}\n\n\t\t// Check Key Shares to ensure not submitted\n\t\tkeyShareBig0, err := c.KeyShares(&bind.CallOpts{}, auth.From, big0)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error occurred when calling c.KeyShares (0)\")\n\t\t}\n\t\tkeyShareBig1, err := c.KeyShares(&bind.CallOpts{}, auth.From, big1)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error occurred when calling c.KeyShares (1)\")\n\t\t}\n\t\tzeroKeyShare := (keyShareBig0.Cmp(big0) == 0) && (keyShareBig1.Cmp(big0) == 0)\n\t\tif !zeroKeyShare {\n\t\t\tt.Fatal(\"Unexpected error: KeyShare is nonzero and already present\")\n\t\t}\n\n\t\t// Check Share Distribution Hashes\n\t\tauthHash, err := c.ShareDistributionHashes(&bind.CallOpts{}, auth.From)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error when calling ShareDistributionHashes\")\n\t\t}\n\t\tzeroBytes := make([]byte, numBytes)\n\t\tvalidHash := !bytes.Equal(authHash[:], zeroBytes)\n\t\tif !validHash {\n\t\t\tt.Fatal(\"Unexpected error: invalid hash\")\n\t\t}\n\n\t\tkeyShareG1Big := G1ToBigIntArray(keyShareG1)\n\t\tkeyShareG2Big := G2ToBigIntArray(keyShareG2)\n\n\t\t_, err = c.SubmitKeyShare(txOpt, auth.From, keyShareG1Big, keyShareDLEQProof, keyShareG2Big)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Unexpected error occurred when submitting key shares\")\n\t\t}\n\n\t\tkeyShareArrayG1[ell] = keyShareG1\n\t\tkeyShareArrayG2[ell] = keyShareG2\n\t\tkeyShareArrayDLEQProof[ell] = keyShareDLEQProof\n\t}\n\tsim.Commit()\n\n\t// Need to check key share submission and confirm validity\n\tfor ell := 0; ell < n; ell++ {\n\t\tauth := authArray[ell]\n\t\tkeyShareG1 := keyShareArrayG1[ell]\n\t\tkeyShareBig0, err := c.KeyShares(&bind.CallOpts{}, auth.From, big0)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error occurred when calling c.KeyShares (0)\")\n\t\t}\n\t\tkeyShareBig1, err := c.KeyShares(&bind.CallOpts{}, auth.From, big1)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error occurred when calling c.KeyShares (1)\")\n\t\t}\n\t\tkeyShareG1Rcvd, err := BigIntArrayToG1([2]*big.Int{keyShareBig0, keyShareBig1})\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error in BigIntArrayToG1 call\")\n\t\t}\n\t\tif !keyShareG1.IsEqual(keyShareG1Rcvd) {\n\t\t\tt.Fatal(\"KeyShareG1 mismatch between submission and received!\")\n\t\t}\n\t}\n\n\tAdvanceBlocksUntil(sim, keyShareSubmissionEnd)\n\t// Check block number here\n\tcurBlock = CurrentBlock(sim)\n\tmpkSubmissionEnd, err := c.TMPKSUBMISSIONEND(&bind.CallOpts{})\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error in getting MPKSubmissionEnd\")\n\t}\n\tvalidBlockNumber = (keyShareSubmissionEnd.Cmp(curBlock) < 0) && (curBlock.Cmp(mpkSubmissionEnd) <= 0)\n\tif !validBlockNumber {\n\t\tt.Fatal(\"Unexpected error; in MPK Submission Phase\")\n\t}\n\n\t// Make Master Public Key (this is not how you would actually do this)\n\tmpk := new(cloudflare.G2).Add(keyShareArrayG2[0], keyShareArrayG2[1])\n\tfor ell := 2; ell < n; ell++ {\n\t\tmpk.Add(mpk, keyShareArrayG2[ell])\n\t}\n\tmpkBig := G2ToBigIntArray(mpk)\n\n\t// For G1 version\n\tmpkG1 := new(cloudflare.G1).Add(keyShareArrayG1[0], keyShareArrayG1[1])\n\tfor ell := 2; ell < n; ell++ {\n\t\tmpkG1.Add(mpkG1, keyShareArrayG1[ell])\n\t}\n\n\t// Perform PairingCheck on mpk and mpkG1 to ensure valid pair\n\tvalidPair := cloudflare.PairingCheck([]*cloudflare.G1{mpkG1, h1Base}, []*cloudflare.G2{h2Neg, mpk})\n\tif !validPair {\n\t\tt.Fatal(\"Error in PairingCheck for mpk\")\n\t}\n\n\tauth := authArray[0]\n\ttxOpt := &bind.TransactOpts{\n\t\tFrom: auth.From,\n\t\tNonce: nil,\n\t\tSigner: auth.Signer,\n\t\tValue: nil,\n\t\tGasPrice: nil,\n\t\tGasLimit: gasLim,\n\t\tContext: nil,\n\t}\n\n\t_, err = c.SubmitMasterPublicKey(txOpt, mpkBig)\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error occurred when submitting master public key\")\n\t}\n\tsim.Commit()\n\n\tmpkRcvd0, err := c.MasterPublicKey(&bind.CallOpts{}, big0)\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error when calling mpk (0)\")\n\t}\n\tmpkRcvd1, err := c.MasterPublicKey(&bind.CallOpts{}, big1)\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error when calling mpk (1)\")\n\t}\n\tmpkRcvd2, err := c.MasterPublicKey(&bind.CallOpts{}, big2)\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error when calling mpk (2)\")\n\t}\n\tmpkRcvd3, err := c.MasterPublicKey(&bind.CallOpts{}, big3)\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error when calling mpk (3)\")\n\t}\n\tmpkSubmittedMatchesRcvd := (mpkBig[0].Cmp(mpkRcvd0) == 0) && (mpkBig[1].Cmp(mpkRcvd1) == 0) && (mpkBig[2].Cmp(mpkRcvd2) == 0) && (mpkBig[3].Cmp(mpkRcvd3) == 0)\n\tif !mpkSubmittedMatchesRcvd {\n\t\tt.Fatal(\"mpk submitted does not match received!\")\n\t}\n\n\t// We now proceed to submit gpkj's; they were created above\n\n\t// Check block number here\n\tAdvanceBlocksUntil(sim, mpkSubmissionEnd)\n\tgpkjSubmissionEnd, err := c.TGPKJSUBMISSIONEND(&bind.CallOpts{})\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error in getting GPKJSubmissionEnd\")\n\t}\n\tcurBlock = CurrentBlock(sim)\n\tvalidBlockNumber = (mpkSubmissionEnd.Cmp(curBlock) < 0) && (curBlock.Cmp(gpkjSubmissionEnd) <= 0)\n\tif !validBlockNumber {\n\t\tt.Fatal(\"Unexpected error; in GPKj Submission Phase\")\n\t}\n\n\tinitialMessage, err := c.InitialMessage(&bind.CallOpts{})\n\tif err != nil {\n\t\tt.Fatal(\"Error when getting InitialMessage for gpkj signature\")\n\t}\n\n\t// Make and submit gpkj's\n\tidx := 0\n\tgskj := gskjArray[idx]\n\tgpkj := new(cloudflare.G2).ScalarBaseMult(gskj)\n\tinitialSigBad := new(cloudflare.G1).ScalarBaseMult(big.NewInt(1))\n\tgpkjBig := G2ToBigIntArray(gpkj)\n\tinitialSigBadBig := G1ToBigIntArray(initialSigBad)\n\n\tauth = authArray[idx]\n\ttxOpt = &bind.TransactOpts{\n\t\tFrom: auth.From,\n\t\tNonce: nil,\n\t\tSigner: auth.Signer,\n\t\tValue: nil,\n\t\tGasPrice: nil,\n\t\tGasLimit: gasLim,\n\t\tContext: nil,\n\t}\n\n\t// Ensure no previous submission\n\tgpkjSubmission0, err := c.GpkjSubmissions(&bind.CallOpts{}, auth.From, big0)\n\tif err != nil {\n\t\tt.Fatal(\"Error when calling GpkjSubmission0\")\n\t}\n\tgpkjSubmission1, err := c.GpkjSubmissions(&bind.CallOpts{}, auth.From, big1)\n\tif err != nil {\n\t\tt.Fatal(\"Error when calling GpkjSubmission1\")\n\t}\n\tgpkjSubmission2, err := c.GpkjSubmissions(&bind.CallOpts{}, auth.From, big2)\n\tif err != nil {\n\t\tt.Fatal(\"Error when calling GpkjSubmission2\")\n\t}\n\tgpkjSubmission3, err := c.GpkjSubmissions(&bind.CallOpts{}, auth.From, big3)\n\tif err != nil {\n\t\tt.Fatal(\"Error when calling GpkjSubmission3\")\n\t}\n\temptyGPKjSub := (gpkjSubmission0.Cmp(big0) == 0) && (gpkjSubmission1.Cmp(big0) == 0) && (gpkjSubmission2.Cmp(big0) == 0) && (gpkjSubmission3.Cmp(big0) == 0)\n\tif !emptyGPKjSub {\n\t\tt.Fatal(\"Unexpected error; gpkj already submitted\")\n\t}\n\n\t// Verify signature\n\tvalidSig, err := cloudflare.Verify(initialMessage, initialSigBad, gpkj, cloudflare.HashToG1)\n\tif err != nil {\n\t\tt.Fatal(\"Error when calling cloudflare.Verify for (initialSig, gpkj) verification\")\n\t}\n\tif validSig {\n\t\tt.Fatal(\"Unexpected error; initialSig should fail cloudflare.Verify\")\n\t}\n\n\t// Attempt to submit invalid signature; should fail\n\t_, err = c.SubmitGPKj(txOpt, gpkjBig, initialSigBadBig)\n\tif err != nil {\n\t\tt.Fatal(\"Error should have occurred; attempted to submit gpkj and invalid signature\")\n\t}\n\tsim.Commit()\n\n\t// Confirm submission failed\n\tgpkjRcvd0, err := c.GpkjSubmissions(&bind.CallOpts{}, auth.From, big0)\n\tif err != nil {\n\t\tt.Fatal(\"Error when calling GpkjSubmission0\")\n\t}\n\tgpkjRcvd1, err := c.GpkjSubmissions(&bind.CallOpts{}, auth.From, big1)\n\tif err != nil {\n\t\tt.Fatal(\"Error when calling GpkjSubmission1\")\n\t}\n\tgpkjRcvd2, err := c.GpkjSubmissions(&bind.CallOpts{}, auth.From, big2)\n\tif err != nil {\n\t\tt.Fatal(\"Error when calling GpkjSubmission2\")\n\t}\n\tgpkjRcvd3, err := c.GpkjSubmissions(&bind.CallOpts{}, auth.From, big3)\n\tif err != nil {\n\t\tt.Fatal(\"Error when calling GpkjSubmission3\")\n\t}\n\temptyGPKjRcvd := (gpkjRcvd0.Cmp(big0) == 0) && (gpkjRcvd1.Cmp(big0) == 0) && (gpkjRcvd2.Cmp(big0) == 0) && (gpkjRcvd3.Cmp(big0) == 0)\n\tif !emptyGPKjRcvd {\n\t\tt.Fatal(\"Unexpected error; gpkj submission should have failed due to invalid signature\")\n\t}\n}", "title": "" }, { "docid": "4ece2699c18a3a45b5d9facc900dc18f", "score": "0.54196936", "text": "func (_ETHDKGSubmitMPK *ETHDKGSubmitMPKCaller) TGPKJSUBMISSIONEND(opts *bind.CallOpts) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ETHDKGSubmitMPK.contract.Call(opts, out, \"T_GPKJ_SUBMISSION_END\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "ae9426e0cfc2e2360e075aab70d45429", "score": "0.53849316", "text": "func (_ETHDKGStorage *ETHDKGStorageCaller) TGPKJSUBMISSIONEND(opts *bind.CallOpts) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ETHDKGStorage.contract.Call(opts, out, \"T_GPKJ_SUBMISSION_END\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "1ab77a3bb374417f4b700dcfed800ff9", "score": "0.53779876", "text": "func (_ETHDKGCompletion *ETHDKGCompletionCaller) TGPKJSUBMISSIONEND(opts *bind.CallOpts) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ETHDKGCompletion.contract.Call(opts, out, \"T_GPKJ_SUBMISSION_END\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "7516fb1be3c34ef6f607600a78bbd764", "score": "0.5376142", "text": "func (_ETHDKGSubmitMPK *ETHDKGSubmitMPKCaller) KeyShareSubmissionCheck(opts *bind.CallOpts) (bool, error) {\n\tvar (\n\t\tret0 = new(bool)\n\t)\n\tout := ret0\n\terr := _ETHDKGSubmitMPK.contract.Call(opts, out, \"key_share_submission_check\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "884412191b43ba1390066c2f3232a103", "score": "0.5361373", "text": "func (_ETHDKG *ETHDKGCaller) TGPKJSUBMISSIONEND(opts *bind.CallOpts) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ETHDKG.contract.Call(opts, out, \"T_GPKJ_SUBMISSION_END\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "475e90af39952a9b74836666da357fcb", "score": "0.53291327", "text": "func (_ETHDKGStorage *ETHDKGStorageCaller) KeyShareSubmissionCheck(opts *bind.CallOpts) (bool, error) {\n\tvar (\n\t\tret0 = new(bool)\n\t)\n\tout := ret0\n\terr := _ETHDKGStorage.contract.Call(opts, out, \"key_share_submission_check\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "71b815a78980bcca36ee4601cbbb014f", "score": "0.53206813", "text": "func TestSubmitGPKjFailBlockNumber(t *testing.T) {\n\tn := 4\n\tthreshold, _ := thresholdFromUsers(n) // threshold, k are return values\n\t_ = threshold // for linter\n\t//c, sim, keyArray, authArray, privKArray, pubKArray := InitialTestSetup(t, n)\n\tc, _, sim, _, authArray, privKArray, pubKArray := InitialTestSetup(t, n)\n\tdefer sim.Close()\n\tregistrationEnd, err := c.TREGISTRATIONEND(&bind.CallOpts{})\n\tif err != nil {\n\t\tt.Fatal(\"Error in getting RegistrationEnd\")\n\t}\n\tAdvanceBlocksUntil(sim, registrationEnd)\n\t// Current block number is now 22 > 21 == T_REGISTRATION_END;\n\t// in Share Distribution phase\n\n\t// These are the standard secrets be used for testing purposes\n\tsecretValuesArray := make([]*big.Int, n)\n\tsecretBase := big.NewInt(100)\n\tfor j := 0; j < n; j++ {\n\t\tsecretValuesArray[j] = new(big.Int).Add(secretBase, big.NewInt(int64(j)))\n\t}\n\n\t// These are the standard private polynomial coefs for testing purposes\n\tbasePrivatePolynomialCoefs := make([]*big.Int, threshold+1)\n\tfor j := 1; j < threshold+1; j++ {\n\t\tbasePrivatePolynomialCoefs[j] = big.NewInt(int64(j))\n\t}\n\n\t// Create private polynomials for all users\n\tprivPolyCoefsArray := make([][]*big.Int, n)\n\tfor ell := 0; ell < n; ell++ {\n\t\tprivPolyCoefsArray[ell] = make([]*big.Int, threshold+1)\n\t\tprivPolyCoefsArray[ell][0] = secretValuesArray[ell]\n\t\tfor j := 1; j < threshold+1; j++ {\n\t\t\tprivPolyCoefsArray[ell][j] = basePrivatePolynomialCoefs[j]\n\t\t}\n\t}\n\n\t// Create public coefficients for all users\n\tpubCoefsArray := make([][]*cloudflare.G1, n)\n\tfor ell := 0; ell < n; ell++ {\n\t\tpubCoefsArray[ell] = make([]*cloudflare.G1, threshold+1)\n\t\tpubCoefsArray[ell] = cloudflare.GeneratePublicCoefs(privPolyCoefsArray[ell])\n\t}\n\n\t// Create big.Int version of public coefficients\n\tpubCoefsBigArray := make([][][2]*big.Int, n)\n\tfor ell := 0; ell < n; ell++ {\n\t\tpubCoefsBigArray[ell] = make([][2]*big.Int, threshold+1)\n\t\tfor j := 0; j < threshold+1; j++ {\n\t\t\tpubCoefsBigArray[ell][j] = G1ToBigIntArray(pubCoefsArray[ell][j])\n\t\t}\n\t}\n\n\t// Create encrypted shares to submit\n\tencSharesArray := make([][]*big.Int, n)\n\tfor ell := 0; ell < n; ell++ {\n\t\tprivK := privKArray[ell]\n\t\tpubK := pubKArray[ell]\n\t\tencSharesArray[ell] = make([]*big.Int, n-1)\n\t\tsecretsArray, err := cloudflare.GenerateSecretShares(pubK, privPolyCoefsArray[ell], pubKArray)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error occurred while generating sharing secrets\")\n\t\t}\n\t\tencSharesArray[ell], err = cloudflare.GenerateEncryptedShares(secretsArray, privK, pubKArray)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error occurred while generating commitments\")\n\t\t}\n\t}\n\n\t// Create arrays to hold submitted information\n\t// First index is participant receiving (n), then who from (n), then values (n-1);\n\t// note that this would have to be changed in practice\n\trcvdEncShares := make([][][]*big.Int, n)\n\tfor ell := 0; ell < n; ell++ {\n\t\trcvdEncShares[ell] = make([][]*big.Int, n)\n\t\tfor j := 0; j < n; j++ {\n\t\t\trcvdEncShares[ell][j] = make([]*big.Int, n-1)\n\t\t}\n\t}\n\trcvdCommitments := make([][][][2]*big.Int, n)\n\tfor ell := 0; ell < n; ell++ {\n\t\trcvdCommitments[ell] = make([][][2]*big.Int, n)\n\t\tfor j := 0; j < n; j++ {\n\t\t\trcvdCommitments[ell][j] = make([][2]*big.Int, threshold+1)\n\t\t}\n\t}\n\n\tbig0 := big.NewInt(0)\n\tbig1 := big.NewInt(1)\n\tbig2 := big.NewInt(2)\n\tbig3 := big.NewInt(3)\n\n\t// Submit encrypted shares and commitments\n\tfor ell := 0; ell < n; ell++ {\n\t\tauth := authArray[ell]\n\t\tencShares := encSharesArray[ell]\n\t\tpubCoefs := pubCoefsBigArray[ell]\n\t\ttxOpt := &bind.TransactOpts{\n\t\t\tFrom: auth.From,\n\t\t\tNonce: nil,\n\t\t\tSigner: auth.Signer,\n\t\t\tValue: nil,\n\t\t\tGasPrice: nil,\n\t\t\tGasLimit: gasLim,\n\t\t\tContext: nil,\n\t\t}\n\t\t// Check public_key to ensure registered\n\t\tpubKBigRcvd0, err := c.PublicKeys(&bind.CallOpts{}, auth.From, big0)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Something went wrong with c.PublicKeys (0)\")\n\t\t}\n\t\tpubKBigRcvd1, err := c.PublicKeys(&bind.CallOpts{}, auth.From, big1)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Something went wrong with c.PublicKeys (1)\")\n\t\t}\n\t\tregisteredPubK := (pubKBigRcvd0.Cmp(big0) != 0) || (pubKBigRcvd1.Cmp(big0) != 0)\n\t\tif !registeredPubK {\n\t\t\tt.Fatal(\"Public Key already exists\")\n\t\t}\n\t\ttxn, err := c.DistributeShares(txOpt, encShares, pubCoefs)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Unexpected error arose in DistributeShares submission\")\n\t\t}\n\t\tsim.Commit()\n\t\treceipt, err := sim.WaitForReceipt(context.Background(), txn)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Unexpected error in TransactionReceipt\")\n\t\t}\n\t\tshareDistEvent, err := c.ETHDKGFilterer.ParseShareDistribution(*receipt.Logs[0])\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Unexpected error in ParseShareDistribution\")\n\t\t}\n\t\t// Save values in arrays for everyone\n\t\tfor j := 0; j < n; j++ {\n\t\t\tif j == ell {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\trcvdEncShares[j][ell] = shareDistEvent.EncryptedShares\n\t\t\trcvdCommitments[j][ell] = shareDistEvent.Commitments\n\t\t}\n\t}\n\t// Everything above is good but now we want to check stuff like events and logs\n\n\tssArrayAll := make([][]*big.Int, n)\n\tfor ell := 0; ell < n; ell++ {\n\t\tssArrayAll[ell] = make([]*big.Int, n-1)\n\t}\n\n\t// HERE WE GO\n\tfor ell := 0; ell < n; ell++ {\n\t\trcvdEncSharesEll := rcvdEncShares[ell]\n\t\tpubK := pubKArray[ell]\n\t\tprivK := privKArray[ell]\n\t\tsharedEncryptedArray, err := cloudflare.CondenseCommitments(pubK, rcvdEncSharesEll, pubKArray)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Unexpected error occurred when condensing commitments\")\n\t\t}\n\t\tsharedSecretsArray, err := cloudflare.GenerateDecryptedShares(privK, sharedEncryptedArray, pubKArray)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Unexpected error occurred when decrypting secrets\")\n\t\t}\n\t\tssArrayAll[ell] = sharedSecretsArray\n\t}\n\n\tgskjArray := make([]*big.Int, n)\n\tfor ell := 0; ell < n; ell++ {\n\t\tsharedSecretsArray := ssArrayAll[ell]\n\t\tprivPolyCoefs := privPolyCoefsArray[ell]\n\t\tidx := ell + 1\n\t\tselfSecret := cloudflare.PrivatePolyEval(privPolyCoefs, idx)\n\t\tgskj := new(big.Int).Set(selfSecret)\n\t\tfor j := 0; j < n-1; j++ {\n\t\t\tsharedSecret := sharedSecretsArray[j]\n\t\t\tgskj.Add(gskj, sharedSecret)\n\t\t}\n\t\tgskjArray[ell] = gskj\n\t}\n\n\tshareDistributionEnd, err := c.TSHAREDISTRIBUTIONEND(&bind.CallOpts{})\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error in getting ShareDistributionEnd\")\n\t}\n\tAdvanceBlocksUntil(sim, shareDistributionEnd)\n\t// Current block number is now 47 > 46 == T_SHARE_DISTRIBUTION_END;\n\t// in Dispute phase\n\tdisputeEnd, err := c.TDISPUTEEND(&bind.CallOpts{})\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error in getting DisputeEnd\")\n\t}\n\tAdvanceBlocksUntil(sim, disputeEnd)\n\t// Current block number is now 72 > 71 == T_DISPUTE_END;\n\t// in Key Derivation phase\n\n\t// Check block number here\n\tcurBlock := CurrentBlock(sim)\n\tkeyShareSubmissionEnd, err := c.TKEYSHARESUBMISSIONEND(&bind.CallOpts{})\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error in getting KeyShareSubmissionEnd\")\n\t}\n\tvalidBlockNumber := (disputeEnd.Cmp(curBlock) < 0) && (curBlock.Cmp(keyShareSubmissionEnd) <= 0)\n\tif !validBlockNumber {\n\t\tt.Fatal(\"Unexpected error; in Key Share Submission Phase\")\n\t}\n\n\t// Now to submit key shares\n\tkeyShareArrayG1 := make([]*cloudflare.G1, n)\n\tkeyShareArrayG2 := make([]*cloudflare.G2, n)\n\tkeyShareArrayDLEQProof := make([][2]*big.Int, n)\n\n\th1BaseMsg := []byte(\"MadHive Rocks!\")\n\tg1Base := new(cloudflare.G1).ScalarBaseMult(big.NewInt(1))\n\th1Base, err := cloudflare.HashToG1(h1BaseMsg)\n\tif err != nil {\n\t\tt.Fatal(\"Error when computing HashToG1([]byte(\\\"MadHive Rock!\\\"))\")\n\t}\n\th2Base := new(cloudflare.G2).ScalarBaseMult(big.NewInt(1))\n\torderMinus1, _ := new(big.Int).SetString(\"21888242871839275222246405745257275088548364400416034343698204186575808495616\", 10)\n\th2Neg := new(cloudflare.G2).ScalarBaseMult(orderMinus1)\n\n\tfor ell := 0; ell < n; ell++ {\n\t\tsecretValue := secretValuesArray[ell]\n\t\tg1Value := new(cloudflare.G1).ScalarBaseMult(secretValue)\n\t\tkeyShareG1 := new(cloudflare.G1).ScalarMult(h1Base, secretValue)\n\t\tkeyShareG2 := new(cloudflare.G2).ScalarMult(h2Base, secretValue)\n\n\t\t// Generate and Verify DLEQ Proof\n\t\tkeyShareDLEQProof, err := cloudflare.GenerateDLEQProofG1(h1Base, keyShareG1, g1Base, g1Value, secretValue, rand.Reader)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error when generating DLEQ Proof\")\n\t\t}\n\t\terr = cloudflare.VerifyDLEQProofG1(h1Base, keyShareG1, g1Base, g1Value, keyShareDLEQProof)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Invalid DLEQ h1Value proof\")\n\t\t}\n\n\t\t// PairingCheck to ensure keyShareG1 and keyShareG2 form valid pair\n\t\tvalidPair := cloudflare.PairingCheck([]*cloudflare.G1{keyShareG1, h1Base}, []*cloudflare.G2{h2Neg, keyShareG2})\n\t\tif !validPair {\n\t\t\tt.Fatal(\"Error in PairingCheck\")\n\t\t}\n\n\t\tauth := authArray[ell]\n\t\ttxOpt := &bind.TransactOpts{\n\t\t\tFrom: auth.From,\n\t\t\tNonce: nil,\n\t\t\tSigner: auth.Signer,\n\t\t\tValue: nil,\n\t\t\tGasPrice: nil,\n\t\t\tGasLimit: gasLim,\n\t\t\tContext: nil,\n\t\t}\n\n\t\t// Check Key Shares to ensure not submitted\n\t\tkeyShareBig0, err := c.KeyShares(&bind.CallOpts{}, auth.From, big0)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error occurred when calling c.KeyShares (0)\")\n\t\t}\n\t\tkeyShareBig1, err := c.KeyShares(&bind.CallOpts{}, auth.From, big1)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error occurred when calling c.KeyShares (1)\")\n\t\t}\n\t\tzeroKeyShare := (keyShareBig0.Cmp(big0) == 0) && (keyShareBig1.Cmp(big0) == 0)\n\t\tif !zeroKeyShare {\n\t\t\tt.Fatal(\"Unexpected error: KeyShare is nonzero and already present\")\n\t\t}\n\n\t\t// Check Share Distribution Hashes\n\t\tauthHash, err := c.ShareDistributionHashes(&bind.CallOpts{}, auth.From)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error when calling ShareDistributionHashes\")\n\t\t}\n\t\tzeroBytes := make([]byte, numBytes)\n\t\tvalidHash := !bytes.Equal(authHash[:], zeroBytes)\n\t\tif !validHash {\n\t\t\tt.Fatal(\"Unexpected error: invalid hash\")\n\t\t}\n\n\t\tkeyShareG1Big := G1ToBigIntArray(keyShareG1)\n\t\tkeyShareG2Big := G2ToBigIntArray(keyShareG2)\n\n\t\t_, err = c.SubmitKeyShare(txOpt, auth.From, keyShareG1Big, keyShareDLEQProof, keyShareG2Big)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Unexpected error occurred when submitting key shares\")\n\t\t}\n\n\t\tkeyShareArrayG1[ell] = keyShareG1\n\t\tkeyShareArrayG2[ell] = keyShareG2\n\t\tkeyShareArrayDLEQProof[ell] = keyShareDLEQProof\n\t}\n\tsim.Commit()\n\n\t// Need to check key share submission and confirm validity\n\tfor ell := 0; ell < n; ell++ {\n\t\tauth := authArray[ell]\n\t\tkeyShareG1 := keyShareArrayG1[ell]\n\t\tkeyShareBig0, err := c.KeyShares(&bind.CallOpts{}, auth.From, big0)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error occurred when calling c.KeyShares (0)\")\n\t\t}\n\t\tkeyShareBig1, err := c.KeyShares(&bind.CallOpts{}, auth.From, big1)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error occurred when calling c.KeyShares (1)\")\n\t\t}\n\t\tkeyShareG1Rcvd, err := BigIntArrayToG1([2]*big.Int{keyShareBig0, keyShareBig1})\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error in BigIntArrayToG1 call\")\n\t\t}\n\t\tif !keyShareG1.IsEqual(keyShareG1Rcvd) {\n\t\t\tt.Fatal(\"KeyShareG1 mismatch between submission and received!\")\n\t\t}\n\t}\n\n\tAdvanceBlocksUntil(sim, keyShareSubmissionEnd)\n\t// Check block number here\n\tcurBlock = CurrentBlock(sim)\n\tmpkSubmissionEnd, err := c.TMPKSUBMISSIONEND(&bind.CallOpts{})\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error in getting MPKSubmissionEnd\")\n\t}\n\tvalidBlockNumber = (keyShareSubmissionEnd.Cmp(curBlock) < 0) && (curBlock.Cmp(mpkSubmissionEnd) <= 0)\n\tif !validBlockNumber {\n\t\tt.Fatal(\"Unexpected error; in MPK Submission Phase\")\n\t}\n\n\t// Make Master Public Key (this is not how you would actually do this)\n\tmpk := new(cloudflare.G2).Add(keyShareArrayG2[0], keyShareArrayG2[1])\n\tfor ell := 2; ell < n; ell++ {\n\t\tmpk.Add(mpk, keyShareArrayG2[ell])\n\t}\n\tmpkBig := G2ToBigIntArray(mpk)\n\n\t// For G1 version\n\tmpkG1 := new(cloudflare.G1).Add(keyShareArrayG1[0], keyShareArrayG1[1])\n\tfor ell := 2; ell < n; ell++ {\n\t\tmpkG1.Add(mpkG1, keyShareArrayG1[ell])\n\t}\n\n\t// Perform PairingCheck on mpk and mpkG1 to ensure valid pair\n\tvalidPair := cloudflare.PairingCheck([]*cloudflare.G1{mpkG1, h1Base}, []*cloudflare.G2{h2Neg, mpk})\n\tif !validPair {\n\t\tt.Fatal(\"Error in PairingCheck for mpk\")\n\t}\n\n\tauth := authArray[0]\n\ttxOpt := &bind.TransactOpts{\n\t\tFrom: auth.From,\n\t\tNonce: nil,\n\t\tSigner: auth.Signer,\n\t\tValue: nil,\n\t\tGasPrice: nil,\n\t\tGasLimit: gasLim,\n\t\tContext: nil,\n\t}\n\n\t_, err = c.SubmitMasterPublicKey(txOpt, mpkBig)\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error occurred when submitting master public key\")\n\t}\n\tsim.Commit()\n\n\tmpkRcvd0, err := c.MasterPublicKey(&bind.CallOpts{}, big0)\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error when calling mpk (0)\")\n\t}\n\tmpkRcvd1, err := c.MasterPublicKey(&bind.CallOpts{}, big1)\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error when calling mpk (1)\")\n\t}\n\tmpkRcvd2, err := c.MasterPublicKey(&bind.CallOpts{}, big2)\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error when calling mpk (2)\")\n\t}\n\tmpkRcvd3, err := c.MasterPublicKey(&bind.CallOpts{}, big3)\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error when calling mpk (3)\")\n\t}\n\tmpkSubmittedMatchesRcvd := (mpkBig[0].Cmp(mpkRcvd0) == 0) && (mpkBig[1].Cmp(mpkRcvd1) == 0) && (mpkBig[2].Cmp(mpkRcvd2) == 0) && (mpkBig[3].Cmp(mpkRcvd3) == 0)\n\tif !mpkSubmittedMatchesRcvd {\n\t\tt.Fatal(\"mpk submitted does not match received!\")\n\t}\n\n\t// We now proceed to submit gpkj's; they were created above\n\n\t// Check block number here; will fail\n\tAdvanceBlocksUntil(sim, mpkSubmissionEnd)\n\tgpkjSubmissionEnd, err := c.TGPKJSUBMISSIONEND(&bind.CallOpts{})\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error in getting GPKJSubmissionEnd\")\n\t}\n\tAdvanceBlocksUntil(sim, gpkjSubmissionEnd)\n\tcurBlock = CurrentBlock(sim)\n\tvalidBlockNumber = (mpkSubmissionEnd.Cmp(curBlock) < 0) && (curBlock.Cmp(gpkjSubmissionEnd) <= 0)\n\tif validBlockNumber {\n\t\tt.Fatal(\"Unexpected error; not in GPKj Submission Phase\")\n\t}\n\n\tinitialMessage, err := c.InitialMessage(&bind.CallOpts{})\n\tif err != nil {\n\t\tt.Fatal(\"Error when getting InitialMessage for gpkj signature\")\n\t}\n\n\t// Make and submit gpkj's; this will fail because not in correct block\n\tidx := 0\n\tgskj := gskjArray[idx]\n\tgpkj := new(cloudflare.G2).ScalarBaseMult(gskj)\n\tinitialSig, err := cloudflare.Sign(initialMessage, gskj, cloudflare.HashToG1)\n\tif err != nil {\n\t\tt.Fatal(\"Error occurred in cloudflare.Sign when signing initialMessage\")\n\t}\n\tgpkjBig := G2ToBigIntArray(gpkj)\n\tinitialSigBig := G1ToBigIntArray(initialSig)\n\n\tauth = authArray[idx]\n\ttxOpt = &bind.TransactOpts{\n\t\tFrom: auth.From,\n\t\tNonce: nil,\n\t\tSigner: auth.Signer,\n\t\tValue: nil,\n\t\tGasPrice: nil,\n\t\tGasLimit: gasLim,\n\t\tContext: nil,\n\t}\n\n\t// Ensure no previous submission\n\tgpkjSubmission0, err := c.GpkjSubmissions(&bind.CallOpts{}, auth.From, big0)\n\tif err != nil {\n\t\tt.Fatal(\"Error when calling GpkjSubmission0\")\n\t}\n\tgpkjSubmission1, err := c.GpkjSubmissions(&bind.CallOpts{}, auth.From, big1)\n\tif err != nil {\n\t\tt.Fatal(\"Error when calling GpkjSubmission1\")\n\t}\n\tgpkjSubmission2, err := c.GpkjSubmissions(&bind.CallOpts{}, auth.From, big2)\n\tif err != nil {\n\t\tt.Fatal(\"Error when calling GpkjSubmission2\")\n\t}\n\tgpkjSubmission3, err := c.GpkjSubmissions(&bind.CallOpts{}, auth.From, big3)\n\tif err != nil {\n\t\tt.Fatal(\"Error when calling GpkjSubmission3\")\n\t}\n\temptyGPKjSub := (gpkjSubmission0.Cmp(big0) == 0) && (gpkjSubmission1.Cmp(big0) == 0) && (gpkjSubmission2.Cmp(big0) == 0) && (gpkjSubmission3.Cmp(big0) == 0)\n\tif !emptyGPKjSub {\n\t\tt.Fatal(\"Unexpected error; gpkj already submitted\")\n\t}\n\n\t// Verify signature\n\tvalidSig, err := cloudflare.Verify(initialMessage, initialSig, gpkj, cloudflare.HashToG1)\n\tif err != nil {\n\t\tt.Fatal(\"Error when calling cloudflare.Verify for (initialSig, gpkj) verification\")\n\t}\n\tif !validSig {\n\t\tt.Fatal(\"Unexpected error; initialSig fails cloudflare.Verify\")\n\t}\n\n\t_, err = c.SubmitGPKj(txOpt, gpkjBig, initialSigBig)\n\tif err != nil {\n\t\tt.Fatal(\"Error occurred when submitting gpkj\")\n\t}\n\tsim.Commit()\n\n\t// Confirm no submission occurred\n\tgpkjRcvd0, err := c.GpkjSubmissions(&bind.CallOpts{}, auth.From, big0)\n\tif err != nil {\n\t\tt.Fatal(\"Error when calling GpkjSubmission0\")\n\t}\n\tgpkjRcvd1, err := c.GpkjSubmissions(&bind.CallOpts{}, auth.From, big1)\n\tif err != nil {\n\t\tt.Fatal(\"Error when calling GpkjSubmission1\")\n\t}\n\tgpkjRcvd2, err := c.GpkjSubmissions(&bind.CallOpts{}, auth.From, big2)\n\tif err != nil {\n\t\tt.Fatal(\"Error when calling GpkjSubmission2\")\n\t}\n\tgpkjRcvd3, err := c.GpkjSubmissions(&bind.CallOpts{}, auth.From, big3)\n\tif err != nil {\n\t\tt.Fatal(\"Error when calling GpkjSubmission3\")\n\t}\n\temptyGPKjRcvd := (gpkjRcvd0.Cmp(big0) == 0) && (gpkjRcvd1.Cmp(big0) == 0) && (gpkjRcvd2.Cmp(big0) == 0) && (gpkjRcvd3.Cmp(big0) == 0)\n\tif !emptyGPKjRcvd {\n\t\tt.Fatal(\"Unexpected error; gpkj submission should have failed due to block number\")\n\t}\n}", "title": "" }, { "docid": "85f7feb8bd562b0e123a5cd58016815f", "score": "0.530141", "text": "func (_ETHDKGCompletion *ETHDKGCompletionCaller) KeyShareSubmissionCheck(opts *bind.CallOpts) (bool, error) {\n\tvar (\n\t\tret0 = new(bool)\n\t)\n\tout := ret0\n\terr := _ETHDKGCompletion.contract.Call(opts, out, \"key_share_submission_check\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "3b91d5ff88edb29d40047e45f376ade9", "score": "0.5297614", "text": "func (_ETHDKG *ETHDKGCaller) KeyShareSubmissionCheck(opts *bind.CallOpts) (bool, error) {\n\tvar (\n\t\tret0 = new(bool)\n\t)\n\tout := ret0\n\terr := _ETHDKG.contract.Call(opts, out, \"key_share_submission_check\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "672979227c83ba8ac92ac1932f01d3a2", "score": "0.5296617", "text": "func GetSubmissionsHandler(w http.ResponseWriter, r *http.Request) {\n\thttprouterParams := r.Context().Value(\"params\").(httprouter.Params)\n\tworkspaceID := httprouterParams.ByName(\"workspaceID\")\n\tformID := httprouterParams.ByName(\"formID\")\n\n\tsubmissions, err := actions.GetFormSubmissions(workspaceID, formID)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\tw.Header().Set(\"Content-type\", \"application/json\")\n\terr = json.NewEncoder(w).Encode(submissions)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n}", "title": "" }, { "docid": "37ac2a10477c355ec1a58d0ebcac42b7", "score": "0.5230032", "text": "func (_ETHDKGGroupAccusation *ETHDKGGroupAccusationCaller) TGPKJSUBMISSIONEND(opts *bind.CallOpts) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ETHDKGGroupAccusation.contract.Call(opts, out, \"T_GPKJ_SUBMISSION_END\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "a3e5ad94d9802d4198be216598a682af", "score": "0.5166712", "text": "func (_ETHDKGCompletion *ETHDKGCompletionSession) TGPKJSUBMISSIONEND() (*big.Int, error) {\n\treturn _ETHDKGCompletion.Contract.TGPKJSUBMISSIONEND(&_ETHDKGCompletion.CallOpts)\n}", "title": "" }, { "docid": "22956f9d4873f13d307df006f1211e97", "score": "0.5162705", "text": "func TestSubmitGPKjFailOffCurveSignature(t *testing.T) {\n\tn := 4\n\tthreshold, _ := thresholdFromUsers(n) // threshold, k are return values\n\t_ = threshold // for linter\n\t//c, sim, keyArray, authArray, privKArray, pubKArray := InitialTestSetup(t, n)\n\tc, _, sim, _, authArray, privKArray, pubKArray := InitialTestSetup(t, n)\n\tdefer sim.Close()\n\tregistrationEnd, err := c.TREGISTRATIONEND(&bind.CallOpts{})\n\tif err != nil {\n\t\tt.Fatal(\"Error in getting RegistrationEnd\")\n\t}\n\tAdvanceBlocksUntil(sim, registrationEnd)\n\t// Current block number is now 22 > 21 == T_REGISTRATION_END;\n\t// in Share Distribution phase\n\n\t// These are the standard secrets be used for testing purposes\n\tsecretValuesArray := make([]*big.Int, n)\n\tsecretBase := big.NewInt(100)\n\tfor j := 0; j < n; j++ {\n\t\tsecretValuesArray[j] = new(big.Int).Add(secretBase, big.NewInt(int64(j)))\n\t}\n\n\t// These are the standard private polynomial coefs for testing purposes\n\tbasePrivatePolynomialCoefs := make([]*big.Int, threshold+1)\n\tfor j := 1; j < threshold+1; j++ {\n\t\tbasePrivatePolynomialCoefs[j] = big.NewInt(int64(j))\n\t}\n\n\t// Create private polynomials for all users\n\tprivPolyCoefsArray := make([][]*big.Int, n)\n\tfor ell := 0; ell < n; ell++ {\n\t\tprivPolyCoefsArray[ell] = make([]*big.Int, threshold+1)\n\t\tprivPolyCoefsArray[ell][0] = secretValuesArray[ell]\n\t\tfor j := 1; j < threshold+1; j++ {\n\t\t\tprivPolyCoefsArray[ell][j] = basePrivatePolynomialCoefs[j]\n\t\t}\n\t}\n\n\t// Create public coefficients for all users\n\tpubCoefsArray := make([][]*cloudflare.G1, n)\n\tfor ell := 0; ell < n; ell++ {\n\t\tpubCoefsArray[ell] = make([]*cloudflare.G1, threshold+1)\n\t\tpubCoefsArray[ell] = cloudflare.GeneratePublicCoefs(privPolyCoefsArray[ell])\n\t}\n\n\t// Create big.Int version of public coefficients\n\tpubCoefsBigArray := make([][][2]*big.Int, n)\n\tfor ell := 0; ell < n; ell++ {\n\t\tpubCoefsBigArray[ell] = make([][2]*big.Int, threshold+1)\n\t\tfor j := 0; j < threshold+1; j++ {\n\t\t\tpubCoefsBigArray[ell][j] = G1ToBigIntArray(pubCoefsArray[ell][j])\n\t\t}\n\t}\n\n\t// Create encrypted shares to submit\n\tencSharesArray := make([][]*big.Int, n)\n\tfor ell := 0; ell < n; ell++ {\n\t\tprivK := privKArray[ell]\n\t\tpubK := pubKArray[ell]\n\t\tencSharesArray[ell] = make([]*big.Int, n-1)\n\t\tsecretsArray, err := cloudflare.GenerateSecretShares(pubK, privPolyCoefsArray[ell], pubKArray)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error occurred while generating sharing secrets\")\n\t\t}\n\t\tencSharesArray[ell], err = cloudflare.GenerateEncryptedShares(secretsArray, privK, pubKArray)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error occurred while generating commitments\")\n\t\t}\n\t}\n\n\t// Create arrays to hold submitted information\n\t// First index is participant receiving (n), then who from (n), then values (n-1);\n\t// note that this would have to be changed in practice\n\trcvdEncShares := make([][][]*big.Int, n)\n\tfor ell := 0; ell < n; ell++ {\n\t\trcvdEncShares[ell] = make([][]*big.Int, n)\n\t\tfor j := 0; j < n; j++ {\n\t\t\trcvdEncShares[ell][j] = make([]*big.Int, n-1)\n\t\t}\n\t}\n\trcvdCommitments := make([][][][2]*big.Int, n)\n\tfor ell := 0; ell < n; ell++ {\n\t\trcvdCommitments[ell] = make([][][2]*big.Int, n)\n\t\tfor j := 0; j < n; j++ {\n\t\t\trcvdCommitments[ell][j] = make([][2]*big.Int, threshold+1)\n\t\t}\n\t}\n\n\tbig0 := big.NewInt(0)\n\tbig1 := big.NewInt(1)\n\tbig2 := big.NewInt(2)\n\tbig3 := big.NewInt(3)\n\n\t// Submit encrypted shares and commitments\n\tfor ell := 0; ell < n; ell++ {\n\t\tauth := authArray[ell]\n\t\tencShares := encSharesArray[ell]\n\t\tpubCoefs := pubCoefsBigArray[ell]\n\t\ttxOpt := &bind.TransactOpts{\n\t\t\tFrom: auth.From,\n\t\t\tNonce: nil,\n\t\t\tSigner: auth.Signer,\n\t\t\tValue: nil,\n\t\t\tGasPrice: nil,\n\t\t\tGasLimit: gasLim,\n\t\t\tContext: nil,\n\t\t}\n\t\t// Check public_key to ensure registered\n\t\tpubKBigRcvd0, err := c.PublicKeys(&bind.CallOpts{}, auth.From, big0)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Something went wrong with c.PublicKeys (0)\")\n\t\t}\n\t\tpubKBigRcvd1, err := c.PublicKeys(&bind.CallOpts{}, auth.From, big1)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Something went wrong with c.PublicKeys (1)\")\n\t\t}\n\t\tregisteredPubK := (pubKBigRcvd0.Cmp(big0) != 0) || (pubKBigRcvd1.Cmp(big0) != 0)\n\t\tif !registeredPubK {\n\t\t\tt.Fatal(\"Public Key already exists\")\n\t\t}\n\t\ttxn, err := c.DistributeShares(txOpt, encShares, pubCoefs)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Unexpected error arose in DistributeShares submission\")\n\t\t}\n\t\tsim.Commit()\n\t\treceipt, err := sim.WaitForReceipt(context.Background(), txn)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Unexpected error in TransactionReceipt\")\n\t\t}\n\t\tshareDistEvent, err := c.ETHDKGFilterer.ParseShareDistribution(*receipt.Logs[0])\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Unexpected error in ParseShareDistribution\")\n\t\t}\n\t\t// Save values in arrays for everyone\n\t\tfor j := 0; j < n; j++ {\n\t\t\tif j == ell {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\trcvdEncShares[j][ell] = shareDistEvent.EncryptedShares\n\t\t\trcvdCommitments[j][ell] = shareDistEvent.Commitments\n\t\t}\n\t}\n\t// Everything above is good but now we want to check stuff like events and logs\n\n\tssArrayAll := make([][]*big.Int, n)\n\tfor ell := 0; ell < n; ell++ {\n\t\tssArrayAll[ell] = make([]*big.Int, n-1)\n\t}\n\n\t// HERE WE GO\n\tfor ell := 0; ell < n; ell++ {\n\t\trcvdEncSharesEll := rcvdEncShares[ell]\n\t\tpubK := pubKArray[ell]\n\t\tprivK := privKArray[ell]\n\t\tsharedEncryptedArray, err := cloudflare.CondenseCommitments(pubK, rcvdEncSharesEll, pubKArray)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Unexpected error occurred when condensing commitments\")\n\t\t}\n\t\tsharedSecretsArray, err := cloudflare.GenerateDecryptedShares(privK, sharedEncryptedArray, pubKArray)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Unexpected error occurred when decrypting secrets\")\n\t\t}\n\t\tssArrayAll[ell] = sharedSecretsArray\n\t}\n\n\tgskjArray := make([]*big.Int, n)\n\tfor ell := 0; ell < n; ell++ {\n\t\tsharedSecretsArray := ssArrayAll[ell]\n\t\tprivPolyCoefs := privPolyCoefsArray[ell]\n\t\tidx := ell + 1\n\t\tselfSecret := cloudflare.PrivatePolyEval(privPolyCoefs, idx)\n\t\tgskj := new(big.Int).Set(selfSecret)\n\t\tfor j := 0; j < n-1; j++ {\n\t\t\tsharedSecret := sharedSecretsArray[j]\n\t\t\tgskj.Add(gskj, sharedSecret)\n\t\t}\n\t\tgskjArray[ell] = gskj\n\t}\n\n\tshareDistributionEnd, err := c.TSHAREDISTRIBUTIONEND(&bind.CallOpts{})\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error in getting ShareDistributionEnd\")\n\t}\n\tAdvanceBlocksUntil(sim, shareDistributionEnd)\n\t// Current block number is now 47 > 46 == T_SHARE_DISTRIBUTION_END;\n\t// in Dispute phase\n\tdisputeEnd, err := c.TDISPUTEEND(&bind.CallOpts{})\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error in getting DisputeEnd\")\n\t}\n\tAdvanceBlocksUntil(sim, disputeEnd)\n\t// Current block number is now 72 > 71 == T_DISPUTE_END;\n\t// in Key Derivation phase\n\n\t// Check block number here\n\tcurBlock := CurrentBlock(sim)\n\tkeyShareSubmissionEnd, err := c.TKEYSHARESUBMISSIONEND(&bind.CallOpts{})\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error in getting KeyShareSubmissionEnd\")\n\t}\n\tvalidBlockNumber := (disputeEnd.Cmp(curBlock) < 0) && (curBlock.Cmp(keyShareSubmissionEnd) <= 0)\n\tif !validBlockNumber {\n\t\tt.Fatal(\"Unexpected error; in Key Share Submission Phase\")\n\t}\n\n\t// Now to submit key shares\n\tkeyShareArrayG1 := make([]*cloudflare.G1, n)\n\tkeyShareArrayG2 := make([]*cloudflare.G2, n)\n\tkeyShareArrayDLEQProof := make([][2]*big.Int, n)\n\n\th1BaseMsg := []byte(\"MadHive Rocks!\")\n\tg1Base := new(cloudflare.G1).ScalarBaseMult(big.NewInt(1))\n\th1Base, err := cloudflare.HashToG1(h1BaseMsg)\n\tif err != nil {\n\t\tt.Fatal(\"Error when computing HashToG1([]byte(\\\"MadHive Rock!\\\"))\")\n\t}\n\th2Base := new(cloudflare.G2).ScalarBaseMult(big.NewInt(1))\n\torderMinus1, _ := new(big.Int).SetString(\"21888242871839275222246405745257275088548364400416034343698204186575808495616\", 10)\n\th2Neg := new(cloudflare.G2).ScalarBaseMult(orderMinus1)\n\n\tfor ell := 0; ell < n; ell++ {\n\t\tsecretValue := secretValuesArray[ell]\n\t\tg1Value := new(cloudflare.G1).ScalarBaseMult(secretValue)\n\t\tkeyShareG1 := new(cloudflare.G1).ScalarMult(h1Base, secretValue)\n\t\tkeyShareG2 := new(cloudflare.G2).ScalarMult(h2Base, secretValue)\n\n\t\t// Generate and Verify DLEQ Proof\n\t\tkeyShareDLEQProof, err := cloudflare.GenerateDLEQProofG1(h1Base, keyShareG1, g1Base, g1Value, secretValue, rand.Reader)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error when generating DLEQ Proof\")\n\t\t}\n\t\terr = cloudflare.VerifyDLEQProofG1(h1Base, keyShareG1, g1Base, g1Value, keyShareDLEQProof)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Invalid DLEQ h1Value proof\")\n\t\t}\n\n\t\t// PairingCheck to ensure keyShareG1 and keyShareG2 form valid pair\n\t\tvalidPair := cloudflare.PairingCheck([]*cloudflare.G1{keyShareG1, h1Base}, []*cloudflare.G2{h2Neg, keyShareG2})\n\t\tif !validPair {\n\t\t\tt.Fatal(\"Error in PairingCheck\")\n\t\t}\n\n\t\tauth := authArray[ell]\n\t\ttxOpt := &bind.TransactOpts{\n\t\t\tFrom: auth.From,\n\t\t\tNonce: nil,\n\t\t\tSigner: auth.Signer,\n\t\t\tValue: nil,\n\t\t\tGasPrice: nil,\n\t\t\tGasLimit: gasLim,\n\t\t\tContext: nil,\n\t\t}\n\n\t\t// Check Key Shares to ensure not submitted\n\t\tkeyShareBig0, err := c.KeyShares(&bind.CallOpts{}, auth.From, big0)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error occurred when calling c.KeyShares (0)\")\n\t\t}\n\t\tkeyShareBig1, err := c.KeyShares(&bind.CallOpts{}, auth.From, big1)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error occurred when calling c.KeyShares (1)\")\n\t\t}\n\t\tzeroKeyShare := (keyShareBig0.Cmp(big0) == 0) && (keyShareBig1.Cmp(big0) == 0)\n\t\tif !zeroKeyShare {\n\t\t\tt.Fatal(\"Unexpected error: KeyShare is nonzero and already present\")\n\t\t}\n\n\t\t// Check Share Distribution Hashes\n\t\tauthHash, err := c.ShareDistributionHashes(&bind.CallOpts{}, auth.From)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error when calling ShareDistributionHashes\")\n\t\t}\n\t\tzeroBytes := make([]byte, numBytes)\n\t\tvalidHash := !bytes.Equal(authHash[:], zeroBytes)\n\t\tif !validHash {\n\t\t\tt.Fatal(\"Unexpected error: invalid hash\")\n\t\t}\n\n\t\tkeyShareG1Big := G1ToBigIntArray(keyShareG1)\n\t\tkeyShareG2Big := G2ToBigIntArray(keyShareG2)\n\n\t\t_, err = c.SubmitKeyShare(txOpt, auth.From, keyShareG1Big, keyShareDLEQProof, keyShareG2Big)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Unexpected error occurred when submitting key shares\")\n\t\t}\n\n\t\tkeyShareArrayG1[ell] = keyShareG1\n\t\tkeyShareArrayG2[ell] = keyShareG2\n\t\tkeyShareArrayDLEQProof[ell] = keyShareDLEQProof\n\t}\n\tsim.Commit()\n\n\t// Need to check key share submission and confirm validity\n\tfor ell := 0; ell < n; ell++ {\n\t\tauth := authArray[ell]\n\t\tkeyShareG1 := keyShareArrayG1[ell]\n\t\tkeyShareBig0, err := c.KeyShares(&bind.CallOpts{}, auth.From, big0)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error occurred when calling c.KeyShares (0)\")\n\t\t}\n\t\tkeyShareBig1, err := c.KeyShares(&bind.CallOpts{}, auth.From, big1)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error occurred when calling c.KeyShares (1)\")\n\t\t}\n\t\tkeyShareG1Rcvd, err := BigIntArrayToG1([2]*big.Int{keyShareBig0, keyShareBig1})\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Error in BigIntArrayToG1 call\")\n\t\t}\n\t\tif !keyShareG1.IsEqual(keyShareG1Rcvd) {\n\t\t\tt.Fatal(\"KeyShareG1 mismatch between submission and received!\")\n\t\t}\n\t}\n\n\tAdvanceBlocksUntil(sim, keyShareSubmissionEnd)\n\t// Check block number here\n\tcurBlock = CurrentBlock(sim)\n\tmpkSubmissionEnd, err := c.TMPKSUBMISSIONEND(&bind.CallOpts{})\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error in getting MPKSubmissionEnd\")\n\t}\n\tvalidBlockNumber = (keyShareSubmissionEnd.Cmp(curBlock) < 0) && (curBlock.Cmp(mpkSubmissionEnd) <= 0)\n\tif !validBlockNumber {\n\t\tt.Fatal(\"Unexpected error; in MPK Submission Phase\")\n\t}\n\n\t// Make Master Public Key (this is not how you would actually do this)\n\tmpk := new(cloudflare.G2).Add(keyShareArrayG2[0], keyShareArrayG2[1])\n\tfor ell := 2; ell < n; ell++ {\n\t\tmpk.Add(mpk, keyShareArrayG2[ell])\n\t}\n\tmpkBig := G2ToBigIntArray(mpk)\n\n\t// For G1 version\n\tmpkG1 := new(cloudflare.G1).Add(keyShareArrayG1[0], keyShareArrayG1[1])\n\tfor ell := 2; ell < n; ell++ {\n\t\tmpkG1.Add(mpkG1, keyShareArrayG1[ell])\n\t}\n\n\t// Perform PairingCheck on mpk and mpkG1 to ensure valid pair\n\tvalidPair := cloudflare.PairingCheck([]*cloudflare.G1{mpkG1, h1Base}, []*cloudflare.G2{h2Neg, mpk})\n\tif !validPair {\n\t\tt.Fatal(\"Error in PairingCheck for mpk\")\n\t}\n\n\tauth := authArray[0]\n\ttxOpt := &bind.TransactOpts{\n\t\tFrom: auth.From,\n\t\tNonce: nil,\n\t\tSigner: auth.Signer,\n\t\tValue: nil,\n\t\tGasPrice: nil,\n\t\tGasLimit: gasLim,\n\t\tContext: nil,\n\t}\n\n\t_, err = c.SubmitMasterPublicKey(txOpt, mpkBig)\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error occurred when submitting master public key\")\n\t}\n\tsim.Commit()\n\n\tmpkRcvd0, err := c.MasterPublicKey(&bind.CallOpts{}, big0)\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error when calling mpk (0)\")\n\t}\n\tmpkRcvd1, err := c.MasterPublicKey(&bind.CallOpts{}, big1)\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error when calling mpk (1)\")\n\t}\n\tmpkRcvd2, err := c.MasterPublicKey(&bind.CallOpts{}, big2)\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error when calling mpk (2)\")\n\t}\n\tmpkRcvd3, err := c.MasterPublicKey(&bind.CallOpts{}, big3)\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error when calling mpk (3)\")\n\t}\n\tmpkSubmittedMatchesRcvd := (mpkBig[0].Cmp(mpkRcvd0) == 0) && (mpkBig[1].Cmp(mpkRcvd1) == 0) && (mpkBig[2].Cmp(mpkRcvd2) == 0) && (mpkBig[3].Cmp(mpkRcvd3) == 0)\n\tif !mpkSubmittedMatchesRcvd {\n\t\tt.Fatal(\"mpk submitted does not match received!\")\n\t}\n\n\t// We now proceed to submit gpkj's; they were created above\n\n\t// Check block number here\n\tAdvanceBlocksUntil(sim, mpkSubmissionEnd)\n\tgpkjSubmissionEnd, err := c.TGPKJSUBMISSIONEND(&bind.CallOpts{})\n\tif err != nil {\n\t\tt.Fatal(\"Unexpected error in getting GPKJSubmissionEnd\")\n\t}\n\tcurBlock = CurrentBlock(sim)\n\tvalidBlockNumber = (mpkSubmissionEnd.Cmp(curBlock) < 0) && (curBlock.Cmp(gpkjSubmissionEnd) <= 0)\n\tif !validBlockNumber {\n\t\tt.Fatal(\"Unexpected error; in GPKj Submission Phase\")\n\t}\n\n\t// Make and submit gpkj's; signature is invalid and not on curve\n\tidx := 0\n\tgskj := gskjArray[idx]\n\tgpkj := new(cloudflare.G2).ScalarBaseMult(gskj)\n\tgpkjBig := G2ToBigIntArray(gpkj)\n\tinitialSigBadBig := [2]*big.Int{big.NewInt(1), big.NewInt(3)}\n\n\tauth = authArray[idx]\n\ttxOpt = &bind.TransactOpts{\n\t\tFrom: auth.From,\n\t\tNonce: nil,\n\t\tSigner: auth.Signer,\n\t\tValue: nil,\n\t\tGasPrice: nil,\n\t\tGasLimit: gasLim,\n\t\tContext: nil,\n\t}\n\n\t// Ensure no previous submission\n\tgpkjSubmission0, err := c.GpkjSubmissions(&bind.CallOpts{}, auth.From, big0)\n\tif err != nil {\n\t\tt.Fatal(\"Error when calling GpkjSubmission0\")\n\t}\n\tgpkjSubmission1, err := c.GpkjSubmissions(&bind.CallOpts{}, auth.From, big1)\n\tif err != nil {\n\t\tt.Fatal(\"Error when calling GpkjSubmission1\")\n\t}\n\tgpkjSubmission2, err := c.GpkjSubmissions(&bind.CallOpts{}, auth.From, big2)\n\tif err != nil {\n\t\tt.Fatal(\"Error when calling GpkjSubmission2\")\n\t}\n\tgpkjSubmission3, err := c.GpkjSubmissions(&bind.CallOpts{}, auth.From, big3)\n\tif err != nil {\n\t\tt.Fatal(\"Error when calling GpkjSubmission3\")\n\t}\n\temptyGPKjSub := (gpkjSubmission0.Cmp(big0) == 0) && (gpkjSubmission1.Cmp(big0) == 0) && (gpkjSubmission2.Cmp(big0) == 0) && (gpkjSubmission3.Cmp(big0) == 0)\n\tif !emptyGPKjSub {\n\t\tt.Fatal(\"Unexpected error; gpkj already submitted\")\n\t}\n\n\t// Submit gpkj; should fail due to invalid (off-curve) signature\n\t_, err = c.SubmitGPKj(txOpt, gpkjBig, initialSigBadBig)\n\tif err != nil {\n\t\tt.Fatal(\"Error occurred when submitting gpkj\")\n\t}\n\tsim.Commit()\n\n\t// Ensure submission failed\n\tgpkjRcvd0, err := c.GpkjSubmissions(&bind.CallOpts{}, auth.From, big0)\n\tif err != nil {\n\t\tt.Fatal(\"Error when calling GpkjSubmission0\")\n\t}\n\tgpkjRcvd1, err := c.GpkjSubmissions(&bind.CallOpts{}, auth.From, big1)\n\tif err != nil {\n\t\tt.Fatal(\"Error when calling GpkjSubmission1\")\n\t}\n\tgpkjRcvd2, err := c.GpkjSubmissions(&bind.CallOpts{}, auth.From, big2)\n\tif err != nil {\n\t\tt.Fatal(\"Error when calling GpkjSubmission2\")\n\t}\n\tgpkjRcvd3, err := c.GpkjSubmissions(&bind.CallOpts{}, auth.From, big3)\n\tif err != nil {\n\t\tt.Fatal(\"Error when calling GpkjSubmission3\")\n\t}\n\temptyGPKjRcvd := (gpkjRcvd0.Cmp(big0) == 0) && (gpkjRcvd1.Cmp(big0) == 0) && (gpkjRcvd2.Cmp(big0) == 0) && (gpkjRcvd3.Cmp(big0) == 0)\n\tif !emptyGPKjRcvd {\n\t\tt.Fatal(\"Unexpected error; gpkj should not have been submitted because invalid signature\")\n\t}\n}", "title": "" }, { "docid": "aad28c493195e5c7b41b336abf40afab", "score": "0.5159129", "text": "func (_ETHDKGCompletion *ETHDKGCompletionCallerSession) TGPKJSUBMISSIONEND() (*big.Int, error) {\n\treturn _ETHDKGCompletion.Contract.TGPKJSUBMISSIONEND(&_ETHDKGCompletion.CallOpts)\n}", "title": "" }, { "docid": "d08a9bd5b6ce6c4ae31e2271920cc81f", "score": "0.5154602", "text": "func (_ETHDKGStorage *ETHDKGStorageCaller) MpkSubmissionCheck(opts *bind.CallOpts) (bool, error) {\n\tvar (\n\t\tret0 = new(bool)\n\t)\n\tout := ret0\n\terr := _ETHDKGStorage.contract.Call(opts, out, \"mpk_submission_check\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "966ba4904dbb17ccbe6f92b2fc4de878", "score": "0.5114973", "text": "func (b *EducationAssignmentRequestBuilder) Submissions() *EducationAssignmentSubmissionsCollectionRequestBuilder {\n\tbb := &EducationAssignmentSubmissionsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}\n\tbb.baseURL += \"/submissions\"\n\treturn bb\n}", "title": "" }, { "docid": "609f0dacd9c4df7e3f0117dcd28ed8a0", "score": "0.51149225", "text": "func (_ETHDKGGroupAccusation *ETHDKGGroupAccusationCaller) KeyShareSubmissionCheck(opts *bind.CallOpts) (bool, error) {\n\tvar (\n\t\tret0 = new(bool)\n\t)\n\tout := ret0\n\terr := _ETHDKGGroupAccusation.contract.Call(opts, out, \"key_share_submission_check\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "7455a987f13e4ae6fad0f4c20bc6e2aa", "score": "0.51078576", "text": "func (_ETHDKGSubmitMPK *ETHDKGSubmitMPKSession) TGPKJSUBMISSIONEND() (*big.Int, error) {\n\treturn _ETHDKGSubmitMPK.Contract.TGPKJSUBMISSIONEND(&_ETHDKGSubmitMPK.CallOpts)\n}", "title": "" }, { "docid": "d08ae39d8f3186439c0327f66db2f454", "score": "0.5105857", "text": "func SubmissionHandler(view *View) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\t\t// Get the problem ID from the URI\n\t\tvars := mux.Vars(r)\n\t\tsubmissionId := vars[\"submission-id\"]\n\n\t\t// Get the submission from the storage\n\t\tif submission, err := view.Controller.GetSubmissionWithId(submissionId); err != nil {\n\t\t\tlog.Println(err)\n\t\t\thttp.Error(w, err.Error(), 500)\n\t\t} else {\n\t\t\t// Respond with the submission\n\t\t\tpayload, _ := json.Marshal(submission)\n\t\t\tw.Write([]byte(payload))\n\t\t}\n\t})\n}", "title": "" }, { "docid": "a2fc2afc1eb33384e6fb4f410d25e29e", "score": "0.51045144", "text": "func (_ETHDKGCompletion *ETHDKGCompletionCaller) MpkSubmissionCheck(opts *bind.CallOpts) (bool, error) {\n\tvar (\n\t\tret0 = new(bool)\n\t)\n\tout := ret0\n\terr := _ETHDKGCompletion.contract.Call(opts, out, \"mpk_submission_check\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "fa828a0a5394891f7dd5b840bd4a9072", "score": "0.5080539", "text": "func (_ETHDKGSubmitMPK *ETHDKGSubmitMPKCallerSession) TGPKJSUBMISSIONEND() (*big.Int, error) {\n\treturn _ETHDKGSubmitMPK.Contract.TGPKJSUBMISSIONEND(&_ETHDKGSubmitMPK.CallOpts)\n}", "title": "" }, { "docid": "4c576d0c30dc8ad6b0f0137105cbf982", "score": "0.50704294", "text": "func (_ETHDKG *ETHDKGCaller) MpkSubmissionCheck(opts *bind.CallOpts) (bool, error) {\n\tvar (\n\t\tret0 = new(bool)\n\t)\n\tout := ret0\n\terr := _ETHDKG.contract.Call(opts, out, \"mpk_submission_check\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "f7380690e53f1aaf87784b7c0d032673", "score": "0.5064833", "text": "func (_ETHDKGSubmitMPK *ETHDKGSubmitMPKCaller) MpkSubmissionCheck(opts *bind.CallOpts) (bool, error) {\n\tvar (\n\t\tret0 = new(bool)\n\t)\n\tout := ret0\n\terr := _ETHDKGSubmitMPK.contract.Call(opts, out, \"mpk_submission_check\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "bee44e176bcb1ba34056638a4247e242", "score": "0.5055283", "text": "func (_ETHDKGStorage *ETHDKGStorageSession) TGPKJSUBMISSIONEND() (*big.Int, error) {\n\treturn _ETHDKGStorage.Contract.TGPKJSUBMISSIONEND(&_ETHDKGStorage.CallOpts)\n}", "title": "" }, { "docid": "7cdb59bc7a28d3e2854b225b882b887a", "score": "0.50552684", "text": "func (s *AutograderService) GetSubmissions(ctx context.Context, in *pb.SubmissionRequest) (*pb.Submissions, error) {\n\tusr, err := s.getCurrentUser(ctx)\n\tif err != nil {\n\t\ts.logger.Errorf(\"GetSubmissions failed: authentication error: %v\", err)\n\t\treturn nil, ErrInvalidUserInfo\n\t}\n\n\t// grp may be nil if there is no group ID in request; this is fine, since the grp.Contains() returns false in this case.\n\tgrp, _ := s.getGroup(&pb.GetGroupRequest{GroupID: in.GetGroupID()})\n\n\t// ensure that current user is teacher, enrolled admin, or the current user is owner of the submission request\n\tif !s.hasCourseAccess(usr.GetID(), in.GetCourseID(), func(e *pb.Enrollment) bool {\n\t\treturn e.Status == pb.Enrollment_TEACHER || (usr.GetIsAdmin() && e.Status == pb.Enrollment_STUDENT) ||\n\t\t\t(e.Status == pb.Enrollment_STUDENT && (usr.IsOwner(in.GetUserID()) || grp.Contains(usr)))\n\t}) {\n\t\ts.logger.Error(\"GetSubmissions failed: user is not teacher or submission author\")\n\t\treturn nil, status.Error(codes.PermissionDenied, \"only owner and teachers can get submissions\")\n\t}\n\tsubmissions, err := s.getSubmissions(in)\n\tif err != nil {\n\t\ts.logger.Errorf(\"GetSubmissions failed: %v\", err)\n\t\treturn nil, status.Error(codes.NotFound, \"no submissions found\")\n\t}\n\treturn submissions, nil\n}", "title": "" }, { "docid": "a9f1fbb2df2b90a51120b1a3b89ea881", "score": "0.50292355", "text": "func (_ETHDKGStorage *ETHDKGStorageCallerSession) TGPKJSUBMISSIONEND() (*big.Int, error) {\n\treturn _ETHDKGStorage.Contract.TGPKJSUBMISSIONEND(&_ETHDKGStorage.CallOpts)\n}", "title": "" }, { "docid": "869dd7885eb529fc2e7f068eeafffed4", "score": "0.49814337", "text": "func (_ETHDKG *ETHDKGSession) TGPKJSUBMISSIONEND() (*big.Int, error) {\n\treturn _ETHDKG.Contract.TGPKJSUBMISSIONEND(&_ETHDKG.CallOpts)\n}", "title": "" }, { "docid": "0b7f4fba69696371a37e91cb719f972f", "score": "0.49540684", "text": "func (_ETHDKGGroupAccusation *ETHDKGGroupAccusationCaller) MpkSubmissionCheck(opts *bind.CallOpts) (bool, error) {\n\tvar (\n\t\tret0 = new(bool)\n\t)\n\tout := ret0\n\terr := _ETHDKGGroupAccusation.contract.Call(opts, out, \"mpk_submission_check\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "5394e2d804aa460c80dec37d97b9e0ad", "score": "0.4950365", "text": "func (_ETHDKG *ETHDKGCallerSession) TGPKJSUBMISSIONEND() (*big.Int, error) {\n\treturn _ETHDKG.Contract.TGPKJSUBMISSIONEND(&_ETHDKG.CallOpts)\n}", "title": "" }, { "docid": "ed43dd15f83b212fd9a7ffb5fec6dc22", "score": "0.49443638", "text": "func (_ETHDKGGroupAccusation *ETHDKGGroupAccusationCallerSession) TGPKJSUBMISSIONEND() (*big.Int, error) {\n\treturn _ETHDKGGroupAccusation.Contract.TGPKJSUBMISSIONEND(&_ETHDKGGroupAccusation.CallOpts)\n}", "title": "" }, { "docid": "56fecc57f28c5b861ca47ae5cde6fb61", "score": "0.49330008", "text": "func (_ETHDKGGroupAccusation *ETHDKGGroupAccusationSession) TGPKJSUBMISSIONEND() (*big.Int, error) {\n\treturn _ETHDKGGroupAccusation.Contract.TGPKJSUBMISSIONEND(&_ETHDKGGroupAccusation.CallOpts)\n}", "title": "" }, { "docid": "a3febe3ee502d50437dde7c88da0f91c", "score": "0.48385733", "text": "func (_ETHDKGStorage *ETHDKGStorageSession) KeyShareSubmissionCheck() (bool, error) {\n\treturn _ETHDKGStorage.Contract.KeyShareSubmissionCheck(&_ETHDKGStorage.CallOpts)\n}", "title": "" }, { "docid": "7f48f943673db8668c785358bd9d55ff", "score": "0.48085606", "text": "func (_ETHDKGCompletion *ETHDKGCompletionSession) KeyShareSubmissionCheck() (bool, error) {\n\treturn _ETHDKGCompletion.Contract.KeyShareSubmissionCheck(&_ETHDKGCompletion.CallOpts)\n}", "title": "" }, { "docid": "4133b72fae0cb982691ca7322b78fc48", "score": "0.48072192", "text": "func (sub *submitter) Submit(ctx context.Context, env string) (result SubmissionResult) {\n\tstart := time.Now()\n\tdefer func() { result.Duration = time.Since(start) }()\n\n\t// construct the request\n\tu, err := url.Parse(sub.coreURL)\n\tif err != nil {\n\t\tresult.Err = errors.Wrap(err, 1)\n\t\treturn\n\t}\n\n\tu.Path = \"/tx\"\n\tq := u.Query()\n\tq.Add(\"blob\", env)\n\tu.RawQuery = q.Encode()\n\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\tresult.Err = errors.Wrap(err, 1)\n\t\treturn\n\t}\n\n\t// perform the submission\n\tresp, err := sub.http.Do(req)\n\tif err != nil {\n\t\tresult.Err = errors.Wrap(err, 1)\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\n\t// parse response\n\tvar cresp coreSubmissionResponse\n\terr = json.NewDecoder(resp.Body).Decode(&cresp)\n\tif err != nil {\n\t\tresult.Err = errors.Wrap(err, 1)\n\t\treturn\n\t}\n\n\t// interpet response\n\tif cresp.Exception != \"\" {\n\t\tresult.Err = errors.Errorf(\"zion-core exception: %s\", cresp.Exception)\n\t\treturn\n\t}\n\n\tswitch cresp.Status {\n\tcase StatusError:\n\t\tresult.Err = &FailedTransactionError{cresp.Error}\n\tcase StatusPending, StatusDuplicate:\n\t\t//noop. A nil Err indicates success\n\tdefault:\n\t\tresult.Err = errors.Errorf(\"Unrecognized zion-core status response: %s\", cresp.Status)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "64c3c36162a150e719555718f0c54f24", "score": "0.48001635", "text": "func (_ETHDKGSubmitMPK *ETHDKGSubmitMPKCallerSession) Addresses(arg0 *big.Int) (common.Address, error) {\n\treturn _ETHDKGSubmitMPK.Contract.Addresses(&_ETHDKGSubmitMPK.CallOpts, arg0)\n}", "title": "" }, { "docid": "10bc41341cd93ce4eb5eed06276d42e8", "score": "0.4765366", "text": "func (_ETHDKGStorage *ETHDKGStorageCallerSession) KeyShareSubmissionCheck() (bool, error) {\n\treturn _ETHDKGStorage.Contract.KeyShareSubmissionCheck(&_ETHDKGStorage.CallOpts)\n}", "title": "" }, { "docid": "8022a0e0954d417dbc50a8d8f1688145", "score": "0.4763499", "text": "func (store *Store) GetSubmissions(uid string) ([]store.Submission, error) {\n\treturn []store.Submission{\n\t\tSubmission{\n\t\t\tID: 1,\n\t\t\tAssessmentID: 1,\n\t\t\tCourseID: 1,\n\t\t\tTitle: \"First attempt at Gliding In Space\",\n\t\t\tDescription: \"Hopefully this works. I think it'll pass most tests\",\n\t\t\tFeedback: \"Nice work - just check those last couple of tests! Comments look good, but don't comment everything.\",\n\t\t},\n\t}, nil\n}", "title": "" }, { "docid": "f3629bfb75c8a3c739cfedb8ebdc1767", "score": "0.47566652", "text": "func (_ETHDKGSubmitMPK *ETHDKGSubmitMPKSession) KeyShareSubmissionCheck() (bool, error) {\n\treturn _ETHDKGSubmitMPK.Contract.KeyShareSubmissionCheck(&_ETHDKGSubmitMPK.CallOpts)\n}", "title": "" }, { "docid": "404bd4e1f53b0817c105833a94866fdc", "score": "0.4738754", "text": "func (cb *Bundle) SubmissionURL() (string, error) {\n\tif cb.bundle == nil {\n\t\treturn \"\", errInvalidCheckBundle\n\t}\n\tif len(cb.bundle.ReverseConnectURLs) == 0 {\n\t\treturn \"\", errInvalidReverseRules\n\t}\n\n\t// submission url from mtev_reverse url, given:\n\t//\n\t// mtev_reverse://FQDN_OR_IP:PORT/check/UUID\n\t// config.reverse:secret_key \"sec_string\"\n\t//\n\t// use: https://FQDN_OR_IP:PORT/module/httptrap/UUID/sec_string\n\t//\n\tmtevReverse := cb.bundle.ReverseConnectURLs[0]\n\tmtevSecret := cb.bundle.Config[apiconf.ReverseSecretKey]\n\tsubmissionURL := strings.Replace(strings.Replace(mtevReverse, \"mtev_reverse\", \"https\", 1), \"check\", \"module/httptrap\", 1)\n\tsubmissionURL += \"/\" + mtevSecret\n\treturn submissionURL, nil\n}", "title": "" }, { "docid": "b424b2b5e7ab518ac80c2d7016db6dd5", "score": "0.4738338", "text": "func (_ETHDKG *ETHDKGSession) KeyShareSubmissionCheck() (bool, error) {\n\treturn _ETHDKG.Contract.KeyShareSubmissionCheck(&_ETHDKG.CallOpts)\n}", "title": "" }, { "docid": "cb4b803141acd32d123777f66bc7cb23", "score": "0.47376317", "text": "func GetSubmissionInfoHandler(w http.ResponseWriter, r *http.Request) {\n\thttprouterParams := r.Context().Value(\"params\").(httprouter.Params)\n\tworkspaceID := httprouterParams.ByName(\"workspaceID\")\n\tformID := httprouterParams.ByName(\"formID\")\n\tsubmissionID := httprouterParams.ByName(\"submissionID\")\n\n\tsubmissionData, err := actions.GetFormSubmissionDetails(workspaceID, formID, submissionID)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\tw.Header().Set(\"Content-type\", \"application/json\")\n\terr = json.NewEncoder(w).Encode(submissionData)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n}", "title": "" }, { "docid": "d6834a2c9318fbcb435d81526501c254", "score": "0.47362867", "text": "func (*Submissions) Descriptor() ([]byte, []int) {\n\treturn file_ag_ag_proto_rawDescGZIP(), []int{17}\n}", "title": "" }, { "docid": "8f7e6e681a9fb2be35e154d1e27613c7", "score": "0.4735432", "text": "func (_ETHDKGCompletion *ETHDKGCompletionCallerSession) KeyShareSubmissionCheck() (bool, error) {\n\treturn _ETHDKGCompletion.Contract.KeyShareSubmissionCheck(&_ETHDKGCompletion.CallOpts)\n}", "title": "" }, { "docid": "74776b9d07b37d159db3519b6ce0a0f3", "score": "0.47273046", "text": "func (_ETHDKGSubmitMPK *ETHDKGSubmitMPKCaller) Addresses(opts *bind.CallOpts, arg0 *big.Int) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _ETHDKGSubmitMPK.contract.Call(opts, out, \"addresses\", arg0)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "4b2d57a49006eb46e223b3b446f0e612", "score": "0.4720152", "text": "func (_ETHDKGSubmitMPK *ETHDKGSubmitMPKSession) Addresses(arg0 *big.Int) (common.Address, error) {\n\treturn _ETHDKGSubmitMPK.Contract.Addresses(&_ETHDKGSubmitMPK.CallOpts, arg0)\n}", "title": "" }, { "docid": "93cc9f3e4a9bd30001482fe3ea56d3f1", "score": "0.4707568", "text": "func SubmitAndWait(title string, sender *librakeys.Keys, script libratypes.Script) uint64 {\n\tfmt.Println(title)\n\taddress := sender.AccountAddress()\nRetry:\n\taccount, err := Client.GetAccount(address)\n\tif err != nil {\n\t\tif _, ok := err.(*libraclient.StaleResponseError); ok {\n\t\t\t// retry to hit another server if got stale response\n\t\t\tgoto Retry\n\t\t}\n\t\tpanic(err)\n\t}\n\tsequenceNum := account.SequenceNumber\n\t// it is recommended to set short expiration time for peer to peer transaction,\n\t// as Libra blockchain transaction execution is fast.\n\texpirationDuration := 30 * time.Second\n\texpiration := uint64(time.Now().Add(expirationDuration).Unix())\n\ttxn := librasigner.Sign(\n\t\tsender,\n\t\taddress,\n\t\tsequenceNum,\n\t\tscript,\n\t\t1_000_000, 0, \"Coin1\",\n\t\texpiration,\n\t\ttestnet.ChainID,\n\t)\n\terr = Client.SubmitTransaction(txn)\n\tif err != nil {\n\t\tif _, ok := err.(*libraclient.StaleResponseError); !ok {\n\t\t\tpanic(err)\n\t\t} else {\n\t\t\t// ignore *libraclient.StaleResponseError as we know\n\t\t\t// submit probably succeed even hit a stale server\n\t\t}\n\t}\n\ttransaction, err := Client.WaitForTransaction2(txn, expirationDuration)\n\tif err != nil {\n\t\t// WaitForTransaction retried for *libraclient.StaleResponseError\n\t\t// already, hence here we panic if got error (including timeout error)\n\t\tpanic(err)\n\t}\n\tfmt.Printf(\"=> version: %v, status: %v\\n\",\n\t\ttransaction.Version, transaction.VmStatus.Type)\n\treturn transaction.Version\n}", "title": "" }, { "docid": "50df4aef6be448b45a37ed392a065dd3", "score": "0.46964467", "text": "func (_ETHDKGSubmitMPK *ETHDKGSubmitMPKCallerSession) KeyShareSubmissionCheck() (bool, error) {\n\treturn _ETHDKGSubmitMPK.Contract.KeyShareSubmissionCheck(&_ETHDKGSubmitMPK.CallOpts)\n}", "title": "" }, { "docid": "b82615afde329b63883081effcd22c21", "score": "0.46901992", "text": "func (_ETHDKG *ETHDKGCallerSession) KeyShareSubmissionCheck() (bool, error) {\n\treturn _ETHDKG.Contract.KeyShareSubmissionCheck(&_ETHDKG.CallOpts)\n}", "title": "" }, { "docid": "146094f9377431c911c630b40934f7bd", "score": "0.4677349", "text": "func GetSubmissionsByQuizAndUser(c echo.Context) error {\n\tuserID := authController.FetchLoggedInUserID(c)\n\tquizID := utils.ConvertToUInt(c.QueryParam(\"quizID\"))\n\n\tmcqSubmissions := quizzesDBInteractions.GetMCQSubmissionsByQuizID(userID, quizID)\n\tlongAnswerSubmissions := quizzesDBInteractions.GetLongAnswerSubmissionsByQuizID(userID, quizID)\n\n\treturn c.JSON(http.StatusOK, echo.Map{\n\t\t\"mcqSubmissions\": mcqSubmissions,\n\t\t\"longAnswerSubmissions\": longAnswerSubmissions,\n\t})\n}", "title": "" }, { "docid": "972fd9d92ca7974df28129a53dc89a20", "score": "0.4636609", "text": "func (r *EducationAssignmentSubmissionsCollectionRequest) Get(ctx context.Context) ([]EducationSubmission, error) {\n\tvar query string\n\tif r.query != nil {\n\t\tquery = \"?\" + r.query.Encode()\n\t}\n\treturn r.Paging(ctx, \"GET\", query, nil)\n}", "title": "" }, { "docid": "470856fcc3f98d1936d9653637cea406", "score": "0.46318814", "text": "func (m *EducationSubmission) GetSubmittedResources()([]EducationSubmissionResourceable) {\n return m.submittedResources\n}", "title": "" }, { "docid": "8235b0194909c5709b9c9e1e0e5eda0f", "score": "0.46186632", "text": "func NewGetSubmissionsDefault(code int) *GetSubmissionsDefault {\n\treturn &GetSubmissionsDefault{\n\t\t_statusCode: code,\n\t}\n}", "title": "" }, { "docid": "2b86ac6805b955087f54cb9216567c60", "score": "0.45944238", "text": "func (_ETHDKGStorage *ETHDKGStorageSession) MpkSubmissionCheck() (bool, error) {\n\treturn _ETHDKGStorage.Contract.MpkSubmissionCheck(&_ETHDKGStorage.CallOpts)\n}", "title": "" }, { "docid": "84d9e21d74d5a35313d8c9cf3d7c77fc", "score": "0.45752594", "text": "func (_ETHDKGCompletion *ETHDKGCompletionSession) MpkSubmissionCheck() (bool, error) {\n\treturn _ETHDKGCompletion.Contract.MpkSubmissionCheck(&_ETHDKGCompletion.CallOpts)\n}", "title": "" }, { "docid": "a8f33c3c310d96de708729a00438a281", "score": "0.45589778", "text": "func DeployETHDKGSubmitMPK(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *ETHDKGSubmitMPK, error) {\n\tparsed, err := abi.JSON(strings.NewReader(ETHDKGSubmitMPKABI))\n\tif err != nil {\n\t\treturn common.Address{}, nil, nil, err\n\t}\n\n\taddress, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(ETHDKGSubmitMPKBin), backend)\n\tif err != nil {\n\t\treturn common.Address{}, nil, nil, err\n\t}\n\treturn address, tx, &ETHDKGSubmitMPK{ETHDKGSubmitMPKCaller: ETHDKGSubmitMPKCaller{contract: contract}, ETHDKGSubmitMPKTransactor: ETHDKGSubmitMPKTransactor{contract: contract}, ETHDKGSubmitMPKFilterer: ETHDKGSubmitMPKFilterer{contract: contract}}, nil\n}", "title": "" }, { "docid": "0760f401f5eb25cf7d23a68b39b843ed", "score": "0.4543877", "text": "func submitHandler(w http.ResponseWriter, r *http.Request) {\n\tif err := r.ParseForm(); err != nil {\n\t\terrorHandler(w, r, http.StatusInternalServerError, \"\")\n\t\treturn\n\t}\n\n\tpkg := r.Form.Get(\"pkg\")\n\tif pkg == \"\" {\n\t\terrorHandler(w, r, http.StatusBadRequest, \"pkg not set\")\n\t\treturn\n\t}\n\n\t// there's obviously a race here, where checking the length of the queue and\n\t// adding to the queue are different operations, this isn't a big concern atm\n\tif len(queue) > maxQueueLen*0.75 {\n\t\terrorHandler(w, r, http.StatusInternalServerError, \"server too busy\")\n\t\treturn\n\t}\n\n\t// overwrite old entry and store a new one\n\t_, err := NewResult(pkg)\n\tif err != nil {\n\t\terrorHandler(w, r, http.StatusInternalServerError, \"could not store placeholder result\")\n\t\treturn\n\t}\n\n\t// add to the queue\n\tqueue <- pkg\n\n\t// return with a redirect to the result page\n\tredirect := url.URL{\n\t\tScheme: r.URL.Scheme,\n\t\tHost: r.URL.Host,\n\t\tPath: fmt.Sprintf(\"/result/%s\", pkg),\n\t}\n\thttp.Redirect(w, r, redirect.String(), http.StatusFound)\n}", "title": "" }, { "docid": "df42f7c308328470164d060615d86d5c", "score": "0.45299244", "text": "func (_ETHDKGSubmitMPK *ETHDKGSubmitMPKCaller) PublicKeys(opts *bind.CallOpts, arg0 common.Address, arg1 *big.Int) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ETHDKGSubmitMPK.contract.Call(opts, out, \"public_keys\", arg0, arg1)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "f2e5c3114903c35781b38365ddc44663", "score": "0.45242387", "text": "func (_ETHDKGSubmitMPK *ETHDKGSubmitMPKCaller) TKEYSHARESUBMISSIONEND(opts *bind.CallOpts) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ETHDKGSubmitMPK.contract.Call(opts, out, \"T_KEY_SHARE_SUBMISSION_END\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "fc754fb5d4c17d69a802fe5f25ecb120", "score": "0.4509412", "text": "func (_ETHDKGStorage *ETHDKGStorageCallerSession) MpkSubmissionCheck() (bool, error) {\n\treturn _ETHDKGStorage.Contract.MpkSubmissionCheck(&_ETHDKGStorage.CallOpts)\n}", "title": "" }, { "docid": "6f206cbd649856142d1e6ae915607909", "score": "0.45080534", "text": "func (_ETHDKGGroupAccusation *ETHDKGGroupAccusationSession) KeyShareSubmissionCheck() (bool, error) {\n\treturn _ETHDKGGroupAccusation.Contract.KeyShareSubmissionCheck(&_ETHDKGGroupAccusation.CallOpts)\n}", "title": "" }, { "docid": "49682047d4195db66360887489039201", "score": "0.45072085", "text": "func (_ETHDKG *ETHDKGSession) MpkSubmissionCheck() (bool, error) {\n\treturn _ETHDKG.Contract.MpkSubmissionCheck(&_ETHDKG.CallOpts)\n}", "title": "" }, { "docid": "4ff0bf7bc97ddb1483ada7000871b441", "score": "0.44906542", "text": "func (_ETHDKGCompletion *ETHDKGCompletionCallerSession) MpkSubmissionCheck() (bool, error) {\n\treturn _ETHDKGCompletion.Contract.MpkSubmissionCheck(&_ETHDKGCompletion.CallOpts)\n}", "title": "" }, { "docid": "208a75c3b1afdd2261c202763bbd026d", "score": "0.44828773", "text": "func (_ETHDKGGroupAccusation *ETHDKGGroupAccusationCallerSession) KeyShareSubmissionCheck() (bool, error) {\n\treturn _ETHDKGGroupAccusation.Contract.KeyShareSubmissionCheck(&_ETHDKGGroupAccusation.CallOpts)\n}", "title": "" }, { "docid": "ec50ef844af3355a35763a1ec7b1fb36", "score": "0.4463387", "text": "func (jt *JobTemplate) JobSubmissionState() (SubmissionState, error) {\n\tvalue, err := getStringValue(jt.jt, C.DRMAA_JS_STATE)\n\tif err != nil {\n\t\treturn ActiveState, err\n\t}\n\n\tif value == \"drmaa_hold\" {\n\t\treturn HoldState, nil\n\t} //else { // if value == \"drmaa_active\" {\n\n\treturn ActiveState, nil\n}", "title": "" }, { "docid": "e3a67b61626180060c72b38273d0b122", "score": "0.44594663", "text": "func AddSubmission(username string, vuln string, binFP string) bool {\n\tdb := connDB()\n\t//try to add the binary fingerprint\n\tqueryStmt, err := db.Prepare(\"INSERT INTO binaries (bin_fp) VALUES ($1)\")\n\t_, err = queryStmt.Exec(binFP)\n\n\tif err != nil {\n\t\tlog.Println(\"Could not add the binary ...\")\n\t}\n\n\t//Add the submission itself\n\tqueryStmt, err = db.Prepare(\"INSERT INTO submissions (user_id,vuln,bin_id) SELECT accounts.id as user_id, $1, binaries.id as bin_id FROM accounts FULL JOIN binaries ON true WHERE accounts.username = $2 AND binaries.bin_fp = $3\")\n\n\tres, err := queryStmt.Exec(vuln, username, binFP)\n\n\tdefer db.Close()\n\tif err != nil {\n\t\tSQLErrorHandling(err)\n\t\treturn false\n\t} else {\n\t\tcount, _ := res.RowsAffected()\n\t\t//query happened without errors but there was nothing to insert\n\t\tif count == 0 {\n\t\t\tlog.Println(\"Submission not added ...\")\n\t\t\treturn false\n\t\t} else {\n\t\t\tlog.Println(\"Successfully created a new Submission!\")\n\t\t\treturn true\n\t\t}\n\t}\n}", "title": "" }, { "docid": "08bdb30bc615688dd478177e9b252873", "score": "0.4449653", "text": "func (*Submission) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cv_internal_run_storage_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "e1c403a9dc04c0a7ba5ae92b8e2ec3c4", "score": "0.4443836", "text": "func SubmitJob(jobs Store, projects project.Store, notifier pubsub.Publisher, webhookValidator WebhookValidator, webhookSecret string) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\n\t\tdefer r.Body.Close()\n\t\tpayload, err := submitJobPayload(r, webhookValidator, webhookSecret)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t\te(err.Error())\n\t\t\treturn\n\t\t}\n\n\t\treq := GitHub{}\n\t\tif err := json.Unmarshal(payload, &req); err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t\te(err.Error())\n\t\t\treturn\n\t\t}\n\n\t\t// If we know exactly which account and project the request is for (on-demand \"run job\" from the web UI)\n\t\t// we can skip traversing all projects to find all projects matching the branch/tag requested.\n\t\tprojectID, accountID, ok := isRequestForSpecificProject(r)\n\t\tif ok {\n\t\t\tevt, err := publishJobArrivalEvent(req, projectID, accountID, notifier)\n\t\t\tif err != nil {\n\t\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\t\te(\"failed to enqueue job '%s'\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\ti(\"Enqueued job request %+v\", evt)\n\t\t\tw.WriteHeader(http.StatusAccepted)\n\t\t\treturn\n\t\t}\n\n\t\t// Parse delivery id\n\t\treq.DeliveryID = r.Header.Get(\"X-GitHub-Delivery\")\n\n\t\t// Grab all projects watching the requested repository\n\t\tprojectsWatchingRepo, err := projectsWatchingRepo(projects, req.Repo.CloneURL)\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\tif len(projectsWatchingRepo) == 0 {\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t\ti(\"Found projects matching repository %s: %v\", req.Repo.CloneURL, projectsWatchingRepo)\n\n\t\t// Create a job per matching project if the ref is one we should build i.e. it matches the project's ref regex e.g. refs/heads/master\n\t\tfor _, project := range projectsWatchingRepo {\n\t\t\tmatches, err := regexp.MatchString(\"^\"+project.Branch+\"$\", req.Branch)\n\t\t\tif !matches || err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tevt, err := publishJobArrivalEvent(req, project.ID, project.AccountID, notifier)\n\t\t\tif err != nil {\n\t\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\t\te(\"failed to enqueue job '%s'\", err)\n\t\t\t\treturn // TODO(ilazakis): attempt to save job, retries / DLX are two valid options\n\t\t\t}\n\t\t\ti(\"Enqueued job request %+v\", evt)\n\t\t}\n\n\t\t// Respond\n\t\tw.WriteHeader(http.StatusAccepted)\n\t})\n}", "title": "" }, { "docid": "0a4756b6208819e8df71b7e3e0f4531b", "score": "0.4431066", "text": "func Submit(job func()) {\n\tglobalPool.Submit(job)\n}", "title": "" }, { "docid": "8a817d788a4aff3f490a32ae04c53615", "score": "0.4422799", "text": "func (_ETHDKGSubmitMPK *ETHDKGSubmitMPKCaller) TMPKSUBMISSIONEND(opts *bind.CallOpts) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ETHDKGSubmitMPK.contract.Call(opts, out, \"T_MPK_SUBMISSION_END\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "b66331aea7d756dccc88082db347d3f9", "score": "0.44207162", "text": "func SUBMISSIONS() TABLE_SUBMISSIONS {\n\ttbl := TABLE_SUBMISSIONS{TableInfo: &sq.TableInfo{\n\t\tSchema: \"public\",\n\t\tName: \"submissions\",\n\t}}\n\ttbl.ANSWERS = sq.NewJSONField(\"answers\", tbl.TableInfo)\n\ttbl.ASSIGNMENT_ID = sq.NewNumberField(\"assignment_id\", tbl.TableInfo)\n\ttbl.SUBMISSION_ID = sq.NewNumberField(\"submission_id\", tbl.TableInfo)\n\ttbl.SUBMITTED = sq.NewBooleanField(\"submitted\", tbl.TableInfo)\n\ttbl.TEAM_ID = sq.NewNumberField(\"team_id\", tbl.TableInfo)\n\treturn tbl\n}", "title": "" }, { "docid": "7892fc8849827e22cd1ff5b88c281f48", "score": "0.4419552", "text": "func (_ETHDKG *ETHDKGCallerSession) MpkSubmissionCheck() (bool, error) {\n\treturn _ETHDKG.Contract.MpkSubmissionCheck(&_ETHDKG.CallOpts)\n}", "title": "" }, { "docid": "5ef9beff8435f417293b2aca6f401ae6", "score": "0.4409522", "text": "func (_ETHDKGSubmitMPK *ETHDKGSubmitMPKSession) MpkSubmissionCheck() (bool, error) {\n\treturn _ETHDKGSubmitMPK.Contract.MpkSubmissionCheck(&_ETHDKGSubmitMPK.CallOpts)\n}", "title": "" }, { "docid": "881b631ae1d3215562ab2c096554623b", "score": "0.4404615", "text": "func SubmitRecomputation(r *http.Request, cfg config.Config) (int, http.Header, []byte, error) {\n\t//STANDARD DECLARATIONS START\n\tcode := http.StatusAccepted\n\th := http.Header{}\n\toutput := []byte(\"\")\n\terr := error(nil)\n\tcharset := \"utf-8\"\n\t//STANDARD DECLARATIONS END\n\n\t// Set Content-Type response Header value\n\tcontentType := r.Header.Get(\"Accept\")\n\th.Set(\"Content-Type\", fmt.Sprintf(\"%s; charset=%s\", contentType, charset))\n\n\t// Grab Tenant DB configuration from context\n\ttenantDbConfig := context.Get(r, \"tenant_conf\").(config.MongoConfig)\n\n\tsession, err := mongo.OpenSession(tenantDbConfig)\n\tdefer mongo.CloseSession(session)\n\n\tif err != nil {\n\t\tcode = http.StatusInternalServerError\n\t\treturn code, h, output, err\n\t}\n\n\tvar recompSubmission IncomingRecomputation\n\t// urlValues := r.URL.Query()\n\n\tbody, err := ioutil.ReadAll(io.LimitReader(r.Body, cfg.Server.ReqSizeLimit))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tif err := r.Body.Close(); err != nil {\n\t\tpanic(err)\n\t}\n\tif err := json.Unmarshal(body, &recompSubmission); err != nil {\n\t\toutput, _ = respond.MarshalContent(respond.BadRequestInvalidJSON, contentType, \"\", \" \")\n\t\tcode = http.StatusBadRequest\n\t\treturn code, h, output, err\n\t}\n\tnow := time.Now()\n\n\tstatusItem := HistoryItem{Status: \"pending\", Timestamp: now.Format(\"2006-01-02T15:04:05Z\")}\n\thistory := []HistoryItem{statusItem}\n\n\trecomputation := MongoInterface{\n\t\tID: mongo.NewUUID(),\n\t\tRequesterName: recompSubmission.RequesterName,\n\t\tRequesterEmail: recompSubmission.RequesterEmail,\n\t\tStartTime: recompSubmission.StartTime,\n\t\tEndTime: recompSubmission.EndTime,\n\t\tReason: recompSubmission.Reason,\n\t\tReport: recompSubmission.Report,\n\t\tExclude: recompSubmission.Exclude,\n\t\tExcludeMetrics: recompSubmission.ExcludeMetrics,\n\t\tExcludeMonSource: recompSubmission.ExcludeMonSource,\n\t\tTimestamp: now.Format(\"2006-01-02T15:04:05Z\"),\n\t\tStatus: \"pending\",\n\t\tHistory: history,\n\t}\n\n\terr = mongo.Insert(session, tenantDbConfig.Db, recomputationsColl, recomputation)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\toutput, err = createSubmitView(recomputation, contentType, r)\n\treturn code, h, output, err\n}", "title": "" }, { "docid": "eaf0777f22a8bf9a48bb1d82b619665e", "score": "0.44028923", "text": "func (*UpdateSubmissionsRequest) Descriptor() ([]byte, []int) {\n\treturn file_ag_ag_proto_rawDescGZIP(), []int{36}\n}", "title": "" }, { "docid": "3822e241f1c82c21c85afc031f86d045", "score": "0.43905386", "text": "func fetchResultsForSubmittedBinaries() {\n\tbinariesList := database.GetAllBinariesAwaitingAnalysisResults()\n\tfor i := 0; i < len(binariesList); i++ {\n\t\tlog.Print(\"Making a call to Virus total for this binary to check if analysis is done: \" + binariesList[i].Path)\n\t\tgetAnalysisResults(binariesList[i].Id, binariesList[i].Path)\n }\n}", "title": "" }, { "docid": "90c12d8f42fccb07bca836160813dd81", "score": "0.4371573", "text": "func (_ETHDKGSubmitMPK *ETHDKGSubmitMPKCallerSession) TKEYSHARESUBMISSIONEND() (*big.Int, error) {\n\treturn _ETHDKGSubmitMPK.Contract.TKEYSHARESUBMISSIONEND(&_ETHDKGSubmitMPK.CallOpts)\n}", "title": "" }, { "docid": "8c027b5e9da27a28723b286f1deb1457", "score": "0.4367293", "text": "func (_ETHDKGStorage *ETHDKGStorageCaller) TKEYSHARESUBMISSIONEND(opts *bind.CallOpts) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _ETHDKGStorage.contract.Call(opts, out, \"T_KEY_SHARE_SUBMISSION_END\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "e34fe4319b19b335ebe5228b4cff7419", "score": "0.435885", "text": "func GetSubmissionChangelogHandler(w http.ResponseWriter, r *http.Request) {\n\thttprouterParams := r.Context().Value(\"params\").(httprouter.Params)\n\tworkspaceID := httprouterParams.ByName(\"workspaceID\")\n\tformID := httprouterParams.ByName(\"formID\")\n\tsubmissionID := httprouterParams.ByName(\"submissionID\")\n\n\tsubmissionData, err := actions.GetSubmissionChangelog(workspaceID, formID, submissionID)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\tw.Header().Set(\"Content-type\", \"application/json\")\n\terr = json.NewEncoder(w).Encode(submissionData)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n}", "title": "" } ]
c957a63e5e3a18c490207aa9139193f8
Pointer method showing the use of pointers.
[ { "docid": "26c45a690f0087a3b7cf1330a583a0fa", "score": "0.73977226", "text": "func Pointer() {\n\ti := 6\n\tp := &i\n\tfmt.Println(p)\n\tfmt.Println(&p)\n\tfmt.Println(*p)\n\n\t*p = *p * *p\n\tfmt.Println(*p)\n\tfmt.Println(i)\n}", "title": "" } ]
[ { "docid": "a017a0441813be21603c3be85a059557", "score": "0.76048654", "text": "func pointerStudy() {\n\tv1 := 42 //integer a is declared\n\tvar p1 *int = &v1 // this astirix before type is declaring pointer to data of that type\n\tvar p2 int = v1 // this astirix is derefrencing, drill throught the runtime and find the value at the address\n\n\tfmt.Println(v1, p1, p2, *p1, &v1, &p2) //&p2 and &v1(p1) are different\n\n\t//pointer arithmatic\n\tpAr := [3]int{1, 2, 3}\n\tp4 := &pAr[0]\n\tp5 := &pAr[1]\n\t//p6 := &pAr[1] - 4 //this operation for pointer arithmatic is not allowed in go\n\tvar p6 *[3]int = &pAr //address of array [1,2,3] = &[1,2,3]\n\tfmt.Println(pAr, p4, *p4, p5, *p5, p6, *p6, &p6) //&p6 is address of address of pAr\n\n\t//Structure and pointers\n\tvar stP *myPointerStruct = &myPointerStruct{foo: 42}\n\tfmt.Println(stP, *stP)\n\n\t//new function\n\t//with new function you can not initialize the value within pointer object\n\tvar stP1 *myPointerStruct\n\tfmt.Println(stP1) //poiner object without initializing : it gives special value <nil>\n\tstP1 = new(myPointerStruct)\n\t//to initialize the value , we derefrence the pointer object and assign value to foo\n\t(*stP1).foo = 14 // * has lower precedence than . ,thus () are necessary\n\tfmt.Println(stP1, (*stP1).foo) //it gives address to struct = &{0}\n\tstP1.foo = 21 // go actually interprets this exactly as (*stP1).foo ;\n\tfmt.Println(stP1.foo) // this is just syntactical sugar\n\n\t// the data is copied in case of array\n\tapoi := [3]int{1, 2, 3}\n\tbpoi := apoi\n\tfmt.Println(apoi, bpoi)\n\tapoi[1] = 21\n\tfmt.Println(apoi, bpoi)\n\n\t//but in slice\n\t// slice apoi2 is copied in bpoi2 , but part of the data that is copied is pointer , not the\n\t// underlined data itself\n\tapoi2 := []int{1, 3, 3}\n\tbpoi2 := apoi2\n\tfmt.Println(apoi2, bpoi2)\n\tapoi2[1] = 43\n\tfmt.Println(apoi2, bpoi2)\n\n\t//another built in type that has this behaviour is map\n\tamap := map[string]string{\"name\": \"ajay\", \"age\": \"64\"}\n\tbmap := amap\n\tfmt.Println(amap, bmap)\n\tamap[\"name\"] = \"neelam\"\n\tfmt.Println(amap, bmap)\n\n}", "title": "" }, { "docid": "4c6d25adc0629b114b922589c14e0a74", "score": "0.7334986", "text": "func Pointer[U any](v U)*U { return &v }", "title": "" }, { "docid": "b201bedbaffdc5f8c01838dcc77d053b", "score": "0.7186363", "text": "func PointerDemo(){\n\tfmt.Println(\"--------pointer test--------\")\n\ta := 10\n b := &a // 取变量a的地址,将指针保存到b中\n fmt.Printf(\"type of b:%T\\n\", b)\n c := *b // 指针取值(根据指针去内存取值)\n fmt.Printf(\"type of c:%T\\n\", c)\n\tfmt.Printf(\"value of c:%v\\n\", c)\n\t\n\tvar a1 *int\n\ta1 = new(int) //不初始分配内存会报错\n *a1 = 100\n fmt.Println(*a1)\n\n}", "title": "" }, { "docid": "596ff7a0c8d7d0e5f67fd0c265ef7942", "score": "0.7098141", "text": "func (a *array) Pointer() unsafe.Pointer { return a.Ptr }", "title": "" }, { "docid": "163f1288bcec79712092c522b6c8c9b7", "score": "0.7058049", "text": "func PointerFn() {\n\tfmt.Println(\"--- Pointer basics --- \")\n\n\tval := 10\n\tvar ptr *int\n\tfmt.Println(\"Ptr =\", ptr)\n\n\tptr = &val\n\tfmt.Println(\"Ptr val =\", *ptr)\n\n\tchangePtr(ptr)\n\tfmt.Println(\"val =\", val, \", *ptr =\", *ptr)\n\n\tvar arr = [...]int{23, 34, 41}\n\n\tfmt.Println(arr)\n\tupdateArr(arr[:])\n\tfmt.Println(arr)\n}", "title": "" }, { "docid": "9384fb19f0014e20e3af7a75825be95a", "score": "0.70400596", "text": "func (p Pointer) Pointer(offset int) Pointer {\n\treturn *(*Pointer)(unsafe.Pointer(uintptr(int(p) + offset)))\n}", "title": "" }, { "docid": "e32591d6152b31e42a2c74ed3bcb3bc5", "score": "0.69957197", "text": "func main() {\n\tvar i int = 3\n\n\t// 2 ways of defining pointer\n\t// var ptr *int = &i\n\t// var ptr3 *int = new(int)\n\tptr := &i\n\n\tfmt.Println(\"Initial value\", i)\n\tfmt.Println(\"Variable address\", ptr)\n\tvar pointerToPointer **int = &ptr\n\tfmt.Println(\"Pointer address\", &ptr)\n\tfmt.Println(\"Pointer to pointer value\", pointerToPointer)\n\tfmt.Println(\"Pointer to pointer value after *\", *pointerToPointer)\n\tfmt.Println(\"Pointer to pointer value after **\", **pointerToPointer)\n\n\tmodifyByValue(i)\n\tfmt.Println(\"After passing variable by value it does not change, because object is copied\", i)\n\tmodifyByPointer(ptr)\n\tfmt.Println(\"After passing variable by pointer it does change\", i)\n\n\tfunction := func() int {\n\t\treturn 5\n\t}\n\tfuncPtr := &function\n\tfmt.Println(\"We can have pointers to functions as well\", &function)\n\tres := (*funcPtr)()\n\tfmt.Println(\"Invocation result\", res)\n\n\ttab := []int{10, 20, 30}\n\tptrTab := &tab\n\tptrTab2 := &tab[0]\n\tfmt.Println(*ptrTab)\n\tfmt.Println(*ptrTab2)\n\t// we can't do pointer arithmetics (at least in v1.15)\n\t// ptr++;\n}", "title": "" }, { "docid": "8c75231a0cd80f48c5aa2d251704ee2c", "score": "0.69268227", "text": "func Pointer(list []unsafe.Pointer, index int) []unsafe.Pointer {\n\tcopy(list[index:], list[index+1:])\n\treturn list[:len(list)-1]\n}", "title": "" }, { "docid": "d65cabee17513b5d3810f9596488a405", "score": "0.6910713", "text": "func Pointer(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 target.Kind() != reflect.Ptr {\n\t\tdiags.Append(diag.WithPath(path, DiagIntoIncompatibleType{\n\t\t\tVal: val,\n\t\t\tTargetType: target.Type(),\n\t\t\tErr: fmt.Errorf(\"cannot dereference pointer, not a pointer, is a %s (%s)\", target.Type(), target.Kind()),\n\t\t}))\n\t\treturn target, diags\n\t}\n\t// we may have gotten a nil pointer, so we need to create our own that\n\t// we can set\n\tpointer := reflect.New(target.Type().Elem())\n\t// build out whatever the pointer is pointing to\n\tpointed, pointedDiags := BuildValue(ctx, typ, val, pointer.Elem(), opts, path)\n\tdiags.Append(pointedDiags...)\n\n\tif diags.HasError() {\n\t\treturn target, diags\n\t}\n\t// to be able to set the pointer to our new pointer, we need to create\n\t// a pointer to the pointer\n\tpointerPointer := reflect.New(pointer.Type())\n\t// we set the pointer we created on the pointer to the pointer\n\tpointerPointer.Elem().Set(pointer)\n\t// then it's settable, so we can now set the concrete value we created\n\t// on the pointer\n\tpointerPointer.Elem().Elem().Set(pointed)\n\t// return the pointer we created\n\treturn pointerPointer.Elem(), diags\n}", "title": "" }, { "docid": "5af6b09ac290b4493ea2f9c0fc44ec8b", "score": "0.6904897", "text": "func PointerStruct() {\n\tsuresh := &Employee{\n\t\tFirstName: \"Suresh\",\n\t}\n\tfmt.Println(\"firstname: \",(*suresh).FirstName)\n\tfmt.Println(\"firstname: \",(suresh).FirstName)\n\tfmt.Println(\"firstname: \",suresh.FirstName)\n}", "title": "" }, { "docid": "ea21278e89635d5d90db16545dffb325", "score": "0.68343836", "text": "func (m Grade) Pointer() *Grade {\n\treturn &m\n}", "title": "" }, { "docid": "c2a6501c2c8e4b22c2652d985ecfd170", "score": "0.67920375", "text": "func DemonstratePointers() {\n\tfmt.Println(\"Creating two numbers...\")\n\tfirst, second := 42, 2701\n\n\t//\n\tfirstpointer := &first\n\tfmt.Println(\"Original value of first number:\", first)\n\tfmt.Println(\"Original value of pointer to first number:\", *firstpointer)\n\n\t//\n\tfmt.Println(\"Re-assign first pointer to 21.\")\n\t*firstpointer = 21\n\n\tfmt.Println(\"New Value of first pointer:\", first)\n\tfmt.Println(\"New Value of first:\", first)\n\n\t//\n\tsecondpointer := &second\n\tfmt.Println(\"Original value of second number:\", second)\n\tfmt.Println(\"Original value of pointer to second number:\", *secondpointer)\n\n\tfmt.Println(\"Divide pointer by 37.\")\n\t*secondpointer = *secondpointer / 37\n\n\tfmt.Println(\"New value of second pointer:\", *secondpointer)\n\tfmt.Println(\"New value of second number:\", second)\n\n}", "title": "" }, { "docid": "f8326e2ec006efd8cc67c16252cfd793", "score": "0.6737167", "text": "func (m DiskUsage) Pointer() *DiskUsage {\n\treturn &m\n}", "title": "" }, { "docid": "b97eea4f3c0066758cb9da636d35d44d", "score": "0.67343533", "text": "func (m LOAType) Pointer() *LOAType {\n\treturn &m\n}", "title": "" }, { "docid": "3ce077f64f6847625376eb9328f0ea6b", "score": "0.67336345", "text": "func Pointer(s string) *string {\n\treturn &s\n}", "title": "" }, { "docid": "ce0cd5ae96659c4bd4fa3a52e423686f", "score": "0.66963243", "text": "func idPointer(id interface{}) (p *interface{}) {\n\tif id != nil {\n\t\tp = &id\n\t}\n\treturn\n}", "title": "" }, { "docid": "5fa5c781e035621c891121e2690c2644", "score": "0.6639935", "text": "func testPointer() {\n\tvar a *int = new(int)\n\t*a = 100\n\tfmt.Printf(\"a = %d\\n\", *a)\n\n\t//b is slice pointer\n\tvar b *[]int = new([]int) // b point a slice, but the sliceis nil now\n\tfmt.Printf(\"*b = %v\\n\", *b)\n\tif *b == nil {\n\t\tfmt.Printf(\"*b is nil now\\n\")\n\t}\n\t(*b) = make([]int, 5, 10) // if do not make, below will\n\t(*b)[0] = 1\n\t(*b)[1] = 2\n\tfmt.Printf(\"*b = %v\\n\", *b)\n}", "title": "" }, { "docid": "637ad42d3eea620fb68f20bbdaebf311", "score": "0.6604639", "text": "func (p *cPointer) Pointer() unsafe.Pointer {\n\treturn p.cptr\n}", "title": "" }, { "docid": "e1562bf0c7d23811b3e3ae68d8357ac5", "score": "0.66010976", "text": "func (poh *PoolHandle) Pointer() *C.daos_handle_t {\n\treturn (*C.daos_handle_t)(poh)\n}", "title": "" }, { "docid": "f8fce1ee461c1f9122b6680c197837b3", "score": "0.6600452", "text": "func (t Timestamp) Pointer() *Timestamp {\n\treturn &t\n}", "title": "" }, { "docid": "d53a11677001ca4652cd609aec8a935c", "score": "0.6588885", "text": "func getPointer() {\n\tvar count1 *int\n\tcount2 := new(int)\n\tcountTemp := 5\n\tcount3 := &countTemp\n\tt := &time.Time{}\n\n\tif count1 != nil {\n\t\tfmt.Printf(\"count1 %#v\\n\", *count1)\n\t}\n\tif count2 != nil {\n\t\tfmt.Printf(\"count2 : %#v\\n\", *count2)\n\t}\n\tif count3 != nil {\n\t\tfmt.Printf(\"count3 :%#v\\n\", *count3)\n\t}\n\tif t != nil {\n\t\tfmt.Printf(\"time : %#v\\n\", *t)\n\t\tfmt.Printf(\"time : %#v\\n\",t.String())\n\t}\n\n}", "title": "" }, { "docid": "b072ed4e5fdfa0d852fc5dd8cc5b8efa", "score": "0.65867704", "text": "func Ptr(data interface{}) unsafe.Pointer { return nil }", "title": "" }, { "docid": "23cb3ed18aeb12a9dd64f7a01b699769", "score": "0.656974", "text": "func valueAndPointer() {\n\n\tvar bp *bool = &b //指针类型,类型前面加* . 指向b\n\tfmt.Println(\"指针类型:\", b, *bp) //指针类型: false false ,前面加*解引用dereferencing\n\tb = true\n\tfmt.Println(\"指针类型:\", b, *bp) //指针类型: true true\n\n\t//------------------------------\n\n\ti := 1\n\ti_pointer := &i //指针\n\n\tfmt.Println(i, i_pointer, *i_pointer, reflect.TypeOf(i), reflect.TypeOf(i_pointer)) //1 0xc082006d90 1 int *int\n\ti = 2\n\tfmt.Println(i, i_pointer, *i_pointer, reflect.TypeOf(i), reflect.TypeOf(i_pointer)) //2 0xc082006d90 2 int *int\n\n\tz := 37 // z is of type int\n\tpi := &z // pi is of type *int (pointer to int)\n\tppi := &pi // ppi is of type **int (pointer to pointer to int)\n\tfmt.Println(z, *pi, **ppi) //37 37 37\n\t**ppi++ // Semantically the same as: (*(*ppi))++ and *(*ppi)++\n\tfmt.Println(z, *pi, **ppi) //38 38 38\n\n\t//----------------------------------\n\tii := 9\n\tjj := 5\n\tproduct := 0\n\tswapAndProduct(&ii, &jj, &product)\n\tfmt.Println(ii, jj, product) //5 9 45\n\n\t//----------------------------------\n\t//3种方式创建User实例\n\t//new(Type) ≡ &Type{} //两种语法等价\n\tmyU := User{1, \"Nshen\"} // user value\n\tmyU1 := &myU // pointer to user\n\n\tmyU2 := &User{2, \"Nshen2\"} // pointer to user\n\n\tmyU3 := new(User) // pointer to user // var myU3 *User = new(User)\n\tmyU3.id = 3\n\tmyU3.name = \"Nshen3\"\n\n\tmyU4 := &User{2, \"Nshen2\"} //与u2内容一样,注意看比较\n\tfmt.Println(\n\t\tmyU2.id == myU4.id, //true\n\t\tmyU2.name == myU4.name, //true\n\t\tmyU2 == myU4, //false\n\t\treflect.DeepEqual(myU2, myU4)) //true\n\n\tfmt.Println(myU) //{1 Nshen} 只有这个是值\n\tfmt.Println(myU1, myU2, myU3, myU4) //&{1 Nshen} &{2 Nshen2} &{3 Nshen3} &{2 Nshen2}\n\tfmt.Println(\n\t\treflect.TypeOf(myU), //main.User\n\t\treflect.TypeOf(myU1), //*main.User\n\t\treflect.TypeOf(myU2), //*main.User\n\t\treflect.TypeOf(myU3), //*main.User\n\t\treflect.TypeOf(myU4)) //*main.User\n\n\t//----------------------------\n\n\tvar flag BitFlag = Active | Send\n\tfmt.Println(flag) //3(Active|Send)\n\tfmt.Println(BitFlag(0), Active, Send, flag, Receive, flag|Receive)\n\n}", "title": "" }, { "docid": "803a940f25fcc21791887bf4abe18c81", "score": "0.65394866", "text": "func (t *TestStruct) FunctionOnPointer() {}", "title": "" }, { "docid": "7905f4ea8857a07a5831548fd615c9b5", "score": "0.65177816", "text": "func MainPointers() {\n\tfmt.Println(\"Start MainPointers >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\")\n\tBasicPointer()\n\tfmt.Println(\"End MainPointers <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\")\n\tfmt.Println()\n}", "title": "" }, { "docid": "93a21832bbf6ea431225e3ca6c73036f", "score": "0.6455691", "text": "func trackPointer(ptr unsafe.Pointer)", "title": "" }, { "docid": "799a35945c1ea935ff490e5d414ddfa9", "score": "0.6454751", "text": "func squarePointer(x *int) {\n\t// putting star to access value at x. x is the address\n\t*x *= *x\n\tfmt.Println(x, *x)\n}", "title": "" }, { "docid": "65ef2d801198ece61e990761c1fce3fb", "score": "0.6439157", "text": "func IntPointer(i int) *int {\n\treturn &i\n}", "title": "" }, { "docid": "65ef2d801198ece61e990761c1fce3fb", "score": "0.6439157", "text": "func IntPointer(i int) *int {\n\treturn &i\n}", "title": "" }, { "docid": "65ef2d801198ece61e990761c1fce3fb", "score": "0.6439157", "text": "func IntPointer(i int) *int {\n\treturn &i\n}", "title": "" }, { "docid": "13b242a0bedd999c38bf6d3da19c3860", "score": "0.63816345", "text": "func (m SnmpPrivacyProtocol) Pointer() *SnmpPrivacyProtocol {\n\treturn &m\n}", "title": "" }, { "docid": "9810686d7a7c0bb7d9d107e42b24b785", "score": "0.6354931", "text": "func changeValuePointer(something *int){\n fmt.Print(\"type of something = \")\n fmt.Printf(\"%T\",something) //*int\n fmt.Println()\n fmt.Println(\"address value of something = \",something)\nfmt.Println(\"value at that address = \",*something) //print what is something pointing to\n//*something is for HUMAN\n//&something is for COMPUTER\n*something++\n\n}", "title": "" }, { "docid": "c96f6151e231d8db44ca4ba90fb07da2", "score": "0.635425", "text": "func Pointer(list []unsafe.Pointer, index int, value unsafe.Pointer) []unsafe.Pointer {\n\textendedList := append(list, value)\n\tif index < len(list) {\n\t\tcopy(extendedList[index+1:], list[index:])\n\t\textendedList[index] = value\n\t}\n\treturn extendedList\n}", "title": "" }, { "docid": "dd4f406c481f3ee6a3458f94c7950f0e", "score": "0.6329534", "text": "func (coh *ContHandle) Pointer() *C.daos_handle_t {\n\treturn (*C.daos_handle_t)(coh)\n}", "title": "" }, { "docid": "f33194700f7e2bc829775b24a70329c9", "score": "0.6323538", "text": "func int64Pointer(n int64) *int64 {\n\treturn &n\n}", "title": "" }, { "docid": "4d6a311902a130b2d7d9e7074acba6e5", "score": "0.63143384", "text": "func main() {\n\n\ti := 1\n\t//申明一个指针\n\tvar p1 *int\n\t//给指针p1赋值\n\tp1 = &i\n\t//通过指针p1访问变量i\n\tfmt.Println(*p1)\n\n\tj := 2\n\tp2 := &j\n\n\tfmt.Println(p1, p2)\n\tfmt.Println(*p1, *p2)\n}", "title": "" }, { "docid": "e495ed87924ce7e89d1c91e9af234b63", "score": "0.6314102", "text": "func doublePtr(num *int) {\n\t// dereference pointer and assign value\n\t*num *= 2\n}", "title": "" }, { "docid": "c8a95b15b21369f24ba978758c4d4165", "score": "0.6280416", "text": "func (h *Huge) AddressPtr() {\n\tfmt.Printf(\"%p\\n\", h)\n}", "title": "" }, { "docid": "cd242f32f224c8f1e4a91e281d1395df", "score": "0.62796247", "text": "func funWithPtr(yPtr *int) {\r\n\r\n\t// the * basically means that we're providing acces\r\n\t// to the underlying value that the pointer points to\r\n\t// in this case we are store the value 0 in the memory\r\n\t// location pointer to by \"y\" pointer\r\n\t*yPtr = 0\r\n}", "title": "" }, { "docid": "9fb3e4362090ad40f579c4459524746c", "score": "0.62537587", "text": "func (m SnmpLanguageCode) Pointer() *SnmpLanguageCode {\n\treturn &m\n}", "title": "" }, { "docid": "723ab4cdb0a7e91826c305558ae51aed", "score": "0.62499565", "text": "func (m ApplicationVMSpecPlacementSituation) Pointer() *ApplicationVMSpecPlacementSituation {\n\treturn &m\n}", "title": "" }, { "docid": "3197bd1f3abc061ca1279dd73ee74e59", "score": "0.6217121", "text": "func pointerTo(t Type) PointerType {\n\treturn PointerType{Addressee: t}\n}", "title": "" }, { "docid": "df770458b9fd38d47f5505d2cd06a937", "score": "0.6216898", "text": "func ptr(data interface{}) unsafe.Pointer {\n\tif data == nil {\n\t\treturn unsafe.Pointer(nil)\n\t}\n\tvar addr unsafe.Pointer\n\tv := reflect.ValueOf(data)\n\tswitch v.Type().Kind() {\n\tcase reflect.Ptr:\n\t\te := v.Elem()\n\t\tswitch e.Kind() {\n\t\tcase\n\t\t\treflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64,\n\t\t\treflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64,\n\t\t\treflect.Float32, reflect.Float64:\n\t\t\taddr = unsafe.Pointer(e.UnsafeAddr())\n\t\tdefault:\n\t\t\tpanic(fmt.Errorf(\"unsupported pointer to type %s; must be a slice or pointer to a singular scalar value or the first element of an array or slice\", e.Kind()))\n\t\t}\n\tcase reflect.Uintptr:\n\t\taddr = unsafe.Pointer(v.Pointer())\n\tcase reflect.Slice:\n\t\taddr = unsafe.Pointer(v.Index(0).UnsafeAddr())\n\tdefault:\n\t\tpanic(fmt.Errorf(\"unsupported type %s; must be a slice or pointer to a singular scalar value or the first element of an array or slice\", v.Type()))\n\t}\n\treturn addr\n}", "title": "" }, { "docid": "1e1c5585ea4a4db4739a48c6f5bd5db6", "score": "0.62166554", "text": "func ptrAnalysis(o *Oracle) *pointer.Result {\n\tresult, err := pointer.Analyze(&o.ptaConfig)\n\tif err != nil {\n\t\tpanic(err) // pointer analysis internal error\n\t}\n\treturn result\n}", "title": "" }, { "docid": "6322ba72e2366d7d71c3ec1f95bea42a", "score": "0.6210905", "text": "func (m LicenseType) Pointer() *LicenseType {\n\treturn &m\n}", "title": "" }, { "docid": "c5976105e757674554dff584293cd17d", "score": "0.6199251", "text": "func returnTestPointer(name string) *string {\n\tgreet := \"Hello\" + name\n\treturn &greet\n}", "title": "" }, { "docid": "b932a21c5838e7d96ba59b2b16b41752", "score": "0.6180294", "text": "func Pointer(v time.Time) *time.Time {\n\treturn helpy.Pointer(v)\n}", "title": "" }, { "docid": "294512cc54a6562e39be72c10e9953e2", "score": "0.61705184", "text": "func reachStructThroughPointer(x, y int) {\n\tv := structure(x, y)\n\tp := &v /// This is crap that I cannot get the address of the result of a function call\n\n\tp.X = 1e9\n\tfmt.Println(v)\n}", "title": "" }, { "docid": "0a75f34d7da573e6b49a9b585da20a37", "score": "0.6161864", "text": "func scanForPointers() {\n\treturn //NoOp TODO consider removing function\n}", "title": "" }, { "docid": "b41a9f9be8ad7590a91de5c1c145dea9", "score": "0.6142587", "text": "func (m *M4) Pointer() *float32 { return &(m.X0) }", "title": "" }, { "docid": "5717fce9015da1d4f26df4cf40d9fbc7", "score": "0.61304915", "text": "func Int32Pointer(i int32) *int32 {\n\treturn &i\n}", "title": "" }, { "docid": "ab7766dd8379cdaaa831b226c2410902", "score": "0.61293185", "text": "func main() {\n\tintptr := new(int)\n\t*intptr = 44\n\n\tp := new(struct{ first, last string })\n\t// It is not necessary to write *p.first to access the pointer's field value. We can drop the * and just use p.first\n\tp.first = \"Samuel\"\n\tp.last = \"Pierre\"\n\tfmt.Printf(\"Value %d, type %T\\n\", *intptr, intptr)\n\tfmt.Printf(\"Person %+v\\n\", p)\n}", "title": "" }, { "docid": "f88187ae0c15ddb93ef36cf1652ea1fc", "score": "0.60919225", "text": "func (m SearchView) Pointer() *SearchView {\n\treturn &m\n}", "title": "" }, { "docid": "f76c3df9ec4cbd27ffee5804e3b7afb7", "score": "0.60813326", "text": "func (m BrickTopoOrderByInput) Pointer() *BrickTopoOrderByInput {\n\treturn &m\n}", "title": "" }, { "docid": "90d36196a2d99f3c489ee934cf398472", "score": "0.6074303", "text": "func (p Parameter) Pointer() bool {\n\t// Remove the ... prefix for variadic parameters.\n\ts := strings.TrimPrefix(p.typeName, \"...\")\n\n\treturn strings.HasPrefix(s, \"*\")\n}", "title": "" }, { "docid": "ef73246b25cf049f7fe5eb7d978ca7df", "score": "0.6058254", "text": "func (m *M3) Pointer() *float32 { return &(m.X0) }", "title": "" }, { "docid": "874132dded65ca01e7cc78c8389d5c03", "score": "0.604796", "text": "func doPointerReceivers(){\n\tv := Vertex{2.3, 4.5}\n\tv.Scale(10)\n\tfmt.Println(v)\n\n\tScale(&v, 10)\n\tfmt.Println(v)\n\n\tp := &Vertex{4, 3}\n\tp.Scale(3)\n\tScaleFunc(p, 8)\n\tfmt.Println(p.X, p.Y)\n}", "title": "" }, { "docid": "9cd5fa18eb2c6de50e0cdcbe27ba6bc6", "score": "0.6047769", "text": "func ptr(p interface{}) string {\n\treturn fmt.Sprintf(\"%p\", p)\n}", "title": "" }, { "docid": "2bf7c59248f1a88a1c8c1e9340528026", "score": "0.6042991", "text": "func (obj *Seat) GetPointer() *Pointer {\n\t_ret := &Pointer{}\n\tobj.Conn().NewProxy(0, _ret, obj.Queue())\n\tobj.Conn().SendRequest(obj, 0, _ret)\n\treturn _ret\n}", "title": "" }, { "docid": "1fd2fa01004c0985b88b171cab833802", "score": "0.6042153", "text": "func (m VlanOrderByInput) Pointer() *VlanOrderByInput {\n\treturn &m\n}", "title": "" }, { "docid": "b40926a95846f52e112679b4b2c6a69a", "score": "0.60336816", "text": "func main() {\n\txPtr := new(int)\n\tone(xPtr)\n\tfmt.Println(*xPtr) // x is 1\n}", "title": "" }, { "docid": "1de42b19c9932b9d654cc22673503ef0", "score": "0.60215116", "text": "func Ptr[T any](v T) *T {\n\treturn &v\n}", "title": "" }, { "docid": "1de42b19c9932b9d654cc22673503ef0", "score": "0.60215116", "text": "func Ptr[T any](v T) *T {\n\treturn &v\n}", "title": "" }, { "docid": "a557d9e0131661321d722c18e1107827", "score": "0.60147446", "text": "func (m ServiceItemParamOrigin) Pointer() *ServiceItemParamOrigin {\n\treturn &m\n}", "title": "" }, { "docid": "730e88abdb977f5c49ec4bfc064c0664", "score": "0.60118675", "text": "func (m LabelOrderByInput) Pointer() *LabelOrderByInput {\n\treturn &m\n}", "title": "" }, { "docid": "ad15b3249a9199b060f0c24ed1acfe06", "score": "0.59960306", "text": "func ptr(v interface{}) unsafe.Pointer {\n\n\tif v == nil || reflect.ValueOf(v).IsNil() {\n\t\treturn unsafe.Pointer(nil)\n\t}\n\n\trv := reflect.ValueOf(v)\n\tvar et reflect.Value\n\tswitch rv.Type().Kind() {\n\tcase reflect.Uintptr:\n\t\toffset, _ := v.(uintptr)\n\t\treturn unsafe.Pointer(offset)\n\tcase reflect.Ptr:\n\t\tet = rv.Elem()\n\tcase reflect.Slice:\n\t\tet = rv.Index(0)\n\tdefault:\n\t\tpanic(\"type must be a pointer, a slice, uintptr or nil\")\n\t}\n\n\treturn unsafe.Pointer(et.UnsafeAddr())\n}", "title": "" }, { "docid": "0f5140e687744f01f15ac72b916123b9", "score": "0.59906566", "text": "func (m KlusterPhase) Pointer() *KlusterPhase {\n\treturn &m\n}", "title": "" }, { "docid": "69619c2dee1444e49d257bd412fb0ad3", "score": "0.59895205", "text": "func (m OperatorStatus) Pointer() *OperatorStatus {\n\treturn &m\n}", "title": "" }, { "docid": "b8b3f4656f07f6ebbbff65550f2d2419", "score": "0.5973305", "text": "func unsafeCode(){\n\tvar value int64 = 10\n\tvar pointer1 = &value\n\t// Create a int32 pointer to the int64 variable that the pointer 1 points to\n\tvar pointer2 = (*int32)(unsafe.Pointer(pointer1))\n\n\tfmt.Printf(\"Original Variable: %v %T \\n\", value, value)\n\tfmt.Printf(\"Pointer 1: %v %T Value=%v \\n\", pointer1, pointer1, *pointer1)\n\tfmt.Printf(\"Pointer 2: %v %T Value=%v \\n\", pointer2, pointer2, *pointer2)\n\t*pointer1 = 5434123412312431212\n\tfmt.Printf(\"Change 1 Variable: %v %T \\n\", value, value)\n\tfmt.Printf(\"Pointer 1: %v %T Value=%v \\n\", pointer1, pointer1, *pointer1)\n\tfmt.Printf(\"Pointer 2: %v %T Value=%v \\n\", pointer2, pointer2, *pointer2)\n\t*pointer1 = 10\n\tfmt.Printf(\"Changes 2 Variable: %v %T \\n\", value, value)\n\tfmt.Printf(\"Pointer 1: %v %T Value=%v \\n\", pointer1, pointer1, *pointer1)\n\tfmt.Printf(\"Pointer 2: %v %T Value=%v \\n\", pointer2, pointer2, *pointer2)\n\tfmt.Println()\n\tarr := [...]int{9, 1, -2, 3, 4}\n\tvar arr_pointer *int = &arr[0]\n\tfmt.Printf(\"Arr Pointer %v %T value=%v \\n\",arr_pointer, arr_pointer, *arr_pointer )\n\tmemoryAddress := uintptr(unsafe.Pointer(arr_pointer)) + unsafe.Sizeof(arr[0])\n\tfmt.Printf(\"mem addr %v %T \\n\\n\",memoryAddress, memoryAddress)\n\tfor i:=0; i<len(arr); i++ {\n\t\tarr_pointer = (*int)(unsafe.Pointer(memoryAddress))\n\t\tfmt.Printf(\"Arr Pointer %v %T value=%v \\n\",arr_pointer, arr_pointer, *arr_pointer )\n\t\tmemoryAddress = uintptr(unsafe.Pointer(arr_pointer)) + unsafe.Sizeof(arr[0])\n\t\tfmt.Printf(\"mem addr %v %T \\n\",memoryAddress, memoryAddress)\n\t}\n\tfmt.Println(\"One more\")\n\tmemoryAddress = uintptr(unsafe.Pointer(arr_pointer)) + unsafe.Sizeof(arr[0])\n\tarr_pointer = (*int)(unsafe.Pointer(memoryAddress))\n\tfmt.Printf(\"Arr Pointer %v %T value=%v \\n\",arr_pointer, arr_pointer, *arr_pointer )\n\tfmt.Printf(\"mem addr %v %T \\n\",memoryAddress, memoryAddress)\n\tfmt.Println()\n\n}", "title": "" }, { "docid": "afcdbbafcb5eeb8cd12c3a74d8b3f144", "score": "0.59622616", "text": "func Int64Pointer(i int64) *int64 {\n\treturn &i\n}", "title": "" }, { "docid": "c96a414c9d24f9780610ed0c4bb7255b", "score": "0.5953451", "text": "func EmptyPointer() *int {\n\tpanic(\"please implement the EmptyPointer function\")\n}", "title": "" }, { "docid": "3f2d6f5b496bb136bb1220ef6b4fd933", "score": "0.5939068", "text": "func toStringPointer(s string) *string {\n\treturn &s\n}", "title": "" }, { "docid": "60703539c6ab8ce71542074dc5953fa1", "score": "0.5918253", "text": "func IntPtr(v int) *int { return &v }", "title": "" }, { "docid": "3f5937b70ec97df2712905d5c72ba761", "score": "0.5903228", "text": "func (m ClusterTopoOrderByInput) Pointer() *ClusterTopoOrderByInput {\n\treturn &m\n}", "title": "" }, { "docid": "6316b93abbe4c28a3594cbff3f1b945b", "score": "0.59005356", "text": "func intPtr(i int) *int {\n\treturn &i\n}", "title": "" }, { "docid": "7f904ab8289b71888dda652a666fedbf", "score": "0.58879226", "text": "func (self *InputHandler) PointerX1O(pointerId int) int{\n return self.Object.Call(\"pointerX\", pointerId).Int()\n}", "title": "" }, { "docid": "5296d831fa6e9966ce6886f840ea43fa", "score": "0.5877951", "text": "func MethodsAndPointerIndirection() {\n\tfmt.Printf(\"****Running methods.MethodsAndPointerIndirection(), methods and pointer indirection \\n\")\n\tv := vertex3{3, 4}\n\tv.Scale(2)\n\tscaleFunc(&v, 10)\n\n\tp := &vertex3{4, 3}\n\tp.Scale(3)\n\tscaleFunc(p, 8)\n\n\tfmt.Println(v, p)\n\n}", "title": "" }, { "docid": "31661eca61c23c424056e2c9ef2be9aa", "score": "0.58736765", "text": "func (m NtpMode) Pointer() *NtpMode {\n\treturn &m\n}", "title": "" }, { "docid": "f7b9cc70df83bc813e9e03537f02bb74", "score": "0.5858709", "text": "func (v Operator) Ptr() *Operator {\n\treturn &v\n}", "title": "" }, { "docid": "d89a7a731df7379e046774402e8480f0", "score": "0.5852608", "text": "func (m ContentLibraryImageOrderByInput) Pointer() *ContentLibraryImageOrderByInput {\n\treturn &m\n}", "title": "" }, { "docid": "d3ee569877bde0ac844fc3966506cfa5", "score": "0.58514655", "text": "func valIsPointer(v interface{}) bool {\n\tswitch v.(type) {\n\tcase *ssa.Alloc, *ssa.FieldAddr, *ssa.Global, *ssa.IndexAddr:\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "e90223fa2c05cfe7f5ed9418f8dbd6a5", "score": "0.58271676", "text": "func (g *Getter) UnsafePointer(name string) (unsafe.Pointer, bool) {\n\tv, has := g.Get(name)\n\tif !has {\n\t\treturn nil, has\n\t}\n\n\tres, ok := v.(unsafe.Pointer)\n\treturn res, ok\n}", "title": "" }, { "docid": "e324bfb99e96304f0dbb9a9c439181cb", "score": "0.58151835", "text": "func (v Source) Ptr() *Source {\n\treturn &v\n}", "title": "" }, { "docid": "c1dc66816622217c99839b6df9e01c7a", "score": "0.5812261", "text": "func TestIllegalUseA(t *testing.T) {\n\tfmt.Println(\"===================== illegalUseA\")\n\n\tpa := new([4]int)\n\t//paf:=&([4]int)\n\n\t// split the legal use\n\t// p1 := unsafe.Pointer(uintptr(unsafe.Pointer(pa)) + unsafe.Sizeof(pa[0]))\n\t// into two expressions (illegal use):\n\n\t//不非法\n\t//ptr := unsafe.Pointer(pa)\n\t//p1 := unsafe.Pointer(uintptr(ptr) + unsafe.Sizeof(pa[0]))\n\n\tptr := uintptr(unsafe.Pointer(pa))\n\tp1 := unsafe.Pointer(ptr + unsafe.Sizeof(pa[0]))\n\n\t// \"go vet\" will make a warning for the above line:\n\t// possible misuse of unsafe.Pointer\n\n\t// the unsafe package docs, https://golang.org/pkg/unsafe/#Pointer,\n\t// thinks above splitting is illegal.\n\t// but the current Go compiler and runtime (1.7.3) can't detect\n\t// this illegal use.\n\t// however, to make your program run well for later Go versions,\n\t// it is best to comply with the unsafe package docs.\n\n\t*(*int)(p1) = 123\n\tfmt.Println(\"*(*int)(p1) :\", *(*int)(p1)) //\n}", "title": "" }, { "docid": "cd2a3f985a330813631d58a1d5805d61", "score": "0.5812251", "text": "func StringPointer(s string) *string {\n\treturn &s\n}", "title": "" }, { "docid": "cd2a3f985a330813631d58a1d5805d61", "score": "0.5812251", "text": "func StringPointer(s string) *string {\n\treturn &s\n}", "title": "" }, { "docid": "cd2a3f985a330813631d58a1d5805d61", "score": "0.5812251", "text": "func StringPointer(s string) *string {\n\treturn &s\n}", "title": "" }, { "docid": "978d94a9c190e3d8b76ef0a1bafe6dd7", "score": "0.5807918", "text": "func MethodsAndPointerIndirection2() {\n\tfmt.Printf(\"****Running methods.MethodsAndPointerIndirection2(), methods and pointer reverse indirection \\n\")\n\tv := vertex3{3, 4}\n\tfmt.Println(v.Abs())\n\tfmt.Println(absFunc(v))\n\n\tp := &vertex3{4, 3}\n\tfmt.Println(p.abs())\n\tfmt.Println(absFunc(*p))\n\n}", "title": "" }, { "docid": "502bda004e3f634e0d60c9e431083b71", "score": "0.5800417", "text": "func (object *Object) IsPointer() bool {\n\treturn object.isPointer\n}", "title": "" }, { "docid": "44068fe29f0d3b3a6e0a5ba4ee26fa0c", "score": "0.5800189", "text": "func Ptr(v interface{}) unsafe.Pointer {\n\n\tif v == nil {\n\t\treturn unsafe.Pointer(nil)\n\t}\n\n\trv := reflect.ValueOf(v)\n\tvar et reflect.Value\n\tswitch rv.Type().Kind() {\n\tcase reflect.Uintptr:\n\t\toffset, _ := v.(uintptr)\n\t\treturn unsafe.Pointer(offset)\n\tcase reflect.Ptr:\n\t\tif rv.IsNil() {\n\t\t\treturn unsafe.Pointer(nil)\n\t\t}\n\t\tet = rv.Elem()\n\tcase reflect.Slice:\n\t\tif rv.IsNil() || rv.Len() == 0 {\n\t\t\treturn unsafe.Pointer(nil)\n\t\t}\n\t\tet = rv.Index(0)\n\tdefault:\n\t\tpanic(\"type must be a pointer, a slice, uintptr or nil\")\n\t}\n\n\treturn unsafe.Pointer(et.UnsafeAddr())\n}", "title": "" }, { "docid": "24342af653bf86cf801a43c888dbb54b", "score": "0.5781531", "text": "func Pointer(object string) types.Option {\n\treturn func(g *types.Cmd) {\n\t\tg.AddOptions(\"pointer\")\n\n\t\tif object != \"\" {\n\t\t\tg.AddOptions(object)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0d0a78f12604d3cc4ca247c137aff466", "score": "0.5780232", "text": "func MethodsWithPointerReceiver2() {\n\tfmt.Printf(\"****Running methods.MethodsWithPointerReceiver2(), methods with pointer receiver \\n\")\n\tv := vertex3{3, 4}\n\tscale(&v, 10)\n\tfmt.Println(abs4(v))\n}", "title": "" }, { "docid": "10b2c598e7d67175e92313b0076eb5dd", "score": "0.5768339", "text": "func (m ApplicationVMSpecPlacementVerb) Pointer() *ApplicationVMSpecPlacementVerb {\n\treturn &m\n}", "title": "" }, { "docid": "a4416f02f59d651b7dc708956ba0f9e1", "score": "0.57681894", "text": "func (self *PhysicsArcade) DistanceToPointer1O(displayObject interface{}, pointer *Pointer) int{\n return self.Object.Call(\"distanceToPointer\", displayObject, pointer).Int()\n}", "title": "" }, { "docid": "d9f93c9b3ca463d06531bac1dccf3267", "score": "0.5767222", "text": "func GetPointer(v interface{}) interface{} {\n\tt := reflect.TypeOf(v)\n\tif t.Kind() == reflect.Ptr {\n\t\tif tt := t.Elem(); tt.Kind() == reflect.Ptr { // pointer of pointer\n\t\t\tif tt.Elem().Kind() == reflect.Ptr {\n\t\t\t\tpanic(\"pointer of pointer of pointer is not supported\")\n\t\t\t}\n\t\t\tel := reflect.ValueOf(v).Elem()\n\t\t\tif el.IsZero() {\n\t\t\t\tvv := reflect.New(tt.Elem())\n\t\t\t\tel.Set(vv)\n\t\t\t\treturn vv.Interface()\n\t\t\t} else {\n\t\t\t\treturn el.Interface()\n\t\t\t}\n\t\t} else {\n\t\t\tif reflect.ValueOf(v).IsZero() {\n\t\t\t\tvv := reflect.New(t.Elem())\n\t\t\t\treturn vv.Interface()\n\t\t\t}\n\t\t\treturn v\n\t\t}\n\t}\n\treturn reflect.New(t).Interface()\n}", "title": "" }, { "docid": "36a1fede17ae75b7608936d5636a631b", "score": "0.57640123", "text": "func (self *InputHandler) PointerY1O(pointerId int) int{\n return self.Object.Call(\"pointerY\", pointerId).Int()\n}", "title": "" }, { "docid": "56215cee65bfac554f397a9a216f1a1d", "score": "0.5757295", "text": "func (WlPointer) Descriptor() *InterfaceDescriptor {\n\treturn &WlPointerDescriptor\n}", "title": "" }, { "docid": "4e5f092df28bed599eb9d7f3f55175bf", "score": "0.5752494", "text": "func (q *pointerQueue) pointerOf(e pointer.Event) int {\n\tfor i, p := range q.pointers {\n\t\tif p.id == e.PointerID {\n\t\t\treturn i\n\t\t}\n\t}\n\tq.pointers = append(q.pointers, pointerInfo{id: e.PointerID})\n\treturn len(q.pointers) - 1\n}", "title": "" }, { "docid": "4e5f092df28bed599eb9d7f3f55175bf", "score": "0.5752494", "text": "func (q *pointerQueue) pointerOf(e pointer.Event) int {\n\tfor i, p := range q.pointers {\n\t\tif p.id == e.PointerID {\n\t\t\treturn i\n\t\t}\n\t}\n\tq.pointers = append(q.pointers, pointerInfo{id: e.PointerID})\n\treturn len(q.pointers) - 1\n}", "title": "" }, { "docid": "33c50188c62f1c58765d9fcdcceeb7b6", "score": "0.5752119", "text": "func (m TaskOrderByInput) Pointer() *TaskOrderByInput {\n\treturn &m\n}", "title": "" } ]
5382eb70104906391ce1581f1e8cb7b7
sendGetRequest sends an http GET request through Gateway.
[ { "docid": "ca8fb0b3ec224800b2edca9fe77c7d1f", "score": "0.7444353", "text": "func sendGetRequest(id string) (*gateway.Status, error) {\n\tvar u url.URL\n\tu.Scheme = \"HTTP\"\n\tu.Host = fmt.Sprintf(\"localhost:%d\", gwSrv.Port())\n\n\tgwHttpClient.URL = u\n\treturn gwHttpClient.Connect().CheckZombieStatus(id)\n}", "title": "" } ]
[ { "docid": "804931324163d63369bce05934f2e22b", "score": "0.6796903", "text": "func SendGetRequest(url string) (responseBody []byte) {\n\n\t// get request\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\tcheck.Panic(\"cannot send GET request: %v\\n\", err)\n\t}\n\tdefer resp.Body.Close()\n\n\t// check status\n\tif resp.StatusCode != http.StatusOK {\n\t\tcheck.Panic(\"unexpected http status code: %d\\n\", resp.StatusCode)\n\t}\n\n\t// extract response's body\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tcheck.Panic(\"cannot read response body: %v\\n\", err)\n\t}\n\treturn body\n}", "title": "" }, { "docid": "375a9366d7e30cad3c14dda0fdc88a0c", "score": "0.6735011", "text": "func GetRequest(url string, headers ...string) (*http.Response, error) {\n\treturn SendRequest(url, \"GET\", \"\", headers...)\n}", "title": "" }, { "docid": "f156a72047ffd7b9ebb67455a3954d77", "score": "0.67089033", "text": "func SendGetRequest(url string) (*Response, error) {\n\treturn NewGetRequest(url).Send()\n}", "title": "" }, { "docid": "b17f662108c2b09831d28ee4c51980f1", "score": "0.66132945", "text": "func (c *Client) SendGet(url string, form url.Values, callback rest.ResponseHandler) {\n\tvar body io.Reader\n\tif form != nil {\n\t\tbody = strings.NewReader(form.Encode())\n\t} else {\n\t\tbody = nil\n\t}\n\tc.sendRequest(\"GET\", url, body, callback)\n}", "title": "" }, { "docid": "b17f662108c2b09831d28ee4c51980f1", "score": "0.66132945", "text": "func (c *Client) SendGet(url string, form url.Values, callback rest.ResponseHandler) {\n\tvar body io.Reader\n\tif form != nil {\n\t\tbody = strings.NewReader(form.Encode())\n\t} else {\n\t\tbody = nil\n\t}\n\tc.sendRequest(\"GET\", url, body, callback)\n}", "title": "" }, { "docid": "cb5a94c9555ea46f1d7eabb9093044de", "score": "0.6432413", "text": "func (g GetRequest) Send(w *Client) (body []byte, err error) {\n\tif w.initialized == false {\n\t\treturn nil, fmt.Errorf(\"Please initialize with your credentials first. Client.Init()\")\n\t}\n\n\t//resp, err := w.client.Get(g.Endpoint, g.Params)\n\tresp, err := w.request(\"GET\", g.Endpoint, g.Params, nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%v - %s\", g.Endpoint, err)\n\t}\n\tdefer resp.Close()\n\n\tbody, err = ioutil.ReadAll(resp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = checkResult(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn body, nil\n}", "title": "" }, { "docid": "5c5dd3b36054b796a2a31bb5d8047a0d", "score": "0.62158775", "text": "func (c *ClockifyHTTPClient) GetRequest(endpoint string) (*json.RawMessage, error) {\n\treturn request(c, \"GET\", endpoint, nil)\n}", "title": "" }, { "docid": "8be5e869a0c2c08e196bf788eddc1e6f", "score": "0.6201148", "text": "func (r *rrffm) doGetRequest(url string) ([]byte, *time.Duration, error) {\n\tif r.debug {\n\t\tlog.Printf(\"Doing GET request to %s\", url)\n\t}\n\tstart := time.Now()\n\n\treq, err := http.NewRequest(http.MethodGet, url, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tif r.debug {\n\t\tdump, _ := httputil.DumpRequestOut(req, false)\n\t\tlog.Println(string(dump))\n\t}\n\n\tresp, err := r.httpClient.Do(req)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tduration := time.Since(start)\n\tif r.debug {\n\t\tlog.Printf(\"Received response\\n%s\", string(body))\n\t}\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\treturn body, &duration, nil\n}", "title": "" }, { "docid": "9b6b986c8a323e9f4c4485aab6b9234d", "score": "0.6160216", "text": "func TestGetRequest(t *testing.T) {\n\tt.Log(\"Sending GET request... (expected http code: 200)\")\n\n\treq := NewRequest()\n\n\tresp, err := req.Query(map[string]string{\"q\": \"hello\"}).Get(\"http://httpbin.org/get\")\n\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\tif resp.GetStatusCode() != 200 {\n\t\tt.Error(\n\t\t\t\"For\", \"GET http://httpbin.org/get\",\n\t\t\t\"expected\", 200,\n\t\t\t\"got\", resp.GetStatusCode(),\n\t\t)\n\t}\n}", "title": "" }, { "docid": "dac85d1faa6ff1d33c1bd1e30b4a3b63", "score": "0.61343247", "text": "func (c *Client) getRequest(requestURL string) (response StandardResponse, err error) {\r\n\t// Set the user agent\r\n\treq := c.httpClient.R().SetHeader(\"User-Agent\", c.options.userAgent)\r\n\r\n\t// Enable tracing\r\n\tif c.options.requestTracing {\r\n\t\treq.EnableTrace()\r\n\t}\r\n\r\n\t// Fire the request\r\n\tvar resp *resty.Response\r\n\tif resp, err = req.Get(requestURL); err != nil {\r\n\t\treturn\r\n\t}\r\n\r\n\t// Tracing enabled?\r\n\tif c.options.requestTracing {\r\n\t\tresponse.Tracing = resp.Request.TraceInfo()\r\n\t}\r\n\r\n\t// Set the status code\r\n\tresponse.StatusCode = resp.StatusCode()\r\n\r\n\t// Set the body\r\n\tresponse.Body = resp.Body()\r\n\treturn\r\n}", "title": "" }, { "docid": "e05c94c5450af1dca08585a76e6604d2", "score": "0.6122109", "text": "func getRequest(t *testing.T, route string) *http.Response {\n\treq, err := http.NewRequest(\"GET\", endpoint+route, nil)\n\tassert.Nil(t, err)\n\tres, err := http.DefaultClient.Do(req)\n\tassert.Nil(t, err)\n\treturn res\n}", "title": "" }, { "docid": "e1f213d308c502f51ee9451712d09bdc", "score": "0.60258913", "text": "func (h *HTTPSend) Get() (*http.Response, error) {\n\treturn h.send(\"GET\")\n}", "title": "" }, { "docid": "243819ee48952f836e310c0f93592263", "score": "0.60058105", "text": "func (b *Binance) SendHTTPRequest(path string, result interface{}) error {\n\treturn b.SendPayload(http.MethodGet, path, nil, nil, result, false, false, b.Verbose, b.HTTPDebugging)\n}", "title": "" }, { "docid": "bad84938c767c9bee1f015d278dd1cdb", "score": "0.5985885", "text": "func sendRequest(url string) (string, int) {\n\n\tclient := &http.Client{\n\t\tTransport: ntlmssp.Negotiator{\n\t\t\tRoundTripper: &http.Transport{},\n\t\t},\n\t}\n\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\treq.SetBasicAuth(\"skedular\", \"chickenfarm\")\n\treq.Header.Set(\"X-AUTH\", \"!te5D?DI<c0#t=2nZir0_eC4.(`i1>p/xEj[Qk_v10dF|G~*{zvwcwTw+`MS&o)M\")\n\tres, err := client.Do(req)\n\tif err != nil {\n\t\treturn \"\", 500\n\t}\n\n\tdefer res.Body.Close()\n\tbytes, _ := ioutil.ReadAll(res.Body)\n\n\t// Parse and read the request\n\tvalue := gjson.Get(string(bytes), \"events\")\n\treturn value.String(), 200\n}", "title": "" }, { "docid": "7bbd6ccb7358b201193f0cba431a333f", "score": "0.59516597", "text": "func SendGetChain(address string) {\n\tfmt.Printf(\"Sending getchain to %s.\\n\", address)\n\n\tdata := GetChain{nodeAddress}\n\tpayload := GobEncode(data)\n\trequest := append(CmdToBytes(\"getchain\"), payload...)\n\n\tSendData(address, request)\n}", "title": "" }, { "docid": "630690e3011315d72fdedc98950b3324", "score": "0.5949444", "text": "func GetRequest(url string, httpChan chan *Response) {\n\t//init client for max timeout of max Response time\n\tvar client = &http.Client{Timeout: maxResponseTime}\n\tr, err := client.Get(url)\n\t//close request after all ops\n\t//create new instance of Response type\n\tvar target = new(Response)\n\tif err != nil {\n\t\t//timeout error or network error\n\t\tfmt.Println(err.Error())\n\t\thttpChan <- target\n\t\treturn\n\t}\n\tdefer r.Body.Close()\n\tif r.StatusCode == http.StatusServiceUnavailable {\n\t\t//pass empty target\n\t\thttpChan <- target\n\t\tfmt.Println(\"service unavailable error\")\n\t\treturn\n\t}\n\tif r.StatusCode != http.StatusOK {\n\t\t//pass empty target\n\t\thttpChan <- target\n\t\tfmt.Println(\"unknown error\")\n\t\treturn\n\t}\n\terr = json.NewDecoder(r.Body).Decode(target)\n\thttpChan <- target\n}", "title": "" }, { "docid": "9ac6c04514888b4f92c82a01d3bdb0b1", "score": "0.5927062", "text": "func (pw *ProtoWs) RequestGet(ws *websocket.Conn) error {\n\tvar err error\n\n\t// send GET request\n\treq := \"GET /stream HTTP/1.1\\r\\n\"\n\treq += fmt.Sprintf(\"%s: %s\\r\\n\", sb.STR_HDR_USER_AGENT, STR_WS_PLAYER)\n\treq += \"\\r\\n\"\n\n\terr = websocket.Message.Send(ws, req)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn err\n\t}\n\n\tlog.Printf(\"SEND [%d]\\n%s\", len(req), color.GreenString(req))\n\n\t// recv response\n\terr = pw.ReadResponse(ws)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn err\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "8613292e7d5155d5c72466cba069a78b", "score": "0.5905001", "text": "func (conn SplunkConnection) HTTPGetRequest(URL string, data *url.Values) (response *http.Response, err error) {\n\tvar req *http.Request\n\n\t// setting client to do a request\n\tc := HTTPClient()\n\n\t// creating request with url values if not null\n\tif data != nil {\n\t\treq, err = http.NewRequest(\"GET\", URL, strings.NewReader(data.Encode()))\n\t\treq.URL.RawQuery = data.Encode()\n\t} else {\n\t\treq, err = http.NewRequest(\"GET\", URL, nil)\n\t}\n\n\tif err != nil {\n\t\treturn &http.Response{}, err\n\t}\n\n\t// setting authentication of request\n\treq.SetBasicAuth(conn.Username, conn.Password)\n\n\t// sending request and checking if have error\n\tresp, err := c.Do(req)\n\tif err != nil {\n\t\treturn &http.Response{}, err\n\t}\n\n\t// returning response\n\treturn resp, nil\n}", "title": "" }, { "docid": "2aed0981ddf1912c61cbe237954310e4", "score": "0.5884629", "text": "func (r GetGatewayRequest) Send(ctx context.Context) (*GetGatewayResponse, error) {\n\tr.Request.SetContext(ctx)\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := &GetGatewayResponse{\n\t\tGetGatewayOutput: r.Request.Data.(*GetGatewayOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "c58cfa313ca20dc80eb88290bfdadc55", "score": "0.5881207", "text": "func (hc *httpClient) DoGet(builder *builder.Builder, params builder.Params) ([]byte, error) {\n form, _ := hc.messageToForm(builder)\n \n req, err := http.NewRequest(\"GET\", fmt.Sprintf(\"%s?%s\", hc.baseHost(params.MiEnv)+params.MiUrl, form.Encode()), nil)\n \n if err != nil {\n return nil, err\n }\n \n req.Header.Set(\"Content-Type\", \"application/x-www-form-urlencoded;charset=UTF-8\")\n req.Header.Set(\"Authorization\", fmt.Sprintf(\"key=%s\", params.AppSecret))\n \n var client = &http.Client{\n Timeout: 5 * time.Second,\n }\n \n res, err := client.Do(req)\n body, err := ioutil.ReadAll(res.Body)\n res.Body.Close()\n \n return body, nil\n}", "title": "" }, { "docid": "338bd2e13280e99cf63c7148aca61464", "score": "0.5872912", "text": "func HTTPGetRequest(request string) string {\n\tresp, err := http.Get(request)\n\tif err != nil {\n\t\tZlog.Fatalf(\"HTTP GET Error %s\", err.Error())\n\t\treturn \"\"\n\t}\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tZlog.Fatalf(\"HTTP GET response read Error %s\", err.Error())\n\t}\n\treturn (string(body))\n}", "title": "" }, { "docid": "c3c8b91b569d2e8e38fd328523dd7815", "score": "0.5853987", "text": "func MakeGetRequest(data []byte) *http.Request {\n\tbody := ioutil.NopCloser(bytes.NewReader(data))\n\treq, _ := http.NewRequest(\"GET\", \"/testing-path\", body)\n\treturn req\n}", "title": "" }, { "docid": "3a3c59b0d8412b404c5386e9895006d3", "score": "0.58378506", "text": "func GetRequest(headers map[string]string, url string) ([]byte, int, error) {\n\ttr := &http.Transport{\n\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: true},\n\t}\n\tclient := &http.Client{Transport: tr, Timeout: 5 * time.Second}\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\tfor key, value := range headers {\n\t\treq.Header.Add(key, value)\n\t}\n\n\tres, err := client.Do(req)\n\n\tif err != nil {\n\t\treturn nil, 500, err\n\t}\n\n\tbody, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\treturn nil, res.StatusCode, err\n\t}\n\tdefer res.Body.Close()\n\n\treturn body, res.StatusCode, nil\n}", "title": "" }, { "docid": "74c0ddf4f287d9689af9b1fbed7251d7", "score": "0.5823592", "text": "func handleGetRequest(w http.ResponseWriter, e *Endpoint, r *http.Request, h *func(q *QueryOptions) (interface{}, error), statusCode int) {\n\tqueryOptions, err := getQueryOptions(r)\n\tif err != nil {\n\t\tsendError(w, http.StatusBadRequest, err)\n\t\treturn\n\t}\n\n\t_, errors := e.AreQueryOptionsSupported(queryOptions)\n\tif errors != nil {\n\t\tsendError(w, http.StatusBadRequest, errors)\n\t\treturn\n\t}\n\n\thandler := *h\n\tdata, err2 := handler(queryOptions)\n\tif err2 != nil {\n\t\tsendError(w, http.StatusInternalServerError, errors)\n\t\treturn\n\t}\n\n\tsendJSONResponse(w, statusCode, data)\n}", "title": "" }, { "docid": "0e0837daa5f44ad894d7239343dd02da", "score": "0.58115804", "text": "func HandleGetRequest(url string) Response {\n\t// Time init\n\tstart := time.Now().UnixNano()\n\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\t// Prone to alerting, printing for now\n\t\tfmt.Println(err)\n\t}\n\tresLength := resp.ContentLength\n\tdefer resp.Body.Close()\n\n\tend := time.Now().UnixNano()\n\tdiff := int((end - start) / int64(time.Millisecond))\n\n\treturn Response{delay: diff, resLength: resLength}\n}", "title": "" }, { "docid": "8302df521a1179a8a059aa803f4e03a2", "score": "0.58111525", "text": "func SimpleHttpGet(sendURL string, params map[string][]string) ([]byte, error) {\n\tvar urlU *url.URL\n\tvar err error\n\turlU, err = url.Parse(sendURL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar urlParams url.Values = params\n\t//If the parameter has Chinese parameters, this method will be URLEncode.\n\turlU.RawQuery = urlParams.Encode()\n\tresp, err := http.Get(urlU.String())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tres,err := ioutil.ReadAll(resp.Body)\n\tif err != nil{\n\t\treturn res,err\n\t}\n\terr = resp.Body.Close()\n\tif err != nil{\n\t\treturn res,err\n\t}\n\treturn res,err\n}", "title": "" }, { "docid": "e106e7af0eaff2765411d759bc3d2990", "score": "0.58086467", "text": "func GetRequest(L *glua.LState) int {\n\t// Get url\n\turl := L.Get(2)\n\n\t// Check valid url\n\tif url.Type() != glua.LTString {\n\t\tL.ArgError(1, \"Invalid url type. Expected string\")\n\t\treturn 0\n\t}\n\n\t// Make get request\n\tresp, err := http.Get(url.String())\n\n\tif err != nil {\n\t\tL.RaiseError(\"Cannot perform get request: %v\", err)\n\t\treturn 0\n\t}\n\n\t// Close response body\n\tdefer resp.Body.Close()\n\n\t// Read from response\n\tbuff, err := ioutil.ReadAll(resp.Body)\n\n\tif err != nil {\n\t\tL.RaiseError(\"Cannot read response body: %v\", err)\n\t\treturn 0\n\t}\n\n\t// Push response\n\tL.Push(glua.LString(string(buff)))\n\n\treturn 1\n}", "title": "" }, { "docid": "cca86d54763478ca497d46235dd4b44c", "score": "0.57930875", "text": "func (cli *OpsGenieClient) buildGetRequest(uri string, request interface{}) goreq.Request {\n\treq := cli.buildCommonRequestProps()\n\treq.Method = \"GET\"\n\treq.ContentType = \"application/x-www-form-urlencoded; charset=UTF-8\"\n\turi = cli.OpsGenieAPIUrl() + uri\n\tif request != nil {\n\t\tv, _ := goquery.Values(request)\n\t\treq.Uri = uri + \"?\" + v.Encode()\n\t} else {\n\t\treq.Uri = uri\n\t}\n\n\tlogging.Logger().Info(\"Executing OpsGenie request to [\" + uri + \"] with parameters: \")\n\treturn req\n}", "title": "" }, { "docid": "d2d685449b6ae3f03692ad0c27358ad2", "score": "0.57843655", "text": "func (e *Expect) GET(url string, args ...interface{}) *Request {\n\treturn e.Request(\"GET\", url, args...)\n}", "title": "" }, { "docid": "46d68b481a0649f9a365d45b2f76d125", "score": "0.57690126", "text": "func GetRequest(url string) ([]byte, int, error) {\n\n\tclient := http.Client{Timeout: 180 * time.Second}\n\treq, err := http.NewRequest(http.MethodGet, url, nil)\n\tif err != nil {\n\t\treturn nil, -1, err\n\t}\n\tctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)\n\tdefer cancel()\n\n\treqWithDeadline := req.WithContext(ctx)\n\tresponse, err := client.Do(reqWithDeadline)\n\tif err != nil {\n\t\treturn nil, -1, err\n\t}\n\n\tdata, err := ioutil.ReadAll(response.Body)\n\n\treturn data, response.StatusCode, err\n\n}", "title": "" }, { "docid": "ee52f6c9dac872cc173f857e9acf0f34", "score": "0.57490516", "text": "func PerformWebRequestGet(handler http.Handler, path string) *httptest.ResponseRecorder {\n\treturn PerformWebRequest(handler, \"GET\", path, nil)\n}", "title": "" }, { "docid": "023216097b3887e6335b479082f47fd9", "score": "0.5713056", "text": "func (ic *Intercom) sendRequest(method, url string, queryParams interface{}, payload map[string]interface{}) (data []byte, err error) {\n\n\tclient := http.Client{}\n\n\tvar req *http.Request\n\tvar resp *http.Response\n\n\tif payload != nil {\n\t\t// With JSON payload\n\t\tvar buf bytes.Buffer\n\n\t\tif err = json.NewEncoder(&buf).Encode(payload); err != nil {\n\t\t\treturn\n\t\t}\n\n\t\tif req, err = http.NewRequest(method, url, &buf); err != nil {\n\t\t\treturn\n\t\t}\n\n\t\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\t} else {\n\t\t// Without JSON payload\n\t\tif req, err = http.NewRequest(method, url, nil); err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\n\treq.SetBasicAuth(ic.AccountKey, \"\")\n\treq.Header.Set(\"Accept\", \"application/json\")\n\n\t// Optional query parameters\n\tif queryParams != nil {\n\t\tic.addQueryParams(req, queryParams)\n\t}\n\n\t//fmt.Println(req.Method, req.URL, req.Body, req.ContentLength)\n\n\t// Send request\n\tif resp, err = client.Do(req); err != nil {\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\n\t// Read response\n\tvar err2 error\n\tdata, err2 = ioutil.ReadAll(resp.Body)\n\tif err2 != nil {\n\t\treturn data, err2\n\t}\n\n\t// Error returned?\n\tif resp.StatusCode >= 400 {\n\t\ts := string(data)\n\t\terr = errors.New(s)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "8a89744e2554fe3fa08848372d8b40b6", "score": "0.5699632", "text": "func GetTransferRequest(ctx context.Context, w http.ResponseWriter, r *http.Request) {\n\tres := MessageResponse{Data: StatusMessage{Message: \"get transfer request\"}}\n\tjson.NewEncoder(w).Encode(res)\n}", "title": "" }, { "docid": "51a04515efd7bd1551e21ad79bfe0dad", "score": "0.5689393", "text": "func SendGetRequestWithAuth(url, token string) (responseBody []byte) {\n\n\t// set request\n\trequest, err := http.NewRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\tcheck.Panic(\"cannot create request: %v\\n\", err)\n\t}\n\n\t// set header\n\trequest.Header.Set(\"Authorization\", \"Bearer \"+token)\n\n\t// post request\n\tclient := new(http.Client)\n\tresp, err := client.Do(request)\n\tif err != nil {\n\t\tcheck.Panic(\"cannot send GET request: %v\\n\", err)\n\t}\n\tdefer resp.Body.Close()\n\n\t// check status\n\tif resp.StatusCode != http.StatusOK {\n\t\tcheck.Panic(\"unexpected http status code: %d\\n\", resp.StatusCode)\n\t}\n\n\t// extract response's body\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tcheck.Panic(\"cannot read response body: %v\\n\", err)\n\t}\n\treturn body\n}", "title": "" }, { "docid": "4ea72bbace70174456d50682a7962b35", "score": "0.565676", "text": "func (c *Conn) get(path, params string) (*http.Response, error) {\n\treq := c.newRequest(http.MethodGet, path, params, nil)\n\treturn c.do(req)\n}", "title": "" }, { "docid": "53fd4aa235a46443e03eabb4d8318c66", "score": "0.5637902", "text": "func (c Client) Get(url string) []byte {\n\treturn c.sendRequest(\"GET\", url, nil, \"\")\n}", "title": "" }, { "docid": "68a4b35bc77a4ae0c343fd8596ef585c", "score": "0.5637624", "text": "func SendRequest(method string, url string, headers map[string]string, body interface{}) ([]byte, http.Header, int, error) {\n\n\treturn send(method, url, headers, body, false, nil, \"\", \"\")\n}", "title": "" }, { "docid": "c4ca09be0c85cd45b5da360e0cde7679", "score": "0.56326914", "text": "func GetRequest(address string) (*HTTPRequest, error) {\n\treturn NewRequest(http.MethodGet, address, nil)\n}", "title": "" }, { "docid": "b4e1ebea70e2f40accff7a89bcf0d303", "score": "0.56212205", "text": "func (bot *Bot) SendRequest(method string, arguments map[string]string) (answer []byte, err error) {\r\n\taddress := fmt.Sprintf(\"https://api.vk.com/method/%s?access_token=%s&v=%s\", method, bot.accessToken, bot.apiVer)\r\n\tfor key, value := range arguments { //TODO without sprintf. Only stream\r\n\t\taddress = fmt.Sprintf(\"%s&%s=%s\", address, key, url.QueryEscape(value))\r\n\t}\r\n\tfmt.Println(address)\r\n\tans, err := http.Get(address)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\t//var result interface{}\r\n\tvar bodybytes bytes.Buffer\r\n\tio.Copy(&bodybytes, ans.Body)\r\n\r\n\treturn bodybytes.Bytes(), nil\r\n}", "title": "" }, { "docid": "277781edb2d5f83b284334cb80e73383", "score": "0.5612957", "text": "func (c Client) get(url string) ([]byte, error) {\n\treq, _ := http.NewRequest(http.MethodGet, url, nil)\n\treturn c.processRequest(req)\n}", "title": "" }, { "docid": "23f773041a21ac19d306d0a70101250d", "score": "0.56125903", "text": "func getRequest(url string) (*http.Response, error) {\n\n\tclient := http.Client{\n\t\tTimeout: time.Second * 300,\n\t}\n\n\treq, err := http.NewRequest(http.MethodGet, url, nil)\n\tif err != nil {\n\t\tlog.WithError(err).Error(\"Error in GET request\")\n\t\treturn nil, err\n\t}\n\n\tres, getErr := client.Do(req)\n\tif getErr != nil {\n\t\tlog.WithError(err).Error(\"Error in GET request\")\n\t\treturn nil, err\n\t}\n\n\tif err != nil {\n\t\tlog.WithError(err).Error(\"failed to listen for messages\")\n\t\treturn nil, err\n\t}\n\n\tif res.StatusCode == http.StatusTooManyRequests {\n\t\terr = errors.New(\"Too many requests being made against host, reporting error and trying again\")\n\t\tlog.WithError(err).Error(\"Failed to perform GET\")\n\t\treturn nil, err\n\t}\n\n\tif res.StatusCode > http.StatusMultipleChoices {\n\t\terr = fmt.Errorf(\"Incorrect response code returned, received: %v\", res.StatusCode)\n\t\tlog.WithError(err).Error(\"Failed to perform GET\")\n\t\treturn nil, err\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "8539e37ec87a813ff741bb1a07539b48", "score": "0.5606537", "text": "func SendRequest(method, url, token string, reqBody io.Reader) (*http.Response, error) {\n\tclient := &http.Client{}\n\treq, err := http.NewRequest(method, url, reqBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttimestamp := fmt.Sprintf(\"%d\", Now())\n\thash := hmac.New(sha256.New, []byte(token))\n\thash.Write([]byte(timestamp))\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"timestamp\", timestamp)\n\treq.Header.Set(\"auth\", hex.EncodeToString(hash.Sum(nil)))\n\n\trsp, err := client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn rsp, err\n}", "title": "" }, { "docid": "e58392672ef84e2c74bf48fbe307e539", "score": "0.5589663", "text": "func GetTheRequest(URL string, client *http.Client) *http.Response {\n\t//do a request on the url\n\treq, err := http.NewRequest(http.MethodGet, URL, nil)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t//getting response from the client\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t//returning the response\n\treturn resp\n}", "title": "" }, { "docid": "ae7467cbd4c8301fd91a807c59e5bf2f", "score": "0.5585914", "text": "func (r *request) get(endpoint string) string {\n\tr.method = http.MethodGet\n\tr.endpoint = endpoint\n\treturn r.do()\n}", "title": "" }, { "docid": "becdaf0504572e621ec4769ae2ba9b76", "score": "0.55803496", "text": "func DoGET(handler echo.HandlerFunc, url string, urlParams map[string]string) (rec *httptest.ResponseRecorder, err error) {\n\treq := httptest.NewRequest(http.MethodGet, url, nil)\n\treturn DoRequest(handler, req, urlParams)\n}", "title": "" }, { "docid": "335f961b763bd194df32f777f3a28444", "score": "0.5576017", "text": "func Get(app *App, url string, t *testing.T) *httpexpect.Response {\n\treq := sendRequest(app, \"GET\", url, t)\n\treturn req.Expect()\n}", "title": "" }, { "docid": "51d931c289c669d928871c515c16b05f", "score": "0.55623823", "text": "func (c *Client) get(\n\tctx context.Context,\n\tendpoint string,\n\tqueries map[string]string,\n) (*http.Response, error) {\n\t// Assemble request\n\treq, err := c.buildRequest(ctx, \"GET\", endpoint, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Add query strings\n\tif queries != nil {\n\t\tencodeQuery(req.URL, queries)\n\t}\n\treturn c.do(req)\n}", "title": "" }, { "docid": "fd7231261bf7836dc081ab191fae02d1", "score": "0.55593586", "text": "func RequestGoodsGet(req model.RequestAbstract) model.ResponseAbstract {\n\n\tdbAbs := commonRequestProcess(req, \"request_goods\")\n\n\treturn prepareResponse(dbAbs)\n}", "title": "" }, { "docid": "72e0ce07c589f942e4ebc6e9ce4bcfea", "score": "0.55399114", "text": "func (c *Client) get(spath string, params *requestParams) (*response, error) {\n\treq, err := c.newReqest(http.MethodGet, spath, params, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn c.do(req)\n}", "title": "" }, { "docid": "1994c4a56c2cc21c0b64e44d164b4bf1", "score": "0.5535989", "text": "func (tc *TinderClient) httpGet(url string) (*http.Response, error) {\n\tif tc.apiToken == \"\" {\n\t\treturn nil, NoApiTokenError\n\t}\n\treq, err := http.NewRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Header.Add(\"X-Auth-Token\", tc.apiToken)\n\treturn httpClient.Do(req)\n}", "title": "" }, { "docid": "f3e0ad0c0df0981a47017ea1fe0dcf8d", "score": "0.55225194", "text": "func (r *HttpRequest) sendRequest(client *http.Client) (*http.Response, error) {\n\treq, err := r.BuildRequest()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttimeoutDuration := 5 * time.Second\n\n\tif r.Timeout != \"\" {\n\t\ttimeoutDuration, err = time.ParseDuration(r.Timeout)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tctx, cancel := context.WithTimeout(context.Background(), timeoutDuration)\n\tdefer cancel()\n\n\tresp, err := client.Do(req.WithContext(ctx))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn resp, r.handleResponse(resp)\n}", "title": "" }, { "docid": "b9e49fa678b033cdedd839a35c86ad5b", "score": "0.5509863", "text": "func (client *Client) SendAzureGetRequest(url string) ([]byte, error) {\n\tif url == \"\" {\n\t\treturn nil, fmt.Errorf(errParamNotSpecified, \"url\")\n\t}\n\n\tresponse, err := client.sendAzureRequest(url, \"GET\", \"\", nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponseContent := getResponseBody(response)\n\treturn responseContent, nil\n}", "title": "" }, { "docid": "08740d765334e1908606bf459ecd49fc", "score": "0.5477358", "text": "func (k8sClient *Client) SendRequest(reqParams *RequestParams) (*http.Response, error) {\n\tlog.Trace(\"K8s/client:SendRequest() Entering\")\n\tdefer log.Trace(\"K8s/client:SendRequest() Leaving\")\n\n\tif k8sClient == nil || k8sClient.HTTPClient == nil {\n\t\treturn nil, errors.New(\"K8s/client:SendRequest() K8s client not initialized properly\")\n\t}\n\n\terr := k8sClient.validateKubernetesDetails()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"K8s/client:SendRequest() K8s Details are not valid\")\n\t}\n\n\trequest, err := http.NewRequest(reqParams.Method, reqParams.URL.String(), reqParams.Body)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"K8s/client:SendRequest() Error in creating Request\")\n\t}\n\n\trequest.Header.Add(\"Authorization\", \"Bearer \"+k8sClient.Token)\n\tif len(reqParams.AdditionalHeaders) > 0 {\n\t\tfor key, value := range reqParams.AdditionalHeaders {\n\t\t\trequest.Header.Add(key, value)\n\t\t}\n\t}\n\n\tres, err := k8sClient.HTTPClient.Do(request)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"K8s/client:SendRequest() Error in receiving response\")\n\t}\n\n\tif res.StatusCode == http.StatusOK || res.StatusCode == http.StatusCreated || res.StatusCode == http.StatusNoContent || res.StatusCode == http.StatusNotFound {\n\t\treturn res, nil\n\t}\n\n\tbody, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"K8s/client:SendRequest() Error while reading response body\")\n\t}\n\treturn res, errors.Errorf(\"K8s/client:SendRequest(): Error in receiving response from k8s %s\", string(body))\n\n}", "title": "" }, { "docid": "01ea2a52b7d73ec5dfef71cdd38d0e53", "score": "0.54572916", "text": "func (k *Kraken) SendHTTPRequest(ctx context.Context, ep exchange.URL, path string, result interface{}) error {\n\tendpoint, err := k.API.Endpoints.GetURL(ep)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\titem := &request.Item{\n\t\tMethod: http.MethodGet,\n\t\tPath: endpoint + path,\n\t\tResult: result,\n\t\tVerbose: k.Verbose,\n\t\tHTTPDebugging: k.HTTPDebugging,\n\t\tHTTPRecording: k.HTTPRecording,\n\t}\n\n\treturn k.SendPayload(ctx, request.Unset, func() (*request.Item, error) {\n\t\treturn item, nil\n\t}, request.UnauthenticatedRequest)\n}", "title": "" }, { "docid": "740300e2b7df54cd1e5a8ad78b2e3bd2", "score": "0.5446486", "text": "func sendGetReq(size string, present bool, endpoint string) []LeadData {\n\tvar req *http.Request\n\n\t// For testing to pass valid and invalid URLs\n\tif endpoint == \"\" {\n\t\treq, _ = http.NewRequest(\"GET\", url, nil)\n\t} else {\n\t\treq, _ = http.NewRequest(\"GET\", endpoint, nil)\n\t}\n\n\t// checks if present is set to true include size parameter in URL else exclude\n\tif present == true {\n\t\tq := req.URL.Query()\n\t\tq.Set(\"size\", size)\n\t\treq.URL.RawQuery = q.Encode()\n\t}\n\n\t// Send the request\n\tresponse, err := client.Do(req)\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\tdefer response.Body.Close()\n\n\tif response.StatusCode != http.StatusOK {\n\t\treturn nil\n\t}\n\n\t// Read response body\n\trsp, err := ioutil.ReadAll(response.Body)\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\t// Unmarshal response data to leaddata\n\tvar data []LeadData\n\tif err := json.Unmarshal(rsp, &data); err != nil {\n\t\treturn nil\n\t}\n\n\treturn data\n}", "title": "" }, { "docid": "1c8846faf3a0df26c60a16b33351ba58", "score": "0.5443683", "text": "func GetRequest(httpClient *http.Client, url, token string) ([]byte, error) {\n\treq, _ := http.NewRequest(\"GET\", url, nil)\n\treq.Header.Set(\"x-token\", token)\n\tresp, err := httpClient.Do(req)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\terrorMsg := ErrorMessage{}\n\t\terr := json.Unmarshal(body, &errorMsg)\n\t\tif err != nil {\n\t\t\treturn body, errors.New(\"Error status\")\n\t\t}\n\t\treturn body, errors.New(errorMsg.Message)\n\t}\n\n\treturn body, nil\n}", "title": "" }, { "docid": "9dd88f31781532d242007929ce407d47", "score": "0.5443003", "text": "func (c *Client) sendRequest(jReq *jsonRequest) {\n\tc.sendPost(jReq)\n\treturn\n}", "title": "" }, { "docid": "7a747abaeeb0081738b8eab0252b1f39", "score": "0.54393995", "text": "func (c *HTTPClient) MakeGETRequest(Path string) string {\n\tresponse, err := c.HTTPClient.Get(c.BaseURL + \"/\" + Path)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tdefer response.Body.Close()\n\tif response.StatusCode == http.StatusOK {\n\t\tbodyBytes, err := ioutil.ReadAll(response.Body)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t} else {\n\t\t\treturn string(bodyBytes)\n\t\t}\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "c38e7f40a088bf43d828f557f5e5110a", "score": "0.54357636", "text": "func (c *Client) GET(url string) ([]byte, error) {\n\treq, err := http.NewRequest(\"GET\", c.Endpoint+url, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn c.do(req)\n}", "title": "" }, { "docid": "5674f842dffb6c3aeaa480b8c35f4bd7", "score": "0.54357237", "text": "func newGetRequest(url string, params url.Values) (*http.Request, error) {\n\tr, err := http.NewRequest(\"GET\", url, strings.NewReader(params.Encode()))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// content is submitted as x-www-form-urlencoded; accepted back as JSON\n\tr.Header.Set(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\tr.Header.Set(\"Accept\", \"application/json\")\n\n\treturn r, nil\n}", "title": "" }, { "docid": "187b968cc5f75c69c8d5d89716284485", "score": "0.5435564", "text": "func NewGetRequest(url string)(*http.Request,error){\n\treq,err:=http.NewRequest(\"GET\",url,nil)\n\tif err!=nil {\n\t\treturn nil, err\n\t}\n\tSetHeaders(req)\n\treturn req,nil\n}", "title": "" }, { "docid": "99ea6f291ec2a8804c014a2b226fba2b", "score": "0.54319155", "text": "func (req *Request) GET() (*http.Request, error) {\n\treturn http.NewRequest(\"GET\", req.SourceURL, http.NoBody)\n}", "title": "" }, { "docid": "52c80dd8dd278a93dee38eb9294e71cd", "score": "0.54266113", "text": "func (c *Client) sendRequest(ctx context.Context,\n\tmethod, url string,\n\tbody io.Reader,\n\ttarget interface{}) error {\n\treq, err := http.NewRequest(method, url, body)\n\tif err != nil {\n\t\treturn err\n\t}\n\treq = req.WithContext(ctx)\n\treq.Header.Add(\"Authorization\", fmt.Sprintf(\"SSWS %s\", c.token))\n\n\tif body != nil {\n\t\treq.Header.Set(\"Content-Type\", \"application/json\")\n\t}\n\n\tresp, err := c.client.Do(req)\n\tif err != nil {\n\t\tfmt.Printf(\"Error %s\\n\", err)\n\t\treturn err\n\t}\n\n\terr = checkCode(resp, target)\n\treturn err\n}", "title": "" }, { "docid": "0b4ace883524b742e9b7497dfacefd54", "score": "0.5425482", "text": "func (req *request) send() ([]byte, error) {\n\tclient := &http.Client{}\n\thttp_req, err := http.NewRequest(req.method, req.url, nil)\n\thttp_req.SetBasicAuth(req.user, req.passwd)\n\tresp, err := client.Do(http_req)\n\tif err != nil {\n\t\tfmt.Printf(\"send_req failed\\n\")\n\t\treturn nil, err\n\t}\n\treturn ioutil.ReadAll(resp.Body)\n}", "title": "" }, { "docid": "074659da50ea063ff1cfdb76fbc6ad01", "score": "0.5408546", "text": "func performGetRequest (url string) (*http.Response, error) {\n\tconfig, err := config.Get()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trequest, err := http.NewRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trequest.Header.Add(\"Authorization\", fmt.Sprintf(\"Bearer %v\", config.BearerToken))\n\tclient := &http.Client{}\n\n\tresponse, err := client.Do(request)\n\tif err != nil {\n\t\treturn nil, errors.New(\"This gitlab operation was not able to be performed\")\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "66ee9b3b3110e9804d667fa2451c370f", "score": "0.54072857", "text": "func makeGetRequest(url string) []byte {\n // get url\n // make request ( http )\n // get the response\n // return the body\n \n res, err := http.Get(ApiRoot + url)\n if err != nil {\n panic(err)\n }\n\n body, err := ioutil.ReadAll(res.Body)\n if err != nil {\n panic(err)\n }\n\n return body\n}", "title": "" }, { "docid": "80a488bf705d3e51675904a59cbfed42", "score": "0.540583", "text": "func SendRequest(req *http.Request, timeout time.Duration) ([]byte, error) {\n\tclient := &http.Client{\n\t\tTimeout: timeout,\n\t}\n\n\tresponse, err := client.Do(req)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Read body from response\n\tbody, err := io.ReadAll(response.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = response.Body.Close()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn body, nil\n}", "title": "" }, { "docid": "a550d33e5109b4783055c55a5fb620a4", "score": "0.5401519", "text": "func (bhh *BindmanHTTPHelper) Get(url string) (*http.Response, []byte, error) {\n\treturn bhh.request(url, \"GET\", \"\", nil)\n}", "title": "" }, { "docid": "4e64003179849268785f56205a41392f", "score": "0.53971046", "text": "func SendRequest(method, endpoint, username, password string, body interface{}) ([]byte, error) {\n\tvar request *http.Request\n\trequestUrl := zeebeUrl + endpoint\n\tswitch method {\n\tcase \"GET\":\n\t\trequest, _ = http.NewRequest(method, requestUrl, nil)\n\tcase \"POST\":\n\t\trequestBody, _ := json.Marshal(body)\n\t\trequest, _ = http.NewRequest(method, requestUrl, bytes.NewBuffer(requestBody))\n\tdefault:\n\t\terr := errors.New(\"HTTP method is unkwown.\")\n\t\tlog.Println(err)\n\t\treturn nil, err\n\t}\n\trequest.Header.Set(\"Content-Type\", \"application/json\")\n\trequest.SetBasicAuth(username, password)\n\n\tresponse, err := webClient.Do(request)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn nil, err\n\t}\n\n\tif response.StatusCode != 200 {\n\t\tlog.Println(response.Status)\n\t\treturn nil, errors.New(response.Status)\n\t}\n\n\tresponsebody, err := ioutil.ReadAll(response.Body)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn nil, err\n\t}\n\n\treturn responsebody, nil\n}", "title": "" }, { "docid": "8cb1261e676dcdcf6665ddec6e027595", "score": "0.5397083", "text": "func GetRequest(url string) []byte {\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tdefer resp.Body.Close()\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn body\n}", "title": "" }, { "docid": "0feee47b4421bb22980ca2d65d9d4e91", "score": "0.5394639", "text": "func GetTransaction(w http.ResponseWriter, r *http.Request) {\n\tclient := &http.Client{\n\t\tTimeout: time.Second * 10,\n\t\tTransport: MyRoundTripper{r: http.DefaultTransport},\n\t}\n\n\tparams := mux.Vars(r)\n\ttxid := params[\"txid\"]\n\tfmt.Println(txid)\n\n\tresponse, err := client.Get(taoNode + \"/api/gettransaction/\" + txid)\n\n\tif err != nil {\n\t\tfmt.Print(err.Error())\n\t\tos.Exit(1)\n\t}\n\n\tresponseData, err := ioutil.ReadAll(response.Body)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Println(string(responseData))\n\tjson.NewEncoder(w).Encode(responseData)\n}", "title": "" }, { "docid": "8cf3b4b8fcbe9b2ae4e0f1d6545be73b", "score": "0.5384153", "text": "func (f *FTX) SendHTTPRequest(ctx context.Context, ep exchange.URL, path string, result interface{}) error {\n\tendpoint, err := f.API.Endpoints.GetURL(ep)\n\tif err != nil {\n\t\treturn err\n\t}\n\titem := &request.Item{\n\t\tMethod: http.MethodGet,\n\t\tPath: endpoint + path,\n\t\tResult: result,\n\t\tVerbose: f.Verbose,\n\t\tHTTPDebugging: f.HTTPDebugging,\n\t\tHTTPRecording: f.HTTPRecording,\n\t}\n\treturn f.SendPayload(ctx, request.Unset, func() (*request.Item, error) {\n\t\treturn item, nil\n\t})\n}", "title": "" }, { "docid": "b24e1a980ee14e5de0f1332af859dcbd", "score": "0.5378863", "text": "func IsGetRequest(kvrequest *pb.KVRequest) bool {\n\treturn kvrequest.GetCommand() == GET\n}", "title": "" }, { "docid": "039d07cfebb4a79803ff6f4a212f110a", "score": "0.537725", "text": "func SendAndReceiveRequest(baseurl *url.URL) []byte {\n\tmovieclient := http.Client{\n\t\tTimeout: time.Second * 2,\n\t}\n\n\treq, err := http.NewRequest(http.MethodGet, baseurl.String(), nil)\n\tValidate(err)\n\n\treq.Header.Set(\"User-Agent\", \"Smalltutorial\")\n\n\tres, getErr := movieclient.Do(req)\n\n\tValidate(getErr)\n\n\tbody, readErr := ioutil.ReadAll(res.Body)\n\tValidate(readErr)\n\n\treturn body\n}", "title": "" }, { "docid": "720367e707e9ccf210915e2e8bade98e", "score": "0.5377022", "text": "func (this *cheshireConn) sendRequest(request *cheshire.Request, resultChan chan *cheshire.Response, errorChan chan error) (*cheshireRequest, error) {\n\t\n\tselect {\n\tcase this.inflightChan <- true :\n\tcase <- time.After(1 * time.Second):\n\t\t//should close this connection..\n\t\tthis.Close()\n\t\treturn nil, fmt.Errorf(\"Max inflight sustained for more then 20 seconds, fail\")\n\t}\n\n\tif !this.Connected() {\n\t\treturn nil, fmt.Errorf(\"Not connected\")\n\t}\n\n\treq := &cheshireRequest{\n\t\treq: request,\n\t\tresultChan: resultChan,\n\t\terrorChan: errorChan,\n\t}\n\tthis.outgoingChan <- req\n\treturn req, nil\n}", "title": "" }, { "docid": "cf9a1c5f600a653baf54448753a19fd3", "score": "0.53767323", "text": "func (cli *OpsGenieClient) sendRequest(req goreq.Request) (*goreq.Response, error) {\n\t// send the request\n\tvar resp *goreq.Response\n\tvar err error\n\tfor i := 0; i < cli.httpTransportSettings.MaxRetryAttempts; i++ {\n\t\tresp, err = req.Do()\n\t\tif err == nil && resp.StatusCode < 500 {\n\t\t\tbreak\n\t\t}\n\t\tif resp != nil {\n\t\t\tdefer resp.Body.Close()\n\t\t\tlogging.Logger().Info(fmt.Sprintf(\"Retrying request [%s] ResponseCode:[%d]. RetryCount: %d\", req.Uri, resp.StatusCode, (i + 1)))\n\t\t} else {\n\t\t\tlogging.Logger().Info(fmt.Sprintf(\"Retrying request [%s] Reason:[%s]. RetryCount: %d\", req.Uri, err.Error(), (i + 1)))\n\t\t}\n\t\ttime.Sleep(timeSleepBetweenRequests * time.Duration(i+1))\n\t}\n\tif err != nil {\n\t\tmessage := \"Unable to send the request \" + err.Error()\n\t\tlogging.Logger().Warn(message)\n\t\treturn nil, errors.New(message)\n\t}\n\t// check for the returning http status\n\tstatusCode := resp.StatusCode\n\tif statusCode >= 400 {\n\t\tbody, err := resp.Body.ToString()\n\t\tif err != nil {\n\t\t\tmessage := \"Server response with error can not be parsed \" + err.Error()\n\t\t\tlogging.Logger().Warn(message)\n\t\t\treturn nil, errors.New(message)\n\t\t}\n\t\treturn nil, errorMessage(statusCode, body)\n\t}\n\treturn resp, nil\n}", "title": "" }, { "docid": "1e02d27ab3ecdb05fc98591e73afe7fb", "score": "0.53766626", "text": "func (s *Server) Get(ctx context.Context, request *api.GetRequest) (*api.GetResponse, error) {\n\tlog.Tracef(\"Received GetRequest %+v\", request)\n\n\tin, err := proto.Marshal(&GetRequest{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout, header, err := s.DoQuery(ctx, opGet, in, request.Header)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tgetResponse := &GetResponse{}\n\tif err = proto.Unmarshal(out, getResponse); err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse := &api.GetResponse{\n\t\tHeader: header,\n\t\tValue: getResponse.Value,\n\t}\n\tlog.Tracef(\"Sending GetResponse %+v\", response)\n\treturn response, nil\n}", "title": "" }, { "docid": "219da3c29bce140bd0c64ef1a2d01170", "score": "0.5375822", "text": "func (c *Client) httpGet(ctx context.Context, url string) (*http.Response, error) {\n\treq, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp, err := c.httpDo(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif resp.StatusCode != http.StatusOK {\n\t\tresp.Body.Close()\n\t\treturn nil, ErrUnexpectedStatusCode(resp.StatusCode)\n\t}\n\treturn resp, nil\n}", "title": "" }, { "docid": "71296632177b845b097d7760d1753f4b", "score": "0.53681356", "text": "func (o *Object) doGetRequest(request getRequest) (getResponse, error) {\n\tselect {\n\tcase <-o.ctx.Done():\n\t\treturn getResponse{}, o.ctx.Err()\n\tcase o.reqCh <- request:\n\t}\n\n\tresponse := <-o.resCh\n\n\t// Return any error to the top level.\n\tif response.Error != nil {\n\t\treturn response, response.Error\n\t}\n\n\t// This was the first request.\n\tif !o.isStarted {\n\t\t// The object has been operated on.\n\t\to.isStarted = true\n\t}\n\t// Set the objectInfo if the request was not readAt\n\t// and it hasn't been set before.\n\tif !o.objectInfoSet && !request.isReadAt {\n\t\to.objectInfo = response.objectInfo\n\t\to.objectInfoSet = true\n\t}\n\t// Set beenRead only if it has not been set before.\n\tif !o.beenRead {\n\t\to.beenRead = response.didRead\n\t}\n\t// Data are ready on the wire, no need to reinitiate connection in lower level\n\to.seekData = false\n\n\treturn response, nil\n}", "title": "" }, { "docid": "34ef1079da3f7b42b21e9b9c5a6d2e1f", "score": "0.53677946", "text": "func Get(urlStr string) *Request {\n\treturn makeRequest(\"GET\", urlStr)\n}", "title": "" }, { "docid": "6c2976202fcb1c196e1bf7a8165ea6b7", "score": "0.53634006", "text": "func (c Client) Get(route string) (*http.Response, error) {\n\tvar url = fmt.Sprintf(\"%s/%s\", c.baseURL(), route)\n\tif c.Debug {\n\t\tlog.Printf(\"HTTP GET -> %s\\n\", url)\n\t}\n\treturn http.Get(url)\n}", "title": "" }, { "docid": "3f0f64de92025c536f41760c31a8e55a", "score": "0.5350542", "text": "func (r *Requester) Get(uri ...string) *Request {\n\treturn r.request(http.MethodGet, uri...)\n}", "title": "" }, { "docid": "a9069279553f6263b09b4cec75976b07", "score": "0.53398395", "text": "func (c *client) sendRequest(ctx context.Context, method, endpoint string, body []byte) ([]byte, error) {\n\tr, err := http.NewRequestWithContext(ctx, method, fmt.Sprintf(\"%s/%s\", c.host, endpoint), bytes.NewReader(body))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create request: %w\", err)\n\t}\n\n\tif err := Sign(r, c.pk); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to sign request: %w\", err)\n\t}\n\n\tresp, err := c.c.Do(r)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to do request: %w\", err)\n\t}\n\tdefer resp.Body.Close() // nolint\n\n\tif resp.StatusCode < 200 || resp.StatusCode >= 300 {\n\t\tswitch resp.StatusCode {\n\t\tcase http.StatusNotFound:\n\t\t\treturn nil, ErrNotFound\n\t\tcase http.StatusBadRequest:\n\t\t\treturn nil, ErrInvalidRequest\n\t\tdefault:\n\t\t\tvar e Error\n\t\t\tif err := json.NewDecoder(resp.Body).Decode(&e); err != nil {\n\t\t\t\treturn nil, errors.Errorf(\"request failed with status %d\", resp.StatusCode)\n\t\t\t}\n\t\t\treturn nil, errors.Errorf(\"request failed: %s\", e.Error)\n\t\t}\n\t}\n\n\tdata, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to read response body: %w\", err)\n\t}\n\n\treturn data, nil\n}", "title": "" }, { "docid": "c6d7821b6cacfc0c04c5d933984c3f85", "score": "0.53392357", "text": "func Get(req GetRequest) (GetResponse, error){\n var payload []byte\n\tvar resp GetResponse\n\n\tpath := req.Path\n\n log.Info(\"Received Get request for path = \",path)\n\n\tapp, appInfo, err := getAppModule(path)\n\n if err != nil {\n resp = GetResponse{Payload:payload, ErrSrc:ProtoErr}\n return resp, err\n }\n\n\terr = appInitialize(app, appInfo, path, nil, GET)\n\n\tif err != nil {\n\t\tresp = GetResponse{Payload:payload, ErrSrc:AppErr}\n\t\treturn resp, err\n\t}\n\n\tdbs, err := getAllDbs()\n\n\tif err != nil {\n\t\tresp = GetResponse{Payload:payload, ErrSrc:ProtoErr}\n return resp, err\n\t}\n\n\tdefer closeAllDbs(dbs[:])\n\n err = (*app).translateGet (dbs)\n\n\tif err != nil {\n\t\tresp = GetResponse{Payload:payload, ErrSrc:AppErr}\n return resp, err\n\t}\n\n resp, err = (*app).processGet(dbs)\n\n return resp, err\n}", "title": "" }, { "docid": "d3fae2065863f328ceaaff98bd73b4ac", "score": "0.5336944", "text": "func (c Client) SendRequest(r *Request) (string, error) {\n\t// http://dev.xiaomi.com/doc/?p=533\n\tclient := &http.Client{}\n\n\tdata := fillData(r)\n\treq, err := http.NewRequest(\"POST\", baseURL+r.TargetType, strings.NewReader(data))\n\treq.Header.Add(\"Authorization\", \"key=\"+c.AppSecret)\n\treq.Header.Add(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer resp.Body.Close()\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(body), nil\n}", "title": "" }, { "docid": "cbf1b56d7d721b72f8b20a298ddddc0f", "score": "0.5334243", "text": "func (p *GatewayHandler) handleGetRequest(w http.ResponseWriter, r *http.Request) {\n\treqPath := r.URL.Path\n\tif rslt, ok := p.cachedRequest[reqPath]; ok { // already cached\n\t\tfmt.Printf(\"[serve-with-cache] %s\", reqPath)\n\t\tp.responseWithCache(w, rslt)\n\t\treturn\n\t}\n\n\tfor _, cacheDef := range p.LazyCacheDefinitions {\n\t\tfullFilled, _ := cacheDef.checkIsPathMatched(reqPath)\n\t\tif fullFilled {\n\t\t\tstatusCode, respHeader, body, errReq := sendGetRequest(GenerateAPIUrl(r), r.Header)\n\t\t\tif errReq != nil {\n\t\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\t\tw.Write([]byte(errReq.Error()))\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif statusCode == 200 {\n\t\t\t\tp.cachedRequest[r.URL.Path] = RequestResult{ResponseHeader: respHeader, ResponseBody: body}\n\t\t\t}\n\t\t\tCopyToHeader(respHeader, w.Header())\n\t\t\tw.WriteHeader(statusCode)\n\t\t\tw.Write(body)\n\t\t}\n\t}\n\tfor _, hExact := range p.serveFromFileExactMatch {\n\t\tif hExact.CheckIsPathServed(reqPath) {\n\t\t\thExact.handleRequest(w, r)\n\t\t\treturn\n\t\t}\n\t}\n\tfor _, hStartwith := range p.serveFromFileStartWithPattern {\n\t\tif hStartwith.CheckIsPathServed(reqPath) {\n\t\t\thStartwith.handleRequest(w, r)\n\t\t\treturn\n\t\t}\n\t}\n\t// ok then send no proxy request\n\tGetAPIProxy(w, r)\n}", "title": "" }, { "docid": "15a245dbe7d5f556df169533fd0e7cf2", "score": "0.53330326", "text": "func (h *taskHandler) sendRequest(requestBody []byte) ([]byte, error) {\n\tvar (\n\t\tresponse *domain.Response\n\t\terr error\n\t\trequest domain.Request\n\t)\n\terr = json.Unmarshal(requestBody, &request)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif response, err = h.tasks.Do(request); err != nil {\n\t\treturn nil, err\n\t}\n\tjsonResponse, err := json.Marshal(response)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn jsonResponse, nil\n}", "title": "" }, { "docid": "93ab1f4cf9be86c389045ac0c022c17d", "score": "0.53326213", "text": "func (h *HTTP) GET(uri string) (*http.Response, error) {\n\tr, err := http.NewRequest(http.MethodGet, uri, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn h.Do(r)\n}", "title": "" }, { "docid": "3440ffd110d051504bed033392c3a65e", "score": "0.53325075", "text": "func sendRequest(newHandler *http.Client, newRequest *http.Request) (int, []byte, http.Header, error) {\n\t// send http request\n\tresp, err := newHandler.Do(newRequest)\n\tif err != nil {\n\t\tif os.IsTimeout(err) {\n\t\t\terr = fmt.Errorf(\"timeout encountered. error: %s\", err.Error())\n\t\t\treturn http.StatusRequestTimeout, nil, nil, err\n\t\t}\n\t\terr = fmt.Errorf(\"failed to send request. Error: %s\", err.Error())\n\t\treturn 0, nil, nil, err\n\t}\n\n\t// read response body\n\tdefer resp.Body.Close()\n\tbody := new(bytes.Buffer)\n\t_, readError := body.ReadFrom(resp.Body)\n\tif readError != nil {\n\t\terr = fmt.Errorf(\"failed to read response body. error: %s\", err.Error())\n\t\treturn resp.StatusCode, nil, nil, err\n\t}\n\n\treturn resp.StatusCode, body.Bytes(), resp.Header, nil\n}", "title": "" }, { "docid": "1a655b1b9151e54b1950b81c84c10b0a", "score": "0.53290796", "text": "func (c *Client) doRequest()", "title": "" }, { "docid": "f649e6a7dbe1c42abed9ff143286f86a", "score": "0.53238285", "text": "func makeRequest(req *http.Request) (*http.Response, error) {\n\tif req == nil {\n\t\treturn nil, errors.New(\"makeRequest: cannot send nil request\")\n\t}\n\tif req.Method != \"GET\" {\n\t\treturn nil, errors.New(\"makeRequest: can only send GET requests\")\n\t}\n\n\t// Connect to the server\n\tconn, err := net.Dial(tcpProtocol, req.URL.Host)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Ensure that there is some Path set\n\tif req.URL.Path == \"\" {\n\t\treq.URL.Path = \"/\"\n\t}\n\n\t// Send request line\n\tvar uri string\n\tif req.URL.RawQuery == \"\" {\n\t\turi = req.URL.Path\n\t} else {\n\t\turi = fmt.Sprintf(\"%s?%s\", req.URL.Path, req.URL.RawQuery)\n\t}\n\terr = sendBytes(conn, []byte(\n\t\tfmt.Sprintf(\"GET %s %s\\r\\n\", uri, req.Proto)))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Send headers\n\tfor k, v := range req.Header {\n\t\tfor i := 0; i < len(v); i++ {\n\t\t\terr = sendBytes(conn, []byte(fmt.Sprintf(\"%s:%s\\r\\n\", k, v[i])))\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// End header\n\terr = sendBytes(conn, []byte(\"\\r\\n\"))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Do not need to send a body because GET requests do not have bodies\n\n\t// Read response\n\tresp, err := http.ReadResponse(bufio.NewReader(conn), req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn resp, nil\n}", "title": "" }, { "docid": "28e4c25da1a1f6062d51f953675df23c", "score": "0.5323199", "text": "func HandleGetChain(request []byte) {\n\tvar buff bytes.Buffer\n\tvar payload GetChain\n\n\tbuff.Write(request[commandLength:])\n\tdec := gob.NewDecoder(&buff)\n\terr := dec.Decode(&payload)\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\n\tSendChain(payload.AddrFrom)\n}", "title": "" }, { "docid": "699f4fa159b4b3e6374b322c93fda107", "score": "0.53222615", "text": "func (bow *Browser) httpGET(u *url.URL, ref *url.URL) error {\n\treq, err := bow.buildRequest(\"GET\", u.String(), ref, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn bow.httpRequest(req)\n}", "title": "" }, { "docid": "c9fc80f3021e6258924294f6b4247579", "score": "0.531898", "text": "func (target *Target) GetWithString(ctx context.Context, request string) (*gpb.GetResponse, error) {\n\tif request == \"\" {\n\t\treturn nil, errors.NewInvalid(\"cannot get an empty request\")\n\t}\n\tr := &gpb.GetRequest{}\n\treqProto := &request\n\tif err := proto.UnmarshalText(*reqProto, r); err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to parse gnmi.GetRequest from %q : %v\", *reqProto, err)\n\t}\n\treturn target.Get(ctx, r)\n}", "title": "" }, { "docid": "7e7b02ded56e715774798f6a6401e8ca", "score": "0.53189796", "text": "func (zebedee *Client) buildGetRequest(url string, requestContextID string, params []parameter) (*http.Request, error) {\n\trequest, err := http.NewRequest(\"GET\", zebedee.url+url, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trequest.Header.Add(requests.RequestIDHeaderParam, requestContextID)\n\n\tif len(params) > 0 {\n\t\tquery := request.URL.Query()\n\t\tfor _, param := range params {\n\t\t\tquery.Add(param.name, param.value)\n\t\t}\n\t\trequest.URL.RawQuery = query.Encode()\n\t}\n\treturn request, nil\n}", "title": "" }, { "docid": "84032e64d02cbc2473252d6d99c0e93f", "score": "0.53149796", "text": "func GetRequest(url *url.URL, verifyTLS bool, headers map[string]string) (int, http.Header, []byte, error) {\n\treq, err := http.NewRequest(\"GET\", url.String(), nil)\n\tif err != nil {\n\t\treturn 0, nil, nil, err\n\t}\n\n\tfor key, value := range headers {\n\t\treq.Header.Set(key, value)\n\t}\n\n\tstatusCode, respHeaders, body, err := performRequest(req, verifyTLS)\n\tif err != nil {\n\t\treturn statusCode, respHeaders, body, err\n\t}\n\n\treturn statusCode, respHeaders, body, nil\n}", "title": "" }, { "docid": "9f9bd1512519b7c024de605a024fc35f", "score": "0.5312532", "text": "func (this *cheshireConn) sendRequest(request *cheshire.Request, resultChan chan *cheshire.Response, errorChan chan error) (*cheshireRequest, error) {\n\n\tsleeps := 0\n\tfor len(this.requests) > this.maxInFlight {\n\t\tlog.Printf(\"Max inflight (%d), sleeping one second\", this.maxInFlight)\n\t\tif sleeps > 20 {\n\t\t\t//should close this connection..\n\t\t\tthis.Close()\n\t\t\treturn nil, fmt.Errorf(\"Max inflight sustained for more then 20 seconds, fail\")\n\t\t}\n\t\ttime.Sleep(1 * time.Second)\n\t\tsleeps++\n\t}\n\n\tif !this.connected {\n\t\treturn nil, fmt.Errorf(\"Not connected\")\n\t}\n\n\tjson, err := json.Marshal(request)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\n\treq := &cheshireRequest{\n\t\treq: request,\n\t\tbytes:\t\tjson,\n\t\tresultChan: resultChan,\n\t\terrorChan: errorChan,\n\t}\n\tthis.outgoingChan <- req\n\treturn req, nil\n}", "title": "" }, { "docid": "ddc79f5aad90d38ce8e1f1b387d0ccce", "score": "0.5307232", "text": "func (c *Client) makeGetRequest(queryString string, requestURL string, result interface{}) error {\n\treq, err := http.NewRequest(\"GET\", c.BaseURL+requestURL, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treq.URL.RawQuery = queryString\n\tresp, err := c.httpClient.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer resp.Body.Close()\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = json.Unmarshal(body, result)\n\treturn err\n}", "title": "" }, { "docid": "70f4a394215739457d77fc90f4f41c7d", "score": "0.5302935", "text": "func NewGetRequest(url string) *Request {\n\treturn &Request{\n\t\tURL: url,\n\t\tMethod: GET,\n\t}\n}", "title": "" }, { "docid": "9ce0f7283eff124e064b3d3292ff1ab0", "score": "0.5300492", "text": "func (recorder *ConnRecorder) GetRequest(idx int) (*jsonrpc.Request, error) {\n\treq := &jsonrpc.Request{}\n\terr := recorder.Unmarshal(idx, req)\n\treturn req, err\n}", "title": "" } ]
e3c134617e85dc2aa4856f420e2f9697
NewProvisionClusterRequestFromReader will create an UpdateClusterRequest from an io.Reader with JSON data.
[ { "docid": "0b3c305310e1a97b8839431c63480517", "score": "0.81965166", "text": "func NewProvisionClusterRequestFromReader(reader io.Reader) (*ProvisionClusterRequest, error) {\n\tvar provisionClusterRequest ProvisionClusterRequest\n\terr := json.NewDecoder(reader).Decode(&provisionClusterRequest)\n\tif err != nil && err != io.EOF {\n\t\treturn nil, errors.Wrap(err, \"failed to decode provision cluster request\")\n\t}\n\treturn &provisionClusterRequest, nil\n}", "title": "" } ]
[ { "docid": "43c4f2d25ce0839f0dc28b524d398fb4", "score": "0.8203564", "text": "func NewProvisionClusterRequestFromReader(reader io.Reader) (*ProvisionClusterRequest, error) {\n\tvar provisionClusterRequest ProvisionClusterRequest\n\terr := json.NewDecoder(reader).Decode(&provisionClusterRequest)\n\tif err != nil && err != io.EOF {\n\t\treturn nil, errors.Wrap(err, \"failed to decode provision cluster request\")\n\t}\n\n\treturn &provisionClusterRequest, nil\n}", "title": "" }, { "docid": "b4f61e241c539701f436d4bf06df0738", "score": "0.8119921", "text": "func NewUpdateClusterRequestFromReader(reader io.Reader) (*UpdateClusterRequest, error) {\n\tvar updateClusterRequest UpdateClusterRequest\n\terr := json.NewDecoder(reader).Decode(&updateClusterRequest)\n\tif err != nil && err != io.EOF {\n\t\treturn nil, errors.Wrap(err, \"failed to decode update cluster request\")\n\t}\n\treturn &updateClusterRequest, nil\n}", "title": "" }, { "docid": "b4f61e241c539701f436d4bf06df0738", "score": "0.8119921", "text": "func NewUpdateClusterRequestFromReader(reader io.Reader) (*UpdateClusterRequest, error) {\n\tvar updateClusterRequest UpdateClusterRequest\n\terr := json.NewDecoder(reader).Decode(&updateClusterRequest)\n\tif err != nil && err != io.EOF {\n\t\treturn nil, errors.Wrap(err, \"failed to decode update cluster request\")\n\t}\n\treturn &updateClusterRequest, nil\n}", "title": "" }, { "docid": "916004be0bec0606b352c0d7136b225f", "score": "0.8013912", "text": "func NewUpgradeClusterRequestFromReader(reader io.Reader) (*PatchUpgradeClusterRequest, error) {\n\tvar upgradeClusterRequest PatchUpgradeClusterRequest\n\terr := json.NewDecoder(reader).Decode(&upgradeClusterRequest)\n\tif err != nil && err != io.EOF {\n\t\treturn nil, errors.Wrap(err, \"failed to decode upgrade cluster request\")\n\t}\n\n\terr = upgradeClusterRequest.Validate()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"upgrade cluster request failed validation\")\n\t}\n\n\treturn &upgradeClusterRequest, nil\n}", "title": "" }, { "docid": "76bfc8f77f3e967189abf162bfdacb89", "score": "0.77717215", "text": "func NewCreateClusterRequestFromReader(reader io.Reader) (*CreateClusterRequest, error) {\n\tvar createClusterRequest CreateClusterRequest\n\terr := json.NewDecoder(reader).Decode(&createClusterRequest)\n\tif err != nil && err != io.EOF {\n\t\treturn nil, errors.Wrap(err, \"failed to decode create cluster request\")\n\t}\n\n\tcreateClusterRequest.SetDefaults()\n\terr = createClusterRequest.Validate()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"create cluster request failed validation\")\n\t}\n\n\treturn &createClusterRequest, nil\n}", "title": "" }, { "docid": "76bfc8f77f3e967189abf162bfdacb89", "score": "0.77717215", "text": "func NewCreateClusterRequestFromReader(reader io.Reader) (*CreateClusterRequest, error) {\n\tvar createClusterRequest CreateClusterRequest\n\terr := json.NewDecoder(reader).Decode(&createClusterRequest)\n\tif err != nil && err != io.EOF {\n\t\treturn nil, errors.Wrap(err, \"failed to decode create cluster request\")\n\t}\n\n\tcreateClusterRequest.SetDefaults()\n\terr = createClusterRequest.Validate()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"create cluster request failed validation\")\n\t}\n\n\treturn &createClusterRequest, nil\n}", "title": "" }, { "docid": "7fb9a33c49156ef227ab39203d8ed298", "score": "0.76315266", "text": "func NewResizeClusterRequestFromReader(reader io.Reader) (*PatchClusterSizeRequest, error) {\n\tvar patchClusterSizeRequest PatchClusterSizeRequest\n\terr := json.NewDecoder(reader).Decode(&patchClusterSizeRequest)\n\tif err != nil && err != io.EOF {\n\t\treturn nil, errors.Wrap(err, \"failed to decode resize cluster request\")\n\t}\n\n\terr = patchClusterSizeRequest.Validate()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"resize cluster request failed validation\")\n\t}\n\n\treturn &patchClusterSizeRequest, nil\n}", "title": "" }, { "docid": "af043a894f873d8e57fe2d36867d3ad2", "score": "0.6914843", "text": "func ClusterFromReader(reader io.Reader) (*Cluster, error) {\n\tcluster := Cluster{}\n\tdecoder := json.NewDecoder(reader)\n\terr := decoder.Decode(&cluster)\n\tif err != nil && err != io.EOF {\n\t\treturn nil, err\n\t}\n\n\treturn &cluster, nil\n}", "title": "" }, { "docid": "bb6fcf9264b14f6fb96c5f9821440807", "score": "0.65183884", "text": "func ClusterInstallationFromReader(reader io.Reader) (*ClusterInstallation, error) {\n\tclusterInstallation := ClusterInstallation{}\n\tdecoder := json.NewDecoder(reader)\n\terr := decoder.Decode(&clusterInstallation)\n\tif err != nil && err != io.EOF {\n\t\treturn nil, err\n\t}\n\n\treturn &clusterInstallation, nil\n}", "title": "" }, { "docid": "80d8bc46a8ea48ba07efc4974ac58dc9", "score": "0.62287414", "text": "func NewProvisionAccountRequestFromReader(reader io.Reader) (*ProvisionAccountRequest, error) {\n\tvar provisionAccountRequest ProvisionAccountRequest\n\terr := json.NewDecoder(reader).Decode(&provisionAccountRequest)\n\tif err != nil && err != io.EOF {\n\t\treturn nil, errors.Wrap(err, \"failed to decode provision account request\")\n\t}\n\treturn &provisionAccountRequest, nil\n}", "title": "" }, { "docid": "b9cf044a89ca3b916133aa1786161874", "score": "0.5955704", "text": "func ClusterInstallationConfigFromReader(reader io.Reader) (map[string]interface{}, error) {\n\tconfig := make(map[string]interface{})\n\tdecoder := json.NewDecoder(reader)\n\n\terr := decoder.Decode(&config)\n\tif err != nil && err != io.EOF {\n\t\treturn nil, err\n\t}\n\n\treturn config, nil\n}", "title": "" }, { "docid": "48a8c2f7aca45e64252f23a77a2964f6", "score": "0.5797449", "text": "func ClustersFromReader(reader io.Reader) ([]*Cluster, error) {\n\tclusters := []*Cluster{}\n\tdecoder := json.NewDecoder(reader)\n\n\terr := decoder.Decode(&clusters)\n\tif err != nil && err != io.EOF {\n\t\treturn nil, err\n\t}\n\n\treturn clusters, nil\n}", "title": "" }, { "docid": "7aa82d3b193527f224821779af83139f", "score": "0.5794344", "text": "func NewCreateNodegroupsRequestFromReader(reader io.Reader) (*CreateNodegroupsRequest, error) {\n\tvar createNodegroupsRequest CreateNodegroupsRequest\n\terr := json.NewDecoder(reader).Decode(&createNodegroupsRequest)\n\tif err != nil && err != io.EOF {\n\t\treturn nil, errors.Wrap(err, \"failed to decode create nodegroups request\")\n\t}\n\n\tcreateNodegroupsRequest.SetDefaults()\n\terr = createNodegroupsRequest.Validate()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"create nodegroups request failed validation\")\n\t}\n\n\treturn &createNodegroupsRequest, nil\n}", "title": "" }, { "docid": "3abb6ac868f80aeb3d5b5ea766df1408", "score": "0.5620841", "text": "func readClusterAuthorizationRequest(iterator *jsoniter.Iterator) *ClusterAuthorizationRequest {\n\tobject := &ClusterAuthorizationRequest{}\n\tfor {\n\t\tfield := iterator.ReadObject()\n\t\tif field == \"\" {\n\t\t\tbreak\n\t\t}\n\t\tswitch field {\n\t\tcase \"byoc\":\n\t\t\tvalue := iterator.ReadBool()\n\t\t\tobject.byoc = &value\n\t\tcase \"account_username\":\n\t\t\tvalue := iterator.ReadString()\n\t\t\tobject.accountUsername = &value\n\t\tcase \"availability_zone\":\n\t\t\tvalue := iterator.ReadString()\n\t\t\tobject.availabilityZone = &value\n\t\tcase \"cluster_id\":\n\t\t\tvalue := iterator.ReadString()\n\t\t\tobject.clusterID = &value\n\t\tcase \"disconnected\":\n\t\t\tvalue := iterator.ReadBool()\n\t\t\tobject.disconnected = &value\n\t\tcase \"display_name\":\n\t\t\tvalue := iterator.ReadString()\n\t\t\tobject.displayName = &value\n\t\tcase \"external_cluster_id\":\n\t\t\tvalue := iterator.ReadString()\n\t\t\tobject.externalClusterID = &value\n\t\tcase \"managed\":\n\t\t\tvalue := iterator.ReadBool()\n\t\t\tobject.managed = &value\n\t\tcase \"reserve\":\n\t\t\tvalue := iterator.ReadBool()\n\t\t\tobject.reserve = &value\n\t\tcase \"resources\":\n\t\t\tvalue := readReservedResourceList(iterator)\n\t\t\tobject.resources = value\n\t\tdefault:\n\t\t\titerator.ReadAny()\n\t\t}\n\t}\n\treturn object\n}", "title": "" }, { "docid": "c51709d5e28d36245231b41bbd67ec37", "score": "0.5581324", "text": "func ClusterInstallationsFromReader(reader io.Reader) ([]*ClusterInstallation, error) {\n\tclusterInstallations := []*ClusterInstallation{}\n\tdecoder := json.NewDecoder(reader)\n\n\terr := decoder.Decode(&clusterInstallations)\n\tif err != nil && err != io.EOF {\n\t\treturn nil, err\n\t}\n\n\treturn clusterInstallations, nil\n}", "title": "" }, { "docid": "da32e8503ddcfcf86be26c22a8025331", "score": "0.5309552", "text": "func FromReader(r io.Reader, basePath string, loaders ...validator.RegistryLoader) (*Package, error) {\n\t// JSON doesn't differentiate between floats and integers. When parsed from JSON, large integers\n\t// get converted into scientific notation\n\t// Issue: https://github.com/frictionlessdata/datapackage-go/issues/28\n\t// Example at TestBigNumBytesIsValid.\n\td := json.NewDecoder(bufio.NewReader(r))\n\td.UseNumber()\n\n\tvar descriptor map[string]interface{}\n\tif err := d.Decode(&descriptor); err != nil {\n\t\treturn nil, err\n\t}\n\treturn New(descriptor, basePath, loaders...)\n}", "title": "" }, { "docid": "2b17062bae36ab7e18091f6bc1f2eed1", "score": "0.52624553", "text": "func InstallationFromReader(reader io.Reader) (*Installation, error) {\n\tinstallation := Installation{}\n\tdecoder := json.NewDecoder(reader)\n\terr := decoder.Decode(&installation)\n\tif err != nil && err != io.EOF {\n\t\treturn nil, err\n\t}\n\n\treturn &installation, nil\n}", "title": "" }, { "docid": "3fce0143e6235f119f2c3a3d1822213d", "score": "0.51996124", "text": "func NewCreateAccountRequestFromReader(reader io.Reader) (*CreateAccountRequest, error) {\n\tvar createAccountRequest CreateAccountRequest\n\terr := json.NewDecoder(reader).Decode(&createAccountRequest)\n\tif err != nil && err != io.EOF {\n\t\treturn nil, errors.Wrap(err, \"failed to decode create account request\")\n\t}\n\n\tcreateAccountRequest.SetDefaults()\n\tif err = createAccountRequest.Validate(); err != nil {\n\t\treturn nil, errors.Wrap(err, \"create account request failed validation\")\n\t}\n\n\treturn &createAccountRequest, nil\n}", "title": "" }, { "docid": "dcc6db8d29c9fb444651ae98050ca9ea", "score": "0.5122813", "text": "func NewFromReader(r io.Reader) (*Json, error) {\n\tj := new(Json)\n\tdec := json.NewDecoder(r)\n\tdec.UseNumber()\n\terr := dec.Decode(&j.data)\n\treturn j, err\n}", "title": "" }, { "docid": "107c8b7485346a9df5246f997b7e1527", "score": "0.5104713", "text": "func NewReader(r io.Reader) *Reader {\n\tvar o interface{}\n\tif err := json.NewDecoder(r).Decode(&o); err != nil {\n\t\treturn &Reader{err: err}\n\t}\n\treturn NewReaderFromMap(o)\n}", "title": "" }, { "docid": "4f678c90cb1a919e1e5af213e4b02146", "score": "0.5058651", "text": "func newNetconfRequest(body io.Reader) *NetconfRequest {\n\t// Decode our JSON body into a NetconfRequest struct\n\trequest := new(NetconfRequest)\n\terr := json.NewDecoder(body).Decode(request)\n\tif err != nil {\n\t\tpanic(errors.New(\"JSON parse error: \" + err.Error()))\n\t}\n\t// Validate we have an actual request to run\n\tif request.Request == \"\" {\n\t\tpanic(errors.New(\"received an empty request!\"))\n\t}\n\t// Make sure we have a valid SSH port to deal with\n\tif request.Port == 0 {\n\t\trequest.Port = 22\n\t}\n\treturn request\n}", "title": "" }, { "docid": "9c3afba996c2a0d90a22e09cc45e1868", "score": "0.5057873", "text": "func NewCreateOracleClusterRequest(server string, body CreateOracleClusterJSONRequestBody) (*http.Request, error) {\n\tvar bodyReader io.Reader\n\tbuf, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbodyReader = bytes.NewReader(buf)\n\treturn NewCreateOracleClusterRequestWithBody(server, \"application/json\", bodyReader)\n}", "title": "" }, { "docid": "f5592fc1f5181f31d0d267c2edbb9536", "score": "0.50465965", "text": "func NewCreateMysqlClusterRequest(server string, body CreateMysqlClusterJSONRequestBody) (*http.Request, error) {\n\tvar bodyReader io.Reader\n\tbuf, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbodyReader = bytes.NewReader(buf)\n\treturn NewCreateMysqlClusterRequestWithBody(server, \"application/json\", bodyReader)\n}", "title": "" }, { "docid": "ae1404407ec6f050c136bf6c00e467f3", "score": "0.5041219", "text": "func (rb *RequestBuilder) FromJSON(data string) (*Request, error) {\n\tvar req Request\n\terr := json.Unmarshal([]byte(data), &req)\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not deserialise json into Putrole request: %w\", err)\n\t}\n\n\treturn &req, nil\n}", "title": "" }, { "docid": "bab295777a041067ae059bb0c0dd3e1c", "score": "0.500254", "text": "func NewRequestReader(conf *RequestReaderConfigs) RequestReader {\n\treturn &request{}\n}", "title": "" }, { "docid": "6090e35d5830f9eacac304c259ff13b6", "score": "0.49747455", "text": "func NewCreateOracleClusterRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) {\n\tvar err error\n\n\tqueryUrl, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tqueryUrl, err = queryUrl.Parse(fmt.Sprintf(\"/api/v1/oracle/clusters\"))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"POST\", queryUrl.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Content-Type\", contentType)\n\treturn req, nil\n}", "title": "" }, { "docid": "ed81b55348d26ae73c66605017711717", "score": "0.49448362", "text": "func NewUpdateOracleClusterByUuidRequest(server string, uuid string, body UpdateOracleClusterByUuidJSONRequestBody) (*http.Request, error) {\n\tvar bodyReader io.Reader\n\tbuf, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbodyReader = bytes.NewReader(buf)\n\treturn NewUpdateOracleClusterByUuidRequestWithBody(server, uuid, \"application/json\", bodyReader)\n}", "title": "" }, { "docid": "1e359292bb94c8879fe8db2c69849c97", "score": "0.49337676", "text": "func (r *Request) FromJSON(data string) (*Request, error) {\n\tvar req Request\n\terr := json.Unmarshal([]byte(data), &req)\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not deserialise json into Updatejob request: %w\", err)\n\t}\n\n\treturn &req, nil\n}", "title": "" }, { "docid": "0ef428d98485792909b7b34fed739272", "score": "0.4908485", "text": "func NewUpdateMysqlClusterConfigRequest(server string, clusterUuid string, body UpdateMysqlClusterConfigJSONRequestBody) (*http.Request, error) {\n\tvar bodyReader io.Reader\n\tbuf, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbodyReader = bytes.NewReader(buf)\n\treturn NewUpdateMysqlClusterConfigRequestWithBody(server, clusterUuid, \"application/json\", bodyReader)\n}", "title": "" }, { "docid": "f595bab77dd13a60b3c2aee09888e24d", "score": "0.48406288", "text": "func FromJSONReader(r io.Reader) Source {\n\treturn source{SourceTypeJSON, func(fs *FlagSet) map[string]string {\n\t\tvar m map[string]string\n\t\tif err := json.NewDecoder(r).Decode(&m); err != nil {\n\t\t\tpanic(fmt.Sprintf(\"JSON couldn't be decoded: %v\", err))\n\t\t}\n\t\treturn m\n\t}}\n}", "title": "" }, { "docid": "d2d767dd0c1d21bcfcef43cece9c0980", "score": "0.4837796", "text": "func NewUpdateClusterByUuidRequest(server string, uuid string, body UpdateClusterByUuidJSONRequestBody) (*http.Request, error) {\n\tvar bodyReader io.Reader\n\tbuf, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbodyReader = bytes.NewReader(buf)\n\treturn NewUpdateClusterByUuidRequestWithBody(server, uuid, \"application/json\", bodyReader)\n}", "title": "" }, { "docid": "0c1ebf51070463f0d81451061634a98a", "score": "0.48340774", "text": "func (r *ManageReplicationRequest) 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, \"SourceRegistryId\")\n\tdelete(f, \"DestinationRegistryId\")\n\tdelete(f, \"Rule\")\n\tdelete(f, \"Description\")\n\tdelete(f, \"DestinationRegionId\")\n\tdelete(f, \"PeerReplicationOption\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"ManageReplicationRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "cd6eaec7597ca7b4a1a41ccb222a6f73", "score": "0.48336756", "text": "func (c Consumer) CreateClientRequest(client1 pubsubpb.PubSubServiceClient, topic string, startIndex int64, fetchSize int64) {\r\n\r\n\treq := pubsubpb.ConsumeRequest{\r\n\t\tTopic: topic,\r\n\t\tStartIndex: startIndex,\r\n\t\tFetchSize: fetchSize,\r\n\t}\r\n\tc.RpcProcessClient(client1, &req)\r\n}", "title": "" }, { "docid": "3271bbe0d2ee57a8a45e78fe63b558c6", "score": "0.48000115", "text": "func NewFromReader(r io.Reader) (Config, error) {\n\tscanner := bufio.NewScanner(r)\n\tp := &parser{scanner: scanner}\n\treturn parse(p, \"\")\n}", "title": "" }, { "docid": "10083b4d7f1fd5ae488fe845ddba99a7", "score": "0.47818902", "text": "func (r *CreateSupervisorRequest) 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, \"SdkAppId\")\n\tdelete(f, \"Users\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"CreateSupervisorRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "d3d019c7230c4597be4d67057b8fa519", "score": "0.47794032", "text": "func NewCreateMysqlClusterRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) {\n\tvar err error\n\n\tqueryUrl, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tqueryUrl, err = queryUrl.Parse(fmt.Sprintf(\"/api/v1/mysql/clusters\"))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"POST\", queryUrl.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Content-Type\", contentType)\n\treturn req, nil\n}", "title": "" }, { "docid": "1a6a5bf8c50334ab6a298a05d3e024df", "score": "0.47626856", "text": "func NewReader(p ParamReader) (client.Reader, error) {\n\tswitch p.Type {\n\tcase ReaderTypeSG:\n\t\tif p.SGL == nil {\n\t\t\treturn nil, fmt.Errorf(\"SGL is empty while reader type is SGL\")\n\t\t}\n\t\treturn NewSGReader(p.SGL, p.Size, true /* withHash */)\n\tcase ReaderTypeRand:\n\t\treturn NewRandReader(p.Size, true /* withHash */)\n\tcase ReaderTypeInMem:\n\t\treturn NewInMemReader(p.Size, true /* withHash */)\n\tcase ReaderTypeFile:\n\t\treturn NewFileReader(p.Path, p.Name, p.Size, true /* withHash */)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"Unknown memory type for creating inmem reader\")\n\t}\n}", "title": "" }, { "docid": "323c575c82c32975c6061a9150faf6a0", "score": "0.47576615", "text": "func NewJSONRequestParser(in io.Reader, resolver jsonpb.AnyResolver) RequestParser {\n\treturn &jsonRequestParser{\n\t\tdec: json.NewDecoder(in),\n\t\tunmarshaler: jsonpb.Unmarshaler{AnyResolver: resolver},\n\t}\n}", "title": "" }, { "docid": "9beb70ce26c1e55ef85d1a57c8e7f51f", "score": "0.47430283", "text": "func NewReader(r io.Reader) (*Reader, error) {}", "title": "" }, { "docid": "381599ed57cffbd638f8537f7bcb97b2", "score": "0.47284207", "text": "func LoadJSONReader(reader io.Reader, postProcess bool) (*OpenAPI3, error) {\n\tb, err := ioutil.ReadAll(reader)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\toa := new(OpenAPI3)\n\tif err = json.Unmarshal(b, &oa); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif postProcess {\n\t\tif err = oa.PostProcess(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn oa, nil\n}", "title": "" }, { "docid": "bf493d9d7c2ac105ec5b68ffb74ef53d", "score": "0.471307", "text": "func (r *OpenProVersionRequest) 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, \"MachineType\")\n\tdelete(f, \"MachineRegion\")\n\tdelete(f, \"Quuids\")\n\tdelete(f, \"ActivityId\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"OpenProVersionRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "122c921c289e131ad33e865977c6a855", "score": "0.47059175", "text": "func (i *Ingestion) FromReader(ctx context.Context, reader io.Reader, options ...FileOption) (*Result, error) {\n\treturn i.fromReader(ctx, reader, options, i.newProp())\n}", "title": "" }, { "docid": "0db1638bb6b132db053ae34075740e06", "score": "0.46937367", "text": "func NewRequest(method, url string, body io.Reader) (*Request, error) {}", "title": "" }, { "docid": "d7e4f5a14ec22c6c615dacb0a79458ee", "score": "0.46878332", "text": "func (a *SystemInfoResponse) FromReader(i io.Reader) error {\n\tb, err := ioutil.ReadAll(i)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn json.Unmarshal(b, a)\n}", "title": "" }, { "docid": "ce56fc3c88032869452b9753ff4ebc70", "score": "0.46711603", "text": "func (c *Client) NewReader(ctx context.Context, resourceName string) (*Reader, error) {\n\t// readClient is set up for Read(). ReadAt() will copy needed fields into\n\t// its reentrantReader.\n\treadClient, err := c.client.Read(ctx, &pb.ReadRequest{\n\t\tResourceName: resourceName,\n\t}, c.options...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Reader{\n\t\tctx: ctx,\n\t\tc: c,\n\t\tresourceName: resourceName,\n\t\treadClient: readClient,\n\t}, nil\n}", "title": "" }, { "docid": "f9538a8a73264582fffdc31d1f9c056e", "score": "0.4658707", "text": "func (r *PutRequest) Read(input []byte) error {\n\treturn json.Unmarshal(input, r)\n}", "title": "" }, { "docid": "8c6dbbc6ff94fbb6461dee0e60d4921f", "score": "0.46450204", "text": "func parseReq(r io.Reader) (*plugin.CodeGeneratorRequest, error) {\n\tglog.V(2).Info(\"Parsing code generator request\")\n\tinput, err := ioutil.ReadAll(r)\n\tif err != nil {\n\t\tglog.Errorf(\"Failed to read code generator request: %v\", err)\n\t\treturn nil, err\n\t}\n\n\treq := new(plugin.CodeGeneratorRequest)\n\tif err = proto.Unmarshal(input, req); err != nil {\n\t\tglog.Errorf(\"Failed to unmarshal code generator request: %v\", err)\n\t\treturn nil, err\n\t}\n\tglog.V(2).Info(\"Parsed code generator request\")\n\n\treturn req, nil\n}", "title": "" }, { "docid": "40bfbd63029d6f73ded00b7863319dee", "score": "0.46304342", "text": "func (client *ClustersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, body ResourcePatch, options *ClustersClientUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/clusters/{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\", \"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": "6f2f24f76168bbf63b75a532e6976445", "score": "0.46267375", "text": "func (r *ModifyRepositoryRequest) 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, \"RegistryId\")\n\tdelete(f, \"NamespaceName\")\n\tdelete(f, \"RepositoryName\")\n\tdelete(f, \"BriefDescription\")\n\tdelete(f, \"Description\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"ModifyRepositoryRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "e68e070eeb954bfad51cca18b55a7074", "score": "0.4622757", "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": "ab6529f995c082571dded2e151b4f076", "score": "0.4614846", "text": "func FromJSONReader(r io.Reader, ptr interface{}) error {\n\tbuf, err := ioutil.ReadAll(r)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = json.Unmarshal(buf, ptr)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9e1d41781a1afcc6b4d07b404885a8f5", "score": "0.46135342", "text": "func JSONReader(input io.ReadCloser) *JSONParser {\n\tparser := NewJSONParser()\n\tin := make(chan io.ReadCloser, 1)\n\tin <- input\n\tclose(in)\n\n\tparser.In = in\n\n\treturn parser\n}", "title": "" }, { "docid": "75587fbdab02d677cd953d57d1da2482", "score": "0.4584842", "text": "func NewReader(reader io.Reader) *Reader {\n\tif reader == nil {\n\t\treturn nil\n\t}\n\tlr := &Reader{\n\t\tscanner: bufio.NewScanner(reader),\n\t\texistsData: true,\n\t\tawkVars: AWKVars{\n\t\t\tRS: defaultRS,\n\t\t\tFS: defaultFS,\n\t\t},\n\t}\n\n\tlr.scanner.Split(lr.scanLinesBySep)\n\tlr.buffer.Grow(bufferSizeLimit)\n\n\treturn lr\n}", "title": "" }, { "docid": "518e066b575ba27774b6a312039ae5bd", "score": "0.45825598", "text": "func NewReader(r *bufio.Reader) *textproto.Reader", "title": "" }, { "docid": "496b6db2aaa610c5d227500ee71ea171", "score": "0.45810726", "text": "func (r *DescribeOrganizationNodesRequest) 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, \"Limit\")\n\tdelete(f, \"Offset\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"DescribeOrganizationNodesRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "7d886afccf00479c8ddb02ff807ac626", "score": "0.45640466", "text": "func (r *ModifyProVersionRenewFlagRequest) 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, \"RenewFlag\")\n\tdelete(f, \"Quuid\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"ModifyProVersionRenewFlagRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "ee46f32853adc4a2a5029d87389de43b", "score": "0.45513678", "text": "func NewCreateMssqlClusterRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) {\n\tvar err error\n\n\tqueryUrl, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tqueryUrl, err = queryUrl.Parse(fmt.Sprintf(\"/api/v1/mssql/clusters\"))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"POST\", queryUrl.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Content-Type\", contentType)\n\treturn req, nil\n}", "title": "" }, { "docid": "4a2061d1da587c9a69b6a34b8ec2bcad", "score": "0.45444965", "text": "func (client *KubernetesClustersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, kubernetesClusterName string, kubernetesClusterUpdateParameters KubernetesClusterPatchParameters, options *KubernetesClustersClientBeginUpdateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/kubernetesClusters/{kubernetesClusterName}\"\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\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, kubernetesClusterUpdateParameters); err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "3213de8a4a7bcd5058fc9e0bfcf4403f", "score": "0.45361835", "text": "func (r *ModifyInstanceRequest) 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, \"RegistryId\")\n\tdelete(f, \"RegistryType\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"ModifyInstanceRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "695dab6e871bec2698df07e35c1b8e3c", "score": "0.45297822", "text": "func NewRequestFromBytes(r io.Reader) (req *Request, err error) {\n\tvar serverName, apiName string\n\tvar args []byte\n\tif serverName, err = bytes.ReadStringWithLength32(r); err != nil {\n\t\treturn\n\t}\n\tif apiName, err = bytes.ReadStringWithLength32(r); err != nil {\n\t\treturn\n\t}\n\tif args, err = bytes.ReadBytesWithLength32(r); err != nil {\n\t\treturn\n\t}\n\treq = NewRequest(serverName, apiName, args)\n\treturn\n}", "title": "" }, { "docid": "00bcf1926a25ecbc729ff2f3968ff067", "score": "0.45282623", "text": "func NewUpdateOracleClusterByUuidRequestWithBody(server string, uuid string, contentType string, body io.Reader) (*http.Request, error) {\n\tvar err error\n\n\tvar pathParam0 string\n\n\tpathParam0, err = runtime.StyleParam(\"simple\", false, \"uuid\", uuid)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryUrl, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tqueryUrl, err = queryUrl.Parse(fmt.Sprintf(\"/api/v1/oracle/clusters/%s\", pathParam0))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"PUT\", queryUrl.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Content-Type\", contentType)\n\treturn req, nil\n}", "title": "" }, { "docid": "ca1921690e70d77e6b90cd0d05fad33a", "score": "0.45196676", "text": "func FromJSONReader(data io.Reader, v interface{}) error {\n\tif data == nil {\n\t\treturn errors.New(\"jsonFile nail\")\n\t}\n\n\tjsonDecoder := json.NewDecoder(data)\n\treturn jsonDecoder.Decode(v)\n}", "title": "" }, { "docid": "f0b52a4a123ee4ff03cfc969cc2a9a89", "score": "0.45100895", "text": "func (r *ModifySecurityPolicyRequest) 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, \"RegistryId\")\n\tdelete(f, \"PolicyIndex\")\n\tdelete(f, \"CidrBlock\")\n\tdelete(f, \"Description\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"ModifySecurityPolicyRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "3ae5b82cd0c14452c7b365fa5281e155", "score": "0.45087707", "text": "func newUpdateClusterUpdateClusterRequest(ctx context.Context, f *Cluster, c *Client) (map[string]interface{}, error) {\n\treq := map[string]interface{}{}\n\n\tif v := f.Labels; !dcl.IsEmptyValueIndirect(v) {\n\t\treq[\"labels\"] = v\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "90dc9b59c40278e3eb90b7c7308e2f1d", "score": "0.45041865", "text": "func NewReader(location, topic string) *Reader {\n\treturn &Reader{\n\t\treader: segkafka.NewReader(segkafka.ReaderConfig{\n\t\t\tBrokers: []string{location},\n\t\t\tGroupID: \"ether\",\n\t\t\tTopic: topic,\n\t\t\tMinBytes: 1,\n\t\t\tMaxBytes: 10e6,\n\t\t}),\n\t}\n}", "title": "" }, { "docid": "f4527030f35180a910ba6c7dadbd2cb4", "score": "0.45008197", "text": "func NewReader(cfg *Config) (r *Reader, err error) {\n\terr = cfg.valid()\n\tif err != nil {\n\t\treturn r, errors.Trace(err)\n\t}\n\n\tr = &Reader{\n\t\tcfg: cfg,\n\t\tstop: make(chan struct{}),\n\t\tmsgs: make(chan *Message, cfg.getMessageBufferSize()),\n\t\tclusterID: cfg.ClusterID,\n\t}\n\n\tconf := sarama.NewConfig()\n\t// set to 10 minutes to prevent i/o timeout when reading huge message\n\tconf.Net.ReadTimeout = KafkaReadTimeout\n\tif cfg.SaramaBufferSize > 0 {\n\t\tconf.ChannelBufferSize = cfg.SaramaBufferSize\n\t}\n\n\tr.client, err = sarama.NewClient(r.cfg.KafkaAddr, conf)\n\tif err != nil {\n\t\terr = errors.Trace(err)\n\t\tr = nil\n\t\treturn\n\t}\n\n\tif r.cfg.CommitTS > 0 {\n\t\tr.cfg.Offset, err = r.getOffsetByTS(r.cfg.CommitTS, conf)\n\t\tif err != nil {\n\t\t\terr = errors.Trace(err)\n\t\t\tr = nil\n\t\t\treturn\n\t\t}\n\t\tlog.Debug(\"set offset to\", zap.Int64(\"offset\", r.cfg.Offset))\n\t}\n\n\tgo r.run()\n\n\treturn\n}", "title": "" }, { "docid": "a4f97c359496b14b4c536a232a644789", "score": "0.4500376", "text": "func NewCreateMssqlClusterRequest(server string, body CreateMssqlClusterJSONRequestBody) (*http.Request, error) {\n\tvar bodyReader io.Reader\n\tbuf, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbodyReader = bytes.NewReader(buf)\n\treturn NewCreateMssqlClusterRequestWithBody(server, \"application/json\", bodyReader)\n}", "title": "" }, { "docid": "226883e12d1b7ff3925543d8a5d00a30", "score": "0.44976106", "text": "func (r *SetDrmKeyProviderInfoRequest) 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, \"SDMCInfo\")\n\tdelete(f, \"SubAppId\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"SetDrmKeyProviderInfoRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "4684d41026f8d0f4ecb8eb405ced0697", "score": "0.4496769", "text": "func ClusterFromBytes(data []byte, main *cfg.Config) (*ProvidedConfig, error) {\n\tc := newDefaultCluster()\n\tif err := yaml.Unmarshal(data, c); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to parse cluster: %v\", err)\n\t}\n\n\tif err := c.ValidateInputs(); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to validate cluster: %v\", err)\n\t}\n\n\tif err := c.Load(main); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn c, nil\n}", "title": "" }, { "docid": "9fd25c2776a21660f07d6e4ea78582ef", "score": "0.4492266", "text": "func InstallationsFromReader(reader io.Reader) ([]*Installation, error) {\n\tinstallations := []*Installation{}\n\tdecoder := json.NewDecoder(reader)\n\n\terr := decoder.Decode(&installations)\n\tif err != nil && err != io.EOF {\n\t\treturn nil, err\n\t}\n\n\treturn installations, nil\n}", "title": "" }, { "docid": "d2303b5a5abab5b2d71caf748e61b8b8", "score": "0.44892332", "text": "func (cc *ClientCommander) NewPutRequest(path string, contentFormat MediaType, body io.Reader) (Message, error) {\n\treturn cc.newPostPutRequest(path, contentFormat, body, PUT)\n}", "title": "" }, { "docid": "a5a66459762cab6533c06566ab116ca2", "score": "0.44873023", "text": "func (r *ModifyPersonSampleRequest) 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, \"PersonId\")\n\tdelete(f, \"SubAppId\")\n\tdelete(f, \"Name\")\n\tdelete(f, \"Description\")\n\tdelete(f, \"Usages\")\n\tdelete(f, \"FaceOperationInfo\")\n\tdelete(f, \"TagOperationInfo\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"ModifyPersonSampleRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "e452623c51e5a9b76124fb7f70c8da04", "score": "0.44855577", "text": "func (client *ClustersClient) createCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, body Cluster, options *ClustersClientBeginCreateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/clusters/{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\", \"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": "be6f6c0c894f966986eaf65a17789c52", "score": "0.44845268", "text": "func (r *ModifyAutoOpenProVersionConfigRequest) 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, \"Status\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"ModifyAutoOpenProVersionConfigRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "557439e999afe3bf7d08045608969e74", "score": "0.44767952", "text": "func (r *CreateReplicationInstanceRequest) 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, \"RegistryId\")\n\tdelete(f, \"ReplicationRegionId\")\n\tdelete(f, \"ReplicationRegionName\")\n\tdelete(f, \"SyncTag\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"CreateReplicationInstanceRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "d61fc9d90e2ea015c93ff8ea2e276197", "score": "0.44709957", "text": "func NewUpdateClusterByUuidRequestWithBody(server string, uuid string, contentType string, body io.Reader) (*http.Request, error) {\n\tvar err error\n\n\tvar pathParam0 string\n\n\tpathParam0, err = runtime.StyleParam(\"simple\", false, \"uuid\", uuid)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryUrl, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tqueryUrl, err = queryUrl.Parse(fmt.Sprintf(\"/api/v1/mysql/clusters/%s\", pathParam0))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"PUT\", queryUrl.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Content-Type\", contentType)\n\treturn req, nil\n}", "title": "" }, { "docid": "48d2ef290d523edd616172706c9b5234", "score": "0.44706506", "text": "func (c *InputService26ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "b159b9fffe3a34242644382736530dde", "score": "0.4467635", "text": "func NewReadRequest(param ...interface{}) (request *ReadRequest, err error) {\n\tif len(param) == 0 {\n\t\treturn nil, errors.New(\"not enough parameters for NewReadRequest\")\n\t}\n\tswitch param[0].(type) {\n\tcase *StoreRequest:\n\t\tsr := param[0].(*StoreRequest)\n\t\trequest, err = createNewReadRequestCommon(&sr.commonRequest)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\trequest.commonRequest.adabasMap = sr.commonRequest.adabasMap\n\t\trequest.commonRequest.MapName = sr.commonRequest.MapName\n\t\trequest.commonRequest.dynamic = nil\n\t\trequest.commonRequest.definition = adatypes.NewDefinitionClone(sr.commonRequest.definition)\n\t\treturn\n\tcase *commonRequest:\n\t\tcr := param[0].(*commonRequest)\n\t\treturn createNewReadRequestCommon(cr)\n\tcase *Adabas:\n\t\tada := param[0].(*Adabas)\n\t\tswitch p := param[1].(type) {\n\t\tcase string:\n\t\t\treturn createNewMapReadRequest(p, ada)\n\t\tcase *Map:\n\t\t\treturn createNewMapPointerReadRequest(ada, p)\n\t\tcase Fnr:\n\t\t\treturn createNewReadRequestAdabas(ada, p), nil\n\t\tcase int:\n\t\t\treturn createNewReadRequestAdabas(ada, Fnr(p)), nil\n\t\t}\n\tcase string:\n\t\tmapName := param[0].(string)\n\t\tif len(param) < 2 {\n\t\t\treturn nil, errors.New(\"not enough parameters for NewReadRequest\")\n\t\t}\n\t\tada := param[1].(*Adabas)\n\t\tif len(param) == 2 {\n\t\t\treturn createNewMapReadRequest(mapName, ada)\n\t\t}\n\t\trep := param[2].(*Repository)\n\t\treturn createNewMapReadRequestRepo(mapName, ada, rep)\n\tdefault:\n\t\tti := reflect.TypeOf(param[0])\n\t\tif ti.Kind() == reflect.Ptr {\n\t\t\tadatypes.Central.Log.Debugf(\"It's a pointer %s\", ti.Name())\n\t\t\tti = ti.Elem()\n\t\t}\n\t\tif ti.Kind() == reflect.Struct {\n\t\t\tadatypes.Central.Log.Debugf(\"It's a struct %s\", ti.Name())\n\t\t\tmapName := ti.Name()\n\t\t\tif len(param) < 2 {\n\t\t\t\treturn nil, errors.New(\"not enough parameters for NewReadRequest\")\n\t\t\t}\n\t\t\tada := param[1].(*Adabas)\n\t\t\tif len(param) == 2 {\n\t\t\t\trequest, err = createNewMapReadRequest(mapName, ada)\n\t\t\t} else {\n\t\t\t\trep := param[2].(*Repository)\n\t\t\t\trequest, err = createNewMapReadRequestRepo(mapName, ada, rep)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\tadatypes.Central.Log.Debugf(\"Error creating dynamic read request: %v\", err)\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tadatypes.Central.Log.Debugf(\"Success creating dynamic read request: %v\", param[0])\n\t\t\trequest.createDynamic(param[0])\n\t\t\tadatypes.Central.Log.Debugf(\"Create dynamic %v\", request.dynamic)\n\t\t\treturn\n\t\t}\n\t\tadatypes.Central.Log.Errorf(\"Unknown request parameter: %v %T\", reflect.TypeOf(param[0]).Kind(), param[0])\n\t}\n\treturn nil, adatypes.NewGenericError(73)\n}", "title": "" }, { "docid": "342e9ebb29b7ca4364cc25566c2405ab", "score": "0.4467514", "text": "func (r *ModifyOwnerIntlBatchRequest) 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, \"Domains\")\n\tdelete(f, \"ToUin\")\n\tdelete(f, \"DnsTransfer\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"ModifyOwnerIntlBatchRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "b36a86e823ae6cc1e2e59e408257eb72", "score": "0.44671595", "text": "func (r *UpdateOrganizationNodeRequest) 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, \"NodeId\")\n\tdelete(f, \"Name\")\n\tdelete(f, \"Remark\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"UpdateOrganizationNodeRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "643671a03cb5ceb397e0869b6ede0fbe", "score": "0.4464699", "text": "func (r *DescribeAsyncRequestInfoRequest) 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, \"AsyncRequestId\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"DescribeAsyncRequestInfoRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "c23d6342b7aed4fc852d9270f48c76a1", "score": "0.44594574", "text": "func NewRequest(method, target string, body io.Reader) *http.Request {}", "title": "" }, { "docid": "9270401eed15de5ccc5b068cf7045363", "score": "0.4458491", "text": "func (c *InputService6ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "title": "" }, { "docid": "34050e84ba034b3be6612eb699bce079", "score": "0.44576877", "text": "func (r *CreateCCReqLimitPolicyRequest) 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, \"InstanceId\")\n\tdelete(f, \"Ip\")\n\tdelete(f, \"Protocol\")\n\tdelete(f, \"Domain\")\n\tdelete(f, \"Policy\")\n\tdelete(f, \"IsGlobal\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"CreateCCReqLimitPolicyRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "5e3555e0f0efea4cb5118a639450ad28", "score": "0.44564086", "text": "func FromReader(r io.Reader) (*HostPool, error) {\n\tpool := HostPool{}\n\tdec := xml.NewDecoder(r)\n\tif err := dec.Decode(&pool); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &pool, nil\n}", "title": "" }, { "docid": "63b9f4baac482685d9a2167390ef6795", "score": "0.44547442", "text": "func (r *CreateOpenPortTaskRequest) 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, \"Uuid\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"CreateOpenPortTaskRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "3793e28e2bdd85b74c81a60aacca9ddd", "score": "0.44544676", "text": "func Deserialize(input []byte) (*Request, error) {\n\tvar message = &Request{}\n\terr := json.Unmarshal(input, message)\n\treturn message, err\n}", "title": "" }, { "docid": "d5eac10bfff502f730eaeb13065ca114", "score": "0.44537953", "text": "func (r *AssignProjectRequest) 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, \"InstanceIds\")\n\tdelete(f, \"ProjectId\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"AssignProjectRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "f171664e3e34a16abdcf114722ca4afe", "score": "0.44530708", "text": "func (r *Request) FromJSON(data string) (*Request, error) {\n\tvar req Request\n\terr := json.Unmarshal([]byte(data), &req)\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not deserialise json into Update request: %w\", err)\n\t}\n\n\treturn &req, nil\n}", "title": "" }, { "docid": "bf92773cba82bc8eb602b234af71ac1e", "score": "0.44529894", "text": "func parseRequest(reader *bufio.Reader) (*Request, os.Error) {\n\n var r = textproto.NewReader(reader)\n\n // create new request object\n request := new(Request)\n\n methodLine, _ := r.ReadLine()\n methodLineElements := strings.Split(methodLine, \" \")\n \n if (len(methodLineElements) != 3) {\n return request, os.NewError(\"Invalid request\")\n }\n\n request.Method = methodLineElements[0]\n\n if methodLineElements[1] == \"/\" {\n request.Path = \"index.html\"\n } else {\n request.Path = methodLineElements[1]\n }\n request.HTTPVersion = methodLineElements[2]\n return request, nil\n}", "title": "" }, { "docid": "2041a6c565afd0c533bdbb1158c87f31", "score": "0.44449982", "text": "func (r *ModifyInstanceTokenRequest) 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, \"TokenId\")\n\tdelete(f, \"RegistryId\")\n\tdelete(f, \"Enable\")\n\tdelete(f, \"Desc\")\n\tdelete(f, \"ModifyFlag\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"ModifyInstanceTokenRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "1e000779f63d489d78c3e62007bd572c", "score": "0.44414964", "text": "func ValidProvisionClusterRequest(request *grpc_provisioner_go.ProvisionClusterRequest) derrors.Error {\n\tif request.RequestId == \"\" {\n\t\treturn derrors.NewInvalidArgumentError(\"request_id must be set\")\n\t}\n\tif request.IsManagementCluster {\n\t\treturn derrors.NewInvalidArgumentError(\"you can only provision and install application clusters\")\n\t}\n\tif request.OrganizationId == \"\" {\n\t\treturn derrors.NewInvalidArgumentError(\"organization_id must be set\")\n\t}\n\tif request.NumNodes <= 0 {\n\t\treturn derrors.NewInvalidArgumentError(\"num_nodes must be positive\")\n\t}\n\tif request.NodeType == \"\" {\n\t\treturn derrors.NewInvalidArgumentError(\"node_type must be set\")\n\t}\n\tif request.TargetPlatform == grpc_installer_go.Platform_AZURE && request.AzureCredentials == nil {\n\t\treturn derrors.NewInvalidArgumentError(\"azure_credentials must be set when type is Azure\")\n\t}\n\tif request.TargetPlatform == grpc_installer_go.Platform_AZURE && request.AzureOptions == nil {\n\t\treturn derrors.NewInvalidArgumentError(\"azure_options must be set when type is Azure\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "82a1d29f80a7e9a195fdcfa3b9ae5602", "score": "0.44412792", "text": "func NewMessageReader(r io.Reader) *MessageReader {\n\treturn (*MessageReader)(json.NewDecoder(r))\n}", "title": "" }, { "docid": "941e2b075e9c7898c531b2dc22f91e98", "score": "0.4441072", "text": "func newClusterCreateRequest(config *gkev1.GKEClusterConfig) *gkeapi.CreateClusterRequest {\n\n\tenableKubernetesAlpha := config.Spec.EnableKubernetesAlpha != nil && *config.Spec.EnableKubernetesAlpha\n\trequest := &gkeapi.CreateClusterRequest{\n\t\tCluster: &gkeapi.Cluster{\n\t\t\tName: config.Spec.ClusterName,\n\t\t\tDescription: config.Spec.Description,\n\t\t\tResourceLabels: config.Spec.Labels,\n\t\t\tInitialClusterVersion: *config.Spec.KubernetesVersion,\n\t\t\tEnableKubernetesAlpha: enableKubernetesAlpha,\n\t\t\tClusterIpv4Cidr: *config.Spec.ClusterIpv4CidrBlock,\n\t\t\tLoggingService: *config.Spec.LoggingService,\n\t\t\tMonitoringService: *config.Spec.MonitoringService,\n\t\t\tIpAllocationPolicy: &gkeapi.IPAllocationPolicy{\n\t\t\t\tClusterIpv4CidrBlock: config.Spec.IPAllocationPolicy.ClusterIpv4CidrBlock,\n\t\t\t\tClusterSecondaryRangeName: config.Spec.IPAllocationPolicy.ClusterSecondaryRangeName,\n\t\t\t\tCreateSubnetwork: config.Spec.IPAllocationPolicy.CreateSubnetwork,\n\t\t\t\tNodeIpv4CidrBlock: config.Spec.IPAllocationPolicy.NodeIpv4CidrBlock,\n\t\t\t\tServicesIpv4CidrBlock: config.Spec.IPAllocationPolicy.ServicesIpv4CidrBlock,\n\t\t\t\tServicesSecondaryRangeName: config.Spec.IPAllocationPolicy.ServicesSecondaryRangeName,\n\t\t\t\tSubnetworkName: config.Spec.IPAllocationPolicy.SubnetworkName,\n\t\t\t\tUseIpAliases: config.Spec.IPAllocationPolicy.UseIPAliases,\n\t\t\t},\n\t\t\tAddonsConfig: &gkeapi.AddonsConfig{},\n\t\t\tNodePools: []*gkeapi.NodePool{},\n\t\t\tLocations: config.Spec.Locations,\n\t\t\tMaintenancePolicy: &gkeapi.MaintenancePolicy{},\n\t\t},\n\t}\n\n\tif *config.Spec.MaintenanceWindow != \"\" {\n\t\trequest.Cluster.MaintenancePolicy.Window = &gkeapi.MaintenanceWindow{\n\t\t\tDailyMaintenanceWindow: &gkeapi.DailyMaintenanceWindow{\n\t\t\t\tStartTime: *config.Spec.MaintenanceWindow,\n\t\t\t},\n\t\t}\n\t}\n\n\taddons := config.Spec.ClusterAddons\n\trequest.Cluster.AddonsConfig.HttpLoadBalancing = &gkeapi.HttpLoadBalancing{Disabled: !addons.HTTPLoadBalancing}\n\trequest.Cluster.AddonsConfig.HorizontalPodAutoscaling = &gkeapi.HorizontalPodAutoscaling{Disabled: !addons.HorizontalPodAutoscaling}\n\trequest.Cluster.AddonsConfig.NetworkPolicyConfig = &gkeapi.NetworkPolicyConfig{Disabled: !addons.NetworkPolicyConfig}\n\n\trequest.Cluster.NodePools = make([]*gkeapi.NodePool, 0, len(config.Spec.NodePools))\n\n\tfor _, np := range config.Spec.NodePools {\n\t\tnodePool := newGKENodePoolFromConfig(&np, config)\n\t\trequest.Cluster.NodePools = append(request.Cluster.NodePools, nodePool)\n\t}\n\n\tif config.Spec.MasterAuthorizedNetworksConfig != nil {\n\t\tblocks := make([]*gkeapi.CidrBlock, len(config.Spec.MasterAuthorizedNetworksConfig.CidrBlocks))\n\t\tfor _, b := range config.Spec.MasterAuthorizedNetworksConfig.CidrBlocks {\n\t\t\tblocks = append(blocks, &gkeapi.CidrBlock{\n\t\t\t\tCidrBlock: b.CidrBlock,\n\t\t\t\tDisplayName: b.DisplayName,\n\t\t\t})\n\t\t}\n\t\trequest.Cluster.MasterAuthorizedNetworksConfig = &gkeapi.MasterAuthorizedNetworksConfig{\n\t\t\tEnabled: config.Spec.MasterAuthorizedNetworksConfig.Enabled,\n\t\t\tCidrBlocks: blocks,\n\t\t}\n\t}\n\n\tif config.Spec.Network != nil {\n\t\trequest.Cluster.Network = *config.Spec.Network\n\t}\n\tif config.Spec.Subnetwork != nil {\n\t\trequest.Cluster.Subnetwork = *config.Spec.Subnetwork\n\t}\n\n\tif config.Spec.NetworkPolicyEnabled != nil {\n\t\trequest.Cluster.NetworkPolicy = &gkeapi.NetworkPolicy{\n\t\t\tEnabled: *config.Spec.NetworkPolicyEnabled,\n\t\t}\n\t}\n\n\tif config.Spec.PrivateClusterConfig != nil {\n\t\trequest.Cluster.PrivateClusterConfig = &gkeapi.PrivateClusterConfig{\n\t\t\tEnablePrivateEndpoint: config.Spec.PrivateClusterConfig.EnablePrivateEndpoint,\n\t\t\tEnablePrivateNodes: config.Spec.PrivateClusterConfig.EnablePrivateNodes,\n\t\t\tMasterIpv4CidrBlock: config.Spec.PrivateClusterConfig.MasterIpv4CidrBlock,\n\t\t}\n\t}\n\n\treturn request\n}", "title": "" }, { "docid": "1efb34c456484f6bd9c436ecb48192bb", "score": "0.44407257", "text": "func (r *CreateOrganizationMemberRequest) 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, \"Name\")\n\tdelete(f, \"PolicyType\")\n\tdelete(f, \"PermissionIds\")\n\tdelete(f, \"NodeId\")\n\tdelete(f, \"AccountName\")\n\tdelete(f, \"Remark\")\n\tdelete(f, \"RecordId\")\n\tdelete(f, \"PayUin\")\n\tdelete(f, \"IdentityRoleID\")\n\tdelete(f, \"AuthRelationId\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"CreateOrganizationMemberRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "17fd1a606778598d7168c7eaff79fbbf", "score": "0.44355947", "text": "func NewReader(r io.Reader) Reader { return &reader{buf: bufio.NewReader(r)} }", "title": "" }, { "docid": "7c0e178901392710dce9dda533f171b3", "score": "0.44319326", "text": "func (r *CreateRepositoryRequest) 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, \"RegistryId\")\n\tdelete(f, \"NamespaceName\")\n\tdelete(f, \"RepositoryName\")\n\tdelete(f, \"BriefDescription\")\n\tdelete(f, \"Description\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"CreateRepositoryRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" }, { "docid": "e502dab48f3c1b0c594a6e19bec3060d", "score": "0.44249195", "text": "func (o *CreateClusterParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tr.SetTimeout(o.timeout)\n\tvar res []error\n\n\tif o.Cluster == nil {\n\t\to.Cluster = new(models.NewCluster)\n\t}\n\n\tif err := r.SetBodyParam(o.Cluster); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "08ec377de2c765981f915a114224bbcc", "score": "0.44217455", "text": "func newVBlockFromReader(r io.Reader) (*VBlock, error) {\n\t// Deserialize the bytes into a MsgBlock.\n\tvar msgvBlock protos.MsgVBlock\n\terr := msgvBlock.Deserialize(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tb := VBlock{\n\t\tmsgvBlock: &msgvBlock,\n\t}\n\treturn &b, nil\n}", "title": "" }, { "docid": "0d37bed4829f16713fca32a1bbcde96c", "score": "0.4414934", "text": "func (r *ManageExternalEndpointRequest) 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, \"RegistryId\")\n\tdelete(f, \"Operation\")\n\tif len(f) > 0 {\n\t\treturn tcerr.NewTencentCloudSDKError(\"ClientError.BuildRequestError\", \"ManageExternalEndpointRequest has unknown keys!\", \"\")\n\t}\n\treturn json.Unmarshal([]byte(s), &r)\n}", "title": "" } ]
eb758ae8afa51e82ecdfe043814387b7
NewPutDevicesAircubesIDWirelessForbidden creates a PutDevicesAircubesIDWirelessForbidden with default headers values
[ { "docid": "1e67b4483e7a868dc11991c536c2043e", "score": "0.7280159", "text": "func NewPutDevicesAircubesIDWirelessForbidden() *PutDevicesAircubesIDWirelessForbidden {\n\treturn &PutDevicesAircubesIDWirelessForbidden{}\n}", "title": "" } ]
[ { "docid": "ca0d4e269f851e35debe9fbe88889522", "score": "0.5916941", "text": "func NewForbidden(messages ...string) *Forbidden {\n\treturn &Forbidden{\n\t\thttpError{\n\t\t\thttp.StatusForbidden,\n\t\t\tnew(\"Forbidden.\", messages...),\n\t\t},\n\t}\n}", "title": "" }, { "docid": "86cdee966fada0bd7960db12c6d14ae5", "score": "0.57899475", "text": "func NewPutTodosForbidden() *PutTodosForbidden {\n\treturn &PutTodosForbidden{}\n}", "title": "" }, { "docid": "5900e6a2587a873593c1cd9e90078aed", "score": "0.55268854", "text": "func NewRegisterForbidden() *RegisterForbidden {\n\treturn &RegisterForbidden{}\n}", "title": "" }, { "docid": "42cf1c2585329d06010530c2020bbcca", "score": "0.5514162", "text": "func NewGetDevicesAirmaxesIDConfigWirelessForbidden() *GetDevicesAirmaxesIDConfigWirelessForbidden {\n\treturn &GetDevicesAirmaxesIDConfigWirelessForbidden{}\n}", "title": "" }, { "docid": "1a1ef4fcb031c3adb0365602d95b5a4d", "score": "0.5498528", "text": "func NewGetDevicesForbidden() *GetDevicesForbidden {\n\treturn &GetDevicesForbidden{}\n}", "title": "" }, { "docid": "1d10bc9297f4106e5e02cdf71c5c4fb9", "score": "0.5461793", "text": "func NewRegisterUsingPUT2Forbidden() *RegisterUsingPUT2Forbidden {\n\treturn &RegisterUsingPUT2Forbidden{}\n}", "title": "" }, { "docid": "665f64fbcbed659c439be16fcab33795", "score": "0.5437481", "text": "func NewWeaviateThingsPatchForbidden() *WeaviateThingsPatchForbidden {\n\n\treturn &WeaviateThingsPatchForbidden{}\n}", "title": "" }, { "docid": "4cae54c96aef199e419ea231c1b8afa9", "score": "0.53931856", "text": "func NewWeaviateThingsCreateForbidden() *WeaviateThingsCreateForbidden {\n\treturn &WeaviateThingsCreateForbidden{}\n}", "title": "" }, { "docid": "24af4a4d06ec2f1b6c2a26220df0a125", "score": "0.5333089", "text": "func NewPutDevicesAircubesIDWirelessUnauthorized() *PutDevicesAircubesIDWirelessUnauthorized {\n\treturn &PutDevicesAircubesIDWirelessUnauthorized{}\n}", "title": "" }, { "docid": "2c837a023c6cf8aea6e690cacb95b464", "score": "0.5309911", "text": "func NewThingsPatchForbidden() *ThingsPatchForbidden {\n\n\treturn &ThingsPatchForbidden{}\n}", "title": "" }, { "docid": "c6b572df0d5918134a0bc6dbdf4ef581", "score": "0.5306541", "text": "func NewNewCallForbidden() *NewCallForbidden {\n\treturn &NewCallForbidden{}\n}", "title": "" }, { "docid": "b94f64879657c9cb4a7a93e05f6447bb", "score": "0.53056806", "text": "func NewPutPruebaForbidden() *PutPruebaForbidden {\n\n\treturn &PutPruebaForbidden{}\n}", "title": "" }, { "docid": "42c736b46374e9fa3b40b73357f707be", "score": "0.5291523", "text": "func Forbidden(format string, v ...interface{}) *Error {\n\treturn New(http.StatusForbidden, fmt.Sprintf(format, v...))\n}", "title": "" }, { "docid": "ed1229472e3bced367ce99a4bd2d4aa5", "score": "0.5246909", "text": "func Forbidden(err *APIError) *APIError {\n\treturn NewAPIError(http.StatusForbidden, \"FORBIDDEN\", Params{})\n}", "title": "" }, { "docid": "f2c39a3d6d713c0523bf6f97003b20d0", "score": "0.52264136", "text": "func NewThingsUpdateForbidden() *ThingsUpdateForbidden {\n\n\treturn &ThingsUpdateForbidden{}\n}", "title": "" }, { "docid": "19217b12acd95ab0d6adbb30b33050d7", "score": "0.5220135", "text": "func NewGetDevicesUnknownForbidden() *GetDevicesUnknownForbidden {\n\treturn &GetDevicesUnknownForbidden{}\n}", "title": "" }, { "docid": "eb1ddea1f080e69d2f12570bd457acbe", "score": "0.5217901", "text": "func NewPutDevicesAircubesIDWirelessBadRequest() *PutDevicesAircubesIDWirelessBadRequest {\n\treturn &PutDevicesAircubesIDWirelessBadRequest{}\n}", "title": "" }, { "docid": "4a51f2b1a906ab696d75c0abb14ef741", "score": "0.5211769", "text": "func NewPutDevicesAirmaxesIDSystemUsersForbidden() *PutDevicesAirmaxesIDSystemUsersForbidden {\n\treturn &PutDevicesAirmaxesIDSystemUsersForbidden{}\n}", "title": "" }, { "docid": "915287754b0319ff0c7fcc4f23eeb6df", "score": "0.5196615", "text": "func NewGetPlatformsForbidden() *GetPlatformsForbidden {\n\treturn &GetPlatformsForbidden{}\n}", "title": "" }, { "docid": "07b0c03ae258fc05583df3744c0f1013", "score": "0.51923746", "text": "func NewQueryForbiddenInfoListCommonRequestWithoutParam() *QueryForbiddenInfoListCommonRequest {\n\n return &QueryForbiddenInfoListCommonRequest{\n JDCloudRequest: core.JDCloudRequest{\n URL: \"/forbiddenInfoCommon:query\",\n Method: \"POST\",\n Header: nil,\n Version: \"v1\",\n },\n }\n}", "title": "" }, { "docid": "47ac7e99d272ac9a3ebb761436dbf4e4", "score": "0.51608616", "text": "func NewPutWorkspaceForbidden() *PutWorkspaceForbidden {\n\treturn &PutWorkspaceForbidden{}\n}", "title": "" }, { "docid": "9c3974fc483bb035bda04cd92039cdc7", "score": "0.51603246", "text": "func NewCreateModelRegistryForbidden() *CreateModelRegistryForbidden {\n\treturn &CreateModelRegistryForbidden{}\n}", "title": "" }, { "docid": "af93ae1656b987f0f88e965abc153e0a", "score": "0.5156816", "text": "func NewSyncTagsForbidden() *SyncTagsForbidden {\n\treturn &SyncTagsForbidden{}\n}", "title": "" }, { "docid": "a08b8d99ed1506f82d7215fe90fa2f26", "score": "0.5148776", "text": "func NewUnimplementedForbidden() *UnimplementedForbidden {\n\treturn &UnimplementedForbidden{}\n}", "title": "" }, { "docid": "607e11df65169b7ad974d8e3fc128c04", "score": "0.5139664", "text": "func NewAddOrderForbidden() *AddOrderForbidden {\n\n\treturn &AddOrderForbidden{}\n}", "title": "" }, { "docid": "6a0d947393b149dd8d363fe79ccec00e", "score": "0.5126465", "text": "func Forbidden(id, format string, a ...interface{}) error {\n\treturn errors.Forbidden(id, format, a...)\n}", "title": "" }, { "docid": "ce432e571d2c1d352d71b0105cdcbbaa", "score": "0.51224846", "text": "func NewChannelsPatchForbidden() *ChannelsPatchForbidden {\n\treturn &ChannelsPatchForbidden{}\n}", "title": "" }, { "docid": "0743a6edb9e0baf00c6ab820f565e748", "score": "0.50938517", "text": "func NewDeleteAllowedRegistryForbidden() *DeleteAllowedRegistryForbidden {\n\treturn &DeleteAllowedRegistryForbidden{}\n}", "title": "" }, { "docid": "df57b8cc81a41fbcf4a6ce52099f462b", "score": "0.5090308", "text": "func NewMetaForbidden(body MetaForbiddenResponseBody) modules.Forbidden {\n\tv := modules.Forbidden(body)\n\treturn v\n}", "title": "" }, { "docid": "a510f1d9b6f53499b90078c2d04c86f2", "score": "0.50631875", "text": "func NewBulkCreateMockTicketsForbidden() *BulkCreateMockTicketsForbidden {\n\treturn &BulkCreateMockTicketsForbidden{}\n}", "title": "" }, { "docid": "dfa97406175c93246ded96dd4a6141e5", "score": "0.5055072", "text": "func NewGetV1DevicesForbidden() *GetV1DevicesForbidden {\n\n\treturn &GetV1DevicesForbidden{}\n}", "title": "" }, { "docid": "477f41cef875a5e2842f077cea1363d7", "score": "0.50514394", "text": "func NewWeaviateCommandsPatchForbidden() *WeaviateCommandsPatchForbidden {\n\treturn &WeaviateCommandsPatchForbidden{}\n}", "title": "" }, { "docid": "986d2b7d122f66fd9916e6016c8142ab", "score": "0.50484884", "text": "func NewThingsDeleteForbidden() *ThingsDeleteForbidden {\n\treturn &ThingsDeleteForbidden{}\n}", "title": "" }, { "docid": "06ad34ef255665714f208316a6bbc7cf", "score": "0.50361705", "text": "func NewValidateAndDeployWindowsUsingPOSTForbidden() *ValidateAndDeployWindowsUsingPOSTForbidden {\n\treturn &ValidateAndDeployWindowsUsingPOSTForbidden{}\n}", "title": "" }, { "docid": "86581d70a039efb9c0471ce83f4e3993", "score": "0.503295", "text": "func NewCloseForbidden() *CloseForbidden {\n\treturn &CloseForbidden{}\n}", "title": "" }, { "docid": "804383613ca4780a71b1231dbbfb7a93", "score": "0.5008379", "text": "func NewCreateControllerServiceForbidden() *CreateControllerServiceForbidden {\n\treturn &CreateControllerServiceForbidden{}\n}", "title": "" }, { "docid": "ebd80575c65eb4cfe79054a628474a47", "score": "0.5006366", "text": "func NewMediaConnectionCreateForbidden() *MediaConnectionCreateForbidden {\n\treturn &MediaConnectionCreateForbidden{}\n}", "title": "" }, { "docid": "c41a3e8ef115527da39d0e3ec2e80236", "score": "0.50001866", "text": "func Forbidden(err error, w http.ResponseWriter) {\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tw.WriteHeader(http.StatusForbidden)\n\n\tdata := errorMessage{\n\t\tCode: http.StatusForbidden,\n\t\tStatus: http.StatusText(http.StatusForbidden),\n\t\tDetail: err.Error(),\n\t}\n\n\tjson.NewEncoder(w).Encode(data)\n}", "title": "" }, { "docid": "7bc2570434c29fb46f79e0c7ea62cf01", "score": "0.49986908", "text": "func NewUpdateRequiredForbidden() *UpdateRequiredForbidden {\n\treturn &UpdateRequiredForbidden{}\n}", "title": "" }, { "docid": "d72522dec932e2c6fcfed3d46caf4dd5", "score": "0.49912822", "text": "func Forbidden(code int, message string, err ...error) error {\n\tif message == \"\" {\n\t\tmessage = http.StatusText(http.StatusForbidden)\n\t}\n\tvar e error\n\tif len(err) > 0 {\n\t\te = err[0]\n\t}\n\treturn &GlobalError{\n\t\tCode: code,\n\t\t// ServiceName: serviceName,\n\t\tMessage: message,\n\t\tStatusCode: http.StatusForbidden,\n\t\tInnerErr: e,\n\t}\n}", "title": "" }, { "docid": "11e524cd2cea5b404e083dd1b88de7d7", "score": "0.49897617", "text": "func Forbidden(msg string) http.HandlerFunc {\n\treturn jsonContent(http.StatusForbidden, &api.ErrorResponse{true, msg})\n}", "title": "" }, { "docid": "c1bd71411fbeeb5a99e652eaa9b05244", "score": "0.4986941", "text": "func NewPutInternalSwitchquotaForbidden() *PutInternalSwitchquotaForbidden {\n\treturn &PutInternalSwitchquotaForbidden{}\n}", "title": "" }, { "docid": "72ec956fb0110f9089d403a1b1c57135", "score": "0.49840927", "text": "func NewPostDeviceForbidden() *PostDeviceForbidden {\n\treturn &PostDeviceForbidden{}\n}", "title": "" }, { "docid": "3adac15e1f43d5d25a4818d770e3bb33", "score": "0.49785516", "text": "func NewAddQuestionToTestForbidden() *AddQuestionToTestForbidden {\n\n\treturn &AddQuestionToTestForbidden{}\n}", "title": "" }, { "docid": "d44b705f7ea4345ae1781e1899f45694", "score": "0.49749595", "text": "func NewDeleteSoftwareComponentForbidden() *DeleteSoftwareComponentForbidden {\n\treturn &DeleteSoftwareComponentForbidden{}\n}", "title": "" }, { "docid": "50a94a3cd8952a884df4730ae9428a43", "score": "0.49614248", "text": "func NewGetDevicesModelsForbidden() *GetDevicesModelsForbidden {\n\treturn &GetDevicesModelsForbidden{}\n}", "title": "" }, { "docid": "f4d4618b3621ae3d5010acc9fcfa2666", "score": "0.49403614", "text": "func NewDataForbidden(body *DataForbiddenResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "766206169e7ffc41e19a7f16f94ff491", "score": "0.49385366", "text": "func NewErrForbidden(message string) error {\n\treturn &ErrorWithStatusCode{\n\t\terror: errors.New(message),\n\t\tstatusCode: http.StatusForbidden,\n\t}\n}", "title": "" }, { "docid": "6a701254af709578bc2402d5b615f1cc", "score": "0.4937226", "text": "func Forbidden(w http.ResponseWriter, msg interface{}) {\n\tWrite(w, http.StatusForbidden, msg)\n}", "title": "" }, { "docid": "7b41ee26fe5e590fd67d5f5066317eda", "score": "0.4918978", "text": "func NewPutCustomFieldForbidden() *PutCustomFieldForbidden {\n\treturn &PutCustomFieldForbidden{}\n}", "title": "" }, { "docid": "50009c6b6e0cd8206784f8d9ea47647f", "score": "0.4914204", "text": "func NewInstallHostForbidden() *InstallHostForbidden {\n\treturn &InstallHostForbidden{}\n}", "title": "" }, { "docid": "a34c61739fa7a6bc4e9963b1de68563c", "score": "0.48974115", "text": "func NewWeaviateKeysGetForbidden() *WeaviateKeysGetForbidden {\n\treturn &WeaviateKeysGetForbidden{}\n}", "title": "" }, { "docid": "a34c61739fa7a6bc4e9963b1de68563c", "score": "0.48974115", "text": "func NewWeaviateKeysGetForbidden() *WeaviateKeysGetForbidden {\n\treturn &WeaviateKeysGetForbidden{}\n}", "title": "" }, { "docid": "0fc2084c137a68fb2e6d55a6310b8870", "score": "0.4886544", "text": "func NewDynamicClientRegistrationForbidden() *DynamicClientRegistrationForbidden {\n\treturn &DynamicClientRegistrationForbidden{}\n}", "title": "" }, { "docid": "a6b89c9593b9eb18ce5780934fe9db66", "score": "0.48589978", "text": "func Forbidden() huma.Response {\n\treturn errorResponse(http.StatusForbidden)\n}", "title": "" }, { "docid": "b6ebae0e1e424cec1a26a73885791515", "score": "0.48543015", "text": "func Forbidden(code, message string, params map[string]string) *IrisError {\n\treturn errorFactory(ERROR_FORBIDDEN, errCode(ERROR_FORBIDDEN, code), message, params)\n}", "title": "" }, { "docid": "4a4f8d741aeeaac271c0fe3439d3a18d", "score": "0.48253232", "text": "func NewPutUsersUserIDCliSecretForbidden() *PutUsersUserIDCliSecretForbidden {\n\treturn &PutUsersUserIDCliSecretForbidden{}\n}", "title": "" }, { "docid": "1a53cb4c4545e4f6f506597255e0495c", "score": "0.48157582", "text": "func NewPutRoomsIDForbidden() *PutRoomsIDForbidden {\n\treturn &PutRoomsIDForbidden{}\n}", "title": "" }, { "docid": "2c8111dc99516fff562d1cfa11fde75e", "score": "0.48013967", "text": "func Forbidden(w http.ResponseWriter, err error) {\n\terrResponse(w, http.StatusForbidden, err)\n}", "title": "" }, { "docid": "5cd731e3801449d47225d9c210dedafe", "score": "0.47998127", "text": "func NewGetListOfFriendsForbidden() *GetListOfFriendsForbidden {\n\treturn &GetListOfFriendsForbidden{}\n}", "title": "" }, { "docid": "7ed7a1cc53786bea671b6960d82e803f", "score": "0.4792188", "text": "func NewAddTagForbidden() *AddTagForbidden {\n\treturn &AddTagForbidden{}\n}", "title": "" }, { "docid": "5daca5b78931147b1429d07f1eb6dee1", "score": "0.47841835", "text": "func NewPutGatewaysIDForbidden() *PutGatewaysIDForbidden {\n\treturn &PutGatewaysIDForbidden{}\n}", "title": "" }, { "docid": "e1ee89530143a79fdc6fe64e2697b480", "score": "0.47831494", "text": "func NewListInfraEnvsForbidden() *ListInfraEnvsForbidden {\n\n\treturn &ListInfraEnvsForbidden{}\n}", "title": "" }, { "docid": "5c0f1628343ba5219c3948c489f3fffe", "score": "0.4780154", "text": "func NewObjectsClassPatchForbidden() *ObjectsClassPatchForbidden {\n\n\treturn &ObjectsClassPatchForbidden{}\n}", "title": "" }, { "docid": "541e76ed09b645395b74dfe4069c0f27", "score": "0.47786763", "text": "func NewUpdateForbidden() *UpdateForbidden {\n\treturn &UpdateForbidden{}\n}", "title": "" }, { "docid": "3f12722400fb71f19bc9b833a0ae5021", "score": "0.47783726", "text": "func Forbidden(msg string) Response {\n\tif msg == \"\" {\n\t\tmsg = \"You are not authorized to perform the requested action.\"\n\t}\n\treturn Response{\n\t\tStatus: http.StatusForbidden,\n\t\tMessage: msg,\n\t}\n}", "title": "" }, { "docid": "a6bf5236ba1c147ff065e8829bff6753", "score": "0.47676173", "text": "func NewUpgradeHeadlessAccountForbidden() *UpgradeHeadlessAccountForbidden {\n\treturn &UpgradeHeadlessAccountForbidden{}\n}", "title": "" }, { "docid": "679b13d57d4cd1b918c2bc1fa5248d68", "score": "0.47643748", "text": "func NewPutTestForbidden() *PutTestForbidden {\n\n\treturn &PutTestForbidden{}\n}", "title": "" }, { "docid": "815e217be86c019edfc916f3bd6dcb94", "score": "0.4764294", "text": "func Forbidden(w http.ResponseWriter) {\n\twriteResponse(w, http.StatusForbidden, errorMsg{ErrorMessage: \"Access Forbidden\"})\n}", "title": "" }, { "docid": "7319b218e318b2f60b99f3b8a5f012c8", "score": "0.4749356", "text": "func NewNetworkCreateForbidden() *NetworkCreateForbidden {\n\treturn &NetworkCreateForbidden{}\n}", "title": "" }, { "docid": "f2062c35158cb85d86caf6bfd088e0c0", "score": "0.4748408", "text": "func NewUpdateFamilyForbidden() *UpdateFamilyForbidden {\n\treturn &UpdateFamilyForbidden{}\n}", "title": "" }, { "docid": "23e444049ea22d236172a2e91ae187e4", "score": "0.47458547", "text": "func NewModifyBandwidthPackageBandwidthRequestWithoutParam() *ModifyBandwidthPackageBandwidthRequest {\n\n return &ModifyBandwidthPackageBandwidthRequest{\n JDCloudRequest: core.JDCloudRequest{\n URL: \"/regions/{regionId}/bandwidthPackages/{bandwidthPackageId}:modifyBandwidthPackageBandwidth\",\n Method: \"PUT\",\n Header: nil,\n Version: \"v1\",\n },\n }\n}", "title": "" }, { "docid": "ac73592c007e0bb7bccefcd00a53fd14", "score": "0.47433248", "text": "func NewPostMessageForbidden(body *PostMessageForbiddenResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "a643d965984a879c3448b7c3e857629e", "score": "0.4732134", "text": "func NewReplicateForbidden() *ReplicateForbidden {\n\treturn &ReplicateForbidden{}\n}", "title": "" }, { "docid": "5535736ff20d3b025f7d669ad9d8139f", "score": "0.47274104", "text": "func Forbidden(err error) error {\n\treturn Grpc(codes.PermissionDenied, err)\n}", "title": "" }, { "docid": "9a6c9455eb7a166289094841ae20a840", "score": "0.4723053", "text": "func NewSetCustomImageForbidden() *SetCustomImageForbidden {\n\treturn &SetCustomImageForbidden{}\n}", "title": "" }, { "docid": "9ae9ff36ada43f528dd6b9e033d8a7f3", "score": "0.4720699", "text": "func NewListRegistryForbidden() *ListRegistryForbidden {\n\treturn &ListRegistryForbidden{}\n}", "title": "" }, { "docid": "87c1f826cc5a585bef1550f7ae390934", "score": "0.47192758", "text": "func NewGetDevicesSsidsForbidden() *GetDevicesSsidsForbidden {\n\treturn &GetDevicesSsidsForbidden{}\n}", "title": "" }, { "docid": "7499b2727a02fc1e4fb42acb7a5f3b75", "score": "0.47095513", "text": "func NewGetDevicesAssetForbidden() *GetDevicesAssetForbidden {\n\treturn &GetDevicesAssetForbidden{}\n}", "title": "" }, { "docid": "4391d4e3c94a16a75892022291ac5b87", "score": "0.47028378", "text": "func NewUnregisterUsingDELETEForbidden() *UnregisterUsingDELETEForbidden {\n\treturn &UnregisterUsingDELETEForbidden{}\n}", "title": "" }, { "docid": "463335ebf11bfa0f59c087cced651848", "score": "0.46979344", "text": "func NewDeletePowerCircuitForbidden() *DeletePowerCircuitForbidden {\n\treturn &DeletePowerCircuitForbidden{}\n}", "title": "" }, { "docid": "e5be868a6efc7d8a76f3b485618f7983", "score": "0.46975252", "text": "func NewGetControlMessageForDeviceForbidden() *GetControlMessageForDeviceForbidden {\n\treturn &GetControlMessageForDeviceForbidden{}\n}", "title": "" }, { "docid": "d62bc41cf210bb3f33448f5767cfd684", "score": "0.46951878", "text": "func NewAPIV1WebhooksByIDPutForbidden() *APIV1WebhooksByIDPutForbidden {\n\treturn &APIV1WebhooksByIDPutForbidden{}\n}", "title": "" }, { "docid": "eda220564041326844e0f644c261b995", "score": "0.46915433", "text": "func NewGetHostForbidden() *GetHostForbidden {\n\n\treturn &GetHostForbidden{}\n}", "title": "" }, { "docid": "e507f825a894e67381ac812a085dcdd9", "score": "0.46884966", "text": "func NewGetExternalSystemCallForbidden() *GetExternalSystemCallForbidden {\n\treturn &GetExternalSystemCallForbidden{}\n}", "title": "" }, { "docid": "bab43a7105f215c367d2f6fba5a24e20", "score": "0.46852243", "text": "func NewCreateNonSITAddressUpdateRequestForbidden() *CreateNonSITAddressUpdateRequestForbidden {\n\n\treturn &CreateNonSITAddressUpdateRequestForbidden{}\n}", "title": "" }, { "docid": "c4371a9b0d16848e106995cd1206fa6c", "score": "0.46851158", "text": "func Forbidden() *ResponseError {\n\treturn &ResponseError{\n\t\tStatus: http.StatusForbidden,\n\t\tCode: \"forbidden\",\n\t\tMessage: \"bad permissions\",\n\t}\n}", "title": "" }, { "docid": "c3d02d35d705b98543fc9b3068bd2572", "score": "0.4682554", "text": "func NewDeleteThermalSimulationForbidden() *DeleteThermalSimulationForbidden {\n\treturn &DeleteThermalSimulationForbidden{}\n}", "title": "" }, { "docid": "d461a0c33c094c9e4be502a530fc7611", "score": "0.4680313", "text": "func NewDeleteAllUsingDELETEForbidden() *DeleteAllUsingDELETEForbidden {\n\treturn &DeleteAllUsingDELETEForbidden{}\n}", "title": "" }, { "docid": "2528bdef8b2c54b8f421ec81f934720a", "score": "0.4674459", "text": "func NewWeaviateCommandsDeleteForbidden() *WeaviateCommandsDeleteForbidden {\n\treturn &WeaviateCommandsDeleteForbidden{}\n}", "title": "" }, { "docid": "5588159b6c6dbf8fbd2fb458477aa0e4", "score": "0.46643978", "text": "func NewGetSpeedtestsForbidden() *GetSpeedtestsForbidden {\n\treturn &GetSpeedtestsForbidden{}\n}", "title": "" }, { "docid": "062f8c28b58b889dd04d98565d2b51ee", "score": "0.4662296", "text": "func NewMediaConnectionEventForbidden() *MediaConnectionEventForbidden {\n\treturn &MediaConnectionEventForbidden{}\n}", "title": "" }, { "docid": "ffbc0a1b0e067e1b96b1b0ac6759b525", "score": "0.46582866", "text": "func NewCreateMachineForbidden() *CreateMachineForbidden {\n\treturn &CreateMachineForbidden{}\n}", "title": "" }, { "docid": "edbb67b2b02997ed5fd78e444793a2fa", "score": "0.46531197", "text": "func NewGetIntegrationForbidden() *GetIntegrationForbidden {\n\treturn &GetIntegrationForbidden{}\n}", "title": "" }, { "docid": "0b0a26fa5c3fb34ed9134d19898c7901", "score": "0.46528274", "text": "func NewSMSDeliveryReceiptAutomationPutForbidden() *SMSDeliveryReceiptAutomationPutForbidden {\n\treturn &SMSDeliveryReceiptAutomationPutForbidden{}\n}", "title": "" }, { "docid": "e86c0025d94dbf62e35584e2c6319f19", "score": "0.46491307", "text": "func NewListExtensionsForbidden() *ListExtensionsForbidden {\n\treturn &ListExtensionsForbidden{}\n}", "title": "" }, { "docid": "75270acfa21b5b492f339d5c0ec56c06", "score": "0.4646429", "text": "func NewUnbindHostForbidden() *UnbindHostForbidden {\n\n\treturn &UnbindHostForbidden{}\n}", "title": "" }, { "docid": "56f643657f569cde75cd219464ae20b9", "score": "0.46354112", "text": "func NewGetAPIForbidden() *GetAPIForbidden {\n\n\treturn &GetAPIForbidden{}\n}", "title": "" }, { "docid": "857ac799baa31d13846c0bb29a66025f", "score": "0.4635338", "text": "func Forbiddenf(format string, i ...interface{}) error {\n\treturn Errorf(Forbidden, format, i...)\n}", "title": "" }, { "docid": "74f83c6fd5cb37a97158306721fa5199", "score": "0.46327698", "text": "func NewPatchTokenForbidden() *PatchTokenForbidden {\n\treturn &PatchTokenForbidden{}\n}", "title": "" } ]
8ab560aa0ca8e4fddd85e602e7cb82cc
Create a new `AWS::EC2::ClientVpnRoute`.
[ { "docid": "093c0bfffd7704313b9a4d6a2049b5bf", "score": "0.6624236", "text": "func NewCfnClientVpnRoute_Override(c CfnClientVpnRoute, scope awscdk.Construct, id *string, props *CfnClientVpnRouteProps) {\n\t_init_.Initialize()\n\n\t_jsii_.Create(\n\t\t\"monocdk.aws_ec2.CfnClientVpnRoute\",\n\t\t[]interface{}{scope, id, props},\n\t\tc,\n\t)\n}", "title": "" } ]
[ { "docid": "4a4e3b88cd20e7873a97fb8f5cad77ac", "score": "0.680846", "text": "func NewCfnClientVpnRoute(scope awscdk.Construct, id *string, props *CfnClientVpnRouteProps) CfnClientVpnRoute {\n\t_init_.Initialize()\n\n\tj := jsiiProxy_CfnClientVpnRoute{}\n\n\t_jsii_.Create(\n\t\t\"monocdk.aws_ec2.CfnClientVpnRoute\",\n\t\t[]interface{}{scope, id, props},\n\t\t&j,\n\t)\n\n\treturn &j\n}", "title": "" }, { "docid": "f36a9fa4e71633a02979af61bf182394", "score": "0.672268", "text": "func NewRoute(key, patt, addr string, instrument *statsd.Client) *Route {\n\treturn &Route{key, patt, addr, nil, make(chan []byte), nil, instrument}\n}", "title": "" }, { "docid": "77dd8a3520cb6497de0c7a098c8a08cb", "score": "0.6243901", "text": "func NewRoute(method string, endpoint string,\n handler func(http.ResponseWriter, *http.Request)) *Route {\n return &Route{\n Method: method,\n Version: 1,\n Endpoint: endpoint,\n Handler: handler,\n }\n}", "title": "" }, { "docid": "6a4f92f396d17df7a6fd23478cec4a3f", "score": "0.62384915", "text": "func NewRoute(doc dom.Document, parent Group, src, dst Pointer) *Route {\n\tr := &Route{\n\t\tline: doc.MakeSVGElement(\"line\"),\n\t\tsrc: src,\n\t\tdst: dst,\n\t}\n\tr.line.ClassList().Add(\"route\")\n\tr.Reroute()\n\tparent.AddChildren(r.line)\n\treturn r\n}", "title": "" }, { "docid": "e51f13949894b9166a3a109ba92d25b0", "score": "0.61915284", "text": "func NewVpnConnectionRoute(ctx *pulumi.Context,\n\tname string, args *VpnConnectionRouteArgs, opts ...pulumi.ResourceOption) (*VpnConnectionRoute, error) {\n\tif args == nil || args.DestinationCidrBlock == nil {\n\t\treturn nil, errors.New(\"missing required argument 'DestinationCidrBlock'\")\n\t}\n\tif args == nil || args.VpnConnectionId == nil {\n\t\treturn nil, errors.New(\"missing required argument 'VpnConnectionId'\")\n\t}\n\tif args == nil {\n\t\targs = &VpnConnectionRouteArgs{}\n\t}\n\tvar resource VpnConnectionRoute\n\terr := ctx.RegisterResource(\"aws:ec2/vpnConnectionRoute:VpnConnectionRoute\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "5043d433ace5a1676096fad22c98438a", "score": "0.6151775", "text": "func NewCfnVPNConnectionRoute(scope awscdk.Construct, id *string, props *CfnVPNConnectionRouteProps) CfnVPNConnectionRoute {\n\t_init_.Initialize()\n\n\tj := jsiiProxy_CfnVPNConnectionRoute{}\n\n\t_jsii_.Create(\n\t\t\"monocdk.aws_ec2.CfnVPNConnectionRoute\",\n\t\t[]interface{}{scope, id, props},\n\t\t&j,\n\t)\n\n\treturn &j\n}", "title": "" }, { "docid": "c8168d7a11daca887890d3396fd2758a", "score": "0.6141311", "text": "func NewRoute(sourceID int, targetID int) Route {\n\troute := Route{\n\t\tSourceID: sourceID,\n\t\tTargetID: targetID,\n\t}\n\treturn route\n}", "title": "" }, { "docid": "c23bf3a7f8966f480e96e404f55b100b", "score": "0.61038446", "text": "func NewCfnVPNConnectionRoute_Override(c CfnVPNConnectionRoute, scope awscdk.Construct, id *string, props *CfnVPNConnectionRouteProps) {\n\t_init_.Initialize()\n\n\t_jsii_.Create(\n\t\t\"monocdk.aws_ec2.CfnVPNConnectionRoute\",\n\t\t[]interface{}{scope, id, props},\n\t\tc,\n\t)\n}", "title": "" }, { "docid": "70d9ac0511ca0ce8594a234e621a10f4", "score": "0.60711825", "text": "func NewRoute(ctx *pulumi.Context,\n\tname string, args *RouteArgs, opts ...pulumi.ResourceOption) (*Route, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.ApiId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ApiId'\")\n\t}\n\tif args.RouteKey == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'RouteKey'\")\n\t}\n\tvar resource Route\n\terr := ctx.RegisterResource(\"aws:apigatewayv2/route:Route\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "7b5809f18082aa66487fdfdbe9f9f935", "score": "0.604894", "text": "func NewRoute(ctx *pulumi.Context,\n\tname string, args *RouteArgs, opts ...pulumi.ResourceOption) (*Route, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.AddressPrefix == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'AddressPrefix'\")\n\t}\n\tif args.NextHopType == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'NextHopType'\")\n\t}\n\tif args.ResourceGroupName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ResourceGroupName'\")\n\t}\n\tif args.RouteTableName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'RouteTableName'\")\n\t}\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource Route\n\terr := ctx.RegisterResource(\"azure:network/route:Route\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "21bab5b7603ba4a130257f37470214f7", "score": "0.59606314", "text": "func New(c *drycc.Client, appID string, name string, procType string, kind string, port int) error {\n\tu := fmt.Sprintf(\"/v2/apps/%s/routes/\", appID)\n\n\treq := api.RouteCreateRequest{Name: name, Type: procType, Kind: kind, Port: port}\n\n\tbody, err := json.Marshal(req)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tres, reqErr := c.Request(\"POST\", u, body)\n\tif reqErr != nil && !drycc.IsErrAPIMismatch(reqErr) {\n\t\treturn reqErr\n\t}\n\tdefer res.Body.Close()\n\treturn reqErr\n}", "title": "" }, { "docid": "278ff66b0de74f1ef0ee12b32415b9cd", "score": "0.5937491", "text": "func NewRoute(dst *net.IPNet, nh IPs) (Route, error) {\n\tif dst == nil {\n\t\treturn Route{}, fmt.Errorf(\"ERROR: NewRoute(): dst is nil\")\n\t}\n\terrMsg := fmt.Sprintf(\"ERROR: NewRoute(%v, %v): \", dst, nh)\n\tif len(nh) <= 0 {\n\t\treturn Route{}, fmt.Errorf(errMsg + \"# of nh is <= 0\")\n\t}\n\tr := Route{Dst: dst}\n\tfor _, ipa := range nh {\n\t\tr.MultiPath = append(r.MultiPath, &NHinfo{Gw: ipa})\n\t}\n\treturn r, nil\n}", "title": "" }, { "docid": "b115d43b440ab66df499e73ae8ad46f1", "score": "0.5907063", "text": "func newRoute() *Route {\n\troute := new(Route) // new 一个结构体\n\troute.params = make([]string, 0) // 请求参数\n\treturn route\n}", "title": "" }, { "docid": "be0ac7518896aa6b1fa17bb43befac42", "score": "0.5882459", "text": "func (r CreateClientVpnRouteRequest) Send(ctx context.Context) (*CreateClientVpnRouteResponse, error) {\n\tr.Request.SetContext(ctx)\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := &CreateClientVpnRouteResponse{\n\t\tCreateClientVpnRouteOutput: r.Request.Data.(*CreateClientVpnRouteOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "b00c0e0719e0310ffed3994f1c7887e8", "score": "0.5862277", "text": "func (t *Device) NewRoute(RouteId string) (*OnfRoute_Route, error){\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.Route == nil {\n\t\tt.Route = make(map[string]*OnfRoute_Route)\n\t}\n\n\tkey := RouteId\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.Route[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list Route\", key)\n\t}\n\n\tt.Route[key] = &OnfRoute_Route{\n\t\tRouteId: &RouteId,\n\t}\n\n\treturn t.Route[key], nil\n}", "title": "" }, { "docid": "0146c4f9f21d854e82dc69b1fc507990", "score": "0.5839102", "text": "func NewRoute(namespace, name, service, port string) *openshiftv1.Route {\n\tr := &openshiftv1.Route{}\n\tInitialize(r, namespace, name)\n\tr.Spec.Port = &openshiftv1.RoutePort{TargetPort: intstr.Parse(port)}\n\tr.Spec.To.Kind = \"Service\"\n\tr.Spec.To.Name = service\n\treturn r\n}", "title": "" }, { "docid": "1ca7fa75059797c2c19fa43f60502d8a", "score": "0.57505727", "text": "func newRoute(g generator, name, path string, numVoices int) []*Voice {\n\tinstr := &sCInstrument{\n\t\tname: name,\n\t\tPath: path,\n\t}\n\treturn _voices(numVoices, g, instr, 1200)\n}", "title": "" }, { "docid": "8056771f9e3903b02d76bb61c2d264b8", "score": "0.5742341", "text": "func NewRoute(kogitoApp *v1alpha1.KogitoApp, service *corev1.Service) (route *routev1.Route, err error) {\n\tif service == nil {\n\t\treturn route, fmt.Errorf(\"Impossible to create a Route without a service on Kogito app %s\", kogitoApp.Name)\n\t}\n\troute = &routev1.Route{\n\t\tObjectMeta: service.ObjectMeta,\n\t\tSpec: routev1.RouteSpec{\n\t\t\tPort: &routev1.RoutePort{\n\t\t\t\tTargetPort: intstr.FromString(defaultExportedProtocol),\n\t\t\t},\n\t\t\tTo: routev1.RouteTargetReference{\n\t\t\t\tKind: meta.KindService.Name,\n\t\t\t\tName: service.Name,\n\t\t\t},\n\t\t},\n\t}\n\taddDefaultMeta(&route.ObjectMeta, kogitoApp)\n\tmeta.SetGroupVersionKind(&route.TypeMeta, meta.KindRoute)\n\troute.ResourceVersion = \"\"\n\treturn route, nil\n}", "title": "" }, { "docid": "cc33545c7438782e92f41551bf45e1f6", "score": "0.57390136", "text": "func New(prov provider) (*Service, error) {\n\tstore, err := prov.StorageProvider().OpenStore(Coordination)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"open route coordination store : %w\", err)\n\t}\n\n\tconnectionLookup, err := connection.NewLookup(prov)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Service{\n\t\trouteStore: store,\n\t\toutbound: prov.OutboundDispatcher(),\n\t\tendpoint: prov.RouterEndpoint(),\n\t\tkms: prov.LegacyKMS(),\n\t\tvdRegistry: prov.VDRIRegistry(),\n\t\tconnectionLookup: connectionLookup,\n\t\trouteRegistrationMap: make(map[string]chan Grant),\n\t\tkeylistUpdateMap: make(map[string]chan *KeylistUpdateResponse),\n\t}, nil\n}", "title": "" }, { "docid": "f2008bfe49ed941dbbe326c84a6dc393", "score": "0.568907", "text": "func New(r *routing.Routing, options Options, pr ...PriorityRoute) http.Handler {\n\ttr := &http.Transport{}\n\tif options.Insecure() {\n\t\ttr.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}\n\t}\n\n\tm := metrics.Default\n\tif options.Debug() {\n\t\tm = metrics.Void\n\t}\n\n\treturn &proxy{r, tr, pr, options, m}\n}", "title": "" }, { "docid": "8dce1137adedb0a36f1cf90b3e8125a1", "score": "0.56759995", "text": "func newGateway(ctx context.Context, cl client.Client, ns, name, gc, k, v string) error {\n\troutes := metav1.LabelSelector{\n\t\tMatchLabels: map[string]string{k: v},\n\t}\n\thttp := gatewayv1alpha1.Listener{\n\t\tPort: gatewayv1alpha1.PortNumber(int32(80)),\n\t\tProtocol: gatewayv1alpha1.HTTPProtocolType,\n\t\tRoutes: gatewayv1alpha1.RouteBindingSelector{\n\t\t\tKind: \"HTTPRoute\",\n\t\t\tSelector: routes,\n\t\t},\n\t}\n\thttps := gatewayv1alpha1.Listener{\n\t\tPort: gatewayv1alpha1.PortNumber(int32(443)),\n\t\tProtocol: gatewayv1alpha1.HTTPSProtocolType,\n\t\tRoutes: gatewayv1alpha1.RouteBindingSelector{\n\t\t\tKind: \"HTTPRoute\",\n\t\t\tSelector: routes,\n\t\t},\n\t}\n\tgw := &gatewayv1alpha1.Gateway{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tNamespace: ns,\n\t\t\tName: name,\n\t\t},\n\t\tSpec: gatewayv1alpha1.GatewaySpec{\n\t\t\tGatewayClassName: gc,\n\t\t\tListeners: []gatewayv1alpha1.Listener{http, https},\n\t\t},\n\t}\n\tif err := cl.Create(ctx, gw); err != nil {\n\t\treturn fmt.Errorf(\"failed to create gateway %s/%s: %v\", ns, name, err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b0bc8c910411557363cfb218f8eadf29", "score": "0.56713104", "text": "func newIPAMRoute(r *net.IPNet) ipamRoute {\n\treturn ipamRoute{Dest: r.String()}\n}", "title": "" }, { "docid": "229378865057fd6c39189a52644568bd", "score": "0.56348604", "text": "func (c *jsiiProxy_ClientVpnEndpoint) AddRoute(id *string, props *ClientVpnRouteOptions) ClientVpnRoute {\n\tvar returns ClientVpnRoute\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"addRoute\",\n\t\t[]interface{}{id, props},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "f53dbb29f4d231b28b14b9c126aa6442", "score": "0.5621007", "text": "func NewCfnVPNGatewayRoutePropagation(scope awscdk.Construct, id *string, props *CfnVPNGatewayRoutePropagationProps) CfnVPNGatewayRoutePropagation {\n\t_init_.Initialize()\n\n\tj := jsiiProxy_CfnVPNGatewayRoutePropagation{}\n\n\t_jsii_.Create(\n\t\t\"monocdk.aws_ec2.CfnVPNGatewayRoutePropagation\",\n\t\t[]interface{}{scope, id, props},\n\t\t&j,\n\t)\n\n\treturn &j\n}", "title": "" }, { "docid": "1137ddcf59a45c5a2e90302f124f94e4", "score": "0.5590905", "text": "func NewRoute(ctrl *Controller, router *gin.Engine) *Route {\n\treturn &Route{\n\t\tctrl: ctrl,\n\t\trouter: router,\n\t}\n}", "title": "" }, { "docid": "8afa3002b17e78ed5ff6d3fb6b202d4a", "score": "0.55885494", "text": "func (d *Service) createRoute(service irtypes.Service, port core.ServicePort, path string, ir irtypes.EnhancedIR, targetClusterSpec collecttypes.ClusterMetadataSpec) *okdroutev1.Route {\n\tweight := int32(1) //Hard-coded to 1 to avoid Helm v3 errors\n\tingressArray := []okdroutev1.RouteIngress{{Host: \"\"}} //Hard-coded to empty string to avoid Helm v3 errors\n\n\troute := &okdroutev1.Route{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: routeKind,\n\t\t\tAPIVersion: okdroutev1.SchemeGroupVersion.String(),\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: service.Name,\n\t\t\tLabels: getServiceLabels(service.Name),\n\t\t},\n\t\tSpec: okdroutev1.RouteSpec{\n\t\t\tHost: targetClusterSpec.Host,\n\t\t\tPath: path,\n\t\t\tTo: okdroutev1.RouteTargetReference{\n\t\t\t\tKind: common.ServiceKind,\n\t\t\t\tName: service.Name,\n\t\t\t\tWeight: &weight,\n\t\t\t},\n\t\t\tPort: &okdroutev1.RoutePort{TargetPort: intstr.IntOrString{Type: intstr.String, StrVal: port.Name}},\n\t\t},\n\t\tStatus: okdroutev1.RouteStatus{\n\t\t\tIngress: ingressArray,\n\t\t},\n\t}\n\treturn route\n}", "title": "" }, { "docid": "692f9cd676859b11ef6d2eef94992478", "score": "0.5568462", "text": "func NewRoutes(service *Service, kong *Client) *Routes {\n\t_routes := &Routes{\n\t\tkong: kong,\n\t\troute: &Route{},\n\t\tservice: service,\n\t\tfail: &FailureMessage{},\n\t}\n\treturn _routes\n}", "title": "" }, { "docid": "c2d9d76e238fdb6472b8f49d221b5671", "score": "0.5563415", "text": "func NewVpnGatewayRoutePropagation(ctx *pulumi.Context,\n\tname string, args *VpnGatewayRoutePropagationArgs, opts ...pulumi.ResourceOpt) (*VpnGatewayRoutePropagation, error) {\n\tif args == nil || args.RouteTableId == nil {\n\t\treturn nil, errors.New(\"missing required argument 'RouteTableId'\")\n\t}\n\tif args == nil || args.VpnGatewayId == nil {\n\t\treturn nil, errors.New(\"missing required argument 'VpnGatewayId'\")\n\t}\n\tinputs := make(map[string]interface{})\n\tif args == nil {\n\t\tinputs[\"routeTableId\"] = nil\n\t\tinputs[\"vpnGatewayId\"] = nil\n\t} else {\n\t\tinputs[\"routeTableId\"] = args.RouteTableId\n\t\tinputs[\"vpnGatewayId\"] = args.VpnGatewayId\n\t}\n\ts, err := ctx.RegisterResource(\"aws:ec2/vpnGatewayRoutePropagation:VpnGatewayRoutePropagation\", name, true, inputs, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &VpnGatewayRoutePropagation{s: s}, nil\n}", "title": "" }, { "docid": "8b81cb8ed7d82f63cf8930602550fc36", "score": "0.5550115", "text": "func NewRouteTable(ctx *pulumi.Context,\n\tname string, args *RouteTableArgs, opts ...pulumi.ResourceOption) (*RouteTable, 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:network/v20180801:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20150501preview:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20150501preview:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20150615:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20150615:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20160330:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20160330:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20160601:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20160601:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20160901:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20160901:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20161201:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20161201:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20170301:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20170301:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20170601:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20170601:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20170801:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20170801:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20170901:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20170901:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20171001:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20171001:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20171101:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20171101:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20180101:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20180101:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20180201:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20180201:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20180401:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20180401:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20180601:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20180601:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20180701:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20180701:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20181001:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20181001:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20181101:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20181101:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20181201:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20181201:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20190201:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20190201:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20190401:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20190401:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20190601:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20190601:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20190701:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20190701:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20190801:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20190801:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20190901:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20190901:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20191101:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20191101:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20191201:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20191201:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20200301:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20200301:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20200401:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20200401:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20200501:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20200501:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20200601:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20200601:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20200701:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20200701:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20200801:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20200801:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20201101:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20201101:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:network/v20210201:RouteTable\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:network/v20210201:RouteTable\"),\n\t\t},\n\t})\n\topts = append(opts, aliases)\n\tvar resource RouteTable\n\terr := ctx.RegisterResource(\"azure-native:network/v20180801:RouteTable\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "a4e75464a8eae46924628aab3ff26ae0", "score": "0.5540161", "text": "func (r Router) New(req *http.Request) (Path, Route, error) {\n\ttrimmedPath, err := trimPath(req)\n\tif err != nil {\n\t\treturn Path(trimmedPath), Route{}, errors.Wrap(err, \"trimPath(req) failed\")\n\t}\n\n\tprefix, path, startIndex := adjustPrefix(trimmedPath, r.Prefixes, r.DefaultPrefix)\n\tstartIndex = adjustStartIndexForNamespace(path, r.Namespaces, startIndex)\n\trPath := routePath(path[:startIndex], path[startIndex:])\n\n\treturn setPathPrefix(prefix, path), Route{Method: req.Method, Path: rPath}, nil\n}", "title": "" }, { "docid": "cd5b3e041e9a117dc13ae6fd26553ad8", "score": "0.5508919", "text": "func New() *Routing {\n\treturn &Routing{routes: routeMapping{}, goTemplates: map[string]*template.Template{}}\n}", "title": "" }, { "docid": "92c3c8774a8c8032ecc66d286b466ead", "score": "0.55001384", "text": "func New() (Router, error) {\n\tvar routes []*Route\n\n\tfor _, iptype := range []RouteType{IPv4, IPv6} {\n\t\tnetshCmd := exec.Command(\"netsh\", \"interface\", iptype.String(), \"show\", \"route\")\n\t\tnetshOutput, err := netshCmd.Output()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tscanner := bufio.NewScanner(bytes.NewReader(netshOutput))\n\t\tfor scanner.Scan() {\n\t\t\toutputLine := strings.TrimSpace(scanner.Text())\n\t\t\tif outputLine == \"\" {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tparts := stringsutil.SplitAny(outputLine, \" \\t\")\n\t\t\tif len(parts) >= 6 && govalidator.IsNumeric(parts[4]) {\n\t\t\t\tprefix := parts[3]\n\t\t\t\t_, _, err := net.ParseCIDR(prefix)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tgateway := parts[5]\n\t\t\t\tinterfaceIndex, err := strconv.Atoi(parts[4])\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\tnetworkInterface, err := net.InterfaceByIndex(interfaceIndex)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tisDefault := stringsutil.EqualFoldAny(prefix, \"0.0.0.0/0\", \"::/0\")\n\n\t\t\t\troute := &Route{\n\t\t\t\t\tType: iptype,\n\t\t\t\t\tDefault: isDefault,\n\t\t\t\t\tDestination: prefix,\n\t\t\t\t\tGateway: gateway,\n\t\t\t\t\tNetworkInterface: networkInterface,\n\t\t\t\t}\n\n\t\t\t\troutes = append(routes, route)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn &RouterWindows{Routes: routes}, nil\n}", "title": "" }, { "docid": "00ff138382cd13ad0be80e1511dbfd3e", "score": "0.5450494", "text": "func NewRoute(hookContext *v1alpha1.WebhookContext, logger *zap.SugaredLogger, eventSourceName, eventName string, metrics *metrics.Metrics) *Route {\n\treturn &Route{\n\t\tContext: hookContext,\n\t\tLogger: logger,\n\t\tEventSourceName: eventSourceName,\n\t\tEventName: eventName,\n\t\tActive: false,\n\t\tDataCh: make(chan []byte),\n\t\tStartCh: make(chan struct{}),\n\t\tStopChan: make(chan struct{}),\n\t\tMetrics: metrics,\n\t}\n}", "title": "" }, { "docid": "f0ff1ec21b9feadd8e9c0352e13afb62", "score": "0.54429287", "text": "func NewRouteWithVersion(method string, endpoint string, version int,\n handler func(http.ResponseWriter, *http.Request)) *Route {\n route := NewRoute(method, endpoint, handler)\n route.Version = version\n return route\n}", "title": "" }, { "docid": "15b96f61ba1d23b9b9d4da739896b1a4", "score": "0.53939605", "text": "func newRoute(path string, handler Handler) *route {\n\troute := &route{\n\t\thandler: handler,\n\t}\n\tstrs := strings.Split(path, \"/\")\n\tstrs = removeEmptyStrings(strs)\n\tpattern := `^`\n\tfor _, str := range strs {\n\t\tif str[0] == '{' && str[len(str)-1] == '}' {\n\t\t\tpattern += `/`\n\t\t\tpattern += `([\\w+-]*)`\n\t\t\troute.paramNames = append(route.paramNames, str[1:(len(str)-1)])\n\t\t} else {\n\t\t\tpattern += `/`\n\t\t\tpattern += str\n\t\t}\n\t}\n\tpattern += `/?$`\n\troute.regex = regexp.MustCompile(pattern)\n\treturn route\n}", "title": "" }, { "docid": "1d8ca5ed8559a22cbda120ad325f0300", "score": "0.5384993", "text": "func NewCfnRoute(scope awscdk.Construct, id *string, props *CfnRouteProps) CfnRoute {\n\t_init_.Initialize()\n\n\tj := jsiiProxy_CfnRoute{}\n\n\t_jsii_.Create(\n\t\t\"monocdk.aws_ec2.CfnRoute\",\n\t\t[]interface{}{scope, id, props},\n\t\t&j,\n\t)\n\n\treturn &j\n}", "title": "" }, { "docid": "455a54ec96de8161cbdbc0d8b2bfaa3b", "score": "0.53452784", "text": "func NewCreateRouteCommand(\n\tp *config.KfParams,\n\tc routeclaims.Client,\n) *cobra.Command {\n\tvar hostname, urlPath string\n\n\tcmd := &cobra.Command{\n\t\tUse: \"create-route DOMAIN [--hostname HOSTNAME] [--path PATH]\",\n\t\tShort: \"Create a route\",\n\t\tExample: `\n # Using namespace (instead of SPACE)\n kf create-route example.com --hostname myapp # myapp.example.com\n kf create-route --namespace myspace example.com --hostname myapp # myapp.example.com\n kf create-route example.com --hostname myapp --path /mypath # myapp.example.com/mypath\n\n # [DEPRECATED] Using SPACE to match 'cf'\n kf create-route myspace example.com --hostname myapp # myapp.example.com\n kf create-route myspace example.com --hostname myapp --path /mypath # myapp.example.com/mypath\n `,\n\t\tArgs: cobra.RangeArgs(1, 2),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tif err := utils.ValidateNamespace(p); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tspace, domain := p.Namespace, args[0]\n\t\t\tif len(args) == 2 {\n\t\t\t\tspace = args[0]\n\t\t\t\tdomain = args[1]\n\t\t\t\tfmt.Fprintln(cmd.OutOrStderr(), `\n[WARN]: passing the SPACE as an argument is deprecated.\nUse the --namespace flag instead.`)\n\t\t\t}\n\n\t\t\tif p.Namespace != \"\" && p.Namespace != \"default\" && p.Namespace != space {\n\t\t\t\treturn fmt.Errorf(\"SPACE (argument=%q) and namespace (flag=%q) (if provided) must match\", space, p.Namespace)\n\t\t\t}\n\n\t\t\tif hostname == \"\" {\n\t\t\t\treturn errors.New(\"--hostname is required\")\n\t\t\t}\n\n\t\t\tcmd.SilenceUsage = true\n\n\t\t\turlPath = path.Join(\"/\", urlPath)\n\n\t\t\tr := &v1alpha1.RouteClaim{\n\t\t\t\tTypeMeta: metav1.TypeMeta{\n\t\t\t\t\tKind: \"RouteClaim\",\n\t\t\t\t},\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tNamespace: space,\n\t\t\t\t\tName: v1alpha1.GenerateRouteClaimName(\n\t\t\t\t\t\thostname,\n\t\t\t\t\t\tdomain,\n\t\t\t\t\t\turlPath,\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t\tSpec: v1alpha1.RouteClaimSpec{\n\t\t\t\t\tRouteSpecFields: v1alpha1.RouteSpecFields{\n\t\t\t\t\t\tHostname: hostname,\n\t\t\t\t\t\tDomain: domain,\n\t\t\t\t\t\tPath: urlPath,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}\n\n\t\t\tif _, err := c.Create(space, r); err != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to create Route: %s\", err)\n\t\t\t}\n\n\t\t\t// NOTE: RouteClaims don't have a status so there's nothing to wait on\n\t\t\t// after creation.\n\t\t\tfmt.Fprintln(cmd.OutOrStdout(), \"Creating route...\")\n\t\t\treturn nil\n\t\t},\n\t}\n\n\tcmd.Flags().StringVar(\n\t\t&hostname,\n\t\t\"hostname\",\n\t\t\"\",\n\t\t\"Hostname for the route\",\n\t)\n\tcmd.Flags().StringVar(\n\t\t&urlPath,\n\t\t\"path\",\n\t\t\"\",\n\t\t\"URL Path for the route\",\n\t)\n\n\treturn cmd\n}", "title": "" }, { "docid": "26675fcf0ff684c205339b4319c83b3e", "score": "0.5341347", "text": "func New(path string, method Method, h gin.HandlerFunc)*Router{\n\treturn &Router{\n\t\tPath:path,\n\t\tMethod: method,\n\t\tHandler: h,\n\t}\n}", "title": "" }, { "docid": "da9e3e177bb7aef0d774f557b7982347", "score": "0.53337675", "text": "func New() *Router { return &Router{c: Config{}} }", "title": "" }, { "docid": "c3321ec6ab29ea0cc728fdf24fc984f0", "score": "0.5328134", "text": "func New(prefix string) Router {\n\tif len(prefix) > 0 {\n\t\tif prefix[0] != '/' {\n\t\t\tprefix = \"/\" + prefix\n\t\t}\n\t\tif prefix[len(prefix)-1] != '/' {\n\t\t\tprefix += \"/\"\n\t\t}\n\t}\n\n\treturn Router{\n\t\tevents: iradix.New(),\n\t\tprefix: prefix,\n\t}\n}", "title": "" }, { "docid": "7ef3eec04192e36b2516fba6197b2ef3", "score": "0.5280829", "text": "func newVaultClient(args string) *Client {\n\tm := splitArgs(args, \";\")\n\n\t// Load in our root certificates via certifi\n\t// so we don't rely on the OS certificates existing\n\trootCerts, err := gocertifi.CACerts()\n\tmaybeWups(err)\n\n\t// Now we need to manually resolve our vault address\n\t// back into an IP/Host combo. This is done becasue\n\t// we can't rely on /etc/resolv.conf existing, which means\n\t// we can't leverage the normal DNS resolution that Go\n\t// would do for us, nor can we leverage glibc here since\n\t// it's possible it can't resolve either. So we are\n\t// opting to do this in pure Go and do this ourselves\n\t// to avoid the issue entirely.\n\tvaultAddr, serverName, err := resolveURL(m.Get(\"vault_addr\"))\n\tmaybeWups(err)\n\n\treturn &Client{\n\t\tconfig: &clientConfig{\n\t\t\troleId: m.Get(\"role_id\"),\n\t\t\tuuid: m.Get(\"uuid\"),\n\t\t\thostname: m.Get(\"hostname\"),\n\t\t\tvaultAddr: vaultAddr,\n\t\t\ttoken: \"\",\n\t\t},\n\t\t// Create custom http.Client that has our root certificates bound to it\n\t\tclient: &http.Client{\n\t\t\tTransport: &http.Transport{\n\t\t\t\tTLSClientConfig: &tls.Config{\n\t\t\t\t\tRootCAs: rootCerts,\n\t\t\t\t\tServerName: serverName,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tserverName: serverName,\n\t}\n}", "title": "" }, { "docid": "2a60c8b0603ca27a75f4cb83b579f85f", "score": "0.52752346", "text": "func initRoute() *echoadapter.EchoLambda {\n\tlog.Printf(\"accountTaker: initializes Echo for route...\")\n\n\t// creates *echo.Echo object to initialize EchoLambda object to return.\n\te = echo.New()\n\n\t// CORS default\n\te.Use(middleware.CORS())\n\n\t// registers GET/POST routes and handlers\n\t// Q. Why API_GATEWAY_RESOURCE_NAME is required?\n\t// A. to avoid 403 error, Missing Authentication Token\n\t// https://aws.amazon.com/ko/premiumsupport/knowledge-center/api-gateway-authentication-token-errors/\n\te.GET(constants.API_GATEWAY_RESOURCE_NAME, handleRoot)\n\te.GET(constants.API_GATEWAY_RESOURCE_NAME+\"/\", handleRoot)\n\n\te.POST(constants.API_GATEWAY_RESOURCE_NAME, handleOccupyAccount)\n\te.POST(constants.API_GATEWAY_RESOURCE_NAME+\"/\", handleOccupyAccount)\n\n\te.POST(constants.API_GATEWAY_RESOURCE_NAME+\"/alarm\", handleSetAlarm)\n\te.POST(constants.API_GATEWAY_RESOURCE_NAME+\"/alarm/\", handleSetAlarm)\n\n\te.POST(constants.API_GATEWAY_RESOURCE_NAME+\"/release\", handleReleaseAccount)\n\te.POST(constants.API_GATEWAY_RESOURCE_NAME+\"/release/\", handleReleaseAccount)\n\n\t// creates and returns a new instance of the EchoLambda object\n\treturn echoadapter.New(e)\n}", "title": "" }, { "docid": "62b03b9084e3d42802d9cefe0e1b46e7", "score": "0.5267288", "text": "func newRouteForCR(cr *devxv1alpha1.StarterKit) *routev1.Route {\n\tlabels := map[string]string{\n\t\t\"app\": cr.Name,\n\t}\n\n\treturn &routev1.Route{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: \"Route\",\n\t\t\tAPIVersion: \"github.com/openshift/api/route/v1\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: cr.Name,\n\t\t\tNamespace: cr.Namespace,\n\t\t\tLabels: labels,\n\t\t},\n\t\tSpec: routev1.RouteSpec{\n\t\t\tTo: routev1.RouteTargetReference{\n\t\t\t\tKind: \"Service\",\n\t\t\t\tName: cr.Name,\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "876eda777116d7836fcedde1f112a7be", "score": "0.525476", "text": "func (svcHdlr AsicDaemonServiceHandler) OnewayCreateIPv4Route(ipv4RouteList []*asicdInt.IPv4Route) error {\n\tvar failedRoutes []*asicdInt.IPv4Route\n\tfor idx := 0; idx < len(ipv4RouteList); idx++ {\n\t\tsvcHdlr.logger.Debug(\"Thrift request received to create ipv4 route - \", ipv4RouteList[idx].DestinationNw, ipv4RouteList[idx].NetworkMask)\n\t\t_, parsedPrefixIP, _, err := IPAddrStringToU8List(ipv4RouteList[idx].DestinationNw)\n\t\tif err != nil {\n\t\t\tsvcHdlr.logger.Err(\"Error:\", err, \" getting parsedPrefixIP\")\n\t\t\tfailedRoutes = append(failedRoutes, ipv4RouteList[idx])\n\t\t\tcontinue\n\t\t}\n\t\tsvcHdlr.logger.Debug(\"parsedPrefixIP:\", parsedPrefixIP, \" err:\", err)\n\t\tmaskIP, parsedPrefixMask, _, err := IPAddrStringToU8List(ipv4RouteList[idx].NetworkMask)\n\t\tif err != nil {\n\t\t\tsvcHdlr.logger.Err(\"Error:\", err, \" getting parsedPrefixMask\")\n\t\t\tfailedRoutes = append(failedRoutes, ipv4RouteList[idx])\n\t\t\tcontinue\n\t\t}\n\t\tprefixLen, err := netUtils.GetPrefixLen(maskIP)\n\t\tif err != nil {\n\t\t\tsvcHdlr.logger.Err(\"Error:\", err, \" getting prefixLen for mask:\", maskIP)\n\t\t\tfailedRoutes = append(failedRoutes, ipv4RouteList[idx])\n\t\t\tcontinue\n\t\t}\n\t\tnwAddr := ((net.IP(parsedPrefixIP)).Mask(net.IPMask(parsedPrefixMask))).String() + \"/\" + strconv.Itoa(prefixLen)\n\t\tsvcHdlr.logger.Debug(\"parsedPrefixMask:\", parsedPrefixMask, \" err:\", err, \" maskIP:\", maskIP, \"prefixLen:\", prefixLen, \" nwAddr:\", nwAddr)\n\t\tfor idx1 := 0; idx1 < len(ipv4RouteList[idx].NextHopList); idx1++ {\n\t\t\t_, parsedNextHopIp, nhIpType, err := IPAddrStringToU8List(ipv4RouteList[idx].NextHopList[idx1].NextHopIp)\n\t\t\tif err != nil {\n\t\t\t\tsvcHdlr.logger.Err(\"Error:\", err, \" getting parsedNextHopIp\")\n\t\t\t\tfailedRoutes = append(failedRoutes, ipv4RouteList[idx])\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif ipv4RouteList[idx].NextHopList[idx1].NextHopIp == \"255.255.255.255\" {\n\t\t\t\tipv4RouteList[idx].NextHopList[idx1].NextHopIfType = commonDefs.IfTypeNull\n\t\t\t}\n\t\t\tsvcHdlr.logger.Debug(\"parsedNextHopIp:\", parsedNextHopIp, \"nhIpType:\", nhIpType, \" err:\", err)\n\t\t\tsvcHdlr.logger.Debug(\"calling createiproute for nwaddr:\", nwAddr)\n\t\t\t/*\t\t\terr = svcHdlr.pluginMgr.CreateIPRoute(nwAddr, parsedPrefixIP, parsedPrefixMask, parsedNextHopIp,\n\t\t\t\t\t\t\tsyscall.AF_INET, nhIpType, int(ipv4RouteList[idx].NextHopList[idx1].Weight),\n\t\t\t\t\t\t\tint(ipv4RouteList[idx].NextHopList[idx1].NextHopIfType))\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tsvcHdlr.logger.Err(\"Error:\", err, \" creating route\")\n\t\t\t\t\t\t\tfailedRoutes = append(failedRoutes, ipv4RouteList[idx])\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}*/\n\t\t\tsvcHdlr.pluginMgr.CreateIPRoute(nwAddr, parsedPrefixIP, parsedPrefixMask, parsedNextHopIp,\n\t\t\t\tsyscall.AF_INET, nhIpType, int(ipv4RouteList[idx].NextHopList[idx1].Weight),\n\t\t\t\tint(ipv4RouteList[idx].NextHopList[idx1].NextHopIfType))\n\t\t}\n\t}\n\t//Notify route add failures\n\tif len(failedRoutes) != 0 {\n\t\tsvcHdlr.logger.Debug(\"non zero failed routes\")\n\t\tmsgBuf, err := json.Marshal(failedRoutes)\n\t\tif err != nil {\n\t\t\treturn errors.New(\"Failed to marshal route create failure message\")\n\t\t}\n\t\tnotification := asicdCommonDefs.AsicdNotification{\n\t\t\tMsgType: uint8(asicdCommonDefs.NOTIFY_IPV4_ROUTE_CREATE_FAILURE),\n\t\t\tMsg: msgBuf,\n\t\t}\n\t\tnotificationBuf, err := json.Marshal(notification)\n\t\tif err != nil {\n\t\t\treturn errors.New(\"Failed to marshal route create failure message\")\n\t\t}\n\t\tsvcHdlr.notifyChan.Ribd <- notificationBuf\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5c365249e31abe81a40418d85d1eab40", "score": "0.52397376", "text": "func New(ctx interface{}) *Router {\n\tvalidateContext(ctx, nil)\n\n\tr := &Router{}\n\tr.contextType = reflect.TypeOf(ctx)\n\tr.pathPrefix = \"/\"\n\tr.maxChildrenDepth = 1\n\tr.root = make(map[httpMethod]*pathNode)\n\tfor _, method := range httpMethods {\n\t\tr.root[method] = newPathNode()\n\t}\n\treturn r\n}", "title": "" }, { "docid": "a66209488b353db53253e91d7513de56", "score": "0.52330595", "text": "func (egw *NsxtEdgeGateway) CreateIpSecVpnTunnel(ipSecVpnConfig *types.NsxtIpSecVpnTunnel) (*NsxtIpSecVpnTunnel, error) {\n\tclient := egw.client\n\tendpoint := types.OpenApiPathVersion1_0_0 + types.OpenApiEndpointIpSecVpnTunnel\n\tminimumApiVersion, err := client.checkOpenApiEndpointCompatibility(endpoint)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\turlRef, err := client.OpenApiBuildEndpoint(fmt.Sprintf(endpoint, egw.EdgeGateway.ID))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttask, err := client.OpenApiPostItemAsync(minimumApiVersion, urlRef, nil, ipSecVpnConfig)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error creating NSX-T IPsec VPN Tunnel configuration: %s\", err)\n\t}\n\n\terr = task.WaitTaskCompletion()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"task failed while creating NSX-T IPsec VPN Tunnel configuration: %s\", err)\n\t}\n\n\t// filtering even by Name is not supported on VCD side\n\tallVpns, err := egw.GetAllIpSecVpnTunnels(nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error retrieving all NSX-T IPsec VPN Tunnel configuration after creation: %s\", err)\n\t}\n\n\tfor index, singleConfig := range allVpns {\n\t\tif singleConfig.IsEqualTo(ipSecVpnConfig) {\n\t\t\t// retrieve exact value by ID, because only this endpoint includes private key\n\t\t\tipSecVpn, err := egw.GetIpSecVpnTunnelById(allVpns[index].NsxtIpSecVpn.ID)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"error retrieving NSX-T IPsec VPN Tunnel configuration: %s\", err)\n\t\t\t}\n\n\t\t\treturn ipSecVpn, nil\n\t\t}\n\t}\n\n\treturn nil, fmt.Errorf(\"error finding NSX-T IPsec VPN Tunnel configuration after creation: %s\", ErrorEntityNotFound)\n}", "title": "" }, { "docid": "777ced1b7e8c0e30c399468da74a9f1e", "score": "0.5230669", "text": "func New(\n\tclient client.Client,\n\tnamespace string,\n\tsecretsManager secretsmanager.Interface,\n\tistioNamespaceFunc func() string,\n\tvalues Values,\n) Interface {\n\treturn &vpnSeedServer{\n\t\tclient: client,\n\t\tnamespace: namespace,\n\t\tsecretsManager: secretsManager,\n\t\tvalues: values,\n\t\tistioNamespaceFunc: istioNamespaceFunc,\n\t}\n}", "title": "" }, { "docid": "c85b53b3bf7690553c73d8bce815d9b4", "score": "0.522857", "text": "func NewRoutesClient(con *armcore.Connection, subscriptionID string) RoutesClient {\n\treturn original.NewRoutesClient(con, subscriptionID)\n}", "title": "" }, { "docid": "6049f181aede780a117c5a2b30d3a9cb", "score": "0.5223408", "text": "func New() Router {\n\tr := &router{\n\t\tsignalCh: make(chan os.Signal),\n\t\tsignals: make(map[os.Signal]Handler),\n\t\tignSignals: make(map[os.Signal]struct{}),\n\t\trunning: false,\n\t\tlock: &sync.RWMutex{},\n\t}\n\treturn r\n}", "title": "" }, { "docid": "7c29cc406c7d3f8e8f105e1fa1aae339", "score": "0.5223168", "text": "func NewPeer(publicIP string, subnets []string, secret string) *Peer {\n\tname := fmt.Sprintf(\"%s-cloud-vpn\", os.Getenv(\"PREFIX\"))\n\treturn &Peer{\n\t\tName: name,\n\t\tPublicIP: publicIP,\n\t\tPrivateSubnets: subnets,\n\t\tSecret: secret,\n\t\tNetworkTags: []string{\"all\"},\n\t\tIpsecPolicyPreset: \"aws\",\n\t}\n}", "title": "" }, { "docid": "d4a871bfadbba4ede23eabc1656a304f", "score": "0.5222211", "text": "func NewCfnVPNGatewayRoutePropagation_Override(c CfnVPNGatewayRoutePropagation, scope awscdk.Construct, id *string, props *CfnVPNGatewayRoutePropagationProps) {\n\t_init_.Initialize()\n\n\t_jsii_.Create(\n\t\t\"monocdk.aws_ec2.CfnVPNGatewayRoutePropagation\",\n\t\t[]interface{}{scope, id, props},\n\t\tc,\n\t)\n}", "title": "" }, { "docid": "88a467cf07e87ac6210436f0c68ef4f4", "score": "0.522197", "text": "func New(db metadata.DB, provider p2plab.NodeProvider, client *httputil.Client, ts *transformers.Transformers, seeder *peer.Peer, builder p2plab.Builder) daemon.Router {\n\treturn &router{\n\t\tdb,\n\t\tprovider,\n\t\tclient,\n\t\tts,\n\t\tseeder,\n\t\tbuilder,\n\t\thelpers.New(db, provider, client),\n\t}\n}", "title": "" }, { "docid": "ea950fa6fe01b5c70274c87b09cd6cde", "score": "0.52128863", "text": "func NewAppRoute(prefix string, server *AppServer) *AppRoute {\n\treturn &AppRoute{\n\t\tserver: server,\n\t\tprefix: prefix,\n\t}\n}", "title": "" }, { "docid": "35429eb92868c36b9fd83f5b70307d4b", "score": "0.51838624", "text": "func newRouteForCR(cr *devxv1alpha1.StarterKit) *routev1.Route {\n\tlabels := map[string]string{\n\t\t\"app\": cr.Name,\n\t\t\"devx\": \"\",\n\t}\n\n\treturn &routev1.Route{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: \"Route\",\n\t\t\tAPIVersion: \"github.com/openshift/api/route/v1\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: cr.Name,\n\t\t\tNamespace: cr.Namespace,\n\t\t\tLabels: labels,\n\t\t},\n\t\tSpec: routev1.RouteSpec{\n\t\t\tTo: routev1.RouteTargetReference{\n\t\t\t\tKind: \"Service\",\n\t\t\t\tName: cr.Name,\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "6d7be86618c83c5da6792f6030f68fa1", "score": "0.51835495", "text": "func (r *Router) NewRoute() *Route {\n\troute := &Route{}\n\tr.routes = append(r.routes, route)\n\treturn route\n}", "title": "" }, { "docid": "433c34efded194645881df70ed40bc0b", "score": "0.51788574", "text": "func New(ctx context.Context) *Router {\n\tr := &Router{\n\t\tctx: ctx,\n\t\tmtx: &sync.Mutex{},\n\t\trouteMap: make(map[string]RouterFunc),\n\t}\n\treturn r\n}", "title": "" }, { "docid": "9824d736c6a2fd37d1846dd36296fc7c", "score": "0.5176276", "text": "func NewVpnConnection(ctx *pulumi.Context,\n\tname string, args *VpnConnectionArgs, opts ...pulumi.ResourceOption) (*VpnConnection, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.CustomerGatewayId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'CustomerGatewayId'\")\n\t}\n\tif args.Type == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'Type'\")\n\t}\n\tvar resource VpnConnection\n\terr := ctx.RegisterResource(\"aws:ec2/vpnConnection:VpnConnection\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "129749be4d97c55a54b8d4be5500d2ec", "score": "0.5176043", "text": "func ClientVpnEndpoint_FromEndpointAttributes(scope constructs.Construct, id *string, attrs *ClientVpnEndpointAttributes) IClientVpnEndpoint {\n\t_init_.Initialize()\n\n\tvar returns IClientVpnEndpoint\n\n\t_jsii_.StaticInvoke(\n\t\t\"monocdk.aws_ec2.ClientVpnEndpoint\",\n\t\t\"fromEndpointAttributes\",\n\t\t[]interface{}{scope, id, attrs},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "36fa80c34c57ab03792fa59a28a10f18", "score": "0.51748544", "text": "func New() *myRouter {\n\treturn &myRouter{}\n}", "title": "" }, { "docid": "31c1f198843f3745a5170a307aeda634", "score": "0.51626545", "text": "func NewNode() Router {\n log.Println(\"Creating new Rabric Node\")\n\n trie := patricia.NewTrie()\n r := &Realm{URI: \"pd\"}\n trie.Insert(patricia.Prefix(\"pd\"), r)\n\n return &node{\n realms: make(map[URI]Realm),\n sessionOpenCallbacks: []func(uint, string){},\n sessionCloseCallbacks: []func(uint, string){},\n root: trie,\n }\n}", "title": "" }, { "docid": "a8ef34ff58449b39ec92c7bb1b321906", "score": "0.51625526", "text": "func NewZoneproductController(router gin.IRouter, client *ent.Client) *ZoneproductController {\n pc := &ZoneproductController{\n client: client,\n router: router,\n }\n pc.register()\n return pc\n }", "title": "" }, { "docid": "3cd34be1676f1b52435dc0c969dfe3b6", "score": "0.51553124", "text": "func newRouteForCR(cr *rulev1alpha1.OperationRule) *routev1.Route {\n\tlabels := map[string]string{\n\t\t\"app\": cr.Name,\n\t}\n\troute := routev1.Route{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: cr.Name,\n\t\t\tNamespace: cr.Namespace,\n\t\t\tLabels: labels,\n\t\t},\n\t\tSpec: routev1.RouteSpec{\n\t\t\tTo: routev1.RouteTargetReference{\n\t\t\t\tName: cr.Name,\n\t\t\t},\n\t\t},\n\t}\n\tif len(cr.Spec.HostName) > 0 {\n\t\troute.Spec.Host = cr.Spec.HostName\n\t}\n\troute.SetGroupVersionKind(routev1.SchemeGroupVersion.WithKind(\"Route\"))\n\treturn &route\n}", "title": "" }, { "docid": "0c8c6fb118d7b42488485acbcd848504", "score": "0.5146471", "text": "func createRouteToBlock(block api.IPAMBlockResponse, host *api.Host, romanaRouteTableId int, multihop bool, nlHandle nlHandleRoute) error {\n\ttestRoutes, err := nlHandle.RouteGet(host.IP)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"couldn't test host %s adjacency\", host.IP)\n\t}\n\n\tif len(testRoutes) > 1 {\n\t\treturn errors.New(fmt.Sprintf(\"more then one path available for host %s, multipath not currently supported\", host.IP))\n\t}\n\n\tif len(testRoutes) == 0 {\n\t\treturn errors.New(fmt.Sprintf(\"no way to reach %s, no default gateway?\", host.IP))\n\t}\n\n\tif testRoutes[0].Gw != nil && multihop == false {\n\t\treturn RouteAdjacencyError{}\n\t}\n\n\troute := netlink.Route{\n\t\tDst: &block.CIDR.IPNet,\n\t\tGw: host.IP,\n\t\tTable: romanaRouteTableId,\n\t}\n\n\tlog.Debugf(\"About to create route %v\", route)\n\treturn nlHandle.RouteAdd(&route)\n}", "title": "" }, { "docid": "00480245752902b6431c56d88b33149b", "score": "0.51378965", "text": "func createApicastRoute(ctx context.Context, client k8sclient.Client, threeScaleAdminPortal string) (string, error) {\n\tlog.Info(\"Create route for self-managed APIcast\")\n\thostsub := strings.TrimPrefix(threeScaleAdminPortal, \"3scale-admin\")\n\troute := &routev1.Route{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"apicast-example\",\n\t\t\tNamespace: apicastNamespace,\n\t\t\tLabels: map[string]string{\n\t\t\t\t\"app\": \"apicast\",\n\t\t\t\t\"threescale_component\": \"apicast\",\n\t\t\t},\n\t\t\tAnnotations: map[string]string{\n\t\t\t\t\"openshift.io/host.generated\": \"true\",\n\t\t\t},\n\t\t},\n\t\tSpec: routev1.RouteSpec{\n\t\t\tPort: &routev1.RoutePort{\n\t\t\t\tTargetPort: intstr.FromString(\"proxy\"),\n\t\t\t},\n\t\t\tTLS: &routev1.TLSConfig{\n\t\t\t\tTermination: \"edge\",\n\t\t\t},\n\t\t\tTo: routev1.RouteTargetReference{\n\t\t\t\tKind: \"Service\",\n\t\t\t\tName: \"apicast-example-apicast\",\n\t\t\t},\n\t\t\tHost: \"selfmanaged-staging\" + hostsub,\n\t\t},\n\t}\n\terr := client.Create(ctx, route)\n\tif err != nil {\n\t\tlog.Error(\"Error create Apicast Route\", err)\n\t\treturn \"\", err\n\t}\n\trouteHost := route.Spec.Host\n\tlog.Info(\"routeHost: \" + routeHost)\n\treturn routeHost, nil\n}", "title": "" }, { "docid": "6a12af01b47b43eb8994cd698e0130bc", "score": "0.5135485", "text": "func NewEventsRoute(instance *gramolav1.AppService, scheme *runtime.Scheme) (*routev1.Route, error) {\n\tlabels := GetAppServiceLabels(instance, EventsServiceName)\n\ttargetPort := intstr.IntOrString{\n\t\tType: intstr.Int,\n\t\tIntVal: int32(EventsServicePort),\n\t}\n\troute := &routev1.Route{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: \"Route\",\n\t\t\tAPIVersion: routev1.SchemeGroupVersion.String(),\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: EventsServiceName,\n\t\t\tNamespace: instance.Namespace,\n\t\t\tLabels: labels,\n\t\t},\n\t\tSpec: routev1.RouteSpec{\n\t\t\tTo: routev1.RouteTargetReference{\n\t\t\t\tKind: \"Service\",\n\t\t\t\tName: EventsServiceName,\n\t\t\t},\n\t\t\tPort: &routev1.RoutePort{\n\t\t\t\tTargetPort: targetPort,\n\t\t\t},\n\t\t},\n\t}\n\n\tif err := controllerutil.SetControllerReference(instance, route, scheme); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn route, nil\n}", "title": "" }, { "docid": "d80802a95b863e8be7705df4e1e78324", "score": "0.5134151", "text": "func NewP2SVpnGatewaysClient(con *armcore.Connection, subscriptionID string) P2SVpnGatewaysClient {\n\treturn original.NewP2SVpnGatewaysClient(con, subscriptionID)\n}", "title": "" }, { "docid": "e8ed3a0eb31515912072fb370bf76c39", "score": "0.51336825", "text": "func NewV2(target, community string) (*Client, error) {\n\tsnmp, err := newSNMP(target)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsnmp.Version = gosnmp.Version2c\n\tsnmp.Community = community\n\treturn &Client{snmp: snmp}, nil\n}", "title": "" }, { "docid": "982b3fe9bfcc8938af0ab38dc41aee09", "score": "0.5128244", "text": "func NewClientP2pRouter(l uc.ClientP2PLogic, port int) {\n\tmux := http.NewServeMux()\n\tClientP2pRouter{\n\t\tLogic: l,\n\t}.SetRoutes(mux)\n\tserver := &http.Server{\n\t\tAddr: fmt.Sprintf(\":%d\", port),\n\t\tHandler: mux,\n\t}\n\n\tfmt.Println(\"listening on\", port)\n\tlog.Fatal(server.ListenAndServe())\n\n}", "title": "" }, { "docid": "688d29518014221ed6df3f2c9fd91319", "score": "0.5121179", "text": "func New(env *Options) destination.Destination {\n\tif err := env.validate(); err != nil {\n\t\tlogger.Default.Fatal(err)\n\t\treturn nil\n\t}\n\n\treturn &Segment{\n\t\toptions: &destination.Options{\n\t\t\tDefaultSchedule: &destination.Schedule{\n\t\t\t\tRealtime: env.Realtime,\n\t\t\t\tInterval: env.Interval,\n\t\t\t\tMaxRetries: env.MaxRetries,\n\t\t\t},\n\t\t\tDefaultVersion: \"v1.0\",\n\t\t\tVersions: map[string]time.Time{\n\t\t\t\t\"v1.0\": time.Time{},\n\t\t\t},\n\t\t},\n\t\tenv: env,\n\t\tclient: http.DefaultClient,\n\t}\n}", "title": "" }, { "docid": "1ae9fd2a5a5ed46efce7f638e83d33dd", "score": "0.5120737", "text": "func NewRouter(ctrl *Controller, router *echo.Echo) *TravelRouter {\n\treturn &TravelRouter{\n\t\tctrl: ctrl,\n\t\trouter: router,\n\t}\n}", "title": "" }, { "docid": "54e498dc574189e362e5befea58435c9", "score": "0.51006204", "text": "func newRoute(method string, name string, pattern string, handlers []Handler) (route *Route) {\n\tpattern = strings.Replace(pattern, \"(int)\", \"([0-9]+)\", -1)\n\tpattern = strings.Replace(pattern, \"(alpha)\", \"([a-z]+)\", -1)\n\tpattern = strings.Replace(pattern, \"(alphanumeric)\", \"([a-z0-9]+)\", -1)\n\tpattern = strings.Replace(pattern, \"(slug)\", \"([a-z0-9-]+)\", -1)\n\tpattern = strings.Replace(pattern, \"(mongo)\", \"([0-9a-fA-F]{24})\", -1)\n\tpattern = strings.Replace(pattern, \"(md5)\", \"([0-9a-fA-F]{32})\", -1)\n\n\tnamed := regexp.MustCompile(`:([a-zA-Z0-9_]+)`)\n\tnamedRegex := regexp.MustCompile(`:([a-zA-Z0-9_]+)\\(([^\\)]+)\\)`)\n\n\t// Create basic base pattern used for URL generation\n\tbasePattern := namedRegex.ReplaceAllString(pattern, \":$1\")\n\n\tif match := namedRegex.MatchString(pattern); match {\n\t\tpattern = namedRegex.ReplaceAllString(pattern, \"(?P<$1>$2)\")\n\t} else {\n\t\tpattern = named.ReplaceAllString(pattern, \"(?P<$1>[^/]+)\")\n\t}\n\n\troute = &Route{strings.ToUpper(method), name, pattern, basePattern, handlers}\n\n\treturn\n}", "title": "" }, { "docid": "4aaaf86b196682694b5c621cf5d3d2df", "score": "0.50931954", "text": "func newRoutingService(sling *sling.Sling) *RoutingService {\n\treturn &RoutingService{\n\t\tsling: sling,\n\t}\n}", "title": "" }, { "docid": "5b9107038d4e07e897b9da0d25e9d699", "score": "0.50899774", "text": "func NewRouteTablePropagation(ctx *pulumi.Context,\n\tname string, args *RouteTablePropagationArgs, opts ...pulumi.ResourceOption) (*RouteTablePropagation, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.TransitGatewayAttachmentId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'TransitGatewayAttachmentId'\")\n\t}\n\tif args.TransitGatewayRouteTableId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'TransitGatewayRouteTableId'\")\n\t}\n\tvar resource RouteTablePropagation\n\terr := ctx.RegisterResource(\"aws:ec2transitgateway/routeTablePropagation:RouteTablePropagation\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "fea1b30150f4045ce4382b7d3bae7418", "score": "0.50888544", "text": "func New(console *console.Console, orderer *orderer.Orderer, peers []*peer.Peer, cas []*ca.CA, port int) (*Proxy, error) {\n\troutes := []*route{\n\t\t{\n\t\t\tSourceHost: console.URL().Host,\n\t\t\tTargetHost: fmt.Sprintf(\"localhost:%d\", console.Port()),\n\t\t\tUseHTTP2: false,\n\t\t},\n\t\t{\n\t\t\tSourceHost: orderer.APIHost(false),\n\t\t\tTargetHost: orderer.APIHost(true),\n\t\t\tUseHTTP2: true,\n\t\t},\n\t\t{\n\t\t\tSourceHost: orderer.OperationsHost(false),\n\t\t\tTargetHost: orderer.OperationsHost(true),\n\t\t\tUseHTTP2: false,\n\t\t},\n\t}\n\tfor _, peer := range peers {\n\t\torgRoutes := []*route{\n\t\t\t{\n\t\t\t\tSourceHost: peer.APIHost(false),\n\t\t\t\tTargetHost: peer.APIHost(true),\n\t\t\t\tUseHTTP2: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tSourceHost: peer.ChaincodeHost(false),\n\t\t\t\tTargetHost: peer.ChaincodeHost(true),\n\t\t\t\tUseHTTP2: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tSourceHost: peer.OperationsHost(false),\n\t\t\t\tTargetHost: peer.OperationsHost(true),\n\t\t\t\tUseHTTP2: false,\n\t\t\t},\n\t\t}\n\t\troutes = append(routes, orgRoutes...)\n\t}\n\tfor _, ca := range cas {\n\t\torgRoutes := []*route{\n\t\t\t{\n\t\t\t\tSourceHost: ca.APIHost(false),\n\t\t\t\tTargetHost: ca.APIHost(true),\n\t\t\t\tUseHTTP2: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\tSourceHost: ca.OperationsHost(false),\n\t\t\t\tTargetHost: ca.OperationsHost(true),\n\t\t\t\tUseHTTP2: false,\n\t\t\t},\n\t\t}\n\t\troutes = append(routes, orgRoutes...)\n\t}\n\trm := routeMap{}\n\tfor _, route := range routes {\n\t\trm[route.SourceHost] = route\n\t}\n\tdirector := func(req *http.Request) {\n\t\thost := req.Host\n\t\tif !portRegex.MatchString(host) {\n\t\t\thost += fmt.Sprintf(\":%d\", port)\n\t\t}\n\t\troute, ok := rm[host]\n\t\tif !ok {\n\t\t\troute = routes[0]\n\t\t}\n\t\tif route.UseHTTP2 {\n\t\t\treq.URL.Scheme = \"h2c\"\n\t\t} else {\n\t\t\treq.URL.Scheme = \"http\"\n\t\t}\n\t\treq.URL.Host = route.TargetHost\n\t}\n\thttpTransport := &http.Transport{}\n\thttpTransport.RegisterProtocol(\"h2c\", &h2cTransportWrapper{\n\t\tTransport: &http2.Transport{\n\t\t\tAllowHTTP: true,\n\t\t\tDialTLS: func(network, addr string, cfg *tls.Config) (net.Conn, error) {\n\t\t\t\treturn net.Dial(network, addr)\n\t\t\t},\n\t\t},\n\t})\n\terr := http2.ConfigureTransport(httpTransport)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treverseProxy := &httputil.ReverseProxy{\n\t\tDirector: director,\n\t\tTransport: httpTransport,\n\t\tFlushInterval: -1,\n\t}\n\thttpServer := &http.Server{\n\t\tAddr: fmt.Sprintf(\":%d\", port),\n\t\tHandler: h2c.NewHandler(reverseProxy, &http2.Server{}),\n\t}\n\terr = http2.ConfigureServer(httpServer, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Proxy{httpServer: httpServer}, nil\n}", "title": "" }, { "docid": "e6ec96ce7e698b053569e5918acb5ad7", "score": "0.5086805", "text": "func New() Router {\n\treturn Router{\n\t\thandlers: make(map[string]map[string]http.HandlerFunc),\n\t}\n}", "title": "" }, { "docid": "9e2b6bd01e8bdec410f5c3b4a81be3dd", "score": "0.5078686", "text": "func New(p *ctypes.Polly) *Router {\n\tr := &Router{\n\t\tr: mux.NewRouter(),\n\t\tp: p,\n\t}\n\n\t//volumes\n\tr.r.HandleFunc(\"/admin/volumes\", r.getVolumesHandler).Methods(\"GET\")\n\tr.r.HandleFunc(\"/admin/volumes\", r.postVolumesHandler).Methods(\"POST\")\n\tr.r.HandleFunc(\"/admin/volumes/{volid}\", r.deleteVolumesHandler).Methods(\"DELETE\")\n\n\thttp.Handle(\"/\", r.r)\n\tgo http.ListenAndServe(\":8080\", nil)\n\n\treturn r\n}", "title": "" }, { "docid": "1e83bba53dd9c99232404614328b1769", "score": "0.5078262", "text": "func NewRouter(conn Conn) Router {\n\trouter := &router{\n\t\troutes: make(map[string]chan *sigmaV1.ExecutionResult),\n\t\tclose: make(chan struct{}),\n\t\tconn: conn,\n\t}\n\n\trouter.wg.Add(1)\n\tgo router.receive()\n\n\treturn router\n}", "title": "" }, { "docid": "64aa8e9265b7bc2e720f3ce2606c3a26", "score": "0.50757986", "text": "func NewVpnGatewaysClient(con *armcore.Connection, subscriptionID string) VpnGatewaysClient {\n\treturn original.NewVpnGatewaysClient(con, subscriptionID)\n}", "title": "" }, { "docid": "83f1f3d10ce90e774a43eb0a245eace4", "score": "0.506134", "text": "func NewRoute(path string, handler HandlerFunc, methods ...string) *Route {\n\treturn &Route{\n\t\tpath: simpleFmtPath(path),\n\t\t// handler\n\t\thandler: handler,\n\t\tmethods: formatMethodsWithDefault(methods, GET),\n\t\t// handlers: middleware,\n\t}\n}", "title": "" }, { "docid": "a3725f17112d13928c07029e481c500d", "score": "0.5055132", "text": "func New(s *session.Session) APIGatewayV2Spec {\n\treturn APIGatewayV2Spec{\n\t\tSession: s,\n\t}\n}", "title": "" }, { "docid": "9786c65b4d0c90407f246167b73afe8f", "score": "0.5045728", "text": "func NewRouteList(runner runner.Runner) RouteList {\n\tr := RouteList{[]Route{}}\n\n\t// Gather current route output\n\tout, err := runner.Run(\"netsh\", \"interface\", \"ipv4\", \"show\", \"route\")\n\n\tif err != nil {\n\t\treturn r\n\t}\n\n\trouteLines := strings.Split(string(out), \"\\n\")\n\n\tfor _, l := range routeLines {\n\t\tif strings.HasPrefix(l, \"Publish\") || strings.HasPrefix(l, \"------\") || strings.TrimSpace(l) == \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\trouteFields := strings.Fields(l)\n\t\tifaceID := routeFields[4]\n\n\t\t_, prefix, _ := net.ParseCIDR(routeFields[3])\n\n\t\tlineRoute := NewRoute(*prefix, ifaceID)\n\n\t\tr.Routes = append(r.Routes, lineRoute)\n\t}\n\n\treturn r\n}", "title": "" }, { "docid": "d3c4e36ba625f29501e52f65aeb1fea9", "score": "0.5041443", "text": "func New(email, token string) *Client {\n\tbasePath := \"https://app.roadmap.space/v1\"\n\tif os.Getenv(\"RM_DEBUG\") == \"1\" {\n\t\tbasePath = \"http://localhost:8070/v1\"\n\t}\n\n\thttpClient := &http.Client{Timeout: HTTPTimeout}\n\tapiClient = &Client{\n\t\temail: email,\n\t\ttoken: token,\n\t\tc: httpClient,\n\t\tBasePath: basePath,\n\t\tRoadmaps: &Roadmaps{EndpointURL: \"/roadmaps\"},\n\t\tFeedback: &Feedback{EndpointURL: \"/feedback\"},\n\t\tIdeas: &Ideas{EndpointURL: \"/ideas\"},\n\t\tStories: &Stories{EndpointURL: \"/stories\"},\n\t\tItems: &Items{EndpointURL: \"/items\"},\n\t}\n\n\treturn apiClient\n}", "title": "" }, { "docid": "b32222006c20dc522100bff0311def9c", "score": "0.5040998", "text": "func New(notifier *gobrake.Notifier) gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\t_, metric := gobrake.NewRouteMetric(context.TODO(), c.Request.Method, c.FullPath())\n\n\t\tc.Next()\n\n\t\tmetric.StatusCode = c.Writer.Status()\n\t\t_ = notifier.Routes.Notify(context.TODO(), metric)\n\t}\n}", "title": "" }, { "docid": "626200fdc3ea4ac70f6926fdd0fce501", "score": "0.50409865", "text": "func NewVirtualNetworkTapsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VirtualNetworkTapsClient {\n\tcp := arm.ClientOptions{}\n\tif options != nil {\n\t\tcp = *options\n\t}\n\tif len(cp.Host) == 0 {\n\t\tcp.Host = arm.AzurePublicCloud\n\t}\n\treturn &VirtualNetworkTapsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)}\n}", "title": "" }, { "docid": "77676c4b74e8e7166956951b248f9190", "score": "0.5036811", "text": "func New(tunName string) (types.LinkEndpointID, error) {\n\tmtu, err := getmtu(tunName)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tfd, err := open(tunName)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\terr = syscall.SetNonblock(fd, true)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\te := &endpoint{\n\t\tfd:\t\tfd,\n\t\tmtu:\tmtu,\n\t\tviews:\tmake([]buffer.View, len(BufConfig)),\n\t\tiovecs:\tmake([]syscall.Iovec, len(BufConfig)),\n\t}\n\tvv := buffer.NewVectorisedView(e.views, 0)\n\te.vv = &vv\n\n\treturn stack.RegisterLinkEndpoint(e), nil\n}", "title": "" }, { "docid": "882edc669c185c902aa3e7d53c675465", "score": "0.5030559", "text": "func NewGateway(db *db.Node, cert *shared.CertInfo, options ...Option) (*Gateway, error) {\n\tctx, cancel := context.WithCancel(context.Background())\n\n\to := newOptions()\n\tfor _, option := range options {\n\t\toption(o)\n\n\t}\n\n\tgateway := &Gateway{\n\t\tdb: db,\n\t\tcert: cert,\n\t\toptions: o,\n\t\tctx: ctx,\n\t\tcancel: cancel,\n\t\tupgradeCh: make(chan struct{}, 16),\n\t}\n\n\terr := gateway.init()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn gateway, nil\n}", "title": "" }, { "docid": "d4a038e911dc01d9175451d69e70f7e6", "score": "0.50245273", "text": "func createRoute(action *k8s.HTTPRouteAction, ns string) []*istio.HTTPRouteDestination {\n\tif action == nil || action.ForwardTo == nil {\n\t\treturn nil\n\t}\n\n\t// TODO this is really bad. What types does object point to?\n\treturn []*istio.HTTPRouteDestination{{\n\t\tDestination: &istio.Destination{\n\t\t\t// TODO cluster.local hardcode\n\t\t\t// TODO is this the right format?\n\t\t\tHost: action.ForwardTo.Name + \".\" + ns + \".svc.\" + constants.DefaultKubernetesDomain,\n\t\t},\n\t}}\n\n}", "title": "" }, { "docid": "03dc3354e221976dca361651bfb340f1", "score": "0.5022154", "text": "func NewRPCRoute(embed Route) *RPCRoute {\n\tret := &RPCRoute{\n\t\tembed: embed,\n\t\tServices: finder.New(),\n\t\tLog: &ggt.VoidLog{},\n\t\tSession: &ggt.VoidSession{},\n\t\tUpload: &ggt.FileProvider{},\n\t}\n\tret.Log.Handle(nil, nil, nil, \"constructor\", \"RPCRoute\")\n\treturn ret\n}", "title": "" }, { "docid": "345db98fc6bf227af8020bd1272428f5", "score": "0.5018666", "text": "func New(tp transport.DatagramTransport) *Gateway {\n\tgw := new(Gateway)\n\tgw.handler.gw = gw\n\n\tgw.tp = tp\n\tgw.tp.SetReceiveDatagramFunc(func(dgram transport.Datagram) {\n\t\tif err := gw.handler.Handle(dgram); err != nil {\n\t\t\tlog.Println(fmt.Errorf(\"gateway: MQTT-SN handling failure: %w\", err))\n\t\t}\n\t})\n\n\treturn gw\n}", "title": "" }, { "docid": "7bdbe568c81d206b3ceb67b4cb2b75bf", "score": "0.501231", "text": "func (c Client) CreateRouteInNamespace(ns string, r *roapi.Route) (*roapi.Route, error) {\n\troute, err := c.oc.Routes(ns).Create(r)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to create route\")\n\t}\n\treturn route, err\n}", "title": "" }, { "docid": "46931fa8053d41b8056f67f7de6fe14b", "score": "0.5009429", "text": "func newRouter() *router {\n\treturn new(router)\n}", "title": "" }, { "docid": "cc5536a3a67ffdcf69bc552e6a6f1986", "score": "0.5005076", "text": "func NewRouting(logger logging.Logger) Routing {\n\treturn &routing{\n\t\tlogger: logger,\n\t}\n}", "title": "" }, { "docid": "2e29bfede40d9ec364e44420717d4293", "score": "0.49996784", "text": "func New(port int) (*Proxy, error) {\n\tp := &Proxy{routeMap: routeMap{}}\n\tdirector := func(req *http.Request) {\n\t\thost := req.Host\n\t\tif !portRegex.MatchString(host) {\n\t\t\thost += fmt.Sprintf(\":%d\", port)\n\t\t}\n\t\troute, ok := p.routeMap[host]\n\t\tif !ok && len(p.routes) > 0 {\n\t\t\troute = p.routes[0]\n\t\t}\n\t\tif route.UseHTTP2 {\n\t\t\treq.URL.Scheme = \"h2c\"\n\t\t} else {\n\t\t\treq.URL.Scheme = \"http\"\n\t\t}\n\t\treq.URL.Host = route.TargetHost\n\t}\n\thttpTransport := &http.Transport{}\n\thttpTransport.RegisterProtocol(\"h2c\", &h2cTransportWrapper{\n\t\tTransport: &http2.Transport{\n\t\t\tAllowHTTP: true,\n\t\t\tDialTLS: func(network, addr string, cfg *gotls.Config) (net.Conn, error) {\n\t\t\t\treturn net.Dial(network, addr)\n\t\t\t},\n\t\t},\n\t})\n\terr := http2.ConfigureTransport(httpTransport)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treverseProxy := &httputil.ReverseProxy{\n\t\tDirector: director,\n\t\tTransport: httpTransport,\n\t\tFlushInterval: -1,\n\t}\n\thttpServer := &http.Server{\n\t\tAddr: fmt.Sprintf(\":%d\", port),\n\t\tHandler: h2c.NewHandler(reverseProxy, &http2.Server{}),\n\t}\n\terr = http2.ConfigureServer(httpServer, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tp.httpServer = httpServer\n\treturn p, nil\n}", "title": "" }, { "docid": "f6a0e8e074e0731936293b1e45697743", "score": "0.49933428", "text": "func (p *PaloAlto) CreateVirtualRouter(name string) error {\n\tvar xmlBody string\n\tvar reqError requestError\n\n\tif p.DeviceType == \"panorama\" {\n\t\treturn errors.New(\"you cannot create virtual-routers on a Panorama device\")\n\t}\n\n\txpath := fmt.Sprintf(\"/config/devices/entry[@name='localhost.localdomain']/network/virtual-router/entry[@name='%s']\", name)\n\txmlBody = \"<protocol><bgp><routing-options><graceful-restart><enable>yes</enable></graceful-restart><as-format>2-byte</as-format></routing-options><enable>no</enable></bgp></protocol>\"\n\n\t_, resp, errs := r.Post(p.URI).Query(fmt.Sprintf(\"type=config&action=set&xpath=%s&element=%s&key=%s\", xpath, xmlBody, p.Key)).End()\n\tif errs != nil {\n\t\treturn errs[0]\n\t}\n\n\tif err := xml.Unmarshal([]byte(resp), &reqError); err != nil {\n\t\treturn err\n\t}\n\n\tif reqError.Status != \"success\" {\n\t\treturn fmt.Errorf(\"error code %s: %s\", reqError.Code, errorCodes[reqError.Code])\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "290b8744725c29785adae1a548a370c7", "score": "0.49929947", "text": "func NewCfnRouteTable(scope awscdk.Construct, id *string, props *CfnRouteTableProps) CfnRouteTable {\n\t_init_.Initialize()\n\n\tj := jsiiProxy_CfnRouteTable{}\n\n\t_jsii_.Create(\n\t\t\"monocdk.aws_ec2.CfnRouteTable\",\n\t\t[]interface{}{scope, id, props},\n\t\t&j,\n\t)\n\n\treturn &j\n}", "title": "" }, { "docid": "8cdd22d07e1eb8a9330e2532019ea7a4", "score": "0.49897614", "text": "func New(options ...Option) *Tunnel {\n\tcfg := getConfig(options...)\n\treturn &Tunnel{\n\t\tcfg: cfg,\n\t\tauth: authclient.New(\n\t\t\tauthclient.WithBrowserCommand(cfg.browserConfig),\n\t\t\tauthclient.WithTLSConfig(cfg.tlsConfig)),\n\t}\n}", "title": "" }, { "docid": "e59d7324a7c7bc53e8a37d06f9fe8b7a", "score": "0.49856243", "text": "func New(address string, timeoutDuration time.Duration) *RmServer {\r\n\r\n\t// log.Println(\"server Started !!\")\r\n\t// tcpServer := tcp_server.New(address, timeoutDuration)\r\n\r\n\trmServer := RmServer{\r\n\t\taddress: address,\r\n\t\ttimeoutDuration: timeoutDuration,\r\n\t\ttcpServer: tcp_server.New(address, timeoutDuration),\r\n\t\tServerSesionUUID: uint32(rand.Int31()),\r\n\t\tupTimeMils: time.Now().Unix() / int64(time.Microsecond),\r\n\t\tRemTopo: remtopo.New(),\r\n\t\tRootUpdateFreq: 3 * time.Second,\r\n\t\tRemLogs: remlogs.New(),\r\n\t}\r\n\r\n\tlog.Println(\"DONE creating rmServer\", rmServer)\r\n\r\n\trmServer.UpdateRootNodePeriodically()\r\n\r\n\t// rmServer.RemTopo.MakeEdgeFromIDs(12345, rmServer.ServerSesionUUID)\r\n\t// rmServer.RemTopo.MakeEdgeFromIDs(12345, 7896)\r\n\t// rmServer.RemTopo.MakeEdgeFromIDs(12345, 484654)\r\n\t// rmServer.RemTopo.MakeEdgeFromIDs(7896, 854)\r\n\r\n\trmServer.tcpServer.OnNewClient(rmServer.onNewClient)\r\n\trmServer.tcpServer.OnNewBytes(rmServer.onNewBytes)\r\n\trmServer.tcpServer.OnClientConnectionClosed(rmServer.onClientConnectionClosed)\r\n\r\n\treturn &rmServer\r\n}", "title": "" }, { "docid": "69e114093608c8bf5e54051cb59fe2ff", "score": "0.4979419", "text": "func New(s storage.Provider) (*VDR, error) {\n\treturn peer.New(s)\n}", "title": "" }, { "docid": "087b979773dd550310f186f3f84b8d98", "score": "0.49780422", "text": "func NewRoute(name string, methods []string, scheme string, host string, port int, path string, requirements Requirements) (*Route, error) {\n\tif len(path) == 0 {\n\t\treturn nil, errors.New(\"Route path cannot be empty\")\n\t}\n\n\tvar regexpFromPath, rx *regexp.Regexp\n\tvar err error\n\tvar requirementsRegexp = make(map[string]*regexp.Regexp)\n\n\tfor name, pattern := range requirements {\n\t\trx, err = regexp.Compile(pattern)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\trequirementsRegexp[name] = rx\n\t}\n\n\tregexpFromPath, err = generateRegexpFromPath(path, requirementsRegexp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar parameters = extractParamNames(path)\n\treturn &Route{name, methods, scheme, \"\", host, port, path, parameters, regexpFromPath, requirementsRegexp}, nil\n}", "title": "" }, { "docid": "dff83cec9df7ba03bc0322ef091c5ed2", "score": "0.49773106", "text": "func newRouteTablesClient(subscriptionID string, baseURI string, authorizer autorest.Authorizer) network.RouteTablesClient {\n\trouteTablesClient := network.NewRouteTablesClientWithBaseURI(baseURI, subscriptionID)\n\trouteTablesClient.Authorizer = authorizer\n\trouteTablesClient.AddToUserAgent(azure.UserAgent())\n\treturn routeTablesClient\n}", "title": "" } ]
ffdb19edc4fdaccaef4421546ee0b08c
NewMockProducer creates a new mock instance
[ { "docid": "293a8d15f955df4acc86eb533d179a0c", "score": "0.6713252", "text": "func NewMockProducer(ctrl *gomock.Controller) *MockProducer {\n\tmock := &MockProducer{ctrl: ctrl}\n\tmock.recorder = &MockProducerMockRecorder{mock}\n\treturn mock\n}", "title": "" } ]
[ { "docid": "8e2582577b1e2dbc8b35e35759e65d46", "score": "0.7634173", "text": "func NewProducer(mock string) (*Producer, error) {\n\tif mock == \"init_err\" {\n\t\treturn nil, errors.New(mock)\n\t}\n\n\treturn &Producer{\n\t\tMock: mock,\n\t\tMessages: make(map[string][]string, 0),\n\t\tStats: info.Producer{Bus: \"mock\", Sent: make(map[string]int)},\n\t}, nil\n}", "title": "" }, { "docid": "edaecce932bce05959b9ae9f8c9cf698", "score": "0.65840286", "text": "func newMockPromClient(metrics map[string]string) *promMockClient {\n\treturn &promMockClient{metrics: metrics}\n}", "title": "" }, { "docid": "4c46f8332057bdd4da27d583030f8eff", "score": "0.63388205", "text": "func NewFakeProducer() *FakeProducer {\n\treturn new(FakeProducer)\n}", "title": "" }, { "docid": "637b80e1e722482208712049ad3ec7bc", "score": "0.6250447", "text": "func newMockPrometheusAPI(t mockConstructorTestingTnewMockPrometheusAPI) *mockPrometheusAPI {\n\tmock := &mockPrometheusAPI{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "02ede93c3bbba9a36c4b40a592b7635d", "score": "0.61682606", "text": "func producerWithStubClient(sendSize int) *Producer {\n\treturn &Producer{\n\t\tStreamName: TestStream,\n\t\tSendSize: sendSize,\n\t\tclient: &StubClient{},\n\t\tmessages: make([]message, sendSize),\n\t\tThrottle: func() Throttle { return &noOpThrottle{} },\n\t}\n}", "title": "" }, { "docid": "3d2d5a57b1d84342a72eb8f107e51485", "score": "0.60632217", "text": "func NewMockPusher() (*pusher, string, chan<- bool) {\n\ttmpfolder, _ := ioutil.TempDir(\"\", \"\")\n\tshutdownChan := make(chan bool)\n\tsvc := NewAlwaysPassMockLogClient()\n\twg := sync.WaitGroup{}\n\twg.Add(1)\n\tp := newPusher(&logGroup, &logStreamName, &tmpfolder, time.Second, svc, shutdownChan, &wg)\n\tp.publisher, _ = publisher.NewPublisher(publisher.NewNonBlockingFifoQueue(1), 1, 2*time.Second, p.pushLogEventBatch)\n\treturn p, tmpfolder, shutdownChan\n}", "title": "" }, { "docid": "d98a666ccb60786cda644ef5959fc55d", "score": "0.60566497", "text": "func NewInMemoryLoggerProducer() LoggerProducer { return &InMemoryLoggerOptions{} }", "title": "" }, { "docid": "d98a666ccb60786cda644ef5959fc55d", "score": "0.60566497", "text": "func NewInMemoryLoggerProducer() LoggerProducer { return &InMemoryLoggerOptions{} }", "title": "" }, { "docid": "bd590a61d67f19663e3cfa21651e7ccd", "score": "0.59807867", "text": "func (m *MockSenderClient) Produce() (sender.Message, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Produce\")\n\tret0, _ := ret[0].(sender.Message)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "aad2e2e8cc930e9c4345adfa963967ff", "score": "0.59299165", "text": "func newMockLogStreamer(t mockConstructorTestingTnewMockLogStreamer) *mockLogStreamer {\n\tmock := &mockLogStreamer{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "501f9f4ab6bc7a1efb7782892e719499", "score": "0.5908353", "text": "func newProducer(addr string, options ...func(*nsq.Config)) (*nsq.Producer, error) {\n\tcfg := nsq.NewConfig()\n\tfor _, option := range options {\n\t\toption(cfg)\n\t}\n\n\tproducer, err := nsq.NewProducer(addr, cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tproducer.SetLogger(log.New(os.Stderr, \"\", log.Flags()), nsq.LogLevelError)\n\treturn producer, nil\n}", "title": "" }, { "docid": "3d812e43bbf60b98f427117417ee67a7", "score": "0.587989", "text": "func (m *MockPublicKeyFinderClient) Produce() (mailbox.PubKeyFinder, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Produce\")\n\tret0, _ := ret[0].(mailbox.PubKeyFinder)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "273aa9ac8644d8da3f98e3d0cee10c98", "score": "0.58769345", "text": "func publisherForTest() *mock.PublisherMock {\n\treturn mock.NewPublisher()\n}", "title": "" }, { "docid": "dc90fd6e890d42b336604657347a00c9", "score": "0.5871503", "text": "func (m *MockSentClient) Produce(client string) (sender.Message, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Produce\", client)\n\tret0, _ := ret[0].(sender.Message)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "90e0a620fb51cd9fda0a8e6613d84553", "score": "0.5840289", "text": "func newSenderTestMock(ctx context.Context) *senderTestMock {\n\tctx, cancel := context.WithCancel(ctx)\n\tservice := &mockService{}\n\tlocal := &mockSender{Base: send.NewBase(\"test\")}\n\n\treturn &senderTestMock{\n\t\tservice: service,\n\t\tlocal: local,\n\t\tsender: &sender{\n\t\t\tctx: ctx,\n\t\t\tcancel: cancel,\n\t\t\topts: LoggerOptions{\n\t\t\t\tParse: func(rawLine string) (LogLine, error) {\n\t\t\t\t\treturn LogLine{Data: rawLine}, nil\n\t\t\t\t},\n\t\t\t\tLocal: local,\n\t\t\t\tMaxBufferSize: 4096,\n\t\t\t},\n\t\t\twrite: service.write,\n\t\t\tBase: send.NewBase(\"test\"),\n\t\t},\n\t}\n}", "title": "" }, { "docid": "e56e22a437d1d806c8d9986becac316b", "score": "0.5830233", "text": "func NewMock(config *provider.Config, tracker *acomm.Tracker) (*Mock, error) {\n\ts := common.Suite{}\n\ts.KVPrefix = \"mock-kv-provider\"\n\ts.KVCmdMaker = common.ConsulMaker\n\ts.SetupSuite()\n\n\tv := viper.New()\n\tflagset := pflag.NewFlagSet(\"mock-kv-provider\", pflag.PanicOnError)\n\tconf := NewConfig(flagset, v)\n\ts.Require().NoError(flagset.Parse(nil))\n\tv.Set(\"service_name\", \"mock-kv-provider\")\n\tv.Set(\"socket_dir\", config.SocketDir())\n\tv.Set(\"coordinator_url\", config.CoordinatorURL())\n\tv.Set(\"log_level\", \"fatal\")\n\tv.Set(\"address\", s.KVURL)\n\ts.Require().NoError(config.LoadConfig())\n\ts.Require().NoError(config.SetupLogging())\n\n\tkv, err := New(conf, tracker)\n\ts.Require().NoError(err)\n\terr = errorKVDown\n\tfor range [5]struct{}{} {\n\t\tif !kv.kvDown() {\n\t\t\terr = nil\n\t\t\tbreak\n\t\t}\n\t\ttime.Sleep(1 * time.Second)\n\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Mock{KV: kv, cmd: s.KVCmd, dir: s.KVDir}, nil\n}", "title": "" }, { "docid": "a427b57e47d456aa061bc81e5b1fb9b0", "score": "0.5792173", "text": "func New(t T) *Tester {\n\n\t// activate the logger if debug is turned on\n\tif *debug {\n\t\tlogger = log.New(os.Stderr, \"<Tester> \", 0)\n\t}\n\n\ttester := &Tester{\n\t\tt: t,\n\t\tcodecs: make(map[string]goka.Codec),\n\t\ttopicQueues: make(map[string]*queue),\n\t\tstorages: make(map[string]storage.Storage),\n\t}\n\ttester.producerMock = newProducerMock(tester.handleEmit)\n\ttester.topicMgrMock = newTopicMgrMock(tester)\n\treturn tester\n}", "title": "" }, { "docid": "bca511892c8781bb834961b7b76ad6dd", "score": "0.576448", "text": "func newMockAnalyticsProvider(t mockConstructorTestingTnewMockAnalyticsProvider) *mockAnalyticsProvider {\n\tmock := &mockAnalyticsProvider{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "91e5c590b86dcde1c58cfb77ead87f52", "score": "0.57512885", "text": "func performCreateSyncProducerTest(t *testing.T, username string, password string) {\n\n\t// Create A Mock SyncProducer\n\tmockSyncProducer := &MockSyncProducer{}\n\n\t// Stub The Kafka SyncProducer Creation Wrapper With Test Version Returning Mock SyncProducer\n\tnewSyncProducerWrapperPlaceholder := newSyncProducerWrapper\n\tnewSyncProducerWrapper = func(brokers []string, config *sarama.Config) (sarama.SyncProducer, error) {\n\t\tassert.NotNil(t, brokers)\n\t\tassert.Len(t, brokers, 1)\n\t\tassert.Equal(t, brokers[0], KafkaBrokers)\n\t\tverifySaramaConfig(t, config, ClientId, username, password)\n\t\treturn mockSyncProducer, nil\n\t}\n\tdefer func() { newSyncProducerWrapper = newSyncProducerWrapperPlaceholder }()\n\n\tconfig, err := client.NewConfigBuilder().\n\t\tWithDefaults().\n\t\tFromYaml(commontesting.SaramaDefaultConfigYaml).\n\t\tWithAuth(&client.KafkaAuthConfig{\n\t\t\tSASL: &client.KafkaSaslConfig{\n\t\t\t\tUser: username,\n\t\t\t\tPassword: password,\n\t\t\t},\n\t\t}).\n\t\tWithClientId(ClientId).\n\t\tBuild()\n\tassert.Nil(t, err)\n\n\t// Perform The Test\n\tproducer, registry, err := CreateSyncProducer([]string{KafkaBrokers}, config)\n\n\t// Verify The Results\n\tassert.Nil(t, err)\n\tassert.NotNil(t, producer)\n\tassert.Equal(t, mockSyncProducer, producer)\n\tassert.NotNil(t, registry)\n}", "title": "" }, { "docid": "8ceef1e1955f36ef7a43686b57b09da6", "score": "0.575026", "text": "func New() *Mocker {\n\treturn &Mocker{}\n}", "title": "" }, { "docid": "c1b0f47f1ff357d013e1e14f6c6db40e", "score": "0.5749018", "text": "func createMock(t *testing.T) (*gomock.Controller, *protos.MockDriverClient) {\n\t// Create a mock\n\tctrl := gomock.NewController(t)\n\tmock := protos.NewMockDriverClient(ctrl)\n\treturn ctrl, mock\n}", "title": "" }, { "docid": "29bc482ab729340ac6d71c2ee52b31cc", "score": "0.5747157", "text": "func (h *Expecter) new() *Expecter {\n\treturn &Expecter{\n\t\tadapter: h.adapter,\n\t\tcallmap: make(map[string][]interface{}),\n\t\tgorm: h.gorm,\n\t\tnoop: h.noop,\n\t\trecorder: &Recorder{},\n\t}\n}", "title": "" }, { "docid": "a714d051e63072709bee9219a324e259", "score": "0.5734998", "text": "func (m *MockReceiverClient) Produce() (mailbox.Receiver, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Produce\")\n\tret0, _ := ret[0].(mailbox.Receiver)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "66519c2c5af53979549cca94660166e4", "score": "0.572199", "text": "func NewKafkaProducerClientMock() *KafkaProducerClientMock {\n\tk := &KafkaProducerClientMock{\n\t\tEventsChan: make(chan kafka.Event),\n\t\tProduceChan: make(chan *kafka.Message),\n\t\tSentMessages: 0,\n\t}\n\treturn k\n}", "title": "" }, { "docid": "becf0e08a8f8cfe7715d4955b17d741e", "score": "0.5692772", "text": "func newAccountProducerProxy(executor *MigrationExecutor, producer AccountProducer, channelLen int) *accountProducerProxy {\n\treturn &accountProducerProxy{\n\t\texecutor: executor,\n\t\tproducer: producer,\n\t\tch: make(chan interface{}, channelLen),\n\t}\n}", "title": "" }, { "docid": "350ddb10d6a606ee8a1de25b5e8f8fe2", "score": "0.56666136", "text": "func (m *MessageBusMock) NewRecorder(p context.Context) (r core.MessageBus, r1 error) {\n\tatomic.AddUint64(&m.NewRecorderPreCounter, 1)\n\tdefer atomic.AddUint64(&m.NewRecorderCounter, 1)\n\n\tif m.NewRecorderMock.mockExpectations != nil {\n\t\ttestify_assert.Equal(m.t, *m.NewRecorderMock.mockExpectations, MessageBusMockNewRecorderParams{p},\n\t\t\t\"MessageBus.NewRecorder got unexpected parameters\")\n\n\t\tif m.NewRecorderFunc == nil {\n\n\t\t\tm.t.Fatal(\"No results are set for the MessageBusMock.NewRecorder\")\n\n\t\t\treturn\n\t\t}\n\t}\n\n\tif m.NewRecorderFunc == nil {\n\t\tm.t.Fatal(\"Unexpected call to MessageBusMock.NewRecorder\")\n\t\treturn\n\t}\n\n\treturn m.NewRecorderFunc(p)\n}", "title": "" }, { "docid": "2d3ff0b0668ff9f5390a16f17c4735ff", "score": "0.5647137", "text": "func TestNew(t *testing.T) {\n\t// We can't test the \"dummy\" client because\n\t// it is a private attribute\n\tsubject.New()\n}", "title": "" }, { "docid": "0a76fcd55121798b278abb265463b564", "score": "0.563875", "text": "func (m *MockNameServiceDomainClient) Produce() (nameservice.ForwardLookup, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Produce\")\n\tret0, _ := ret[0].(nameservice.ForwardLookup)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "7b71dc6b45cb4d2f25db8a96af85767b", "score": "0.5631112", "text": "func NewMockProducerClient(ctrl *gomock.Controller) *MockProducerClient {\n\tmock := &MockProducerClient{ctrl: ctrl}\n\tmock.recorder = &MockProducerClientMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "7a7b4adee414dbf83e152d58fae4fb05", "score": "0.56093735", "text": "func (m *MockProducer) EXPECT() *MockProducerMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "7a7b4adee414dbf83e152d58fae4fb05", "score": "0.56093735", "text": "func (m *MockProducer) EXPECT() *MockProducerMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "7a7b4adee414dbf83e152d58fae4fb05", "score": "0.56093735", "text": "func (m *MockProducer) EXPECT() *MockProducerMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "172406e0548b0a863aa2f1658a79ffcf", "score": "0.5604434", "text": "func Mock(e *consensus.Emitter, inert bool) Generator {\n\treturn &mock{e, inert}\n}", "title": "" }, { "docid": "172406e0548b0a863aa2f1658a79ffcf", "score": "0.5604434", "text": "func Mock(e *consensus.Emitter, inert bool) Generator {\n\treturn &mock{e, inert}\n}", "title": "" }, { "docid": "81914e6c2c5459a25ae4b05a10fbe764", "score": "0.5604092", "text": "func NewProducer(broker string) (Producer, error) {\n\tkafkaConfig := sarama.NewConfig()\n\tkafkaConfig.Producer.Return.Successes = true\n\n\tkafkaProducer, err := sarama.NewSyncProducer([]string{broker}, kafkaConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &producer{Producer: kafkaProducer}, nil\n}", "title": "" }, { "docid": "8a080d40f32f7ce9204140296f9d2962", "score": "0.5590444", "text": "func NewProducer() {\n\n\tfor {\n\t\tfmt.Println(\"Creating Producer\")\n\t\tp, err := kafka.NewProducer(&kafka.ConfigMap{\n\t\t\t\"bootstrap.servers\": kafkaServer,\n\t\t})\n\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t} else {\n\t\t\tfmt.Println(\"Producer created\")\n\t\t\tproducer = p\n\t\t\tbreak\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "64f0e96f8c4dcf3837179bc66b18077e", "score": "0.5589251", "text": "func NewMock() *MockDependency {\n\treturn &MockDependency{\n\t\tT: TypeInfo{\n\t\t\tName: \"mock\",\n\t\t\tVersion: 0,\n\t\t},\n\t\tJobEdges: NewJobEdges(),\n\t}\n}", "title": "" }, { "docid": "186078b3c2c43ebc085fd30c7652b116", "score": "0.5580368", "text": "func NewProducer(brokers []string, options ...Option) (*Producer, error) {\n\tclient, err := initClient(brokers, options...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tproducer, err := sarama.NewSyncProducerFromClient(client)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Producer{\n\t\tproducer: producer,\n\t}, nil\n}", "title": "" }, { "docid": "b31a66b94dd676bac0950f8800a3181e", "score": "0.55788225", "text": "func (m *MockBalanceFinderClient) Produce() (mailbox.BalanceFinder, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Produce\")\n\tret0, _ := ret[0].(mailbox.BalanceFinder)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "c1bddad01e6def27b51c46d4c507f537", "score": "0.55663306", "text": "func NewProducer(uri, exchangeName, exchangeType, queue, bindingKey string) *Producer {\n\treturn &Producer{\n\t\turi: uri,\n\t\texchangeName: exchangeName,\n\t\texchangeType: exchangeType,\n\t\tqueue: queue,\n\t\tbindingKey: bindingKey,\n\t\treConn: make(chan *amqp.Error),\n\t}\n}", "title": "" }, { "docid": "b348ccf8e47248748363ed8c87054dd9", "score": "0.5563714", "text": "func (km *Tester) ProducerBuilder() kafka.ProducerBuilder {\n\treturn func(b []string, cid string, hasher func() hash.Hash32) (kafka.Producer, error) {\n\t\treturn km.producerMock, nil\n\t}\n}", "title": "" }, { "docid": "4f0d93cbd2806a1113877060dec85d52", "score": "0.5534824", "text": "func newMockDiagnosticsProvider(t mockConstructorTestingTnewMockDiagnosticsProvider) *mockDiagnosticsProvider {\n\tmock := &mockDiagnosticsProvider{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "914061515d0bca77c3da05a73bfeec51", "score": "0.5532983", "text": "func NewProducer(addr string, config *Config) (*Producer, error) {\n\tconfig.assertInitialized()\n\terr := config.Validate()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tp := &Producer{\n\t\tid: atomic.AddInt64(&instCount, 1),\n\n\t\taddr: addr,\n\t\tconfig: *config,\n\n\t\tlogger: log.New(os.Stderr, \"\", log.Flags()),\n\t\tlogLvl: LogLevelInfo,\n\n\t\ttransactionChan: make(chan *ProducerTransaction),\n\t\texitChan: make(chan int),\n\t\tresponseChan: make(chan []byte),\n\t\terrorChan: make(chan []byte),\n\t}\n\treturn p, nil\n}", "title": "" }, { "docid": "2b7c44d61fea37fad5baed27f2986839", "score": "0.5527359", "text": "func newMockZkClient(initialChildren ...string) (mocked *mockZkClient, snaps chan []string, errs chan error) {\n\tvar doneOnce sync.Once\n\tdone := make(chan struct{})\n\n\tmocked = &mockZkClient{}\n\tmocked.On(\"stop\").Return().Run(func(_ mock.Arguments) { doneOnce.Do(func() { close(done) }) })\n\tmocked.On(\"stopped\").Return((<-chan struct{})(done))\n\n\tif initialChildren != nil {\n\t\terrs = make(chan error) // this is purposefully unbuffered (some tests depend on this)\n\t\tsnaps = make(chan []string, 1)\n\t\tsnaps <- initialChildren[:]\n\t\tmocked.On(\"watchChildren\", currentPath).Return(\n\t\t\ttest_zk_path, (<-chan []string)(snaps), (<-chan error)(errs)).Run(\n\t\t\tfunc(_ mock.Arguments) { log.V(1).Infoln(\"watchChildren invoked\") })\n\t}\n\treturn\n}", "title": "" }, { "docid": "bdd564d94c904bd4b2bef561c6ea5dfa", "score": "0.5521154", "text": "func producerRespondingWith(sendSize int, responses ...clientResponse) *Producer {\n\treturn &Producer{\n\t\tStreamName: TestStream,\n\t\tSendSize: sendSize,\n\t\tclient: &StubClient{responses: responses},\n\t\tmessages: make([]message, sendSize),\n\t\tThrottle: func() Throttle { return &noOpThrottle{} },\n\t}\n}", "title": "" }, { "docid": "c8abfb528a03e9a08f9e800f5273b7e1", "score": "0.5519368", "text": "func NewProducer(trans io.Writer, ser serializer.Serializer, deadline time.Time, rateBytesPerSec int64, waitGroup *sync.WaitGroup) (producer *Producer, err error) {\n\tproducer = new(Producer)\n\tproducer.transport = trans\n\tproducer.serializer = ser\n\tproducer.deadline = deadline\n\tproducer.generator = generator.NewGenerator(rateBytesPerSec)\n\tproducer.waitGroup = waitGroup\n\treturn producer, nil\n}", "title": "" }, { "docid": "bfa4f5f04a607868fd73acfd7099fe4c", "score": "0.5496074", "text": "func NewProducer(config *Config) (Producer, error) {\n\taddr := []string{fmt.Sprintf(\"%v:%v\", config.Host, config.Port)}\n\tsaramaProducer, err := sarama.NewSyncProducer(addr, nil)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &producer{\n\t\tKafkaProducer: saramaProducer,\n\t\tConfig: config,\n\t}, nil\n}", "title": "" }, { "docid": "1bce2c695da23136d2cdc098c488a922", "score": "0.54886776", "text": "func (p *producerMock) Close() error {\n\tlogger.Printf(\"Closing producer mock\")\n\treturn nil\n}", "title": "" }, { "docid": "48d0a7f89760058ff8f560942cec0d6f", "score": "0.5488393", "text": "func (m *MockObjectRequester) Write(ctx context.Context, prov peer.AddrInfo, pid protocol.ID, data []byte) (network.Stream, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Write\", ctx, prov, pid, data)\n\tret0, _ := ret[0].(network.Stream)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "8041cead5d980cbee00f77ad5bf51343", "score": "0.5458771", "text": "func NewProducer(opt ProducerOptions, ropt *redis.ClusterOptions) (*Producer, error) {\n\tclient, err := newClient(clientOptions{\n\t\tname: opt.Name,\n\t\tshardsCount: opt.ShardsCount,\n\t\tropt: ropt,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tretr := retrier.New(retrier.Config{RetryPolicy: []time.Duration{time.Second * 1}})\n\tc := make(chan string, opt.PendingBufferSize)\n\n\tpr := &Producer{\n\t\tcl: client,\n\t\twg: &sync.WaitGroup{},\n\t\topt: opt,\n\t\tc: c,\n\t\tretr: retr,\n\t}\n\n\tpr.wg.Add(1)\n\tgo pr.produce()\n\n\treturn pr, nil\n}", "title": "" }, { "docid": "4d8af978574570ea65395e9de9a43baa", "score": "0.54548043", "text": "func NewTargetMock() *TargetMock { return &TargetMock{} }", "title": "" }, { "docid": "4d8af978574570ea65395e9de9a43baa", "score": "0.54548043", "text": "func NewTargetMock() *TargetMock { return &TargetMock{} }", "title": "" }, { "docid": "f2db9b2677f11e61c06499e35b218ad0", "score": "0.5429529", "text": "func newMockQueryProvider(t mockConstructorTestingTnewMockQueryProvider) *mockQueryProvider {\n\tmock := &mockQueryProvider{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "73277b22bac642ab87807efb6d554d7d", "score": "0.5414491", "text": "func NewMock(t *testing.T, expectedStarts int) *Mock {\n\tret := &Mock{\n\t\tUnsynchronizedMock: UnsynchronizedMock{\n\t\t\tnow: time.Unix(0, 0),\n\t\t\tstartCheckpoint: NewFailOnUnexpectedCheckpoint(TimerStart, t),\n\t\t},\n\t}\n\tExpectUpcomingStarts(expectedStarts).UpcomingEventsOption(&ret.UnsynchronizedMock)\n\treturn ret\n}", "title": "" }, { "docid": "62bc41694f11a8e7ff22a6b790f1c7a2", "score": "0.54133564", "text": "func (m *MockProducerClient) Produce(arg0 context.Context, arg1 *producer.Timber, arg2 ...grpc.CallOption) (*producer.ProduceResult, 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, \"Produce\", varargs...)\n\tret0, _ := ret[0].(*producer.ProduceResult)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "12a7ce8cbbde5ff2e84cdfdab973bd41", "score": "0.5411521", "text": "func TestCreateSyncProducer(t *testing.T) {\n\tperformCreateSyncProducerTest(t, \"\", \"\")\n}", "title": "" }, { "docid": "52cedb6d46e4387c32c173025b731e73", "score": "0.5389358", "text": "func New(config Config, addrs ...string) (*Producer, error) {\n\terr := verifyConfig(&config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tp, err := sarama.NewSyncProducer(addrs, &config.Config)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"producer: failed to create a producer\")\n\t}\n\n\treturn NewFrom(p, config)\n}", "title": "" }, { "docid": "6326a6528a009c6c90ba94a844d83a1c", "score": "0.5373609", "text": "func MockAMQPSender(notifier chan string) *AMQPServer {\n\tserver := &AMQPServer{}\n\treturn server\n}", "title": "" }, { "docid": "f7e1ba7b904694c8e2c6581a5031ef69", "score": "0.53720266", "text": "func New() *Mock {\n\treturn &Mock{\n\t\tdata: make(map[string][]byte, 10),\n\t}\n}", "title": "" }, { "docid": "8e700e649e14c08cc7fce4054f2f84fe", "score": "0.53688955", "text": "func NewMockWither(t *testing.T) *MockWither {\n\tm := &MockWither{}\n\tm.Test(t)\n\treturn m\n}", "title": "" }, { "docid": "67e661ae48e7d26b290e74259e019e60", "score": "0.5352757", "text": "func (m *MockMux) On(arg0 go_extensions_redis.Hash) go_extensions_redis.Client {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"On\", arg0)\n\tret0, _ := ret[0].(go_extensions_redis.Client)\n\treturn ret0\n}", "title": "" }, { "docid": "f6be08479bb8d555ff9d466159966cd1", "score": "0.533411", "text": "func NewProducer(c *conf.KafkaProducer) (p *Producer) {\n\tvar err error\n\tp = &Producer{\n\t\tc: c,\n\t\tenv: fmt.Sprintf(\"zookeeper%s@%v|brokers%v|sync(%t)\", c.Zookeeper.Root, c.Zookeeper.Addrs, c.Brokers, c.Sync),\n\t}\n\tif !c.Sync {\n\t\tif err = p.asyncDial(); err != nil {\n\t\t\tgo p.reAsyncDial()\n\t\t}\n\t} else {\n\t\tif err = p.syncDial(); err != nil {\n\t\t\tgo p.reSyncDial()\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "706a973ec4504758a07d4dbbeb15490a", "score": "0.53289133", "text": "func newKafkaProducer(brokers []string) sarama.AsyncProducer {\n\tproducerConfig := sarama.NewConfig()\n\tproducerConfig.Producer.RequiredAcks = sarama.WaitForLocal // Only wait for the leader to ack\n\tproducerConfig.Producer.Compression = sarama.CompressionSnappy // Compress messages\n\tproducerConfig.Producer.Flush.Frequency = 500 * time.Millisecond // Flush batches every 500ms\n\n\tproducer, err := sarama.NewAsyncProducer(brokers, producerConfig)\n\tif err != nil {\n\t\tlog.Fatalln(\"Failed to start Sarama producer:\", err)\n\t}\n\n\t// We will just log to STDOUT if we're not able to produce messages.\n\t// Note: messages will only be returned here after all retry attempts are exhausted.\n\tgo func() {\n\t\tfor err := range producer.Errors() {\n\t\t\tlog.Println(\"Failed to write message:\", err)\n\t\t}\n\t}()\n\n\treturn producer\n}", "title": "" }, { "docid": "c920195018541fc0cf9e61f0aef3f28d", "score": "0.53200597", "text": "func CreateMock(client CommonAPIClient) *Handler {\n\treturn &Handler{client}\n}", "title": "" }, { "docid": "046e9057c6b2a1a1e209b9e88951b6b3", "score": "0.53048366", "text": "func NewProducer() *Producer {\n\tconfig := sarama.NewConfig()\n\tconfig.Producer.Partitioner = sarama.NewRandomPartitioner\n\tconfig.Producer.RequiredAcks = sarama.WaitForAll\n\tconfig.Producer.Return.Successes = true\n\tc, err := sarama.NewSyncProducer([]string{\n\t\t\"kafka-01:9092\",\n\t\t\"kafka-02:9092\",\n\t\t\"kafka-03:9092\"}, config)\n\tif err != nil{\n\t\tpanic(err)\n\t}\n\n\treturn &Producer{ChatProducer: c}\n}", "title": "" }, { "docid": "d22ce1721fb99b85d46ffb5137f46e5b", "score": "0.52998734", "text": "func NewMock(engineMounts map[string]EngineType) *Mock {\n\treturn &Mock{\n\t\tcontents: map[string]*api.Secret{},\n\t\tengineMounts: engineMounts,\n\t}\n}", "title": "" }, { "docid": "ad36f6f38f466f39fe66db94d1f3d357", "score": "0.52822304", "text": "func NewProbe(t interface {\n\tmock.TestingT\n\tCleanup(func())\n}) *Probe {\n\tmock := &Probe{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "4157bee0567983902cd7cd8e4110f280", "score": "0.5265696", "text": "func NewMock() *Mock {\n\treturn new(Mock)\n}", "title": "" }, { "docid": "0a84482fd65e7ddff7764a71e06a696d", "score": "0.52609146", "text": "func NewProducer(opts *ProducerOpts) *Producer {\n\t// Required arguments\n\tif opts.Address == \"\" && opts.Client == nil {\n\t\tpanic(\"A redis client must be provided.\")\n\t}\n\n\tif opts.Queue == \"\" {\n\t\tpanic(\"A queue name must be provided.\")\n\t}\n\n\t// Computed properties\n\tvar client *redis.Client\n\tif opts.Client != nil {\n\t\tclient = opts.Client\n\t} else {\n\t\tclient = redis.NewClient(&redis.Options{\n\t\t\tAddr: opts.Address,\n\t\t})\n\t}\n\n\tqueue := newQueue(&queueOpts{\n\t\tName: opts.Queue,\n\t})\n\n\t// Embed Lua scripts\n\tprepScripts()\n\tpushJobScript := loadLua(\"/lua/push_job.lua\")\n\tscheduleJobScript := loadLua(\"/lua/schedule_job.lua\")\n\n\treturn &Producer{\n\t\topts: opts.withDefaults(),\n\n\t\t// Computed properties\n\t\tclient: client,\n\t\tqueue: queue,\n\n\t\t// Scripts\n\t\tpushJobScript: pushJobScript,\n\t\tscheduleJobScript: scheduleJobScript,\n\t}\n}", "title": "" }, { "docid": "6c792b5a4b0e96848537957b149d0504", "score": "0.5260222", "text": "func NewProducer(appName, eventingAdminPort, eventingDir, kvPort, metakvAppHostPortsPath, nsServerPort, uuid string,\n\tsuperSup common.EventingSuperSup) *Producer {\n\tp := &Producer{\n\t\tappName: appName,\n\t\tbootstrapFinishCh: make(chan struct{}, 1),\n\t\teventingAdminPort: eventingAdminPort,\n\t\teventingDir: eventingDir,\n\t\teventingNodeUUIDs: make([]string, 0),\n\t\tkvPort: kvPort,\n\t\tlistenerHandles: make([]*abatableListener, 0),\n\t\tmetakvAppHostPortsPath: metakvAppHostPortsPath,\n\t\tnotifyInitCh: make(chan struct{}, 1),\n\t\tnotifySettingsChangeCh: make(chan struct{}, 1),\n\t\tnotifySupervisorCh: make(chan struct{}),\n\t\tnsServerPort: nsServerPort,\n\t\tsuperSup: superSup,\n\t\ttopologyChangeCh: make(chan *common.TopologyChangeMsg, 10),\n\t\tuuid: uuid,\n\t\tworkerNameConsumerMap: make(map[string]common.EventingConsumer),\n\t}\n\n\tp.eventingNodeUUIDs = append(p.eventingNodeUUIDs, uuid)\n\treturn p\n}", "title": "" }, { "docid": "1933fb487916303e86ae9ffae76a1ef1", "score": "0.5258846", "text": "func newMockTransactor(t *testing.T) mockTransactor {\n\treturn mockTransactor{t: t}\n}", "title": "" }, { "docid": "fb5b25ed5aa0126ab52d1a04f73accb7", "score": "0.52490306", "text": "func mockSenderSupplied() *SenderSupplied {\n\tss := NewSenderSupplied()\n\tss.UserRequestCorrelation = \"User Req\"\n\tss.MessageDuplicationCode = MessageDuplicationOriginal\n\treturn ss\n}", "title": "" }, { "docid": "8be84060dabfd96f83d47c07d9ce2798", "score": "0.52489185", "text": "func (m *MockNetworkClient) ProduceSender(senders *settings.Senders) (sender.Message, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ProduceSender\", senders)\n\tret0, _ := ret[0].(sender.Message)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "bf627172f4172445c657a26c735fe530", "score": "0.5246364", "text": "func newRunner(output string, err error) *MockRunner {\n\tm := &MockRunner{}\n\tm.On(\"Run\", mock.Anything).Return([]byte(output), err)\n\treturn m\n}", "title": "" }, { "docid": "4030793a5f8cde8c03d7668d8a3f83e7", "score": "0.5241133", "text": "func newKafkaProducerClient(ctx context.Context, bConfig *BrokerConfig, options *ProducerClientOptions) (Producer, error) {\n\terr := validateKafkaProducerBrokerConfig(bConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = validateKafkaProducerClientConfig(options)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlogger.Ctx(ctx).Infow(\"kafka producer: initializing new\", \"options\", options)\n\n\tconfigMap := &kafkapkg.ConfigMap{\n\t\t\"bootstrap.servers\": strings.Join(bConfig.Brokers, \",\"),\n\t}\n\n\tif bConfig.EnableTLS {\n\t\tcerts, err := readKafkaCerts(bConfig.CertDir)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tconfigMap.SetKey(\"security.protocol\", \"ssl\")\n\t\tconfigMap.SetKey(\"ssl.ca.location\", certs.caCertPath)\n\t\tconfigMap.SetKey(\"ssl.certificate.location\", certs.userCertPath)\n\t\tconfigMap.SetKey(\"ssl.key.location\", certs.userKeyPath)\n\t}\n\n\tp, err := kafkapkg.NewProducer(configMap)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlogger.Ctx(ctx).Infow(\"kafka producer: initialized\")\n\n\treturn &KafkaBroker{\n\t\tProducer: p,\n\t\tConfig: bConfig,\n\t\tPOptions: options,\n\t}, nil\n}", "title": "" }, { "docid": "e0269f5c960bfa941a9191183e69f474", "score": "0.5237131", "text": "func NewMock() Store {\n\ttodos := make(map[int]*types.Todo)\n\ttodos[1] = &types.Todo{\n\t\tID: 1,\n\t\tName: \"Shower\",\n\t\tCreatedTime: time.Now(),\n\t\tDueTime: time.Now().Add(time.Hour * 48),\n\t}\n\treturn &mock{\n\t\ttodos: todos,\n\t}\n}", "title": "" }, { "docid": "4dfd8402608db6e3aadd47aba1902247", "score": "0.5234041", "text": "func NewProducer(ctx context.Context, conf Config, logger *log.Logger) (Producer, error) {\n\tproducer, err := createProducer(conf, logger)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &kafkaProducer{\n\t\tconf: conf,\n\t\tctx: ctx,\n\t\tproducer: producer,\n\t\terrors: make(chan error, errorQueueSize),\n\t\tlogger: logger,\n\t}, nil\n}", "title": "" }, { "docid": "a40cda74b146ea26183b002d560c215a", "score": "0.52205753", "text": "func NewMock() *Mock {\n\treturn &Mock{\n\t\tcontents: map[string]*api.Secret{},\n\t}\n}", "title": "" }, { "docid": "4d3ac46c0065b07228fbf510c999e76b", "score": "0.52175665", "text": "func (m *MockProducer) Emit(arg0, arg1 string, arg2 []byte) *Promise {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Emit\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(*Promise)\n\treturn ret0\n}", "title": "" }, { "docid": "07f0438f92dae49b612c892360bdd8ad", "score": "0.5210717", "text": "func (m *mMessageBusMockNewPlayer) Expect(p context.Context, p1 io.Reader) *mMessageBusMockNewPlayer {\n\tm.mockExpectations = &MessageBusMockNewPlayerParams{p, p1}\n\treturn m\n}", "title": "" }, { "docid": "e2637df4b6f01fabfbafcaf0101b6578", "score": "0.5206837", "text": "func NewMockBroker(t TestState, brokerID int) *MockBroker {\n\tvar err error\n\n\tbroker := &MockBroker{\n\t\tstopper: make(chan bool),\n\t\tt: t,\n\t\tbrokerID: brokerID,\n\t\texpectations: make(chan encoder, 512),\n\t}\n\n\tbroker.listener, err = net.Listen(\"tcp\", \"localhost:0\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\t_, portStr, err := net.SplitHostPort(broker.listener.Addr().String())\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\ttmp, err := strconv.ParseInt(portStr, 10, 32)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tbroker.port = int32(tmp)\n\n\tgo broker.serverLoop()\n\n\treturn broker\n}", "title": "" }, { "docid": "0660773ffcff0b48bdc6c3649e0f1811", "score": "0.52046794", "text": "func (p *producerMock) Emit(topic string, key string, value []byte) *kafka.Promise {\n\treturn p.emitter(topic, key, value)\n}", "title": "" }, { "docid": "95e4dcbd95ff838146f41388eb6e2270", "score": "0.5200755", "text": "func (m *MockProducerClient) EXPECT() *MockProducerClientMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "e49ab5b333e874e832db446b336f75b6", "score": "0.5198284", "text": "func Mock() types.Package {\n\ttmpDir, err := ioutil.TempDir(\"\", \"\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\twriter := New(tmpDir)\n\tfor _, artifact := range mockArtifacts {\n\t\tif err := writer.Put(artifact); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\treturn writer\n}", "title": "" }, { "docid": "7efccb1828e2474f7c6342d1fca8b7f8", "score": "0.51720256", "text": "func NewMock() *mockClient {\n\treturn &mockClient{}\n}", "title": "" }, { "docid": "66b7744eb151fab52b56a174dc7f3d34", "score": "0.517029", "text": "func NewCommunicatorMock(t minimock.Tester) *CommunicatorMock {\n\tm := &CommunicatorMock{t: t}\n\n\tif controller, ok := t.(minimock.MockController); ok {\n\t\tcontroller.RegisterMocker(m)\n\t}\n\n\tm.ExchangePhase1Mock = mCommunicatorMockExchangePhase1{mock: m}\n\tm.ExchangePhase2Mock = mCommunicatorMockExchangePhase2{mock: m}\n\tm.ExchangePhase21Mock = mCommunicatorMockExchangePhase21{mock: m}\n\tm.ExchangePhase3Mock = mCommunicatorMockExchangePhase3{mock: m}\n\tm.InitMock = mCommunicatorMockInit{mock: m}\n\n\treturn m\n}", "title": "" }, { "docid": "84327ffacc04b0c278a2bdc7b0943787", "score": "0.5166524", "text": "func (m *MessageBusMock) NewPlayer(p context.Context, p1 io.Reader) (r core.MessageBus, r1 error) {\n\tatomic.AddUint64(&m.NewPlayerPreCounter, 1)\n\tdefer atomic.AddUint64(&m.NewPlayerCounter, 1)\n\n\tif m.NewPlayerMock.mockExpectations != nil {\n\t\ttestify_assert.Equal(m.t, *m.NewPlayerMock.mockExpectations, MessageBusMockNewPlayerParams{p, p1},\n\t\t\t\"MessageBus.NewPlayer got unexpected parameters\")\n\n\t\tif m.NewPlayerFunc == nil {\n\n\t\t\tm.t.Fatal(\"No results are set for the MessageBusMock.NewPlayer\")\n\n\t\t\treturn\n\t\t}\n\t}\n\n\tif m.NewPlayerFunc == nil {\n\t\tm.t.Fatal(\"Unexpected call to MessageBusMock.NewPlayer\")\n\t\treturn\n\t}\n\n\treturn m.NewPlayerFunc(p, p1)\n}", "title": "" }, { "docid": "846e6bc74b9222c2a8fbe11ea5689856", "score": "0.5163416", "text": "func NewSyncProducer(t ErrorReporter, config *sarama.Config) *SyncProducer {\n\treturn &SyncProducer{\n\t\tt: t,\n\t\texpectations: make([]*producerExpectation, 0),\n\t}\n}", "title": "" }, { "docid": "bf4cb52a89fb05ea3b04c4bd5b859fbe", "score": "0.515867", "text": "func NewProducer(datadir string) kvdb.DbProducer {\n\treturn &producer{\n\t\tdatadir: datadir,\n\t}\n}", "title": "" }, { "docid": "25589a3c525925da12ba6f7605099619", "score": "0.5149606", "text": "func makeProducerFromInstance(a Actor) Producer {\n\treturn func() Actor {\n\t\treturn a\n\t}\n}", "title": "" }, { "docid": "76c9a626d5b7c98abe7027b09be7b9e9", "score": "0.51453215", "text": "func NewProducer(callbacks ProducerCallbacks, brokerList []string, topic string, certFile *string, keyFile *string, caFile *string, verifySsl *bool) *Producer {\n\tproducer := Producer{callbacks: callbacks, topic: topic}\n\n\tconfig := sarama.NewConfig()\n\ttlsConfig := createTLSConf(certFile, keyFile, caFile, verifySsl)\n\tif tlsConfig != nil {\n\t\tconfig.Net.TLS.Enable = true\n\t\tconfig.Net.TLS.Config = tlsConfig\n\t}\n\tconfig.Producer.RequiredAcks = sarama.WaitForLocal\n\tconfig.Producer.Compression = sarama.CompressionSnappy\n\tconfig.Producer.Flush.Frequency = 500 * time.Millisecond\n\n\tsaramaProducer, err := sarama.NewAsyncProducer(brokerList, config)\n\tif err != nil {\n\t\tlog.Fatalln(\"Failed to start Sarama producer:\", err)\n\t\tpanic(err)\n\t}\n\tgo func() {\n\t\tfor err := range saramaProducer.Errors() {\n\t\t\tif producer.callbacks.OnError != nil {\n\t\t\t\tproducer.callbacks.OnError(err)\n\t\t\t}\n\t\t}\n\t}()\n\tproducer.asyncProducer = saramaProducer\n\treturn &producer\n}", "title": "" }, { "docid": "da90105891a1535188354c7ffafa9c5c", "score": "0.5141121", "text": "func InitMockEventRecorder() *events.FakeRecorder {\n\tfakeRecorder := events.NewFakeRecorder(3)\n\tk8sSchema := runtime.NewScheme()\n\tclientgoscheme.AddToScheme(k8sSchema)\n\n\teventRecorder = &EventRecorder{\n\t\tRecorder: fakeRecorder,\n\t\tK8sClient: testclient.NewClientBuilder().WithScheme(k8sSchema).Build(),\n\t}\n\treturn fakeRecorder\n}", "title": "" }, { "docid": "7774ac24dac7555488fc65154efd0a77", "score": "0.51210195", "text": "func NewMockConsumer() nsq.Consumer {\n\treturn &mockConsumer{}\n}", "title": "" }, { "docid": "21d76b71033c2388f64d91ac6425c652", "score": "0.5116193", "text": "func (_m *MockCoreProviderFactory) EXPECT() *MockCoreProviderFactoryMockRecorder {\n\treturn _m.recorder\n}", "title": "" }, { "docid": "5a258fa083bf0712e77e02f74fd04dac", "score": "0.5110777", "text": "func (m *mMessageBusMockNewRecorder) Set(f func(p context.Context) (r core.MessageBus, r1 error)) *MessageBusMock {\n\tm.mock.NewRecorderFunc = f\n\tm.mockExpectations = nil\n\treturn m.mock\n}", "title": "" }, { "docid": "33a1a8c60b82a0cf204d3f6783e6dcda", "score": "0.5100979", "text": "func NewFakeRecorder(bufferSize int) *FakeRecorder {\n\treturn &FakeRecorder{\n\t\tEvents: make(chan string, bufferSize),\n\t}\n}", "title": "" }, { "docid": "44e136c6a52d1084014ac5f6a0355cd5", "score": "0.50999695", "text": "func NewProducer(ctx context.Context, pConfig *ProducerConfig) (producer *Producer, err error) {\n\treturn NewProducerWithGenerators(\n\t\tctx,\n\t\tpConfig,\n\t\tsarama.NewAsyncProducer,\n\t\tSaramaNewBroker,\n\t)\n}", "title": "" }, { "docid": "621b1241b343ad3b321f924bec47aa4c", "score": "0.5095755", "text": "func NewProducer(cfg *ProducerCfg, senders ...senders.SenderItf) (*Producer, error) {\n\tp := &Producer{\n\t\tProducerCfg: cfg,\n\t\tsenders: senders,\n\t\tcounter: utils.NewCounter(),\n\t\tpMsgPool: &sync.Pool{\n\t\t\tNew: func() interface{} {\n\t\t\t\treturn &pendingDiscardMsg{}\n\t\t\t},\n\t\t},\n\n\t\ttag2SenderCaches: &sync.Map{},\n\t\tsender2senderCache: &sync.Map{},\n\t\tdiscardMsgCountMap: &sync.Map{},\n\t\tunSupportedTags: &sync.Map{},\n\t\ttag2NSender: &sync.Map{}, // map[tag]nSender\n\t\ttag2Cancel: &sync.Map{}, // map[tag]nSender\n\t}\n\tif err := p.valid(); err != nil {\n\t\treturn nil, errors.Wrap(err, \"producer config invalid\")\n\t}\n\n\tp.successedChan = make(chan *library.FluentMsg, cfg.DiscardChanSize)\n\tp.failedChan = make(chan *library.FluentMsg, cfg.DiscardChanSize)\n\tp.registerMonitor()\n\n\tfor _, s := range senders {\n\t\tlog.Logger.Info(\"enable sender\", zap.String(\"name\", s.GetName()))\n\t\ts.SetCommitChan(cfg.CommitChan)\n\t\ts.SetMsgPool(cfg.MsgPool)\n\t\ts.SetSuccessedChan(p.successedChan)\n\t\ts.SetFailedChan(p.failedChan)\n\t}\n\n\tlog.Logger.Info(\"new producer\",\n\t\tzap.Int(\"nfork\", p.NFork),\n\t\tzap.Int(\"discard_chan_size\", p.DiscardChanSize),\n\t)\n\treturn p, nil\n}", "title": "" } ]
7d9372ce25c01dbef45efeceb439fe46
The method by which this artifact was referenced during the build.
[ { "docid": "5394ea4cdde0ef0d14284999fbe16bac", "score": "0.0", "text": "func (o GoogleDevtoolsContaineranalysisV1alpha1SlsaProvenanceZeroTwoSlsaMaterialResponseOutput) Uri() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GoogleDevtoolsContaineranalysisV1alpha1SlsaProvenanceZeroTwoSlsaMaterialResponse) string {\n\t\treturn v.Uri\n\t}).(pulumi.StringOutput)\n}", "title": "" } ]
[ { "docid": "751084347da8eb24fee44dc07bf4e1d2", "score": "0.57548857", "text": "func (dc DirectCall) Method() string {\n\treturn dc.method\n}", "title": "" }, { "docid": "b23c86fa1b9721af39f948e7ec2397db", "score": "0.55906355", "text": "func (h *handler) Method() string {\n\treturn h.method\n}", "title": "" }, { "docid": "e9b07a575356466435e2691ae2d98d50", "score": "0.5541857", "text": "func (is *Iris) Method() string {\n\treturn is.ctx.Method()\n}", "title": "" }, { "docid": "440d8f2efd6e17404eef042c702bdfc0", "score": "0.5522755", "text": "func (m *WorkbookTableSort) GetMethod()(*string) {\n return m.method\n}", "title": "" }, { "docid": "5cf45faeaab3849c8b6be1e6ea874ea7", "score": "0.5521217", "text": "func (e *CallMethod) Target() *core.RecordRef {\n\treturn &e.ObjectRef\n}", "title": "" }, { "docid": "a06cd6e1f3143509e5ec6b93ec2686c9", "score": "0.54493403", "text": "func (h Header) Method() string {\n\treturn h.get(\":method\")\n}", "title": "" }, { "docid": "7f619ddbde088f37180836bf240d0df1", "score": "0.5447736", "text": "func (ae *AbstractEvent) GetMethod() string {\n\treturn \"\"\n}", "title": "" }, { "docid": "d2fb71cf4bbc0a660b2bd0ca2ffec82a", "score": "0.5390565", "text": "func (_this *MerchantValidationEvent) MethodName() string {\n\tvar ret string\n\tvalue := _this.Value_JS.Get(\"methodName\")\n\tret = (value).String()\n\treturn ret\n}", "title": "" }, { "docid": "6464afcb8a3f0954800c406b880553a1", "score": "0.5311816", "text": "func (w GitLabWebhook) Ref() string {\n\treturn w.RefValue\n}", "title": "" }, { "docid": "fe2b57edb86fa3f311ae3b3d47f33df5", "score": "0.529449", "text": "func (ba *baseAPI) Method() string {\n\treturn ba.method\n}", "title": "" }, { "docid": "ce761c545aeaf216e41e003bdf2f4dbf", "score": "0.52618045", "text": "func (detail RouteDetails) Method() string {\n\treturn detail.method\n}", "title": "" }, { "docid": "bce710e34b99719736e30ada162f5bdc", "score": "0.5257396", "text": "func (s *Stream) Method() string {\n\treturn s.method\n}", "title": "" }, { "docid": "faf5991e0423178a0102d1a240acfda5", "score": "0.5228107", "text": "func methodName() string {\n\tpc, _, _, _ := runtime.Caller(2)\n\tf := runtime.FuncForPC(pc)\n\tif f == nil {\n\t\treturn \"unknown method\"\n\t}\n\treturn f.Name()\n}", "title": "" }, { "docid": "faf5991e0423178a0102d1a240acfda5", "score": "0.5228107", "text": "func methodName() string {\n\tpc, _, _, _ := runtime.Caller(2)\n\tf := runtime.FuncForPC(pc)\n\tif f == nil {\n\t\treturn \"unknown method\"\n\t}\n\treturn f.Name()\n}", "title": "" }, { "docid": "51b0032468ee7f2e0c31727d415237b6", "score": "0.52168584", "text": "func (c *Cmd) Method() string {\n\treturn c.M\n}", "title": "" }, { "docid": "51b0032468ee7f2e0c31727d415237b6", "score": "0.52168584", "text": "func (c *Cmd) Method() string {\n\treturn c.M\n}", "title": "" }, { "docid": "76cd1f107024343220071ffc21f56695", "score": "0.5181145", "text": "func (v *Bar_MissingArg_Args) MethodName() string {\n\treturn \"missingArg\"\n}", "title": "" }, { "docid": "20452b7d8db9ca23d964cf3ad7e94d7e", "score": "0.5150544", "text": "func (_this *PaymentMethodChangeEvent) MethodName() string {\n\tvar ret string\n\tvalue := _this.Value_JS.Get(\"methodName\")\n\tret = (value).String()\n\treturn ret\n}", "title": "" }, { "docid": "58b59d669b3600ea542c0ec97fa1fe09", "score": "0.5131292", "text": "func (r *Route) Method() string {\n\treturn r.method\n}", "title": "" }, { "docid": "6bde5e639b325944a8bc0536ed9d6310", "score": "0.5131109", "text": "func (v *Bar_ArgWithHeaders_Args) MethodName() string {\n\treturn \"argWithHeaders\"\n}", "title": "" }, { "docid": "86d0daa0f95499b7d153af0649398e35", "score": "0.5120805", "text": "func (target Target) Target() string {\n\treturn target.target\n}", "title": "" }, { "docid": "3b87f242cd3882f43e548d4069f54917", "score": "0.5119297", "text": "func (sasl *SASLExternal) Method() string {\n\treturn \"EXTERNAL\"\n}", "title": "" }, { "docid": "d5e7a24bbea6a3642fe097592024a520", "score": "0.5099506", "text": "func (h *mockResolveHandler) Method() string {\n\treturn http.MethodGet\n}", "title": "" }, { "docid": "17630e98c5ae0ca98e6f898da036be0f", "score": "0.50692874", "text": "func (v *Bar_ArgWithHeaders_Result) MethodName() string {\n\treturn \"argWithHeaders\"\n}", "title": "" }, { "docid": "8c93dfd88bc7a59d2c6cbebec980a254", "score": "0.50482255", "text": "func (m MockServerTransportStream) Method() string {\n\tif m.MethodFunc == nil {\n\t\tpanic(\"Method called, but not set\")\n\t}\n\treturn m.MethodFunc()\n}", "title": "" }, { "docid": "641ded51001f13b593324157b813ee40", "score": "0.5038582", "text": "func (v *Bar_HelloWorld_Args) MethodName() string {\n\treturn \"helloWorld\"\n}", "title": "" }, { "docid": "d5ffdba91b45c925b482dcc1ee958bb3", "score": "0.5032558", "text": "func (g *Game) Method() Method {\n\treturn g.method\n}", "title": "" }, { "docid": "88318325b4e50d0735877cffe1b9d819", "score": "0.50132823", "text": "func (v *Bar_ArgWithQueryHeader_Result) MethodName() string {\n\treturn \"argWithQueryHeader\"\n}", "title": "" }, { "docid": "fd05f0b2dd5e0b75c6d727a6895a8b52", "score": "0.5012309", "text": "func (v *Bar_ArgWithQueryHeader_Args) MethodName() string {\n\treturn \"argWithQueryHeader\"\n}", "title": "" }, { "docid": "5b4ce6cd6bfece601f5068c0217d3267", "score": "0.5011828", "text": "func (op *ReportAssembly) GetHTTPMethod() string {\n\treturn op.opHTTPData.GetHTTPMethod()\n}", "title": "" }, { "docid": "9142c73a24136684b855f8b343e30cc3", "score": "0.5009372", "text": "func (m Method) String() string {\n\treturn Methods[m]\n}", "title": "" }, { "docid": "4d5c329cf897457b63baa8a4edd46b19", "score": "0.500517", "text": "func (v *Bar_MissingArg_Result) MethodName() string {\n\treturn \"missingArg\"\n}", "title": "" }, { "docid": "1f03d422a0f09a1f528406ac1751df2b", "score": "0.5002739", "text": "func getEntryMethod(frame *rtda.Frame) {\n\t// entry := _getEntryPop(frame)\n\t// method := int32(entry.Method)\n\n\t// todo\n\tstack := frame.OperandStack()\n\tstack.PushInt(0)\n}", "title": "" }, { "docid": "b46b65c06e661b2f9d7ab9e03bdf791b", "score": "0.49912828", "text": "func (l localRoute) Method() string {\n\treturn l.method\n}", "title": "" }, { "docid": "e11f468c3a96728bb6c6b8859fb8a26b", "score": "0.4989878", "text": "func (req *request) Method() string {\n\treturn req.inner.Method\n}", "title": "" }, { "docid": "469d80648e623b06de5ce911a66fcd09", "score": "0.4967463", "text": "func (srv *Server) Method() string {\n\treturn string(srv.Ctx.Method())\n}", "title": "" }, { "docid": "75e54c64130881200bc7e13251cbd99f", "score": "0.4946226", "text": "func (call *Call) GetMethod() string {\n\treturn call.Method\n}", "title": "" }, { "docid": "479338229141548d32f97d7e79736596", "score": "0.49190298", "text": "func (e Entries) Method() *String {\n\tm := NewString()\n\tfor _, v := range e {\n\t\tm.Add(v.Method)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "d9d6c6774dc9f35222c26ff9ad175a79", "score": "0.49098355", "text": "func pkgMethod(pc uintptr) (method string) {\n\tif f := runtime.FuncForPC(pc); f != nil {\n\t\tmethod = f.Name()\n\t\tif ind := strings.LastIndex(method, \"/\"); ind > 0 {\n\t\t\tmethod = method[ind+1:]\n\t\t}\n\t\tif ind := strings.Index(method, \".\"); ind > 0 {\n\t\t\tmethod = method[ind+1:]\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "03b6b61f1347892b023ad29fe86e7663", "score": "0.49082848", "text": "func (v *Bar_HelloWorld_Result) MethodName() string {\n\treturn \"helloWorld\"\n}", "title": "" }, { "docid": "32e2ba5860cd8fe558d8af89428723e1", "score": "0.49010423", "text": "func (self *TraitDBusMethodInvocation) GetMethodName() (return__ string) {\n\tvar __cgo__return__ *C.gchar\n\t__cgo__return__ = C.g_dbus_method_invocation_get_method_name(self.CPointer)\n\treturn__ = C.GoString((*C.char)(unsafe.Pointer(__cgo__return__)))\n\treturn\n}", "title": "" }, { "docid": "592cb8540a9a6d86fe4ee68c43b7fff8", "score": "0.4898989", "text": "func (op *RecurrentAssembly) GetHTTPMethod() string {\n\treturn op.opHTTPData.GetHTTPMethod()\n}", "title": "" }, { "docid": "7294736cf270e8d0fddcc8b62ede012d", "score": "0.48903048", "text": "func (m *AutoDiscoveryConfiguration) Method() AutoDiscoveryMethod {\n\treturn m.methodField\n}", "title": "" }, { "docid": "ea5c3a64c518befce40156a892147023", "score": "0.48825452", "text": "func (m *autoDiscoveryMethod) Name() string {\n\treturn \"AutoDiscoveryMethod\"\n}", "title": "" }, { "docid": "61ea7d122c2a6ffedd2a4cb13bbfadbe", "score": "0.48757026", "text": "func (v *Bar_Normal_Args) MethodName() string {\n\treturn \"normal\"\n}", "title": "" }, { "docid": "0550608e02c3a05011a9f1147fec2a2a", "score": "0.48755306", "text": "func (ctx *FastHttpRequest) Method() string {\n\treturn utils.BytesToString(ctx.RequestCtx.Method())\n}", "title": "" }, { "docid": "5062e263f7557a7a5e7ec2799dbb9228", "score": "0.4864038", "text": "func (rs *RequestSender) Method() string {\n\treturn rs.method\n}", "title": "" }, { "docid": "fef42fa980957cc6541fbf48cf93fe10", "score": "0.48399302", "text": "func (md *MethodDescriptor) GetFullyQualifiedName() string {\n\treturn string(md.wrapped.FullName())\n}", "title": "" }, { "docid": "9f121252499f62a2df34d057bd169dbc", "score": "0.4838911", "text": "func (v *Bar_ArgWithParams_Args) MethodName() string {\n\treturn \"argWithParams\"\n}", "title": "" }, { "docid": "1a9bcdc370c3ef98cd07df50f94c8682", "score": "0.48372114", "text": "func (d *archiveImageDestination) Reference() types.ImageReference {\n\treturn d.ref\n}", "title": "" }, { "docid": "b83572c8132be02e0ebbeca4c4ff3cd5", "score": "0.4831152", "text": "func (o *SubmitSelfServiceRecoveryFlowWithLinkMethodBody) GetMethod() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Method\n}", "title": "" }, { "docid": "dcb4e0e541c5bc4448e9f2c6eed97b49", "score": "0.4822481", "text": "func (v *swagger) Reference() string {\n\treturn v.reference\n}", "title": "" }, { "docid": "36ec8f5a7d6ddfb5b0d0eaa85ef57997", "score": "0.48159933", "text": "func (v *Bar_TooManyArgs_Args) MethodName() string {\n\treturn \"tooManyArgs\"\n}", "title": "" }, { "docid": "6fbccf5f0234911a958be13205ef6b38", "score": "0.48079", "text": "func (v *Bar_ArgWithParams_Result) MethodName() string {\n\treturn \"argWithParams\"\n}", "title": "" }, { "docid": "3b6d540e025eedeaa8f4f4dace6334ec", "score": "0.47913235", "text": "func (o *SubmitSelfServiceRecoveryFlowBody) GetMethod() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Method\n}", "title": "" }, { "docid": "8fef51389049209175e2a87b8b56d2cb", "score": "0.47817233", "text": "func (o Operand) Ref() string {\n\tif o.DownstreamVersion != nil {\n\t\treturn o.DownstreamVersion.String()\n\t}\n\treturn o.UpstreamVersion.String()\n}", "title": "" }, { "docid": "290ee655327198565d79a0380f58ec91", "score": "0.47795635", "text": "func __FILE__() string {\n\t_, file, _, _ := runtime.Caller(1)\n\treturn file\n}", "title": "" }, { "docid": "c8dfe6d8604cc7b3b94341ce759b73b1", "score": "0.4779188", "text": "func getMethod(fn, file string) string {\n\t// get last index from file\n\tfile = path.Base(file)\n\n\t// get string before `.func1` from fn\n\tbase := path.Base(fn)\n\tif strings.LastIndex(fn, \"func1\") > 0 {\n\t\tbase = path.Base(fn[:strings.LastIndex(fn, \"func1\")-1])\n\t}\n\n\treturn fmt.Sprintf(\"%s.%s\", file[:strings.LastIndex(file, \".\")], base[strings.LastIndex(base, \".\")+1:])\n}", "title": "" }, { "docid": "6d1950d43dad0057e50b1c6d24dd0d57", "score": "0.47787544", "text": "func (ctx *WebContext) Method() string {\n\treturn ctx.request.Method()\n}", "title": "" }, { "docid": "1172a20cd0da5674844258d33c38be49", "score": "0.4775251", "text": "func (m Method) Declaration() string {\n\treturn m.Name + m.Signature()\n}", "title": "" }, { "docid": "9afb84852053d9156302a5ff8f8b96bb", "score": "0.47698545", "text": "func (sch CommandHandlerUtil) getMethodName(cmd Command) string {\n\tvar commandFullName string\n\n\tif reflect.ValueOf(cmd).Kind() == reflect.Ptr {\n\t\tcommandFullName = \"Handle\" + reflect.TypeOf(cmd).Elem().Name()\n\t} else {\n\t\tcommandFullName = \"Handle\" + reflect.TypeOf(cmd).Name()\n\t}\n\n\treturn commandFullName\n}", "title": "" }, { "docid": "0045515c9808e9cebc8aa81c1e4cd6d3", "score": "0.4769407", "text": "func (m namedMethod) GetMethodName() string {\n\treturn m.name\n}", "title": "" }, { "docid": "2a3059faa5ee47821ca9795d838ff7e2", "score": "0.4767134", "text": "func (bandX *BandX) RefBandXMethodName(s string) {\n\tbandX.Name = s\n}", "title": "" }, { "docid": "9ddf00d6e9b1693ca7c54e154d173780", "score": "0.4765033", "text": "func (b *Backend) GetMethod() string {\n\treturn b.Method\n}", "title": "" }, { "docid": "9ddf00d6e9b1693ca7c54e154d173780", "score": "0.4765033", "text": "func (b *Backend) GetMethod() string {\n\treturn b.Method\n}", "title": "" }, { "docid": "2f321d6cb1bb6cae5c15f0b8683092bb", "score": "0.47568852", "text": "func (v *Bar_ArgWithParamsAndDuplicateFields_Result) MethodName() string {\n\treturn \"argWithParamsAndDuplicateFields\"\n}", "title": "" }, { "docid": "1654ebc55f5893b970f5430b59e438d2", "score": "0.4750072", "text": "func (m *gerritEvent) ExecutionLink() string {\n\treturn m.executionLinkField\n}", "title": "" }, { "docid": "1bcb242361a8249ef734304fe146008c", "score": "0.4747888", "text": "func (m *gerritEvent) Trigger() string {\n\treturn m.triggerField\n}", "title": "" }, { "docid": "859e69b20f22038ddf198758dcb00ba6", "score": "0.47478014", "text": "func (r *vstRequest) Method() string {\n\treturn r.method\n}", "title": "" }, { "docid": "79e0ea3d8b117ac2fd99f8cea9d2c4fe", "score": "0.4743884", "text": "func (v *Bounce_Bounce_Args) MethodName() string {\n\treturn \"bounce\"\n}", "title": "" }, { "docid": "476df011f1ee091efc8268b458aa9318", "score": "0.47438392", "text": "func (e *Event) Target() string {\n\treturn e.Args[0]\n}", "title": "" }, { "docid": "a29747270777aa0f6b6a7bd3a16c883f", "score": "0.4743218", "text": "func (self *TraitDBusMethodInvocation) GetMethodInfo() (return__ *C.GDBusMethodInfo) {\n\treturn__ = C.g_dbus_method_invocation_get_method_info(self.CPointer)\n\treturn\n}", "title": "" }, { "docid": "dce165fa56f2449aae0a62950e239500", "score": "0.47426754", "text": "func (o BasicSliPtrOutput) Method() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *BasicSli) []string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Method\n\t}).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "46a5247770a9b6efc5109bc5ad80aca2", "score": "0.4731331", "text": "func (o RuleGroupRuleStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchOutput) Method() RuleGroupRuleStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchMethodPtrOutput {\n\treturn o.ApplyT(func(v RuleGroupRuleStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatch) *RuleGroupRuleStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchMethod {\n\t\treturn v.Method\n\t}).(RuleGroupRuleStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchMethodPtrOutput)\n}", "title": "" }, { "docid": "dce480147e44476ca87538636cd0313f", "score": "0.47215715", "text": "func (rh *requestBase) Method() string {\n\treturn rh.req.Method\n}", "title": "" }, { "docid": "c04865c5e2c5aded1159fe20df1b5083", "score": "0.47185412", "text": "func (o *AvailabilityMonitoringPG) GetMethod() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Method\n}", "title": "" }, { "docid": "08ec4b0e0c61e1ab39773d66fb36fcb5", "score": "0.47179168", "text": "func (a *Agent) Target() string {\n\treturn a.target\n}", "title": "" }, { "docid": "949a51e1fd441ce8d02b1744cb36c774", "score": "0.4711339", "text": "func (b *FunctionDriver) FunctionName() string { return b.functionName }", "title": "" }, { "docid": "84084387d1a1197b91cb1787032981f8", "score": "0.47089332", "text": "func (g *GoAttribute) Ref() string {\n\treturn g.NameScope.GoFullTypeRef(g.Attribute, g.Pkg)\n}", "title": "" }, { "docid": "0ce75eb8126482afac858e65feb91270", "score": "0.47055984", "text": "func (o RuleGroupRuleStatementNotStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchOutput) Method() RuleGroupRuleStatementNotStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchMethodPtrOutput {\n\treturn o.ApplyT(func(v RuleGroupRuleStatementNotStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatch) *RuleGroupRuleStatementNotStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchMethod {\n\t\treturn v.Method\n\t}).(RuleGroupRuleStatementNotStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchMethodPtrOutput)\n}", "title": "" }, { "docid": "7d327885dbdebee7f2061713dd4ef67e", "score": "0.46932015", "text": "func (request *request) Method() string {\n\treturn request.RequestMethod\n}", "title": "" }, { "docid": "135af78c48d2028598a5a154a85b89d7", "score": "0.46893713", "text": "func (b BitbucketServerWebhook) Ref() string {\n\tfor _, r := range b.RefChanges {\n\t\tif r.RefID == \"refs/heads/master\" {\n\t\t\treturn \"refs/heads/master\"\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "ea46483082b85139ff907bc060180e42", "score": "0.4684931", "text": "func (v *Bar_ArgWithParamsAndDuplicateFields_Args) MethodName() string {\n\treturn \"argWithParamsAndDuplicateFields\"\n}", "title": "" }, { "docid": "d54815b53e671afe01cb5e0f0270f8c1", "score": "0.46768653", "text": "func (which *SomeWhich) Name() string {\n\treturn \"which\"\n}", "title": "" }, { "docid": "7285d527956e683f193e8f7802017a38", "score": "0.46740294", "text": "func (this *Dex_MethodIdItem) MethodName() (v string, err error) {\n\tif (this._f_methodName) {\n\t\treturn this.methodName, nil\n\t}\n\ttmp63, err := this._root.StringIds()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\ttmp64, err := tmp63[this.NameIdx].Value()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tthis.methodName = string(tmp64.Data)\n\tthis._f_methodName = true\n\treturn this.methodName, nil\n}", "title": "" }, { "docid": "8bc93e89ffe8ab56c302a6523c8a690f", "score": "0.46687284", "text": "func (o *MethodRule) GetMethodName() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.MethodName\n}", "title": "" }, { "docid": "764faecb16671f099beb9fca951afabd", "score": "0.46615022", "text": "func (c *CodecRequest) Method() (string, error) {\r\n\treturn c.proxy_codec_request.Method()\r\n}", "title": "" }, { "docid": "bf8104dcf2dbcb7e268acc8f51cb69f9", "score": "0.4660376", "text": "func (v *Bar_TooManyArgs_Result) MethodName() string {\n\treturn \"tooManyArgs\"\n}", "title": "" }, { "docid": "954ea0d229779db975ca6006323656a8", "score": "0.46570584", "text": "func (router *Router) ResolveMethod(skin *mcSkin, resource string) func(int) error {\n\tswitch resource {\n\tcase \"Avatar\":\n\t\treturn skin.GetHead\n\tcase \"Helm\":\n\t\treturn skin.GetHelm\n\tcase \"Cube\":\n\t\treturn skin.GetCube\n\tcase \"Bust\":\n\t\treturn skin.GetBust\n\tcase \"Body\":\n\t\treturn skin.GetBody\n\tcase \"Armor/Bust\":\n\t\treturn skin.GetArmorBust\n\tcase \"Armour/Bust\":\n\t\treturn skin.GetArmorBust\n\tcase \"Armor/Body\":\n\t\treturn skin.GetArmorBody\n\tcase \"Armour/Body\":\n\t\treturn skin.GetArmorBody\n\tdefault:\n\t\treturn skin.GetHelm\n\t}\n}", "title": "" }, { "docid": "51518897eef2a76a53f99e6d8f35780f", "score": "0.46375364", "text": "func (_this *PaymentResponse) MethodName() string {\n\tvar ret string\n\tvalue := _this.Value_JS.Get(\"methodName\")\n\tret = (value).String()\n\treturn ret\n}", "title": "" }, { "docid": "8cee4d890aa3d985fb5c09576f11e3ce", "score": "0.4634355", "text": "func (o RoleManagementPolicyRuleTargetOutput) Caller() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v RoleManagementPolicyRuleTarget) *string { return v.Caller }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "1a8411db3ca8fb3d042d62d0eaa0fb20", "score": "0.46253413", "text": "func (s *Server) MethodNames() []string { return collection.MethodNames[:] }", "title": "" }, { "docid": "c5f509d7a06c0e7aef23b31751d76ab5", "score": "0.46243054", "text": "func (o *RecoveryFlowMethod) GetMethod() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Method\n}", "title": "" }, { "docid": "14f77525c2409d0f428fdaa136f684dc", "score": "0.46205607", "text": "func (p *Message) Target() string {\n\treturn p.Args[0]\n}", "title": "" }, { "docid": "09a3ad44b02a69540c349c7ed181e4a3", "score": "0.4613545", "text": "func (u SomeImpl) Method(argument string, arg2 int) string {\n\treturn fmt.Sprintf(\"Method called, %v %v %v\\n\", argument, u.value, arg2)\n}", "title": "" }, { "docid": "454f8a9f5c4a350e953415a73cbcffa7", "score": "0.46124938", "text": "func (req *TextRequirement) Reference() string {\n\treturn req.reference\n}", "title": "" }, { "docid": "f7e085025f34026f3b25a315eed5ba9c", "score": "0.4608278", "text": "func (o RuleGroupRuleStatementNotStatementStatementAndStatementStatementRegexPatternSetReferenceStatementFieldToMatchOutput) Method() RuleGroupRuleStatementNotStatementStatementAndStatementStatementRegexPatternSetReferenceStatementFieldToMatchMethodPtrOutput {\n\treturn o.ApplyT(func(v RuleGroupRuleStatementNotStatementStatementAndStatementStatementRegexPatternSetReferenceStatementFieldToMatch) *RuleGroupRuleStatementNotStatementStatementAndStatementStatementRegexPatternSetReferenceStatementFieldToMatchMethod {\n\t\treturn v.Method\n\t}).(RuleGroupRuleStatementNotStatementStatementAndStatementStatementRegexPatternSetReferenceStatementFieldToMatchMethodPtrOutput)\n}", "title": "" }, { "docid": "1bd4bc4f8b2e1bd3ef048b9800133f2b", "score": "0.46060878", "text": "func (r *Request) Method() string {\n\treturn r.httpRequest.Method\n}", "title": "" }, { "docid": "d9d375b9496e31887e7f4ed1eccc8db3", "score": "0.46053338", "text": "func (ctx *Ctx) Method(override ...string) string {\n\tif len(override) > 0 {\n\t\tctx.method = override[0]\n\t}\n\treturn ctx.method\n}", "title": "" }, { "docid": "d132f1bdd8806bed27ac33f162612ce0", "score": "0.46036017", "text": "func GetMethodName(ctx context.Context) string {\n\t// case 1: called from server side\n\tm := rkgrpcinter.GetServerContextPayload(ctx)\n\tif v1, ok := m[rkgrpcinter.RpcMethodKey]; ok {\n\t\treturn v1.(string)\n\t}\n\n\t// case 2: called from client side\n\tm = rkgrpcinter.GetClientContextPayload(ctx)\n\tif v1, ok := m[rkgrpcinter.RpcMethodKey]; ok {\n\t\treturn v1.(string)\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "de2fafeb61b523e2b94415694243f0a0", "score": "0.46035734", "text": "func (ctx *FastHttpRequest) MethodBytes() []byte {\n\treturn ctx.RequestCtx.Method()\n}", "title": "" } ]
9e111ca05c1d41d543e51da7e058a252
NewHTTP creates a new HTTP server with the provided options
[ { "docid": "2484e5d650a138ead91c58fa13daf5d3", "score": "0.7362744", "text": "func NewHTTP(o *options.Base, h http.Handler) *HTTP {\n\treturn &HTTP{\n\t\tBase: NewBase(options.ModeHTTP, h, o),\n\t}\n}", "title": "" } ]
[ { "docid": "5c0638bbcbc7e0e77036a0849bacbf79", "score": "0.7420238", "text": "func NewHTTP(host string, port int) *HTTP {\n\ts := &HTTP{}\n\ts.ID = ID{host, port, \"http\", \"http service\"}\n\ts.Router = mux.NewRouter()\n\ts.running = false\n\treturn s\n}", "title": "" }, { "docid": "e0a4e4b5aed4c90826f4fa41fa663e91", "score": "0.73723453", "text": "func NewHTTP(addr string, state *rumour.State) *http.Server {\n\tlogger := log.New(os.Stdout, \"[http] \", log.LstdFlags)\n\n\treturn &http.Server{\n\t\tAddr: addr,\n\t\tHandler: newRouter(state, logger),\n\t\tErrorLog: logger,\n\t\tReadTimeout: 5 * time.Second,\n\t\tWriteTimeout: 300 * time.Second,\n\t\tIdleTimeout: 15 * time.Second,\n\t}\n}", "title": "" }, { "docid": "bbcffd7d29b23384b52db076e2c3dce2", "score": "0.71670794", "text": "func NewHTTP(conf HTTPConfig) HTTP {\n\treturn HTTP{\n\t\tHost: conf.Host,\n\t\tPort: conf.Port,\n\t}\n}", "title": "" }, { "docid": "ac770f849231173f18d85bff138505fa", "score": "0.7142141", "text": "func New(config Configuration, storage storage.Storage) *HTTPServer {\n\treturn &HTTPServer{\n\t\tConfig: config,\n\t\tStorage: storage,\n\t\tInfoParams: make(map[string]string),\n\t}\n}", "title": "" }, { "docid": "7def95084654b9322ade7933ada53638", "score": "0.7133478", "text": "func NewHTTP(port string, classifier *Classifier) *HTTP {\n\tt := new(HTTP)\n\tt.port = port\n\trootDir := util.GetDir()\n\tt.tplDir = rootDir + \"/html\"\n\tt.assetsDir = rootDir + \"/assets\"\n\tt.classifier = classifier\n\treturn t\n}", "title": "" }, { "docid": "6feb710dcf71f800cddcd7703406d93e", "score": "0.7073603", "text": "func NewHTTP(url string) *HTTP {\n\t// TODO build a proper http.Client, don't rely on the 0val default like we did in the v1 sdk\n\thc := &http.Client{\n\t\tTransport: &http.Transport{\n\t\t\tMaxIdleConnsPerHost: 1,\n\t\t},\n\t\tTimeout: 5 * time.Second,\n\t}\n\treturn &HTTP{\n\t\tURL: url,\n\t\tclient: hc,\n\t}\n}", "title": "" }, { "docid": "fe7459e5286177a2f225dfdd40cac076", "score": "0.7018711", "text": "func NewHTTP(addr string, timeout time.Duration) (*HTTP, error) {\n\tconf := client.HTTPConfig{\n\t\tAddr: addr,\n\t\tTimeout: timeout,\n\t}\n\tc, err := client.NewHTTPClient(conf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &HTTP{c: c}, nil\n}", "title": "" }, { "docid": "c94a2f2962f391de38642daef0c8c1ea", "score": "0.6844434", "text": "func NewHTTPServer(options *Options) (*HTTPServer, error) {\n\tgologger.DefaultLogger.SetMaxLevel(levels.LevelDebug)\n\n\tserver := &HTTPServer{options: options, domain: strings.TrimSuffix(options.Domain, \".\")}\n\n\trouter := &http.ServeMux{}\n\trouter.Handle(\"/\", server.logger(http.HandlerFunc(server.defaultHandler)))\n\trouter.Handle(\"/register\", server.authMiddleware(http.HandlerFunc(server.registerHandler)))\n\trouter.Handle(\"/deregister\", server.authMiddleware(http.HandlerFunc(server.deregisterHandler)))\n\trouter.Handle(\"/poll\", server.authMiddleware(http.HandlerFunc(server.pollHandler)))\n\n\tserver.tlsserver = http.Server{Addr: options.ListenIP + \":443\", Handler: router}\n\tserver.nontlsserver = http.Server{Addr: options.ListenIP + \":80\", Handler: router}\n\treturn server, nil\n}", "title": "" }, { "docid": "591edd5e929780edb2cdadf67b3997c7", "score": "0.67699844", "text": "func NewHttp(conf *config.Config) *Http {\n\tmux := http.NewServeMux()\n\ts := &Http{\n\t\tconf: conf,\n\t\tmux: mux,\n\t\tsrv: &http.Server{\n\t\t\tHandler: mux,\n\t\t},\n\t}\n\ts.setupHandlers()\n\treturn s\n}", "title": "" }, { "docid": "fb744565968cb3d65c6ae96d2f7fd016", "score": "0.6737391", "text": "func NewHTTP(cfg *config.HTTP, log *logrus.Logger, msgs chan Msg) *HTTP {\n\treturn &HTTP{cfg: cfg, log: log, msgs: msgs}\n}", "title": "" }, { "docid": "72f6ef58eec97505d96747b3a3da5222", "score": "0.670452", "text": "func NewServerHTTP(addr string, group []*Config) (*ServerHTTP, error) {\n\ts, err := NewServer(addr, group)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsh := &ServerHTTP{Server: s, httpServer: new(http.Server)}\n\tsh.httpServer.Handler = sh\n\n\treturn sh, nil\n}", "title": "" }, { "docid": "b4683443a0be4af00ea20ef3597401d1", "score": "0.66826046", "text": "func NewServerHTTP(Addr ...string) *SimpleServer {\n\tS, _ := NewServerHTTPS(nil, Addr...)\n\treturn S\n}", "title": "" }, { "docid": "2199e6d16705b82c1dcd1e3655b2f209", "score": "0.6642494", "text": "func NewHTTP(requestHandler *RequestHandler) *http.Server {\n\tr := router.NewRouter()\n\tr.Use(loggingMiddleware)\n\n\t// health check\n\tr.HandleFunc(\"/\", healthCheck).Methods(\"GET\")\n\n\ts := r.PathPrefix(uri.LinkedClouds).Subrouter()\n\n\t// retrieve all linked clouds\n\ts.HandleFunc(\"\", requestHandler.RetrieveLinkedClouds).Methods(\"GET\")\n\t// add linked cloud\n\ts.HandleFunc(\"\", requestHandler.AddLinkedCloud).Methods(\"POST\")\n\t// delete linked cloud\n\ts.HandleFunc(\"/{\"+linkedCloudIdKey+\"}\", requestHandler.DeleteLinkedCloud).Methods(\"DELETE\")\n\n\ts = r.PathPrefix(uri.LinkedAccounts).Subrouter()\n\t// add linked account\n\ts.HandleFunc(\"\", requestHandler.AddLinkedAccount).Methods(\"GET\")\n\t// retrieve all linked accounts\n\ts.HandleFunc(\"/retrieve\", requestHandler.RetrieveLinkedAccounts).Methods(\"GET\")\n\t// delete linked cloud\n\ts.HandleFunc(\"/{\"+linkedAccountIdKey+\"}\", requestHandler.DeleteLinkedAccount).Methods(\"DELETE\")\n\n\t// notify linked cloud\n\tr.HandleFunc(uri.NotifyLinkedAccount, requestHandler.NotifyLinkedAccount).Methods(\"POST\")\n\n\t// OAuthCallback\n\toauthURL, _ := url.Parse(requestHandler.oauthCallback)\n\tr.HandleFunc(oauthURL.Path, requestHandler.OAuthCallback).Methods(\"GET\")\n\n\treturn &http.Server{Handler: r}\n}", "title": "" }, { "docid": "597ac46b7b23415aab6718f45b7824a3", "score": "0.6633578", "text": "func New(listenAddr string, name string) *HTTP {\n\treturn &HTTP{\n\t\tname: name,\n\t\tserver: &http.Server{\n\t\t\tAddr: listenAddr,\n\t\t},\n\t\thandlers: make(map[string]string),\n\t\tmu: &sync.RWMutex{},\n\t}\n}", "title": "" }, { "docid": "b116f1913f19a1b420d08dc9321021b7", "score": "0.65720224", "text": "func NewHttp(directive IDirective) (*Http, error) {\n\t//parameters := directive.GetParameters()\n\thttp := &Http{\n\t\tHttpName: \"http\", //first parameter of the directive is the upstream name\n\t}\n\n\tblock := directive.GetBlock()\n\tif block == nil {\n\t\treturn nil, errors.New(\"http directive must have a block\")\n\t}\n\n\tif len(directive.GetBlock().GetDirectives()) > 0 {\n\n\t\tfor _, d := range directive.GetBlock().GetDirectives() {\n\t\t\tif d.GetName() == \"server\" {\n\t\t\t\ts, _ := NewServer(d)\n\t\t\t\thttp.Servers = append(http.Servers, s)\n\t\t\t}\n\t\t}\n\t}\n\n\tfmt.Println(\"==========\", len(http.Servers))\n\thttp.Block = directive.GetBlock()\n\n\t// return &Http{\n\t// \tBlock: block,\n\t// }, nil\n\treturn http, nil\n\n}", "title": "" }, { "docid": "4a2ce17c93d9d91e75a7aab885c0f3a3", "score": "0.6553979", "text": "func NewHTTPServer(c *C, p *Process) *HTTPServer {\n\th := NewHandler()\n\th.Process = p\n\n\tln, err := net.Listen(\"tcp\", fmt.Sprintf(\":%d\", MustAtoi(p.Port)+1))\n\tc.Assert(err, IsNil)\n\n\ts := &HTTPServer{\n\t\tServer: &http.Server{\n\t\t\tHandler: h,\n\t\t},\n\t\tln: ln,\n\t}\n\tgo s.Serve(ln)\n\n\treturn s\n}", "title": "" }, { "docid": "7c240e103b11b4f6e6be157e37469c57", "score": "0.65505475", "text": "func (gb *gearbox) newHTTPServer() *fasthttp.Server {\n\treturn &fasthttp.Server{\n\t\tHandler: gb.handler,\n\t\tLogger: nil,\n\t\tLogAllErrors: false,\n\t}\n}", "title": "" }, { "docid": "5bf365e4af415a10d7a936b27ecd0738", "score": "0.6530298", "text": "func New(mux http.Handler, opts ...Options) *http.Server {\n\tvar server http.Server\n\tserver.Handler = mux\n\n\tfor _, opt := range opts {\n\t\topt(&server)\n\t}\n\n\treturn &server\n}", "title": "" }, { "docid": "3bca2537691c35a0dda38844a05485e8", "score": "0.6488704", "text": "func NewHTTPPool(self string) *HTTPPool{\n\treturn &HTTPPool{\n\t\tself: self,\n\t\tbasePath: defaultBasePath,\n\t}\n}", "title": "" }, { "docid": "4f475a6d0695244b046962e69764374c", "score": "0.64808506", "text": "func NewHTTPPool(self string) *HTTPPool {\n\treturn &HTTPPool{\n\t\tself: self,\n\t\tbasePath: defaultBasePath,\n\t}\n}", "title": "" }, { "docid": "0322703c522ce4498387ecf62cc24f62", "score": "0.6480219", "text": "func (gb *gearbox) newHTTPServer() *fasthttp.Server {\n\treturn &fasthttp.Server{\n\t\tHandler: gb.router.Handler,\n\t\tLogger: &customLogger{},\n\t\tLogAllErrors: false,\n\t\tName: gb.settings.ServerName,\n\t\tConcurrency: gb.settings.Concurrency,\n\t\tNoDefaultDate: gb.settings.DisableDefaultDate,\n\t\tNoDefaultContentType: gb.settings.DisableDefaultContentType,\n\t\tDisableHeaderNamesNormalizing: gb.settings.DisableHeaderNormalizing,\n\t\tDisableKeepalive: gb.settings.DisableKeepalive,\n\t\tNoDefaultServerHeader: gb.settings.ServerName == \"\",\n\t\tReadTimeout: gb.settings.ReadTimeout,\n\t\tWriteTimeout: gb.settings.WriteTimeout,\n\t\tIdleTimeout: gb.settings.IdleTimeout,\n\t\tReadBufferSize: gb.settings.ReadBufferSize,\n\t}\n}", "title": "" }, { "docid": "83ecc3288e3738fae9eb19a297dc6e66", "score": "0.6460416", "text": "func NewHTTPService(serve *http.Server, opts ...HTTPOption) (service.Service, error) {\n\tif serve == nil {\n\t\treturn nil, ErrEmptyHTTPServer\n\t}\n\n\ts := &httpService{\n\t\tlogger: zap.NewNop(),\n\n\t\tskipErrors: false,\n\t\tserver: serve,\n\t\tnetwork: \"tcp\",\n\t}\n\n\tfor i := range opts {\n\t\topts[i](s)\n\t}\n\n\tif s.listener != nil {\n\t\treturn s, nil\n\t}\n\n\tif s.address == \"\" {\n\t\treturn nil, ErrEmptyHTTPAddress\n\t}\n\n\tvar err error\n\tif s.listener, err = net.Listen(s.network, s.address); err != nil {\n\t\treturn nil, s.catch(err)\n\t}\n\n\treturn s, nil\n}", "title": "" }, { "docid": "e79a873602e8a53d615f39e559b2a0d8", "score": "0.6459593", "text": "func NewHTTPServer(ctn di.Container) *cobra.Command {\n\treturn &cobra.Command{\n\t\tUse: \"http-server\",\n\t\tShort: \"Run http server\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\treturn ctn.Call(func(e *echo.Echo, cfg *viper.Viper, logger *zap.Logger) (err error) {\n\t\t\t\tvar addr = net.JoinHostPort(\n\t\t\t\t\tcfg.GetString(\"echo.host\"),\n\t\t\t\t\tcfg.GetString(\"echo.port\"),\n\t\t\t\t)\n\n\t\t\t\tlogger.Info(\"Starting HTTP server\", zap.String(\"addr\", addr))\n\n\t\t\t\tgo func() {\n\t\t\t\t\tif err = e.Start(addr); err != nil {\n\t\t\t\t\t\tlogger.Info(\"Gracefully shutting down the HTTP server\")\n\t\t\t\t\t}\n\t\t\t\t}()\n\n\t\t\t\tlogger.Info(\"HTTP server started\", zap.String(\"addr\", addr))\n\n\t\t\t\t// wait, global context cancellation\n\t\t\t\t<-cmd.Context().Done()\n\n\t\t\t\t// graceful shutdown\n\t\t\t\tvar timeout = 10 * time.Second\n\t\t\t\tlogger.Info(\"Stopping HTTP server\", zap.Duration(\"timeout\", timeout))\n\n\t\t\t\tvar ctx, cancel = context.WithTimeout(context.Background(), timeout)\n\t\t\t\tdefer cancel()\n\n\t\t\t\treturn e.Shutdown(ctx)\n\t\t\t})\n\t\t},\n\t}\n}", "title": "" }, { "docid": "3fcb66ce9881f88f03ec6b4111eed8f5", "score": "0.6448265", "text": "func NewHTTPServer(lc fx.Lifecycle, mux *http.ServeMux, log *zap.Logger) *http.Server {\n\tsrv := &http.Server{Addr: \":8080\", Handler: mux}\n\tlc.Append(fx.Hook{\n\t\tOnStart: func(ctx context.Context) error {\n\t\t\tln, err := net.Listen(\"tcp\", srv.Addr)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tlog.Info(\"Starting HTTP server\", zap.String(\"addr\", srv.Addr))\n\t\t\tgo srv.Serve(ln)\n\t\t\treturn nil\n\t\t},\n\t\tOnStop: func(ctx context.Context) error {\n\t\t\treturn srv.Shutdown(ctx)\n\t\t},\n\t})\n\treturn srv\n}", "title": "" }, { "docid": "88a1755db3583b698ca69ecfb7777875", "score": "0.64359057", "text": "func New(cfg *viper.Viper) (*Server, error) {\n\tvar S Server\n\tS.cfg = cfg\n\n\tidleTO, err := S.parseTimeout(S.cfg.GetString(\"http.idle_timeout\"))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treadTO, err := S.parseTimeout(S.cfg.GetString(\"http.read_timeout\"))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\twriteTO, err := S.parseTimeout(S.cfg.GetString(\"http.write_timeout\"))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif S.cfg.GetBool(\"http.tls.enable\") {\n\t\treturn nil, fmt.Errorf(\"tls is unsupported at the moment\")\n\t} else {\n\t\tS.HTTP = &http.Server{\n\t\t\tAddr: fmt.Sprintf(\"%s:%d\", S.cfg.GetString(\"http.bind_address\"), cfg.GetInt(\"http.bind_port\")),\n\t\t\tIdleTimeout: idleTO,\n\t\t\tReadTimeout: readTO,\n\t\t\tWriteTimeout: writeTO,\n\t\t\tHandler: S.newRouter(),\n\t\t}\n\t}\n\n\treturn &S, nil\n}", "title": "" }, { "docid": "961f78df035493934e5013f781682abe", "score": "0.64342475", "text": "func NewHTTPServer(c *conf.Server, logger log.Logger) *http.Server {\n\n\tm := grpc.WithMiddleware(\n\t\tmiddleware.Chain(\n\t\t\trecovery.Recovery(),\n\t\t\ttracing.Client(),\n\t\t\tlogging.Client(logger),\n\t\t),\n\t)\n\n\tctx := context.Background()\n\tmux := newGateway()\n\n\tssoc, err := ssopb.NewApi(ctx, m)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tssopb.RegisterApiHandlerClient(ctx, mux, ssoc)\n\tsysc, err := syspb.NewApi(ctx, m)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tsyspb.RegisterApiHandlerClient(ctx, mux, sysc)\n\t// tiku\n\ttikuc, err := tikupb.NewApi(ctx, m)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\ttikupb.RegisterApiHandlerClient(ctx, mux, tikuc)\n\t// pms\n\tpmsc, err := pmspb.NewApi(ctx, m)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tpmspb.RegisterApiHandlerClient(ctx, mux, pmsc)\n\t// member\n\tmemberc, err := memberpb.NewApi(ctx, m)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tmemberpb.RegisterApiHandlerClient(ctx, mux, memberc)\n\t// cms\n\tcmsc, err := cmspb.NewApi(ctx, m)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tcmspb.RegisterApiHandlerClient(ctx, mux, cmsc)\n\n\tvar opts = []http.ServerOption{}\n\tif c.Http.Network != \"\" {\n\t\topts = append(opts, http.Network(c.Http.Network))\n\t}\n\tif c.Http.Address != \"\" {\n\t\topts = append(opts, http.Address(c.Http.Address))\n\t}\n\tif c.Http.Timeout != nil {\n\t\topts = append(opts, http.Timeout(c.Http.Timeout.AsDuration()))\n\t}\n\topts = append(opts, http.Logger(logger))\n\thttpSrv := http.NewServer(opts...)\n\thttpSrv.HandlePrefix(\"/api/v1\", mux)\n\n\th := openapiv2.NewHandler()\n\thttpSrv.HandlePrefix(\"/q/\", h)\n\n\thttpSrv.HandleFunc(\"/api/start\", func(w xhttp.ResponseWriter, r *xhttp.Request) {\n\t\tw.Write([]byte(\"hello kratos!\"))\n\t})\n\treturn httpSrv\n}", "title": "" }, { "docid": "84e2854cdbf52047f2bb0bd336b9c100", "score": "0.63984936", "text": "func NewHTTPServer(c *conf.Server, ac *conf.Auth, logger log.Logger, s *service.AdminService) *http.Server {\n\tvar opts = []http.ServerOption{\n\t\tNewMiddleware(ac, logger),\n\t\thttp.Filter(handlers.CORS(\n\t\t\thandlers.AllowedHeaders([]string{\"\" +\n\t\t\t\t\"\", \"Content-Type\", \"Authorization\"}),\n\t\t\thandlers.AllowedMethods([]string{\"GET\", \"POST\", \"PUT\", \"DELETE\", \"HEAD\", \"OPTIONS\"}),\n\t\t\thandlers.AllowedOrigins([]string{\"*\"}),\n\t\t)),\n\t}\n\tif c.Http.Network != \"\" {\n\t\topts = append(opts, http.Network(c.Http.Network))\n\t}\n\tif c.Http.Addr != \"\" {\n\t\topts = append(opts, http.Address(c.Http.Addr))\n\t}\n\tif c.Http.Timeout != nil {\n\t\topts = append(opts, http.Timeout(c.Http.Timeout.AsDuration()))\n\t}\n\tsrv := http.NewServer(opts...)\n\n\th := openapiv2.NewHandler()\n\tsrv.HandlePrefix(\"/q/\", h)\n\n\tv1.RegisterAdminHTTPServer(srv, s)\n\treturn srv\n}", "title": "" }, { "docid": "17154084e95f7f48a4829d1aabee4733", "score": "0.6390313", "text": "func NewHTTPPool(self string)*HTTPPool{\n\treturn &HTTPPool{\n\t\tself: self,\n\t\tbasePath: defaultBasePath,\n\t}\n}", "title": "" }, { "docid": "e68673648980a9a5f3186f59c4760489", "score": "0.638412", "text": "func NewHTTPServer(c *conf.Server, m middleware.Middleware) *http.Server {\n\tvar opts = []http.ServerOption{\n\t\thttp.Middleware(m),\n\t\thttp.Filter(handlers.CORS(\n\t\t\thandlers.AllowedHeaders([]string{\"X-Requested-With\", \"Content-Type\", \"Authorization\"}),\n\t\t\thandlers.AllowedMethods([]string{\"GET\", \"POST\", \"PUT\", \"PATCH\", \"DELETE\", \"HEAD\", \"OPTIONS\"}),\n\t\t\thandlers.AllowedOrigins([]string{\"*\"}),\n\t\t)),\n\t}\n\tif c.Http.Network != \"\" {\n\t\topts = append(opts, http.Network(c.Http.Network))\n\t}\n\tif c.Http.Addr != \"\" {\n\t\topts = append(opts, http.Address(c.Http.Addr))\n\t}\n\tif c.Http.Timeout != nil {\n\t\topts = append(opts, http.Timeout(c.Http.Timeout.AsDuration()))\n\t}\n\tsrv := http.NewServer(opts...)\n\treturn srv\n}", "title": "" }, { "docid": "2c4d2e48549af6eb9b4957b2e16d6e64", "score": "0.6381015", "text": "func NewHTTPSO(ctx context.Context, namespace string) error {\n\treturn sh.RunWithV(\n\t\tmake(map[string]string),\n\t\t\"kubectl\", \"create\", \"-f\", \"examples/httpscaledobject.yaml\", \"-n\", namespace,\n\t)\n}", "title": "" }, { "docid": "2d2227ab820b626d32926e412dd613a3", "score": "0.63596463", "text": "func New(url string) Service {\n\treturn &http{\n\t\tclient: &h.Client{},\n\t\tresponder: &defaultResponder{},\n\t\turl: url,\n\t}\n}", "title": "" }, { "docid": "148f3b3c4661bf45750576fa4ce77054", "score": "0.63595456", "text": "func newHTTPService(channelID string) (*HTTPServiceImpl, error) {\n\tconfig, err := httpsnapconfig.NewConfig(PeerConfigPath, channelID)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(errors.GeneralError, err, \"Failed to initialize config\")\n\t}\n\n\tif config == nil {\n\t\treturn nil, errors.New(errors.GeneralError, \"config from ledger is nil\")\n\t}\n\thttpService := &HTTPServiceImpl{}\n\thttpService.config = config\n\treturn httpService, nil\n\n}", "title": "" }, { "docid": "09f0f5e50a9634562b758d0bca870c1e", "score": "0.63582104", "text": "func New(opts Options) *Server {\n\tsrv := &Server{\n\t\timpl: http.Server{\n\t\t\tAddr: opts.Addr,\n\t\t},\n\t\tlogger: opts.Logger,\n\t}\n\n\treturn srv\n}", "title": "" }, { "docid": "c59a40cb8958583b169bffcfbcdbefe2", "score": "0.63196266", "text": "func NewHTTPServer(agent *Command, config *structs.Config) (*HTTPServer, error) {\n\n\t// Start the listener\n\tlnAddr, err := net.ResolveTCPAddr(\"tcp\", config.BindAddress+\":\"+config.HTTPPort)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tln, err := Listener(\"tcp\", lnAddr.IP.String(), lnAddr.Port)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to start HTTP listener: %v\", err)\n\t}\n\n\t// Create the mux\n\tmux := http.NewServeMux()\n\n\t// Create the server\n\tsrv := &HTTPServer{\n\t\tagent: agent,\n\t\tmux: mux,\n\t\tlistener: ln,\n\t\tAddr: ln.Addr().String(),\n\t}\n\tsrv.registerHandlers()\n\n\t// Handle requests with gzip compression\n\tgzip, err := gziphandler.GzipHandlerWithOpts(gziphandler.MinSize(0))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tgo http.Serve(ln, gzip(mux))\n\tlogging.Info(\"command/http: the API server has started and is listening at %s\", srv.Addr)\n\n\treturn srv, nil\n}", "title": "" }, { "docid": "37ab9eaab2c5ec44f65b2b6cd58d1006", "score": "0.63117814", "text": "func NewHTTPServer(ctx context.Context, endpoints Endpoints) http.Handler {\n\tm := http.NewServeMux()\n\tm.Handle(\"/keygen\", httptransport.NewServer(\n\t\tendpoints.GenerateKeyEndpoint,\n\t\tDecodeGenerateKeyRequest,\n\t\tEncodeGenerateKeyResponse,\n\t))\n\tm.Handle(\"/encrypt\", httptransport.NewServer(\n\t\tendpoints.GCMEncryptEndpoint,\n\t\tDecodeGCMEncryptRequest,\n\t\tEncodeGCMEncryptResponse,\n\t))\n\tm.Handle(\"/decrypt\", httptransport.NewServer(\n\t\tendpoints.GCMDecryptEndpoint,\n\t\tDecodeGCMDecryptRequest,\n\t\tEncodeGCMDecryptResponse,\n\t))\n\tm.Handle(\"/metrics\", promhttp.Handler())\n\treturn m\n}", "title": "" }, { "docid": "24715ed2290061a06e0aca6edcdbc718", "score": "0.6305746", "text": "func NewHTTPServer(c *conf.Server, logger log.Logger, a *service.AdminService, s *service.ApiService) *http.Server {\n\tvar opts = []http.ServerOption{\n\t\thttp.Middleware(\n\t\t\tmiddleware.Chain(\n\t\t\t\trecovery.Recovery(),\n\t\t\t\thandleerr.Server(),\n\t\t\t\ttracing.Server(),\n\t\t\t\tlogging.Server(logger),\n\t\t\t),\n\t\t),\n\t}\n\tif c.Http.Network != \"\" {\n\t\topts = append(opts, http.Network(c.Http.Network))\n\t}\n\tif c.Http.Address != \"\" {\n\t\topts = append(opts, http.Address(c.Http.Address))\n\t}\n\tif c.Http.Timeout != nil {\n\t\topts = append(opts, http.Timeout(c.Http.Timeout.AsDuration()))\n\t}\n\topts = append(opts, http.Logger(logger))\n\thttpSrv := http.NewServer(opts...)\n\n\tpb.RegisterAdminHTTPServer(httpSrv, a)\n\tpb.RegisterApiHTTPServer(httpSrv, s)\n\n\thttpSrv.HandleFunc(\"/kratos/start\", func(w xhttp.ResponseWriter, r *xhttp.Request) {\n\t\tw.Write([]byte(\"hello kratos!\"))\n\t})\n\n\treturn httpSrv\n}", "title": "" }, { "docid": "7a4e99a2c09a68a78909971b418ce91e", "score": "0.62882113", "text": "func (s *Server) newHttpServer(address string) *http.Server {\n\tserver := &http.Server{\n\t\tAddr: address,\n\t\tHandler: http.HandlerFunc(s.config.Handler),\n\t\tReadTimeout: s.config.ReadTimeout,\n\t\tWriteTimeout: s.config.WriteTimeout,\n\t\tIdleTimeout: s.config.IdleTimeout,\n\t\tMaxHeaderBytes: s.config.MaxHeaderBytes,\n\t\tErrorLog: log.New(&errorLogger{logger: s.config.Logger}, \"\", 0),\n\t}\n\tserver.SetKeepAlivesEnabled(s.config.KeepAlive)\n\treturn server\n}", "title": "" }, { "docid": "15d5a5e064954bac082b079593308bc0", "score": "0.62734807", "text": "func NewHttpServer(c *client.Client, config Config) (*HttpServer, error) {\n\thandler := NewHandler(c)\n\n\trouter := httprouter.New()\n\trouter.POST(\"/query\", handler.query)\n\trouter.GET(\"/query\", handler.query)\n\trouter.POST(\"/ping\", handler.ping)\n\trouter.GET(\"/ping\", handler.ping)\n\trouter.POST(\"/write\", handler.write)\n\trouter.GET(\"/write\", handler.write)\n\n\treturn &HttpServer{router: router, config: config}, nil\n}", "title": "" }, { "docid": "d59af3ee8c8011aa55f5fec37c678b70", "score": "0.6256027", "text": "func NewHttpServer(address string, mux http.Handler) *HttpServer {\n\thttpServerPtr := &HttpServer{ctx: context.Background()}\n\thttpServerPtr.serverPtr = &http.Server{\n\t\tAddr: address,\n\t\tWriteTimeout: 6 * time.Second,\n\t\tHandler: mux,\n\t}\n\treturn httpServerPtr\n}", "title": "" }, { "docid": "0fe1483a751a01c22055e5f5cac75e94", "score": "0.6244615", "text": "func NewHTTPServer(service Service) *HTTPServer {\n\ts := &HTTPServer{\n\t\tservice: service,\n\t}\n\tr := mux.NewRouter()\n\t{\n\t\tr.Methods(\"POST\").Path(\"/signup\").HandlerFunc(s.handleSignup)\n\t\tr.Methods(\"POST\").Path(\"/login\").HandlerFunc(s.handleLogin)\n\t\tr.Methods(\"GET\").Path(\"/validate\").HandlerFunc(s.handleValidate)\n\t\tr.Methods(\"POST\").Path(\"/logout\").HandlerFunc(s.handleLogout)\n\t}\n\ts.router = r\n\treturn s\n}", "title": "" }, { "docid": "d15c37c682a567e3de88cb341c83bf70", "score": "0.62379366", "text": "func NewHTTPServer() *HTTPServer {\n\treturn &HTTPServer{\n\t\tServer: &http.Server{},\n\t\tlistener: nil,\n\t\trunning: make(chan error, 1),\n\t}\n}", "title": "" }, { "docid": "d41604dfdc882478743e784b6276772e", "score": "0.6229212", "text": "func NewHTTP(requestHandler *RequestHandler) *router.Router {\n\trouter := router.New()\n\trouter.GET(uri.Devices, func(ctx *fasthttp.RequestCtx) {\n\t\tvalidateRequest(ctx, requestHandler.listDevices)\n\t})\n\trouter.DELETE(uri.Devices+\"/:deviceId\", func(ctx *fasthttp.RequestCtx) {\n\t\tvalidateRequest(ctx, requestHandler.offboardDevice)\n\t})\n\trouter.GET(uri.Resources, func(ctx *fasthttp.RequestCtx) {\n\t\tvalidateRequest(ctx, requestHandler.listResources)\n\t})\n\trouter.GET(uri.Resources+\"/:resourceId\", func(ctx *fasthttp.RequestCtx) {\n\t\tvalidateRequest(ctx, requestHandler.getResourceContent)\n\t})\n\trouter.PUT(uri.Resources+\"/:resourceId\", func(ctx *fasthttp.RequestCtx) {\n\t\tvalidateRequest(ctx, requestHandler.updateResourceContent)\n\t})\n\trouter.GET(uri.Healthcheck, requestHandler.healthcheck)\n\n\treturn router\n}", "title": "" }, { "docid": "10848b461709da986ee8b64b1bfe9ce6", "score": "0.6198863", "text": "func NewHttpApi(address *url.URL, options *HttpApiOptions) (HttpApi, error) {\n\tif options.Timeout == 0 {\n\t\toptions.Timeout = 10 * time.Second\n\t}\n\n\treturn defaultHttpApi{\n\t\thttpClient: &http.Client{\n\t\t\tTimeout: options.Timeout,\n\t\t},\n\t\taddress: address,\n\t\toptions: options,\n\t}, nil\n}", "title": "" }, { "docid": "5fad6874af5c48310a35f1f4471a2b93", "score": "0.6194478", "text": "func NewHTTPTestServer(code int, body string) *httptest.Server {\n\treturn httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.WriteHeader(code)\n\t\t_, err := w.Write([]byte(body))\n\t\tif err != nil {\n\t\t\tfmt.Println(\"error writing HTTP response\")\n\t\t}\n\t}))\n}", "title": "" }, { "docid": "29b31f7657cbcc6830e374cee4272467", "score": "0.6193273", "text": "func New(configuration Configuration, alertParser alertparser.AlertParser, trapSender trapsender.TrapSender, logger log.Logger) *HTTPServer {\n\treturn &HTTPServer{configuration, alertParser, trapSender, logger}\n}", "title": "" }, { "docid": "3e79a032c8e55904cac4a66e31b75807", "score": "0.61707836", "text": "func NewHTTPServer() *echo.Echo {\n\te := echo.New()\n\te.Debug = true\n\n\treturn e\n}", "title": "" }, { "docid": "61a38a44f5108debd5767df800eca6a4", "score": "0.6156295", "text": "func NewHTTPServe(\n\tctx context.Context,\n\tsvcEndpoints delivery.Endpoints,\n\tlogger log.Logger,\n) http.Handler {\n\t// Initialize mux router error logger and error\n\tvar (\n\t\tr = mux.NewRouter()\n\t\toptions []httptransport.ServerOption\n\t\terrorLogger = httptransport.ServerErrorLogger(logger)\n\t\terrorEncoder = httptransport.ServerErrorEncoder(\n\t\t\tdecodeencode.EncodeErrorResponse,\n\t\t)\n\t)\n\toptions = append(options, errorLogger, errorEncoder)\n\n\t// Attaching middlewares\n\tr.Use(middleware.ContentTypeMiddleware)\n\tr.Use(middleware.AllowOrigin)\n\tr.Use(mux.CORSMethodMiddleware(r))\n\n\t// Creating routes\n\tr.Methods(\"POST\").Path(\"/user\").Handler(httptransport.NewServer(\n\t\tsvcEndpoints.CreateUser,\n\t\tdecodeCreateUserRequest,\n\t\tdecodeencode.EncodeResponse,\n\t\toptions...,\n\t))\n\tr.Methods(\"GET\").Path(\"/user/{id}\").Handler(httptransport.NewServer(\n\t\tsvcEndpoints.GetUser,\n\t\tdecodeGetUserRequest,\n\t\tdecodeencode.EncodeResponse,\n\t\toptions...,\n\t))\n\n\treturn r\n}", "title": "" }, { "docid": "7b455c148d7b4f34d52b83f5b922a8cb", "score": "0.61469686", "text": "func New(cmdCtx context.Context, log *logrus.Entry, conf *runtime.HTTPConfig, p runtime.Port, hosts runtime.HostHandlers) *HTTPServer {\n\t// TODO: uuid package switch with global option\n\tuidFn := func() string {\n\t\treturn xid.New().String()\n\t}\n\n\tlogConf := *logging.DefaultConfig\n\tlogConf.TypeFieldKey = \"couper_access\"\n\tenv.DecodeWithPrefix(&logConf, \"ACCESS_\")\n\n\thttpSrv := &HTTPServer{\n\t\taccessLog: logging.NewAccessLog(&logConf, log.Logger),\n\t\tconfig: conf,\n\t\tcommandCtx: cmdCtx,\n\t\tlog: log,\n\t\tmuxes: hosts,\n\t\tuidFn: uidFn,\n\t}\n\n\tsrv := &http.Server{\n\t\tAddr: \":\" + string(p),\n\t\tHandler: httpSrv,\n\t\tIdleTimeout: conf.Timings.IdleTimeout,\n\t\tReadHeaderTimeout: conf.Timings.ReadHeaderTimeout,\n\t}\n\n\thttpSrv.srv = srv\n\n\treturn httpSrv\n}", "title": "" }, { "docid": "830c96b69ba7981d9121a4d133d99cd5", "score": "0.61430657", "text": "func NewHTTP(svc importer.Service, er *echo.Group, DefaultDbhost, DefaultElasticBulkType, DefaultElasticHost string, DefaultFetch, DefaultOffset int) {\n\th := HTTP{\n\t\tsvc: svc,\n\t\tDefaultDbhost: DefaultDbhost,\n\t\tDefaultElasticBulkType: DefaultElasticBulkType,\n\t\tDefaultElasticHost: DefaultElasticHost,\n\t\tDefaultFetch: DefaultFetch,\n\t\tDefaultOffset: DefaultOffset,\n\t}\n\tig := er.Group(\"/bulk\")\n\tig.POST(\"\", h.bulk)\n\tig.GET(\"\", h.bulk)\n}", "title": "" }, { "docid": "a3c12a93b091f01426858e801025d1d2", "score": "0.6140223", "text": "func NewHTTPServer(endpoints Set, logger log.Logger) http.Handler {\n\tr := mux.NewRouter()\n\toptions := []httptransport.ServerOption{\n\t\thttptransport.ServerErrorLogger(logger),\n\t\thttptransport.ServerErrorEncoder(encodeHTTPError),\n\t}\n\n\tr.Methods(\"POST\").Path(\"/save\").Handler(httptransport.NewServer(\n\t\tendpoints.SaveEndpoint,\n\t\tdecodeHTTPSaveRequest,\n\t\tencodeHTTPGenericResponse,\n\t\toptions...,\n\t))\n\n\treturn r\n}", "title": "" }, { "docid": "0b2e593a86b796f2b577f733eb86545e", "score": "0.6136552", "text": "func NewHTTPServer(cfg conf.App, logger *log.Logger, handler http.Handler) *HTTPServer {\n\tappServer := HTTPServer{\n\t\tserver: http.Server{\n\t\t\tAddr: cfg.Web.Host, // IP:Port or Hostname:Port\n\t\t\tHandler: handler, // Root HTTP Router\n\t\t\tReadTimeout: cfg.Web.ReadTimeout, // the maximum duration for reading the entire request, including the body\n\t\t\tWriteTimeout: cfg.Web.WriteTimeout, // the maximum duration before timing out writes of the response\n\t\t\tIdleTimeout: cfg.Web.IdleTimeout, // the maximum amount of time to wait for the next request when keep-alive is enabled\n\t\t\tReadHeaderTimeout: cfg.Web.ReadHeaderTimeout, // the amount of time allowed to read request headers\n\t\t},\n\t\tlogger: logger,\n\t}\n\treturn &appServer\n}", "title": "" }, { "docid": "b1be4e63a4cb7a602e0916e4693520c3", "score": "0.6129129", "text": "func NewHTTPPool() *HTTPPool {\n\treturn &HTTPPool{\n\t\tbasePath: defaultBasePath,\n\t}\n}", "title": "" }, { "docid": "f5e9806d0bff7fb881df903bc5453021", "score": "0.612486", "text": "func newServer(handler http.HandlerFunc, loopback bool, https bool) (*httptest.Server, error) {\n\tsrv := httptest.NewUnstartedServer(handler)\n\n\tif !loopback {\n\t\t// Replace the test-supplied loopback listener with the first available\n\t\t// non-loopback address.\n\t\tsrv.Listener.Close()\n\t\tl, err := net.Listen(\"tcp\", \"0.0.0.0:0\")\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tsrv.Listener = l\n\t}\n\n\tif https {\n\t\tsrv.StartTLS()\n\t} else {\n\t\tsrv.Start()\n\t}\n\treturn srv, nil\n}", "title": "" }, { "docid": "c6b502e439a34dd727bbcbddff8df72d", "score": "0.60953814", "text": "func newHTTPTransport(ctx context.Context, cfg *Config) *httpTransport {\n\tif cfg.Client == nil {\n\t\tcfg.Client = &http.Client{}\n\t}\n\tif cfg.Server == nil {\n\t\tcfg.Server = &http.Server{}\n\t}\n\tcfg.Server.Addr = cfg.Name\n\n\tscheme := \"https\"\n\tif cfg.CertFile == \"\" || cfg.KeyFile == \"\" {\n\t\tscheme = \"http\"\n\t}\n\th := &httpTransport{\n\t\tscheme: scheme,\n\t\tstartCh: make(chan struct{}),\n\t\tctx: ctx,\n\t\tconfig: cfg,\n\t\tlogger: cfg.Logger,\n\t\tclient: cfg.Client,\n\t\tserver: cfg.Server,\n\t\trouter: httprouter.New(),\n\t}\n\th.router.HEAD(\"/aliveness\", h.handleAliveness)\n\th.router.DELETE(\"/destroy-dmap/:name\", h.handleDestroyDmap)\n\th.router.POST(\"/move-dmap\", h.handleMoveDmap)\n\th.router.POST(\"/update-routing\", h.handleUpdateRouting)\n\th.router.GET(\"/is-part-empty/:partID\", h.handleIsPartEmpty)\n\th.router.GET(\"/is-backup-empty/:partID\", h.handleIsBackupEmpty)\n\n\th.router.POST(\"/put/:name/:hkey\", h.handlePut)\n\th.router.GET(\"/get/:name/:hkey\", h.handleGet)\n\th.router.DELETE(\"/delete/:name/:hkey\", h.handleDelete)\n\th.router.GET(\"/get-prev/:name/:hkey\", h.handleGetPrev)\n\th.router.DELETE(\"/delete-prev/:name/:hkey\", h.handleDeletePrev)\n\n\th.router.GET(\"/find-lock/:name/:key\", h.handleFindLock)\n\th.router.GET(\"/lock/:name/:key\", h.handleLock)\n\th.router.GET(\"/lock-prev/:name/:key\", h.handleLockPrev)\n\th.router.GET(\"/unlock/:name/:key\", h.handleUnlock)\n\th.router.GET(\"/unlock-prev/:name/:key\", h.handleUnlockPrev)\n\n\th.router.POST(\"/backup/put/:name/:hkey\", h.handlePutBackup)\n\th.router.GET(\"/backup/get/:name/:hkey\", h.handleGetBackup)\n\th.router.DELETE(\"/backup/delete/:name/:hkey\", h.handleDeleteBackup)\n\th.router.POST(\"/backup/move-dmap\", h.handleMoveBackupDmap)\n\n\t// Endpoints for external access.\n\th.router.GET(\"/ex/get/:name/:key\", h.handleExGet)\n\th.router.POST(\"/ex/put/:name/:key\", h.handleExPut)\n\th.router.DELETE(\"/ex/delete/:name/:key\", h.handleExDelete)\n\th.router.GET(\"/ex/lock-with-timeout/:name/:key\", h.handleExLockWithTimeout)\n\th.router.GET(\"/ex/unlock/:name/:key\", h.handleExUnlock)\n\th.router.GET(\"/ex/destroy/:name\", h.handleExDestroy)\n\th.router.PUT(\"/ex/incr/:name/:key/:delta\", h.handleExIncr)\n\th.router.PUT(\"/ex/decr/:name/:key/:delta\", h.handleExDecr)\n\th.router.PUT(\"/ex/getput/:name/:key\", h.handleExGetPut)\n\treturn h\n}", "title": "" }, { "docid": "eed4cc5992388c805e95b51ea43c8b08", "score": "0.609172", "text": "func New(config *config.ServerConfig) *Server {\n\n\trouter := httprouter.New()\n\n\t// automatic handle for OPTIONS requests\n\trouter.GlobalOPTIONS = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tif r.Header.Get(\"Access-Control-Request-Method\") != \"\" {\n\t\t\t// Set CORS headers\n\t\t\theader := w.Header()\n\t\t\theader.Set(\"Access-Control-Allow-Origin\", \"*\")\n\t\t\theader.Set(\"Access-Control-Allow-Methods\", r.Header.Get(\"Allow\"))\n\t\t\theader.Set(\"Access-Control-Allow-Headers\", strings.Join(config.CORS.AllowedHeaders, \", \"))\n\t\t\theader.Set(\"Access-Control-Max-Age\", strconv.FormatInt(config.CORS.MaxAge, 10))\n\t\t}\n\t\t// Adjust status code to 204\n\t\tw.WriteHeader(http.StatusNoContent)\n\t})\n\n\twebServer := &http.Server{\n\t\tAddr: config.Listen,\n\t\tHandler: router,\n\t\tReadTimeout: 5 * time.Second,\n\t\tWriteTimeout: 10 * time.Second,\n\t\tIdleTimeout: 15 * time.Second,\n\t}\n\n\treturn &Server{\n\t\trouter: router,\n\t\twebServer: webServer,\n\t\tconfig: config,\n\t}\n}", "title": "" }, { "docid": "8b2938bd8c87e0839053ca4f04909acf", "score": "0.60886574", "text": "func NewHttp(baseUrl string, p poster.Poster, errorCb func(error)) (Service, error) {\n\tif errorCb == nil {\n\t\terrorCb = func(error) {}\n\t}\n\tif p == nil {\n\t\tp = poster.Http()\n\t}\n\n\turl := baseUrl\n\tif strings.HasPrefix(url, \"http://\") {\n\t\turl = url[len(\"http://\"):]\n\t}\n\n\tws, _, err := websocket.DefaultDialer.Dial(fmt.Sprintf(\"ws://%s/events\", url), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tself := &remoteService{\n\t\tbaseUrl, true, p,\n\t\t0,\n\t\tsync.Mutex{}, map[string]*remoteServiceBackend{},\n\t\tsync.Mutex{}, ws,\n\t\tsync.Mutex{}, map[uint32]chan json.RawMessage{},\n\t}\n\n\tgo func() {\n\t\tif err := self.run(ws); err != nil {\n\t\t\terrorCb(err)\n\t\t}\n\t}()\n\n\treturn self, nil\n}", "title": "" }, { "docid": "153866ffd16054cf9ff99b7846960e05", "score": "0.60841805", "text": "func NewHTTPServer(ctx context.Context, endpoints e.Endpoints) http.Handler {\n\tr := mux.NewRouter()\n\tr.Use(commonMiddleware)\n\n\tr.Methods(\"GET\").Path(\"/questions\").Handler(httptransport.NewServer(\n\t\tendpoints.GetAllQuestionsEndpoint,\n\t\tt.DecodeCountRequest,\n\t\tt.EncodeResponse,\n\t))\n\n\tr.Methods(\"DELETE\").Path(\"/questions/{id}\").Handler(httptransport.NewServer(\n\t\tendpoints.DeleteQuestionEndpoint,\n\t\tt.DecodeDeleteRequest,\n\t\tt.EncodeResponse,\n\t))\n\n\tr.Methods(\"GET\").Path(\"/questions/{id}\").Handler(httptransport.NewServer(\n\t\tendpoints.GetQuestionByIdEndpoint,\n\t\tt.DecodeDeleteRequest,\n\t\tt.EncodeResponse,\n\t))\n\n\tr.Methods(\"GET\").Path(\"/questions/user/{name}\").Handler(httptransport.NewServer(\n\t\tendpoints.GetQuestionsByUserEndpoint,\n\t\tt.DecodeGetByUserRequest,\n\t\tt.EncodeResponse,\n\t))\n\n\tr.Methods(\"PUT\").Path(\"/questions/{id}\").Handler(httptransport.NewServer(\n\t\tendpoints.UpdateQuestionEndpoint,\n\t\tt.DecodeUpdateRequest,\n\t\tt.EncodeResponse,\n\t))\n\n\tr.Methods(\"POST\").Path(\"/question\").Handler(httptransport.NewServer(\n\t\tendpoints.CreateQuestionEndpoint,\n\t\tt.DecodeQuestionCreateRequest,\n\t\tt.EncodeResponse,\n\t))\n\n\tr.Methods(\"GET\").Path(\"/answers\").Handler(httptransport.NewServer(\n\t\tendpoints.GetAllAnswersEndpoint,\n\t\tt.DecodeCountRequest,\n\t\tt.EncodeResponse,\n\t))\n\n\treturn r\n}", "title": "" }, { "docid": "87082006ec4a8fea72a0e9fbdc931c5a", "score": "0.60761046", "text": "func NewHTTPService(vm *otto.Otto, context *Context, stub shim.ChaincodeStubInterface) (result *HTTPService) {\n\tlogger.Debug(\"Entering NewHTTPService\", vm, context, &stub)\n\tdefer func() { logger.Debug(\"Exiting NewHTTPService\", result) }()\n\n\t// Create a new instance of the JavaScript chaincode class.\n\ttemp, err := vm.Call(\"new concerto.HTTPService\", nil, context.This)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"Failed to create new instance of HTTPService JavaScript class: %v\", err))\n\t} else if !temp.IsObject() {\n\t\tpanic(\"New instance of HTTPService JavaScript class is not an object\")\n\t}\n\tobject := temp.Object()\n\n\t// Add a pointer to the Go object into the JavaScript object.\n\tresult = &HTTPService{This: temp.Object(), Stub: stub}\n\terr = object.Set(\"$this\", result)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"Failed to store Go object in HTTPService JavaScript object: %v\", err))\n\t}\n\n\t// Bind the methods into the JavaScript object.\n\tresult.This.Set(\"_post\", result.post)\n\treturn result\n}", "title": "" }, { "docid": "3bfabdfd175b955d84931dd559e63046", "score": "0.6039279", "text": "func NewHTTPBackend(connString string, port int) Backend {\n\treturn &httpBackend{\n\t\tconnString,\n\t\tport,\n\t}\n}", "title": "" }, { "docid": "794f90e704d0ed7a001cb1d79bf9a715", "score": "0.6038277", "text": "func New(port string, handler http.Handler) *Server {\n\treturn &Server{\n\t\tserver: &http.Server{\n\t\t\tAddr: \":\" + port,\n\t\t\tHandler: handler,\n\t\t\tReadTimeout: 5 * time.Second,\n\t\t\tWriteTimeout: 55 * time.Second,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "bee773ac9c5977fd6fd3423ed5714abe", "score": "0.6003832", "text": "func NewHttpServer(exePath string, options *HttpServerOptions) (HttpServer, error) {\n\tfinalExePath, err := fullyQualifiedBinaryPath(exePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif options.HttpApi == nil {\n\t\ta, err := url.Parse(fmt.Sprintf(\"http://127.0.0.1:%d\", options.Port))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\toptions.HttpApi, err = NewHttpApi(a, &HttpApiOptions{\n\t\t\tTimeout: 5 * time.Second,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn &deprecatedHttpServer{\n\t\texePath: finalExePath,\n\t\toptions: options,\n\t\tmutex: &sync.Mutex{},\n\t\tstate: Stopped,\n\t\tstopped: make(chan StoppedInfo),\n\t}, nil\n}", "title": "" }, { "docid": "4345069382fc5d993e683a8a096c7bf3", "score": "0.5993128", "text": "func New(mux *http.ServeMux, serverAddress string) *http.Server {\n\t// See https://blog.cloudflare.com/exposing-go-on-the-internet/ for details about these settings\n\ttlsConfig := &tls.Config{\n\t\t// Causes servers to use Go's default cipher suite preferences, which are tuned to avoid attacks\n\t\t// Does nothing on clients.\n\t\tPreferServerCipherSuites: true,\n\t\t// Only use curves which have assembly implementations\n\t\tCurvePreferences: []tls.CurveID{\n\t\t\ttls.CurveP256,\n\t\t\ttls.X25519,\n\t\t},\n\n\t\tMinVersion: tls.VersionTLS12,\n\t\tCipherSuites: []uint16{\n\t\t\ttls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,\n\t\t\ttls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,\n\t\t\ttls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,\n\t\t\ttls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,\n\t\t\ttls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,\n\t\t\ttls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,\n\t\t},\n\t}\n\n\tserver := &http.Server{\n\t\tAddr: serverAddress,\n\t\tReadTimeout: 10 * time.Second,\n\t\tWriteTimeout: 10 * time.Second,\n\t\tIdleTimeout: \t\t120 * time.Second,\n\t\tMaxHeaderBytes: 1 << 20,\n\t\tTLSConfig: tlsConfig,\n\t\tHandler: mux,\n\t}\n\n\treturn server\n}", "title": "" }, { "docid": "bc6973cf706f41e8efaa3b9e0fe4d71c", "score": "0.5988744", "text": "func NewHTTPTransport(addr raft.ServerAddress, client Doer, logger *log.Logger, urlFmt string) *HTTPTransport {\n\tif client == nil {\n\t\tclient = http.DefaultClient\n\t}\n\tif logger == nil {\n\t\tlogger = log.New(os.Stderr, \"\", log.LstdFlags)\n\t}\n\tif urlFmt == \"\" {\n\t\turlFmt = \"https://%v/raft/\"\n\t}\n\treturn &HTTPTransport{\n\t\tlogger: logger,\n\t\tconsumer: make(chan raft.RPC),\n\t\taddr: addr,\n\t\tclient: client,\n\t\turlFmt: urlFmt,\n\t}\n}", "title": "" }, { "docid": "b810120d44662ecbeac0eef0b9c7a6e5", "score": "0.59636706", "text": "func New(\n\tgenerator template.Generator,\n\tvalidator repo.ValidatorService,\n\tbaseURL string,\n\topts ...func(*Config),\n) (*Server, error) {\n\tcfg := Config{\n\t\tHTTPServer: new(http.Server),\n\t\tLogger: zero.Logger(),\n\t}\n\tfor _, opt := range opts {\n\t\topt(&cfg)\n\t}\n\n\t// Normalize baseURL.\n\tbaseURL = urlutil.StripProtocol(baseURL)\n\tbaseURL = strings.Trim(baseURL, \"/\")\n\n\treturn &Server{\n\t\tgenerator: generator,\n\t\tvalidator: validator,\n\t\thttpsrv: cfg.HTTPServer,\n\t\tlog: cfg.Logger,\n\t\tbaseURL: baseURL,\n\t}, nil\n}", "title": "" }, { "docid": "bc210d7ca179f91227dd8df32d9b0bb6", "score": "0.5952644", "text": "func (s *Service) createHTTPServer(config Config) (srv *httpServer, containerPort int, hostAddr, containerAddr string, err error) {\n\t// Create address to listen on\n\tcontainerPort, hostPort, err := s.getHTTPServerPort()\n\tif err != nil {\n\t\treturn nil, 0, \"\", \"\", maskAny(err)\n\t}\n\tcontainerAddr = net.JoinHostPort(config.BindAddress, strconv.Itoa(containerPort))\n\thostAddr = net.JoinHostPort(config.OwnAddress, strconv.Itoa(hostPort))\n\n\t// Create HTTP server\n\treturn newHTTPServer(s.log, s, &s.runtimeServerManager, config, s.id), containerPort, hostAddr, containerAddr, nil\n}", "title": "" }, { "docid": "7ecf8bd89838dcfc05d6f227696cef8e", "score": "0.5930942", "text": "func NewHTTPServer(client deps.DeOlhoNaFila) *Server {\n\thandler := &httpHandler{DeOlhoNaFilaClient: client}\n\n\tr := mux.NewRouter()\n\tr.HandleFunc(\"/data.raw\", handler.rawData).Methods(http.MethodPost)\n\tr.HandleFunc(\"/data\", handler.data).Methods(http.MethodGet)\n\n\treturn &Server{r}\n}", "title": "" }, { "docid": "e012324e26d59dab9e24a4020f029ca8", "score": "0.59164304", "text": "func New(mesgService *service.Service, addr string) (*HTTPServerService, error) {\n\ts := &HTTPServerService{\n\t\tservice: mesgService,\n\t\tsessions: make(map[string]*server.Session),\n\t\tcaches: make([]*cache, 0),\n\t}\n\tserver, err := server.New(addr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ts.server = server\n\tgo func() {\n\t\tfor ses := range s.server.Sessions {\n\t\t\tgo s.handleSession(ses)\n\t\t}\n\t}()\n\treturn s, nil\n}", "title": "" }, { "docid": "795ca64e7adcff0e2338d525239bb8bc", "score": "0.59026295", "text": "func NewHTTPHandler(endpoints endpoint.Endpoints, options map[string][]http.ServerOption) http1.Handler {\n\tm := http1.NewServeMux()\n\tmakeSignupHandler(m, endpoints, options[\"Signup\"])\n\tmakeSigninHandler(m, endpoints, options[\"Signin\"])\n\tmakeSignoutHandler(m, endpoints, options[\"Signout\"])\n\tmakeGetRolesHandler(m, endpoints, options[\"GetRoles\"])\n\tmakeUserInfoHandler(m, endpoints, options[\"UserInfo\"])\n\tmakeGetGroupsHandler(m, endpoints, options[\"GetGroups\"])\n\tmakeCreateGroupHandler(m, endpoints, options[\"CreateGroup\"])\n\tmakeUpdateGroupHandler(m, endpoints, options[\"UpdateGroup\"])\n\tmakeGetGroupAssetsHandler(m, endpoints, options[\"GetGroupAssets\"])\n\tmakeChangeGroupAssetsHandler(m, endpoints, options[\"ChangeGroupAssets\"])\n\tmakeCreateWalletHandler(m, endpoints, options[\"CreateWallet\"])\n\tmakeGetWalletsHandler(m, endpoints, options[\"GetWallets\"])\n\tmakeQueryOmniPropertyHandler(m, endpoints, options[\"QueryOmniProperty\"])\n\tmakeEthTokenHandler(m, endpoints, options[\"EthToken\"])\n\tmakeCreateTokenHandler(m, endpoints, options[\"CreateToken\"])\n\tmakeSendBTCTxHandler(m, endpoints, options[\"SendBTCTx\"])\n\tmakeSendOmniTxHandler(m, endpoints, options[\"SendOmniTx\"])\n\tmakeSendETHTxHandler(m, endpoints, options[\"SendETHTx\"])\n\tmakeSendERC20TxHandler(m, endpoints, options[\"SendERC20Tx\"])\n\tmakeQueryBalanceHandler(m, endpoints, options[\"QueryBalance\"])\n\tmakeWalletValidateHandler(m, endpoints, options[\"WalletValidate\"])\n\treturn m\n}", "title": "" }, { "docid": "7b7d0fc8fd49f0349c42dea8be7b86a5", "score": "0.5902181", "text": "func New(routes []Route, middlewares []MiddlewareFunc, port string, maxSimultaneousConnections int) (*Server, error) {\n\ts := &Server{}\n\trouter := newRouter()\n\trouter.StrictSlash(true)\n\trouter.addRoutes(routes)\n\trouter.addMiddlewares(middlewares)\n\ts.router = router\n\n\ts.Port = port\n\t// Start the web server\n\tsrv := &http.Server{\n\t\tAddr: fmt.Sprintf(\":%s\", port),\n\t\tHandler: router,\n\t\tMaxHeaderBytes: 1 << 13,\n\t}\n\ts.Address = srv.Addr\n\tlistener, listenerErr := net.Listen(\"tcp\", srv.Addr)\n\n\tif listenerErr != nil {\n\t\treturn nil, fmt.Errorf(\"unable to listen on %s\", srv.Addr)\n\t}\n\n\ts.listener = listener\n\n\tserveErr := srv.Serve(netutil.LimitListener(listener, maxSimultaneousConnections))\n\n\tif serveErr != nil {\n\t\treturn nil, fmt.Errorf(\"error in starting server at address %s\", srv.Addr)\n\t}\n\n\treturn s, nil\n}", "title": "" }, { "docid": "d0ca6bab14985de2bdfe5b52b324c755", "score": "0.58992314", "text": "func New(options *Options) (*TCPServer, error) {\n\treturn &TCPServer{options: options}, nil\n}", "title": "" }, { "docid": "5c322c24ac2f51250f13072ed5da6f45", "score": "0.5894891", "text": "func NewHTTPService(db *gorm.DB, queue rabbitmq.RabbitQueue) *HTTPService {\n\tservice := HTTPService{\n\t\trepo: repository.NewHTTPGetConfig(db),\n\t\tqueue: queue,\n\t\tworkChannel: make(chan database.HTTPGetConfig, 20),\n\t}\n\n\t// startup multiple dispatchers in seperate goroutines\n\tfor i := 0; i <= 5; i++ {\n\t\tgo service.dispatcher()\n\t}\n\n\treturn &service\n}", "title": "" }, { "docid": "2080037241b70d3da205d50279eb90cf", "score": "0.5894009", "text": "func newFakeHTTPServer() *fakeHTTPServer {\n\treturn &fakeHTTPServer{}\n}", "title": "" }, { "docid": "3ed3b946aec0e2eb33bab848c147a9c6", "score": "0.5888137", "text": "func NewTHttpClientWithOptions(urlstr string, options THttpClientOptions) (*THttpClient, error) {\n\tparsedURL, err := url.Parse(urlstr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclient := options.Client\n\tif client == nil {\n\t\tclient = http.DefaultClient\n\t}\n\treturn &THttpClient{\n\t\tclient: client,\n\t\turl: parsedURL,\n\t\theader: options.Header,\n\t\trequest: bytes.NewBuffer(make([]byte, 0, 1024)),\n\t}, nil\n}", "title": "" }, { "docid": "8769e252a5855fbc9f30b855811b8c4d", "score": "0.58826286", "text": "func http_new(w http.ResponseWriter, req *http.Request,\n parent string, target string, str_args map[string]string) (string,bool){\n \n LapLog(\"================> NEW COMMAND\")\n data:=NewLapData(`n`, `to`, target)\n for k,v:= range str_args {\n data.AddString(k,v)\n }\n LapLog(\"Sending %+v\",data)\n head_node.Input(&data,``)\n return ``,false\n}", "title": "" }, { "docid": "ecc1a424f3515c24de4a5d1f52ff5ea7", "score": "0.5879931", "text": "func New(opts *Options, addedOptions ...func(*Server)) *Server {\n\ts := &Server{\n\t\tinfo: InfoNew(func(i *Info) {\n\t\t\ti.Name = opts.Name\n\t\t\ti.Hostname = opts.Hostname\n\t\t\ti.Port = opts.Port\n\t\t\ti.ProfPort = opts.ProfPort\n\t\t\ti.MaxConn = opts.MaxConn\n\t\t\ti.MaxWorkers = opts.MaxWorkers\n\t\t\ti.Debug = opts.Debug\n\t\t}),\n\t\topts: opts,\n\t\tauth: auth.New(),\n\t\tlog: logger.New(logger.UseDefault, false),\n\t\tstats: StatusNew(),\n\t\trunning: false,\n\t}\n\n\tif s.info.Debug {\n\t\ts.log.SetLogLevel(logger.Debug)\n\t}\n\n\t// Setup the routes, middleware, and server.\n\tmux := http.NewServeMux()\n\tmux.HandleFunc(httpRouteAliveV1, s.aliveHandler)\n\tmux.HandleFunc(httpRouteParseV1, s.parseHandler)\n\tmux.HandleFunc(httpRouteStatusV1, s.statusHandler)\n\ts.srvr = &http.Server{\n\t\tAddr: fmt.Sprintf(\"%s:%d\", s.info.Hostname, s.info.Port),\n\t\tHandler: &Middleware{serv: s, handler: mux},\n\t\tReadTimeout: TCPReadTimeout,\n\t\tWriteTimeout: TCPWriteTimeout,\n\t}\n\n\ts.handleSignals() // Evoke trap signals handler\n\n\t// Additional hook for specialized custom options.\n\tfor _, f := range addedOptions {\n\t\tf(s)\n\t}\n\treturn s\n}", "title": "" }, { "docid": "50297b0767027d2617f3120b3b26eb8e", "score": "0.58793604", "text": "func New(t testing.TB, handler http.Handler) HTTPTester {\n\treturn &htest{\n\t\thandler: handler,\n\t\tt: t,\n\t}\n}", "title": "" }, { "docid": "b11fccb7593671e4210de8e279c1d2c2", "score": "0.58556205", "text": "func NewHTTPServer(ctx context.Context, endpoints Endpoints) http.Handler {\n\tr := mux.NewRouter()\n\tr.Use(commonMiddleware)\n\tr.Use(logMiddleware)\n\n\tr.Methods(\"GET\").Path(\"/r/{code}\").Handler(httptransport.NewServer(\n\t\tendpoints.FindRedirect,\n\t\tdecodeFindRedirectReq,\n\t\tredirectResponse,\n\t))\n\n\tr.Methods(\"GET\").Path(\"/report\").Handler(httptransport.NewServer(\n\t\tendpoints.Report,\n\t\tnil,\n\t\tencodeResponse,\n\t))\n\n\tr.Methods(\"POST\").Path(\"/\").Handler(httptransport.NewServer(\n\t\tendpoints.StoreRedirect,\n\t\tdecodeStoreRedirectReq,\n\t\tencodeResponse,\n\t))\n\n\treturn r\n}", "title": "" }, { "docid": "fac6471e2dd7bf78e28b3e662b695241", "score": "0.5853556", "text": "func New(opts ...Option) *Server {\n\tsrv := &Server{}\n\n\t// Apply all options to the Server.\n\tfor _, o := range opts {\n\t\to(srv)\n\t}\n\n\treturn srv\n}", "title": "" }, { "docid": "e8036acc3f0579fab0c1ba29aa16080b", "score": "0.5850045", "text": "func New(addr string, log logger.Logger, services map[string]http.Handler) (*Server, error) {\n\trouter := chi.NewRouter()\n\tserver := &http.Server{\n\t\tHandler: router,\n\t\tAddr: addr,\n\t\tReadHeaderTimeout: 2 * time.Second,\n\t}\n\n\ts := &Server{\n\t\trouter: router,\n\t\tserver: server,\n\t\tlog: log,\n\t}\n\treturn s.routes(services)\n}", "title": "" }, { "docid": "6f12cf254c5a165a57073a26bbe39b94", "score": "0.58498347", "text": "func NewHttpClient(t time.Duration) *HttpClient {\n\treturn &HttpClient{\n\t\tcli: &http.Client{\n\t\t\tTimeout: t * time.Second,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "0ab26ad7db8d8f9d56f235e332bf62d7", "score": "0.58441764", "text": "func New(options map[string]interface{}, fns ...Middleware) *Server {\n\ts := Server{}\n\ts.Use(fns...)\n\n\treturn &s\n}", "title": "" }, { "docid": "39dd6fbec98367fe2fbef5bef111bb89", "score": "0.58439505", "text": "func NewHTTPGetConfig(id int64, endpoint string, expectedStatusCode int) {\n\n}", "title": "" }, { "docid": "12589ef8a2a5dba3a98831fee57bc277", "score": "0.58332247", "text": "func New(addr string, st storage.Storage) (*Server, error) {\n\tvar server = &Server{\n\t\tstorage: st,\n\t\thttp: &http.Server{\n\t\t\tAddr: addr,\n\t\t},\n\t}\n\tserver.http.Handler = server.setupRouter()\n\n\treturn server, nil\n}", "title": "" }, { "docid": "ac1f7cbbbcca536b0a4c0eab144e097c", "score": "0.5833061", "text": "func New(opts ...OptionsModifier) *Server {\n\toptions := newOptsWithModifiers(opts...)\n\n\trouter := NewRouter(options.Logger)\n\n\ts := &Server{\n\t\trouter: router,\n\t\tlock: sync.RWMutex{},\n\t\tstarted: atomic.Value{},\n\t\toptions: options,\n\t}\n\n\ts.started.Store(false)\n\n\t// yes this creates a circular reference,\n\t// but the VK server and HTTP server are\n\t// extremely tightly wound together so\n\t// we have to make this compromise\n\ts.server = createGoServer(options, s)\n\n\treturn s\n}", "title": "" }, { "docid": "69d5d1cf0050ead6eec53ddc72bbdca5", "score": "0.5824717", "text": "func NewServer(addr string, h *Handler) *http.Server {\n\t// (?) Good practice to use timeouts\n\t// WriteTimeout & ReadTimeout\n\treturn &http.Server{\n\t\tAddr: addr,\n\t\tHandler: h,\n\t}\n}", "title": "" }, { "docid": "0a847da7620e292bbd3380ddf1f2969f", "score": "0.5822768", "text": "func NewHttpServer(port int, handler *http.Handler) *http.Server {\n\treturn &http.Server{\n\t\tAddr: fmt.Sprintf(\":%d\", port),\n\t\tReadHeaderTimeout: 10 * time.Second,\n\t\tReadTimeout: 30 * time.Second,\n\t\tWriteTimeout: 2 * time.Minute,\n\t\tIdleTimeout: 5 * time.Minute,\n\t\tHandler: *handler,\n\t}\n}", "title": "" }, { "docid": "4ab391550471e7af37359fa0e8db6294", "score": "0.58189", "text": "func NewHTTPWriter(c HTTPWriterConfig) *HTTPWriter {\n\treturn &HTTPWriter{\n\t\tclient: fasthttp.Client{\n\t\t\tName: httpClientName,\n\t\t},\n\n\t\tc: c,\n\t\turl: []byte(c.Host),\n\t}\n}", "title": "" }, { "docid": "bd57464381d72f195e8770e332cde729", "score": "0.5818843", "text": "func NewHttpServer(address string, logger log.Logger) (*httpServer, error) {\n\tlistener, err := net.Listen(\"tcp\", address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlogger.Info(\"started http server\", log.String(\"address\", address))\n\n\trouter := http.NewServeMux()\n\n\ts := &httpServer{\n\t\tChanShutdownWaiter: supervised.NewChanWaiter(\"SignerHttpServer\"),\n\t\tserver: &http.Server{\n\t\t\tHandler: router,\n\t\t},\n\t\tport: listener.Addr().(*net.TCPAddr).Port,\n\t\tlogger: logger,\n\t\trouter: router,\n\t}\n\n\t// We prefer not to use `HttpServer.ListenAndServe` because we want to block until the socket is listening or exit immediately\n\tgo s.server.Serve(httpserver.TcpKeepAliveListener{listener.(*net.TCPListener)})\n\n\treturn s, nil\n}", "title": "" }, { "docid": "f82f57b41ef96e1101c9323edef3ee24", "score": "0.58169353", "text": "func NewHttpHandler() *httpHandler {\n return &httpHandler{}\n}", "title": "" }, { "docid": "43e5462469537da0663c7b8083e4b135", "score": "0.58142954", "text": "func NewHTTPServer(\n\tpageService page.Service,\n\tleadService leads.Service,\n\tlogger *logrus.Logger) HTTPServer {\n\n\thttpServer := httpServer{\n\t\tpageService: pageService,\n\t\tleadService: leadService,\n\t\tlogger: logger,\n\t}\n\n\tr := mux.NewRouter()\n\n\tr.Methods(\"POST\").Path(\"/lead\").HandlerFunc(httpServer.PostLeadHandler)\n\n\tr.PathPrefix(\"/static/\").Handler(\n\t\thttp.StripPrefix(\n\t\t\t\"/static/\",\n\t\t\thttp.FileServer(\n\t\t\t\thttp.Dir(\n\t\t\t\t\thttpServer.staticFolderPath(),\n\t\t\t\t),\n\t\t\t),\n\t\t),\n\t)\n\n\tr.PathPrefix(\"/\").HandlerFunc(httpServer.TemplateHandler)\n\n\thttpServer.handler = r\n\n\treturn &httpServer\n}", "title": "" }, { "docid": "fa538c08f3362b5c79bf1c9d96175246", "score": "0.58125174", "text": "func New() *Elton {\n\te := NewWithoutServer()\n\ts := &http.Server{\n\t\tHandler: e,\n\t}\n\te.Server = s\n\treturn e\n}", "title": "" }, { "docid": "df50116e73b15a6e9e2faaa3db8738d4", "score": "0.5811039", "text": "func New(\n\tgreeter Greeter,\n) *remotohttp.Server {\n\tserver := &remotohttp.Server{\n\t\tOnErr: func(w http.ResponseWriter, r *http.Request, err error) {\n\t\t\tfmt.Fprintf(os.Stderr, \"%s %s: %s\\n\", r.Method, r.URL.Path, err.Error())\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t},\n\t\tNotFound: http.NotFoundHandler(),\n\t}\n\n\tRegisterGreeterServer(server, greeter)\n\treturn server\n}", "title": "" }, { "docid": "6dea33a1b35d03fdf2d5df80ac8a1c54", "score": "0.5807818", "text": "func New(address string, handler http.Handler) (*Server, error) {\n\tsrvr := &Server{server: http.Server{Handler: handler}}\n\n\tvar err error\n\tif srvr.listener, err = net.Listen(\"tcp\", address); err != nil {\n\t\treturn nil, fmt.Errorf(\"net.Listen: %w\", err)\n\t}\n\n\treturn srvr, nil\n}", "title": "" }, { "docid": "2b6dec2284f49eb2d91e2ea6b9e795d8", "score": "0.5805242", "text": "func New(serverAddress string, h http.Handler) *Server {\n\ttlsConfig := &tls.Config{\n\t\t// Causes servers to use Go's default ciphersuite preferences,\n\t\t// which are tuned to avoid attacks. Does nothing on clients.\n\t\tPreferServerCipherSuites: true,\n\t\t// Only use curves which have assembly implementations\n\t\tCurvePreferences: []tls.CurveID{\n\t\t\ttls.CurveP256,\n\t\t\ttls.X25519, // Go 1.8 only\n\t\t},\n\t\tMinVersion: tls.VersionTLS12,\n\t\tCipherSuites: []uint16{\n\t\t\ttls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,\n\t\t\ttls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,\n\t\t\ttls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305, // Go 1.8 only\n\t\t\ttls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305, // Go 1.8 only\n\t\t\ttls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,\n\t\t\ttls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,\n\t\t},\n\t}\n\n\treturn &Server{\n\t\tHTTPServer: &http.Server{\n\t\t\tAddr: serverAddress,\n\t\t\tReadTimeout: 5 * time.Second,\n\t\t\tWriteTimeout: 10 * time.Second,\n\t\t\tIdleTimeout: 120 * time.Second,\n\t\t\tTLSConfig: tlsConfig,\n\t\t\tHandler: h,\n\t\t},\n\t\taddress: serverAddress,\n\t}\n}", "title": "" }, { "docid": "de4e8b417a4d89a118764d7a44daafd6", "score": "0.5802016", "text": "func NewHTTPTransport(ep *Endpoints, logger log.Logger) http.Handler {\n\topts := []kithttp.ServerOption{\n\t\tkithttp.ServerErrorLogger(log.With(logger, \"tag\", \"http\")),\n\t\tkithttp.ServerErrorEncoder(encodeHTTPError),\n\t}\n\n\tlistPlayersHandler := kithttp.NewServer(\n\t\tep.listPlayersEndpoint,\n\t\tdecodeHTTPListPlayersRequest,\n\t\tencodeHTTPListPlayersResponse,\n\t\topts...,\n\t)\n\n\tgetPlayerHandler := kithttp.NewServer(\n\t\tep.getPlayerEndpoint,\n\t\tdecodeHTTPGetPlayerRequest,\n\t\tencodeHTTPGetPlayerResponse,\n\t\topts...,\n\t)\n\n\tcreatePlayerHandler := kithttp.NewServer(\n\t\tep.savePlayerEndpoint,\n\t\tdecodeHTTPCreatePlayerRequest,\n\t\tencodeHTTPSavePlayerResponse,\n\t\topts...,\n\t)\n\n\tupdatePlayerHandler := kithttp.NewServer(\n\t\tep.savePlayerEndpoint,\n\t\tdecodeHTTPUpdatePlayerRequest,\n\t\tencodeHTTPSavePlayerResponse,\n\t\topts...,\n\t)\n\n\tdeletePlayerHandler := kithttp.NewServer(\n\t\tep.deletePlayerEndpoint,\n\t\tdecodeHTTPDeletePlayerRequest,\n\t\tencodeHTTPDeletePlayerResponse,\n\t\topts...,\n\t)\n\n\tr := mux.NewRouter()\n\tr.Handle(\"/v1/players\", listPlayersHandler).Methods(\"GET\")\n\tr.Handle(\"/v1/players/{id}\", getPlayerHandler).Methods(\"GET\")\n\tr.Handle(\"/v1/players\", createPlayerHandler).Methods(\"POST\")\n\tr.Handle(\"/v1/players/{id}\", updatePlayerHandler).Methods(\"PUT\")\n\tr.Handle(\"/v1/players/{id}\", deletePlayerHandler).Methods(\"DELETE\")\n\n\treturn accessControl(r)\n}", "title": "" }, { "docid": "d9b8186ea888d2247ada9a6ebb458e38", "score": "0.57953393", "text": "func NewHTTPComponent(base Base, httpClient *http.Client) *HTTP {\n\th := &HTTP{\n\t\tBase: base,\n\t\tHTTPClient: httpClient,\n\t}\n\th.Init()\n\treturn h\n}", "title": "" }, { "docid": "ac46b4dc6074a00cba9cd3f532265275", "score": "0.5793918", "text": "func NewHTTPTransport(log logger.Logger, svc RequestsService, p *bluemonday.Policy, mdl ...func(http.Handler) http.Handler) http.Handler {\n\th := &HTTPTransport{log: log, router: chi.NewRouter().With(mdl...), svc: svc, sanitizer: p}\n\th.attachRoutes()\n\treturn h\n}", "title": "" }, { "docid": "12a658c93298a42a27b2ddb53964ee49", "score": "0.5792232", "text": "func NewHTTPHandler(endpoints endpoint.Endpoints, options map[string][]http.ServerOption) http1.Handler {\n\tm := mux.NewRouter()\n\tmakeCreateProductHandler(m, endpoints, options[\"CreateProduct\"])\n\tmakeGetAllProductHandler(m, endpoints, options[\"GetAllProduct\"])\n\tmakeUpdateProductHandler(m, endpoints, options[\"UpdateProduct\"])\n\tmakeDeleteProductHandler(m, endpoints, options[\"DeleteProduct\"])\n\tmakeGetProductHandler(m, endpoints, options[\"GetProduct\"])\n\tmakeUpdateProductStockHandler(m, endpoints, options[\"UpdateProductStock\"])\n\treturn m\n}", "title": "" }, { "docid": "2f8a0033c34c7ea831365e21fc1532dd", "score": "0.57890403", "text": "func newHTTPRequest(ops types.HTTPOptions) (*http.Request, error) {\n\t// make new request\n\tpayloadBytes, _ := json.Marshal(ops.Body)\n\treq, err := http.NewRequest(ops.Method, ops.Endpoint, bytes.NewBuffer(payloadBytes))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\t// Add any query parameters to the URL.\n\tif len(ops.QueryParams) != 0 {\n\t\taddQueryParameters(req, ops.QueryParams)\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "6401fc9f08a92be9f49cbacc6283baf1", "score": "0.5787699", "text": "func New(logger log.Logger, reg *prometheus.Registry, comp component.Component, prober *prober.HTTPProbe, opts ...Option) *Server {\n\toptions := options{}\n\tfor _, o := range opts {\n\t\to.apply(&options)\n\t}\n\n\tmux := http.NewServeMux()\n\tif options.mux != nil {\n\t\tmux = options.mux\n\t}\n\n\tregisterMetrics(mux, reg)\n\tregisterProbes(mux, prober, logger)\n\tregisterProfiler(mux)\n\n\tvar h http.Handler\n\tif options.enableH2C {\n\t\th2s := &http2.Server{}\n\t\th = h2c.NewHandler(mux, h2s)\n\t} else {\n\t\th = mux\n\t}\n\n\treturn &Server{\n\t\tlogger: log.With(logger, \"service\", \"http/server\", \"component\", comp.String()),\n\t\tcomp: comp,\n\t\tprober: prober,\n\t\tmux: mux,\n\t\tsrv: &http.Server{Addr: options.listen, Handler: h},\n\t\topts: options,\n\t}\n}", "title": "" } ]
448b7d730f304cca2b21f9a15b11a377
SetReturnTimeout adds the returnTimeout to the network ethernet ports get params
[ { "docid": "c527ac6133a4ac9c856fef08fedca3c1", "score": "0.7931474", "text": "func (o *NetworkEthernetPortsGetParams) SetReturnTimeout(returnTimeout *int64) {\n\to.ReturnTimeout = returnTimeout\n}", "title": "" } ]
[ { "docid": "0afa906dc4f16c615239fdde30bc5bce", "score": "0.7541596", "text": "func (o *NetworkEthernetPortsGetParams) WithReturnTimeout(returnTimeout *int64) *NetworkEthernetPortsGetParams {\n\to.SetReturnTimeout(returnTimeout)\n\treturn o\n}", "title": "" }, { "docid": "0d183b173a47a241db32c7e0cdaea254", "score": "0.70151883", "text": "func (o *NetworkEthernetPortsGetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "d5db7fc3a0cca868dda66d53e5325a64", "score": "0.6982768", "text": "func (o *NvmeInterfaceCollectionGetParams) SetReturnTimeout(returnTimeout *int64) {\n\to.ReturnTimeout = returnTimeout\n}", "title": "" }, { "docid": "3694c65757ed64ea9d0241ef3024cdf0", "score": "0.6855745", "text": "func (o *SoftwareModifyParams) SetReturnTimeout(returnTimeout *int64) {\n\to.ReturnTimeout = returnTimeout\n}", "title": "" }, { "docid": "4925cb8d008cdf83d1eb90e0e372611b", "score": "0.6696622", "text": "func (o *SnapmirrorPoliciesGetParams) SetReturnTimeout(returnTimeout *int64) {\n\to.ReturnTimeout = returnTimeout\n}", "title": "" }, { "docid": "64b679e66f41ca1dc78c6281d228e37e", "score": "0.6626216", "text": "func (o *PostReturnAddressesByReturnAddressIDGetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "f98d7dbeae4dab29943c130bdfaca8bf", "score": "0.66106826", "text": "func (rc *returnChannel) SetTimeout(timeout time.Duration, sleeper ...Timewarp) {\n\tif len(sleeper) > 0 {\n\t\trc.sleeper = sleeper[0]\n\t}\n\trc.timeout = timeout\n}", "title": "" }, { "docid": "a8f33d64fc18bddd4d83cf027f8a0983", "score": "0.6564998", "text": "func (o *PlexCollectionGetParams) SetReturnTimeout(returnTimeout *int64) {\n\to.ReturnTimeout = returnTimeout\n}", "title": "" }, { "docid": "310d324badad363805b39bd18a71409f", "score": "0.6502383", "text": "func (o *SnapmirrorRelationshipsGetParams) SetReturnTimeout(returnTimeout *int64) {\n\to.ReturnTimeout = returnTimeout\n}", "title": "" }, { "docid": "a8d2b6db95fe5fd8c8aa63680b96b677", "score": "0.6494597", "text": "func (o *AuditCollectionGetParams) SetReturnTimeout(returnTimeout *int64) {\n\to.ReturnTimeout = returnTimeout\n}", "title": "" }, { "docid": "0aeb6686b0761b6945ce6d4d49194e6f", "score": "0.6473597", "text": "func (o *GetPlatformNetworksParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "0c0a1eef2b3d19e527e66c8fc83c351f", "score": "0.6467286", "text": "func (o *DevicesGetModulePropertiesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "87cd60cfec1ab01c87f8aed9f464e179", "score": "0.6451107", "text": "func (o *SoftwareModifyParams) WithReturnTimeout(returnTimeout *int64) *SoftwareModifyParams {\n\to.SetReturnTimeout(returnTimeout)\n\treturn o\n}", "title": "" }, { "docid": "62c6a3e4de56ef195cd15b420056987c", "score": "0.6435557", "text": "func (o *GetDataCenterUsingGETParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "a8637769345d942056d328b9c9119086", "score": "0.63684714", "text": "func (o *EmsConfigGetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "c0dc06ac9b8ca7433c028528d2c7c696", "score": "0.6368158", "text": "func (o *PerformanceS3MetricCollectionGetParams) SetReturnTimeout(returnTimeout *int64) {\n\to.ReturnTimeout = returnTimeout\n}", "title": "" }, { "docid": "266f81fc83c9640a128e397bd079f2f0", "score": "0.6364776", "text": "func (o *GetLibcParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "98195680af20a5fc65175074f752d765", "score": "0.6360926", "text": "func (o *GroupPolicyObjectCentralAccessRuleCollectionGetParams) SetReturnTimeout(returnTimeout *int64) {\n\to.ReturnTimeout = returnTimeout\n}", "title": "" }, { "docid": "5f2edc891e05a0a1cb376e30e2141a22", "score": "0.6345595", "text": "func (o *IscsiSessionGetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "5a96bb69047e11cab3f83320ab8aff3e", "score": "0.6330866", "text": "func (o *FcLoginCollectionGetParams) SetReturnTimeout(returnTimeout *int64) {\n\to.ReturnTimeout = returnTimeout\n}", "title": "" }, { "docid": "fdd057644530cd368ebf1483043c55fe", "score": "0.6326761", "text": "func (o *GcpKmsCollectionGetParams) SetReturnTimeout(returnTimeout *int64) {\n\to.ReturnTimeout = returnTimeout\n}", "title": "" }, { "docid": "8e35438db4bcbe94c17d30572fd132c5", "score": "0.6323156", "text": "func (o *GetPaymentInfosUsingGETParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "c60801c11ec31bd91ecd664412046ff8", "score": "0.63088846", "text": "func (o *GetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "4722755d28cd9e28a5ab82e6080837be", "score": "0.6308442", "text": "func (o *ConsistencyGroupCollectionGetParams) SetReturnTimeout(returnTimeout *int64) {\n\to.ReturnTimeout = returnTimeout\n}", "title": "" }, { "docid": "56a34daafde4bd68b0be1c336ed43b1c", "score": "0.63072056", "text": "func (o *GetLTENetworkIDEnodebsENODEBSerialParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "8dd2d4d7eae51ee951a3fc590ddf0e91", "score": "0.6293418", "text": "func (o *CifsShareCollectionGetParams) SetReturnTimeout(returnTimeout *int64) {\n\to.ReturnTimeout = returnTimeout\n}", "title": "" }, { "docid": "c5535e701ddece5a97e622a652d5c69b", "score": "0.62689334", "text": "func (o *GetPublicGetlasttradesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "7944403ba43ee135a3cf295921429e0e", "score": "0.62657976", "text": "func (o *ConsistencyGroupSnapshotGetParams) SetReturnTimeout(returnTimeout *int64) {\n\to.ReturnTimeout = returnTimeout\n}", "title": "" }, { "docid": "22afe6879c2bd9aedf08bb473c4b7236", "score": "0.6265164", "text": "func (o *GetCashierParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "74e555f16c3ed71ccc278ce5f4b7ba5b", "score": "0.62500536", "text": "func (o *LookupsGetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "48ac9e6987967e5410116fe3e09728ff", "score": "0.62290406", "text": "func (o *GetConfigStatusParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "b3a48f90cb582c992a8889c7e58b7d4b", "score": "0.6213711", "text": "func (o *FileMoveCollectionGetParams) SetReturnTimeout(returnTimeout *int64) {\n\to.ReturnTimeout = returnTimeout\n}", "title": "" }, { "docid": "f5b52add608cfb74f4329d9fac5d48f6", "score": "0.61946636", "text": "func (o *GetNetworkDeviceLldpCdpParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "3840cb7e168208c1820f359212918c90", "score": "0.6189752", "text": "func (o *DevicesGetModuleTelemetryValueParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "f033730aa715760020d3e74e340910c8", "score": "0.617486", "text": "func (o *GetCommandTemplateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "72d0056eb601cba92f38a4d0fbb0d96e", "score": "0.6174405", "text": "func (o *GetNetworkSecurityIntrusionSettingsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "ec6896ca51203d2fa72f50dd4ffab949", "score": "0.6161122", "text": "func (o *GetVMEntityFilterResultsConnectionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "84698e10d5035b11529a6b2f7a4b85bf", "score": "0.61527604", "text": "func (o *CustomerCustomerMetadataV1GetAttributeMetadataGetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "cb3aeff290adb02a7fed5c84f14af835", "score": "0.61517346", "text": "func (o *GetaspecificContractParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "f89884c871a07dbea69f15d32890e3c7", "score": "0.61412024", "text": "func (o *GetLightParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "4d5cda9321fbaeb52194fcb11ebd2d3a", "score": "0.6141034", "text": "func (o *GetNetworksNetworkIDDescriptionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "3ae041d0bcb2a6037082ed2af6b7cd1d", "score": "0.6134361", "text": "func (o *RepoGetGitHookParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "586d1ae7ae22b782ab4a2bf951d5b4a8", "score": "0.61337954", "text": "func (o *GetTransactionDetailsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "c35b4c9cae3f452be043284e0f3d65af", "score": "0.6131213", "text": "func (o *PostLettersExportGetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "896f44238889fbe2da582b36811676d5", "score": "0.6130109", "text": "func (o *GetPluginBinaryParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "0db624c15d6be2fa97f35c84b31a2f2c", "score": "0.6097256", "text": "func (o *RechargePackagesGetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "57afeb1ca46721f0ca6a843f4d5bd826", "score": "0.60831666", "text": "func (o *ExtendedGetKlsIDUsingGETParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "17ab784f7c5b8e11878a9083e3f8885a", "score": "0.60671943", "text": "func (o *GetBacsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "ab86cb8afd30071db29b20a75a12a8f4", "score": "0.6051158", "text": "func (o *IsVidmRegisteredUsingGETParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "91e65b35437ee32e47bf6ea889a8ee6d", "score": "0.6045955", "text": "func (o *GetStackByCrnInWorkspaceV4Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "b02bccf4407362d51c00aeb400aa5f23", "score": "0.6043352", "text": "func (o *GetNodesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "06c30d3c7582b051d7deb0d099259e97", "score": "0.6041018", "text": "func (o *UpdateNetworkAppliancePortParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "0414259fc9c686dd4d3789f96d20bd5f", "score": "0.60287285", "text": "func (o *NetInfoParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "c6dc22fd8c233fe3559b9ea88b0ad0de", "score": "0.6025258", "text": "func (o *GetNetscanByIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "3b285ccec99af2a616d2f3a2c10a4355", "score": "0.6016737", "text": "func (o *GetConnectionsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "9ba761782f0a6e3cfce072b5a97fd89a", "score": "0.6015811", "text": "func (o *ColumnFamilyMetricsRowCacheHitGetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "97ff80d426e14bfa608dba449280f0c4", "score": "0.60157216", "text": "func (o *InternalV1PowervsInstancesGetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "a0ad40d2082ca11839a9ab964407324f", "score": "0.6015692", "text": "func (o *GetEndpointPropertiesUsingGETParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "75c7d6c7f0d02b2e9538cd43c826fb06", "score": "0.60113496", "text": "func (o *GetPublicGetCurrenciesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "08d3deba6fea228a148ca374a6f8ad1b", "score": "0.6008507", "text": "func (o *GetaspecificPbxDeviceModelParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "a098e18604ba16f4f15dfb289c92b870", "score": "0.59968513", "text": "func (o *CustomerAddressMetadataV1GetCustomAttributesMetadataGetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "c5bd3a6130bcb9f685c25ff63c5f4b7b", "score": "0.59883416", "text": "func (o *GetRuleParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "830881b70d81f2ab2f6b17ddf5e80b55", "score": "0.5982078", "text": "func (o *ReadReportingRevisionsGetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "45eeb39bea75f77024e5262e78880b7d", "score": "0.5981577", "text": "func (o *UpgradeStackByCrnParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "059896323c592ea09773834d71c97044", "score": "0.59736013", "text": "func (o *GetLicenseCustomerOpsMoidParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "81749b38ff2d6f38a07b428628eb5dab", "score": "0.5967797", "text": "func (o *NetworkEthernetPortsGetParams) WithTimeout(timeout time.Duration) *NetworkEthernetPortsGetParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "title": "" }, { "docid": "2efc819d0e2056af99a52ba6c1c8a537", "score": "0.595594", "text": "func (o *GetIntelReportEntitiesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "513c7127dd51c408eb064c9864507a71", "score": "0.59489566", "text": "func (o *GetNdmpUserParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "1394f21c2fca528f3f81af307820aec9", "score": "0.59441066", "text": "func (o *GetAllowedRegistryParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "40276de2b69a87d9958e78f122514769", "score": "0.5942454", "text": "func (o *GetActiveRegisteredOraclesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "702c62df61493d7f4c6e006cba5a8663", "score": "0.59347695", "text": "func (o *GetWasmContractsContractAddressStoreParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "0cacbf1a2097bf27078127dc94fd4ada", "score": "0.59343386", "text": "func (o *ServiceInstanceLastOperationGetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "5116d36840cfc957cb135747e6d29605", "score": "0.5914506", "text": "func (o *GetOrganizationMemberParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "dc425b26d330902f4e20f6062cb36719", "score": "0.5910603", "text": "func (o *GetNumbersearchParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "e79158424462fd5324884b3e373e465a", "score": "0.5906348", "text": "func (o *CreateLogicalRouterParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "c80e8b90e98c1c26515b76b1e6258f6d", "score": "0.5904072", "text": "func (o *GetIPLoadbalancingServiceNameVrackNetworkParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "c4c63dc485707cc38259dd13c89f61ee", "score": "0.5898685", "text": "func (o *GetPbxDeviceConfigitemsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "92f8df6382502ae2b302da5a5931ac8a", "score": "0.5897336", "text": "func (o *GetTransactionsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "da41d112c0626be7cca5092374f9ee58", "score": "0.589452", "text": "func (o *SystemsGET2Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "08aba3c0a6cb3548b22c6d8400b7ce8c", "score": "0.589238", "text": "func (o *GetPublicGetLastTradesByCurrencyParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "6e8acbb56a459389322425ac0a69bb93", "score": "0.5891875", "text": "func (o *GetTestTokenParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "8bbb0dd74e04ee21d99b3a82006fe34a", "score": "0.5885118", "text": "func (o *GetDevicesIDNetflowParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "0b092438a45d079c179970eda8d5e978", "score": "0.5881779", "text": "func (o *GetNmsChangedParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "0a068311d93fa3c5d8c05fe31ff5705c", "score": "0.5881004", "text": "func (o *NetworkListParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "ac652c38aa822131237b11381be4ceea", "score": "0.5880052", "text": "func (o *CustomerAddressRepositoryV1GetByIDGetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "8ea1cf2fb893c61700f6d61c3f01575a", "score": "0.5877641", "text": "func (o *GetPromotionsUsingGET1Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "b734d4bb5e14d01741124653629f54b7", "score": "0.5876001", "text": "func (o *GetDeploymentEventsUsingGETParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "f5d2a1cc17e974ce2eedfedec4807661", "score": "0.58755434", "text": "func (o *GetNetworkUplinkSettingsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "25272f45579a7d466a0252ab403978f0", "score": "0.5872565", "text": "func (o *GetChangesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "3695e9526ca767d6d7dc96fd3b13b159", "score": "0.5871941", "text": "func (o *OccupancyGetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "69a6ce893a49854f5ea661046beac4f1", "score": "0.5868406", "text": "func (o *GetUnitsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "a372173f335a6b15bd3119e6b41055b6", "score": "0.5867191", "text": "func (o *GetRenterDirSiapathParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "a1ad05d81fd6d5fae1a4a09f8e626e3d", "score": "0.5852097", "text": "func (o *ListRemotePeeringConnectionsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "720c062b9ee8823f8c21b72625302344", "score": "0.58464533", "text": "func (o *NvmeInterfaceCollectionGetParams) WithReturnTimeout(returnTimeout *int64) *NvmeInterfaceCollectionGetParams {\n\to.SetReturnTimeout(returnTimeout)\n\treturn o\n}", "title": "" }, { "docid": "fe96dffb6d7eb4b9068c10fb8a082917", "score": "0.58463895", "text": "func (o *GetRenterDownloadSiapathParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "fb99cbed05fc551891f18d020cc219f4", "score": "0.5844022", "text": "func (o *DevicesGetCloudPropertiesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "b80830a6674c9940c50f6865f8b249ff", "score": "0.5842682", "text": "func (o *GetV1EntitlementsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "761a91773ecbea935eac14a775b85eb7", "score": "0.58404744", "text": "func (o *GetAllRowsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "05036acb5117d70fee25a5f4a597ff91", "score": "0.5837378", "text": "func (o *SnapmirrorPoliciesGetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "e7e670646f78f51d1a0db7b68d05a122", "score": "0.5836658", "text": "func (o *GetIntelActorEntitiesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" } ]
2d333a95f1f560a062fb1f7e7cd59810
Equals returns true if all the fields of this ThriftTest_TestOneway_Args match the provided ThriftTest_TestOneway_Args. This function performs a deep comparison.
[ { "docid": "1b8684183634e3dcdafb9030adc93a27", "score": "0.7694265", "text": "func (v *ThriftTest_TestOneway_Args) Equals(rhs *ThriftTest_TestOneway_Args) bool {\n\tif v == nil {\n\t\treturn rhs == nil\n\t} else if rhs == nil {\n\t\treturn false\n\t}\n\tif !_I32_EqualsPtr(v.SecondsToSleep, rhs.SecondsToSleep) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" } ]
[ { "docid": "1c5d4136e9194e8fdca75256c8e305a2", "score": "0.7408637", "text": "func (v *ThriftTest_TestStruct_Args) Equals(rhs *ThriftTest_TestStruct_Args) bool {\n\tif v == nil {\n\t\treturn rhs == nil\n\t} else if rhs == nil {\n\t\treturn false\n\t}\n\tif !((v.Thing == nil && rhs.Thing == nil) || (v.Thing != nil && rhs.Thing != nil && v.Thing.Equals(rhs.Thing))) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "ec4909219cda4a3c1b72d642bfd3dede", "score": "0.7119202", "text": "func (v *ThriftTest_TestNest_Args) Equals(rhs *ThriftTest_TestNest_Args) bool {\n\tif v == nil {\n\t\treturn rhs == nil\n\t} else if rhs == nil {\n\t\treturn false\n\t}\n\tif !((v.Thing == nil && rhs.Thing == nil) || (v.Thing != nil && rhs.Thing != nil && v.Thing.Equals(rhs.Thing))) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "f49d6f01ee686595f01109b5b433295a", "score": "0.7098817", "text": "func (v *ThriftTest_TestMulti_Args) Equals(rhs *ThriftTest_TestMulti_Args) bool {\n\tif v == nil {\n\t\treturn rhs == nil\n\t} else if rhs == nil {\n\t\treturn false\n\t}\n\tif !_Byte_EqualsPtr(v.Arg0, rhs.Arg0) {\n\t\treturn false\n\t}\n\tif !_I32_EqualsPtr(v.Arg1, rhs.Arg1) {\n\t\treturn false\n\t}\n\tif !_I64_EqualsPtr(v.Arg2, rhs.Arg2) {\n\t\treturn false\n\t}\n\tif !((v.Arg3 == nil && rhs.Arg3 == nil) || (v.Arg3 != nil && rhs.Arg3 != nil && _Map_I16_String_Equals(v.Arg3, rhs.Arg3))) {\n\t\treturn false\n\t}\n\tif !_Numberz_EqualsPtr(v.Arg4, rhs.Arg4) {\n\t\treturn false\n\t}\n\tif !_UserId_EqualsPtr(v.Arg5, rhs.Arg5) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "719dfd7c43d4f485f4c9ef9803e0d185", "score": "0.7016558", "text": "func (v *ThriftTest_TestBinary_Args) Equals(rhs *ThriftTest_TestBinary_Args) bool {\n\tif v == nil {\n\t\treturn rhs == nil\n\t} else if rhs == nil {\n\t\treturn false\n\t}\n\tif !((v.Thing == nil && rhs.Thing == nil) || (v.Thing != nil && rhs.Thing != nil && bytes.Equal(v.Thing, rhs.Thing))) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "b1e15a3b286197e6785c7af1d968912f", "score": "0.69084406", "text": "func (v *ThriftTest_TestEnum_Args) Equals(rhs *ThriftTest_TestEnum_Args) bool {\n\tif v == nil {\n\t\treturn rhs == nil\n\t} else if rhs == nil {\n\t\treturn false\n\t}\n\tif !_Numberz_EqualsPtr(v.Thing, rhs.Thing) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "466985735a212c6f90f680c272dae488", "score": "0.660921", "text": "func (v *ThriftTest_TestByte_Args) Equals(rhs *ThriftTest_TestByte_Args) bool {\n\tif v == nil {\n\t\treturn rhs == nil\n\t} else if rhs == nil {\n\t\treturn false\n\t}\n\tif !_Byte_EqualsPtr(v.Thing, rhs.Thing) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "e934537682e3d3af9f573b82c04b7fa8", "score": "0.6563196", "text": "func (v *ThriftTest_TestMultiException_Args) Equals(rhs *ThriftTest_TestMultiException_Args) bool {\n\tif v == nil {\n\t\treturn rhs == nil\n\t} else if rhs == nil {\n\t\treturn false\n\t}\n\tif !_String_EqualsPtr(v.Arg0, rhs.Arg0) {\n\t\treturn false\n\t}\n\tif !_String_EqualsPtr(v.Arg1, rhs.Arg1) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "c97ae1d5133189c7c802f4e5e3ab8184", "score": "0.651521", "text": "func (v *ThriftTest_TestList_Args) Equals(rhs *ThriftTest_TestList_Args) bool {\n\tif v == nil {\n\t\treturn rhs == nil\n\t} else if rhs == nil {\n\t\treturn false\n\t}\n\tif !((v.Thing == nil && rhs.Thing == nil) || (v.Thing != nil && rhs.Thing != nil && _List_I32_Equals(v.Thing, rhs.Thing))) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "c6d790bd8571f6dc5ae90575e8d2463b", "score": "0.6463707", "text": "func (v *ThriftTest_TestI64_Args) Equals(rhs *ThriftTest_TestI64_Args) bool {\n\tif v == nil {\n\t\treturn rhs == nil\n\t} else if rhs == nil {\n\t\treturn false\n\t}\n\tif !_I64_EqualsPtr(v.Thing, rhs.Thing) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "0071ebdf123b523cfd2be4eff1c16364", "score": "0.6419836", "text": "func (v *SimpleService_TestUuid_Args) Equals(rhs *SimpleService_TestUuid_Args) bool {\n\tif v == nil {\n\t\treturn rhs == nil\n\t} else if rhs == nil {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "d4c21cc6136e168f5d29b7141b39fbbf", "score": "0.6407423", "text": "func (v *ThriftTest_TestSet_Args) Equals(rhs *ThriftTest_TestSet_Args) bool {\n\tif v == nil {\n\t\treturn rhs == nil\n\t} else if rhs == nil {\n\t\treturn false\n\t}\n\tif !((v.Thing == nil && rhs.Thing == nil) || (v.Thing != nil && rhs.Thing != nil && _Set_I32_mapType_Equals(v.Thing, rhs.Thing))) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "e17fe67f836ded8f289c151b46fb6f02", "score": "0.63981026", "text": "func (v *ThriftTest_TestException_Args) Equals(rhs *ThriftTest_TestException_Args) bool {\n\tif v == nil {\n\t\treturn rhs == nil\n\t} else if rhs == nil {\n\t\treturn false\n\t}\n\tif !_String_EqualsPtr(v.Arg, rhs.Arg) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "11e43318fd5b3ead7d3247af724db704", "score": "0.6393221", "text": "func (v *ThriftTest_TestDouble_Args) Equals(rhs *ThriftTest_TestDouble_Args) bool {\n\tif v == nil {\n\t\treturn rhs == nil\n\t} else if rhs == nil {\n\t\treturn false\n\t}\n\tif !_Double_EqualsPtr(v.Thing, rhs.Thing) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "a500b316ff25147ab623029c7ecc3edf", "score": "0.633071", "text": "func (v *ThriftTest_TestMap_Args) Equals(rhs *ThriftTest_TestMap_Args) bool {\n\tif v == nil {\n\t\treturn rhs == nil\n\t} else if rhs == nil {\n\t\treturn false\n\t}\n\tif !((v.Thing == nil && rhs.Thing == nil) || (v.Thing != nil && rhs.Thing != nil && _Map_I32_I32_Equals(v.Thing, rhs.Thing))) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "889cef277fd49bf00c3df47a12d24167", "score": "0.6330033", "text": "func (v *ThriftTest_TestTypedef_Args) Equals(rhs *ThriftTest_TestTypedef_Args) bool {\n\tif v == nil {\n\t\treturn rhs == nil\n\t} else if rhs == nil {\n\t\treturn false\n\t}\n\tif !_UserId_EqualsPtr(v.Thing, rhs.Thing) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "2396ed260a771144c305cc61e3bc116a", "score": "0.6214971", "text": "func (v *SimpleService_UrlTest_Args) Equals(rhs *SimpleService_UrlTest_Args) bool {\n\tif v == nil {\n\t\treturn rhs == nil\n\t} else if rhs == nil {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "e812d48cf551083a827f09fd923fa1bf", "score": "0.61934006", "text": "func (v *ThriftTest_TestInsanity_Args) Equals(rhs *ThriftTest_TestInsanity_Args) bool {\n\tif v == nil {\n\t\treturn rhs == nil\n\t} else if rhs == nil {\n\t\treturn false\n\t}\n\tif !((v.Argument == nil && rhs.Argument == nil) || (v.Argument != nil && rhs.Argument != nil && v.Argument.Equals(rhs.Argument))) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "ad50da997c21f5107113d61da2ce8302", "score": "0.6131172", "text": "func (v *ThriftTest_TestMapMap_Args) Equals(rhs *ThriftTest_TestMapMap_Args) bool {\n\tif v == nil {\n\t\treturn rhs == nil\n\t} else if rhs == nil {\n\t\treturn false\n\t}\n\tif !_I32_EqualsPtr(v.Hello, rhs.Hello) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "4e08187f15bc45a4d42b933bfab34dd2", "score": "0.60887563", "text": "func (v *SecondService_BlahBlah_Args) Equals(rhs *SecondService_BlahBlah_Args) bool {\n\tif v == nil {\n\t\treturn rhs == nil\n\t} else if rhs == nil {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "4f89215a371575374c49701b35252dd1", "score": "0.6048798", "text": "func (v *ThriftTest_TestVoid_Args) Equals(rhs *ThriftTest_TestVoid_Args) bool {\n\tif v == nil {\n\t\treturn rhs == nil\n\t} else if rhs == nil {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "80a726c15cac9fc34342914ddb9ef062", "score": "0.6037989", "text": "func (v *ThriftTest_TestString_Args) Equals(rhs *ThriftTest_TestString_Args) bool {\n\tif v == nil {\n\t\treturn rhs == nil\n\t} else if rhs == nil {\n\t\treturn false\n\t}\n\tif !_String_EqualsPtr(v.Thing, rhs.Thing) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "11e920630bb0934af8c7fe4ef9da3cd8", "score": "0.59870684", "text": "func (v *ThriftTest_TestI32_Args) Equals(rhs *ThriftTest_TestI32_Args) bool {\n\tif v == nil {\n\t\treturn rhs == nil\n\t} else if rhs == nil {\n\t\treturn false\n\t}\n\tif !_I32_EqualsPtr(v.Thing, rhs.Thing) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "baacef58b7d396a7838e98c9dfa34c2e", "score": "0.59299225", "text": "func (a Args) Equals(b Args) bool {\n\tif len(a) != len(b) {\n\t\treturn false\n\t}\n\tfor i := range a {\n\t\tif !a[i].Equals(b[i]) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "a0e83feb9104db89a1aae219dbd54eb6", "score": "0.58731335", "text": "func (v *ThriftTest_TestStringMap_Args) Equals(rhs *ThriftTest_TestStringMap_Args) bool {\n\tif v == nil {\n\t\treturn rhs == nil\n\t} else if rhs == nil {\n\t\treturn false\n\t}\n\tif !((v.Thing == nil && rhs.Thing == nil) || (v.Thing != nil && rhs.Thing != nil && _Map_String_String_Equals(v.Thing, rhs.Thing))) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "1daf437ce8d98ef7377b0efa81596392", "score": "0.5818769", "text": "func (q *quickSuite) testEquals(t *testing.T, giveVal thriftType) {\n\tgive := reflect.ValueOf(giveVal)\n\trhs := give\n\n\tequals := give.MethodByName(\"Equals\")\n\trequire.True(t, equals.IsValid(), \"Type does not implement Equals()\")\n\n\tif equals.Type().In(0) != rhs.Type() {\n\t\t// We were passing the objects around by pointer but\n\t\t// we need the value-form here.\n\t\trhs = rhs.Elem()\n\t}\n\n\tassert.True(t,\n\t\tequals.Call([]reflect.Value{rhs})[0].Bool(),\n\t\t\"%v should be equal to itself\", giveVal)\n}", "title": "" }, { "docid": "a0512e00964135cb5e68dead46b15590", "score": "0.58185434", "text": "func (v *HistoryService_ReplicateRawEvents_Args) Equals(rhs *HistoryService_ReplicateRawEvents_Args) bool {\n\tif v == nil {\n\t\treturn rhs == nil\n\t} else if rhs == nil {\n\t\treturn false\n\t}\n\tif !((v.ReplicateRequest == nil && rhs.ReplicateRequest == nil) || (v.ReplicateRequest != nil && rhs.ReplicateRequest != nil && v.ReplicateRequest.Equals(rhs.ReplicateRequest))) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "6a3885d08f32e42f24648cd429ed71c8", "score": "0.5760596", "text": "func Eq(vals ...interface{}) bool {\n\tif len(vals) <= 1 {\n\t\treturn true\n\t}\n\n\tlval := vals[0]\n\n\tfor i := 1; i < len(vals); i++ {\n\t\tif !reflect.DeepEqual(lval, vals[i]) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "c213bea7a1f6063333bbbe7a670daf6a", "score": "0.56573087", "text": "func Eq(t TestingT, want, give any, fmtAndArgs ...any) bool {\n\tt.Helper()\n\n\tif err := checkEqualArgs(want, give); err != nil {\n\t\treturn fail(t,\n\t\t\tfmt.Sprintf(\"Cannot compare: %#v == %#v (%s)\", want, give, err),\n\t\t\tfmtAndArgs,\n\t\t)\n\t}\n\n\tif !reflects.IsEqual(want, give) {\n\t\t// TODO diff := diff(want, give)\n\t\twant, give = formatUnequalValues(want, give)\n\t\treturn fail(t, fmt.Sprintf(\"Not equal: \\n\"+\n\t\t\t\"expect: %s\\n\"+\n\t\t\t\"actual: %s\", want, give), fmtAndArgs)\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "70cfaa94b69ff2181764dba9f24b028a", "score": "0.55760074", "text": "func allFieldsWhithoutEnabledEquals(entry1, entry2 *l3.VRRPEntry) bool {\n\tif entry1.Interface != entry2.Interface ||\n\t\t!intervalEquals(entry1.Interval, entry2.Interval) ||\n\t\tentry1.Priority != entry2.Priority ||\n\t\tentry1.VrId != entry2.VrId ||\n\t\tentry1.Accept != entry2.Accept ||\n\t\tentry1.Preempt != entry2.Preempt ||\n\t\tentry1.Unicast != entry2.Unicast ||\n\t\tlen(entry1.IpAddresses) != len(entry2.IpAddresses) {\n\t\treturn false\n\t}\n\n\tfor i := 0; i < len(entry1.IpAddresses); i++ {\n\t\tif entry1.IpAddresses[i] != entry2.IpAddresses[i] {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "bb12954be6915e6375748c3aedd4790f", "score": "0.5573117", "text": "func sameFields(a []engine.Point, b []engine.Point) bool {\n\t//\tif len(a) != len(b) {\n\t//\t\treturn false\n\t//\t}\n\tfor y := 0; y < len(a); y++ {\n\t\tif a[y].X != b[y].X || a[y].Y != b[y].Y {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "297427d59b6184b2c25ad4b8b73e77dc", "score": "0.5549607", "text": "func (v *VersioningTestV2) Equals(rhs *VersioningTestV2) bool {\n\tif v == nil {\n\t\treturn rhs == nil\n\t} else if rhs == nil {\n\t\treturn false\n\t}\n\tif !_I32_EqualsPtr(v.BeginInBoth, rhs.BeginInBoth) {\n\t\treturn false\n\t}\n\tif !_I32_EqualsPtr(v.Newint, rhs.Newint) {\n\t\treturn false\n\t}\n\tif !_Byte_EqualsPtr(v.Newbyte, rhs.Newbyte) {\n\t\treturn false\n\t}\n\tif !_I16_EqualsPtr(v.Newshort, rhs.Newshort) {\n\t\treturn false\n\t}\n\tif !_I64_EqualsPtr(v.Newlong, rhs.Newlong) {\n\t\treturn false\n\t}\n\tif !_Double_EqualsPtr(v.Newdouble, rhs.Newdouble) {\n\t\treturn false\n\t}\n\tif !((v.Newstruct == nil && rhs.Newstruct == nil) || (v.Newstruct != nil && rhs.Newstruct != nil && v.Newstruct.Equals(rhs.Newstruct))) {\n\t\treturn false\n\t}\n\tif !((v.Newlist == nil && rhs.Newlist == nil) || (v.Newlist != nil && rhs.Newlist != nil && _List_I32_Equals(v.Newlist, rhs.Newlist))) {\n\t\treturn false\n\t}\n\tif !((v.Newset == nil && rhs.Newset == nil) || (v.Newset != nil && rhs.Newset != nil && _Set_I32_mapType_Equals(v.Newset, rhs.Newset))) {\n\t\treturn false\n\t}\n\tif !((v.Newmap == nil && rhs.Newmap == nil) || (v.Newmap != nil && rhs.Newmap != nil && _Map_I32_I32_Equals(v.Newmap, rhs.Newmap))) {\n\t\treturn false\n\t}\n\tif !_String_EqualsPtr(v.Newstring, rhs.Newstring) {\n\t\treturn false\n\t}\n\tif !_I32_EqualsPtr(v.EndInBoth, rhs.EndInBoth) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "d68b865fd85403bbce4b7f1da155cc6f", "score": "0.55281496", "text": "func equals(sliceA []interface{}, sliceB []interface{}) bool {\n\tif len(sliceA) != len(sliceB) {\n\t\treturn false\n\t}\n\n\tfor i := 0; i < len(sliceA); i++ {\n\t\tif sliceA[i] != sliceB[i] {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "3292745916f5f86f6a2538e1dbc87ba4", "score": "0.5404378", "text": "func (a Type) Equals(b Type) bool {\n\tif a.Name != b.Name || len(a.Fields) != len(b.Fields) {\n\t\treturn false\n\t}\n\tfor _, v := range a.Fields {\n\t\tfound := false\n\t\tfor _, w := range b.Fields {\n\t\t\tif v.Equals(w) {\n\t\t\t\tfound = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !found {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "4f108e8c8846581e2de55ee6b28f2991", "score": "0.5368638", "text": "func (lom *LOM) Equal(rem cos.OAH) (equal bool) { return lom.ObjAttrs().Equal(rem) }", "title": "" }, { "docid": "eb5adc2c046d43d4ded24216846087a6", "score": "0.5366324", "text": "func (vt Tester) Equal(others ...any) Tester {\n\tvt.t.Helper()\n\tfor _, other := range others {\n\t\teq := Equal(vt.v, other)\n\t\tif !eq {\n\t\t\tvt.t.Errorf(\"Equal(v, %v) = false, want true\", other)\n\t\t}\n\t}\n\treturn vt\n}", "title": "" }, { "docid": "2dcfb466b79bdf6d6a9fde0f3e7d2c74", "score": "0.5357742", "text": "func (a Asserter) DeepEqual(expected, actual interface{}) {\r\n\tif reflect.DeepEqual(actual, expected) {\r\n\t\teVerb := fmtVerbForArg(expected)\r\n\t\taVerb := fmtVerbForArg(actual)\r\n\t\ta.fail(\"expected %s to be \"+eVerb+\" but was \"+aVerb, a.fullVar(), expected, actual)\r\n\t}\r\n}", "title": "" }, { "docid": "9e83ef0e0cd9cd15f3482a1e5cc5e7cd", "score": "0.53513867", "text": "func (v *VersioningTestV1) Equals(rhs *VersioningTestV1) bool {\n\tif v == nil {\n\t\treturn rhs == nil\n\t} else if rhs == nil {\n\t\treturn false\n\t}\n\tif !_I32_EqualsPtr(v.BeginInBoth, rhs.BeginInBoth) {\n\t\treturn false\n\t}\n\tif !_String_EqualsPtr(v.OldString, rhs.OldString) {\n\t\treturn false\n\t}\n\tif !_I32_EqualsPtr(v.EndInBoth, rhs.EndInBoth) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "f0f3efac0f13d7e23eb07efcc4c7b50e", "score": "0.5333595", "text": "func eq(arg1 reflect.Value, arg2 ...reflect.Value) (bool, error) {\n\tv1 := indirectInterface(arg1)\n\tif v1 != zero {\n\t\tif t1 := v1.Type(); !t1.Comparable() {\n\t\t\treturn false, fmt.Errorf(\"uncomparable type %s: %v\", t1, v1)\n\t\t}\n\t}\n\tif len(arg2) == 0 {\n\t\treturn false, errNoComparison\n\t}\n\tk1, _ := basicKind(v1)\n\tfor _, arg := range arg2 {\n\t\tv2 := indirectInterface(arg)\n\t\tk2, _ := basicKind(v2)\n\t\ttruth := false\n\t\tif k1 != k2 {\n\t\t\t// Special case: Can compare integer values regardless of type's sign.\n\t\t\tswitch {\n\t\t\tcase k1 == intKind && k2 == uintKind:\n\t\t\t\ttruth = v1.Int() >= 0 && uint64(v1.Int()) == v2.Uint()\n\t\t\tcase k1 == uintKind && k2 == intKind:\n\t\t\t\ttruth = v2.Int() >= 0 && v1.Uint() == uint64(v2.Int())\n\t\t\tdefault:\n\t\t\t\treturn false, errBadComparison\n\t\t\t}\n\t\t} else {\n\t\t\tswitch k1 {\n\t\t\tcase boolKind:\n\t\t\t\ttruth = v1.Bool() == v2.Bool()\n\t\t\tcase complexKind:\n\t\t\t\ttruth = v1.Complex() == v2.Complex()\n\t\t\tcase floatKind:\n\t\t\t\ttruth = v1.Float() == v2.Float()\n\t\t\tcase intKind:\n\t\t\t\ttruth = v1.Int() == v2.Int()\n\t\t\tcase stringKind:\n\t\t\t\ttruth = v1.String() == v2.String()\n\t\t\tcase uintKind:\n\t\t\t\ttruth = v1.Uint() == v2.Uint()\n\t\t\tdefault:\n\t\t\t\tif v2 == zero {\n\t\t\t\t\ttruth = v1 == v2\n\t\t\t\t} else {\n\t\t\t\t\tif t2 := v2.Type(); !t2.Comparable() {\n\t\t\t\t\t\treturn false, fmt.Errorf(\"uncomparable type %s: %v\", t2, v2)\n\t\t\t\t\t}\n\t\t\t\t\ttruth = v1.Interface() == v2.Interface()\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif truth {\n\t\t\treturn true, nil\n\t\t}\n\t}\n\treturn false, nil\n}", "title": "" }, { "docid": "0f08abd40d0ec1e93fefaefb50f62e92", "score": "0.5319048", "text": "func (v *SecondService_SecondtestString_Args) Equals(rhs *SecondService_SecondtestString_Args) bool {\n\tif v == nil {\n\t\treturn rhs == nil\n\t} else if rhs == nil {\n\t\treturn false\n\t}\n\tif !_String_EqualsPtr(v.Thing, rhs.Thing) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "21974f1fb10a27f27333fb5b0e992094", "score": "0.52970505", "text": "func DeepEqual(params ...interface{}) (bool, string) {\n\treturn DeepEquals.Check(params, defaultParams)\n}", "title": "" }, { "docid": "2afbacd4d9a6bd969eb2a16beeeb0d90", "score": "0.5260944", "text": "func (v *LargeDeltas) Equals(rhs *LargeDeltas) bool {\n\tif v == nil {\n\t\treturn rhs == nil\n\t} else if rhs == nil {\n\t\treturn false\n\t}\n\tif !((v.B1 == nil && rhs.B1 == nil) || (v.B1 != nil && rhs.B1 != nil && v.B1.Equals(rhs.B1))) {\n\t\treturn false\n\t}\n\tif !((v.B10 == nil && rhs.B10 == nil) || (v.B10 != nil && rhs.B10 != nil && v.B10.Equals(rhs.B10))) {\n\t\treturn false\n\t}\n\tif !((v.B100 == nil && rhs.B100 == nil) || (v.B100 != nil && rhs.B100 != nil && v.B100.Equals(rhs.B100))) {\n\t\treturn false\n\t}\n\tif !_Bool_EqualsPtr(v.CheckTrue, rhs.CheckTrue) {\n\t\treturn false\n\t}\n\tif !((v.B1000 == nil && rhs.B1000 == nil) || (v.B1000 != nil && rhs.B1000 != nil && v.B1000.Equals(rhs.B1000))) {\n\t\treturn false\n\t}\n\tif !_Bool_EqualsPtr(v.CheckFalse, rhs.CheckFalse) {\n\t\treturn false\n\t}\n\tif !((v.Vertwo2000 == nil && rhs.Vertwo2000 == nil) || (v.Vertwo2000 != nil && rhs.Vertwo2000 != nil && v.Vertwo2000.Equals(rhs.Vertwo2000))) {\n\t\treturn false\n\t}\n\tif !((v.ASet2500 == nil && rhs.ASet2500 == nil) || (v.ASet2500 != nil && rhs.ASet2500 != nil && _Set_String_mapType_Equals(v.ASet2500, rhs.ASet2500))) {\n\t\treturn false\n\t}\n\tif !((v.Vertwo3000 == nil && rhs.Vertwo3000 == nil) || (v.Vertwo3000 != nil && rhs.Vertwo3000 != nil && v.Vertwo3000.Equals(rhs.Vertwo3000))) {\n\t\treturn false\n\t}\n\tif !((v.BigNumbers == nil && rhs.BigNumbers == nil) || (v.BigNumbers != nil && rhs.BigNumbers != nil && _List_I32_Equals(v.BigNumbers, rhs.BigNumbers))) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "63c10d997041edbca713cf361b31b2e0", "score": "0.5257327", "text": "func (t Targets) Same(o Targets) bool {\n\tif len(t) != len(o) {\n\t\treturn false\n\t}\n\tsort.Stable(t)\n\tsort.Stable(o)\n\n\tfor i, e := range t {\n\t\tif !strings.EqualFold(e, o[i]) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "8d9adac39ba64b7e71fcde3459554f61", "score": "0.5257254", "text": "func (o OnValue) DeepEquals(expect interface{}) bool {\n\treturn o.TestDeepDiff(o.value, expect)\n}", "title": "" }, { "docid": "e1d1f52cc17afcd43929b437c472dd12", "score": "0.52103114", "text": "func (o OnMap) DeepEquals(expected interface{}) bool {\n\treturn o.mapsEqual(expected, compare.DeepEqual)\n}", "title": "" }, { "docid": "f4a1f4c2d86345b725ebe666b4fa116c", "score": "0.52023125", "text": "func FieldsArrayEquals(a PatternFields, b PatternFields) bool {\n\tfor key, field := range b {\n\t\tif a[key] != field {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "b482ef3a320c31a665ef134c2b8c36df", "score": "0.5192661", "text": "func Equal(t *testing.T, expected, actual interface{}, msgAndArgs ...interface{}) bool {\n\texpectRaw, err := json.Marshal(expected)\n\tif err != nil {\n\t\treturn false\n\t}\n\tactualRaw, err := json.Marshal(actual)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\tif !bytes.Equal(expectRaw, actualRaw) {\n\t\treturn assert.Fail(t, fmt.Sprintf(\"Not equal: \\n\"+\n\t\t\t\"expected: %s\\n\"+\n\t\t\t\"actual : %s\", string(expectRaw), string(actualRaw)), msgAndArgs...)\n\t}\n\treturn true\n}", "title": "" }, { "docid": "7ab39b274da1578a9ca7ad37ba9f20ec", "score": "0.5133436", "text": "func PropsEquals(p1, p2 []Prop) bool {\n\tif len(p1) != len(p2) {\n\t\treturn false\n\t}\n\n\tfor i, prop := range p1 {\n\t\tif !prop.Equals(&p2[i]) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "04cdaf3c740f2752419f6da4f875b5f7", "score": "0.5131073", "text": "func (c *dagView) Equals(other *dagView) bool {\n\tc.mtx.Lock()\n\tother.mtx.Lock()\n\t//fmt.Printf(\"len1: %d, len2: %d\\n\", len(c.nodes), len(other.nodes))\n\t//fmt.Printf(\"hash equals : %v\\n\", c.virtualHash().IsEqual(other.virtualHash()))\n\tequals := len(c.nodes) == len(other.nodes) && c.virtualHash().IsEqual(other.virtualHash())\n\tother.mtx.Unlock()\n\tc.mtx.Unlock()\n\treturn equals\n}", "title": "" }, { "docid": "25ec476adf7d21e2ea7c1301c370a864", "score": "0.5120345", "text": "func (p Params) Equal(a Params) bool {\n\tif len(a) != len(p) {\n\t\treturn false\n\t}\n\t// Since they are the same size we only need to check from one side, i.e.\n\t// compare a's values to p's values.\n\tfor k, v := range a {\n\t\tif bv, ok := p[k]; !ok || bv != v {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "4c3a5715c9269350a89b997770e5c7d4", "score": "0.5118016", "text": "func deepEqualPurchases(ps1, ps2 []Purchase) bool {\n\tif len(ps1) != len(ps2) {\n\t\treturn false\n\t}\n\tfor i := 0; i < len(ps1); i++ {\n\t\tif ps1[i].ID != ps2[i].ID || ps1[i].ProductID != ps2[i].ProductID ||\n\t\t\tps1[i].Username != ps2[i].Username || ps1[i].Date.String() != ps2[i].Date.String() {\n\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "62b7a71443a4ef8e5021fb7e0ab4871a", "score": "0.5106933", "text": "func (s State) Equals(o State) bool {\n\tsuite := s.CipherSuite == o.CipherSuite\n\tgroupID := bytes.Equal(s.GroupID, o.GroupID)\n\tepoch := s.Epoch == o.Epoch\n\ttree := s.Tree.Equals(o.Tree)\n\tcth := bytes.Equal(s.ConfirmedTranscriptHash, o.ConfirmedTranscriptHash)\n\tith := bytes.Equal(s.InterimTranscriptHash, o.InterimTranscriptHash)\n\tkeys := reflect.DeepEqual(s.Keys, o.Keys)\n\n\treturn suite && groupID && epoch && tree && cth && ith && keys\n}", "title": "" }, { "docid": "80bd6d669f902903ff7064be1a5136f7", "score": "0.510503", "text": "func (o *options) equals(options *options) bool {\n\treturn o.failingCriticals == options.failingCriticals && o.dateFlags == options.dateFlags && o.startingLevel == options.startingLevel\n}", "title": "" }, { "docid": "6a0ebea9cef160b28c001965feb1a744", "score": "0.5094217", "text": "func Equal(seqs ...Seq) bool {\n\treturn EqualTest(valEquality, seqs...)\n}", "title": "" }, { "docid": "e60953873d6018d03804cc8331792cb2", "score": "0.508247", "text": "func (this *assertion) AlmostEquals(expected interface{}, tolerance float64) {\n\tthis.t.Helper()\n\tthis.so(this.actual, should.AlmostEqual, expected, tolerance)\n}", "title": "" }, { "docid": "ce76f75d7c15821eca55e7db2110270c", "score": "0.5078098", "text": "func TestEq(a, b []int) bool {\n\tif (a == nil) != (b == nil) {\n\t\treturn false\n\t}\n\n\tif len(a) != len(b) {\n\t\treturn false\n\t}\n\n\tfor i := range a {\n\t\tif a[i] != b[i] {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "a094b84c6eecb657e1308021c95f7967", "score": "0.5066221", "text": "func (v *Field) Equals(rhs *Field) bool {\n\tif v == nil {\n\t\treturn rhs == nil\n\t} else if rhs == nil {\n\t\treturn false\n\t}\n\tif !_FieldType_EqualsPtr(v.Type, rhs.Type) {\n\t\treturn false\n\t}\n\tif !_String_EqualsPtr(v.StringData, rhs.StringData) {\n\t\treturn false\n\t}\n\tif !_I64_EqualsPtr(v.IntData, rhs.IntData) {\n\t\treturn false\n\t}\n\tif !_Bool_EqualsPtr(v.BoolData, rhs.BoolData) {\n\t\treturn false\n\t}\n\tif !((v.BinaryData == nil && rhs.BinaryData == nil) || (v.BinaryData != nil && rhs.BinaryData != nil && bytes.Equal(v.BinaryData, rhs.BinaryData))) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "a769403e11ec5d5b9b199bcc0ffd1de5", "score": "0.5063488", "text": "func argsEqual(args, pattern []string) bool {\n\tif len(args) < len(pattern)+1 {\n\t\treturn false\n\t}\n\tfor i, arg := range pattern {\n\t\tif arg != args[i] {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "b6469a4a043b5abd86e14369340d78b2", "score": "0.50512445", "text": "func DeepEqual(x, y interface{}) bool {\n\tif x == nil || y == nil {\n\t\treturn x == y\n\t}\n\n\tv1 := reflect.ValueOf(x)\n\tv2 := reflect.ValueOf(y)\n\n\treturn deepValueEqual(v1, v2)\n}", "title": "" }, { "docid": "e94d52af156d0b4c4187f253dd38ef21", "score": "0.5048803", "text": "func (v *HistoryService_RecordActivityTaskStarted_Args) Equals(rhs *HistoryService_RecordActivityTaskStarted_Args) bool {\n\tif v == nil {\n\t\treturn rhs == nil\n\t} else if rhs == nil {\n\t\treturn false\n\t}\n\tif !((v.AddRequest == nil && rhs.AddRequest == nil) || (v.AddRequest != nil && rhs.AddRequest != nil && v.AddRequest.Equals(rhs.AddRequest))) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "7d7b96026bd52607dd306980a55f84ea", "score": "0.50440055", "text": "func (d DValArg) TypeEqual(other Datum) bool {\n\t_, ok := other.(DValArg)\n\treturn ok\n}", "title": "" }, { "docid": "117ebc4ba9c9f8b30d13e15959609367", "score": "0.5033822", "text": "func (v *Wrapped) Equals(rhs *Wrapped) bool {\n\tif v == nil {\n\t\treturn rhs == nil\n\t} else if rhs == nil {\n\t\treturn false\n\t}\n\tif !v.N1.Equals(rhs.N1) {\n\t\treturn false\n\t}\n\tif !((v.N2 == nil && rhs.N2 == nil) || (v.N2 != nil && rhs.N2 != nil && v.N2.Equals(rhs.N2))) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "258371259238db8dfa845402e8a064a3", "score": "0.5026801", "text": "func Same(t TestingT, wanted, actual any, fmtAndArgs ...any) bool {\n\tif samePointers(wanted, actual) {\n\t\treturn true\n\t}\n\n\tt.Helper()\n\treturn fail(t, fmt.Sprintf(\"Not same: \\n\"+\n\t\t\"wanted: %p %#v\\n\"+\n\t\t\"actual: %p %#v\", wanted, wanted, actual, actual), fmtAndArgs)\n}", "title": "" }, { "docid": "d97f77db3304f98d0941f7f1402963a8", "score": "0.50223887", "text": "func (v *ThriftTest_TestOneway_Args) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [1]string\n\ti := 0\n\tif v.SecondsToSleep != nil {\n\t\tfields[i] = fmt.Sprintf(\"SecondsToSleep: %v\", *(v.SecondsToSleep))\n\t\ti++\n\t}\n\n\treturn fmt.Sprintf(\"ThriftTest_TestOneway_Args{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "ddb972aa9d32e2f801d34872d3439a02", "score": "0.50148624", "text": "func EnvelopesEqual(a, b ax.Envelope) bool {\n\tif !a.CreatedAt.Equal(b.CreatedAt) {\n\t\treturn false\n\t}\n\n\tif !a.SendAt.Equal(b.SendAt) {\n\t\treturn false\n\t}\n\n\tif !proto.Equal(a.Message, b.Message) {\n\t\treturn false\n\t}\n\n\t// ensure the \"difficult to compare\" values are equal so the remainder of\n\t// the struct can be compared using the equality operator.\n\ta.CreatedAt = b.CreatedAt\n\ta.SendAt = b.SendAt\n\ta.Message = b.Message\n\n\treturn a == b\n}", "title": "" }, { "docid": "84c96a437e7c674a00519d83ca7e21a7", "score": "0.4987089", "text": "func (o EventDataStoreAdvancedFieldSelectorOutput) Equals() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v EventDataStoreAdvancedFieldSelector) []string { return v.Equals }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "31a3f9c167745bd9ffc95994b88772f0", "score": "0.4980151", "text": "func (a *BigVec) Equal(b *BigVec) bool {\n\n\tif len(a.Coords) != len(b.Coords) {\n\t\treturn false\n\t}\n\n\tequal := true\n\tfor i := 0; i < len(a.Coords); i++ {\n\t\tif a.Coords[i].Cmp(b.Coords[i]) != 0 {\n\t\t\tequal = false\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn equal\n}", "title": "" }, { "docid": "936e6af6e33c5c17583ad49c62c601d3", "score": "0.49788636", "text": "func Equal(actual, expected interface{}) (bool, string) {\n\t/* var opts []cmp.Option\n\tt := reflect.TypeOf(actual)\n\tif t == nil {\n\t} else if t.Kind() == reflect.Struct {\n\t\topts = append(opts, cmp.AllowUnexported(actual))\n\t} else if t.Kind() == reflect.Ptr && t.Elem().Kind() == reflect.Struct {\n\t\topts = append(opts, cmp.AllowUnexported(reflect.ValueOf(actual).Elem().Interface()))\n\t}\n\tt = reflect.TypeOf(expected)\n\tif t == nil {\n\t} else if t.Kind() == reflect.Struct {\n\t\topts = append(opts, cmp.AllowUnexported(expected))\n\t} else if t.Kind() == reflect.Ptr && t.Elem().Kind() == reflect.Struct {\n\t\topts = append(opts, cmp.AllowUnexported(reflect.ValueOf(expected).Elem().Interface()))\n\t} */\n\topts := allowUnexported(actual)\n\n\tr := cmp.Diff(actual, expected, opts...)\n\treturn r == \"\", r\n}", "title": "" }, { "docid": "c34d729d0fa2cdf08fc9d6036b70db88", "score": "0.4977552", "text": "func VariableDefsEquals(v1, v2 []VariableDef) bool {\n\tif len(v1) != len(v2) {\n\t\treturn false\n\t}\n\n\tfor i, arg := range v1 {\n\t\tif !arg.Equals(&v2[i]) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "bbad7c37f5c8627bddf3ad0658abbab9", "score": "0.4976818", "text": "func (f Flag64) TestAll(anotherFlags Flag64) bool {\n\treturn f&anotherFlags == anotherFlags\n}", "title": "" }, { "docid": "0f8049c97c1728ab2ba2f7d8f2a9f538", "score": "0.4969299", "text": "func (t DatasetTuple) Equals(o DatasetTuple) bool {\n\tfor i, v := range o.Data {\n\t\tif t.Data[i] != v {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "0ec019d6309280cdb58dd9de98214922", "score": "0.49688324", "text": "func Eq(operanders ...any) bool {\n\tif len(operanders) < 2 {\n\t\treturn true\n\t}\n\n\tx := Val(operanders[0])\n\n\tfor _, v := range operanders[1:] {\n\t\tif x != Val(v) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "5c1c596fd761636a332f2e4504711daf", "score": "0.49650237", "text": "func equal(x, y interface{}) bool {\n\treturn reflect.DeepEqual(x, y)\n}", "title": "" }, { "docid": "9d5f9dfbb4be86d4ed95824952a70b80", "score": "0.49645647", "text": "func (ps Pots) Equal(qs Pots) bool {\n\tfor i := range qs {\n\t\tif ps[i] != qs[i] {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "d9ad6c4ee7d57519f0be2298beadfe25", "score": "0.49559462", "text": "func (e *Invocation) isEqual(other *Invocation) bool {\n\treturn e == other || (e.ID == other.ID &&\n\t\te.MutationsCount == other.MutationsCount && // compare it first, it changes most often\n\t\te.JobID == other.JobID &&\n\t\te.IndexedJobID == other.IndexedJobID &&\n\t\te.Started.Equal(other.Started) &&\n\t\te.Finished.Equal(other.Finished) &&\n\t\te.TriggeredBy == other.TriggeredBy &&\n\t\tbytes.Equal(e.PropertiesRaw, other.PropertiesRaw) &&\n\t\tequalSortedLists(e.Tags, other.Tags) &&\n\t\tbytes.Equal(e.IncomingTriggersRaw, other.IncomingTriggersRaw) &&\n\t\tbytes.Equal(e.OutgoingTriggersRaw, other.OutgoingTriggersRaw) &&\n\t\tbytes.Equal(e.PendingTimersRaw, other.PendingTimersRaw) &&\n\t\te.Revision == other.Revision &&\n\t\te.RevisionURL == other.RevisionURL &&\n\t\tbytes.Equal(e.Task, other.Task) &&\n\t\tequalSortedLists(e.TriggeredJobIDs, other.TriggeredJobIDs) &&\n\t\te.DebugLog == other.DebugLog &&\n\t\te.RetryCount == other.RetryCount &&\n\t\te.Status == other.Status &&\n\t\te.ViewURL == other.ViewURL &&\n\t\tbytes.Equal(e.TaskData, other.TaskData))\n}", "title": "" }, { "docid": "c91a486be650a5a54f2726e3ac9a4faf", "score": "0.49478787", "text": "func TestEquals(t *testing.T) {\n\ttests := []struct {\n\t\tin1 string // hex encoded value\n\t\tin2 string // hex encoded value\n\t\texpected bool // expected equality\n\t}{\n\t\t{\"0\", \"0\", true},\n\t\t{\"0\", \"1\", false},\n\t\t{\"1\", \"0\", false},\n\t\t// 2^32 - 1 == 2^32 - 1?\n\t\t{\"ffffffff\", \"ffffffff\", true},\n\t\t// 2^64 - 1 == 2^64 - 2?\n\t\t{\"ffffffffffffffff\", \"fffffffffffffffe\", false},\n\t\t// 0 == prime (mod prime)?\n\t\t{\"0\", \"fffffffeffffffffffffffffffffffffffffffff00000000ffffffffffffffff\", true},\n\t\t// 1 == prime+1 (mod prime)?\n\t\t{\"1\", \"fffffffeffffffffffffffffffffffffffffffff000000010000000000000000\", true},\n\t}\n\n\tt.Logf(\"Running %d tests\", len(tests))\n\tfor i, test := range tests {\n\t\tf := new(fieldVal).SetHex(test.in1).Normalize()\n\t\tf2 := new(fieldVal).SetHex(test.in2).Normalize()\n\t\tresult := f.Equals(f2)\n\t\tif result != test.expected {\n\t\t\tt.Errorf(\"fieldVal.Equals #%d wrong result\\n\"+\n\t\t\t\t\"got: %v\\nwant: %v\", i, result, test.expected)\n\t\t\tcontinue\n\t\t}\n\t}\n}", "title": "" }, { "docid": "92119212a102680ad9c56859d646963f", "score": "0.4947708", "text": "func (v *CrazyNesting) Equals(rhs *CrazyNesting) bool {\n\tif v == nil {\n\t\treturn rhs == nil\n\t} else if rhs == nil {\n\t\treturn false\n\t}\n\tif !_String_EqualsPtr(v.StringField, rhs.StringField) {\n\t\treturn false\n\t}\n\tif !((v.SetField == nil && rhs.SetField == nil) || (v.SetField != nil && rhs.SetField != nil && _Set_Insanity_sliceType_Equals(v.SetField, rhs.SetField))) {\n\t\treturn false\n\t}\n\tif !_List_Map_Set_I32_mapType_Map_I32_Set_List_Map_Insanity_String_sliceType_Equals(v.ListField, rhs.ListField) {\n\t\treturn false\n\t}\n\tif !((v.BinaryField == nil && rhs.BinaryField == nil) || (v.BinaryField != nil && rhs.BinaryField != nil && bytes.Equal(v.BinaryField, rhs.BinaryField))) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "ccf3bb5efe4833ec8ffbdcd6a2e5ec67", "score": "0.4943893", "text": "func BoxesAreEqual(a, b box) bool {\n\tif a.x != b.x {\n\t\treturn false\n\t}\n\tif a.y != b.y {\n\t\treturn false\n\t}\n\tif a.l != b.l {\n\t\treturn false\n\t}\n\tif a.w != b.w {\n\t\treturn false\n\t}\n\tif a.id != b.id {\n\t\treturn false\n\t}\n\n\treturn true\n\n\t// It would be more elegant to use reflections to get the values of the\n\t// respected fields of the box struct. See also:\n\t// https://stackoverflow.com/qüstions/18926303/iterate-through-a-struct-in-go\n\t//\n\t// However, using reflect to iterate over the box structure fails as the\n\t// data field variables are all lower case in `box` and thus are invisible\n\t// outside the defining package and reflect is an outside package. See\n\t// https://groups.google.com/forum/#!topic/golang-nuts/UYgse9hnfoc\n\t//\n\t//\n\t//\tA := reflect.ValueOf(a)\n\t//\tB := reflect.ValueOf(b)\n\t//\n\t//\tA_values := make([]interface{}, A.NumField())\n\t//\tB_values := make([]interface{}, B.NumField())\n\t//\n\t//\tfor i := 0; i < A.NumField(); i++ {\n\t//\t\tA_values[i] = A.Field(i).Interface()\n\t//\t}\n\t//\tfor i := 0; i < B.NumField(); i++ {\n\t//\t\tB_values[i] = B.Field(i).Interface()\n\t//\t}\n\t//\n\t//\tfor i, v := range A_values {\n\t//\t\tif v != B_values[i] {\n\t//\t\t\treturn false\n\t//\t\t}\n\t//\t}\n\t//\treturn true\n}", "title": "" }, { "docid": "acb5892023b524fc1238457cf8cf65b7", "score": "0.49393624", "text": "func (v *BoolTest) Equals(rhs *BoolTest) bool {\n\tif v == nil {\n\t\treturn rhs == nil\n\t} else if rhs == nil {\n\t\treturn false\n\t}\n\tif !_Bool_EqualsPtr(v.B, rhs.B) {\n\t\treturn false\n\t}\n\tif !_String_EqualsPtr(v.S, rhs.S) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "3afc333563d6ccac68adaefb897892aa", "score": "0.49283594", "text": "func (v *OneField) Equals(rhs *OneField) bool {\n\tif v == nil {\n\t\treturn rhs == nil\n\t} else if rhs == nil {\n\t\treturn false\n\t}\n\tif !((v.Field == nil && rhs.Field == nil) || (v.Field != nil && rhs.Field != nil && v.Field.Equals(rhs.Field))) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "09e12b4fa46f10f3b099b6d69d65b13c", "score": "0.49192297", "text": "func isEqual(expected, target interface{}, excepts []string) error {\n\tve := reflect.ValueOf(expected)\n\tte := reflect.TypeOf(expected)\n\tvt := reflect.ValueOf(target)\n\n\tif ve.Type() != vt.Type() {\n\t\treturn fmt.Errorf(\"expected type %v is not equal to target type %v\", ve.Type(), vt.Type())\n\t}\n\n\tif ve.Kind() == reflect.Ptr {\n\t\tve = ve.Elem()\n\t\tte = te.Elem()\n\t\tvt = vt.Elem()\n\t}\n\n\tif ve.Kind() != reflect.Struct {\n\t\treturn errors.New(\"not struct\")\n\t}\n\n\tfor i := 0; i < ve.NumField(); i++ {\n\t\tn := te.Field(i).Name\n\t\tif contains(excepts, n) {\n\t\t\tcontinue\n\t\t}\n\n\t\tfe := ve.FieldByName(n)\n\t\tft := vt.FieldByName(n)\n\n\t\tif !fe.CanInterface() {\n\t\t\tcontinue\n\t\t}\n\n\t\tif fe.Interface() != ft.Interface() {\n\t\t\treturn fmt.Errorf(\"field %v: expected %v, but got %v\", n, fe.Interface(), ft.Interface())\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "4db0b1d8cd3381eacb2ddc578fd96e21", "score": "0.49175185", "text": "func (a TokenArray) Equals(other TokenArray) bool {\n\tif len(a) != len(other) {\n\t\treturn false\n\t}\n\tfor i, x := range a {\n\t\tif x != other[i] {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "99f87153a4b720652dc640e3d73a1f30", "score": "0.4906438", "text": "func (k *Key) Equal(other *Key) (ret bool) {\n\tret = (k.appID == other.appID &&\n\t\tk.namespace == other.namespace &&\n\t\tlen(k.toks) == len(other.toks))\n\tif ret {\n\t\tfor i, t := range k.toks {\n\t\t\tif ret = t == other.toks[i]; !ret {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "72a45b23128042d904bb8a7212bf5f60", "score": "0.48942512", "text": "func (t Tuple) Equals(other Tuple) bool {\n\treturn math.Abs(t.X-other.X) < Epsilon &&\n\t\tmath.Abs(t.Y-other.Y) < Epsilon &&\n\t\tmath.Abs(t.Z-other.Z) < Epsilon &&\n\t\tmath.Abs(t.W-other.W) < Epsilon\n}", "title": "" }, { "docid": "760ddea8df3e78145a11c011768875d8", "score": "0.48864564", "text": "func DeepEqual(amorph0, amorph1 interface{}) bool {\n\tswitch {\n\tcase amorph0 == nil && amorph1 == nil:\n\t\treturn true\n\tcase amorph0 == nil:\n\t\treturn false\n\tcase amorph1 == nil:\n\t\treturn false\n\t}\n\tswitch cvt0 := amorph0.(type) {\n\tcase string:\n\t\treturn stringCmp(cvt0, amorph1)\n\tcase []interface{}:\n\t\treturn sliceCmp(cvt0, amorph1)\n\tcase map[string]interface{}:\n\t\treturn mapCmp(cvt0, amorph1)\n\tcase float64:\n\t\treturn float64Cmp(cvt0, amorph1)\n\tdefault:\n\t\treturn reflect.DeepEqual(amorph0, amorph1)\n\t}\n}", "title": "" }, { "docid": "519fe75690fa8bb9708cc118da9f8500", "score": "0.48827302", "text": "func (n *Name) Equals(other *Name) bool {\n\tif n.Size() != other.Size() {\n\t\treturn false\n\t}\n\n\tfor i := 0; i < n.Size(); i++ {\n\t\tif n.At(i).Type() != other.At(i).Type() || !bytes.Equal(n.At(i).Value(), other.At(i).Value()) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "af4f9c06ad3b4731cf1670182237a39d", "score": "0.48808816", "text": "func DeepEqual(x, y interface{}) bool {\n\tif x == nil || y == nil {\n\t\treturn x == y\n\t}\n\tv1 := ValueOf(x)\n\tv2 := ValueOf(y)\n\n\treturn deepValueEqual(v1, v2, make(map[visit]bool))\n}", "title": "" }, { "docid": "afaaba6d778937b418966378693a5104", "score": "0.48766935", "text": "func (v *ZapOptOutStruct) Equals(rhs *ZapOptOutStruct) bool {\n\tif v == nil {\n\t\treturn rhs == nil\n\t} else if rhs == nil {\n\t\treturn false\n\t}\n\tif !(v.Name == rhs.Name) {\n\t\treturn false\n\t}\n\tif !(v.Optout == rhs.Optout) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "280c107ae78a3df85595d8b06f79db2c", "score": "0.48745662", "text": "func Equal(params ...interface{}) (bool, string) {\n\treturn Equals.Check(params, cmpParams)\n}", "title": "" }, { "docid": "50160df733ba31e82eb092e2a8fc093f", "score": "0.487338", "text": "func testTypeInfoEquals(t *testing.T, tiArrays [][]TypeInfo) {\n\tfor tiArrayIndex, tiArray := range tiArrays {\n\t\tt.Run(tiArray[0].GetTypeIdentifier().String(), func(t *testing.T) {\n\t\t\t// check this TypeInfo against its own variations, EX: Int16 & Int32\n\t\t\t// a != b should also mean b != a\n\t\t\tfor i := range tiArray {\n\t\t\t\tti1 := tiArray[i]\n\t\t\t\tt.Run(ti1.String(), func(t *testing.T) {\n\t\t\t\t\tfor j := range tiArray {\n\t\t\t\t\t\tti2 := tiArray[j]\n\t\t\t\t\t\tt.Run(fmt.Sprintf(ti2.String()), func(t *testing.T) {\n\t\t\t\t\t\t\tequality := ti1.Equals(ti2)\n\t\t\t\t\t\t\tif i == j {\n\t\t\t\t\t\t\t\tassert.True(t, equality)\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tassert.False(t, equality)\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// we just check the first element and assume it'll hold true for the other values\n\t\t\tfirstTi := tiArray[0]\n\t\t\tt.Run(fmt.Sprintf(`%v Others`, firstTi), func(t *testing.T) {\n\t\t\t\t// check this TypeInfo against the other types, EX: Int16 & Float64\n\t\t\t\tfor tiArrayIndex2, tiArray2 := range tiArrays {\n\t\t\t\t\tif tiArrayIndex == tiArrayIndex2 {\n\t\t\t\t\t\t// this is the for loop above\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tfor _, otherTi := range tiArray2 {\n\t\t\t\t\t\tt.Run(fmt.Sprintf(otherTi.String()), func(t *testing.T) {\n\t\t\t\t\t\t\tequality := firstTi.Equals(otherTi)\n\t\t\t\t\t\t\tassert.False(t, equality)\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": "5389debd10aea77566cc005cfa90b545", "score": "0.4870198", "text": "func Equal(x, y interface{}) bool {\n return equal(reflect.ValueOf(x), reflect.ValueOf(y))\n}", "title": "" }, { "docid": "37864bc31be37b48fda71f4bece38d1e", "score": "0.48630348", "text": "func (m DubboCallModel) Equals(o DubboCallModel) bool {\n\tif m.Application != o.Application {\n\t\treturn false\n\t}\n\n\tif len(m.ProvideServices) != len(o.ProvideServices) {\n\t\treturn false\n\t}\n\tfor k := range m.ProvideServices {\n\t\tif _, ok := o.ProvideServices[k]; !ok {\n\t\t\treturn false\n\t\t}\n\t}\n\n\tif len(m.ConsumeServices) != len(o.ConsumeServices) {\n\t\treturn false\n\t}\n\tfor k := range m.ConsumeServices {\n\t\tif _, ok := o.ConsumeServices[k]; !ok {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "8b7adb4baddc7d9a3463774d1e4ec814", "score": "0.4856663", "text": "func EqualsTest(n *Node, a, b interface{}) bool {\n\n\ta2, b2, same := Promote(n, a, b)\n\tif !same {\n\t\treturn false\n\t}\n\n\treturn a2 == b2\n}", "title": "" }, { "docid": "f7f1ed830536be984f4264523fec17ae", "score": "0.4855152", "text": "func AdvancedEqual(o1, o2 *AdvancedOption) bool {\n\treturn o1.Equal(o2)\n}", "title": "" }, { "docid": "26a4d1732b414729670e088c380cb182", "score": "0.4853501", "text": "func (aa Address) Equals(aa2 Address) bool {\n\tif aa.Empty() && aa2.Empty() {\n\t\treturn true\n\t}\n\n\treturn bytes.Equal(aa.Bytes(), aa2.Bytes())\n}", "title": "" }, { "docid": "2f18c3020332215966dfdad7f9d8eaa5", "score": "0.48498672", "text": "func (d *Date) Equals(other *Date) bool {\n\t// TODO: should check if fields are set before comparing\n\tif d.year == other.year && d.month == other.month && d.day == other.day {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "63d8a2df68da9cfa62fdf01eca4c0ed5", "score": "0.48479557", "text": "func Equals(refA, refB *v1.ObjectReference) bool {\n\tif refA == nil || refB == nil {\n\t\treturn false\n\t}\n\n\treturn reflect.DeepEqual(refA, refB)\n}", "title": "" }, { "docid": "5b3fc7863a7763498bdedcc2dc536b4c", "score": "0.48463723", "text": "func (a SOA) Equal(b SOA) bool {\n\treturn a.Ttl == b.Ttl && a.MName == b.MName && a.RName == b.RName &&\n\t\ta.Refresh == b.Refresh && a.Retry == b.Retry &&\n\t\ta.Expire == b.Expire && a.MinTtl == b.MinTtl\n}", "title": "" }, { "docid": "b8f20de1afbe359cef24335b4331c5fd", "score": "0.48379743", "text": "func Equal(t TestingT, want, give any, fmtAndArgs ...any) bool {\n\tt.Helper()\n\treturn Eq(t, want, give, fmtAndArgs...)\n}", "title": "" }, { "docid": "f36975aa7eb0c8cbd4e305de7c2fb34e", "score": "0.48315027", "text": "func (v Version) Equals(o *Version) bool {\n\tif o == nil {\n\t\treturn v.IsZero()\n\t}\n\n\tif v.Scalar == o.Scalar && v.PID == o.PID {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "dbf3a10a773da7a9008ca1409de78e1b", "score": "0.48258182", "text": "func (a OID) IsEqualTo(b OID) bool {\n\tif len(a) != len(b) {\n\t\treturn false\n\t}\n\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\n\treturn true\n}", "title": "" } ]
052e701cfa5a17fe2072575f1bde7c99
UnmarshalJSON implements the json.Unmarshaller interface for type RestoreJobRecoveryPointDetails.
[ { "docid": "aad82c706ce1b6dba72e041e50edb8e0", "score": "0.8665593", "text": "func (r *RestoreJobRecoveryPointDetails) 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 \"recoveryPointID\":\n\t\t\terr = unpopulate(val, \"RecoveryPointID\", &r.RecoveryPointID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"recoveryPointTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"RecoveryPointTime\", &r.RecoveryPointTime)\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": "05e5f63e81a8aa362543f6dd20f84659", "score": "0.7552016", "text": "func (a *AzureBackupRecoveryPointBasedRestoreRequest) 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 \"objectType\":\n\t\t\terr = unpopulate(val, \"ObjectType\", &a.ObjectType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"recoveryPointId\":\n\t\t\terr = unpopulate(val, \"RecoveryPointID\", &a.RecoveryPointID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"restoreTargetInfo\":\n\t\t\ta.RestoreTargetInfo, err = unmarshalRestoreTargetInfoBaseClassification(val)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"sourceDataStoreType\":\n\t\t\terr = unpopulate(val, \"SourceDataStoreType\", &a.SourceDataStoreType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"sourceResourceId\":\n\t\t\terr = unpopulate(val, \"SourceResourceID\", &a.SourceResourceID)\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": "438b683bee98f194a021176bfe8bbc05", "score": "0.75446993", "text": "func (r *RestorePoint) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", r, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &r.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &r.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &r.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &r.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", r, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "318e84c9b4b0b27fedb572dff36493d5", "score": "0.73126066", "text": "func (a *AzureBackupRecoveryTimeBasedRestoreRequest) 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 \"objectType\":\n\t\t\terr = unpopulate(val, \"ObjectType\", &a.ObjectType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"recoveryPointTime\":\n\t\t\terr = unpopulate(val, \"RecoveryPointTime\", &a.RecoveryPointTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"restoreTargetInfo\":\n\t\t\ta.RestoreTargetInfo, err = unmarshalRestoreTargetInfoBaseClassification(val)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"sourceDataStoreType\":\n\t\t\terr = unpopulate(val, \"SourceDataStoreType\", &a.SourceDataStoreType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"sourceResourceId\":\n\t\t\terr = unpopulate(val, \"SourceResourceID\", &a.SourceResourceID)\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": "b2ab087d259befd83ef4c43b826b2a82", "score": "0.72925496", "text": "func (a *AzureBackupRecoveryPointResource) 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 \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &a.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &a.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\ta.Properties, err = unmarshalAzureBackupRecoveryPointClassification(val)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"systemData\":\n\t\t\terr = unpopulate(val, \"SystemData\", &a.SystemData)\n\t\t\tdelete(rawMsg, 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": "5af496d11081977468e7d5a8589e7b02", "score": "0.7209925", "text": "func (rp *RestorePoint) 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 \"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\trp.Location = &location\n\t\t\t}\n\t\tcase \"properties\":\n\t\t\tif v != nil {\n\t\t\t\tvar restorePointProperties RestorePointProperties\n\t\t\t\terr = json.Unmarshal(*v, &restorePointProperties)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\trp.RestorePointProperties = &restorePointProperties\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\trp.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\trp.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\trp.Type = &typeVar\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3f24ee5132d713d801241dec83936972", "score": "0.7075149", "text": "func (a *AzureBackupDiscreteRecoveryPoint) 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 \"friendlyName\":\n\t\t\terr = unpopulate(val, \"FriendlyName\", &a.FriendlyName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"objectType\":\n\t\t\terr = unpopulate(val, \"ObjectType\", &a.ObjectType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"policyName\":\n\t\t\terr = unpopulate(val, \"PolicyName\", &a.PolicyName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"policyVersion\":\n\t\t\terr = unpopulate(val, \"PolicyVersion\", &a.PolicyVersion)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"recoveryPointDataStoresDetails\":\n\t\t\terr = unpopulate(val, \"RecoveryPointDataStoresDetails\", &a.RecoveryPointDataStoresDetails)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"recoveryPointId\":\n\t\t\terr = unpopulate(val, \"RecoveryPointID\", &a.RecoveryPointID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"recoveryPointTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"RecoveryPointTime\", &a.RecoveryPointTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"recoveryPointType\":\n\t\t\terr = unpopulate(val, \"RecoveryPointType\", &a.RecoveryPointType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"retentionTagName\":\n\t\t\terr = unpopulate(val, \"RetentionTagName\", &a.RetentionTagName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"retentionTagVersion\":\n\t\t\terr = unpopulate(val, \"RetentionTagVersion\", &a.RetentionTagVersion)\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": "fa97adf3a5afa2164ebb1b44832dbefc", "score": "0.7045519", "text": "func (r *RecoveryPointDataStoreDetails) 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 \"creationTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"CreationTime\", &r.CreationTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"expiryTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"ExpiryTime\", &r.ExpiryTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &r.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"metaData\":\n\t\t\terr = unpopulate(val, \"MetaData\", &r.MetaData)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"rehydrationExpiryTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"RehydrationExpiryTime\", &r.RehydrationExpiryTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"rehydrationStatus\":\n\t\t\terr = unpopulate(val, \"RehydrationStatus\", &r.RehydrationStatus)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"state\":\n\t\t\terr = unpopulate(val, \"State\", &r.State)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &r.Type)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"visible\":\n\t\t\terr = unpopulate(val, \"Visible\", &r.Visible)\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": "79ff1633303cc5ef9b9b6f038d90fa5f", "score": "0.69378644", "text": "func (a *AzureBackupRestoreWithRehydrationRequest) 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 \"objectType\":\n\t\t\terr = unpopulate(val, \"ObjectType\", &a.ObjectType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"recoveryPointId\":\n\t\t\terr = unpopulate(val, \"RecoveryPointID\", &a.RecoveryPointID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"rehydrationPriority\":\n\t\t\terr = unpopulate(val, \"RehydrationPriority\", &a.RehydrationPriority)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"rehydrationRetentionDuration\":\n\t\t\terr = unpopulate(val, \"RehydrationRetentionDuration\", &a.RehydrationRetentionDuration)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"restoreTargetInfo\":\n\t\t\ta.RestoreTargetInfo, err = unmarshalRestoreTargetInfoBaseClassification(val)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"sourceDataStoreType\":\n\t\t\terr = unpopulate(val, \"SourceDataStoreType\", &a.SourceDataStoreType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"sourceResourceId\":\n\t\t\terr = unpopulate(val, \"SourceResourceID\", &a.SourceResourceID)\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": "224d2576ba2065c941fa1dea821784d6", "score": "0.6911834", "text": "func (d *DiskRestorePoint) 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 \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &d.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &d.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &d.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &d.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\", d, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a39a3edcdc5e3e12222cfff2238432be", "score": "0.67995065", "text": "func (r *RestorePointProperties) 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 \"consistencyMode\":\n\t\t\terr = unpopulate(val, \"ConsistencyMode\", &r.ConsistencyMode)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"excludeDisks\":\n\t\t\terr = unpopulate(val, \"ExcludeDisks\", &r.ExcludeDisks)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"instanceView\":\n\t\t\terr = unpopulate(val, \"InstanceView\", &r.InstanceView)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"provisioningState\":\n\t\t\terr = unpopulate(val, \"ProvisioningState\", &r.ProvisioningState)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"sourceMetadata\":\n\t\t\terr = unpopulate(val, \"SourceMetadata\", &r.SourceMetadata)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"sourceRestorePoint\":\n\t\t\terr = unpopulate(val, \"SourceRestorePoint\", &r.SourceRestorePoint)\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": "bfe618e2826ca9823a167f79b7bb653a", "score": "0.6794871", "text": "func (r *RestorePointProperties) 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 \"earliestRestoreDate\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"EarliestRestoreDate\", &r.EarliestRestoreDate)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"restorePointCreationDate\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"RestorePointCreationDate\", &r.RestorePointCreationDate)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"restorePointLabel\":\n\t\t\terr = unpopulate(val, \"RestorePointLabel\", &r.RestorePointLabel)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"restorePointType\":\n\t\t\terr = unpopulate(val, \"RestorePointType\", &r.RestorePointType)\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": "d2d8f13179c20c9261a3333d2605e961", "score": "0.6773279", "text": "func (a *AzureBackupRestoreRequest) 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 \"objectType\":\n\t\t\terr = unpopulate(val, \"ObjectType\", &a.ObjectType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"restoreTargetInfo\":\n\t\t\ta.RestoreTargetInfo, err = unmarshalRestoreTargetInfoBaseClassification(val)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"sourceDataStoreType\":\n\t\t\terr = unpopulate(val, \"SourceDataStoreType\", &a.SourceDataStoreType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"sourceResourceId\":\n\t\t\terr = unpopulate(val, \"SourceResourceID\", &a.SourceResourceID)\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": "17730f3f30eb4dba1214aaf0811d7048", "score": "0.67166567", "text": "func (r *RestorePointInstanceView) 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 \"diskRestorePoints\":\n\t\t\terr = unpopulate(val, \"DiskRestorePoints\", &r.DiskRestorePoints)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"statuses\":\n\t\t\terr = unpopulate(val, \"Statuses\", &r.Statuses)\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": "0b068bbc2c5680ba0047e8f54fa3979a", "score": "0.6704733", "text": "func (r *RestoreOperation) 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 \"endTime\":\n\t\t\terr = unpopulateTimeUnix(val, \"EndTime\", &r.EndTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"error\":\n\t\t\terr = unpopulate(val, \"Error\", &r.Error)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"jobId\":\n\t\t\terr = unpopulate(val, \"JobID\", &r.JobID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"startTime\":\n\t\t\terr = unpopulateTimeUnix(val, \"StartTime\", &r.StartTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"status\":\n\t\t\terr = unpopulate(val, \"Status\", &r.Status)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"statusDetails\":\n\t\t\terr = unpopulate(val, \"StatusDetails\", &r.StatusDetails)\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": "05a433b5f622c5b0f983c1e169dfc0f3", "score": "0.6665846", "text": "func (m *ManagedDatabaseRestoreDetailsProperties) 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 \"blockReason\":\n\t\t\terr = unpopulate(val, \"BlockReason\", &m.BlockReason)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"currentRestoringFileName\":\n\t\t\terr = unpopulate(val, \"CurrentRestoringFileName\", &m.CurrentRestoringFileName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"lastRestoredFileName\":\n\t\t\terr = unpopulate(val, \"LastRestoredFileName\", &m.LastRestoredFileName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"lastRestoredFileTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"LastRestoredFileTime\", &m.LastRestoredFileTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"lastUploadedFileName\":\n\t\t\terr = unpopulate(val, \"LastUploadedFileName\", &m.LastUploadedFileName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"lastUploadedFileTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"LastUploadedFileTime\", &m.LastUploadedFileTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"numberOfFilesDetected\":\n\t\t\terr = unpopulate(val, \"NumberOfFilesDetected\", &m.NumberOfFilesDetected)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"percentCompleted\":\n\t\t\terr = unpopulate(val, \"PercentCompleted\", &m.PercentCompleted)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"status\":\n\t\t\terr = unpopulate(val, \"Status\", &m.Status)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"unrestorableFiles\":\n\t\t\terr = unpopulate(val, \"UnrestorableFiles\", &m.UnrestorableFiles)\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": "5bc66b8705e5b439ad655c638973c3fb", "score": "0.6557505", "text": "func (r *RestorePointCollection) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", r, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &r.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"location\":\n\t\t\terr = unpopulate(val, \"Location\", &r.Location)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &r.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &r.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"tags\":\n\t\t\terr = unpopulate(val, \"Tags\", &r.Tags)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &r.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", r, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f24129be9e4d57c801ffbfc60e000955", "score": "0.65493244", "text": "func (a *AzureBackupJob) 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 \"activityID\":\n\t\t\terr = unpopulate(val, \"ActivityID\", &a.ActivityID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"backupInstanceFriendlyName\":\n\t\t\terr = unpopulate(val, \"BackupInstanceFriendlyName\", &a.BackupInstanceFriendlyName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"backupInstanceId\":\n\t\t\terr = unpopulate(val, \"BackupInstanceID\", &a.BackupInstanceID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"dataSourceId\":\n\t\t\terr = unpopulate(val, \"DataSourceID\", &a.DataSourceID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"dataSourceLocation\":\n\t\t\terr = unpopulate(val, \"DataSourceLocation\", &a.DataSourceLocation)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"dataSourceName\":\n\t\t\terr = unpopulate(val, \"DataSourceName\", &a.DataSourceName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"dataSourceSetName\":\n\t\t\terr = unpopulate(val, \"DataSourceSetName\", &a.DataSourceSetName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"dataSourceType\":\n\t\t\terr = unpopulate(val, \"DataSourceType\", &a.DataSourceType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"destinationDataStoreName\":\n\t\t\terr = unpopulate(val, \"DestinationDataStoreName\", &a.DestinationDataStoreName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"duration\":\n\t\t\terr = unpopulate(val, \"Duration\", &a.Duration)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"endTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"EndTime\", &a.EndTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"errorDetails\":\n\t\t\terr = unpopulate(val, \"ErrorDetails\", &a.ErrorDetails)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"etag\":\n\t\t\terr = unpopulate(val, \"Etag\", &a.Etag)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"extendedInfo\":\n\t\t\terr = unpopulate(val, \"ExtendedInfo\", &a.ExtendedInfo)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"isUserTriggered\":\n\t\t\terr = unpopulate(val, \"IsUserTriggered\", &a.IsUserTriggered)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"operation\":\n\t\t\terr = unpopulate(val, \"Operation\", &a.Operation)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"operationCategory\":\n\t\t\terr = unpopulate(val, \"OperationCategory\", &a.OperationCategory)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"policyId\":\n\t\t\terr = unpopulate(val, \"PolicyID\", &a.PolicyID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"policyName\":\n\t\t\terr = unpopulate(val, \"PolicyName\", &a.PolicyName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"progressEnabled\":\n\t\t\terr = unpopulate(val, \"ProgressEnabled\", &a.ProgressEnabled)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"progressUrl\":\n\t\t\terr = unpopulate(val, \"ProgressURL\", &a.ProgressURL)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"restoreType\":\n\t\t\terr = unpopulate(val, \"RestoreType\", &a.RestoreType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"sourceDataStoreName\":\n\t\t\terr = unpopulate(val, \"SourceDataStoreName\", &a.SourceDataStoreName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"sourceResourceGroup\":\n\t\t\terr = unpopulate(val, \"SourceResourceGroup\", &a.SourceResourceGroup)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"sourceSubscriptionID\":\n\t\t\terr = unpopulate(val, \"SourceSubscriptionID\", &a.SourceSubscriptionID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"startTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"StartTime\", &a.StartTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"status\":\n\t\t\terr = unpopulate(val, \"Status\", &a.Status)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"subscriptionId\":\n\t\t\terr = unpopulate(val, \"SubscriptionID\", &a.SubscriptionID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"supportedActions\":\n\t\t\terr = unpopulate(val, \"SupportedActions\", &a.SupportedActions)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"vaultName\":\n\t\t\terr = unpopulate(val, \"VaultName\", &a.VaultName)\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": "e4afee451c1ea21e12db19883ae82354", "score": "0.6541395", "text": "func (r *RestoreTargetInfo) 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 \"datasourceAuthCredentials\":\n\t\t\tr.DatasourceAuthCredentials, err = unmarshalAuthCredentialsClassification(val)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"datasourceInfo\":\n\t\t\terr = unpopulate(val, \"DatasourceInfo\", &r.DatasourceInfo)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"datasourceSetInfo\":\n\t\t\terr = unpopulate(val, \"DatasourceSetInfo\", &r.DatasourceSetInfo)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"objectType\":\n\t\t\terr = unpopulate(val, \"ObjectType\", &r.ObjectType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"recoveryOption\":\n\t\t\terr = unpopulate(val, \"RecoveryOption\", &r.RecoveryOption)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"restoreLocation\":\n\t\t\terr = unpopulate(val, \"RestoreLocation\", &r.RestoreLocation)\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": "d074c76b2d1c333b281629a437bfde23", "score": "0.64700055", "text": "func (d *DiskRestorePointList) 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 \"nextLink\":\n\t\t\terr = unpopulate(val, \"NextLink\", &d.NextLink)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"value\":\n\t\t\terr = unpopulate(val, \"Value\", &d.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\", d, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c012eb17b970e87aeaeca84af24195ca", "score": "0.64636254", "text": "func (v *ValidateRestoreRequestObject) 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 \"restoreRequestObject\":\n\t\t\tv.RestoreRequestObject, err = unmarshalAzureBackupRestoreRequestClassification(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\", v, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b571228fbb987468741d67811cfc63bc", "score": "0.6387926", "text": "func (d *DiskRestorePointInstanceView) 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 \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &d.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"replicationStatus\":\n\t\t\terr = unpopulate(val, \"ReplicationStatus\", &d.ReplicationStatus)\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": "775d78fd330510169ce16f103015f4cb", "score": "0.63709617", "text": "func (r *RestoreOperationParameters) 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 \"folderToRestore\":\n\t\t\terr = unpopulate(val, \"FolderToRestore\", &r.FolderToRestore)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"sasTokenParameters\":\n\t\t\terr = unpopulate(val, \"SASTokenParameters\", &r.SASTokenParameters)\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": "5d04f607379959e316a730427573f5b9", "score": "0.63421583", "text": "func (d *DiskRestorePointProperties) 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 \"completionPercent\":\n\t\t\terr = unpopulate(val, \"CompletionPercent\", &d.CompletionPercent)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"diskAccessId\":\n\t\t\terr = unpopulate(val, \"DiskAccessID\", &d.DiskAccessID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"encryption\":\n\t\t\terr = unpopulate(val, \"Encryption\", &d.Encryption)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"familyId\":\n\t\t\terr = unpopulate(val, \"FamilyID\", &d.FamilyID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"hyperVGeneration\":\n\t\t\terr = unpopulate(val, \"HyperVGeneration\", &d.HyperVGeneration)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"networkAccessPolicy\":\n\t\t\terr = unpopulate(val, \"NetworkAccessPolicy\", &d.NetworkAccessPolicy)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"osType\":\n\t\t\terr = unpopulate(val, \"OSType\", &d.OSType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"publicNetworkAccess\":\n\t\t\terr = unpopulate(val, \"PublicNetworkAccess\", &d.PublicNetworkAccess)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"purchasePlan\":\n\t\t\terr = unpopulate(val, \"PurchasePlan\", &d.PurchasePlan)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"replicationState\":\n\t\t\terr = unpopulate(val, \"ReplicationState\", &d.ReplicationState)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"securityProfile\":\n\t\t\terr = unpopulate(val, \"SecurityProfile\", &d.SecurityProfile)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"sourceResourceId\":\n\t\t\terr = unpopulate(val, \"SourceResourceID\", &d.SourceResourceID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"sourceResourceLocation\":\n\t\t\terr = unpopulate(val, \"SourceResourceLocation\", &d.SourceResourceLocation)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"sourceUniqueId\":\n\t\t\terr = unpopulate(val, \"SourceUniqueID\", &d.SourceUniqueID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"supportedCapabilities\":\n\t\t\terr = unpopulate(val, \"SupportedCapabilities\", &d.SupportedCapabilities)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"supportsHibernation\":\n\t\t\terr = unpopulate(val, \"SupportsHibernation\", &d.SupportsHibernation)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"timeCreated\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"TimeCreated\", &d.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\", d, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0f759fd2b5056c2aa0c1d65ee9956e6b", "score": "0.6315557", "text": "func (d *DiskRestorePointReplicationStatus) 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 \"completionPercent\":\n\t\t\terr = unpopulate(val, \"CompletionPercent\", &d.CompletionPercent)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"status\":\n\t\t\terr = unpopulate(val, \"Status\", &d.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\", d, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b0a0c8596379eebc4c696a23baa31c1f", "score": "0.63036805", "text": "func (s *SelectiveKeyRestoreOperation) 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 \"endTime\":\n\t\t\terr = unpopulateTimeUnix(val, \"EndTime\", &s.EndTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"error\":\n\t\t\terr = unpopulate(val, \"Error\", &s.Error)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"jobId\":\n\t\t\terr = unpopulate(val, \"JobID\", &s.JobID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"startTime\":\n\t\t\terr = unpopulateTimeUnix(val, \"StartTime\", &s.StartTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"status\":\n\t\t\terr = unpopulate(val, \"Status\", &s.Status)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"statusDetails\":\n\t\t\terr = unpopulate(val, \"StatusDetails\", &s.StatusDetails)\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": "5fb1d24f22c4a504d243932fa5d8a5b1", "score": "0.6262764", "text": "func (i *ItemLevelRestoreTargetInfo) 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 \"datasourceAuthCredentials\":\n\t\t\ti.DatasourceAuthCredentials, err = unmarshalAuthCredentialsClassification(val)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"datasourceInfo\":\n\t\t\terr = unpopulate(val, \"DatasourceInfo\", &i.DatasourceInfo)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"datasourceSetInfo\":\n\t\t\terr = unpopulate(val, \"DatasourceSetInfo\", &i.DatasourceSetInfo)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"objectType\":\n\t\t\terr = unpopulate(val, \"ObjectType\", &i.ObjectType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"recoveryOption\":\n\t\t\terr = unpopulate(val, \"RecoveryOption\", &i.RecoveryOption)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"restoreCriteria\":\n\t\t\ti.RestoreCriteria, err = unmarshalItemLevelRestoreCriteriaClassificationArray(val)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"restoreLocation\":\n\t\t\terr = unpopulate(val, \"RestoreLocation\", &i.RestoreLocation)\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": "8dd1941c8069a087c30147efea42260a", "score": "0.62627345", "text": "func (r *RestorePointSourceVMStorageProfile) 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 \"dataDisks\":\n\t\t\terr = unpopulate(val, \"DataDisks\", &r.DataDisks)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"osDisk\":\n\t\t\terr = unpopulate(val, \"OSDisk\", &r.OSDisk)\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": "a4fb774fcd4ab3ac28323f72307b780b", "score": "0.6258746", "text": "func (future *RestorePointsCreateFuture) UnmarshalJSON(body []byte) error {\n\tvar azFuture azure.Future\n\tif err := json.Unmarshal(body, &azFuture); err != nil {\n\t\treturn err\n\t}\n\tfuture.FutureAPI = &azFuture\n\tfuture.Result = future.result\n\treturn nil\n}", "title": "" }, { "docid": "b794038813f18516e32d7b8caae035f2", "score": "0.6212592", "text": "func (r *RestoreSecretParameters) 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 \"value\":\n\t\t\terr = runtime.DecodeByteArray(string(val), &r.SecretBackup, runtime.Base64URLFormat)\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": "23e128b62d7019c2bef3307f114cc85e", "score": "0.618136", "text": "func (j *JobStage) 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 \"detail\":\n\t\t\terr = unpopulate(val, \"Detail\", &j.Detail)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"errorCode\":\n\t\t\terr = unpopulate(val, \"ErrorCode\", &j.ErrorCode)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"message\":\n\t\t\terr = unpopulate(val, \"Message\", &j.Message)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"stageStatus\":\n\t\t\terr = unpopulate(val, \"StageStatus\", &j.StageStatus)\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": "0c47dc28f43ac986a5aae6305f30e609", "score": "0.6160122", "text": "func (r *RestorePointSourceMetadata) 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 \"diagnosticsProfile\":\n\t\t\terr = unpopulate(val, \"DiagnosticsProfile\", &r.DiagnosticsProfile)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"hardwareProfile\":\n\t\t\terr = unpopulate(val, \"HardwareProfile\", &r.HardwareProfile)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"licenseType\":\n\t\t\terr = unpopulate(val, \"LicenseType\", &r.LicenseType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"location\":\n\t\t\terr = unpopulate(val, \"Location\", &r.Location)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"osProfile\":\n\t\t\terr = unpopulate(val, \"OSProfile\", &r.OSProfile)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"securityProfile\":\n\t\t\terr = unpopulate(val, \"SecurityProfile\", &r.SecurityProfile)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"storageProfile\":\n\t\t\terr = unpopulate(val, \"StorageProfile\", &r.StorageProfile)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"userData\":\n\t\t\terr = unpopulate(val, \"UserData\", &r.UserData)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"vmId\":\n\t\t\terr = unpopulate(val, \"VMID\", &r.VMID)\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": "7404e4db9f75f39dd4663117bb80b0a7", "score": "0.6145442", "text": "func (r *RestorePointCollectionProperties) 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 \"provisioningState\":\n\t\t\terr = unpopulate(val, \"ProvisioningState\", &r.ProvisioningState)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"restorePointCollectionId\":\n\t\t\terr = unpopulate(val, \"RestorePointCollectionID\", &r.RestorePointCollectionID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"restorePoints\":\n\t\t\terr = unpopulate(val, \"RestorePoints\", &r.RestorePoints)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"source\":\n\t\t\terr = unpopulate(val, \"Source\", &r.Source)\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": "7563e6523c04d5ced9febd6765c1dc94", "score": "0.61358434", "text": "func (r *RestorePointCollectionUpdate) 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 \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &r.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"tags\":\n\t\t\terr = unpopulate(val, \"Tags\", &r.Tags)\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": "62e84c9e93b4ae9abe9476a6143f4298", "score": "0.6124239", "text": "func (a *AzureDatabricksDeltaLakeSink) 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 \"importSettings\":\n\t\t\terr = unpopulate(val, &a.ImportSettings)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"preCopyScript\":\n\t\t\terr = unpopulate(val, &a.PreCopyScript)\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 a.CopySink.unmarshalInternal(rawMsg)\n}", "title": "" }, { "docid": "6f6709529df56cfc26c28fd79f60c5a1", "score": "0.6062036", "text": "func (a *AzureBackupParams) 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 \"backupType\":\n\t\t\terr = unpopulate(val, \"BackupType\", &a.BackupType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"objectType\":\n\t\t\terr = unpopulate(val, \"ObjectType\", &a.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\", a, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "29e5657246a2a1e90804a7daf70002cd", "score": "0.6036335", "text": "func (future *ManagedDatabasesCompleteRestoreFuture) UnmarshalJSON(body []byte) error {\n\tvar azFuture azure.Future\n\tif err := json.Unmarshal(body, &azFuture); err != nil {\n\t\treturn err\n\t}\n\tfuture.FutureAPI = &azFuture\n\tfuture.Result = future.result\n\treturn nil\n}", "title": "" }, { "docid": "64a8c3f44c5ff60483a70efd3ce0382e", "score": "0.6021907", "text": "func (r *RestoreFilesTargetInfo) 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 \"objectType\":\n\t\t\terr = unpopulate(val, \"ObjectType\", &r.ObjectType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"recoveryOption\":\n\t\t\terr = unpopulate(val, \"RecoveryOption\", &r.RecoveryOption)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"restoreLocation\":\n\t\t\terr = unpopulate(val, \"RestoreLocation\", &r.RestoreLocation)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"targetDetails\":\n\t\t\terr = unpopulate(val, \"TargetDetails\", &r.TargetDetails)\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": "8232f21f00d3ff14c265bf4b08731fe9", "score": "0.6010432", "text": "func (r *RestorePointCollectionListResult) 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 \"nextLink\":\n\t\t\terr = unpopulate(val, \"NextLink\", &r.NextLink)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"value\":\n\t\t\terr = unpopulate(val, \"Value\", &r.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\", r, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b0901ddb90b6e3f67dfb3accf263974c", "score": "0.5996736", "text": "func (r *RestorePointCollectionSourceProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", r, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &r.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"location\":\n\t\t\terr = unpopulate(val, \"Location\", &r.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\", r, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5712a9ad2f53dc7f2dc7768c08f43b19", "score": "0.599224", "text": "func (s *SpotRestorePolicy) 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 \"enabled\":\n\t\t\terr = unpopulate(val, \"Enabled\", &s.Enabled)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"restoreTimeout\":\n\t\t\terr = unpopulate(val, \"RestoreTimeout\", &s.RestoreTimeout)\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": "91f25fab86b4f662c8e692eb73e7a1cc", "score": "0.5981346", "text": "func (a *AzureDatabricksDeltaLakeSource) 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 \"exportSettings\":\n\t\t\terr = unpopulate(val, &a.ExportSettings)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"query\":\n\t\t\terr = unpopulate(val, &a.Query)\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 a.CopySource.unmarshalInternal(rawMsg)\n}", "title": "" }, { "docid": "1e2755cc561a69c9e9eddb9d4895b7cb", "score": "0.596915", "text": "func (s *SelectiveKeyRestoreOperationParameters) 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 \"folder\":\n\t\t\terr = unpopulate(val, \"Folder\", &s.Folder)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"sasTokenParameters\":\n\t\t\terr = unpopulate(val, \"SASTokenParameters\", &s.SASTokenParameters)\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": "f8298a1e2b8efa26ad6c73374d8d3a90", "score": "0.59634626", "text": "func (r RestoreJobRecoveryPointDetails) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"recoveryPointID\", r.RecoveryPointID)\n\tpopulateTimeRFC3339(objectMap, \"recoveryPointTime\", r.RecoveryPointTime)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "dcfb7a9eeebdd1517cb9532599c387ad", "score": "0.59525096", "text": "func (u *UpgradeDetails) 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 \"endTimeUtc\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"EndTimeUTC\", &u.EndTimeUTC)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"lastUpdatedTimeUtc\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"LastUpdatedTimeUTC\", &u.LastUpdatedTimeUTC)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"message\":\n\t\t\terr = unpopulate(val, \"Message\", &u.Message)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"operationId\":\n\t\t\terr = unpopulate(val, \"OperationID\", &u.OperationID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"previousResourceId\":\n\t\t\terr = unpopulate(val, \"PreviousResourceID\", &u.PreviousResourceID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"startTimeUtc\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"StartTimeUTC\", &u.StartTimeUTC)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"status\":\n\t\t\terr = unpopulate(val, \"Status\", &u.Status)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"triggerType\":\n\t\t\terr = unpopulate(val, \"TriggerType\", &u.TriggerType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"upgradedResourceId\":\n\t\t\terr = unpopulate(val, \"UpgradedResourceID\", &u.UpgradedResourceID)\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": "7ede3fc86faf734bb8d9efc76dd0d911", "score": "0.5932104", "text": "func (a *ArmRollingUpgradeMonitoringPolicy) 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 \"failureAction\":\n\t\t\terr = unpopulate(val, \"FailureAction\", &a.FailureAction)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"healthCheckRetryTimeout\":\n\t\t\terr = unpopulate(val, \"HealthCheckRetryTimeout\", &a.HealthCheckRetryTimeout)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"healthCheckStableDuration\":\n\t\t\terr = unpopulate(val, \"HealthCheckStableDuration\", &a.HealthCheckStableDuration)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"healthCheckWaitDuration\":\n\t\t\terr = unpopulate(val, \"HealthCheckWaitDuration\", &a.HealthCheckWaitDuration)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"upgradeDomainTimeout\":\n\t\t\terr = unpopulate(val, \"UpgradeDomainTimeout\", &a.UpgradeDomainTimeout)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"upgradeTimeout\":\n\t\t\terr = unpopulate(val, \"UpgradeTimeout\", &a.UpgradeTimeout)\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": "574cadd11552b35a44f4ccc99e92428d", "score": "0.5925433", "text": "func (future *ReplicationLinksFailoverAllowDataLossFuture) UnmarshalJSON(body []byte) error {\n\tvar azFuture azure.Future\n\tif err := json.Unmarshal(body, &azFuture); err != nil {\n\t\treturn err\n\t}\n\tfuture.FutureAPI = &azFuture\n\tfuture.Result = future.result\n\treturn nil\n}", "title": "" }, { "docid": "d5c47f2fc13f1e5741547302cb06a94b", "score": "0.5914275", "text": "func (r *RangeBasedItemLevelRestoreCriteria) 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 \"maxMatchingValue\":\n\t\t\terr = unpopulate(val, \"MaxMatchingValue\", &r.MaxMatchingValue)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"minMatchingValue\":\n\t\t\terr = unpopulate(val, \"MinMatchingValue\", &r.MinMatchingValue)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"objectType\":\n\t\t\terr = unpopulate(val, \"ObjectType\", &r.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\", r, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2bb9f3d85dfde5e1e04aa7ee6b4ac768", "score": "0.59015495", "text": "func (a *AzureBackupRule) 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 \"backupParameters\":\n\t\t\ta.BackupParameters, err = unmarshalBackupParametersClassification(val)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"dataStore\":\n\t\t\terr = unpopulate(val, \"DataStore\", &a.DataStore)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &a.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"objectType\":\n\t\t\terr = unpopulate(val, \"ObjectType\", &a.ObjectType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"trigger\":\n\t\t\ta.Trigger, err = unmarshalTriggerContextClassification(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\", a, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ab261f53d5aa82122aa3ad1f0cd021d5", "score": "0.5892461", "text": "func (l *LongTermRetentionBackupProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", l, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"backupExpirationTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"BackupExpirationTime\", &l.BackupExpirationTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"backupStorageRedundancy\":\n\t\t\terr = unpopulate(val, \"BackupStorageRedundancy\", &l.BackupStorageRedundancy)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"backupTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"BackupTime\", &l.BackupTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"databaseDeletionTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"DatabaseDeletionTime\", &l.DatabaseDeletionTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"databaseName\":\n\t\t\terr = unpopulate(val, \"DatabaseName\", &l.DatabaseName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"requestedBackupStorageRedundancy\":\n\t\t\terr = unpopulate(val, \"RequestedBackupStorageRedundancy\", &l.RequestedBackupStorageRedundancy)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"serverCreateTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"ServerCreateTime\", &l.ServerCreateTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"serverName\":\n\t\t\terr = unpopulate(val, \"ServerName\", &l.ServerName)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", l, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bf605d219284bee0b26294d1dac23637", "score": "0.5891056", "text": "func (destination *DeadLetterDestination_ARM) UnmarshalJSON(data []byte) error {\n\tvar rawJson map[string]interface{}\n\terr := json.Unmarshal(data, &rawJson)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdiscriminator := rawJson[\"endpointType\"]\n\tif discriminator == \"StorageBlob\" {\n\t\tdestination.StorageBlob = &StorageBlobDeadLetterDestination_ARM{}\n\t\treturn json.Unmarshal(data, destination.StorageBlob)\n\t}\n\n\t// No error\n\treturn nil\n}", "title": "" }, { "docid": "d734c8fe65b5c0cb72e6395d52a62e7d", "score": "0.58805144", "text": "func (future *VirtualMachineScaleSetsRedeployFuture) UnmarshalJSON(body []byte) error {\n\tvar azFuture azure.Future\n\tif err := json.Unmarshal(body, &azFuture); err != nil {\n\t\treturn err\n\t}\n\tfuture.FutureAPI = &azFuture\n\tfuture.Result = future.result\n\treturn nil\n}", "title": "" }, { "docid": "3f8ef73d45637aa0c0001770ca22a319", "score": "0.5872149", "text": "func (b *BackupInstance) 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 \"currentProtectionState\":\n\t\t\terr = unpopulate(val, \"CurrentProtectionState\", &b.CurrentProtectionState)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"dataSourceInfo\":\n\t\t\terr = unpopulate(val, \"DataSourceInfo\", &b.DataSourceInfo)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"dataSourceSetInfo\":\n\t\t\terr = unpopulate(val, \"DataSourceSetInfo\", &b.DataSourceSetInfo)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"datasourceAuthCredentials\":\n\t\t\tb.DatasourceAuthCredentials, err = unmarshalAuthCredentialsClassification(val)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"friendlyName\":\n\t\t\terr = unpopulate(val, \"FriendlyName\", &b.FriendlyName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"objectType\":\n\t\t\terr = unpopulate(val, \"ObjectType\", &b.ObjectType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"policyInfo\":\n\t\t\terr = unpopulate(val, \"PolicyInfo\", &b.PolicyInfo)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"protectionErrorDetails\":\n\t\t\terr = unpopulate(val, \"ProtectionErrorDetails\", &b.ProtectionErrorDetails)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"protectionStatus\":\n\t\t\terr = unpopulate(val, \"ProtectionStatus\", &b.ProtectionStatus)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"provisioningState\":\n\t\t\terr = unpopulate(val, \"ProvisioningState\", &b.ProvisioningState)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"validationType\":\n\t\t\terr = unpopulate(val, \"ValidationType\", &b.ValidationType)\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": "01183ed8e282af070540ec9e5144e59d", "score": "0.5852033", "text": "func (r *RestorableDroppedManagedDatabaseProperties) 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 \"creationDate\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"CreationDate\", &r.CreationDate)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"databaseName\":\n\t\t\terr = unpopulate(val, \"DatabaseName\", &r.DatabaseName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"deletionDate\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"DeletionDate\", &r.DeletionDate)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"earliestRestoreDate\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"EarliestRestoreDate\", &r.EarliestRestoreDate)\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": "542b8b9e15deb4a2b29ab143164caab3", "score": "0.58501214", "text": "func (r *RestorePointSourceVMDataDisk) 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 \"caching\":\n\t\t\terr = unpopulate(val, \"Caching\", &r.Caching)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"diskRestorePoint\":\n\t\t\terr = unpopulate(val, \"DiskRestorePoint\", &r.DiskRestorePoint)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"diskSizeGB\":\n\t\t\terr = unpopulate(val, \"DiskSizeGB\", &r.DiskSizeGB)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"lun\":\n\t\t\terr = unpopulate(val, \"Lun\", &r.Lun)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"managedDisk\":\n\t\t\terr = unpopulate(val, \"ManagedDisk\", &r.ManagedDisk)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &r.Name)\n\t\t\tdelete(rawMsg, key)\n\t\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": "1bdcb38a6816d05266d587e59c239e93", "score": "0.58475775", "text": "func (g *GatewayDetails) 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 \"dmtsClusterUri\":\n\t\t\terr = unpopulate(val, \"DmtsClusterURI\", &g.DmtsClusterURI)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"gatewayObjectId\":\n\t\t\terr = unpopulate(val, \"GatewayObjectID\", &g.GatewayObjectID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"gatewayResourceId\":\n\t\t\terr = unpopulate(val, \"GatewayResourceID\", &g.GatewayResourceID)\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": "fbf17535c307842572426bdc6f8a04e8", "score": "0.58428377", "text": "func (e *EnvironmentStateDetails) 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 \"code\":\n\t\t\terr = unpopulate(val, \"Code\", &e.Code)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"message\":\n\t\t\terr = unpopulate(val, \"Message\", &e.Message)\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": "c02c5cb4d2de003d727183d95f71ec47", "score": "0.58373183", "text": "func (r *RolloutStep) 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 \"messages\":\n\t\t\terr = unpopulate(val, \"Messages\", &r.Messages)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &r.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"operationInfo\":\n\t\t\terr = unpopulate(val, \"OperationInfo\", &r.OperationInfo)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"resourceOperations\":\n\t\t\terr = unpopulate(val, \"ResourceOperations\", &r.ResourceOperations)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"status\":\n\t\t\terr = unpopulate(val, \"Status\", &r.Status)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"stepGroup\":\n\t\t\terr = unpopulate(val, \"StepGroup\", &r.StepGroup)\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": "10e7d350952c4f76a14794994851dfa0", "score": "0.58274484", "text": "func (future *VirtualMachineScaleSetVMsRedeployFuture) UnmarshalJSON(body []byte) error {\n\tvar azFuture azure.Future\n\tif err := json.Unmarshal(body, &azFuture); err != nil {\n\t\treturn err\n\t}\n\tfuture.FutureAPI = &azFuture\n\tfuture.Result = future.result\n\treturn nil\n}", "title": "" }, { "docid": "c9be4fd57d0676029e7b9b4ab31152b5", "score": "0.58110636", "text": "func (r *RetargetScheduleProperties) 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 \"currentResourceId\":\n\t\t\terr = unpopulate(val, \"CurrentResourceID\", &r.CurrentResourceID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"targetResourceId\":\n\t\t\terr = unpopulate(val, \"TargetResourceID\", &r.TargetResourceID)\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": "cc5dbeb8826580da267c56611b0666a2", "score": "0.58103365", "text": "func (r *RetrieveBootDiagnosticsDataResult) 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 \"consoleScreenshotBlobUri\":\n\t\t\terr = unpopulate(val, \"ConsoleScreenshotBlobURI\", &r.ConsoleScreenshotBlobURI)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"serialConsoleLogBlobUri\":\n\t\t\terr = unpopulate(val, \"SerialConsoleLogBlobURI\", &r.SerialConsoleLogBlobURI)\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": "cc5dbeb8826580da267c56611b0666a2", "score": "0.58103365", "text": "func (r *RetrieveBootDiagnosticsDataResult) 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 \"consoleScreenshotBlobUri\":\n\t\t\terr = unpopulate(val, \"ConsoleScreenshotBlobURI\", &r.ConsoleScreenshotBlobURI)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"serialConsoleLogBlobUri\":\n\t\t\terr = unpopulate(val, \"SerialConsoleLogBlobURI\", &r.SerialConsoleLogBlobURI)\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": "d4af41d5d498cff1e9c7a5bc9818af96", "score": "0.58091444", "text": "func (r *RollbackStatusInfo) 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 \"failedRolledbackInstanceCount\":\n\t\t\terr = unpopulate(val, \"FailedRolledbackInstanceCount\", &r.FailedRolledbackInstanceCount)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"rollbackError\":\n\t\t\terr = unpopulate(val, \"RollbackError\", &r.RollbackError)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"successfullyRolledbackInstanceCount\":\n\t\t\terr = unpopulate(val, \"SuccessfullyRolledbackInstanceCount\", &r.SuccessfullyRolledbackInstanceCount)\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": "d4af41d5d498cff1e9c7a5bc9818af96", "score": "0.58091444", "text": "func (r *RollbackStatusInfo) 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 \"failedRolledbackInstanceCount\":\n\t\t\terr = unpopulate(val, \"FailedRolledbackInstanceCount\", &r.FailedRolledbackInstanceCount)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"rollbackError\":\n\t\t\terr = unpopulate(val, \"RollbackError\", &r.RollbackError)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"successfullyRolledbackInstanceCount\":\n\t\t\terr = unpopulate(val, \"SuccessfullyRolledbackInstanceCount\", &r.SuccessfullyRolledbackInstanceCount)\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": "3d7bf4cfacd04f575d01d907e1c9363a", "score": "0.58079195", "text": "func (future *DatabasesResumeFuture) UnmarshalJSON(body []byte) error {\n\tvar azFuture azure.Future\n\tif err := json.Unmarshal(body, &azFuture); err != nil {\n\t\treturn err\n\t}\n\tfuture.FutureAPI = &azFuture\n\tfuture.Result = future.result\n\treturn nil\n}", "title": "" }, { "docid": "79311e7d338576d387c18ccf554721d3", "score": "0.5802698", "text": "func (k *KubernetesPVRestoreCriteria) 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 \"objectType\":\n\t\t\terr = unpopulate(val, \"ObjectType\", &k.ObjectType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"storageClassName\":\n\t\t\terr = unpopulate(val, \"StorageClassName\", &k.StorageClassName)\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": "2e2915b8cbd04a5bec1fc7c463f62f72", "score": "0.5798767", "text": "func (future *VirtualMachinesRedeployFuture) UnmarshalJSON(body []byte) error {\n\tvar azFuture azure.Future\n\tif err := json.Unmarshal(body, &azFuture); err != nil {\n\t\treturn err\n\t}\n\tfuture.FutureAPI = &azFuture\n\tfuture.Result = future.result\n\treturn nil\n}", "title": "" }, { "docid": "4d5337d7556f679cd5575e07851efcc0", "score": "0.5796154", "text": "func (future *VirtualMachineScaleSetsReimageFuture) UnmarshalJSON(body []byte) error {\n\tvar azFuture azure.Future\n\tif err := json.Unmarshal(body, &azFuture); err != nil {\n\t\treturn err\n\t}\n\tfuture.FutureAPI = &azFuture\n\tfuture.Result = future.result\n\treturn nil\n}", "title": "" }, { "docid": "fe614a2aa7ab241be66d10d2a22be0d5", "score": "0.57933336", "text": "func (b *Backup) 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 \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &b.Properties)\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": "3fe699bfc85633032b4e2110b36aed0d", "score": "0.57928103", "text": "func (a *AzureDatabricksDeltaLakeExportCommand) 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 \"dateFormat\":\n\t\t\terr = unpopulate(val, &a.DateFormat)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"timestampFormat\":\n\t\t\terr = unpopulate(val, &a.TimestampFormat)\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 a.ExportSettings.unmarshalInternal(rawMsg)\n}", "title": "" }, { "docid": "9589e2a96a6381ce8843c71ee32347a7", "score": "0.5778963", "text": "func (r *RestorableDroppedDatabaseProperties) 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 \"backupStorageRedundancy\":\n\t\t\terr = unpopulate(val, \"BackupStorageRedundancy\", &r.BackupStorageRedundancy)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"creationDate\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"CreationDate\", &r.CreationDate)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"databaseName\":\n\t\t\terr = unpopulate(val, \"DatabaseName\", &r.DatabaseName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"deletionDate\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"DeletionDate\", &r.DeletionDate)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"earliestRestoreDate\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"EarliestRestoreDate\", &r.EarliestRestoreDate)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"maxSizeBytes\":\n\t\t\terr = unpopulate(val, \"MaxSizeBytes\", &r.MaxSizeBytes)\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": "a6921f919d7ca7a017a37cfb507430d6", "score": "0.5777153", "text": "func (f *FullBackupOperation) 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 \"azureStorageBlobContainerUri\":\n\t\t\terr = unpopulate(val, \"AzureStorageBlobContainerURI\", &f.AzureStorageBlobContainerURI)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"endTime\":\n\t\t\terr = unpopulateTimeUnix(val, \"EndTime\", &f.EndTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"error\":\n\t\t\terr = unpopulate(val, \"Error\", &f.Error)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"jobId\":\n\t\t\terr = unpopulate(val, \"JobID\", &f.JobID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"startTime\":\n\t\t\terr = unpopulateTimeUnix(val, \"StartTime\", &f.StartTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"status\":\n\t\t\terr = unpopulate(val, \"Status\", &f.Status)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"statusDetails\":\n\t\t\terr = unpopulate(val, \"StatusDetails\", &f.StatusDetails)\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": "5190fb94c3f759cd4617e37169372491", "score": "0.5777009", "text": "func (rdd *RestorableDroppedDatabase) 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 \"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\trdd.Location = &location\n\t\t\t}\n\t\tcase \"properties\":\n\t\t\tif v != nil {\n\t\t\t\tvar restorableDroppedDatabaseProperties RestorableDroppedDatabaseProperties\n\t\t\t\terr = json.Unmarshal(*v, &restorableDroppedDatabaseProperties)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\trdd.RestorableDroppedDatabaseProperties = &restorableDroppedDatabaseProperties\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\trdd.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\trdd.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\trdd.Type = &typeVar\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7b9681d4af679d386f8c4f1bce76ec6f", "score": "0.5770317", "text": "func (future *ReplicationLinksFailoverFuture) UnmarshalJSON(body []byte) error {\n\tvar azFuture azure.Future\n\tif err := json.Unmarshal(body, &azFuture); err != nil {\n\t\treturn err\n\t}\n\tfuture.FutureAPI = &azFuture\n\tfuture.Result = future.result\n\treturn nil\n}", "title": "" }, { "docid": "bfbd58291133482c065b9cad755a89bd", "score": "0.57548565", "text": "func (v *GetRelayoutBoundaryReturns) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonC5a4559bDecodeGithubComKnqChromedpCdpDom41(&r, v)\n\treturn r.Error()\n}", "title": "" }, { "docid": "e23ae97f14c6d20777c07bea35fdaf12", "score": "0.5749972", "text": "func (r *RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration) 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 \"duration\":\n\t\t\terr = unpopulate(val, &r.Duration)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"endDateTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, &r.EndDateTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, &r.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c8a7c8f3db757fe1fffd4f8b65addfe2", "score": "0.5745911", "text": "func (future *VirtualMachineScaleSetsRestartFuture) UnmarshalJSON(body []byte) error {\n\tvar azFuture azure.Future\n\tif err := json.Unmarshal(body, &azFuture); err != nil {\n\t\treturn err\n\t}\n\tfuture.FutureAPI = &azFuture\n\tfuture.Result = future.result\n\treturn nil\n}", "title": "" }, { "docid": "32dc122f43bb3e885e50b7353edf2aaa", "score": "0.5742164", "text": "func (m *ManagedInstanceLongTermRetentionBackupProperties) 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 \"backupExpirationTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"BackupExpirationTime\", &m.BackupExpirationTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"backupStorageRedundancy\":\n\t\t\terr = unpopulate(val, \"BackupStorageRedundancy\", &m.BackupStorageRedundancy)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"backupTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"BackupTime\", &m.BackupTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"databaseDeletionTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"DatabaseDeletionTime\", &m.DatabaseDeletionTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"databaseName\":\n\t\t\terr = unpopulate(val, \"DatabaseName\", &m.DatabaseName)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"managedInstanceCreateTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"ManagedInstanceCreateTime\", &m.ManagedInstanceCreateTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"managedInstanceName\":\n\t\t\terr = unpopulate(val, \"ManagedInstanceName\", &m.ManagedInstanceName)\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": "a73e3e59213b3bba97f120c7262cd54a", "score": "0.57410383", "text": "func (r *RerunTumblingWindowTriggerActionParameters) 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 \"endTime\":\n\t\t\tvar aux timeRFC3339\n\t\t\terr = unpopulate(val, &aux)\n\t\t\tr.EndTime = (*time.Time)(&aux)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"maxConcurrency\":\n\t\t\terr = unpopulate(val, &r.MaxConcurrency)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"startTime\":\n\t\t\tvar aux timeRFC3339\n\t\t\terr = unpopulate(val, &aux)\n\t\t\tr.StartTime = (*time.Time)(&aux)\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": "d8ca4d5335b7c88450b21b53eff7c889", "score": "0.57402015", "text": "func (future *VirtualMachinesReapplyFuture) UnmarshalJSON(body []byte) error {\n\tvar azFuture azure.Future\n\tif err := json.Unmarshal(body, &azFuture); err != nil {\n\t\treturn err\n\t}\n\tfuture.FutureAPI = &azFuture\n\tfuture.Result = future.result\n\treturn nil\n}", "title": "" }, { "docid": "5c3a2fcf29cc2bef5ce6a0567d29d80a", "score": "0.57313186", "text": "func (v *VirtualMachineReimageParameters) 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 \"tempDisk\":\n\t\t\terr = unpopulate(val, \"TempDisk\", &v.TempDisk)\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": "c4ffa8b008af9e82b96ab59649b5130b", "score": "0.5725221", "text": "func (r *RerunTriggerResource) 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 \"properties\":\n\t\t\terr = unpopulate(val, &r.Properties)\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 r.SubResource.unmarshalInternal(rawMsg)\n}", "title": "" }, { "docid": "c258daa523c2fdf051c3866d7c350a72", "score": "0.5720234", "text": "func (d *DeviceRolloverDetails) 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 \"authorizationEligibility\":\n\t\t\terr = unpopulate(val, \"AuthorizationEligibility\", &d.AuthorizationEligibility)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"authorizationStatus\":\n\t\t\terr = unpopulate(val, \"AuthorizationStatus\", &d.AuthorizationStatus)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"inEligibilityReason\":\n\t\t\terr = unpopulate(val, \"InEligibilityReason\", &d.InEligibilityReason)\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": "c54317aa747125e11f20502858ba0866", "score": "0.5715004", "text": "func (future *FailoverGroupsForceFailoverAllowDataLossFuture) UnmarshalJSON(body []byte) error {\n\tvar azFuture azure.Future\n\tif err := json.Unmarshal(body, &azFuture); err != nil {\n\t\treturn err\n\t}\n\tfuture.FutureAPI = &azFuture\n\tfuture.Result = future.result\n\treturn nil\n}", "title": "" }, { "docid": "f4c0ec5ad1a738af8ad9c73da6b2c84e", "score": "0.5697665", "text": "func (r *RecoveryWalkResponse) 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 \"nextPlatformUpdateDomain\":\n\t\t\terr = unpopulate(val, \"NextPlatformUpdateDomain\", &r.NextPlatformUpdateDomain)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"walkPerformed\":\n\t\t\terr = unpopulate(val, \"WalkPerformed\", &r.WalkPerformed)\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": "f4c0ec5ad1a738af8ad9c73da6b2c84e", "score": "0.5697665", "text": "func (r *RecoveryWalkResponse) 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 \"nextPlatformUpdateDomain\":\n\t\t\terr = unpopulate(val, \"NextPlatformUpdateDomain\", &r.NextPlatformUpdateDomain)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"walkPerformed\":\n\t\t\terr = unpopulate(val, \"WalkPerformed\", &r.WalkPerformed)\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": "d08c337a08a3aca026c930afec82b47e", "score": "0.5696546", "text": "func (r *RestorePointSourceVMOSDisk) 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 \"caching\":\n\t\t\terr = unpopulate(val, \"Caching\", &r.Caching)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"diskRestorePoint\":\n\t\t\terr = unpopulate(val, \"DiskRestorePoint\", &r.DiskRestorePoint)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"diskSizeGB\":\n\t\t\terr = unpopulate(val, \"DiskSizeGB\", &r.DiskSizeGB)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"encryptionSettings\":\n\t\t\terr = unpopulate(val, \"EncryptionSettings\", &r.EncryptionSettings)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"managedDisk\":\n\t\t\terr = unpopulate(val, \"ManagedDisk\", &r.ManagedDisk)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &r.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"osType\":\n\t\t\terr = unpopulate(val, \"OSType\", &r.OSType)\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": "fb5391d1cc5a6fc7cea2a00208fe5337", "score": "0.56926006", "text": "func (future *VirtualMachineScaleSetRollingUpgradesCancelFuture) UnmarshalJSON(body []byte) error {\n\tvar azFuture azure.Future\n\tif err := json.Unmarshal(body, &azFuture); err != nil {\n\t\treturn err\n\t}\n\tfuture.FutureAPI = &azFuture\n\tfuture.Result = future.result\n\treturn nil\n}", "title": "" }, { "docid": "9bf265a8e2240428aedeaa2369d3714e", "score": "0.5691902", "text": "func (b *BackupProperties) 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 \"backupJobCreationType\":\n\t\t\terr = unpopulate(val, \"BackupJobCreationType\", &b.BackupJobCreationType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"backupPolicyId\":\n\t\t\terr = unpopulate(val, \"BackupPolicyID\", &b.BackupPolicyID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"backupType\":\n\t\t\terr = unpopulate(val, \"BackupType\", &b.BackupType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"createdOn\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"CreatedOn\", &b.CreatedOn)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"elements\":\n\t\t\terr = unpopulate(val, \"Elements\", &b.Elements)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"sizeInBytes\":\n\t\t\terr = unpopulate(val, \"SizeInBytes\", &b.SizeInBytes)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"ssmHostName\":\n\t\t\terr = unpopulate(val, \"SsmHostName\", &b.SsmHostName)\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": "161ae23c83cc1a5a9f2c19e57c264932", "score": "0.56910175", "text": "func (rdmd *RestorableDroppedManagedDatabase) 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 restorableDroppedManagedDatabaseProperties RestorableDroppedManagedDatabaseProperties\n\t\t\t\terr = json.Unmarshal(*v, &restorableDroppedManagedDatabaseProperties)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\trdmd.RestorableDroppedManagedDatabaseProperties = &restorableDroppedManagedDatabaseProperties\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\trdmd.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\trdmd.Tags = tags\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\trdmd.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\trdmd.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\trdmd.Type = &typeVar\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d008c9802140ea7a7b5b84b3ba63c9a1", "score": "0.5685272", "text": "func (future *VirtualMachinesRestartFuture) UnmarshalJSON(body []byte) error {\n\tvar azFuture azure.Future\n\tif err := json.Unmarshal(body, &azFuture); err != nil {\n\t\treturn err\n\t}\n\tfuture.FutureAPI = &azFuture\n\tfuture.Result = future.result\n\treturn nil\n}", "title": "" }, { "docid": "6be15998844811a3ee3938a44f888f9f", "score": "0.56850374", "text": "func (a *AzureDataLakeStoreSink) 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 \"copyBehavior\":\n\t\t\terr = unpopulate(val, &a.CopyBehavior)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"enableAdlsSingleFileParallel\":\n\t\t\terr = unpopulate(val, &a.EnableAdlsSingleFileParallel)\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 a.CopySink.unmarshalInternal(rawMsg)\n}", "title": "" }, { "docid": "c50ab61c20cdf9d74b2c3f756d1e5dd8", "score": "0.5683737", "text": "func (j *JobProperties) 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 \"backupPointInTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"BackupPointInTime\", &j.BackupPointInTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"backupType\":\n\t\t\terr = unpopulate(val, \"BackupType\", &j.BackupType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"dataStats\":\n\t\t\terr = unpopulate(val, \"DataStats\", &j.DataStats)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"deviceId\":\n\t\t\terr = unpopulate(val, \"DeviceID\", &j.DeviceID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"entityLabel\":\n\t\t\terr = unpopulate(val, \"EntityLabel\", &j.EntityLabel)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"entityType\":\n\t\t\terr = unpopulate(val, \"EntityType\", &j.EntityType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"isCancellable\":\n\t\t\terr = unpopulate(val, \"IsCancellable\", &j.IsCancellable)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"jobStages\":\n\t\t\terr = unpopulate(val, \"JobStages\", &j.JobStages)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"jobType\":\n\t\t\terr = unpopulate(val, \"JobType\", &j.JobType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"sourceDeviceId\":\n\t\t\terr = unpopulate(val, \"SourceDeviceID\", &j.SourceDeviceID)\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": "ca62bd57ad2a54e8370ca5088c0dee88", "score": "0.56828", "text": "func (r *RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration) 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 \"duration\":\n\t\t\terr = unpopulate(val, &r.Duration)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"endDateTime\":\n\t\t\terr = unpopulateTimeRFC3339(val, &r.EndDateTime)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, &r.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b633f838e2b9e9d734141ac474e5d404", "score": "0.5682557", "text": "func (j *JobExecutionBase) 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 \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &j.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &j.Name)\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": "161e26389d5cbd8d4658def08d9523ad", "score": "0.56824857", "text": "func (future *VirtualMachinesCaptureFuture) UnmarshalJSON(body []byte) error {\n\tvar azFuture azure.Future\n\tif err := json.Unmarshal(body, &azFuture); err != nil {\n\t\treturn err\n\t}\n\tfuture.FutureAPI = &azFuture\n\tfuture.Result = future.result\n\treturn nil\n}", "title": "" }, { "docid": "ab3916dd72a73d54658efe21748e345b", "score": "0.56753063", "text": "func (a *AzureDataExplorerSink) 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 \"flushImmediately\":\n\t\t\terr = unpopulate(val, &a.FlushImmediately)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"ingestionMappingAsJson\":\n\t\t\terr = unpopulate(val, &a.IngestionMappingAsJSON)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"ingestionMappingName\":\n\t\t\terr = unpopulate(val, &a.IngestionMappingName)\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 a.CopySink.unmarshalInternal(rawMsg)\n}", "title": "" }, { "docid": "c50da89c6dbee798dacfc9f76161fa04", "score": "0.5671311", "text": "func (b *Backup) 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 backupProperties BackupProperties\n\t\t\t\terr = json.Unmarshal(*v, &backupProperties)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tb.BackupProperties = &backupProperties\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\tb.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\tb.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\tb.Type = &typeVar\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b66098e8b2c24fe816ef5fcd6889c2d5", "score": "0.56681067", "text": "func (v *VolumeFailoverMetadata) 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 \"backupCreatedDate\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"BackupCreatedDate\", &v.BackupCreatedDate)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"backupElementId\":\n\t\t\terr = unpopulate(val, \"BackupElementID\", &v.BackupElementID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"backupId\":\n\t\t\terr = unpopulate(val, \"BackupID\", &v.BackupID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"backupPolicyId\":\n\t\t\terr = unpopulate(val, \"BackupPolicyID\", &v.BackupPolicyID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"sizeInBytes\":\n\t\t\terr = unpopulate(val, \"SizeInBytes\", &v.SizeInBytes)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"volumeId\":\n\t\t\terr = unpopulate(val, \"VolumeID\", &v.VolumeID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"volumeType\":\n\t\t\terr = unpopulate(val, \"VolumeType\", &v.VolumeType)\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": "a8dc0ac8ccec100a3052aaa13c59a4fc", "score": "0.5667841", "text": "func (a *AzureDatabricksDeltaLakeImportCommand) 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 \"dateFormat\":\n\t\t\terr = unpopulate(val, &a.DateFormat)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"timestampFormat\":\n\t\t\terr = unpopulate(val, &a.TimestampFormat)\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 a.ImportSettings.unmarshalInternal(rawMsg)\n}", "title": "" }, { "docid": "ae5b3568a8ddb19ce47323045c827634", "score": "0.566344", "text": "func (r *RerunTumblingWindowTrigger) 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 \"typeProperties\":\n\t\t\terr = unpopulate(val, &r.TypeProperties)\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 r.Trigger.unmarshalInternal(rawMsg)\n}", "title": "" } ]
8fb76bf4c863ee0cf5a4f61465f0ecf9
Deprecated: Use AnonymousBucketAccessMode.Descriptor instead.
[ { "docid": "ece185a68f2baa9bdb76c2296595256a", "score": "0.6912342", "text": "func (AnonymousBucketAccessMode) EnumDescriptor() ([]byte, []int) {\n\treturn file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_rawDescGZIP(), []int{1}\n}", "title": "" } ]
[ { "docid": "a17e1e7fd7f21394479863b9edd25043", "score": "0.5762777", "text": "func (*DriverGrantBucketAccessRequest) Descriptor() ([]byte, []int) {\n\treturn file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "bc3453ac15b8608ab64c2c769528b07b", "score": "0.5670363", "text": "func (*DriverRevokeBucketAccessRequest) Descriptor() ([]byte, []int) {\n\treturn file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_rawDescGZIP(), []int{13}\n}", "title": "" }, { "docid": "888c3fde578d86ed6f8089a52f8faf38", "score": "0.56318736", "text": "func (Asset_ResourceSpec_AccessMode) EnumDescriptor() ([]byte, []int) {\n\treturn file_cloud_dataplex_v1_data_proto_rawDescGZIP(), []int{3, 2, 1}\n}", "title": "" }, { "docid": "6197f331efdd3363519f175d479c5474", "score": "0.54486275", "text": "func (p *PureFBDriver) RevokeBucketAccess(id string, accountId string) error {\n\treturn nil\n}", "title": "" }, { "docid": "0d64fc08f57d3aad16bab506a6aee76d", "score": "0.54461706", "text": "func (*QueryAccessKeys) Descriptor() ([]byte, []int) {\n\treturn file_credential_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "7c747a1ff542fc24ab2525e4f7949792", "score": "0.53350693", "text": "func (*DriverGrantBucketAccessResponse) Descriptor() ([]byte, []int) {\n\treturn file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_rawDescGZIP(), []int{12}\n}", "title": "" }, { "docid": "203455b8565d6695e0d3ec936db7264e", "score": "0.52915215", "text": "func (BackendBucketCdnPolicy_CacheMode) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{40, 0}\n}", "title": "" }, { "docid": "04d379a6b1d83426fa3b56969097b5c3", "score": "0.5290217", "text": "func (AllowAccessState) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_cloud_policytroubleshooter_iam_v3_troubleshooter_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "230d9a8721da723fc0dd9800a70cbafa", "score": "0.52619034", "text": "func (p *PureFBDriver) GrantBucketAccess(id string, accountName string, accessPolicy string) (string, *bucket.BucketAccessCredentials, error) {\n\treturn \"fb-admin-account\", &bucket.BucketAccessCredentials{\n\t\tAccessKeyId: p.AccessKeyID,\n\t\tSecretAccessKey: p.SecretAccessKey,\n\t}, nil\n}", "title": "" }, { "docid": "3d13321d8dbb0c461d623525751cf412", "score": "0.52553916", "text": "func (*DriverRevokeBucketAccessResponse) Descriptor() ([]byte, []int) {\n\treturn file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_rawDescGZIP(), []int{14}\n}", "title": "" }, { "docid": "06cf433265c0ced7100bd4ecaa4278ff", "score": "0.52359986", "text": "func (UserGrantSearchKey) EnumDescriptor() ([]byte, []int) {\n\treturn file_auth_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "f4f266470aca73b96c5e173d91f5e64e", "score": "0.52326417", "text": "func (*AccessLevel) Descriptor() ([]byte, []int) {\n\treturn file_google_identity_accesscontextmanager_v1_access_level_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "afb829beb75500c360fa99580b35f2b3", "score": "0.523252", "text": "func (DenyAccessState) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_cloud_policytroubleshooter_iam_v3_troubleshooter_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "d831144d578cca4f6112e917f164517a", "score": "0.51875234", "text": "func (*QueryAccessKeysRequest) Descriptor() ([]byte, []int) {\n\treturn file_credential_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "6c5748e6f66a0a2702da0642e7b26470", "score": "0.51732695", "text": "func (*QueryAccessKeysData) Descriptor() ([]byte, []int) {\n\treturn file_credential_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "86fb65cbbd8d5f95592bbd482207d1f9", "score": "0.5167244", "text": "func (*AccessToken) Descriptor() ([]byte, []int) {\n\treturn file_coredocument_coredocument_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "1b528ed7d90399138d6f9a810e153aac", "score": "0.5164108", "text": "func (S3SignatureVersion) EnumDescriptor() ([]byte, []int) {\n\treturn file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "5dd51e07f48e5821b74d1a5fffa31a6f", "score": "0.51312536", "text": "func (*AccessToken) Descriptor() ([]byte, []int) {\n\treturn file_entity_admin_user_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "61320b20d3c99e8910c8e7bbbbabdc75", "score": "0.50684106", "text": "func (*DeleteAccessKeyRequest) Descriptor() ([]byte, []int) {\n\treturn file_credential_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "198749288f69656ae28d943b653aa163", "score": "0.50474674", "text": "func (Permission_Mode) EnumDescriptor() ([]byte, []int) {\n\treturn file_core_v1_core_proto_rawDescGZIP(), []int{58, 0}\n}", "title": "" }, { "docid": "17432d5e65cd43dccec929c0712dd669", "score": "0.5042842", "text": "func (*GetAccessKeyRequest) Descriptor() ([]byte, []int) {\n\treturn file_credential_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "4fcf379a509fef2e0ebfe9ef5b942ef1", "score": "0.50201476", "text": "func (*Secret) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_metastore_v1alpha_metastore_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "402777b4dd058db6fec7e76803febe18", "score": "0.50154847", "text": "func (*QuotaGrant) Descriptor() ([]byte, []int) {\n\treturn file_mock_core_proto_rawDescGZIP(), []int{27}\n}", "title": "" }, { "docid": "6a3c1196fcbc9dcb880c7c02bf03bf74", "score": "0.49977672", "text": "func (Secret_Status) EnumDescriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_lockbox_v1_secret_proto_rawDescGZIP(), []int{0, 0}\n}", "title": "" }, { "docid": "c2852b9592582191478b86ba7d7aae0e", "score": "0.4996316", "text": "func (*QueryAccessKeysResponse) Descriptor() ([]byte, []int) {\n\treturn file_credential_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "2e8976b3380ba1a48c90628ce825bc2c", "score": "0.4990138", "text": "func (MyProjectOrgSearchKey) EnumDescriptor() ([]byte, []int) {\n\treturn file_auth_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "1a170eda4ba019c0dd44af64a4e7c091", "score": "0.49826628", "text": "func (*Secret) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_lockbox_v1_secret_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "6ad8f40eccd884958e4aaeb96b7641f5", "score": "0.49804455", "text": "func (MFAState) EnumDescriptor() ([]byte, []int) {\n\treturn file_auth_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "f10825ca9bd42fc63bcb865aa0e9ae41", "score": "0.49792424", "text": "func (AuthorizationLoggingOptions_PermissionType) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{25, 0}\n}", "title": "" }, { "docid": "0316c5e1e8e7eb2d162a98f0381e51c7", "score": "0.49755308", "text": "func (*OrgIamPolicy) Descriptor() ([]byte, []int) {\n\treturn file_admin_proto_rawDescGZIP(), []int{17}\n}", "title": "" }, { "docid": "bde130760cb440b2f89805446dedbb07", "score": "0.497526", "text": "func (AccessState) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_cloud_policytroubleshooter_v1_explanations_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "74b180aeca4fd966150ba9c067fffa4e", "score": "0.49711898", "text": "func (*MyPermissions) Descriptor() ([]byte, []int) {\n\treturn file_auth_proto_rawDescGZIP(), []int{34}\n}", "title": "" }, { "docid": "ead09dd01a5e2b10e8d1e26a7ed63274", "score": "0.49615207", "text": "func (*CreateAccessKeyRequest) Descriptor() ([]byte, []int) {\n\treturn file_credential_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "96402b29d2cfd5056c67061d940a6ea5", "score": "0.4961263", "text": "func (WriteRequest_Atomicity) EnumDescriptor() ([]byte, []int) {\n\treturn file_bfruntime_proto_rawDescGZIP(), []int{0, 0}\n}", "title": "" }, { "docid": "6385fc5ddf431ebc0de250fad6906637", "score": "0.49393123", "text": "func (Lock_State) EnumDescriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_marketplace_licensemanager_v1_lock_proto_rawDescGZIP(), []int{0, 0}\n}", "title": "" }, { "docid": "0925bd7ebc06bcb0bbc64c5f84ad90f8", "score": "0.49360815", "text": "func (*OrgIamPolicyID) Descriptor() ([]byte, []int) {\n\treturn file_admin_proto_rawDescGZIP(), []int{20}\n}", "title": "" }, { "docid": "74ccacd4a82ef6d072d268ee6dd6cea4", "score": "0.4930606", "text": "func (ResourceQuota) EnumDescriptor() ([]byte, []int) {\n\treturn file_alameda_api_v1alpha1_datahub_common_types_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "56b8030683b673ca10a1a8cfa87010ea", "score": "0.49295905", "text": "func (f *Fake) RevokeBucketAccess(id string, accountId string) error {\n\tlogrus.Info(\"bucket_driver.Fake revoke bucket received\")\n\treturn nil\n}", "title": "" }, { "docid": "f109eddf502ac17d407a2ae6380df1ca", "score": "0.4928831", "text": "func (IamPolicyAnalysisOutputConfig_BigQueryDestination_PartitionKey) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_cloud_asset_v1_asset_service_proto_rawDescGZIP(), []int{25, 1, 0}\n}", "title": "" }, { "docid": "95f06e7c939366844e7f29fd624756e2", "score": "0.49265847", "text": "func (AccessConfig_Type) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{8, 1}\n}", "title": "" }, { "docid": "dd34fd064386c9e3887d0f288c46108b", "score": "0.49258792", "text": "func (Volume_StorageType) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_cloud_baremetalsolution_v2_volume_proto_rawDescGZIP(), []int{0, 0}\n}", "title": "" }, { "docid": "384615e9dcbc606d5bd29a5d982b9525", "score": "0.49224344", "text": "func (*PermanentLockedAccount) Descriptor() ([]byte, []int) {\n\treturn file_cosmos_vesting_v1beta1_vesting_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "1715a8dc4c1f4f9e69d682daa745cc3b", "score": "0.49204513", "text": "func (*ClearBucketRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_api_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "228fa476376824b559cdfc1c6bc8593e", "score": "0.49200854", "text": "func (PreservedStatePreservedDisk_Mode) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{352, 1}\n}", "title": "" }, { "docid": "08c29f8b5d2bd7bf960fc82d6d8d1f26", "score": "0.4917541", "text": "func (*BucketInfo) Descriptor() ([]byte, []int) {\n\treturn file_collector_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "192e0a1bf686f26266c6656bcba3ff0e", "score": "0.49168986", "text": "func (Snapshot_StorageBytesStatus) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{454, 1}\n}", "title": "" }, { "docid": "826648c864431b87522fdc0ae6015b36", "score": "0.49096346", "text": "func (AsymmetricSignatureAlgorithm) EnumDescriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_kms_v1_asymmetricsignature_asymmetric_signature_key_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "fa631aad05252b879031c87a108c5b9f", "score": "0.49053502", "text": "func (*DeleteSignedUrlKeyBackendBucketRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{570}\n}", "title": "" }, { "docid": "42db805ca0349c5501dc23bc945127aa", "score": "0.48981884", "text": "func (AuthenticationType) EnumDescriptor() ([]byte, []int) {\n\treturn file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "d846c9f95f49a5d2f6b3ec11a058d429", "score": "0.48978043", "text": "func (Quota_Metric) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{353, 0}\n}", "title": "" }, { "docid": "85c8bf86d17cc5a9a346e8a9d78b647e", "score": "0.48939964", "text": "func (*DriverDeleteBucketRequest) Descriptor() ([]byte, []int) {\n\treturn file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "46468ff5a17103c6de65359a62755150", "score": "0.4892393", "text": "func (AllocationSpecificSKUAllocationAllocatedInstancePropertiesReservedDisk_Interface) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{15, 0}\n}", "title": "" }, { "docid": "3197afbea375dcde3eaa896866d986e6", "score": "0.48920333", "text": "func (CrawlerService_AdminPermission) EnumDescriptor() ([]byte, []int) {\n\treturn file_examples_protoconf_src_crawler_crawler_proto_rawDescGZIP(), []int{1, 0}\n}", "title": "" }, { "docid": "550d824e8fc4694ad19530ef5102bbe2", "score": "0.4890202", "text": "func (*BackendBucket) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{41}\n}", "title": "" }, { "docid": "170449ef398035d595f8bd5da901a74d", "score": "0.4885597", "text": "func newOpenBucket() OpenBucket {\n\treturn Bucket{}\n}", "title": "" }, { "docid": "6061842f2f50d256d2d30faa823f2df5", "score": "0.4884191", "text": "func (IamMemberSearchKey) EnumDescriptor() ([]byte, []int) {\n\treturn file_admin_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "ea1e6f19f9c0b1192c82704e07c38ab3", "score": "0.48779377", "text": "func (*GetBackendBucketRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{571}\n}", "title": "" }, { "docid": "2927db1703a3339afbd45b6dbe089050", "score": "0.48771054", "text": "func (*PatchBackendBucketRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{574}\n}", "title": "" }, { "docid": "9ba4e0201ebf5cf6862d636e211cd27b", "score": "0.48723835", "text": "func (UserState) EnumDescriptor() ([]byte, []int) {\n\treturn file_auth_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "6ce80ef644e15e0c877abeb0b37ccf38", "score": "0.48718986", "text": "func (BackendServiceCdnPolicy_CacheMode) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{45, 0}\n}", "title": "" }, { "docid": "0fa230661f5b4f5076b2bd775bedf922", "score": "0.48710504", "text": "func (*DeleteBackendBucketRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{569}\n}", "title": "" }, { "docid": "18afb96cdd300d84ea999bbf78e8cb06", "score": "0.48663414", "text": "func (*UpdateBackendBucketRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{575}\n}", "title": "" }, { "docid": "e4f6f89f71124b385233a6832e52c729", "score": "0.48634392", "text": "func (Deployment_LockState) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_cloud_config_v1_config_proto_rawDescGZIP(), []int{0, 2}\n}", "title": "" }, { "docid": "89069b1957313f6bfed2142c2ea9e047", "score": "0.48612648", "text": "func (*ListBackendBucketsRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{573}\n}", "title": "" }, { "docid": "913d1741e12dfbc088cec4e804eca0fe", "score": "0.4860468", "text": "func (*AddSignedUrlKeyBackendBucketRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{568}\n}", "title": "" }, { "docid": "7b805bebca2951e6e726cf2471a890e3", "score": "0.48602095", "text": "func (*DefaultPasswordLockoutPolicy) Descriptor() ([]byte, []int) {\n\treturn file_admin_proto_rawDescGZIP(), []int{67}\n}", "title": "" }, { "docid": "d8cf76e89fc2d75edda67c99a9afb979", "score": "0.4860087", "text": "func (*AuthorizedInfo) Descriptor() ([]byte, []int) {\n\treturn file_BrokerService_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "5b53ef75a9ea81161df4f1d0899da721", "score": "0.485989", "text": "func (AttachedDisk_Mode) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{22, 1}\n}", "title": "" }, { "docid": "9f84f1655139fe339dfe15a7aa5ebf90", "score": "0.48587427", "text": "func (*AccountFanAchieved) Descriptor() ([]byte, []int) {\n\treturn file_ex_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "de1b2de04f9da9d6789247b33c34ce66", "score": "0.48525026", "text": "func (AttachedDisk_Interface) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{22, 0}\n}", "title": "" }, { "docid": "d6fbf2c3cf14a2a924fcbee952bd81da", "score": "0.48470116", "text": "func (Instance_PrivateIpv6GoogleAccess) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{179, 0}\n}", "title": "" }, { "docid": "373cae20144c5a1aa2f1e4cc3485ffd4", "score": "0.48452088", "text": "func (PermissionAction) EnumDescriptor() ([]byte, []int) {\n\treturn file_schema_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "4d64eb4c00fd1e0f1676d51a38dff318", "score": "0.48448673", "text": "func (f *Fake) GrantBucketAccess(id string, accountName string, accessPolicy string) (string, *bucket.BucketAccessCredentials, error) {\n\tlogrus.Info(\"bucket_driver.Fake access bucket received\")\n\treturn accountName,\n\t\t&bucket.BucketAccessCredentials{\n\t\t\tAccessKeyId: \"YOUR-ACCESSKEYID\",\n\t\t\tSecretAccessKey: \"YOUR-SECRETACCESSKEY\",\n\t\t}, nil\n}", "title": "" }, { "docid": "3d586617646dd969331906e172eb4963", "score": "0.48443866", "text": "func (Backend_BalancingMode) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{39, 0}\n}", "title": "" }, { "docid": "8b5c423a60e704dcd1b2ca60cb4ada01", "score": "0.48440853", "text": "func (*IamPolicyAnalysisQuery_AccessSelector) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_asset_v1_asset_service_proto_rawDescGZIP(), []int{22, 2}\n}", "title": "" }, { "docid": "b6720cf4857654c7734051427c02c1e9", "score": "0.48415056", "text": "func (*OrgIamPolicyView) Descriptor() ([]byte, []int) {\n\treturn file_admin_proto_rawDescGZIP(), []int{18}\n}", "title": "" }, { "docid": "fc0bb6b2a78248d212fc05fc843d62bd", "score": "0.48407304", "text": "func (*ChangeIamMemberRequest) Descriptor() ([]byte, []int) {\n\treturn file_admin_proto_rawDescGZIP(), []int{24}\n}", "title": "" }, { "docid": "350f189f952faa7c24d55f6db6938944", "score": "0.48339975", "text": "func (AttachedFilesystemSpec_Mode) EnumDescriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_compute_v1_instancegroup_instance_group_proto_rawDescGZIP(), []int{9, 0}\n}", "title": "" }, { "docid": "5c4f4e060265aab83d4e33fb80b65ccf", "score": "0.48337805", "text": "func (OrgSearchKey) EnumDescriptor() ([]byte, []int) {\n\treturn file_admin_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "050f30ae8b25653b0b3e9875872fab6a", "score": "0.48325026", "text": "func (*TestIamPermissionsRegionDiskRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{901}\n}", "title": "" }, { "docid": "c118ed618a682f5a6cab9dfd626bf1ae", "score": "0.4827589", "text": "func (Version_Status) EnumDescriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_lockbox_v1_secret_proto_rawDescGZIP(), []int{1, 0}\n}", "title": "" }, { "docid": "e20d8524c9fad89bd6dd1bc767c37aaa", "score": "0.4825565", "text": "func (*StorageAction) Descriptor() ([]byte, []int) {\n\treturn file_storage_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "28dbbc29adfb5d290340e446b88cd2e2", "score": "0.48231798", "text": "func (*AppAccessToken) Descriptor() ([]byte, []int) {\n\treturn file_common_common_proto_rawDescGZIP(), []int{16}\n}", "title": "" }, { "docid": "356d597b0055d62b23eaa0242b8c8ab4", "score": "0.48226538", "text": "func driveViewBucket(tx *bolt.Tx, driveID resource.ID) *bolt.Bucket {\n\tdrv := driveBucket(tx, driveID)\n\tif drv == nil {\n\t\treturn nil\n\t}\n\treturn drv.Bucket([]byte(ViewBucket))\n}", "title": "" }, { "docid": "b9ca2ce1b441f646e2fedfca85a45a7c", "score": "0.48211333", "text": "func (UserSessionState) EnumDescriptor() ([]byte, []int) {\n\treturn file_auth_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "9b9a99de3099c290e819616ce9a392fd", "score": "0.48203903", "text": "func (*Denied) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{107}\n}", "title": "" }, { "docid": "35904aaa5ac67ecaeef48b5ebcbb8fad", "score": "0.48193395", "text": "func (*HashOnlyNotaryStorage) Descriptor() ([]byte, []int) {\n\treturn file_storage_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "731a4245e5b0ac4d992a2444cda0576f", "score": "0.48169854", "text": "func (*GetAccessKeyResponse) Descriptor() ([]byte, []int) {\n\treturn file_credential_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "906246968b9faa90a9438b7b7aa0159a", "score": "0.48139626", "text": "func (*Permission) Descriptor() ([]byte, []int) {\n\treturn file_permission_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "f49589520730199e09a1863076acf05b", "score": "0.48082668", "text": "func (*Authorization) Descriptor() ([]byte, []int) {\n\treturn file_xds_workload_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "c06a2aaa41e8af824bf5b8d7c3958dba", "score": "0.48068294", "text": "func (PreservedStatePreservedDisk_AutoDelete) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{352, 0}\n}", "title": "" }, { "docid": "1ab1da6ceaaadb62cf9c17e4d5c9385a", "score": "0.48056436", "text": "func (InstanceProperties_PrivateIpv6GoogleAccess) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{67, 0}\n}", "title": "" }, { "docid": "8e14bf2efc560f04bf595e847086a0b6", "score": "0.48036715", "text": "func (*EncryptShareNotaryStorage) Descriptor() ([]byte, []int) {\n\treturn file_storage_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "40f9b0bb492d13fe5e66075583c43e28", "score": "0.48031193", "text": "func (IdpState) EnumDescriptor() ([]byte, []int) {\n\treturn file_admin_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "a62bf18d6c6c472dab04725c5f2ece31", "score": "0.48025876", "text": "func (*DriverCreateBucketRequest) Descriptor() ([]byte, []int) {\n\treturn file_sigs_k8s_io_container_object_storage_interface_spec_cosi_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "2d32ba89283a2caa3561d6eb4fd7a758", "score": "0.48006174", "text": "func (MigrationPayload_Algorithm) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_auth_proto_rawDescGZIP(), []int{0, 0}\n}", "title": "" }, { "docid": "c70da806b331d67e2be07b2eb7da1e18", "score": "0.47981673", "text": "func (*WatchPermissionsResponse_PageTokenChange) Descriptor() ([]byte, []int) {\n\treturn edgelq_iam_proto_v1alpha2_permission_service_proto_rawDescGZIP(), []int{8, 0}\n}", "title": "" }, { "docid": "aa8b5114d94b555127ecfab59a31a40c", "score": "0.47957698", "text": "func (b *Bucket) openBucket(value []byte) *Bucket {\n\tpanic(\"not implemented\")\n}", "title": "" }, { "docid": "5e6c0e3fabaa706f9830bc90ac4761b4", "score": "0.47894195", "text": "func (StatefulPolicyPreservedStateDiskDevice_AutoDelete) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{467, 0}\n}", "title": "" }, { "docid": "c75dda6cf8276357a09207939339ff30", "score": "0.4786183", "text": "func (*TestIamPermissionsLicenseRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{792}\n}", "title": "" } ]
1b6c91098aa09a899f9716093ae7a62f
GetAverageInboundRoundTripDelay gets the averageInboundRoundTripDelay property value. The average inbound stream network round trip delay.
[ { "docid": "7350cfb18f1aff9d2c70322bc9fbd93f", "score": "0.7513565", "text": "func (m *TeleconferenceDeviceMediaQuality) GetAverageInboundRoundTripDelay()(*i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ISODuration) {\n return m.averageInboundRoundTripDelay\n}", "title": "" } ]
[ { "docid": "2b356342f3d5c7ded5244a87e6d9df48", "score": "0.665023", "text": "func (m *TeleconferenceDeviceMediaQuality) SetAverageInboundRoundTripDelay(value *i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ISODuration)() {\n m.averageInboundRoundTripDelay = value\n}", "title": "" }, { "docid": "fa850021250feb6e87318371b7864281", "score": "0.6490925", "text": "func (m *TeleconferenceDeviceMediaQuality) GetAverageOutboundRoundTripDelay()(*i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ISODuration) {\n return m.averageOutboundRoundTripDelay\n}", "title": "" }, { "docid": "0c5a0acc3b83ef19be7ffd39f2ed4450", "score": "0.5443233", "text": "func (m *TeleconferenceDeviceMediaQuality) SetAverageOutboundRoundTripDelay(value *i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ISODuration)() {\n m.averageOutboundRoundTripDelay = value\n}", "title": "" }, { "docid": "9fb262cf51fc1681bffd7829a76b2748", "score": "0.5409057", "text": "func (m *TeleconferenceDeviceMediaQuality) GetMaximumInboundRoundTripDelay()(*i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ISODuration) {\n return m.maximumInboundRoundTripDelay\n}", "title": "" }, { "docid": "6730bff7bf175e0549e72df3331d7ab4", "score": "0.5320652", "text": "func (game *Game) GetAvgLatency() (avg time.Duration) {\n\tavg = 0\n\tvar sum time.Duration\n\tvar count time.Duration\n\tfor _, latency := range game.latency.MyPing {\n\t\tsum += latency\n\t\tcount++\n\t}\n\tif count != 0 {\n\t\tavg = sum / count\n\t}\n\treturn avg\n}", "title": "" }, { "docid": "ff31066305ac7f4e803eea03eb97f4d0", "score": "0.5162323", "text": "func (s Server) SetAverageRTT(rtt time.Duration) Server {\n\ts.AverageRTT = rtt\n\ts.AverageRTTSet = true\n\treturn s\n}", "title": "" }, { "docid": "eea81871cc526d76d14189838a92e718", "score": "0.5029287", "text": "func (m *TeleconferenceDeviceMediaQuality) GetAverageInboundPacketLossRateInPercentage()(*float64) {\n return m.averageInboundPacketLossRateInPercentage\n}", "title": "" }, { "docid": "5030cc0bd8eaa4d08a9c03f62bea212b", "score": "0.49977863", "text": "func (m *TeleconferenceDeviceMediaQuality) GetAverageInboundJitter()(*i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ISODuration) {\n return m.averageInboundJitter\n}", "title": "" }, { "docid": "5e846c616e23b43509afce63547569e8", "score": "0.49553537", "text": "func (d *DiffMap) GetAverageDiff() float32 {\n\twidth := len(d.Diffs)\n\theight := len(d.Diffs[0])\n\tavg := d.Total / int64(width*height)\n\treturn float32(avg) / granularity\n}", "title": "" }, { "docid": "b734a2fdfc77688c4317835dc92f8cee", "score": "0.48765513", "text": "func (o *WorkflowPropertiesAllOf) GetRetryDelay() int64 {\n\tif o == nil || o.RetryDelay == nil {\n\t\tvar ret int64\n\t\treturn ret\n\t}\n\treturn *o.RetryDelay\n}", "title": "" }, { "docid": "256d406e899093a5117d645363dbda40", "score": "0.47700924", "text": "func (o *SystemDiagnosticsSnapshotDTO) GetProcessorLoadAverage() float64 {\n\tif o == nil || o.ProcessorLoadAverage == nil {\n\t\tvar ret float64\n\t\treturn ret\n\t}\n\treturn *o.ProcessorLoadAverage\n}", "title": "" }, { "docid": "057bc4057d303ba91e6ba2934ea7eec7", "score": "0.4667609", "text": "func (rs *rangeScanner) avgScan() time.Duration {\n\trs.completedScan.L.Lock()\n\tdefer rs.completedScan.L.Unlock()\n\treturn time.Duration(rs.total.Nanoseconds() / int64(rs.count))\n}", "title": "" }, { "docid": "7ea93a66c81408c733a34c886e7ee153", "score": "0.46531165", "text": "func (d *data) Average() time.Duration {\n\tvar rc time.Duration\n\tif d.count > 0 {\n\t\trc = d.totalTime / time.Duration(d.count)\n\t}\n\treturn rc\n}", "title": "" }, { "docid": "7155c8b487ca76cfdfbe127689128cc5", "score": "0.4633984", "text": "func (r *RollingWindow) Average() float64 {\n\tr.RLock()\n\tdefer r.RUnlock()\n\n\ttotal := 0.0\n\n\tfor _, v := range r.values {\n\t\ttotal = total + v\n\t}\n\n\tif total == 0 {\n\t\treturn total\n\t}\n\n\treturn total / float64(r.size)\n}", "title": "" }, { "docid": "962ab1dfdf55d3d6b5c9fe9cf44a904a", "score": "0.46329674", "text": "func (r *RollingWindow) AverageSince(w time.Duration) (float64, error) {\n\tr.RLock()\n\tdefer r.RUnlock()\n\n\tif w > r.window {\n\t\treturn 0, ErrWrongWindowSize\n\t}\n\n\tsum := 0.0\n\tcount := 0.0\n\twindowSize := int(w / r.granularity)\n\n\tfor i := 0; i < windowSize; i++ {\n\t\tpos := r.position - i\n\t\tif pos < 0 {\n\t\t\tpos += len(r.values)\n\t\t}\n\n\t\tsum += r.values[pos]\n\t\tcount++\n\t}\n\n\treturn sum / count, nil\n}", "title": "" }, { "docid": "fdf32131db46d22fb826b7b0c60463d4", "score": "0.45810863", "text": "func (s *lossRecovery) roundTripTime() time.Duration {\n\tif s.smoothedRTT > 0 {\n\t\treturn s.smoothedRTT\n\t}\n\treturn initialRTT\n}", "title": "" }, { "docid": "877162b8aea139be62f9d32c284f5fac", "score": "0.45365167", "text": "func (s *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv4ExternalReachability_Prefix) GetDelayMetric() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv4ExternalReachability_Prefix_DelayMetric {\n\tif s != nil && s.DelayMetric != nil {\n\t\treturn s.DelayMetric\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "605e50ec8891279af54c3a2c234d8bd1", "score": "0.45087582", "text": "func (this *DataStore) GetAverage() float64 {\n\tthis.RLock()\n\tdefer func() {\n\t\tthis.RUnlock()\n\t}()\n\treturn float64(this.sum) / float64(this.size)\n}", "title": "" }, { "docid": "84726b0d73503a73622c049a89e0aa06", "score": "0.4473981", "text": "func (s *BaseBanditArm) GetAverageReward() float64 {\n\tvar result float64\n\tfor _, reward := range s.rewards {\n\t\tresult += reward\n\t}\n\treturn result / float64(s.count)\n}", "title": "" }, { "docid": "16b880c0e60f2eb0fa6b646847333249", "score": "0.4459132", "text": "func (v *ContinueAsNewWorkflowExecutionDecisionAttributes) GetBackoffStartIntervalInSeconds() (o int32) {\n\tif v != nil && v.BackoffStartIntervalInSeconds != nil {\n\t\treturn *v.BackoffStartIntervalInSeconds\n\t}\n\treturn\n}", "title": "" }, { "docid": "2887a0a98a0fae6a6145f4734ae93f17", "score": "0.4455833", "text": "func (t *Lsp_Tlv_Ipv4ExternalReachability_Prefix) GetDelayMetric() *Lsp_Tlv_Ipv4ExternalReachability_Prefix_DelayMetric {\n\tif t != nil && t.DelayMetric != nil {\n\t\treturn t.DelayMetric\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0c99b796568ded6fbf71e29f66f55081", "score": "0.44498196", "text": "func TimeAverage(values []time.Duration) float64 {\n\tl := len(values)\n\tif l <= 0 {\n\t\treturn float64(0.0)\n\t}\n\ts := time.Duration(0)\n\tfor _, d := range values {\n\t\ts += d\n\t}\n\treturn float64(s) / float64(l)\n}", "title": "" }, { "docid": "36a9b4969386de11848b8d59322ca3bf", "score": "0.4448133", "text": "func GetLoadAvg() (LoadAvg, error) {\n\treturn getLoadAvg()\n}", "title": "" }, { "docid": "20bc254763fac19e64990d53081f624c", "score": "0.44423568", "text": "func (ts *Timeseries) GetAvgRate(since time.Duration) (hits float64, bytes float64) {\n\tfor _, row := range ts.GetRowsSince(since) {\n\t\thits += float64(row.totalHits)\n\t\tbytes += float64(row.totalBits)\n\t}\n\tsecs := float64(since / time.Second)\n\treturn hits / secs, bytes / secs\n}", "title": "" }, { "docid": "da2f5d283ecb85b374eccfdb2a2ac723", "score": "0.44413197", "text": "func (m *TeleconferenceDeviceMediaQuality) GetMaximumOutboundRoundTripDelay()(*i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ISODuration) {\n return m.maximumOutboundRoundTripDelay\n}", "title": "" }, { "docid": "f686f3a2f42d55e11a883efbc238491a", "score": "0.44290748", "text": "func (_TBTCSystem *TBTCSystemSession) GetGovernanceTimeDelay() (*big.Int, error) {\n\treturn _TBTCSystem.Contract.GetGovernanceTimeDelay(&_TBTCSystem.CallOpts)\n}", "title": "" }, { "docid": "6934a36ea08d429e9fedecec1aaafc72", "score": "0.44266573", "text": "func (v *StartChildWorkflowExecutionInitiatedEventAttributes) GetDelayStartSeconds() (o int32) {\n\tif v != nil && v.DelayStartSeconds != nil {\n\t\treturn *v.DelayStartSeconds\n\t}\n\treturn\n}", "title": "" }, { "docid": "04669ae563165f352539e74c42a61341", "score": "0.44222862", "text": "func (s Stats) AvgLatency() time.Duration {\n\trequests := s.Requests\n\tif requests == 0 {\n\t\trequests = 1\n\t}\n\treturn s.TotalLatency / time.Duration(requests)\n}", "title": "" }, { "docid": "f4d8e2de28b531e17dd5f2169a247d48", "score": "0.44219556", "text": "func (n *RollingNumber) AverageInSecond(key string) int64 {\n\treturn n.Sum(key) * 1000 / n.timeInMilliseconds\n}", "title": "" }, { "docid": "5c3b6a8ded8b501d3573af02c755c6d9", "score": "0.44112113", "text": "func (e *Event) DelaySeconds() int64 {\n\treturn int64(math.Min(\n\t\tmath.Pow(2, float64(e.retryCount+1)),\n\t\t15*60, // Max is 15 minutes\n\t))\n}", "title": "" }, { "docid": "c77a055f4fe18e6f018b381b644cd7a5", "score": "0.43955976", "text": "func (v *StartWorkflowExecutionRequest) GetDelayStartSeconds() (o int32) {\n\tif v != nil && v.DelayStartSeconds != nil {\n\t\treturn *v.DelayStartSeconds\n\t}\n\treturn\n}", "title": "" }, { "docid": "867f618d3d5599bf92e2388468c71791", "score": "0.43840232", "text": "func (rsm *RTTStatsManager) SmoothedRTT() time.Duration {\n\tminSmoothedRTT := time.Duration(9999999999) //9999999999 is like inf in RTT sence... (~10sec)\n\t//TODO Not tested\n\tfor _, rttStats := range rsm.rttStatsMap {\n\t\tif minSmoothedRTT > rttStats.smoothedRTT && rttStats.smoothedRTT > 0 {\n\t\t\tminSmoothedRTT = rttStats.smoothedRTT\n\t\t}\n\t}\n\treturn minSmoothedRTT\n}", "title": "" }, { "docid": "2f21bb3b92e1aafbb8d424735a06551c", "score": "0.4377052", "text": "func (o ExplainQueryStageResponseOutput) WaitRatioAvg() pulumi.Float64Output {\n\treturn o.ApplyT(func(v ExplainQueryStageResponse) float64 { return v.WaitRatioAvg }).(pulumi.Float64Output)\n}", "title": "" }, { "docid": "ffa52307bb933c82706652908ead93f7", "score": "0.4372887", "text": "func (s *BinaryColumnStatisticsData) SetAverageLength(v float64) *BinaryColumnStatisticsData {\n\ts.AverageLength = &v\n\treturn s\n}", "title": "" }, { "docid": "32fb5ed0dc88d0ff04023b00edd3a4c0", "score": "0.43725693", "text": "func (r *Queue) DelaySeconds() pulumi.IntOutput {\n\treturn (pulumi.IntOutput)(r.s.State[\"delaySeconds\"])\n}", "title": "" }, { "docid": "5efe3b4539ed88dc7a8f70a0d8553007", "score": "0.4370527", "text": "func (_TBTCSystem *TBTCSystemCaller) GetGovernanceTimeDelay(opts *bind.CallOpts) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _TBTCSystem.contract.Call(opts, out, \"getGovernanceTimeDelay\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "c1740682252ff50e37944217a0841b0c", "score": "0.43362942", "text": "func (v *RetryPolicy) GetInitialIntervalInSeconds() (o int32) {\n\tif v != nil {\n\t\treturn v.InitialIntervalInSeconds\n\t}\n\treturn\n}", "title": "" }, { "docid": "d5430af5827c64ecbb839e69e4830232", "score": "0.4327097", "text": "func (stage *PipelineStage) AverageExecutionTime() float64 {\r\n\ttotalDuration := float64(0.0)\r\n\tfor _, worker := range stage.Workers {\r\n\t\ttotalDuration += float64(worker.Stats.ExecutionTime)\r\n\t}\r\n\treturn totalDuration / float64(len(stage.Workers))\r\n}", "title": "" }, { "docid": "ed130c505fdc4e73efac728e9c44420c", "score": "0.4317948", "text": "func (v *WorkflowExecutionContinuedAsNewEventAttributes) GetBackoffStartIntervalInSeconds() (o int32) {\n\tif v != nil && v.BackoffStartIntervalInSeconds != nil {\n\t\treturn *v.BackoffStartIntervalInSeconds\n\t}\n\treturn\n}", "title": "" }, { "docid": "1c5e185879433e4980e0c78ced50c4dd", "score": "0.431299", "text": "func (s *udtSocketCc) GetPacketSendPeriod() time.Duration {\n\treturn s.sndPeriod\n}", "title": "" }, { "docid": "e658941e9689c309b89b6eaa19189dae", "score": "0.43127507", "text": "func meanTravelTime(persons *sync.Map) float32 {\n\ttotalTravelTime := 0\n\tpersonCount := 0\n\tpersons.Range(func(_, value interface{}) bool {\n\t\tperson := value.(*Person)\n\t\ttotalTravelTime += person.TravelTime\n\t\tpersonCount++\n\t\treturn true\n\t})\n\treturn float32(totalTravelTime) / float32(personCount)\n}", "title": "" }, { "docid": "96362f18814bdd12c39c119c01c169c8", "score": "0.4312071", "text": "func (v *SignalWithStartWorkflowExecutionRequest) GetDelayStartSeconds() (o int32) {\n\tif v != nil && v.DelayStartSeconds != nil {\n\t\treturn *v.DelayStartSeconds\n\t}\n\treturn\n}", "title": "" }, { "docid": "1159ad5fd7f3ed59e6c191fce59b9f60", "score": "0.4309624", "text": "func (_TBTCSystem *TBTCSystemCallerSession) GetGovernanceTimeDelay() (*big.Int, error) {\n\treturn _TBTCSystem.Contract.GetGovernanceTimeDelay(&_TBTCSystem.CallOpts)\n}", "title": "" }, { "docid": "3ce610e4c010be5274c9a0f7c1a81abf", "score": "0.43087128", "text": "func (s *StringColumnStatisticsData) SetAverageLength(v float64) *StringColumnStatisticsData {\n\ts.AverageLength = &v\n\treturn s\n}", "title": "" }, { "docid": "6908d6c7cc044153ba2ebaf5a47d7a28", "score": "0.43043864", "text": "func (m Message) GetAvgPrxPrecision(f *field.AvgPrxPrecisionField) quickfix.MessageRejectError {\n\treturn m.Body.Get(f)\n}", "title": "" }, { "docid": "2054a26e36409394e463233a022e7f9f", "score": "0.42847136", "text": "func (l *Lock) RetryDelay() time.Duration {\n\treturn l.retryDelay\n}", "title": "" }, { "docid": "a297c2ed2ca2fc53ef9645e91b91da08", "score": "0.42804632", "text": "func (s *Server) GetAverage(stream calcpb.CalcService_GetAverageServer) error {\n\tavg, sum := float64(0), float64(0)\n\trequestID := \"\"\n\tfor n := 1; n <= 100000; n++ {\n\t\treq, err := stream.Recv()\n\t\tif err == io.EOF {\n\t\t\tlog.Printf(\"[%s] average => %v\", requestID, avg)\n\t\t\treturn stream.SendAndClose(&calcpb.AverageResponse{\n\t\t\t\tResult: avg,\n\t\t\t\tJobUid: requestID,\n\t\t\t})\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to receive from stream: %v\", err)\n\t\t}\n\t\tsum += float64(req.GetValue())\n\t\tavg = sum / float64(n)\n\t\trequestID = req.GetJobUid()\n\t}\n\treturn fmt.Errorf(\"maximum allowed argument size exceeded\")\n}", "title": "" }, { "docid": "3a8db560ac67ea0570391222b0f2f28d", "score": "0.4267035", "text": "func (s *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv) GetLinkDelayVariation() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkDelayVariation {\n\tif s != nil && s.LinkDelayVariation != nil {\n\t\treturn s.LinkDelayVariation\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "70cea79365d24ab08366d126653e1bbc", "score": "0.42647448", "text": "func (p *simpleProfiler) GetAvg(id int) float64 {\n\treturn (p.accum[id].totalTime /\n\t\tfloat64(p.accum[id].invocations))\n}", "title": "" }, { "docid": "6092c39227598599f17ebcb5b8903e13", "score": "0.42495832", "text": "func (s *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv) GetLinkDelayVariation() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayVariation {\n\tif s != nil && s.LinkDelayVariation != nil {\n\t\treturn s.LinkDelayVariation\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0eb28ea287a10c22d02db5289eab105e", "score": "0.42483488", "text": "func (s *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv4InternalReachability_Prefix) GetDelayMetric() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv4InternalReachability_Prefix_DelayMetric {\n\tif s != nil && s.DelayMetric != nil {\n\t\treturn s.DelayMetric\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "dea4e7d0c48db36f262e13da9fbf87ab", "score": "0.42451295", "text": "func (t *Lsp_Tlv_Ipv4InternalReachability_Prefix) GetDelayMetric() *Lsp_Tlv_Ipv4InternalReachability_Prefix_DelayMetric {\n\tif t != nil && t.DelayMetric != nil {\n\t\treturn t.DelayMetric\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "263c4bd6bbbfeb06234879fb464ab26b", "score": "0.42409503", "text": "func (m *TeleconferenceDeviceMediaQuality) SetAverageInboundJitter(value *i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ISODuration)() {\n m.averageInboundJitter = value\n}", "title": "" }, { "docid": "7e49fd43eec403e135f0fc5c296a0a64", "score": "0.42296532", "text": "func (b *backoffImpl) GetDelay(ctx Context) time.Duration {\n\treturn b.getDelay(ctx)\n}", "title": "" }, { "docid": "5b1b5cba53f1552a8de2d241993635de", "score": "0.42199206", "text": "func ServiceGetAverage() []byte {\n\tresult, err := load.ServiceGetAverage()\n\treturn util.ConvertInterfaceToJsonBytes(result, err)\n}", "title": "" }, { "docid": "4a35a42f307fdd1900cf0e9d03fd1aab", "score": "0.42171657", "text": "func (l *Loader) RetryDelay() time.Duration {\n\treturn l.cfg.RetryDelay\n}", "title": "" }, { "docid": "28d9f359f8c2456c3122cda853604ae1", "score": "0.42152256", "text": "func (pl *PaceLimiter) DelaysTotal() uint64 {\n\tpl.mu.Lock()\n\tn := pl.delaysTotal\n\tpl.mu.Unlock()\n\treturn n\n}", "title": "" }, { "docid": "4486f659fa00d2ae7ab5d84e0a8a975b", "score": "0.42134205", "text": "func (s *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv) GetLinkDelayVariation() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayVariation {\n\tif s != nil && s.LinkDelayVariation != nil {\n\t\treturn s.LinkDelayVariation\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f19d1c255e67321c610b8caae2c8405d", "score": "0.42121544", "text": "func (this *Player) AudioDelay() (int64, error) {\n\tif this.ptr == nil {\n\t\treturn 0, syscall.EINVAL\n\t}\n\treturn int64(C.libvlc_audio_get_delay(this.ptr)), checkError()\n}", "title": "" }, { "docid": "6a79f2c3fe60169101cbda90b21c47c0", "score": "0.4208048", "text": "func GetLoadAvg() (LoadAvg, error) {\n\ttxt, err := readLoadAvg()\n\tif err != nil {\n\t\treturn LoadAvg{}, err\n\t}\n\treturn getLoadAvg(txt)\n}", "title": "" }, { "docid": "8eadbd5df97d6130f5a4d5dcf076a809", "score": "0.41901153", "text": "func (o ExplainQueryStageResponseOutput) WaitMsAvg() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ExplainQueryStageResponse) string { return v.WaitMsAvg }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "d931efbf369e98d8fc8ec9b2c0da1ef6", "score": "0.41874576", "text": "func CalculateAvgLatency() {\n\tloadbalancer.LatencyMapRWMutex.RLock()\n\tfor _, v := range loadbalancer.ProtocolStatsMap {\n\t\tfor _, stats := range v {\n\t\t\tstats.CalculateAverageLatency()\n\t\t}\n\t}\n\tloadbalancer.LatencyMapRWMutex.RUnlock()\n}", "title": "" }, { "docid": "290cd445bf1665b314f25c3683640e0f", "score": "0.4186445", "text": "func (s *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv) GetLinkDelayVariation() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkDelayVariation {\n\tif s != nil && s.LinkDelayVariation != nil {\n\t\treturn s.LinkDelayVariation\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6eecb90f4b48374786d9a1290146513b", "score": "0.41787356", "text": "func (m *TeleconferenceDeviceMediaQuality) GetAverageOutboundPacketLossRateInPercentage()(*float64) {\n return m.averageOutboundPacketLossRateInPercentage\n}", "title": "" }, { "docid": "a8c29194cbb7799998c54447745d0c2a", "score": "0.4177255", "text": "func (e Event) AverageSize() float64 {\n\treturn e.Size / float64(e.Count)\n}", "title": "" }, { "docid": "4f4308df01c6eb648b3c87dd3ce08195", "score": "0.41771126", "text": "func (s *Session) ShareDurationAverage() (float64, float64) {\n\ts.mu.RLock()\n\tdefer s.mu.RUnlock()\n\n\tvar minTime, maxTime time.Time\n\tvar timestampCount int\n\n\tfor i := uint64(0); i < s.vardiff.bufSize; i++ {\n\t\t// s.log.Printf(\"ShareDurationAverage: %d %s %t\\n\", i, s.shareTimes[i], s.shareTimes[i].IsZero())\n\t\tif s.shareTimes[i].IsZero() {\n\t\t\tcontinue\n\t\t}\n\t\ttimestampCount++\n\t\tif minTime.IsZero() {\n\t\t\tminTime = s.shareTimes[i]\n\t\t}\n\t\tif maxTime.IsZero() {\n\t\t\tmaxTime = s.shareTimes[i]\n\t\t}\n\t\tif s.shareTimes[i].Before(minTime) {\n\t\t\tminTime = s.shareTimes[i]\n\t\t}\n\t\tif s.shareTimes[i].After(maxTime) {\n\t\t\tmaxTime = s.shareTimes[i]\n\t\t}\n\t}\n\n\tvar unsubmitStart time.Time\n\tif maxTime.IsZero() {\n\t\tunsubmitStart = s.sessionStartTimestamp\n\t} else {\n\t\tunsubmitStart = maxTime\n\t}\n\tunsubmitDuration := time.Now().Sub(unsubmitStart).Seconds()\n\tif timestampCount < 2 { // less than 2 stamp\n\t\treturn unsubmitDuration, 0\n\t}\n\n\thistoryDuration := maxTime.Sub(minTime).Seconds() / float64(timestampCount-1)\n\n\treturn unsubmitDuration, historyDuration\n}", "title": "" }, { "docid": "a36319acb0b48ae7ecf08dfe84ba344d", "score": "0.41684785", "text": "func (s *Context) SwrGetDelay(b int64) int64 {\n\treturn int64(C.swr_get_delay((*C.struct_SwrContext)(s), C.int64_t(b)))\n}", "title": "" }, { "docid": "1766773970f7d9a8cb51705cea348270", "score": "0.41420186", "text": "func (m *TeleconferenceDeviceMediaQuality) SetMaximumInboundRoundTripDelay(value *i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ISODuration)() {\n m.maximumInboundRoundTripDelay = value\n}", "title": "" }, { "docid": "39bc6270c46fa959dbc6bd55cf713214", "score": "0.41273126", "text": "func GetLoadAvg() (*Loadavg, error) {\n\tloadAvgLine, err := ioutil.ReadFile(\"/proc/loadavg\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tparts := strings.Fields(string(loadAvgLine))\n\tif len(parts) < 3 {\n\t\treturn nil, errors.New(\"bad format\" + string(loadAvgLine))\n\t}\n\n\tload := &Loadavg{\n\t\ttimestamp: time.Now().Unix(),\n\t}\n\n\tif load.current, err = strconv.ParseFloat(parts[0], 32); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif load.avg5, err = strconv.ParseFloat(parts[1], 32); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif load.avg15, err = strconv.ParseFloat(parts[2], 32); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn load, nil\n}", "title": "" }, { "docid": "f580b22a93b3a938478f102b00046146", "score": "0.41258726", "text": "func LoadAvg() ([3]float64, error) { return loadAvg() }", "title": "" }, { "docid": "48d59198fc854498bd607195ef7bc8de", "score": "0.4124109", "text": "func (v *RetryPolicy) GetMaximumIntervalInSeconds() (o int32) {\n\tif v != nil {\n\t\treturn v.MaximumIntervalInSeconds\n\t}\n\treturn\n}", "title": "" }, { "docid": "047d57b605ec2ce8208e7fe6082dd27f", "score": "0.41208383", "text": "func (m PowerMessage) AveragePower(prev PowerMessage) float32 {\n\tif prev == nil {\n\t\treturn float32(m.InstantaneousPower())\n\t}\n\n\tif prev.EventCount() == m.EventCount() {\n\t\treturn float32(m.InstantaneousPower())\n\t}\n\n\treturn float32(m.accumulatedPowerDiff(prev)) / float32(m.eventCountDiff(prev))\n}", "title": "" }, { "docid": "cc954bb4f7b47a2c4c06d06a5f054e73", "score": "0.41203356", "text": "func (t *Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv) GetLinkDelayVariation() *Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_LinkDelayVariation {\n\tif t != nil && t.LinkDelayVariation != nil {\n\t\treturn t.LinkDelayVariation\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ca017c7446d51ae288ad4923f6b49d20", "score": "0.41196552", "text": "func (m *resendMap) rtt() time.Duration {\n\tconst averageDuration = time.Second * 5\n\tvar (\n\t\ttotal, records time.Duration\n\t\tnow = time.Now()\n\t)\n\tfor t, rtt := range m.delays {\n\t\tif now.Sub(t) > averageDuration {\n\t\t\tdelete(m.delays, t)\n\t\t\tcontinue\n\t\t}\n\t\ttotal += rtt\n\t\trecords++\n\t}\n\tif records == 0 {\n\t\t// No records yet, generally should not happen. Just return a reasonable amount of time.\n\t\treturn time.Millisecond * 50\n\t}\n\treturn total / records\n}", "title": "" }, { "docid": "bd09feff2b0f8fca610bd11996bb2e29", "score": "0.40991515", "text": "func (trs *SaveServer) GetIncomingBytesPerSecond() float64 {\n\treturn trs.InBytesPerSec\n}", "title": "" }, { "docid": "64a3ace775cc9c5fcb687363b3731ed0", "score": "0.40908885", "text": "func _int_avg(ch *channel, src identifier, params map[string]interface{}) func() interface{} {\n\tsumFunc := _int_sum(ch, src, params)\n\treturn func() interface{} {\n\t\tsum, ct := sumFunc().(int), len(ch.listeners)\n\t\treturn sum / ct\n\t}\n}", "title": "" }, { "docid": "8d339c330b81d4175c53343056098172", "score": "0.40891188", "text": "func GetPsdDelayThreshold(client sophos.ClientInterface, options ...sophos.Option) (val int64, err error) {\n\terr = get(client, \"/api/nodes/psd.delay_threshold\", &val, options...)\n\treturn\n}", "title": "" }, { "docid": "ca688452a5818c37ea91c837537aaf47", "score": "0.40802425", "text": "func (t *Tensor) Average() float32 {\n\tvar adder float32\n\tfor i := range t.f32data {\n\t\tadder += t.f32data[i]\n\t}\n\treturn adder / (float32)(len(t.f32data))\n}", "title": "" }, { "docid": "4526561413d9244cbd5a2283721e664a", "score": "0.4076589", "text": "func (transaction *AccountAllowanceApproveTransaction) GetMinBackoff() time.Duration {\n\tif transaction.minBackoff != nil {\n\t\treturn *transaction.minBackoff\n\t}\n\n\treturn 250 * time.Millisecond\n}", "title": "" }, { "docid": "c9766ccfc1a46884b8bc87346c5ef8b7", "score": "0.40749615", "text": "func (request ListTransferAppliancesRequest) RetryPolicy() *common.RetryPolicy {\n\treturn request.RequestMetadata.RetryPolicy\n}", "title": "" }, { "docid": "9768e718a04cd8ef1c7a054e453184ab", "score": "0.40646338", "text": "func meanWaitingTime(persons *sync.Map) float32 {\n\ttotalWaitingTime := 0\n\tpersonCount := 0\n\tpersons.Range(func(_, value interface{}) bool {\n\t\tperson := value.(*Person)\n\t\ttotalWaitingTime += person.WaitingTime\n\t\tpersonCount++\n\t\treturn true\n\t})\n\treturn float32(totalWaitingTime) / float32(personCount)\n}", "title": "" }, { "docid": "1574825bc376cf7d5dfbb3fbb5e0447d", "score": "0.4057463", "text": "func (docLen *DocumentLengths) averageDocumentLength() float64 {\n\treturn float64(docLen.totalLength) / float64(len(docLen.lengths))\n}", "title": "" }, { "docid": "4e3e26c51f143f25f43eb0801451f064", "score": "0.40542257", "text": "func Average(xs []float64) float64 {\n\ttotal := 0.0\n\tfor i := 0; i < len(xs); i++ {\n\t\ttotal += xs[i]\n\t}\n\treturn total / float64(len(xs))\n}", "title": "" }, { "docid": "3afa3d040effccb86acc6961c60abe9c", "score": "0.40530866", "text": "func (t *Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv) GetLinkDelayVariation() *Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayVariation {\n\tif t != nil && t.LinkDelayVariation != nil {\n\t\treturn t.LinkDelayVariation\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4ebbbf4453382e430f7956bcbc205fe1", "score": "0.40527105", "text": "func (client *Client) GetInterval() time.Duration {\n\treturn eal.FromTscDuration(int64(client.Tx.c.burstInterval)) / C.PINGCLIENT_TX_BURST_SIZE\n}", "title": "" }, { "docid": "640bd1b9951736f6e6c92c29bd281047", "score": "0.4044249", "text": "func Average(g []float64) float64 {\n\tvar s float64\n\tfor _, x := range g {\n\t\ts += x\n\t}\n\treturn s / float64(len(g))\n}", "title": "" }, { "docid": "4c0161daf36970f14b577ce33df9751c", "score": "0.40404034", "text": "func (s *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv) GetLinkDelay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelay {\n\tif s != nil && s.LinkDelay != nil {\n\t\treturn s.LinkDelay\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cfe19f80546e8967438a48163c24e274", "score": "0.40374807", "text": "func (m *TeleconferenceDeviceMediaQuality) SetAverageInboundPacketLossRateInPercentage(value *float64)() {\n m.averageInboundPacketLossRateInPercentage = value\n}", "title": "" }, { "docid": "62070a49f435ad02bf4593a2967497fd", "score": "0.4033348", "text": "func (s *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv) GetLinkDelay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelay {\n\tif s != nil && s.LinkDelay != nil {\n\t\treturn s.LinkDelay\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fd490831cd98e6c5b86e334d71d9f444", "score": "0.40323547", "text": "func getAverages() float64 {\n\tvar sumReadings int\n\tfor i := 0; i < sampleSize; i++ {\n\t\tsumReadings += read()\n\t}\n\n\tavgReadings := float64(sumReadings) / float64(sampleSize)\n\treturn avgReadings\n}", "title": "" }, { "docid": "03740fde5de1a26a8c34bf3ef022387b", "score": "0.4031301", "text": "func (a *Attrs) AverageSize() float64 {\n\tcountKnownSize := a.Count - a.CountUnknownSize\n\tif countKnownSize > 0 {\n\t\treturn float64(a.Size) / float64(countKnownSize)\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "f85b61e8486e28ac7f8aa6cca20f078a", "score": "0.4028703", "text": "func (t *Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv) GetLinkDelayVariation() *Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_LinkDelayVariation {\n\tif t != nil && t.LinkDelayVariation != nil {\n\t\treturn t.LinkDelayVariation\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c602e0e0e9a5ade85e5ff63f03780a78", "score": "0.40241146", "text": "func (m Message) GetWtAverageLiquidity(f *field.WtAverageLiquidityField) quickfix.MessageRejectError {\n\treturn m.Body.Get(f)\n}", "title": "" }, { "docid": "5e46e785eb03c5667a54d6b6b9acdb7e", "score": "0.4023951", "text": "func (s *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsReachability_Neighbor) GetDelayMetric() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsReachability_Neighbor_DelayMetric {\n\tif s != nil && s.DelayMetric != nil {\n\t\treturn s.DelayMetric\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a1641b8c9f4e296d31f49a4971cac278", "score": "0.40230685", "text": "func (v *ActivityTaskScheduledEventAttributes) GetRetryPolicy() (o *RetryPolicy) {\n\tif v != nil && v.RetryPolicy != nil {\n\t\treturn v.RetryPolicy\n\t}\n\treturn\n}", "title": "" }, { "docid": "f9b5d6cd561264d8f67105d36909baa6", "score": "0.4020938", "text": "func (sp *StreamProcessor) GetInitialReconnectDelay() time.Duration {\n\treturn sp.initialReconnectDelay\n}", "title": "" }, { "docid": "6fad85539ec1387eaf367aff186bda01", "score": "0.401291", "text": "func getAverage(slice []uint32) int {\n\tvar sum uint32 = 0\n\tfor i := 0; i < len(slice); i++ {\n\t\tsum += (slice[i])\n\t}\n\tcount := len(slice)\n\t// Take the square root to get the true average\n\tavg := math.Sqrt(float64(sum / uint32(count)))\n\n\treturn int(avg)\n}", "title": "" }, { "docid": "91acb434e858cc5c7511b7aff253fb1e", "score": "0.4010066", "text": "func (t *Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv) GetLinkDelayVariation() *Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkDelayVariation {\n\tif t != nil && t.LinkDelayVariation != nil {\n\t\treturn t.LinkDelayVariation\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3b2fc79c5013271fa047bec193430643", "score": "0.40098414", "text": "func (s *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv) GetLinkDelay() *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_LinkDelay {\n\tif s != nil && s.LinkDelay != nil {\n\t\treturn s.LinkDelay\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4302fe867b3c33f24a43150bdd1781ea", "score": "0.40085778", "text": "func (_TBTCSystem *TBTCSystemCaller) GetPriceFeedGovernanceTimeDelay(opts *bind.CallOpts) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _TBTCSystem.contract.Call(opts, out, \"getPriceFeedGovernanceTimeDelay\")\n\treturn *ret0, err\n}", "title": "" } ]
6093094b3535045a5c1aef8c8acca4af
WithLoginHint prepopulates the login prompt with a username.
[ { "docid": "59a093f5f59a3880994673c0a53e6de0", "score": "0.6677602", "text": "func WithLoginHint(username string) interface {\n\tAuthCodeURLOption\n\toptions.CallOption\n} {\n\treturn struct {\n\t\tAuthCodeURLOption\n\t\toptions.CallOption\n\t}{\n\t\tCallOption: options.NewCallOption(\n\t\t\tfunc(a any) error {\n\t\t\t\tswitch t := a.(type) {\n\t\t\t\tcase *authCodeURLOptions:\n\t\t\t\t\tt.loginHint = username\n\t\t\t\tdefault:\n\t\t\t\t\treturn fmt.Errorf(\"unexpected options type %T\", a)\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t},\n\t\t),\n\t}\n}", "title": "" } ]
[ { "docid": "f0c1544c2c2ebf9dd36308b1fe898751", "score": "0.64557576", "text": "func PromptForUsernameWithDefault(defaultVal string) (string, error) {\n\treturn PromptForStringWithDefault(PromptUsername, defaultVal, userNameValidator)\n}", "title": "" }, { "docid": "8aebb80633a263ec6e6e2c34492ec348", "score": "0.62087107", "text": "func (o *BankInterface) SetLoginHint(v string) {\n\to.LoginHint.Set(&v)\n}", "title": "" }, { "docid": "335483fa257566eb7eedb57abab9470e", "score": "0.6060774", "text": "func PromptForUsername() (string, error) {\n\treturn PromptForString(PromptUsername, userNameValidator)\n}", "title": "" }, { "docid": "8f0f03452031eba56248e609ee3e5f7f", "score": "0.58476084", "text": "func LoginPrompt(ctx *pkcs11.Ctx, session pkcs11.SessionHandle, userFlag uint) error {\n\tvar (\n\t\tpinType string\n\t)\n\tmaxAttempts := 2\n\tif userFlag == pkcs11.CKU_SO {\n\t\tpinType = \"SO\"\n\t} else {\n\t\tpinType = \"User\"\n\t}\n\tfor attempts := 0; attempts <= maxAttempts; attempts++ {\n\t\tfmt.Printf(\"Enter your %s pin: \", pinType)\n\t\tpinBytes, err := terminal.ReadPassword(int(syscall.Stdin))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = ctx.Login(session, userFlag, string(pinBytes))\n\t\tif err == nil {\n\t\t\tfmt.Printf(\"\\nLogged in as %s\\n\", pinType)\n\t\t\treturn nil\n\t\t}\n\t\tfmt.Println(\"Wrong ping. Try again.\")\n\t}\n\treturn errors.New(\"Incorrect attempts exceeded\")\n}", "title": "" }, { "docid": "29b18cd5a8fbdd25b7dcd20e0d506ee5", "score": "0.5377607", "text": "func (o *BankInterface) GetLoginHint() string {\n\tif o == nil || o.LoginHint.Get() == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn *o.LoginHint.Get()\n}", "title": "" }, { "docid": "e709b14770e3300027153542be5445db", "score": "0.5236468", "text": "func askUser() string {\n\tvar proxyUser string\n\n\tfmt.Println(\"Enter proxy username (optional)\")\n\tfmt.Scanln(&proxyUser)\n\n\treturn proxyUser\n}", "title": "" }, { "docid": "67b4aa5948a36185b59b3d07a1bc3563", "score": "0.51911896", "text": "func loginPrompt(vault *api.Client) {\n\tpassword, err := speakeasy.Ask(\"Enter your vault password: \")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tpath := fmt.Sprintf(\"auth/userpass/login/%s\", os.Getenv(\"USER\"))\n\ts, err := vault.Logical().Write(path, map[string]interface{}{\n\t\t\"password\": password,\n\t})\n\tif err != nil {\n\t\tfmt.Println(\"Invalid username or password\")\n\t\tos.Exit(1)\n\t}\n\n\ttoken := s.Auth.ClientToken\n\tioutil.WriteFile(vaultTokenPath, []byte(token), 0600)\n\tvault.SetToken(token)\n}", "title": "" }, { "docid": "cbf5287795fe19a42bb2097ad738deef", "score": "0.51476485", "text": "func (c *Client) setUsername() {\n\tc.Ch <- \"Enter your name: \"\n\tc.input.Scan()\n\tc.idle.Stop() // reset idle timer on name input\n\tc.idle.Reset(timeout)\n\tc.username = c.input.Text()\n}", "title": "" }, { "docid": "5a9deab6c32e9bd39e8c5d3674d06e41", "score": "0.5127338", "text": "func WithUserName(username string) func(*AuthFlow) {\n\treturn func(p *AuthFlow) {\n\t\tp.username = username\n\t}\n}", "title": "" }, { "docid": "c988e67ba0b95d1f5b2690779b5efceb", "score": "0.50763124", "text": "func WithLogin(server string, name string, user string, password string) *Bot {\n\tcfg := Config{\n\t\tUser: user,\n\t\tPassword: password,\n\t}\n\n\treturn New(server, name, cfg)\n}", "title": "" }, { "docid": "06425adba2e3b582b1a3d4b486208973", "score": "0.506476", "text": "func PromptForUserPasswordWithDefault(defaultVal string) (string, error) {\n\treturn PromptForPasswordWithDefault(PromptPassword, defaultVal, userPasswordValidator)\n}", "title": "" }, { "docid": "95a0a1223c07ec6c274914823a8839eb", "score": "0.50561374", "text": "func ProfileLogin(c *cli.Context, _ *Client) error {\n\tif !c.IsSet(\"username\") {\n\t\treturn fmt.Errorf(\"please provide a username\")\n\t}\n\n\tif !c.IsSet(\"password\") {\n\t\treturn fmt.Errorf(\"please provide a password\")\n\t}\n\n\t// username := c.String(\"username\")\n\t// password := c.String(\"password\")\n\n\t// resp, err := client.Auth.LoginUser(\n\t// \tauth.NewLoginUserParams().WithAuthLogin(&models.AuthLogin{\n\t// \t\tUsername: &username,\n\t// \t\tPassword: &password,\n\t// \t}),\n\t// )\n\n\t// if err != nil {\n\t// \tswitch val := err.(type) {\n\t// \tcase *auth.LoginUserUnauthorized:\n\t// \t\treturn fmt.Errorf(*val.Payload.Message)\n\t// \tcase *auth.LoginUserDefault:\n\t// \t\treturn fmt.Errorf(*val.Payload.Message)\n\t// \tdefault:\n\t// \t\treturn PrettyError(err)\n\t// \t}\n\t// }\n\n\ttmpl, err := template.New(\n\t\t\"_\",\n\t).Funcs(\n\t\tglobalFuncMap,\n\t).Funcs(\n\t\tsprigFuncMap,\n\t).Parse(\n\t\tfmt.Sprintln(c.String(\"format\")),\n\t)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn tmpl.Execute(os.Stdout, nil)\n}", "title": "" }, { "docid": "ecf1211f3c7a7edb911f4b9419a8b09d", "score": "0.49915904", "text": "func Login(c *cli.Context) {\n\tif !CheckLoginCommandFlags(c) {\n\t\treturn\n\t}\n\n\tsettings.PrintPlaceholderValues()\n\n\torgInfo := types.OrgInfo{\n\t\tAccountName: c.String(\"org\"),\n\t\tRegion: c.String(\"region\"),\n\t}\n\tpassword := c.String(\"password\")\n\tinputUser := c.String(\"username\")\n\ttaURL := \"\"\n\tidmServerURL := \"\"\n\n\tuserEmail, err := utils.GetUserEmail()\n\tif err != nil || len(userEmail) == 0 {\n\t\tlog.Debug(err.Error())\n\t\t// utils.CheckError(errors.New(\"Username is not set.\"))\n\t}\n\n\tif err, value := settings.GetPlaceHolderValue(settings.TIBCO_ACCOUNTS_URL_PLACEHOLDER); err == nil {\n\t\ttaURL = value\n\t} else {\n\t\tlog.Debug(err.Error())\n\t\t// utils.CheckError(errors.New(\"TIBCO Accounts URL is not set.\"))\n\t}\n\n\tidmServerURL, err = utils.GetIDMConnectURL()\n\tif err != nil {\n\t\tlog.Debug(err.Error())\n\t\t// utils.CheckError(errors.New(\"Identity-Management Server URL is not set.\"))\n\t}\n\n\tif !c.IsSet(\"username\") && !c.IsSet(\"password\") {\n\t\tinputUser = utils.PromptForUser(userEmail)\n\t} else if !c.IsSet(\"username\") && c.IsSet(\"password\") {\n\t\tinputUser = userEmail\n\t}\n\n\tif CheckPlatformVersionAndLogin(c) == nil {\n\t\tcOrg, cRegion, err := utils.GetOrgAndRegion()\n\t\tif err != nil {\n\t\t\tlog.Debug(err.Error())\n\t\t\tutils.CheckError(errors.New(\"Failed to retrieve current organization and region information. \"))\n\t\t\treturn\n\t\t}\n\n\t\tif inputUser == userEmail {\n\t\t\tif c.IsSet(\"org\") && c.IsSet(\"region\") {\n\t\t\t\tif cOrg == orgInfo.AccountName && cRegion == orgInfo.Region {\n\t\t\t\t\tfmt.Println(\"User is already logged in. \")\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfmt.Println(\"User is already logged in. \")\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif !c.IsSet(\"password\") {\n\t\tpassword = utils.PromptForPassword()\n\t}\n\n\t// do login\n\ttoken, err := TaLogin(taURL, inputUser, password)\n\tutils.CheckError(err)\n\n\terr = IdmLogin(idmServerURL, inputUser, token.AccessToken, orgInfo, true)\n\n\tutils.CheckError(err)\n\treturn\n}", "title": "" }, { "docid": "d9326244a23758084bab622d7cd03341", "score": "0.49848175", "text": "func FakeLogin() {\n\tfakedLogin = true\n}", "title": "" }, { "docid": "6fa1da2bc638e9b4e1f223cf9d6cf4b0", "score": "0.49822596", "text": "func (ls *LoginService) PromptDeviceName(skipPrompts bool) *LoginService {\n\tif ls.err != nil {\n\t\treturn ls\n\t}\n\n\texistingName := config.GetDeviceName()\n\tdeviceName := prompts.DeviceName(existingName, skipPrompts)\n\tviper.Set(\"device\", deviceName)\n\n\tls.log.Printf(\"Using device %s\\n\", deviceName)\n\n\treturn ls\n}", "title": "" }, { "docid": "a1209e2d08c0abf834d8d3a456b88391", "score": "0.49569783", "text": "func Login(ctx context.Context) string {\n\treturn ctx.Value(contextKeyLogin).(string)\n}", "title": "" }, { "docid": "798da8949ab9901112652b1b1837fe13", "score": "0.49481234", "text": "func (m *PasswordCredential) SetHint(value *string)() {\n m.hint = value\n}", "title": "" }, { "docid": "70941b6ddeb8bd4dcdb3e15020c699ca", "score": "0.49468526", "text": "func OptQueryUsername(value string) QueryEventOption {\n\treturn func(e *QueryEvent) { e.Username = value }\n}", "title": "" }, { "docid": "712767dc21763e2976e79bc818d6c850", "score": "0.48869488", "text": "func (self *ircBot) login() {\n\n\tself.isAuthenticating = true\n\n\t// We use the botname as the 'realname', because bot's don't have real names!\n\tself.SendRaw(\"USER \" + self.nick + \" 0 * :\" + self.realname)\n\n\tself.setNick()\n}", "title": "" }, { "docid": "82a7c33e664d30a39b120f2eb3d68fea", "score": "0.48746482", "text": "func (o *BankInterface) GetLoginHintOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.LoginHint.Get(), o.LoginHint.IsSet()\n}", "title": "" }, { "docid": "1b91c451ac60b57263a83cfde8af0a96", "score": "0.48725927", "text": "func PrepUsername(username string) string {\n\treturn strings.TrimSpace(username)\n}", "title": "" }, { "docid": "875dde51f8f55aac390b50e095116746", "score": "0.48648906", "text": "func SubcommandLogin(opts auth.Options, name string) *subcommands.Command {\n\treturn SubcommandLoginWithParams(CommandParams{Name: name, AuthOptions: opts})\n}", "title": "" }, { "docid": "48f33362ce666c6e3b12ce647e589823", "score": "0.48647147", "text": "func (c *Client) ConfigLogin() (err error) {\n\tif c.Username != \"\" {\n\t\tcolor.Green(\"Current user: %v\", c.Username)\n\t}\n\tcolor.Cyan(\"Configure username and password\")\n\tcolor.Cyan(\"Note: The password is invisible, just type it correctly.\")\n\n\tfmt.Printf(\"Username: \")\n\tusername := util.ScanlineTrim()\n\n\tpassword := \"\"\n\tif terminal.IsTerminal(int(syscall.Stdin)) {\n\t\tfmt.Printf(\"Password: \")\n\t\tbytePassword, err := terminal.ReadPassword(int(syscall.Stdin))\n\t\tif err != nil {\n\t\t\tfmt.Println()\n\t\t\tif err.Error() == \"EOF\" {\n\t\t\t\tfmt.Println(\"Interrupted.\")\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\t\tpassword = string(bytePassword)\n\t\tfmt.Println()\n\t} else {\n\t\tcolor.Red(\"Your terminal does not support the hidden password.\")\n\t\tfmt.Printf(\"password: \")\n\t\tpassword = util.Scanline()\n\t}\n\n\tc.Username = username\n\tc.Password, err = encrypt(username, password)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn c.Login()\n}", "title": "" }, { "docid": "45d9b6ed3b8820c25fcba16c2867bbb4", "score": "0.48638076", "text": "func (l *LoginDetails) setUsername(s string) error {\r\n\tl.username.value = s\r\n\treturn nil\r\n}", "title": "" }, { "docid": "fd4751015b514bc75a06b096950a4475", "score": "0.4863313", "text": "func Login(username, password string) error {\n\tif username == \"\" || password == \"\" {\n\t\treturn errors.New(\"Expect 2 parameters\")\n\t}\n\tstorage := GetInstance()\n\tif userList := storage.QueryUser(func(user *User) bool {\n\t\treturn user.GetName() == username\n\t}); len(userList) == 0 {\n\t\treturn errors.New(username + \" doesn't exist\")\n\t} else {\n\t\tstorage.SetCurUsername(username)\n\t\treturn storage.Sync()\n\t}\n}", "title": "" }, { "docid": "ff6bd784e0c88ce124c15ed7583cd123", "score": "0.48558205", "text": "func ExampleClient_Login() {\n\tcli, _ := NewClient(\"http://localhost:8008\", \"\", \"\")\n\tresp, err := cli.Login(&ReqLogin{\n\t\tType: \"m.login.password\",\n\t\tUser: \"alice\",\n\t\tPassword: \"wonderland\",\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tcli.SetCredentials(resp.UserID, resp.AccessToken)\n}", "title": "" }, { "docid": "4c209574b71dcefd98218d8a9176aead", "score": "0.4841468", "text": "func Login(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprintf(w, \"you trynna login\")\n}", "title": "" }, { "docid": "014bfb0189b00d38d66cd5ec200be64f", "score": "0.48382175", "text": "func (nu *NewUser) PrepNewUser() {\n\tnu.Username = PrepUsername(nu.Username)\n\tnu.FullName = PrepFullName(nu.FullName)\n\tnu.DisplayName = PrepDisplayName(nu.DisplayName)\n}", "title": "" }, { "docid": "39a406c4cf8f5d75f6fee3030dadd8ea", "score": "0.4829612", "text": "func (r *UserResolver) Login() string {\n\treturn r.u.Login\n}", "title": "" }, { "docid": "24d859bbeb49ff7e6d64b4c9421c26c8", "score": "0.48254445", "text": "func promptUser(list []string, label string) (result string) {\n\tif label == \"\" {\n\t\tlabel = \"Selecione a Empresa\"\n\t}\n\ttemplates := &promptui.SelectTemplates{\n\t\tHelp: `{{ \"Use estas teclas para navegar:\" | faint }} {{ .NextKey | faint }} ` +\n\t\t\t`{{ .PrevKey | faint }} {{ .PageDownKey | faint }} {{ .PageUpKey | faint }} ` +\n\t\t\t`{{ if .Search }} {{ \"and\" | faint }} {{ .SearchKey | faint }} {{ \"toggles search\" | faint }}{{ end }}`,\n\t}\n\n\tprompt := promptui.Select{\n\t\tLabel: label,\n\t\tItems: list,\n\t\tTemplates: templates,\n\t}\n\n\t_, result, err := prompt.Run()\n\n\tif err != nil {\n\t\tfmt.Printf(\"Prompt failed %v\\n\", err)\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "64016513ca495e3fd2238d67da81a225", "score": "0.4813142", "text": "func (o GoogleCloudIntegrationsV1alphaUsernameAndPasswordOutput) Username() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v GoogleCloudIntegrationsV1alphaUsernameAndPassword) *string { return v.Username }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "b8bb5622f825118b8ec6e6afc181b1b8", "score": "0.48013958", "text": "func fmtPrompt() string {\n\tuser, _ := user.Current()\n\thost, _ := os.Hostname()\n\tcwd, _ := os.Getwd()\n\n\tcwd = strings.Replace(cwd, user.HomeDir, \"~\", 1)\n\n\targs := []string{\n\t\t\"d\", cwd,\n\t\t\"h\", host,\n\t\t\"u\", user.Username,\n\t}\n\n\tfor i, v := range args {\n\t\tif i % 2 == 0 {\n\t\t\targs[i] = \"%\" + v\n\t\t}\n\t}\n\n\tr := strings.NewReplacer(args...)\n\tnprompt := r.Replace(prompt)\n\n\treturn nprompt\n}", "title": "" }, { "docid": "9c10feeb1bcee3256fef0b07bc24c0cf", "score": "0.47809383", "text": "func (b *IdentityProviderBuilder) Login(value bool) *IdentityProviderBuilder {\n\tb.login = &value\n\treturn b\n}", "title": "" }, { "docid": "19045db5c66559f411cc3accbf523a9a", "score": "0.4762755", "text": "func showAdminLogin(w http.ResponseWriter, r *http.Request) {\n\tip := strings.SplitN(r.RemoteAddr, \":\", 2)[0]\n\tchallenge, _ := siteUsers.IssueAdminChallenge(ip)\n\n\ttemplates.ExecuteTemplate(w, \"admin_login\", struct {\n\t\tChallenge string\n\t\tSettings *tolxankaConfigToml\n\t}{challenge, settings})\n}", "title": "" }, { "docid": "c3678a2f694875fd70c8314ff81961ed", "score": "0.47415382", "text": "func (m *SharePointIdentity) SetLoginName(value *string)() {\n err := m.GetBackingStore().Set(\"loginName\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "ea1b8f410f65a5d5aa632953bd7281cd", "score": "0.47376394", "text": "func (s *RequestProcessorClient) Login(password, authKey, name string) error {\n\tvar rsp crypto.LoginResponse\n\terr := s.cli.Call(\"RequestProcessor.Login\", &crypto.LoginRequest{Password: password,\n\t\tAuthKey: authKey,\n\t\tName: name}, &rsp)\n\treturn err\n}", "title": "" }, { "docid": "3e4080e3cc2258ac5f2e765efa459265", "score": "0.47201592", "text": "func EnrollUsername(username string) func(*url.Values) {\n\treturn func(opts *url.Values) {\n\t\topts.Set(\"username\", username)\n\t}\n}", "title": "" }, { "docid": "b2cafa199217b631949bee266da3d4fe", "score": "0.47155777", "text": "func promptCharacter(username string) string {\n\treturn fmt.Sprintf(`You are Teleport, a tool that users can use to connect to Linux servers and run relevant commands, as well as have a conversation.\nA Teleport cluster is a connectivity layer that allows access to a set of servers. Servers may also be referred to as nodes.\nNodes sometimes have labels such as \"production\" and \"staging\" assigned to them. Labels are used to group nodes together.\nYou will engage in professional conversation with the user and help accomplish tasks such as executing tasks\nwithin the cluster or answering relevant questions about Teleport, Linux or the cluster itself.\n\nYou are not permitted to engage in conversation that is not related to Teleport, Linux or the cluster itself.\nIf this user asks such an unrelated question, you must concisely respond that it is beyond your scope of knowledge.\n\nYou are talking to %v.`, username)\n}", "title": "" }, { "docid": "872c2c456ff1c53d1c687a62682c41c0", "score": "0.4713711", "text": "func PromptForPasswordWithDefault(label, defaultVal string, validate promptui.ValidateFunc) (string, error) {\n\tprompt := promptui.Prompt{\n\t\tLabel: label,\n\t\tValidate: validate,\n\t\tDefault: defaultVal,\n\t\tMask: '*',\n\t}\n\treturn prompt.Run()\n}", "title": "" }, { "docid": "d7c00d4e476b0d10291f62d79619ee85", "score": "0.47132882", "text": "func (o GoogleCloudIntegrationsV1alphaUsernameAndPasswordPtrOutput) Username() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *GoogleCloudIntegrationsV1alphaUsernameAndPassword) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Username\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "a254d5897afb975121ae1e7d03a4d180", "score": "0.47092965", "text": "func Prompt(prefix string) (string, error) {\n\tif len(prefix) > 0 {\n\t\tfmt.Printf(\"%s: \", prefix)\n\t} else {\n\t\tfmt.Print(\"Enter: \")\n\t}\n\tvar input string\n\t_, err := fmt.Scanln(&input)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif len(input) == 0 {\n\t\treturn \"\", errors.New(\"empty input\")\n\t}\n\n\treturn input, nil\n}", "title": "" }, { "docid": "c6f708046ab66d8eccf0a6f94da06550", "score": "0.47046888", "text": "func (cli *CLI) Login() {\n\t//get username\n\tvar identity string\n\tfmt.Fprintf(os.Stderr, \"Please enter your username or email: \")\n\t_, err := fmt.Scanln(&identity)\n\tcheck(err)\n\n\t//get password\n\tfmt.Fprintf(os.Stderr, \"Please enter your password: \")\n\tpass, err := terminal.ReadPassword(int(os.Stdin.Fd()))\n\tfmt.Fprintf(os.Stderr, \"\\n\")\n\tcheck(err)\n\tpassword := string(pass)\n\n\tauth := Login{identity, password}\n\ttoken, err := cli.Client.TokenLogin(auth)\n\tcheck(err)\n\n\tcli.Client.Auth = token\n\tcli.save()\n\tfmt.Println(\"Success!\")\n}", "title": "" }, { "docid": "6c2a81916ef68f070e7dc3990041c0cd", "score": "0.46921796", "text": "func LoginCommand(cData CommandData, usernameArg string, args ...bool) {\n\t//Print error if user tries to bench\n\tbenchCheck(cData)\n\n\t//Print confirmation if user is already logged in\n\tif cData.Config.IsLoggedIn() && !cData.Yes && len(args) == 0 {\n\t\ti, _ := gaw.ConfirmInput(\"You are already logged in. Overwrite session? [y/n]> \", bufio.NewReader(os.Stdin))\n\t\tif !i {\n\t\t\treturn\n\t\t}\n\t}\n\n\t//Enter credentials\n\tusername, pass := credentials(usernameArg, false, 0)\n\n\tvar response server.LoginResponse\n\n\t//Do request\n\tresp, err := server.NewRequest(server.EPLogin, server.CredentialsRequest{\n\t\tPassword: pass,\n\t\tUsername: username,\n\t}, cData.Config).Do(&response)\n\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\treturn\n\t}\n\n\tif resp.Status == server.ResponseError && resp.HTTPCode == 403 {\n\t\tfmt.Println(color.HiRedString(\"Failure\"))\n\t} else if resp.Status == server.ResponseSuccess && len(response.Token) > 0 {\n\t\t//put username and token in config\n\t\tcData.Config.User = struct {\n\t\t\tUsername string\n\t\t\tSessionToken string\n\t\t}{\n\t\t\tUsername: username,\n\t\t\tSessionToken: response.Token,\n\t\t}\n\n\t\t//Set default namespace to users\n\t\tcData.Config.Default.Namespace = response.Namespace\n\n\t\t//Save new config\n\t\terr := configService.Save(cData.Config, cData.Config.File)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Error saving config:\", err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tfmt.Println(color.HiGreenString(\"Success!\"), \"\\nLogged in as\", username)\n\t} else {\n\t\tprintResponseError(resp)\n\t}\n}", "title": "" }, { "docid": "c03ca70d1fd99b24ee35f98620026711", "score": "0.46758828", "text": "func LoginAuthUsername(context *gin.Context, username string) {\n\tuser := &models.User{}\n\tmgm.Coll(user).First(bson.M{\"username\": username}, user)\n\tcontext.Set(\"userID\", user.ID.Hex())\n}", "title": "" }, { "docid": "d45e2ba9dc8fb8956c0dae0604de8632", "score": "0.467386", "text": "func (s *ShortLinkInput) GetUsername(defaultVal string) string {\n\tif s.Username == nil {\n\t\treturn defaultVal\n\t}\n\treturn *s.Username\n}", "title": "" }, { "docid": "281a1a81fbfaa1f847bb607a32d76af2", "score": "0.46606833", "text": "func (o ApiConfigHandlerResponseOutput) Login() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ApiConfigHandlerResponse) string { return v.Login }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "9b6fe52b734db1bcc57e39ac7e9d6c73", "score": "0.46593708", "text": "func SubcommandLoginWithParams(params CommandParams) *subcommands.Command {\n\treturn &subcommands.Command{\n\t\tUsageLine: params.Name,\n\t\tShortDesc: \"performs interactive login flow\",\n\t\tLongDesc: \"Performs interactive login flow and caches obtained credentials\",\n\t\tCommandRun: func() subcommands.CommandRun {\n\t\t\tc := &loginRun{}\n\t\t\tc.params = &params\n\t\t\tc.registerBaseFlags()\n\t\t\treturn c\n\t\t},\n\t}\n}", "title": "" }, { "docid": "637c30104e7d360edd57c75900855304", "score": "0.4639624", "text": "func Hint(str string, noPadding bool) { defUI.Hint(str, noPadding) }", "title": "" }, { "docid": "93f6eea0b0d0d02c180713dab31ffebb", "score": "0.46270835", "text": "func (co *ClientOptions) Username(s string) *ClientOptions {\n\treturn &ClientOptions{next: co, opt: options.Username(s), err: nil}\n}", "title": "" }, { "docid": "ced6c03b7c2acdb1d8daa1a454b8fb39", "score": "0.46248874", "text": "func (o *OpCLI) SignInWithPresetPass(username, password string, keepSignInSessionAlive bool) error {\n\to.user = username\n\to.pass = password\n\to.keepSessionAlive = keepSignInSessionAlive\n\terr := o.signInExec()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "23cac493c47f59cbf7e4b5fde24d07d0", "score": "0.46233448", "text": "func PromptMissing(cfg *config.Config, skipPass bool) error {\n\tif cfg == nil {\n\t\treturn errors.New(\"interact: cannot fill in fields of a nil Config\")\n\t}\n\n\tif cfg.QuestID == \"\" {\n\t\tvar (\n\t\t\tprompt = promptui.Prompt{\n\t\t\t\tLabel: \"Quest ID\",\n\t\t\t\tTemplates: plainTemplates,\n\t\t\t}\n\t\t\tinput, err = prompt.Run()\n\t\t)\n\t\tif err != nil {\n\t\t\treturn ess.AddCtx(\"interact: prompting for Quest ID\", err)\n\t\t}\n\t\tif input == \"\" {\n\t\t\treturn errors.New(\"interact: Quest ID must not be empty\")\n\t\t}\n\t\tcfg.QuestID = input\n\t}\n\n\tif (cfg.Password == \"\") && !skipPass {\n\t\tvar (\n\t\t\tprompt = promptui.Prompt{\n\t\t\t\tLabel: \"Quest password\",\n\t\t\t\tMask: '*',\n\t\t\t\tTemplates: plainTemplates,\n\t\t\t}\n\t\t\tinput, err = prompt.Run()\n\t\t)\n\t\tif err != nil {\n\t\t\treturn ess.AddCtx(\"interact: prompting for Quest password\", err)\n\t\t}\n\t\tif input == \"\" {\n\t\t\treturn errors.New(\"interact: password must not be empty\")\n\t\t}\n\t\tcfg.Password = input\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "528fbc08f9670c94b59d5824498d0038", "score": "0.4616756", "text": "func (a *Authen) Login(ctx context.Context, req *message.LoginRequest, rsp *authen.AuthenLoginReply) (err error) {\n\t// read the user's id, username and password\n\tvar user *authenModel.User\n\t{\n\t\tuser, err = a.repo.ReadUserByUsername(req.Username)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"fail Authen.Login(%s): %w\", req.Username, err)\n\t\t}\n\t}\n\t// verify the user password\n\terr = lib.ComparePassword(req.Password, user.Password)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"fail Authen.Login(%s): %w\", req.Username, err)\n\t}\n\trsp.Data = &authen.AuthUser{\n\t\tId: user.ID.Hex(),\n\t\tUsername: user.Username,\n\t\tFailAt: user.FailAt,\n\t\tFailCount: user.FailCount,\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e7009ed3f6a1aeba11764b006f193ea8", "score": "0.46131885", "text": "func WithLoginPath(path string) option {\n\treturn func(m *Module) {\n\t\tm.loginPath = path\n\t}\n}", "title": "" }, { "docid": "e799c6cf3a2e4a2ecab8353c2fa566fd", "score": "0.46115863", "text": "func Login(c *goexpect.GExpect, user string, password string) (*Shell, error) {\n\tl := &Shell{exp: c}\n\n\terr := c.Send(\"\\n\")\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"Failed to send a newline\")\n\t}\n\n\tbuffer, _, err := axepect.ExpectWithin(c, defaultTimeout, regexp.MustCompile(\"login:\"))\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"error waiting for login prompt, got text: %s\", buffer)\n\t}\n\n\tif err := doPassword(c, user, password); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn l, nil\n}", "title": "" }, { "docid": "376aff95646b154501c18fcce72e8c75", "score": "0.46061322", "text": "func (o RepositoryOptsPtrOutput) Username() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *RepositoryOpts) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Username\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "b3414ebf142dc1ed88312a7206750477", "score": "0.460551", "text": "func (g *GitCLI) SetUsername(dir string, username string) error {\n\t// Will return status 1 silently if the user is not set.\n\t_, err := g.gitCmdWithOutput(dir, \"config\", \"--get\", \"user.name\")\n\tif err != nil {\n\t\treturn g.gitCmd(dir, \"config\", \"--global\", \"--add\", \"user.name\", username)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "59c630e7bdf837d713fc782d899812a8", "score": "0.46007037", "text": "func (v *GetTeamsViewerUser) GetLogin() string { return v.Login }", "title": "" }, { "docid": "5410e21deb931a6978bd2610c2ecd5d5", "score": "0.4595669", "text": "func (a *Authenticator) LoginWithChallenge(r *http.Request) (string, time.Time, string, error) {\n\treturn a.loginWithChallenge(r)\n}", "title": "" }, { "docid": "c34f602d17cd731bf75886f5ef498393", "score": "0.458888", "text": "func promptUserStr(conn net.Conn, prompt string) (string, error) {\n\tconn.Write([]byte(prompt))\n\tresponse, err := bufio.NewReader(conn).ReadString('\\n')\n\tresponse = strings.TrimSuffix(response, \"\\n\")\n\treturn response, err\n}", "title": "" }, { "docid": "46b01e188dfa2bb1191f7f7eef53a1c0", "score": "0.4583222", "text": "func Login(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\terr := tpl.ExecuteTemplate(w, \"login.html\", nil)\n\tHandleError(w, err)\n}", "title": "" }, { "docid": "36932c8d88174d2e330b4fbd71589981", "score": "0.45762026", "text": "func (s *Server) Login(username, password string) string {\n\tindex := s.userIndex(username)\n\tif index == -1 {\n\t\treturn \"user \" + username + \" does not exist\"\n\t}\n\tuser := s.users[index]\n\tif user.Authorize(password) {\n\t\treturn \"user \" + username + \" logged in\"\n\t} else {\n\t\treturn \"invalid password for \" + username\n\t}\n}", "title": "" }, { "docid": "761b883712da3aa82c92a4bb64905e4f", "score": "0.45712847", "text": "func (r CGTeamworkMutation) Login(ctx context.Context, input models.CGTeamworkLoginInput) (ret *models.CGTeamworkLogin, err error) {\n\tret = new(models.CGTeamworkLogin)\n\tret.ClientMutationID = input.ClientMutationID\n\n\tres, err := r.app.CGTeamwork().Login(ctx, input.Login, input.Password)\n\tif err != nil {\n\t\treturn\n\t}\n\tret.AccessToken = res.AccessToken()\n\tret.AccessTokenExpire = res.AccessTokenExpire()\n\treturn\n}", "title": "" }, { "docid": "845d23126cbec662344782890e9b096f", "score": "0.45626855", "text": "func (PasswordCheckingStep) Login(credential credentials.Credential, password string) error {\n\thashed := credential.HashedPassword()\n\tif hashed == \"\" {\n\t\treturn realms.ErrLoginFailed\n\t}\n\n\thasher := credential.Hasher()\n\tif err := hasher.Validate(password, credential.HashedPassword()); err != nil {\n\t\treturn realms.ErrLoginFailed\n\t} else {\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "7e78328fea8ec93ce3b884836da5b9be", "score": "0.45554695", "text": "func promptUserInfo(db *sql.DB) error {\n\tif count, _ := storage.GetUserCount(db); count != 0 {\n\t\treturn nil\n\t}\n\n\t// get user info like username/password\n\treader := bufio.NewReader(os.Stdin)\n\tfmt.Printf(\"No user currently exists! Please create one:\\n\")\n\tfmt.Printf(\"First name: \")\n\tfirstName, _ := reader.ReadString('\\n')\n\tfmt.Printf(\"Last Name: \")\n\tlastName, _ := reader.ReadString('\\n')\n\tfmt.Printf(\"Email: \")\n\temail, _ := reader.ReadString('\\n')\n\tfmt.Printf(\"Location: \")\n\tlocation, _ := reader.ReadString('\\n')\n\tfmt.Printf(\"Catch Phrase: \")\n\tcatchPhrase, _ := reader.ReadString('\\n')\n\tfmt.Printf(\"Login: \")\n\tlogin, _ := reader.ReadString('\\n')\n\tfmt.Printf(\"Password: \")\n\tpassword, _ := reader.ReadString('\\n')\n\n\thashedPw, _ := authentication.EncryptPassword(password[:len(password)-1])\n\n\tnewUser, err := storage.CreateUser(db, firstName[:len(firstName)-1], lastName[:len(lastName)-1], email[:len(email)-1], location[:len(location)-1], catchPhrase[:len(catchPhrase)-1], login[:len(login)-1], hashedPw)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfmt.Printf(\"User %s created successfully.\", newUser.FirstName)\n\n\treturn nil\n}", "title": "" }, { "docid": "9a39ed6c2edff6dbbbe7af08552dfee0", "score": "0.45514524", "text": "func (o RepositoryOptsOutput) Username() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v RepositoryOpts) *string { return v.Username }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "a4d50b71702cb2453269cad80c52c8df", "score": "0.45338354", "text": "func (v *GetRateLimitViewerUser) GetLogin() string { return v.Login }", "title": "" }, { "docid": "ebe67d7e2bef91156147dffc99099ebd", "score": "0.45180392", "text": "func (c UserServer) Login(ctx context.Context, param *model.UserAccount) (*model.UserAccount, error) {\n\tresult, err := c.UserUsecase.Login(param)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "ebe67d7e2bef91156147dffc99099ebd", "score": "0.45180392", "text": "func (c UserServer) Login(ctx context.Context, param *model.UserAccount) (*model.UserAccount, error) {\n\tresult, err := c.UserUsecase.Login(param)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "39dda0deb72588c89130772b822572d5", "score": "0.4515688", "text": "func Prompt(prompt string, args ...interface{}) string {\n\tvar s string\n\tfmt.Printf(prompt+\": \", args...)\n\tfmt.Scanln(&s)\n\treturn s\n}", "title": "" }, { "docid": "419838a0d52ffc965354d857ae86099f", "score": "0.45021078", "text": "func (ftp *FTP) Login(username string, password string) (err error) {\n\tif _, err = ftp.cmd(CodeUserNameOkNeedPassword, \"USER %s\", username); err != nil {\n\t\tif ftp.HasCode(err.Error(), CodeUserLoggedIn) {\n\t\t\t// Ok, probably anonymous server\n\t\t\t// but login was fine, so return no error\n\t\t\terr = nil\n\t\t} else {\n\t\t\treturn\n\t\t}\n\t}\n\n\tif _, err = ftp.cmd(CodeUserLoggedIn, \"PASS %s\", password); err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "7fcd763d57fd9fd1196d8d7cdb0571ed", "score": "0.44873297", "text": "func (o AuthenticatorOutput) ProviderUserNameTemplate() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Authenticator) pulumi.StringPtrOutput { return v.ProviderUserNameTemplate }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "17e5a3d75402b47e4aee0d365ae97559", "score": "0.44838947", "text": "func (r FrontendApiCreateBrowserLoginFlowRequest) LoginChallenge(loginChallenge string) FrontendApiCreateBrowserLoginFlowRequest {\n\tr.loginChallenge = &loginChallenge\n\treturn r\n}", "title": "" }, { "docid": "9a542ecb798ad31077bc2c42ba4f2c48", "score": "0.4483814", "text": "func (o GoogleCloudIntegrationsV1alphaUsernameAndPasswordResponseOutput) Username() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GoogleCloudIntegrationsV1alphaUsernameAndPasswordResponse) string { return v.Username }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "cfd41ec449bcea4bbd4259dc09a19a2d", "score": "0.44832367", "text": "func newLoginLoadUser(g *libkb.GlobalContext, username string) *loginLoadUser {\n\treturn &loginLoadUser{\n\t\tContextified: libkb.NewContextified(g),\n\t\tusername: strings.TrimSpace(username),\n\t}\n}", "title": "" }, { "docid": "363bdf7eb4af77fa563d8f9dd652595c", "score": "0.44734004", "text": "func (repo *Repository) Login(w http.ResponseWriter, r *http.Request) {\n\trender.Template(w, r, \"login.page.html\", &models.TemplateData{\n\t\tForm: forms.New(nil),\n\t})\n}", "title": "" }, { "docid": "4e0c519584ec7c6fd5ed19127050600a", "score": "0.44677037", "text": "func (r FrontendApiCreateBrowserRegistrationFlowRequest) LoginChallenge(loginChallenge string) FrontendApiCreateBrowserRegistrationFlowRequest {\n\tr.loginChallenge = &loginChallenge\n\treturn r\n}", "title": "" }, { "docid": "73e9d981b12c4c418f94eecf3e73de4f", "score": "0.44604307", "text": "func (a Agent) Login(username, password string) error {\n\tlogin := libts.Request{\n\t\tCommand: \"login\",\n\t\tArgs: map[string]interface{}{\n\t\t\t\"client_login_name\": username,\n\t\t\t\"client_login_password\": password,\n\t\t},\n\t}\n\treturn a.Query.Do(login, nil)\n}", "title": "" }, { "docid": "b5c78fe01c8b79e03f7dd424087607bb", "score": "0.4459358", "text": "func commandLogin(login Login) *exec.Cmd {\n\tif login.Email != \"\" {\n\t\treturn commandLoginEmail(login)\n\t}\n\treturn exec.Command(\n\t\tbuildahExe, \"login\",\n\t\t\"-u\", login.Username,\n\t\t\"-p\", login.Password,\n\t\tlogin.Registry,\n\t)\n}", "title": "" }, { "docid": "3135d8fedd0847a28661e68366cc344b", "score": "0.44504246", "text": "func (c *Controller) InjectPrompt(context echo.Context) (err error) {\n\tp := &model.Prompt{}\n\tanswer := context.QueryParam(\"answer\")\n\tif err = context.Bind(p); err != nil {\n\t\treturn err\n\t}\n\tc.Backend, err = c.Backend.InjectPrompt(p, answer)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn c.Home(context)\n}", "title": "" }, { "docid": "1e5f7885f0ae3294b36126ebc03601f7", "score": "0.44498718", "text": "func (c *Client) Login(ctx context.Context, hostname, username, secret string, insecure bool) error {\n\tsettings := &iface.LoginSettings{\n\t\tContext: ctx,\n\t\tHostname: hostname,\n\t\tUsername: username,\n\t\tSecret: secret,\n\t\tInsecure: insecure,\n\t}\n\treturn c.login(settings)\n}", "title": "" }, { "docid": "3c5eec973cddce30fc89852f2190070e", "score": "0.44497603", "text": "func (o UrlMapResponseOutput) Login() pulumi.StringOutput {\n\treturn o.ApplyT(func(v UrlMapResponse) string { return v.Login }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "6e16b1ca5530f4d1eabbddb4ed47c37d", "score": "0.444275", "text": "func (w *TTYWriter) Hint(format string, args ...interface{}) {\n\tlog.out.Infof(format, args...)\n\tlog.spinner.hold()\n\tw.Fprintf(w.out.Out, \"%s\\n\", blueString(format, args...))\n\tlog.spinner.unhold()\n}", "title": "" }, { "docid": "7c4233a333978957e90a6ad84f84df0b", "score": "0.44423229", "text": "func CandidateLogin(c *gin.Context) {\n\tusername := c.PostForm(\"roll\")\n\tpassHash := c.PostForm(\"pass\")\n\tcandidate, err := ElectionDb.GetCandidate(username)\n\tif err != nil {\n\t\tc.String(http.StatusForbidden, \"This candidate has not yet registered.\")\n\t\treturn\n\t}\n\n\tif candidate.Password != passHash {\n\t\tc.String(http.StatusForbidden, \"Invalid Password.\")\n\t\treturn\n\t}\n\n\tutils.StartSession(c)\n\n\tsimplifiedCandidate := candidate.Simplify()\n\tc.JSON(http.StatusOK, &simplifiedCandidate)\n}", "title": "" }, { "docid": "3526ca64a99b8f43d8ba85be63acbf42", "score": "0.44418156", "text": "func Prompt(message string, checks ...interact.InputCheck) (string, error) {\n\treturn DefaultActor.Prompt(Input(message), checks...)\n}", "title": "" }, { "docid": "1e457308b27437570f9f0fec439d722d", "score": "0.4439167", "text": "func (n *System_Aaa_Authentication_UserPathAny) Username() *System_Aaa_Authentication_User_UsernamePathAny {\n\treturn &System_Aaa_Authentication_User_UsernamePathAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"config\", \"username\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "1c91c924bb952e507495a1782e359f88", "score": "0.4433795", "text": "func (self *LPass) Login(args []string) (*exec.Cmd, error) {\n\tif self.Username == \"\" {\n\t\tpanic(\"Error: you have to set your lastpass username!\")\n\t}\n\n\tbinaryPath, err := exec.LookPath(\"lpass\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\targv := []string{binaryPath, \"login\", \"--trust\", self.Username}\n\tenv := os.Environ()\n\tfmt.Printf(\"Executing: %s\\n\", argv)\n\terr = syscall.Exec(binaryPath, argv, env)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tpanic(\"WHOAH, it shouldn't be possible to get here!\")\n\n\treturn nil, nil\n}", "title": "" }, { "docid": "b1009b4bed8173f1d5fdc65cb7946cf2", "score": "0.44336963", "text": "func (b *LocalBackend) StartLoginInteractive() {\n\tb.mu.Lock()\n\tb.assertClientLocked()\n\tb.interact = true\n\turl := b.authURL\n\tcc := b.cc\n\tb.mu.Unlock()\n\tb.logf(\"StartLoginInteractive: url=%v\", url != \"\")\n\n\tif url != \"\" {\n\t\tb.popBrowserAuthNow()\n\t} else {\n\t\tcc.Login(nil, b.loginFlags|controlclient.LoginInteractive)\n\t}\n}", "title": "" }, { "docid": "2d0de3a3d0f2af46a817241dbda77cbb", "score": "0.4433158", "text": "func NewLoginByUsernamePayload(body *LoginByUsernameRequestBody) *user.LoginByUsernamePayload {\n\tv := &user.LoginByUsernamePayload{\n\t\tUsername: *body.Username,\n\t\tPassword: *body.Password,\n\t}\n\tif body.HumanCode != nil {\n\t\tv.HumanCode = *body.HumanCode\n\t}\n\tif body.CaptchaID != nil {\n\t\tv.CaptchaID = *body.CaptchaID\n\t}\n\tif body.HumanCode == nil {\n\t\tv.HumanCode = \"\"\n\t}\n\tif body.CaptchaID == nil {\n\t\tv.CaptchaID = \"\"\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "1c872abed18d21157e58e9b93e3eeb35", "score": "0.4430674", "text": "func (c *CredentialRequest) GetUsername() string {\n\treturn AskForUsername()\n}", "title": "" }, { "docid": "fb2bcc5908f993461788cc974fe7c36d", "score": "0.44280678", "text": "func (client *AuthClient) Login() (string, error) {\n\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\tdefer cancel()\n\n\treq := pb.CreateUserRequest{\n\t\tUser: &pb.User{\n\t\t\tName: client.username,\n\t\t\tPassword: client.password,\n\t\t\tRole: \"admin\",\n\t\t},\n\t}\n\n\tres, err := client.service.CreateUser(ctx, &req)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn res.AccessToken, nil\n}", "title": "" }, { "docid": "204374a9c66389ba13ec4252f1707255", "score": "0.4427713", "text": "func WithLoginRetry(n int) Option {\n\treturn func(c *Client) {\n\t\tc.loginRetry = n\n\t}\n}", "title": "" }, { "docid": "c1b2adb11b2adbbdc075bdc829701d86", "score": "0.44247025", "text": "func (c *Client) LoginWithOpts(options ...iface.LoginOption) error {\n\tsettings := &iface.LoginSettings{}\n\tfor _, option := range options {\n\t\toption(settings)\n\t}\n\treturn c.login(settings)\n}", "title": "" }, { "docid": "6ba69a378ca2a99009759ae9dd79260d", "score": "0.4424357", "text": "func (g *GHP) readUsername() (err error) {\n\tfmt.Printf(\"Username for https://%s: \", github)\n\tg.Username, err = readline()\n\treturn\n}", "title": "" }, { "docid": "ebed29ad5c176a4bba030a4850e33ecc", "score": "0.4414699", "text": "func Login(ctx IPKCS11Ctx, session pkcs11.SessionHandle, passRetriever notary.PassRetriever, userFlag uint, defaultPassw string, hardwareName string) error {\n\terr := ctx.Login(session, userFlag, defaultPassw)\n\tif err == nil {\n\t\treturn nil\n\t}\n\n\tfor attempts := 0; ; attempts++ {\n\t\tvar (\n\t\t\tgiveup bool\n\t\t\terr error\n\t\t\tuser string\n\t\t)\n\t\tif userFlag == pkcs11.CKU_SO {\n\t\t\tuser = \"SO Pin\"\n\t\t} else {\n\t\t\tuser = \"User Pin\"\n\t\t}\n\t\tpasswd, giveup, err := passRetriever(user, hardwareName, false, attempts)\n\t\tif giveup || err != nil {\n\t\t\treturn trustmanager.ErrPasswordInvalid{}\n\t\t}\n\t\tif attempts > 2 {\n\t\t\treturn trustmanager.ErrAttemptsExceeded{}\n\t\t}\n\n\t\terr = ctx.Login(session, userFlag, passwd)\n\t\tif err == nil {\n\t\t\treturn nil\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8b9f186ce780fbaa6cdf74f2caa8ef50", "score": "0.44113392", "text": "func Login(ctx *iris.Context) {\n\tctx.Render(\"login.html\", nil, iris.RenderOptions{\"layout\": iris.NoLayout})\n}", "title": "" }, { "docid": "bf905382b455a85a058ea0ed746247b1", "score": "0.44106662", "text": "func NewUserPrompt(ctx *Ctx, anchor VerticalAnchor, anchorOffset int) *UserPrompt {\n\tprefix := ctx.config.Prompt\n\tif len(prefix) <= 0 { // default\n\t\tprefix = \"QUERY>\"\n\t}\n\tprefixLen := runewidth.StringWidth(prefix)\n\n\treturn &UserPrompt{\n\t\tCtx: ctx,\n\t\tAnchorSettings: &AnchorSettings{anchor, anchorOffset},\n\t\tprefix: prefix,\n\t\tprefixLen: prefixLen,\n\t\tbasicStyle: ctx.config.Style.Basic,\n\t\tqueryStyle: ctx.config.Style.Query,\n\t}\n}", "title": "" }, { "docid": "07de460c7c54bc81a028fe02ac58ea8e", "score": "0.4410422", "text": "func login(writer http.ResponseWriter, request *http.Request) {\n\tt := parseTemplateFiles(\"login.layout\", \"public.navbar\", \"login\")\n\tt.Execute(writer, nil)\n}", "title": "" }, { "docid": "b147e73ec5771784f310518f96522dde", "score": "0.44055137", "text": "func (o AutoLoginOutput) SharedUsername() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *AutoLogin) pulumi.StringPtrOutput { return v.SharedUsername }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "4a3d8792c1cb29b43e7e0d997e47d9f5", "score": "0.439969", "text": "func (t *Tableau) Login(server, username, password string) (string, error) {\n\treturn t.login(server, username, password)\n}", "title": "" }, { "docid": "a19afbcc34eb4881666236cf061ce0f6", "score": "0.4395201", "text": "func (local *LocalConfig) PromptUserForConfig() error {\n\tvar c LocalConfig\n\terr := prompt.Dialog(&c, \"Insert the label to be used to mark the GitHub review issues\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*local = c\n\treturn nil\n}", "title": "" } ]
4cd17c2514e920a3c20bddfd364e15a8
Usage prints the command's usage.
[ { "docid": "796f771ba9efbdf91fd8722daf0a2c0a", "score": "0.78934777", "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": "03ca02e718e9a37d7764e7f6ab378477", "score": "0.82380176", "text": "func Usage() {\n\tfmt.Fprintf(Stderr, UsageMessage+\"\\n\", CommandName)\n}", "title": "" }, { "docid": "e260ed07fd040896472cb1105cb51d73", "score": "0.812779", "text": "func Usage() {\n\tfmt.Fprintf(Stderr, usageMessage+\"\\n\", CommandName)\n}", "title": "" }, { "docid": "ade3fe9ee4f1574875e129f360efbf53", "score": "0.8097668", "text": "func (cmd *Cmd) Usage(more ...string) {\n\tfmt.Fprintf(os.Stderr, strings.Join(more, \"\"))\n\tfmt.Fprintf(os.Stderr, \"Usage: %s <command> <args>\\n\", os.Args[0])\n\tos.Exit(2)\n}", "title": "" }, { "docid": "5fa63f00790aaea54a62bc39d870841b", "score": "0.8035714", "text": "func ShowUsage(cmd *cobra.Command, args []string) {\n\tcmd.Usage()\n}", "title": "" }, { "docid": "c7a5bae8757409ccc4e6d5fb02d6e5df", "score": "0.8027317", "text": "func usage() {\n\tfmt.Printf(\"%s\", helpString)\n}", "title": "" }, { "docid": "834de261fd4322d95774a7bc188c30e7", "score": "0.79813087", "text": "func (*VersionCmd) Usage() string {\n\treturn `version\n`\n}", "title": "" }, { "docid": "5d5238dcd95571c59ebaa9e9e0cf6fd6", "score": "0.7960995", "text": "func (cmd *AddCommand) PrintUsage() {\n\tfmt.Println(Help(cmd))\n}", "title": "" }, { "docid": "b68f70343b2af2ec3ff3d05226dac7d4", "score": "0.7921777", "text": "func (c *Command) Usage() {\n\ttmpl(cmdUsage, c)\n\tos.Exit(2)\n}", "title": "" }, { "docid": "ac0e12f6cf7621e02cd9b7dae2f7c405", "score": "0.7870177", "text": "func (cmd *Command) Usage() {\n\tcmd.UsageLine = strings.TrimSpace(cmd.UsageLine)\n\n\ttw := tabwriter.NewWriter(os.Stderr, 0, 8, 2, '\\t', 0)\n\tdefer tw.Flush()\n\n\tt := template.Must(template.New(\"usage\").Parse(cmd.helpTemplate))\n\tt.Execute(tw, cmd.helpTemplateData)\n}", "title": "" }, { "docid": "1f67b85a15ae3bd37bef04204a60e345", "score": "0.7749245", "text": "func (c *Command) Usage() int {\n\tlog.Printf(c.UsageString())\n\treturn 0\n}", "title": "" }, { "docid": "8f0640ab350272279000fe8da8183985", "score": "0.7747508", "text": "func (c *Command) Usage() {\n\tfmt.Fprintf(os.Stderr, \"usage: %s %s\\n\\n\", Name, c.UsageLine)\n\tfmt.Fprintf(os.Stderr, \"Type '%s help %s' for more information\\n\", Name, c.Name())\n\tos.Exit(1)\n}", "title": "" }, { "docid": "e2a8f1880fbf197bd838ba797766a23c", "score": "0.7744592", "text": "func usage() {\n\tfmt.Fprint(os.Stderr, usageText)\n\tflag.PrintDefaults()\n}", "title": "" }, { "docid": "2ec0a6a32f1e0785e02c713240528e0e", "score": "0.7729967", "text": "func usage() {\n\tusageString := `\ncut 9 image \n\nversion: 0.0.1\nUsage: command [-h] [-f file_path] [-o output_name]\n \nOptions:\n`\n\tfmt.Fprintf(os.Stderr, usageString)\n\tflag.PrintDefaults()\n}", "title": "" }, { "docid": "ca2a71803600af603d814e88a96e2f6e", "score": "0.7677528", "text": "func (c *Command) Usage() {\n\tbuildCommandText(c)\n\tfmt.Fprintf(os.Stderr, \"usage: %s\\n\", c.UsageLine)\n\tfmt.Fprintf(os.Stderr, \"Run '%s help %s' for details.\\n\", CommandEnv.Exec, c.LongName())\n\tSetExitStatus(2)\n\tExit()\n}", "title": "" }, { "docid": "0e3648d063ab5818aa5d2b6fe85e5156", "score": "0.7651703", "text": "func usage() {\n\tfmt.Printf(\"%s\\n\", usageStr)\n\tos.Exit(0)\n}", "title": "" }, { "docid": "0e3648d063ab5818aa5d2b6fe85e5156", "score": "0.7651703", "text": "func usage() {\n\tfmt.Printf(\"%s\\n\", usageStr)\n\tos.Exit(0)\n}", "title": "" }, { "docid": "359bf0df50e6c22d349dcb43f819476b", "score": "0.7639949", "text": "func (c *command) usage(name ...string) {\n\tfmt.Fprintf(os.Stderr, `ciao-cli: Command-line interface for the Cloud Integrated Advanced Orchestrator (CIAO)\n\nUsage:\n\n\tciao-cli [options] `+name[0]+` sub-command [flags]\n`)\n\n\tvar t = template.Must(template.New(\"commandTemplate\").Parse(commandTemplate))\n\tt.Execute(os.Stderr, c)\n\n\tfmt.Fprintf(os.Stderr, `\nUse \"ciao-cli `+name[0]+` sub-command -help\" for more information about that item.\n`)\n\tos.Exit(2)\n}", "title": "" }, { "docid": "359bf0df50e6c22d349dcb43f819476b", "score": "0.7639949", "text": "func (c *command) usage(name ...string) {\n\tfmt.Fprintf(os.Stderr, `ciao-cli: Command-line interface for the Cloud Integrated Advanced Orchestrator (CIAO)\n\nUsage:\n\n\tciao-cli [options] `+name[0]+` sub-command [flags]\n`)\n\n\tvar t = template.Must(template.New(\"commandTemplate\").Parse(commandTemplate))\n\tt.Execute(os.Stderr, c)\n\n\tfmt.Fprintf(os.Stderr, `\nUse \"ciao-cli `+name[0]+` sub-command -help\" for more information about that item.\n`)\n\tos.Exit(2)\n}", "title": "" }, { "docid": "969e27dd9c5de615712daa512a488194", "score": "0.7636522", "text": "func (c *Commander) Usage(writer io.Writer) {\n\tfmt.Fprintf(writer, \"Usage: %s <command>\\n\\nAvailable commands are:\\n\", AppName)\n\tmaxLength := 0\n\tmetas := []*nameDescription{}\n\tfor _, cmd := range c.Commands {\n\t\tnames := []string{}\n\t\tfor k := range cmd.Aliases() {\n\t\t\tnames = append(names, k)\n\t\t}\n\t\tsort.Strings(names)\n\t\tname := strings.Join(names, \", \")\n\t\tif len(name) > maxLength {\n\t\t\tmaxLength = len(name)\n\t\t}\n\t\tmetas = append(metas, &nameDescription{name, cmd.Description()})\n\t}\n\tformat := fmt.Sprintf(\" %%-%ds %%s\\n\", maxLength)\n\tfor _, m := range metas {\n\t\tfmt.Fprintf(writer, format, m.name, m.description)\n\t}\n\tfmt.Fprintf(writer, \"\\n\")\n}", "title": "" }, { "docid": "0025694cd2a444312d7771615a52b405", "score": "0.7600222", "text": "func (o *Options) PrintUsage() {\n\tvar banner = ` ____ _\n| _ \\ ___| |_ _ __ _ _\n| |_) / _ \\ __| '__| | | |\n| _ < __/ |_| | | |_| |\n|_| \\_\\___|\\__|_| \\__, |\n |___/\n`\n\tcolor.Cyan(banner)\n\tflag.Usage()\n}", "title": "" }, { "docid": "22d6379fd3cd06eef8c435cf531cbf79", "score": "0.7591615", "text": "func usage() {\n\tfmt.Printf(usageText, os.Args[0])\n\tos.Exit(0)\n}", "title": "" }, { "docid": "5ca6cb39d21d6158893b623c5e1ccc42", "score": "0.75703984", "text": "func (c *BaseCommand) Usage(message string) {\n\tui.Say(terminal.FailureColor(\"FAILED\"))\n\tui.Say(\"Incorrect usage. %s\\n\", message)\n\t_, err := c.cliConnection.CliCommand(\"help\", c.name)\n\tif err != nil {\n\t\tui.Failed(\"Could not display help: %s\", err)\n\t}\n}", "title": "" }, { "docid": "d2c0f4a3a07fac33eeb02094871a2520", "score": "0.75669783", "text": "func usage() {\n\tfmt.Println(usageStr)\n\tos.Exit(0)\n}", "title": "" }, { "docid": "f4e7f6ec56eade59063fea2847842987", "score": "0.75538915", "text": "func (opt *Options) PrintUsage() {\n\tvar banner = ` _ __\n| |__ / _| __ _\n| '_ \\| |_ / _' |\n| |_) | _| (_| |\n|_.__/|_| \\__, |\n |___/\n\nA fast brainfuck interpreter and compiler.\nNasm is required for compilation. This can be installed on Linux like this:\n\n\tsudo apt install nasm\n\nCompilation is the default. To use the interpreter pass the relevant switch.\n`\n\tfmt.Println(banner)\n\tflag.Usage()\n}", "title": "" }, { "docid": "8db6ab0d66c18ce1dc3d025e69900f8a", "score": "0.7549568", "text": "func Usage() {\n\tfmt.Fprintf(os.Stderr, \"Usage of %s:\\n\", os.Args[0])\n\tflag.PrintDefaults()\n}", "title": "" }, { "docid": "8db6ab0d66c18ce1dc3d025e69900f8a", "score": "0.7549568", "text": "func Usage() {\n\tfmt.Fprintf(os.Stderr, \"Usage of %s:\\n\", os.Args[0])\n\tflag.PrintDefaults()\n}", "title": "" }, { "docid": "8db6ab0d66c18ce1dc3d025e69900f8a", "score": "0.7549568", "text": "func Usage() {\n\tfmt.Fprintf(os.Stderr, \"Usage of %s:\\n\", os.Args[0])\n\tflag.PrintDefaults()\n}", "title": "" }, { "docid": "a888e78346767ac1e4673a2ec97c548f", "score": "0.7544837", "text": "func Usage(commandPrefix, action, mandatoryFlags string) string {\n\treturn fmt.Sprintf(\"%s %s %s %s [flags]\", Name, commandPrefix, action, mandatoryFlags)\n}", "title": "" }, { "docid": "d21fa9f765a9f662d927e616850a2451", "score": "0.75182146", "text": "func Usage() {\n\tfmt.Fprint(os.Stderr, \"Usage of \", os.Args[0], \":\\n\")\n\tflag.PrintDefaults()\n\tfmt.Fprint(os.Stderr, \"\\n\")\n}", "title": "" }, { "docid": "2e2fe6dd4d2612610f84ec312548aa2a", "score": "0.7516751", "text": "func printUsage() {\n\tfmt.Printf(`cbd is a distributed C/C++ build tool.\n\nUsage:\n\tcbd command [arguments]\n`)\n}", "title": "" }, { "docid": "76950c8044c33ace2a8555afbd2ea589", "score": "0.7498065", "text": "func usage() {\n\tprintUsage(os.Stderr)\n\tos.Exit(1)\n}", "title": "" }, { "docid": "9c31a1bfdee06cb128f0cf620250a8ba", "score": "0.74718606", "text": "func usage() {\n\tfmt.Fprintf(os.Stderr, \"Usage of %s:\\n\", os.Args[0])\n\tflag.PrintDefaults()\n\n\tos.Exit(1)\n}", "title": "" }, { "docid": "a9d0e2e0707f4e245e451498d18dcdb2", "score": "0.746709", "text": "func Usage() {\n\tfmt.Fprintf(os.Stderr, \"Usage of %s:\\n\", os.Args[0])\n\tfmt.Fprintf(os.Stderr, \"\\tgocql-gen\\n\")\n\tfmt.Fprintf(os.Stderr, \"For more information, see:\\n\")\n\tfmt.Fprintf(os.Stderr, \"\\thttps://github.com/timthesinner/gocql-gen\\n\")\n}", "title": "" }, { "docid": "c10a93ff12122d0bfeb471221a453974", "score": "0.7466962", "text": "func (c *RunCommand) Usage() string {\n\treturn `run [-config=./config.json]:\n\tRuns the server and listens to incoming messages`\n}", "title": "" }, { "docid": "8c8c309356fc7e81f2dffefd9f502800", "score": "0.74644244", "text": "func usage() {\n\tfmt.Fprintf(os.Stderr, \"USAGE\\n\")\n\tfmt.Fprintf(os.Stderr, \" %s <mode> [flags]\\n\", os.Args[0])\n\tfmt.Fprintf(os.Stderr, \"\\n\")\n\tfmt.Fprintf(os.Stderr, \"MODES\\n\")\n\tfmt.Fprintf(os.Stderr, \" query Create a query api for the backend\\n\")\n\tfmt.Fprintf(os.Stderr, \"\\n\")\n\tfmt.Fprintf(os.Stderr, \"VERSION\\n\")\n\tfmt.Fprintf(os.Stderr, \" %s (%s)\\n\", version, runtime.Version())\n\tfmt.Fprintf(os.Stderr, \"\\n\")\n}", "title": "" }, { "docid": "947fa770f26da6780499c137dcfa5670", "score": "0.7460379", "text": "func (cli *CLI) Usage() {\n\tfmt.Printf(\"\\nUsage:\\n\t%s [command]\\n\", getScriptName())\n\tfmt.Print(\"\\nAvailable Commands:\\n\")\n\tfor _, c := range cli.Commands {\n\t\tfmt.Print(fmt.Sprintf(\"\t%s\\n\", c.usage()))\n\t}\n}", "title": "" }, { "docid": "48ddb58ae606b89f82d6dda215cde0c2", "score": "0.741554", "text": "func (c *command) Usage() string {\n\treturn \"Usage: scan -set NAMESPACE.SET\\n\"\n}", "title": "" }, { "docid": "0f296525cafc11de4c6aafce00e73219", "score": "0.7410213", "text": "func printUsage(args []string) {\n\tfmt.Printf(\"Usage: %s \", os.Args[0])\n\ti := 0\n\tfor k := range cmds {\n\t\tfmt.Printf(k)\n\t\tif i != len(cmds)-1 {\n\t\t\tfmt.Printf(\"|\")\n\t\t}\n\t\ti++\n\t}\n\tfmt.Println()\n\tfmt.Println(DetailedVersionString())\n}", "title": "" }, { "docid": "64d908737969e2cfc20890e6835c8a5b", "score": "0.74054235", "text": "func (bi *BuildInfo) Usage(name string) string {\n\tswitch name {\n\tcase \"version\":\n\t\treturn \"Print version information and quit\"\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "2b0d936afd157079c35ed26fab21e79f", "score": "0.73965496", "text": "func usage() {\n\tvar err error\n\to := flag.CommandLine.Output()\n\tmsg := func(m string) {\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\t_, err = fmt.Fprintf(o, m)\n\t}\n\n\tmsg(\"warp:\\tsimple command line warp9 client to manipulate objects.\\n\")\n\tmsg(\"Usage of warp: [-v][-d dbglev] [-a addr] cmd arg\\n\")\n\tflag.PrintDefaults()\n\tmsg(\"\\n cmd = {ls,stat,cat,get,write,ctl}\\n\")\n\tmsg(\"\\tls - list contents of a directory object\\n\")\n\tmsg(\"\\tstat - show metadata of an object\\n\")\n\tmsg(\"\\tcat - copy contents of an object to stdout\\n\")\n\tmsg(\"\\tget - perform a get (open/read/close) operation (like cat)\\n\")\n\tmsg(\"\\twrite - copy contents of stdin to object (use: echo hello| np write)\\n\")\n\tmsg(\"\\tctl - perform a write of rest of args to object; then read contents and write to stdout\\n\")\n\tmsg(\"\\tdcat - copy contents of an object to stdout, sleep 10 before closing\\n\")\n\tif err != nil {\n\t\tlog.Fatalf(\"usage message failed: %v\", err)\n\t}\n}", "title": "" }, { "docid": "693b6835225d428643b718c24393e137", "score": "0.7370171", "text": "func Usage(commands []Command) {\n\ttemplate := `fyne-cross is a simple tool to cross compile Fyne applications\n\nUsage: fyne-cross <command> [arguments]\n\nThe commands are:\n\n{{ range $k, $cmd := . }}\t{{ printf \"%-13s %s\\n\" $cmd.Name $cmd.Description }}{{ end }}\nUse \"fyne-cross <command> -help\" for more information about a command.\n`\n\n\tprintUsage(template, commands)\n}", "title": "" }, { "docid": "3e262a204795c17c8865e3a531f10c0b", "score": "0.73566896", "text": "func (reporter *rlogReporter) Usage() {\n\treporter.logger.Info(\"Usage:\", os.Args[0], \"[migrate | rewind | do | undo | executed | pending]\")\n\tline := \" %18s %s\"\n\treporter.logger.Infof(line, styleBold(\"migrate\"), \"Apply all pending migrations\")\n\treporter.logger.Infof(line, styleBold(\"rewind\"), \"Rewind all executed migrations\")\n\treporter.logger.Infof(line, styleBold(\"do\"), \"Execute the next pending migration\")\n\treporter.logger.Infof(line, styleBold(\"undo\"), \"Execute the last applied migration\")\n\treporter.logger.Infof(line, styleBold(\"executed\"), \"List all executed migrations\")\n\treporter.logger.Infof(line, styleBold(\"pending\"), \"List all pending migrations\")\n}", "title": "" }, { "docid": "e059f668becc0df17a39ce1baf363f51", "score": "0.7342973", "text": "func (m *Main) Usage() string {\n\treturn strings.TrimLeft(`\nkubeql is a tool.\nUsage:\n\tkubeql command [arguments]\n\nThe commands are:\n server start kubeql web server application\n\nUse \"kubeql [command]\" for more information about a command.\n`, \"\\n\")\n}", "title": "" }, { "docid": "9123d313ed06b05b541095ec5a53fcb6", "score": "0.7339693", "text": "func usage() {\n\tme := \"a.out\"\n\tif len(os.Args) >= 1 {\n\t\tme = os.Args[0]\n\t}\n\tfmt.Fprintf(os.Stderr, \"Usage of %s:\\n\", me)\n\tfmt.Fprintf(os.Stderr, \"\\t%s [flags...] -- <program name> args...\\n\", me)\n\tfmt.Fprintf(os.Stderr, \"Flags:\\n\")\n\tflag.PrintDefaults()\n\tfmt.Fprintf(os.Stderr,\n\t\t\"See https://cloud.google.com/tools/cloud-debugger/setting-up-on-compute-engine for more information.\\n\")\n\tos.Exit(2)\n}", "title": "" }, { "docid": "4c298b41b778579d92cecdd7b0d0d74e", "score": "0.73293334", "text": "func usage() {\n\tfmt.Fprintf(os.Stderr, \"Usage: %s [options]\\n\", os.Args[0])\n\tflag.PrintDefaults()\n\tos.Exit(2)\n}", "title": "" }, { "docid": "499c93da3fb2498269fa8f5245da13bc", "score": "0.73227525", "text": "func usage() {\n\tfmt.Fprintf(os.Stderr, \"usage: %s\\n\", filepath.Base(os.Args[0]))\n\tflag.PrintDefaults()\n\tos.Exit(1)\n}", "title": "" }, { "docid": "b56f4e28544cd22ec5dffc47550d0f36", "score": "0.7319302", "text": "func UsageCmd() *cli.Command {\n\treturn &cli.Command{\n\t\tName: \"usage\",\n\t\tDescription: \"With this command you can view the current api usage.\",\n\t\tUsage: \"Retrieve information about the current api usage.\",\n\t\tAction: UsageAction,\n\t}\n}", "title": "" }, { "docid": "5bba9ebac110118e5713356a0d77cafc", "score": "0.72684497", "text": "func Usage() {\n\tfmt.Fprintf(os.Stderr, \"Usage of %s:\\n\", os.Args[0])\n\tfmt.Fprintf(os.Stderr, \"\\tifmock [flags] -type T [directory]\\n\")\n\tfmt.Fprintf(os.Stderr, \"\\tifmock [flags] -type T files... # Must be a single package\\n\")\n\tfmt.Fprintf(os.Stderr, \"Flags:\\n\")\n\tflag.PrintDefaults()\n}", "title": "" }, { "docid": "c0bf38627e463c4fb8072f739515e21f", "score": "0.72265476", "text": "func usage() {\n\tfmt.Println(\"Synopsis: chkpath [-h] [-v]\")\n\tflag.PrintDefaults()\n}", "title": "" }, { "docid": "7b9b2f88a6862421b65e887f5834af9e", "score": "0.718556", "text": "func statsUsage() {\n\tfmt.Fprintf(os.Stderr, `Stats describes stats information of this services\nUsage:\n %s [globalflags] stats COMMAND [flags]\n\nCOMMAND:\n user-number: Users Information\n\nAdditional help:\n %s stats COMMAND --help\n`, os.Args[0], os.Args[0])\n}", "title": "" }, { "docid": "46e6252e2d11729140951aee574961cf", "score": "0.7182809", "text": "func weatherUsage() {\n\tfmt.Fprintf(os.Stderr, `The weather service returns information for a given location.\nUsage:\n %s [globalflags] weather COMMAND [flags]\n\nCOMMAND:\n weather-query: WeatherQuery implements WeatherQuery.\n\nAdditional help:\n %s weather COMMAND --help\n`, os.Args[0], os.Args[0])\n}", "title": "" }, { "docid": "549bb3b212f2e355ba8394a3321f6d4c", "score": "0.7169504", "text": "func (sch *StationsCommandHandler) Usage(err ...error) {\n\tif len(err) > 0 {\n\t\tfmt.Printf(\"The following errors occurred: %v\\n\", err)\n\t}\n\n\tsch.flagSet.Usage()\n\tos.Exit(1)\n}", "title": "" }, { "docid": "b2dbf861e5b734b5db1d7358d51a3856", "score": "0.7141233", "text": "func informationUsage() {\n\tfmt.Fprintf(os.Stderr, `Service is the information service interface.\nUsage:\n %s [globalflags] information COMMAND [flags]\n\nCOMMAND:\n device- layout: DeviceLayout implements device layout.\n firmware- statistics: FirmwareStatistics implements firmware statistics.\n\nAdditional help:\n %s information COMMAND --help\n`, os.Args[0], os.Args[0])\n}", "title": "" }, { "docid": "1c2f6117f74a55fd569402e3417d7f79", "score": "0.71328163", "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": "93dc23a750cf4a3b048fd5182fd0d826", "score": "0.7115254", "text": "func PrintUsage() {\n\tPrintUsageTo(Output)\n}", "title": "" }, { "docid": "4bd4201f7e8fb67e1338940d0f886638", "score": "0.7113883", "text": "func usage() {}", "title": "" }, { "docid": "9226a5d1ddfd80760ee4d428f8ee00c3", "score": "0.71133316", "text": "func Usage() {\n\tfmt.Fprintf(os.Stderr,\n\t\t\"\\nUsage:\\n %s [flags]\\n\\nFlags:\\n\\n\",\n\t\tprogname)\n\tfmt.Fprintf(os.Stderr, USAGE_SUMMARY)\n\tflag.PrintDefaults()\n\tfmt.Fprintf(os.Stderr,\n\t\t\"\\nE.g.:\\n\\n PocketWeb &\\n PocketWeb -p 8088 -d /some/where/else\\n POCKETWEB_D=/some/where/else POCKETWEB_P=8088 PocketWeb\\n PocketWeb -ver\\n\")\n\tos.Exit(0)\n}", "title": "" }, { "docid": "876f40b0227095e8933d95f53f7e1832", "score": "0.7107116", "text": "func Usage() {\n\tfmt.Fprintf(os.Stderr, \"Usage of %s:\\n\", os.Args[0])\n\tfmt.Fprintf(os.Stderr, \"\\tvet [flags] directory...\\n\")\n\tfmt.Fprintf(os.Stderr, \"\\tvet [flags] files... # Must be a single package\\n\")\n\tfmt.Fprintf(os.Stderr, \"For more information run\\n\")\n\tfmt.Fprintf(os.Stderr, \"\\tgodoc code.google.com/p/go.tools/cmd/vet\\n\\n\")\n\tfmt.Fprintf(os.Stderr, \"Flags:\\n\")\n\tflag.PrintDefaults()\n\tos.Exit(2)\n}", "title": "" }, { "docid": "df924ab008dd4db787187e98e5ab8fe1", "score": "0.7103079", "text": "func usage() {\n\tfmt.Printf(\"go-s3-copy %v\\n\", Version)\n\tfmt.Println(\"usage: go-s3-copy [-h] [-config file]\")\n\tfmt.Println(\" -h: displays this\")\n\tfmt.Println(\" -config file: configuration file in json\")\n}", "title": "" }, { "docid": "8ca1dc1fffb2eea04869590eeb265be3", "score": "0.70981055", "text": "func testUsage() {\n\tfmt.Fprintf(os.Stderr, `Service is the test service interface.\nUsage:\n %s [globalflags] test COMMAND [flags]\n\nCOMMAND:\n get: Get implements get.\n error: Error implements error.\n email: Email implements email.\n\nAdditional help:\n %s test COMMAND --help\n`, os.Args[0], os.Args[0])\n}", "title": "" }, { "docid": "92871dbf057e0c06739aa1b1f8eec908", "score": "0.7084995", "text": "func usage() {\n\tfmt.Fprintf(os.Stderr, \"Usage: %s [-c] [-p file] file\\n\", os.Args[0])\n\tflag.PrintDefaults()\n}", "title": "" }, { "docid": "dd85081c0091a5d523faf14f3ad584d1", "score": "0.7070264", "text": "func (mc *mergeCmd) Usage() string {\n\treturn `merge -files=fileNames -out=fileName.\n`\n}", "title": "" }, { "docid": "9ed56a5f2151640a77dad4f6cd3251b1", "score": "0.706072", "text": "func Usage() {\n\n\tuprintf := func(strFmt string, args ...interface{}) {\n\t\tfmt.Fprintf(UsageWriter, strFmt, args...)\n\t}\n\n\tuprintln := func(strFmt string, args ...interface{}) {\n\t\tuprintf(strFmt+\"\\n\", args...)\n\t}\n\n\tmlen := 0\n\topts := []Option{}\n\tfor _, opt := range baseOptionSet {\n\t\topts = append(opts, *opt)\n\t\ts := fmt.Sprintf(\"%s\", opt.Name)\n\t\tif len(s) > mlen {\n\t\t\tmlen = len(s)\n\t\t}\n\t}\n\n\tsort.Sort(sortedUsageOptionSlice(opts))\n\n\tif Version != \"\" {\n\t\tuprintln(`%s (ver. %s)`, Name, Version)\n\t} else {\n\t\tuprintln(`%s`, Name)\n\t}\n\n\tif Description != \"\" {\n\t\tuprintln(`%s`, Description)\n\t}\n\n\tuprintln(\"\")\n\n\tif len(Examples) > 0 {\n\t\tuprintln(\"Examples:\")\n\t\tfor _, v := range Examples {\n\t\t\tuprintln(\" # %s\", v.Description)\n\t\t\tuprintln(\" $ %s\\n\", v.Cmd)\n\t\t}\n\t}\n\n\tif len(opts) > 0 {\n\t\tuprintln(\"Flags:\")\n\n\t\tlastSort := opts[0].Options.SortOrder\n\n\t\tfmtStr := fmt.Sprintf(\" -%%-%ds (default: %%s)\\n %%s\\n\", mlen)\n\t\tfor _, opt := range opts {\n\t\t\tif opt.Options.SortOrder != lastSort {\n\t\t\t\tuprintln(\"\")\n\t\t\t}\n\n\t\t\tuprintln(fmtStr,\n\t\t\t\topt.Name,\n\t\t\t\topt.defaultValueString(\"<empty>\"),\n\t\t\t\topt.Description,\n\t\t\t)\n\n\t\t\tlastSort = opt.Options.SortOrder\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b527f2daa62a0fb1c026f91614ea08d9", "score": "0.70600754", "text": "func statusUsage() {\n\tfmt.Fprintf(os.Stderr, `Describes the status of each service\nUsage:\n %[1]s [globalflags] status COMMAND [flags]\n\nCOMMAND:\n status: Return status of the services\n\nAdditional help:\n %[1]s status COMMAND --help\n`, os.Args[0])\n}", "title": "" }, { "docid": "3f8bcc4369d8194bd262dc7f8ccde45d", "score": "0.70363635", "text": "func (g *FlagGrouping) Usage(cmd *cobra.Command) error {\n\tif cmd == nil {\n\t\treturn fmt.Errorf(\"nil command\")\n\t}\n\n\tgroup := g.groups[cmd]\n\n\tusage := []string{fmt.Sprintf(\"Usage: %s\", cmd.UseLine())}\n\n\tif cmd.HasAvailableSubCommands() {\n\t\tusage = append(usage, \"\\nCommands:\")\n\t\tbuf := strings.Builder{}\n\t\tw := tabwriter.NewWriter(&buf, 10, 0, 3, ' ', 0)\n\t\tfor _, subCommand := range cmd.Commands() {\n\t\t\t_, _ = fmt.Fprintf(w, \" %s\\t%s\\n\", subCommand.Name(), subCommand.Short)\n\t\t}\n\t\t_ = w.Flush()\n\t\tusage = append(usage, strings.Split(strings.TrimRight(buf.String(), \"\\n\"), \"\\n\")...)\n\t}\n\n\tif cmd.HasExample() {\n\t\tusage = append(usage, \"\\nExamples:\")\n\t\tusage = append(usage, cmd.Example)\n\t}\n\n\tif len(cmd.Aliases) > 0 {\n\t\tusage = append(usage, \"\\nAliases: \"+cmd.NameAndAliases())\n\t}\n\n\tif group != nil {\n\t\tfor _, nfs := range group.list {\n\t\t\tusage = append(usage, fmt.Sprintf(\"\\n%s flags:\", nfs.name))\n\t\t\tusage = append(usage, strings.TrimRightFunc(nfs.fs.FlagUsages(), unicode.IsSpace))\n\t\t}\n\t}\n\n\tusage = append(usage, \"\\nCommon flags:\")\n\tif len(cmd.PersistentFlags().FlagUsages()) != 0 {\n\t\tusage = append(usage, strings.TrimRightFunc(cmd.PersistentFlags().FlagUsages(), unicode.IsSpace))\n\t}\n\tif len(cmd.InheritedFlags().FlagUsages()) != 0 {\n\t\tusage = append(usage, strings.TrimRightFunc(cmd.InheritedFlags().FlagUsages(), unicode.IsSpace))\n\t}\n\n\tusage = append(usage,\n\t\tfmt.Sprintf(\"\\nUse '%s [command] --help' for more information about a command.\\n\",\n\t\t\tcmd.CommandPath()))\n\n\tcmd.Println(strings.Join(usage, \"\\n\"))\n\n\treturn nil\n}", "title": "" }, { "docid": "26bc57253533594f540bddbe93f8585a", "score": "0.7031746", "text": "func Usage() {\n\tfmt.Fprintf(os.Stderr, \"Usage of %s:\\n\", os.Args[0])\n\tfmt.Fprintf(os.Stderr, \"\\tvalidate [flags] -type T [directory]\\n\")\n\tfmt.Fprintf(os.Stderr, \"\\tvalidate [flags] -type T files... # Must be a single package\\n\")\n\tfmt.Fprintf(os.Stderr, \"For more information, see:\\n\")\n\tfmt.Fprintf(os.Stderr, \"\\thttp://godoc.org/github.com/shelakel/go-validate/cmd/validate\\n\")\n\tfmt.Fprintf(os.Stderr, \"Flags:\\n\")\n\tflag.PrintDefaults()\n}", "title": "" }, { "docid": "3906146d82ccce702a2467cb2b5e1ff3", "score": "0.7015239", "text": "func Usage() {\n\thelp := `Usage: secretz -t <organization> [options]\n\n -c int\n\t\tNumber of concurrent fetchers (default 5)\n\t\t\n -delay int\n\t\tdelay between requests + random delay/2 jitter (default 600)\n\t\t\n -members string\n\t\tRetrieve members of Github Org parameters: [list | scan]\n\t\t\n -setkey string\n\t\tSet API Key for api.travis-ci.org\n\t\t\n -t string\n\t\tTarget organization\n\t\t\n -timeout int\n\t\tTimeout for the tool in seconds (default 30)`\n\tfmt.Printf(help)\n\n}", "title": "" }, { "docid": "89462d782447a011a389a4730559dc54", "score": "0.70148665", "text": "func healthcheckUsage() {\n\tfmt.Fprintf(os.Stderr, `The healthcheck service is used report on the liveness and readiness status of the weather service.\nUsage:\n %s [globalflags] healthcheck COMMAND [flags]\n\nCOMMAND:\n liveness: Liveness implements liveness.\n readiness: Readiness implements readiness.\n\nAdditional help:\n %s healthcheck COMMAND --help\n`, os.Args[0], os.Args[0])\n}", "title": "" }, { "docid": "08a695536b4db5d6d64e0851ca7c3a7f", "score": "0.69947356", "text": "func Usage() {\n\tfmt.Fprintln(os.Stderr, \"command: factors <regexp_pattern>\")\n\tfmt.Fprintln(os.Stderr, \"server: factors -http=\"+defaultAddr)\n\tflag.PrintDefaults()\n}", "title": "" }, { "docid": "bedb4eaf3146d057de8f52fb1b74422e", "score": "0.6990241", "text": "func Usage(msg string) {\n\tif msg != \"\" {\n\t\tfmt.Fprintf(os.Stderr, \"%s\\n\", msg)\n\t}\n\tfmt.Fprintf(os.Stderr, \"Usage of file2go:\\n\")\n\tfmt.Fprintf(os.Stderr, \"\\tfile2go -o target/file.go -p mypkg file1 file2 file3\\n\")\n\tgolf.Usage()\n}", "title": "" }, { "docid": "21ee7f8a77b5005bd56fef70d1fd4398", "score": "0.69816834", "text": "func adminUsage() {\n\tfmt.Fprintf(os.Stderr, `Admin provide functions for the management screen.\nUsage:\n %s [globalflags] admin COMMAND [flags]\n\nCOMMAND:\n user-number: Number of users\n admin list user: List all stored users\n admin get user: Show user by ID\n admin create user: Add new user and return its ID.\n admin update user: Update user item.\n admin delete user: Delete user by id.\n\nAdditional help:\n %s admin COMMAND --help\n`, os.Args[0], os.Args[0])\n}", "title": "" }, { "docid": "cc8012a30b85d31f866bcd491c2ba461", "score": "0.69727767", "text": "func PrintUsage() {\n\tfmt.Println(\"Usage: httpc (get|post) [-v] (-h \\\"key:value\\\")* \" +\n\t\t\"[-d inline-data] [-f file] URL\")\n}", "title": "" }, { "docid": "da2ac2d5763c81bb83562edde4efe282", "score": "0.69727516", "text": "func (w *Writer) usage() {\n\tname := w.fullName(Bin)\n\tif usage := w.Usage; w.cmds != nil {\n\t\tif usage == \"\" {\n\t\t\tusage = \"<command> [options] ...\"\n\t\t}\n\t\tfmt.Fprintf(w, \"Usage: %s %s\\n\", name, usage)\n\t\tfmt.Fprintf(w, \" %s <command> help\\n\", name)\n\t\tfmt.Fprintf(w, \" %s help [command]\\n\", name)\n\t} else {\n\t\tsp := \" \"\n\t\tif usage == \"\" {\n\t\t\tsp = \"\"\n\t\t}\n\t\tfmt.Fprintf(w, \"Usage: %s%s%s\\n\", name, sp, usage)\n\t\tfmt.Fprintf(w, \" %s help\\n\", name)\n\t}\n}", "title": "" }, { "docid": "8b168977f5c8e795565276ebfff31d09", "score": "0.69609374", "text": "func (c *Cli) Usage(w io.Writer) {\n\tvar parts []string\n\tparts = append(parts, c.appName)\n\tif len(c.options) > 0 {\n\t\tparts = append(parts, \"[OPTIONS]\")\n\t}\n\t// Add parts defined by params, verbs, or actions\n\tif len(c.params) > 0 {\n\t\tparts = append(parts, c.params...)\n\t}\n\tif len(c.verbs) > 0 && len(c.params) == 0 {\n\t\tif c.VerbsRequired {\n\t\t\tparts = append(parts, \"VERB\")\n\t\t} else {\n\t\t\tparts = append(parts, \"[VERB]\")\n\t\t}\n\t\t// Check for verb options...\n\t\tfor _, verb := range c.verbs {\n\t\t\tif len(verb.options) > 0 {\n\t\t\t\tparts = append(parts, \"[VERB OPTIONS]\")\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\t// Check for verb params\n\t\tfor _, verb := range c.verbs {\n\t\t\tif len(verb.params) > 0 {\n\t\t\t\tparts = append(parts, \"[VERB PARAMETERS...]\")\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\tfmt.Fprintf(w, \"\\nUSAGE: %s\\n\\n\", strings.Join(parts, \" \"))\n\n\tif section, ok := c.Documentation[\"synopsis\"]; ok == true {\n\t\tfmt.Fprintf(w, \"SYNOPSIS\\n\\n%s\\n\\n\", bytes.TrimSpace(section))\n\t}\n\tif section, ok := c.Documentation[\"description\"]; ok == true {\n\t\tfmt.Fprintf(w, \"DESCRIPTION\\n\\n%s\\n\\n\", bytes.TrimSpace(section))\n\t}\n\n\tif len(c.env) > 0 {\n\t\tfmt.Fprintf(w, \"ENVIRONMENT\\n\\n\")\n\t\tif len(c.options) > 0 {\n\t\t\tfmt.Fprintf(w, \"Environment variables can be overridden by corresponding options\\n\\n\")\n\t\t}\n\t\tkeys := []string{}\n\t\tpadding := 0\n\t\tfor k, _ := range c.env {\n\t\t\tkeys = append(keys, k)\n\t\t\tif len(k) > padding {\n\t\t\t\tpadding = len(k) + 1\n\t\t\t}\n\t\t}\n\t\t// Sort the keys alphabetically and display output\n\t\tsort.Strings(keys)\n\t\tfor _, k := range keys {\n\t\t\tfmt.Fprintf(w, \" %s %s\\n\", padRight(k, \" \", padding), c.env[k].Usage)\n\t\t}\n\t\tfmt.Fprintf(w, \"\\n\\n\")\n\t}\n\n\tif len(c.options) > 0 {\n\t\tfmt.Fprintf(w, \"OPTIONS\\n\\n\")\n\t\tif len(c.env) > 0 {\n\t\t\tfmt.Fprintf(w, \"Options will override any corresponding environment settings\\n\\n\")\n\t\t}\n\t\tkeys := []string{}\n\t\tpadding := 0\n\t\tfor k, _ := range c.options {\n\t\t\tkeys = append(keys, k)\n\t\t\tif len(k) > padding {\n\t\t\t\tpadding = len(k) + 1\n\t\t\t}\n\t\t}\n\t\t// Sort the keys alphabetically and display output\n\t\tsort.Strings(keys)\n\t\tfor _, k := range keys {\n\t\t\tfmt.Fprintf(w, \" %s %s\\n\", padRight(k, \" \", padding), c.options[k])\n\t\t}\n\t\tfmt.Fprintf(w, \"\\n\\n\")\n\t}\n\n\tif len(c.verbs) > 0 {\n\t\tfmt.Fprintf(w, \"VERBS\\n\\n\")\n\t\tkeys := []string{}\n\t\tpadding := 0\n\t\tfor k, _ := range c.verbs {\n\t\t\tkeys = append(keys, k)\n\t\t\tif len(k) > padding {\n\t\t\t\tpadding = len(k) + 1\n\t\t\t}\n\t\t}\n\t\t// Sort the keys alphabetically and display output\n\t\tsort.Strings(keys)\n\t\tfor _, k := range keys {\n\t\t\tusage := c.verbs[k].Usage\n\t\t\tfmt.Fprintf(w, \" %s %s\\n\", padRight(k, \" \", padding), usage)\n\t\t\tif len(c.verbs[k].params) > 0 {\n\t\t\t\tif len(c.verbs[k].options) == 0 {\n\t\t\t\t\tfmt.Fprintf(w, \" %s `%s %s %s`\\n\", padRight(\"\", \" \", padding), c.appName, k, strings.Join(c.verbs[k].params, \" \"))\n\t\t\t\t} else {\n\t\t\t\t\tfmt.Fprintf(w, \" %s `%s %s [VERB OPTIONS] %s`\\n\", padRight(\"\", \" \", padding), c.appName, k, strings.Join(c.verbs[k].params, \" \"))\n\t\t\t\t}\n\t\t\t}\n\t\t\tif len(c.verbs[k].options) > 0 {\n\t\t\t\tfmt.Fprintf(w, \" %s verb options:\\n\", padRight(\"\", \" \", padding))\n\t\t\t\tfor op, desc := range c.verbs[k].options {\n\t\t\t\t\tfmt.Fprintf(w, \" %s %s %s\\n\", padRight(\"\", \" \", padding), padRight(op, \" \", padding), desc)\n\t\t\t\t}\n\t\t\t}\n\t\t\tfmt.Fprintf(w, \"\\n\")\n\t\t}\n\t\tfmt.Fprintf(w, \"\\n\\n\")\n\t}\n\n\tif section, ok := c.Documentation[\"examples\"]; ok == true {\n\t\tfmt.Fprintf(w, \"EXAMPLES\\n\\n%s\\n\\n\", bytes.TrimSpace(section))\n\t}\n\n\tif section, ok := c.Documentation[\"bugs\"]; ok == true {\n\t\tfmt.Fprintf(w, \"BUGS\\n\\n%s\\n\\n\", bytes.TrimSpace(section))\n\t}\n\n\tif len(c.Documentation) > 0 {\n\t\tkeys := []string{}\n\t\tfor k, _ := range c.verbs {\n\t\t\tif _, hasDoc := c.Documentation[k]; hasDoc == true {\n\t\t\t\tkeys = append(keys, k)\n\t\t\t}\n\t\t}\n\t\tif len(keys) > 0 {\n\t\t\t// Sort the keys alphabetically and display output\n\t\t\tsort.Strings(keys)\n\t\t\tfmt.Fprintf(w, \"See %s -help TOPIC for topics - %s\\n\\n\", c.appName, strings.Join(keys, \", \"))\n\t\t}\n\t}\n\n\tfmt.Fprintf(w, \"%s\\n\", c.version)\n}", "title": "" }, { "docid": "12254704e3c82b44db72d76144e75aa7", "score": "0.695775", "text": "func printUsage(w io.Writer) {\n\tfmt.Fprintf(w, \"%s\\n\\n\", Short)\n\tfmt.Fprintf(w, \"Usage:\\n\\n %s [help] <command> [<args>...]\\n\\n\", Name)\n\n\ttopics := false\n\tfmt.Fprintf(w, \"The commands are:\\n\")\n\tmutex.Lock()\n\tdefer mutex.Unlock()\n\tvar cmds []string\n\tfor cn, c := range commands {\n\t\tcmds = append(cmds, cn)\n\t\tif !c.runnable() {\n\t\t\ttopics = true\n\t\t}\n\t}\n\tsort.Strings(cmds)\n\n\tfor _, cn := range cmds {\n\t\tc := commands[cn]\n\t\tif !c.runnable() {\n\t\t\tcontinue\n\t\t}\n\t\tfmt.Fprintf(w, \" %-16s %s\\n\", c.Name(), c.Short)\n\t}\n\tfmt.Fprintf(w, \"\\nUse '%s help <command>' for more information about a command.\\n\\n\", Name)\n\n\tif !topics {\n\t\treturn\n\t}\n\tfmt.Fprintf(w, \"Additional help topics:\\n\\n\")\n\tfor _, cn := range cmds {\n\t\tc := commands[cn]\n\t\tif c.runnable() {\n\t\t\tcontinue\n\t\t}\n\t\tfmt.Fprintf(w, \" %-16s %s\\n\", c.Name(), c.Short)\n\t}\n\tfmt.Fprintf(w, \"\\nUse '%s help <topic>' for more information about that topic.\\n\\n\", Name)\n}", "title": "" }, { "docid": "ae5ee5e06a49061f3b8082caf448341a", "score": "0.69520825", "text": "func usage() string {\n\tusage := \"GoSCSV is a command line CSV processing tool.\\n\"\n\tusage += fmt.Sprintf(\"Version: %s (%s)\\n\", VERSION, GIT_HASH)\n\tusage += \"Subcommands:\\n\"\n\tfor _, subcommand := range subcommands {\n\t\tusage += usageForSubcommand(subcommand)\n\t}\n\tusage += \"See https://github.com/flowrean/goscsv for more documentation.\"\n\treturn usage\n}", "title": "" }, { "docid": "7193175061a57b05be4265350eb1f437", "score": "0.6948058", "text": "func todoUsage() {\n\tfmt.Fprintf(os.Stderr, `Service that manage todo.\nUsage:\n %s [globalflags] todo COMMAND [flags]\n\nCOMMAND:\n hello: Hello implements hello.\n show: Show implements show.\n create: Create implements create.\n update: Update implements update.\n delete: Delete implements delete.\n\nAdditional help:\n %s todo COMMAND --help\n`, os.Args[0], os.Args[0])\n}", "title": "" }, { "docid": "9c1014963af47b4a08d5d200c0a989f6", "score": "0.69460136", "text": "func usage() {\n\tfmt.Printf(\"Welcome to Kangaroo Coin\\n\\n\")\n\tfmt.Printf(\"Please use the follow flags:\\n\\n\")\n\tfmt.Printf(\"-port:\tSet the PORT of the server (default 4000)\\n\")\n\tfmt.Printf(\"-mode:\tChoose between 'html', 'rest', and 'all' (rest is recommended)\\n\")\n\tos.Exit(0)\n}", "title": "" }, { "docid": "c807d08175ef4db584fecaf66cc1303e", "score": "0.6940859", "text": "func peopleUsage() {\n\tfmt.Fprintf(os.Stderr, `Service is the people service interface.\nUsage:\n %s [globalflags] people COMMAND [flags]\n\nCOMMAND:\n list: list\n create: create\n show: show\n update: update\n delete: delete\n\nAdditional help:\n %s people COMMAND --help\n`, os.Args[0], os.Args[0])\n}", "title": "" }, { "docid": "e537f1b6630f0460ad05a29c5ed3b8a4", "score": "0.6927949", "text": "func exportUsage() {\n\tfmt.Fprintf(os.Stderr, `Service is the export service interface.\nUsage:\n %s [globalflags] export COMMAND [flags]\n\nCOMMAND:\n list- mine: ListMine implements list mine.\n status: Status implements status.\n download: Download implements download.\n csv: Csv implements csv.\n json- lines: JSONLines implements json lines.\n\nAdditional help:\n %s export COMMAND --help\n`, os.Args[0], os.Args[0])\n}", "title": "" }, { "docid": "2746c724b95121ebd0136a7f390a0293", "score": "0.6902157", "text": "func Usage() {\n\tfmt.Fprintf(os.Stderr, \"Usage of go-gencon:\\n\")\n\tfmt.Fprintf(os.Stderr, \" go-gencon [flags] -type containee -cont container\\n\")\n\tfmt.Fprintf(os.Stderr, \"\\n\")\n\tfmt.Fprintf(os.Stderr, \"Available generic containers:\\n\")\n\tfmt.Fprintf(os.Stderr, \" - Stack\\n\")\n\tfmt.Fprintf(os.Stderr, \" - BoundedStack\\n\")\n\tfmt.Fprintf(os.Stderr, \" - LockFreeQueue\\n\")\n\tfmt.Fprintf(os.Stderr, \" - Set\\n\")\n\tfmt.Fprintf(os.Stderr, \"\\n\")\n\tfmt.Fprintf(os.Stderr, \"For more information, see:\\n\")\n\tfmt.Fprintf(os.Stderr, \"\\thttp://github.com/arl/go-gencon\\n\")\n\tfmt.Fprintf(os.Stderr, \"Flags:\\n\")\n\tflag.PrintDefaults()\n}", "title": "" }, { "docid": "b6281fef43f46edbe20917c98d655344", "score": "0.6896939", "text": "func usage() {\n\tfmt.Fprintf(os.Stderr, \"usage: gist [options] <file>|-\\n\")\n\tflag.PrintDefaults()\n\tos.Exit(2)\n}", "title": "" }, { "docid": "b135443591f02ecf705c5ceaa8c95ce3", "score": "0.68722916", "text": "func catalogUsage() {\n\tfmt.Fprintf(os.Stderr, `The Catalog Service exposes endpoints to interact with catalogs\nUsage:\n %[1]s [globalflags] catalog COMMAND [flags]\n\nCOMMAND:\n refresh: Refresh a Catalog by it's name\n refresh-all: Refresh all catalogs\n catalog-error: List all errors occurred refreshing a catalog\n\nAdditional help:\n %[1]s catalog COMMAND --help\n`, os.Args[0])\n}", "title": "" }, { "docid": "0eeea83198695bd835ae2f453f4be489", "score": "0.6868137", "text": "func Usage(args []string, app *kingpin.Application, out, err io.Writer, vars map[string]any) string {\n\tvar buf bytes.Buffer\n\tapp.Writers(&buf, io.Discard)\n\tapp.UsageContext(&kingpin.UsageContext{\n\t\tTemplate: CompactUsageTemplate,\n\t\tFuncs: UsageTemplateFuncs,\n\t\tVars: vars,\n\t})\n\tapp.Usage(args)\n\tapp.Writers(out, err)\n\treturn buf.String()\n}", "title": "" }, { "docid": "52ca203611041942b02df9f200832929", "score": "0.68680865", "text": "func adminUsage() {\n\tfmt.Fprintf(os.Stderr, `Admin service\nUsage:\n %[1]s [globalflags] admin COMMAND [flags]\n\nCOMMAND:\n update-agent: Create or Update an agent user with required scopes\n refresh-config: Refresh the changes in config file\n\nAdditional help:\n %[1]s admin COMMAND --help\n`, os.Args[0])\n}", "title": "" }, { "docid": "f62fa44020209b2a1a395d557068a20f", "score": "0.6854384", "text": "func Usage() {\n\tfmt.Fprintf(os.Stderr, \"Usage of tfplugingen:\\n\")\n\tfmt.Fprintf(os.Stderr, \"\\ttfplugingen [flags] -type T [directory]\\n\")\n\tfmt.Fprintf(os.Stderr, \"\\ttfplugingen [flags] -type T files... # Must be a single package\\n\")\n\tfmt.Fprintf(os.Stderr, \"Flags:\\n\")\n\tflag.PrintDefaults()\n}", "title": "" }, { "docid": "71e191bbcee5ac3f84a7dca055ceffc0", "score": "0.68499494", "text": "func usage() {\n\tdoc := heredoc.Doc(`\n\n\tFor running with AMQP and Prometheus use following option\n\t********************* Production *********************\n\tgo run main.go -mhost=localhost -mport=8081 -amqpurl=10.19.110.5:5672/collectd/telemetry\n\t**************************************************************\n\n\tFor running Sample data wihout AMQP use following option\n\t********************* Sample Data *********************\n\tgo run main.go -mhost=localhost -mport=8081 -usesample=true -h=10 -p=100 -t=-1 \n\t*************************************************************`)\n\tfmt.Fprintln(os.Stderr, `Required commandline argument missing`)\n\tfmt.Fprintln(os.Stdout, doc)\n\tflag.PrintDefaults()\n}", "title": "" }, { "docid": "0ff6db3ec3a4db4731b08c0b73f12bcc", "score": "0.6843683", "text": "func ttnUsage() {\n\tfmt.Fprintf(os.Stderr, `Service is the ttn service interface.\nUsage:\n %s [globalflags] ttn COMMAND [flags]\n\nCOMMAND:\n webhook: Webhook implements webhook.\n\nAdditional help:\n %s ttn COMMAND --help\n`, os.Args[0], os.Args[0])\n}", "title": "" }, { "docid": "497782aee53588974f4b6a7e380cb8a2", "score": "0.68434805", "text": "func (sc *splitCmd) Usage() string {\n\treturn `split -file=FileName [-size=Size] [-out=FileName].\n`\n}", "title": "" }, { "docid": "1c2e661167880696b634c638b11976b1", "score": "0.6838994", "text": "func discourseUsage() {\n\tfmt.Fprintf(os.Stderr, `Service is the discourse service interface.\nUsage:\n %s [globalflags] discourse COMMAND [flags]\n\nCOMMAND:\n authenticate: Authenticate implements authenticate.\n\nAdditional help:\n %s discourse COMMAND --help\n`, os.Args[0], os.Args[0])\n}", "title": "" }, { "docid": "40b854efa78f8c7735490c7de84f7f6c", "score": "0.6835802", "text": "func UsageCommands() string {\n\treturn `healthcheck (liveness|readiness)\nweather weather-query\n`\n}", "title": "" }, { "docid": "103a0b42f9f8f033df1a052cb668b387", "score": "0.68297607", "text": "func (cch *CompositeCommandHandler) Usage(err ...error) {\n\tif len(err) > 0 {\n\t\tfmt.Printf(\"The following errors occurred: %v\\n\", err)\n\t}\n\n\tfor k := range cch.subHandlers {\n\t\tfmt.Printf(\" %s\\n\", k)\n\t}\n\n\tos.Exit(1)\n}", "title": "" }, { "docid": "79ec5c5903cab0db8e90751b3163ce48", "score": "0.6828089", "text": "func printUsage() {\n\tfmt.Printf(\"Usage: %s [OPTION]... FILE... TARGET\\n\"+\n\t\t\"Create or update the chroot environment in TARGET using \"+\n\t\t\"specification\\n\"+\n\t\t\"FILEs. TARGET should be a directory and is created if it does not\\n\"+\n\t\t\"exist.\\n\\n\", os.Args[0])\n\tflag.VisitAll(func(f *flag.Flag) {\n\t\tfmt.Printf(\" --%-23s %s\\n\", f.Name, f.Usage)\n\t})\n\tfmt.Printf(\"\\nFor bug reporting instructions, please see:\\n\" +\n\t\t\"<https://github.com/cblichmann/jailtime/issues>\\n\")\n}", "title": "" }, { "docid": "e564e4a21ffb345593dd49be237b41e2", "score": "0.6822178", "text": "func showUsage() {\n\tinfo := usage.NewInfo(\"\", \"app-name\")\n\n\tinfo.AddOption(OPT_PROCFILE, \"Path to procfile\", \"file\")\n\tinfo.AddOption(OPT_DRY_START, \"Dry start {s-}(don't export anything, just parse and test procfile){!}\")\n\tinfo.AddOption(OPT_DISABLE_VALIDATION, \"Disable application validation\")\n\tinfo.AddOption(OPT_UNINSTALL, \"Remove scripts and helpers for a particular application\")\n\tinfo.AddOption(OPT_FORMAT, \"Format of generated configs\", \"upstart|systemd\")\n\tinfo.AddOption(OPT_NO_COLORS, \"Disable colors in output\")\n\tinfo.AddOption(OPT_HELP, \"Show this help message\")\n\tinfo.AddOption(OPT_VERSION, \"Show version\")\n\n\tinfo.AddExample(\"-p ./myprocfile -f systemd myapp\", \"Export given procfile to systemd as myapp\")\n\tinfo.AddExample(\"-u -f systemd myapp\", \"Uninstall myapp from systemd\")\n\n\tinfo.AddExample(\"-p ./myprocfile -f upstart myapp\", \"Export given procfile to upstart as myapp\")\n\tinfo.AddExample(\"-u -f upstart myapp\", \"Uninstall myapp from upstart\")\n\n\tinfo.Render()\n}", "title": "" }, { "docid": "8665ee472c600b020d8904312e096dbb", "score": "0.6817648", "text": "func apiUsage() {\n\tfmt.Printf(\"NAME:\\n %s - %s\\n\\n\", serviceName, serviceDescription)\n\tfmt.Printf(\"USAGE: %s [global options] [arguments...]\\n\\n\", serviceName)\n\tfmt.Printf(\"VERSION:\\n %s\\n\\n\", serviceVersion)\n\tfmt.Printf(\"DESCRIPTION:\\n %s\\n\\n\", appDescription)\n\tfmt.Printf(\"GLOBAL OPTIONS:\\n\")\n\tflag.PrintDefaults()\n\tfmt.Printf(\"\\n\")\n}", "title": "" }, { "docid": "910534d88a278539a381a3f40aec14ce", "score": "0.68146765", "text": "func followingUsage() {\n\tfmt.Fprintf(os.Stderr, `Service is the following service interface.\nUsage:\n %s [globalflags] following COMMAND [flags]\n\nCOMMAND:\n follow: Follow implements follow.\n unfollow: Unfollow implements unfollow.\n followers: Followers implements followers.\n\nAdditional help:\n %s following COMMAND --help\n`, os.Args[0], os.Args[0])\n}", "title": "" }, { "docid": "b0b47049f20ede4b57726f77aa4c8726", "score": "0.6801372", "text": "func (cmd *CLI) UsageString() string {\n\thasSubCommands := len(cmd.subCommands) > 0\n\thasParams := len(cmd.params) > 0\n\thasDescription := len(cmd.description) > 0\n\n\t// Start the Buffer\n\tvar buff bytes.Buffer\n\n\tbuff.WriteString(\"Usage:\\n\")\n\tbuff.WriteString(fmt.Sprintf(\" %s [options...]\", cmd.Name()))\n\n\t// Write Param Syntax\n\tif hasParams {\n\t\tbuff.WriteString(fmt.Sprintf(\" %s\", cmd.paramable.UsageString()))\n\t}\n\n\t// Write Sub Command Syntax\n\tif hasSubCommands {\n\t\tbuff.WriteString(\" <command> [arg...]\")\n\t}\n\n\tif hasDescription {\n\t\tbuff.WriteString(fmt.Sprintf(\"\\n\\n%s\", cmd.Description()))\n\t}\n\n\t// Write Flags Syntax\n\tbuff.WriteString(\"\\n\\nOptions:\\n\")\n\tbuff.WriteString(cmd.flagable.UsageString())\n\n\t// Write Sub Command List\n\tif hasSubCommands {\n\t\tbuff.WriteString(\"\\n\\nCommands:\\n\")\n\t\tbuff.WriteString(cmd.subCommandable.UsageString())\n\t}\n\n\t// Return buffer as string\n\treturn buff.String()\n}", "title": "" }, { "docid": "e00239b04fe83e0f50ac0d9bc7559d4a", "score": "0.6801233", "text": "func Usage() {\n\t_, _ = fmt.Fprintf(os.Stderr, \"Usage of go-syncpool:\\n\")\n\t_, _ = fmt.Fprintf(os.Stderr, \"\\tgo-syncpool [flags] -type T [directory]\\n\")\n\t_, _ = fmt.Fprintf(os.Stderr, \"\\tgo-syncpool [flags] -type T<V> [directory]\\n\")\n\t_, _ = fmt.Fprintf(os.Stderr, \"\\tgo-syncpool [flags] -type T<V> files... # Must be a single package\\n\")\n\t_, _ = fmt.Fprintf(os.Stderr, \"\\tgo-syncpool [flags] -type T,S [directory]\\n\")\n\t_, _ = fmt.Fprintf(os.Stderr, \"\\tgo-syncpool [flags] -type T<V>,S<V> [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-syncpool\\n\")\n\t_, _ = fmt.Fprintf(os.Stderr, \"Flags:\\n\")\n\tflag.PrintDefaults()\n}", "title": "" }, { "docid": "084030834c02c5ab256f61c3838c3026", "score": "0.6800257", "text": "func PrintUsage(name string) {\n\tDefault.PrintUsage(name)\n}", "title": "" } ]
f9c3e347a7e96bae3ed2fcf295d61e5a
ToAuthorshipMedia converts an authorship model into an authorship media type
[ { "docid": "1f696ce2e60e42b9c3100abcdd8e67c8", "score": "0.8522126", "text": "func ToAuthorshipMedia(a *model.Authorship) *app.Authorship {\n\tif a == nil {\n\t\treturn nil\n\t}\n\treturn &app.Authorship{\n\t\tAuthorshipID: int(a.ID),\n\t\tAuthorID: int(a.AuthorID),\n\t\tAuthor: ToAuthorMedia(a.Author),\n\t\tBookID: int(a.BookID),\n\t\tBook: ToBookMedia(a.Book),\n\t\tRoleID: int(a.RoleID),\n\t\tRole: ToRoleMedia(a.Role),\n\t\tHref: app.AuthorshipsHref(a.ID),\n\t}\n}", "title": "" } ]
[ { "docid": "f58d580e03393330d342b174e80c7594", "score": "0.69673914", "text": "func ToAuthorMedia(a *model.Author) *app.Author {\n\tif a == nil {\n\t\treturn nil\n\t}\n\treturn &app.Author{\n\t\tHref: app.AuthorsHref(a.ID),\n\t\tAuthorID: int(a.ID),\n\t\tAuthorName: a.Name,\n\t}\n}", "title": "" }, { "docid": "56b70bdf660396ad02d4ff413c936b85", "score": "0.61916727", "text": "func ToOwnershipMedia(a *model.Ownership) *app.Ownership {\n\tif a == nil {\n\t\treturn nil\n\t}\n\treturn &app.Ownership{\n\t\tBook: ToBookMedia(a.Book),\n\t\tBookID: int(a.BookID),\n\t\tHref: app.OwnershipsHref(a.UserID, a.BookID),\n\t\tUserID: int(a.UserID),\n\t}\n}", "title": "" }, { "docid": "a3ae2d037abd41c6b3cfe82285e74a98", "score": "0.5945485", "text": "func ToEditorMedia(a *model.Editor) *app.Editor {\n\tif a == nil {\n\t\treturn nil\n\t}\n\treturn &app.Editor{\n\t\tHref: app.EditorsHref(a.ID),\n\t\tEditorID: int(a.ID),\n\t\tEditorName: a.Name,\n\t}\n}", "title": "" }, { "docid": "7b010d5f5aeed48c56220fe3241927c4", "score": "0.5507346", "text": "func ToEditionMedia(a *model.Edition) *app.Edition {\n\tif a == nil {\n\t\treturn nil\n\t}\n\treturn &app.Edition{\n\t\tEditionID: int(a.ID),\n\t\tBookID: int(a.BookID),\n\t\tBook: ToBookMedia(a.Book),\n\t\tCollectionID: int(a.CollectionID),\n\t\tCollection: ToCollectionMedia(a.Collection),\n\t\tPrintID: int(a.PrintID),\n\t\tPrint: ToPrintMedia(a.Print),\n\t\tHref: app.EditionsHref(a.ID),\n\t}\n}", "title": "" }, { "docid": "510d4e2ffa6be7dbe560daf970883715", "score": "0.53116906", "text": "func ToCollectionMedia(a *model.Collection) *app.Collection {\n\tif a == nil {\n\t\treturn nil\n\t}\n\treturn &app.Collection{\n\t\tCollectionID: int(a.ID),\n\t\tCollectionName: a.Name,\n\t\tEditorID: int(a.EditorID),\n\t\tEditor: ToEditorMedia(a.Editor),\n\t\tHref: app.CollectionsHref(a.ID),\n\t}\n}", "title": "" }, { "docid": "b2f269494199be091476303e69a03cb7", "score": "0.53072596", "text": "func ToRoleMedia(a *model.Role) *app.Role {\n\tif a == nil {\n\t\treturn nil\n\t}\n\treturn &app.Role{\n\t\tHref: app.RolesHref(a.ID),\n\t\tRoleID: int(a.ID),\n\t\tRoleName: a.Name,\n\t}\n}", "title": "" }, { "docid": "864d173f7dd26ada4ef05784e9da0500", "score": "0.5305634", "text": "func ToBookDetailMedia(a *model.BookDetail) *app.BookDetail {\n\tif a == nil {\n\t\treturn nil\n\t}\n\tret := &app.BookDetail{\n\t\tBook: ToBookMedia(a.Book),\n\t\tEdition: ToEditionMedia(a.Edition),\n\t}\n\tif len(a.Authors) > 0 {\n\t\tfor i := range a.Authors {\n\t\t\tret.Authors = append(ret.Authors, ToAuthorshipMedia(a.Authors[i]))\n\t\t}\n\t}\n\tif len(a.Classes) > 0 {\n\t\tfor i := range a.Classes {\n\t\t\tret.Classes = append(ret.Classes, ToClassificationMedia(int(a.Book.SeriesID), a.Classes[i]))\n\t\t}\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "25cf913a26bd7c34e3a4b565833ad9f0", "score": "0.51496327", "text": "func ToBookMedia(a *model.Book) *app.Book {\n\tif a == nil {\n\t\treturn nil\n\t}\n\treturn &app.Book{\n\t\tHref: app.BooksHref(a.ID),\n\t\tBookID: int(a.ID),\n\t\tBookName: a.Name,\n\t\tBookIsbn: a.ISBN,\n\t}\n}", "title": "" }, { "docid": "13d85c7d881e1db6638e35661051904d", "score": "0.5120266", "text": "func ToBookLinkMedia(a *model.Book) *app.BookLink {\n\tif a == nil {\n\t\treturn nil\n\t}\n\treturn &app.BookLink{\n\t\tHref: app.BooksHref(a.ID),\n\t\tBookID: int(a.ID),\n\t}\n}", "title": "" }, { "docid": "1201062743712154378771791c193808", "score": "0.4982335", "text": "func ToAuthTokenMedia(a *model.User, accToken, refToken string) *app.Authtoken {\n\tif a == nil {\n\t\treturn nil\n\t}\n\treturn &app.Authtoken{\n\t\tUser: ToUserMedia(a),\n\t\tAccessToken: accToken,\n\t\tRefreshToken: refToken,\n\t}\n}", "title": "" }, { "docid": "184c84bd266b414b1f17f82f13ad6f51", "score": "0.49254555", "text": "func ToRoomMedia(r *models.Room) *app.Room {\n\treturn &app.Room{\n\t\tName: r.Name,\n\t\tCreated: r.Created,\n\t\tDescription: r.Description,\n\t}\n}", "title": "" }, { "docid": "3ce5b04626870e52c392c4933141008e", "score": "0.49237737", "text": "func ToClassificationMedia(seriesID int, a *model.Class) *app.Classification {\n\tif a == nil {\n\t\treturn nil\n\t}\n\treturn &app.Classification{\n\t\tClass: ToClassMedia(a),\n\t\tHref: app.ClassificationsHref(seriesID, a.ID),\n\t}\n}", "title": "" }, { "docid": "59ab0d90285b16a21c58d07614f98ba2", "score": "0.48931012", "text": "func ToPrintMedia(a *model.Print) *app.Print {\n\tif a == nil {\n\t\treturn nil\n\t}\n\treturn &app.Print{\n\t\tHref: app.PrintsHref(a.ID),\n\t\tPrintID: int(a.ID),\n\t\tPrintName: a.Name,\n\t}\n}", "title": "" }, { "docid": "ac5e52a4e4cd611137faad0955031ce7", "score": "0.48532832", "text": "func (c *ArchiveInsertCall) Media(r io.Reader) *ArchiveInsertCall {\n\tc.caller_ = &googleapi.MediaUpload{\n\t\tMedia: r,\n\t}\n\tc.pathTemplate_ = \"/upload/groups/v1/groups/{groupId}/archive\"\n\treturn c\n}", "title": "" }, { "docid": "efd314830335805684db130c19338b5e", "score": "0.48361564", "text": "func ToCategoryMedia(a *model.Category) *app.Category {\n\tif a == nil {\n\t\treturn nil\n\t}\n\treturn &app.Category{\n\t\tHref: app.CategoriesHref(a.ID),\n\t\tCategoryID: int(a.ID),\n\t\tCategoryName: a.Name,\n\t}\n}", "title": "" }, { "docid": "269dd402ed04802665103a57f7617e73", "score": "0.48108754", "text": "func ToRoomCollectionMedia(rs []*models.Room) *app.RoomCollection {\n\tres := app.RoomCollection{}\n\tfor _, r := range rs {\n\t\tres = append(res, ToRoomMedia(r))\n\t}\n\treturn &res\n}", "title": "" }, { "docid": "4563a42db02d120743f5bec15c39d282", "score": "0.47459754", "text": "func (r *rawBadgeMedia) export() BadgeMedia {\n\treturn BadgeMedia{\n\t\tSmallImage: url.URL(r.SmallImage),\n\t\tMediumImage: url.URL(r.MediumImage),\n\t\tLargeImage: url.URL(r.LargeImage),\n\t}\n}", "title": "" }, { "docid": "43d5f6a93cae977b8c1e7992754b99be", "score": "0.47452208", "text": "func (m *MediaContentRatingAustralia) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) {\n if m.GetMovieRating() != nil {\n cast := (*m.GetMovieRating()).String()\n err := writer.WriteStringValue(\"movieRating\", &cast)\n if err != nil {\n return err\n }\n }\n {\n err := writer.WriteStringValue(\"@odata.type\", m.GetOdataType())\n if err != nil {\n return err\n }\n }\n if m.GetTvRating() != nil {\n cast := (*m.GetTvRating()).String()\n err := writer.WriteStringValue(\"tvRating\", &cast)\n if err != nil {\n return err\n }\n }\n {\n err := writer.WriteAdditionalData(m.GetAdditionalData())\n if err != nil {\n return err\n }\n }\n return nil\n}", "title": "" }, { "docid": "646a3455c0d56876ed44e27a01f0fb99", "score": "0.4678977", "text": "func ToClassMedia(a *model.Class) *app.Class {\n\tif a == nil {\n\t\treturn nil\n\t}\n\treturn &app.Class{\n\t\tHref: app.ClassesHref(a.ID),\n\t\tClassID: int(a.ID),\n\t\tClassName: a.Name,\n\t}\n}", "title": "" }, { "docid": "693fddb25df14c814ba13fa11820b6d7", "score": "0.4662321", "text": "func ToUserMedia(a *model.User) *app.User {\n\tif a == nil {\n\t\treturn nil\n\t}\n\treturn &app.User{\n\t\tEmail: a.Email,\n\t\tHref: app.UsersHref(a.ID),\n\t\tUserID: int(a.ID),\n\t\tNickname: a.Nickname,\n\t\tIsAdmin: a.IsAdmin,\n\t\tIsValidated: a.IsValidated,\n\t}\n}", "title": "" }, { "docid": "795588184c788dc9b6e3157188960994", "score": "0.4655424", "text": "func (c *Client) WoWAzeriteEssenceMedia(ctx context.Context, azeriteEssenceID int) (*wowgd.AzeriteEssenceMedia, *Header, error) {\n\tdat, header, err := c.getStructData(ctx,\n\t\tfmt.Sprintf(\"/data/wow/media/azerite-essence/%d\", azeriteEssenceID),\n\t\tc.GetStaticNamespace(),\n\t\t&wowgd.AzeriteEssenceMedia{},\n\t)\n\treturn dat.(*wowgd.AzeriteEssenceMedia), header, err\n}", "title": "" }, { "docid": "723e8ad76605e50bc7978e4f24a0283d", "score": "0.465505", "text": "func getMediaTypeForImp(bid openrtb2.Bid) openrtb_ext.BidType {\n\tswitch bid.MType {\n\tcase openrtb2.MarkupBanner:\n\t\treturn openrtb_ext.BidTypeBanner\n\tcase openrtb2.MarkupVideo:\n\t\treturn openrtb_ext.BidTypeVideo\n\tdefault:\n\t\treturn \"\"\n\t}\n}", "title": "" }, { "docid": "b335405aa4409ba048405a37b1cb9957", "score": "0.46268362", "text": "func (c *Client) WoWCreatureFamilyMedia(ctx context.Context, creatureFamilyID int) (*wowgd.CreatureFamilyMedia, *Header, error) {\n\tdat, header, err := c.getStructData(ctx,\n\t\tfmt.Sprintf(\"/data/wow/media/creature-family/%d\", creatureFamilyID),\n\t\tc.GetStaticNamespace(),\n\t\t&wowgd.CreatureFamilyMedia{},\n\t)\n\treturn dat.(*wowgd.CreatureFamilyMedia), header, err\n}", "title": "" }, { "docid": "97d8ab98db506f72e2694bc02d47d12e", "score": "0.452309", "text": "func (c *Convert) ToJson(mf *MediaFile) (*MediaFile, error) {\n\tjsonName := fs.TypeJson.FindFirst(mf.FileName(), []string{c.conf.SidecarPath(), fs.HiddenPath}, c.conf.OriginalsPath(), c.conf.Settings().Index.Group)\n\n\tresult, err := NewMediaFile(jsonName)\n\n\tif err == nil {\n\t\treturn result, nil\n\t}\n\n\tif !c.conf.SidecarWritable() {\n\t\treturn nil, fmt.Errorf(\"convert: metadata export to json disabled in read only mode (%s)\", mf.RelativeName(c.conf.OriginalsPath()))\n\t}\n\n\tjsonName = fs.FileName(mf.FileName(), c.conf.SidecarPath(), c.conf.OriginalsPath(), \".json\", c.conf.Settings().Index.Group)\n\n\tfileName := mf.RelativeName(c.conf.OriginalsPath())\n\n\tlog.Infof(\"convert: %s -> %s\", fileName, filepath.Base(jsonName))\n\n\tcmd := exec.Command(c.conf.ExifToolBin(), \"-j\", mf.FileName())\n\n\t// Fetch command output.\n\tvar out bytes.Buffer\n\tvar stderr bytes.Buffer\n\tcmd.Stdout = &out\n\tcmd.Stderr = &stderr\n\n\t// Run convert command.\n\tif err := cmd.Run(); err != nil {\n\t\tif stderr.String() != \"\" {\n\t\t\treturn nil, errors.New(stderr.String())\n\t\t} else {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Write output to file.\n\tif err := ioutil.WriteFile(jsonName, []byte(out.String()), os.ModePerm); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Check if file exists.\n\tif !fs.FileExists(jsonName) {\n\t\treturn nil, fmt.Errorf(\"convert: %s could not be created, check configuration\", jsonName)\n\t}\n\n\treturn NewMediaFile(jsonName)\n}", "title": "" }, { "docid": "be917b1a192bcf56bfb52dd355e8dd94", "score": "0.45226762", "text": "func CreateMediaContentRatingAustraliaFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewMediaContentRatingAustralia(), nil\n}", "title": "" }, { "docid": "1d42523a5f9f5d0190eb30632d77ebc5", "score": "0.45092994", "text": "func ToExternalRepresentation(distribution interface{}, ir float64) (interface{}, error) {\n\tswitch d := distribution.(type) {\n\tcase UniformDistribution:\n\t\treturn d.ToExternalRepr(ir), nil\n\tcase LogUniformDistribution:\n\t\treturn d.ToExternalRepr(ir), nil\n\tcase IntUniformDistribution:\n\t\treturn d.ToExternalRepr(ir), nil\n\tcase StepIntUniformDistribution:\n\t\treturn d.ToExternalRepr(ir), nil\n\tcase DiscreteUniformDistribution:\n\t\treturn d.ToExternalRepr(ir), nil\n\tcase CategoricalDistribution:\n\t\treturn d.ToExternalRepr(ir), nil\n\tdefault:\n\t\treturn nil, ErrUnknownDistribution\n\t}\n}", "title": "" }, { "docid": "a9eb3e910d9ba0c719d58b325c3135b2", "score": "0.4477809", "text": "func (m *MediaContentRatingNewZealand) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) {\n if m.GetMovieRating() != nil {\n cast := (*m.GetMovieRating()).String()\n err := writer.WriteStringValue(\"movieRating\", &cast)\n if err != nil {\n return err\n }\n }\n {\n err := writer.WriteStringValue(\"@odata.type\", m.GetOdataType())\n if err != nil {\n return err\n }\n }\n if m.GetTvRating() != nil {\n cast := (*m.GetTvRating()).String()\n err := writer.WriteStringValue(\"tvRating\", &cast)\n if err != nil {\n return err\n }\n }\n {\n err := writer.WriteAdditionalData(m.GetAdditionalData())\n if err != nil {\n return err\n }\n }\n return nil\n}", "title": "" }, { "docid": "ec69eaa473c2c696f49dd342fdcb9c69", "score": "0.44663447", "text": "func extractMedia(media []twitter.MediaEntity) []string {\n\tlinks := make([]string, len(media))\n\tfor i, source := range media {\n\t\tswitch source.Type {\n\t\tcase \"photo\":\n\t\t\tlinks[i] = source.MediaURLHttps\n\n\t\tcase \"animated_gif\", \"video\":\n\t\t\tlinks[i] = source.VideoInfo.Variants[0].URL\n\t\t}\n\t}\n\treturn links\n}", "title": "" }, { "docid": "2ba5805031aa6889e4f46e881c441707", "score": "0.44645596", "text": "func (c *Client) WoWAchievementMedia(ctx context.Context, achievementID int) (*wowgd.AchievementMedia, *Header, error) {\n\tdat, header, err := c.getStructData(ctx,\n\t\tfmt.Sprintf(\"/data/wow/media/achievement/%d\", achievementID),\n\t\tc.GetStaticNamespace(),\n\t\t&wowgd.AchievementMedia{},\n\t)\n\treturn dat.(*wowgd.AchievementMedia), header, err\n}", "title": "" }, { "docid": "965376c1658c78351dce988c14a4e311", "score": "0.44602054", "text": "func NewMediaContentRatingAustralia()(*MediaContentRatingAustralia) {\n m := &MediaContentRatingAustralia{\n }\n m.SetAdditionalData(make(map[string]interface{}));\n return m\n}", "title": "" }, { "docid": "ac6549d5223044186d581b545cf76bab", "score": "0.44468296", "text": "func (c *Client) WoWCreatureDisplayMedia(ctx context.Context, creatureDisplayID int) (*wowgd.CreatureDisplayMedia, *Header, error) {\n\tdat, header, err := c.getStructData(ctx,\n\t\tfmt.Sprintf(\"/data/wow/media/creature-display/%d\", creatureDisplayID),\n\t\tc.GetStaticNamespace(),\n\t\t&wowgd.CreatureDisplayMedia{},\n\t)\n\treturn dat.(*wowgd.CreatureDisplayMedia), header, err\n}", "title": "" }, { "docid": "a131123bbf6ae3a7c69f61d6a95ce621", "score": "0.43981525", "text": "func (a *Author) MarshalEditor() ([]byte, error) {\n\tview, err := editor.Form(a,\n\t\t// Take note that the first argument to these Input-like functions\n\t\t// is the string version of each Author field, and must follow\n\t\t// this pattern for auto-decoding and auto-encoding reasons:\n\t\teditor.Field{\n\t\t\tView: editor.Input(\"Name\", a, map[string]string{\n\t\t\t\t\"label\": \"Name\",\n\t\t\t\t\"type\": \"text\",\n\t\t\t\t\"placeholder\": \"Enter the Name here\",\n\t\t\t}),\n\t\t},\n\t\teditor.Field{\n\t\t\tView: editor.Input(\"Email\", a, map[string]string{\n\t\t\t\t\"label\": \"Email\",\n\t\t\t\t\"type\": \"text\",\n\t\t\t\t\"placeholder\": \"Enter the Email here\",\n\t\t\t}),\n\t\t},\n\t\teditor.Field{\n\t\t\tView: reference.Select(\"Affiliation\", a, map[string]string{\n\t\t\t\t\"label\": \"Affiliation\",\n\t\t\t},\n\t\t\t\t\"Organization\",\n\t\t\t\t`Organization: {{ .id }}`,\n\t\t\t),\n\t\t},\n\t)\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to render Author editor view: %s\", err.Error())\n\t}\n\n\treturn view, nil\n}", "title": "" }, { "docid": "bfb191171ea7fb902a50a29272f2b72c", "score": "0.43889523", "text": "func (o StreamOutput) MediaType() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Stream) pulumi.StringPtrOutput { return v.MediaType }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "11e2dec330468bc7b13443d82c284328", "score": "0.43872207", "text": "func (m *Movie) toListing() listing.Movie {\n\treturn listing.Movie{\n\t\tID: m.ID,\n\t\tTitle: m.Title,\n\t\tPlot: m.Plot,\n\t\tCreatedAt: m.CreatedAt,\n\t}\n}", "title": "" }, { "docid": "5a336bd3bce302249a4fed064d47dffb", "score": "0.43693817", "text": "func (b *foreignBlob) MediaType() (types.MediaType, error) {\n\treturn types.DockerForeignLayer, nil\n}", "title": "" }, { "docid": "a7e7b717cccc7db4323da7a3be26a772", "score": "0.43605667", "text": "func ToUserTinyMedia(a *model.User) *app.UserTiny {\n\tif a == nil {\n\t\treturn nil\n\t}\n\treturn &app.UserTiny{\n\t\tHref: app.UsersHref(a.ID),\n\t\tUserID: int(a.ID),\n\t\tNickname: a.Nickname,\n\t}\n}", "title": "" }, { "docid": "b536898b411636452e97c8626c674e3e", "score": "0.4345978", "text": "func (c *Client) WoWCovenantMedia(ctx context.Context, covenantID int) (*wowgd.CovenantMedia, *Header, error) {\n\tdat, header, err := c.getStructData(ctx,\n\t\tfmt.Sprintf(\"/data/wow/media/covenant/%d\", covenantID),\n\t\tc.GetStaticNamespace(),\n\t\t&wowgd.CovenantMedia{},\n\t)\n\treturn dat.(*wowgd.CovenantMedia), header, err\n}", "title": "" }, { "docid": "b0f499bff6b7ca05b5e8793875c311ca", "score": "0.4340523", "text": "func (o TargetResponseOutput) MediaType() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v TargetResponse) *string { return v.MediaType }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "0c147d63aab1d8385361d73f25e160b7", "score": "0.43352735", "text": "func (o TargetResponsePtrOutput) MediaType() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *TargetResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.MediaType\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "2ad0a4c57f0a80c38afc42aa7ef7978f", "score": "0.43335712", "text": "func (account *Account) Archived(params ...interface{}) *FeedMedia {\n\tinsta := account.inst\n\n\tmedia := &FeedMedia{}\n\tmedia.inst = insta\n\tmedia.endpoint = urlUserArchived\n\n\tfor _, param := range params {\n\t\tswitch s := param.(type) {\n\t\tcase string:\n\t\t\tmedia.timestamp = s\n\t\t}\n\t}\n\n\treturn media\n}", "title": "" }, { "docid": "3cd1e245ec27d3adbfdd0ef5d352f0eb", "score": "0.43198916", "text": "func (c *Client) WoWGuildCrestEmblemMedia(ctx context.Context, emblemID int) (*wowgd.GuildCrestEmblemMedia, *Header, error) {\n\tdat, header, err := c.getStructData(ctx,\n\t\tfmt.Sprintf(\"/data/wow/media/guild-crest/emblem/%d\", emblemID),\n\t\tc.GetStaticNamespace(),\n\t\t&wowgd.GuildCrestEmblemMedia{},\n\t)\n\treturn dat.(*wowgd.GuildCrestEmblemMedia), header, err\n}", "title": "" }, { "docid": "dce009e6bbb0bd7005e6c2de517bc2a7", "score": "0.4310061", "text": "func ToSeriesMedia(a *model.Series) *app.Series {\n\tif a == nil {\n\t\treturn nil\n\t}\n\treturn &app.Series{\n\t\tSeriesID: int(a.ID),\n\t\tSeriesName: a.Name,\n\t\tCategoryID: int(a.CategoryID),\n\t\tCategory: ToCategoryMedia(a.Category),\n\t\tHref: app.SeriesHref(a.ID),\n\t}\n}", "title": "" }, { "docid": "03339c818b9bb5b3851b44cf0493e859", "score": "0.42891425", "text": "func (m MediaType) ContentType() string { return string(m) }", "title": "" }, { "docid": "f2a9caa02a5343974d72fb45339be466", "score": "0.42769158", "text": "func (l DescribedCompressedLayer) MediaType() (types.MediaType, error) {\n\treturn types.MediaType(l.desc.MediaType), nil\n}", "title": "" }, { "docid": "9d510c61bfd61b72fcc4666be45a72b7", "score": "0.425877", "text": "func formatMediaMessage(message relay.Message) string {\n\ttext := message.Text\n\tif text != \"\" {\n\t\ttext += \" \"\n\t}\n\tif message.Extra[\"url\"] != \"\" {\n\t\ttext += \"( \" + message.Extra[\"url\"] + \" ) \"\n\t}\n\tintSize, _ := strconv.ParseUint(message.Extra[\"size\"], 10, 64)\n\tsize := bytefmt.ByteSize(intSize)\n\tswitch message.Extra[\"media\"] {\n\tcase \"sticker\":\n\t\tfallthrough\n\tcase \"photo\":\n\t\ttext += fmt.Sprintf(\"(%v, %v×%v, %viB)\",\n\t\t\tmessage.Extra[\"media\"], message.Extra[\"width\"],\n\t\t\tmessage.Extra[\"height\"], size)\n\tcase \"document\":\n\t\ttext += fmt.Sprintf(\"(\\\"%v\\\", %viB)\", message.Extra[\"mediaName\"],\n\t\t\tsize)\n\tcase \"audio\":\n\t\ttext += fmt.Sprintf(\"%v — %v (%vs, %viB)\",\n\t\t\tmessage.Extra[\"performer\"], message.Extra[\"mediaName\"],\n\t\t\tmessage.Extra[\"duration\"], size)\n\tcase \"video\":\n\t\ttext += fmt.Sprintf(\"(%v, %v×%v×%vs, %viB)\",\n\t\t\tmessage.Extra[\"media\"], message.Extra[\"width\"],\n\t\t\tmessage.Extra[\"height\"], message.Extra[\"duration\"],\n\t\t\tsize)\n\tcase \"voice\":\n\t\ttext += fmt.Sprintf(\"(%v, %vs, %viB)\",\n\t\t\tmessage.Extra[\"media\"], message.Extra[\"duration\"],\n\t\t\tsize)\n\t}\n\treturn text\n}", "title": "" }, { "docid": "feac102f143bbf7404d7667c39194ed6", "score": "0.42493874", "text": "func CreateMediaContentRatingNewZealandFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewMediaContentRatingNewZealand(), nil\n}", "title": "" }, { "docid": "0e7d0cf0c38b740be9faa424e413975a", "score": "0.42307928", "text": "func (ser *MediaRelationService) Marshal(m db.Model) ([]byte, error) {\n\tmr, err := ser.AssertType(m)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%s: %w\", errmsgModelAssertType, err)\n\t}\n\n\tv, err := json.Marshal(mr)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%s: %w\", errmsgJSONMarshal, err)\n\t}\n\n\treturn v, nil\n}", "title": "" }, { "docid": "36a5faf4965e0fffdda78c3cfec31dc5", "score": "0.41999522", "text": "func (o VideoStreamOutput) MediaType() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *VideoStream) pulumi.StringPtrOutput { return v.MediaType }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "5090197d10a4850f8e790bb9c483dba9", "score": "0.41895637", "text": "func (c *EditsExpansionfilesUploadCall) Media(r io.Reader, options ...googleapi.MediaOption) *EditsExpansionfilesUploadCall {\n\tc.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)\n\treturn c\n}", "title": "" }, { "docid": "b14eae12d77a07d8035fa5d70ef2e8d1", "score": "0.41763178", "text": "func CreateArticleMedia(article graphql.Article, photos, art []*drive.File) {\n\tfor {\n\t\tif mediaConfig := Input(\"add media? (y/n): \"); mediaConfig == \"y\" {\n\t\t\t// [YES]: Upload media\n\t\t\tbreak\n\t\t} else if mediaConfig == \"n\" {\n\t\t\t// [NO]: Skip article\n\t\t\treturn\n\t\t}\n\t}\n\n\tfor {\n\t\tlog.Info(\"==========\")\n\t\tmediaAttrs := map[string]string{\n\t\t\t\"articleID\": article.ID,\n\t\t}\n\t\tfilename := Input(\"-> filename: \")\n\t\tif filename == \"\" {\n\t\t\treturn\n\t\t}\n\t\tfor _, p := range photos {\n\t\t\tif p.Name == filename {\n\t\t\t\tmediaAttrs[\"mediaType\"] = \"photo\"\n\t\t\t\tmediaAttrs[\"webContentLink\"] = p.WebContentLink\n\t\t\t\tmediaAttrs[\"mimeType\"] = p.MimeType\n\t\t\t}\n\t\t}\n\t\tif _, found := mediaAttrs[\"mediaType\"]; !found {\n\t\t\t// No matching photo found, let's check art...\n\t\t\tfor _, a := range art {\n\t\t\t\tif a.Name == filename {\n\t\t\t\t\tmediaAttrs[\"mediaType\"] = \"illustration\"\n\t\t\t\t\tmediaAttrs[\"webContentLink\"] = a.WebContentLink\n\t\t\t\t\tmediaAttrs[\"mimeType\"] = a.MimeType\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif _, found := mediaAttrs[\"mediaType\"]; !found {\n\t\t\tlog.Errorf(\"Unable to find media with name %s.\\n\", filename)\n\t\t\tcontinue\n\t\t}\n\t\tmediaAttrs[\"title\"] = Input(\"-> title: \")\n\t\tmediaAttrs[\"caption\"] = Input(\"-> caption: \")\n\t\tfor {\n\t\t\tif artistName := Input(\"-> artist: \"); artistName != \"\" {\n\t\t\t\tmediaAttrs[\"artistName\"] = artistName\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tmedium, err := graphql.CreateMedium(mediaAttrs)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Unable to create media. %v\\n\",\terr)\n\t\t\tcontinue\n\t\t} else {\n\t\t\tlog.Noticef(\"Created Medium #%s.\\n\", medium.ID)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "31269152eb428f469bb66a5034b527fc", "score": "0.41704148", "text": "func getMediaTypeForImp(impId string, imps []openrtb2.Imp) openrtb_ext.BidType {\n\tmediaType := openrtb_ext.BidTypeBanner //default type\n\tfor _, imp := range imps {\n\t\tif imp.ID == impId {\n\t\t\tif imp.Video != nil {\n\t\t\t\tmediaType = openrtb_ext.BidTypeVideo\n\t\t\t}\n\t\t\treturn mediaType\n\t\t}\n\t}\n\treturn mediaType\n}", "title": "" }, { "docid": "a45fcfdfda2d196508d90f64f174637d", "score": "0.41669548", "text": "func (c *Client) WoWPlayableSpecializationMedia(ctx context.Context, specID int) (*wowgd.PlayableSpecializationMedia, *Header, error) {\n\tdat, header, err := c.getStructData(ctx,\n\t\tfmt.Sprintf(\"/data/wow/media/playable-specialization/%d\", specID),\n\t\tc.GetStaticNamespace(),\n\t\t&wowgd.PlayableSpecializationMedia{},\n\t)\n\treturn dat.(*wowgd.PlayableSpecializationMedia), header, err\n}", "title": "" }, { "docid": "85c309eedaff779b01427b5db203ba00", "score": "0.4163997", "text": "func (c *Client) WoWProfessionMedia(ctx context.Context, professionID int) (*wowgd.ProfessionMedia, *Header, error) {\n\tdat, header, err := c.getStructData(ctx,\n\t\tfmt.Sprintf(\"/data/wow/media/profession/%d\", professionID),\n\t\tc.GetStaticNamespace(),\n\t\t&wowgd.ProfessionMedia{},\n\t)\n\treturn dat.(*wowgd.ProfessionMedia), header, err\n}", "title": "" }, { "docid": "c3a958d948f01d0abb1dda12fb09cbb4", "score": "0.41599375", "text": "func NewMediaContentRatingNewZealand()(*MediaContentRatingNewZealand) {\n m := &MediaContentRatingNewZealand{\n }\n m.SetAdditionalData(make(map[string]interface{}));\n return m\n}", "title": "" }, { "docid": "3c296319b4e9b2416a691d117038310b", "score": "0.41337594", "text": "func (m *Artifact) ToORM(ctx context.Context) (ArtifactORM, error) {\n\tto := ArtifactORM{}\n\tvar err error\n\tif prehook, ok := interface{}(m).(ArtifactWithBeforeToORM); ok {\n\t\tif err = prehook.BeforeToORM(ctx, &to); err != nil {\n\t\t\treturn to, err\n\t\t}\n\t}\n\tif v, err := resource1.Decode(&Artifact{}, m.Id); err != nil {\n\t\treturn to, err\n\t} else if v != nil {\n\t\tto.Id = v.(string)\n\t}\n\tto.Name = m.Name\n\tto.Description = m.Description\n\tto.Repo = m.Repo\n\tto.Commit = m.Commit\n\tif m.ChartVersionId != nil {\n\t\tif v, err := resource1.Decode(&ChartVersion{}, m.ChartVersionId); err != nil {\n\t\t\treturn to, err\n\t\t} else if v != nil {\n\t\t\tvv := v.(string)\n\t\t\tto.ChartVersionId = &vv\n\t\t}\n\t}\n\taccountID, err := auth1.GetAccountID(ctx, nil)\n\tif err != nil {\n\t\treturn to, err\n\t}\n\tto.AccountID = accountID\n\tif posthook, ok := interface{}(m).(ArtifactWithAfterToORM); ok {\n\t\terr = posthook.AfterToORM(ctx, &to)\n\t}\n\treturn to, err\n}", "title": "" }, { "docid": "fb8282d483e8aa2cca31f7c9c4ccaaaf", "score": "0.41308472", "text": "func (c *EditsDeobfuscationfilesUploadCall) Media(r io.Reader, options ...googleapi.MediaOption) *EditsDeobfuscationfilesUploadCall {\n\tc.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)\n\treturn c\n}", "title": "" }, { "docid": "8af56587c378522c1d091aeadf28ea4b", "score": "0.41271618", "text": "func (c *EditsApksUploadCall) Media(r io.Reader, options ...googleapi.MediaOption) *EditsApksUploadCall {\n\tc.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)\n\treturn c\n}", "title": "" }, { "docid": "b6c565b625152a5d9fd3644ebcc9a0e0", "score": "0.4115277", "text": "func (c *Client) WoWJournalInstanceMedia(ctx context.Context, journalInstanceID int) (*wowgd.JournalInstanceMedia, *Header, error) {\n\tdat, header, err := c.getStructData(ctx,\n\t\tfmt.Sprintf(\"/data/wow/media/journal-instance/%d\", journalInstanceID),\n\t\tc.GetStaticNamespace(),\n\t\t&wowgd.JournalInstanceMedia{},\n\t)\n\treturn dat.(*wowgd.JournalInstanceMedia), header, err\n}", "title": "" }, { "docid": "4a014b74ede358ec9862d7d1e0e69df2", "score": "0.41006032", "text": "func (a *Author) ToProto() *contentpb.Author {\n\tif a == nil {\n\t\treturn nil\n\t}\n\treturn &contentpb.Author{\n\t\tId: a.ID,\n\t\tName: a.Name,\n\t\tEmail: a.Email,\n\t\tImage: a.Image.ToProto(),\n\t}\n}", "title": "" }, { "docid": "5e092e611b953d9f45bf1a54ecbc4fc9", "score": "0.40922198", "text": "func (s InputMediaClassArray) AsInputMediaInvoice() (to InputMediaInvoiceArray) {\n\tfor _, elem := range s {\n\t\tvalue, ok := elem.(*InputMediaInvoice)\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\t\tto = append(to, *value)\n\t}\n\n\treturn to\n}", "title": "" }, { "docid": "22b77869ca172866324d002cdaf50a92", "score": "0.4089366", "text": "func (d *Decoder) media(xref string) *MediaRecord {\n\tif xref == \"\" {\n\t\treturn &MediaRecord{}\n\t}\n\n\tref, found := d.refs[xref].(*MediaRecord)\n\tif !found {\n\t\trec := &MediaRecord{Xref: xref}\n\t\td.refs[rec.Xref] = rec\n\t\treturn rec\n\t}\n\treturn ref\n}", "title": "" }, { "docid": "f6a92739fc713b54d77ea76b3aae5f86", "score": "0.40831953", "text": "func (c *InternalappsharingartifactsUploadbundleCall) Media(r io.Reader, options ...googleapi.MediaOption) *InternalappsharingartifactsUploadbundleCall {\n\tc.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)\n\treturn c\n}", "title": "" }, { "docid": "ec475279d25bff8da2c5cfc94007158b", "score": "0.40807483", "text": "func (p *PublisherMunger) Munge(obj *github.MungeObject) {}", "title": "" }, { "docid": "fc4bb32654b98bf67d3334ee9ec6e772", "score": "0.40709817", "text": "func (c *EditsBundlesUploadCall) Media(r io.Reader, options ...googleapi.MediaOption) *EditsBundlesUploadCall {\n\tc.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)\n\treturn c\n}", "title": "" }, { "docid": "1b9aa3d6ca7c038900d2d2d10725bdde", "score": "0.40679288", "text": "func (c *EditsImagesUploadCall) Media(r io.Reader, options ...googleapi.MediaOption) *EditsImagesUploadCall {\n\tc.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)\n\treturn c\n}", "title": "" }, { "docid": "5b0cff87199816982c8ddd0c69146f09", "score": "0.4050537", "text": "func (ser *MediaRelationService) Unmarshal(buf []byte) (db.Model, error) {\n\tvar mr models.MediaRelation\n\terr := json.Unmarshal(buf, &mr)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%s: %w\", errmsgJSONUnmarshal, err)\n\t}\n\treturn &mr, nil\n}", "title": "" }, { "docid": "eda20acdbf33badec7412f29ef46657d", "score": "0.40435946", "text": "func (ogp *OpenGraphParser) CreateMedia(HTMLString string) ([]*core.Media, error) {\n\tvideo := ogp.parseMeta(HTMLString, \"og:video\")\n\tif len(video) == 0 {\n\t\treturn nil, fmt.Errorf(\"video not found\")\n\t}\n\n\tvideo = html.UnescapeString(video)\n\ttitle := ogp.parseMeta(HTMLString, \"og:title\")\n\tdescription := ogp.parseMeta(HTMLString, \"og:description\")\n\turl := ogp.parseMeta(HTMLString, \"og:url\")\n\n\tmedia := &core.Media{\n\t\tResourceURL: video,\n\t\tURL: url,\n\t\tTitle: title,\n\t\tDescription: description,\n\t\tType: core.TVideo,\n\t}\n\treturn []*core.Media{media}, nil\n}", "title": "" }, { "docid": "5999f3da25ffc1df1ee2eb20ec0b6f4b", "score": "0.4043076", "text": "func (p *Publication) MarshalEditor() ([]byte, error) {\n\tview, err := editor.Form(p,\n\t\t// Take note that the first argument to these Input-like functions\n\t\t// is the string version of each Publication field, and must follow\n\t\t// this pattern for auto-decoding and auto-encoding reasons:\n\t\teditor.Field{\n\t\t\tView: editor.Input(\"Title\", p, map[string]string{\n\t\t\t\t\"label\": \"Title\",\n\t\t\t\t\"type\": \"text\",\n\t\t\t\t\"placeholder\": \"Enter the Title here\",\n\t\t\t}),\n\t\t},\n\t\teditor.Field{\n\t\t\tView: editor.Select(\"Format\", p, map[string]string{\n\t\t\t\t\"label\": \"Format\",\n\t\t\t}, map[string]string{\n\t\t\t\t// \"value\": \"Display Name\",\n\t\t\t\t\"journal-article\": \"journal article\",\n\t\t\t\t\"conference-paper\": \"conference paper\",\n\t\t\t\t\"poster\": \"poster\",\n\t\t\t\t\"technical-report\": \"technical report\",\n\t\t\t\t\"book\": \"book\",\n\t\t\t\t\"thesis\": \"thesis\",\n\t\t\t}),\n\t\t},\n\t\teditor.Field{\n\t\t\tView: editor.Tags(\"ResearchTopics\", p, map[string]string{\n\t\t\t\t\"label\": \"ResearchTopics\",\n\t\t\t\t\"placeholder\": \"+ResearchTopics\",\n\t\t\t}),\n\t\t},\n\t\teditor.Field{\n\t\t\tView: reference.SelectRepeater(\"Authors\", p, map[string]string{\n\t\t\t\t\"label\": \"Authors\",\n\t\t\t},\n\t\t\t\t\"Person\",\n\t\t\t\t`{{ .name }} `,\n\t\t\t),\n\t\t},\n\t\teditor.Field{\n\t\t\tView: reference.SelectRepeater(\"Labs\", p, map[string]string{\n\t\t\t\t\"label\": \"Labs\",\n\t\t\t},\n\t\t\t\t\"Lab\",\n\t\t\t\t`{{ .name }} `,\n\t\t\t),\n\t\t},\n\t\teditor.Field{\n\t\t\tView: editor.Input(\"Year\", p, map[string]string{\n\t\t\t\t\"label\": \"Year\",\n\t\t\t\t\"type\": \"text\",\n\t\t\t\t\"placeholder\": \"Enter the Year here\",\n\t\t\t}),\n\t\t},\n\t\teditor.Field{\n\t\t\tView: editor.Input(\"Citation\", p, map[string]string{\n\t\t\t\t\"label\": \"Citation\",\n\t\t\t\t\"type\": \"text\",\n\t\t\t\t\"placeholder\": \"Enter the Citation here\",\n\t\t\t}),\n\t\t},\n\t\teditor.Field{\n\t\t\tView: editor.Richtext(\"Abstract\", p, map[string]string{\n\t\t\t\t\"label\": \"Abstract\",\n\t\t\t\t\"placeholder\": \"Enter the Abstract here\",\n\t\t\t}),\n\t\t},\n\t\teditor.Field{\n\t\t\tView: editor.File(\"Pdf\", p, map[string]string{\n\t\t\t\t\"label\": \"Pdf\",\n\t\t\t\t\"placeholder\": \"Upload the Pdf here\",\n\t\t\t}),\n\t\t},\n\t\teditor.Field{\n\t\t\tView: editor.Input(\"Url\", p, map[string]string{\n\t\t\t\t\"label\": \"Url\",\n\t\t\t\t\"type\": \"text\",\n\t\t\t\t\"placeholder\": \"Enter the Url here\",\n\t\t\t}),\n\t\t},\n\t)\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to render Publication editor view: %s\", err.Error())\n\t}\n\n\treturn view, nil\n}", "title": "" }, { "docid": "bb08591403fcaf37438e2f19bc16d14e", "score": "0.4029866", "text": "func (client *Client) metadataToFilter(href, objectName string, filter *FilterDef) (*FilterDef, error) {\n\tif filter == nil {\n\t\tfilter = &FilterDef{}\n\t}\n\tmetadata, err := getMetadata(client, href, objectName)\n\tif err == nil && metadata != nil && len(metadata.MetadataEntry) > 0 {\n\t\tfor _, md := range metadata.MetadataEntry {\n\t\t\tisSystem := false\n\t\t\tif md.Domain != nil && md.Domain.Domain == \"SYSTEM\" {\n\t\t\t\tisSystem = true\n\t\t\t}\n\t\t\tvar fType string\n\t\t\tvar ok bool\n\t\t\tif md.TypedValue.XsiType == \"\" {\n\t\t\t\tfType = guessMetadataType(md.TypedValue.Value)\n\t\t\t} else {\n\t\t\t\tfType, ok = retrievedMetadataTypes[md.TypedValue.XsiType]\n\t\t\t\tif !ok {\n\t\t\t\t\tfType = \"STRING\"\n\t\t\t\t}\n\t\t\t}\n\t\t\terr = filter.AddMetadataFilter(md.Key, md.TypedValue.Value, fType, isSystem, false)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\treturn filter, nil\n}", "title": "" }, { "docid": "238ba0a2c32e513fc4d008ee9839721f", "score": "0.4026868", "text": "func GetMediaHandle(db interface{}) func(server.Request) (handler.Response, error) {\n\n\treturn func(req server.Request) (handler.Response, error) {\n\t\t// params from /medias/id/:mediaId\n\t\tmediaId := req.GetParamByName(\"mediaId\")\n\t\tmediaUUID, uuidErr := uuid.FromString(mediaId)\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 media id!\")},\n\t\t\t\tnil\n\t\t}\n\n\t\t// Create service\n\t\tmediaService, serviceErr := service.NewMediaService(db)\n\t\tif serviceErr != nil {\n\t\t\treturn handler.Response{StatusCode: http.StatusInternalServerError}, serviceErr\n\t\t}\n\n\t\tfoundMedia, err := mediaService.FindById(mediaUUID)\n\t\tif err != nil {\n\t\t\treturn handler.Response{StatusCode: http.StatusInternalServerError}, err\n\t\t}\n\n\t\tmediaModel := models.MediaModel{\n\t\t\tObjectId: foundMedia.ObjectId,\n\t\t\tDeletedDate: foundMedia.DeletedDate,\n\t\t\tCreatedDate: foundMedia.CreatedDate,\n\t\t\tThumbnail: foundMedia.Thumbnail,\n\t\t\tURL: foundMedia.URL,\n\t\t\tFullPath: foundMedia.FullPath,\n\t\t\tCaption: foundMedia.Caption,\n\t\t\tFileName: foundMedia.FileName,\n\t\t\tDirectory: foundMedia.Directory,\n\t\t\tOwnerUserId: foundMedia.OwnerUserId,\n\t\t\tLastUpdated: foundMedia.LastUpdated,\n\t\t\tAlbumId: foundMedia.AlbumId,\n\t\t\tWidth: foundMedia.Width,\n\t\t\tHeight: foundMedia.Height,\n\t\t\tMeta: foundMedia.Meta,\n\t\t\tAccessUserList: foundMedia.AccessUserList,\n\t\t\tPermission: foundMedia.Permission,\n\t\t\tDeleted: foundMedia.Deleted,\n\t\t}\n\n\t\tbody, marshalErr := json.Marshal(mediaModel)\n\t\tif marshalErr != nil {\n\t\t\terrorMessage := fmt.Sprintf(\"Error while marshaling mediaModel: %s\",\n\t\t\t\tmarshalErr.Error())\n\t\t\treturn handler.Response{StatusCode: http.StatusBadRequest, Body: utils.MarshalError(\"marshalMediaModelError\", 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": "0a51e599cd34d140ce5dac9758d480c8", "score": "0.4019921", "text": "func (ctx *ShowAuthorshipsContext) OK(r *Authorship) error {\n\tif ctx.ResponseData.Header().Get(\"Content-Type\") == \"\" {\n\t\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.authorship+json\")\n\t}\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 200, r)\n}", "title": "" }, { "docid": "9fa2ac4b21ad1e15515ac13fd08fada7", "score": "0.40168232", "text": "func (m *MediaContentRatingNewZealand) GetMovieRating()(*RatingNewZealandMoviesType) {\n return m.movieRating\n}", "title": "" }, { "docid": "bfa3ee07b9c295b454cbb67c11230335", "score": "0.40088356", "text": "func (m *MediaContentRatingAustralia) GetMovieRating()(*RatingAustraliaMoviesType) {\n return m.movieRating\n}", "title": "" }, { "docid": "19e7e044cb6aae90344acbba822d867f", "score": "0.3997594", "text": "func (c *InternalappsharingartifactsUploadapkCall) Media(r io.Reader, options ...googleapi.MediaOption) *InternalappsharingartifactsUploadapkCall {\n\tc.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)\n\treturn c\n}", "title": "" }, { "docid": "266e40977eadae536c509ff46b4b26b8", "score": "0.3997413", "text": "func (ser *MediaGenreService) Marshal(m db.Model) ([]byte, error) {\n\tmg, err := ser.AssertType(m)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%s: %w\", errmsgModelAssertType, err)\n\t}\n\n\tv, err := json.Marshal(mg)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%s: %w\", errmsgJSONMarshal, err)\n\t}\n\n\treturn v, nil\n}", "title": "" }, { "docid": "c3cd4befa777f371fc6da6496929dcef", "score": "0.3985594", "text": "func makeAuthorshipRules(c *config.Tree, dataDir string, existing []makex.Rule, opt plan.Options) ([]makex.Rule, error) {\n\t// determine authorship for each source unit individually, but we have to\n\t// wait until graphing AND blaming completes.\n\tgraphRules, blameRules := make(map[unit.ID]*grapher.GraphUnitRule), make(map[unit.ID]*vcsutil.BlameSourceUnitRule)\n\tfor _, rule := range existing {\n\t\tswitch rule := rule.(type) {\n\t\tcase *grapher.GraphUnitRule:\n\t\t\tgraphRules[rule.Unit.ID()] = rule\n\t\tcase *vcsutil.BlameSourceUnitRule:\n\t\t\tblameRules[rule.Unit.ID()] = rule\n\t\t}\n\t}\n\n\tvar rules []makex.Rule\n\tfor unitID, gr := range graphRules {\n\t\t// find unit\n\t\tvar u *unit.SourceUnit\n\t\tfor _, u2 := range c.SourceUnits {\n\t\t\tif u2.ID() == unitID {\n\t\t\t\tu = u2\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif u == nil {\n\t\t\treturn nil, fmt.Errorf(\"no source unit found with ID %q\", unitID)\n\t\t}\n\n\t\tbr, present := blameRules[unitID]\n\t\tif !present {\n\t\t\treturn nil, fmt.Errorf(\"no blame rule found corresponding to graph rule for unit ID %q\", u.ID())\n\t\t}\n\n\t\trule := &ComputeUnitAuthorshipRule{\n\t\t\tdataDir: dataDir,\n\t\t\tUnit: u,\n\t\t\tBlameOutput: br.Target(),\n\t\t\tGraphOutput: gr.Target(),\n\t\t}\n\n\t\trules = append(rules, rule)\n\t}\n\n\treturn rules, nil\n}", "title": "" }, { "docid": "065e8b3dac806f9108229715e126eec6", "score": "0.398381", "text": "func ProtoToAsset(p *alphapb.DataplexAlphaAsset) *alpha.Asset {\n\tobj := &alpha.Asset{\n\t\tName: dcl.StringOrNil(p.GetName()),\n\t\tDisplayName: dcl.StringOrNil(p.GetDisplayName()),\n\t\tUid: dcl.StringOrNil(p.GetUid()),\n\t\tCreateTime: dcl.StringOrNil(p.GetCreateTime()),\n\t\tUpdateTime: dcl.StringOrNil(p.GetUpdateTime()),\n\t\tDescription: dcl.StringOrNil(p.GetDescription()),\n\t\tState: ProtoToDataplexAlphaAssetStateEnum(p.GetState()),\n\t\tResourceSpec: ProtoToDataplexAlphaAssetResourceSpec(p.GetResourceSpec()),\n\t\tResourceStatus: ProtoToDataplexAlphaAssetResourceStatus(p.GetResourceStatus()),\n\t\tSecurityStatus: ProtoToDataplexAlphaAssetSecurityStatus(p.GetSecurityStatus()),\n\t\tDiscoverySpec: ProtoToDataplexAlphaAssetDiscoverySpec(p.GetDiscoverySpec()),\n\t\tDiscoveryStatus: ProtoToDataplexAlphaAssetDiscoveryStatus(p.GetDiscoveryStatus()),\n\t\tProject: dcl.StringOrNil(p.GetProject()),\n\t\tLocation: dcl.StringOrNil(p.GetLocation()),\n\t\tLake: dcl.StringOrNil(p.GetLake()),\n\t\tDataplexZone: dcl.StringOrNil(p.GetDataplexZone()),\n\t}\n\treturn obj\n}", "title": "" }, { "docid": "167fef08927f994db4cd73f378f6b6b2", "score": "0.39770052", "text": "func (c *Client) WoWPlayableClassMedia(ctx context.Context, classID int) (*wowgd.PlayableClassMedia, *Header, error) {\n\tdat, header, err := c.getStructData(ctx,\n\t\tfmt.Sprintf(\"/data/wow/media/playable-class/%d\", classID),\n\t\tc.GetStaticNamespace(),\n\t\t&wowgd.PlayableClassMedia{},\n\t)\n\treturn dat.(*wowgd.PlayableClassMedia), header, err\n}", "title": "" }, { "docid": "df2e16db233f578ffb6d2723e0fc0018", "score": "0.3967862", "text": "func (Media) Unmarshal(reader io.Reader, ref interface{}) error {\n\treturn Unmarshal(reader, &ref)\n}", "title": "" }, { "docid": "c84cb97fd88cfb8f16723d86fcf5289c", "score": "0.39673653", "text": "func (c *ArchiveInsertCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *ArchiveInsertCall {\n\tc.caller_ = &googleapi.ResumableUpload{\n\t\tMedia: io.NewSectionReader(r, 0, size),\n\t\tMediaType: mediaType,\n\t\tContentLength: size,\n\t\tCallback: c.callback_,\n\t}\n\tc.pathTemplate_ = \"/resumable/upload/groups/v1/groups/{groupId}/archive\"\n\tc.context_ = ctx\n\treturn c\n}", "title": "" }, { "docid": "c0f0352e6986b8228e98dba3db71d3ba", "score": "0.3954137", "text": "func toPreview(org []byte) []byte {\n\n\timg, err := jpeg.Decode(bytes.NewReader(org))\n\tif err != nil {\n\t\treturn org\n\t}\n\n\tbuf := new(bytes.Buffer)\n\tjpeg.Encode(buf,\n\t\tresize.Resize(PreviewWidth, 0, img, resize.Lanczos3), nil)\n\n\treturn buf.Bytes()\n}", "title": "" }, { "docid": "7d89f1c98c6d6568128dcec004adf771", "score": "0.39497796", "text": "func addMedia(client *http.Client, source string, internalFilename string, mediaFileFormat string, mediaFolderName string, mediaMap map[string]string) (string, error) {\n\terr := grabber{client}.checkMedia(source)\n\tif err != nil {\n\t\treturn \"\", &FileRetrievalError{\n\t\t\tSource: source,\n\t\t\tErr: err,\n\t\t}\n\t}\n\tif internalFilename == \"\" {\n\t\t// If a filename isn't provided, use the filename from the source\n\t\tinternalFilename = filepath.Base(source)\n\t\t_, ok := mediaMap[internalFilename]\n\t\t// if filename is too long, invalid or already used, try to generate a unique filename\n\t\tif len(internalFilename) > 255 || !fs.ValidPath(internalFilename) || ok {\n\t\t\tinternalFilename = fmt.Sprintf(\n\t\t\t\tmediaFileFormat,\n\t\t\t\tlen(mediaMap)+1,\n\t\t\t\tstrings.ToLower(filepath.Ext(source)),\n\t\t\t)\n\t\t}\n\t}\n\n\tif _, ok := mediaMap[internalFilename]; ok {\n\t\treturn \"\", &FilenameAlreadyUsedError{Filename: internalFilename}\n\t}\n\n\tmediaMap[internalFilename] = source\n\n\treturn path.Join(\n\t\t\"..\",\n\t\tmediaFolderName,\n\t\tinternalFilename,\n\t), nil\n}", "title": "" }, { "docid": "8b55a1abfd0494698d81040e548dbb6b", "score": "0.3944626", "text": "func getEncryptedMediaType(mediatype string) (string, error) {\n\tfor _, s := range strings.Split(mediatype, \"+\")[1:] {\n\t\tif s == \"encrypted\" {\n\t\t\treturn \"\", errors.Errorf(\"unsupportedmediatype: %v already encrypted\", mediatype)\n\t\t}\n\t}\n\tunsuffixedMediatype := strings.Split(mediatype, \"+\")[0]\n\tswitch unsuffixedMediatype {\n\tcase DockerV2Schema2LayerMediaType, imgspecv1.MediaTypeImageLayer, imgspecv1.MediaTypeImageLayerNonDistributable:\n\t\treturn mediatype + \"+encrypted\", nil\n\t}\n\n\treturn \"\", errors.Errorf(\"unsupported mediatype to encrypt: %v\", mediatype)\n}", "title": "" }, { "docid": "206b38f1bda364e5ccb24294f7324bac", "score": "0.3939256", "text": "func (a *AniList) Media(q string, variables interface{}) (m Media, err error) {\n\tdata, err := a.Data(q, variables)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tm = data.Media\n\treturn\n}", "title": "" }, { "docid": "b6a99108bd1d40d628312721cf1a1d8d", "score": "0.39301836", "text": "func externalizeReaction(reaction reactions.EmojiID) (githubv4.ReactionContent, error) {\n\tswitch reaction {\n\tcase \"+1\":\n\t\treturn githubv4.ReactionContentThumbsUp, nil\n\tcase \"-1\":\n\t\treturn githubv4.ReactionContentThumbsDown, nil\n\tcase \"smile\":\n\t\treturn githubv4.ReactionContentLaugh, nil\n\tcase \"tada\":\n\t\treturn githubv4.ReactionContentHooray, nil\n\tcase \"confused\":\n\t\treturn githubv4.ReactionContentConfused, nil\n\tcase \"heart\":\n\t\treturn githubv4.ReactionContentHeart, nil\n\tcase \"rocket\":\n\t\treturn githubv4.ReactionContentRocket, nil\n\tcase \"eyes\":\n\t\treturn githubv4.ReactionContentEyes, nil\n\tdefault:\n\t\treturn \"\", fmt.Errorf(\"%q is an unsupported reaction\", reaction)\n\t}\n}", "title": "" }, { "docid": "be90f1489d53e820ec6579bf5f2b3b50", "score": "0.39249", "text": "func (identity *Identity) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) {\n\tif identity == nil {\n\t\treturn nil, nil\n\t}\n\tresult := &Identity_ARM{}\n\n\t// Set property \"Type\":\n\tif identity.Type != nil {\n\t\ttypeVar := *identity.Type\n\t\tresult.Type = &typeVar\n\t}\n\n\t// Set property \"UserAssignedIdentities\":\n\tresult.UserAssignedIdentities = make(map[string]UserAssignedIdentityDetails_ARM, len(identity.UserAssignedIdentities))\n\tfor _, ident := range identity.UserAssignedIdentities {\n\t\tidentARMID, err := resolved.ResolvedReferences.Lookup(ident.Reference)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tkey := identARMID\n\t\tresult.UserAssignedIdentities[key] = UserAssignedIdentityDetails_ARM{}\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "86f9b15c280ad47d7a4e6cf05154da32", "score": "0.39208165", "text": "func (*MediaAttribute) Descriptor() ([]byte, []int) {\n\treturn file_contacts_media_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "7964414a32402c398bea69c0e7a1f12e", "score": "0.39141586", "text": "func (f Format) MediaType() string {\n\tswitch f {\n\tcase FormatJSONPB:\n\t\treturn mtPRPCJSONPB\n\tcase FormatText:\n\t\treturn mtPRPCText\n\tcase FormatBinary:\n\t\tfallthrough\n\tdefault:\n\t\treturn mtPRPCBinary\n\t}\n}", "title": "" }, { "docid": "945f4ea611ad4c3872f5dab1ffd8bf7e", "score": "0.39123186", "text": "func (ser *MediaRelationService) mapFromModel(vlist []db.Model) ([]*models.MediaRelation, error) {\n\tlist := make([]*models.MediaRelation, len(vlist))\n\tvar err error\n\tfor i, v := range vlist {\n\t\tlist[i], err = ser.AssertType(v)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"%s: %w\", errmsgModelAssertType, err)\n\t\t}\n\t}\n\treturn list, nil\n}", "title": "" }, { "docid": "7f86d530782a52ac88b7f99224d37b99", "score": "0.3910987", "text": "func (s InputMediaClassArray) AsInputMediaDocument() (to InputMediaDocumentArray) {\n\tfor _, elem := range s {\n\t\tvalue, ok := elem.(*InputMediaDocument)\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\t\tto = append(to, *value)\n\t}\n\n\treturn to\n}", "title": "" }, { "docid": "fa818b439cda1b8bb069e17be0b01c72", "score": "0.39098182", "text": "func (t *Response) MessageMedia(opts MessageOpts, body messageBody) twimlInterface {\n\taddMessage(t, &opts, body)\n\treturn t\n}", "title": "" }, { "docid": "6c6bd3d7dc26786ea58fe4a72d386b38", "score": "0.39065918", "text": "func (c *MediaUploadCall) Media(r io.Reader, options ...googleapi.MediaOption) *MediaUploadCall {\n\tc.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)\n\treturn c\n}", "title": "" }, { "docid": "6c6bd3d7dc26786ea58fe4a72d386b38", "score": "0.39065918", "text": "func (c *MediaUploadCall) Media(r io.Reader, options ...googleapi.MediaOption) *MediaUploadCall {\n\tc.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)\n\treturn c\n}", "title": "" }, { "docid": "aa84f69b7af9c0c9f5cafbc73d53cb41", "score": "0.39050612", "text": "func (a *BaseAppcast) FilterReleasesByMediaType(regexpStr string, inversed ...interface{}) {\n\tinverse := false\n\tif len(inversed) > 0 {\n\t\tinverse = inversed[0].(bool)\n\t}\n\n\ta.filterReleasesDownloadsBy(func(d Download) bool {\n\t\tre := regexp.MustCompile(regexpStr)\n\t\tif re.MatchString(d.Type) {\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t}, inverse)\n}", "title": "" }, { "docid": "3a1e5152ce53ed0968e485f6734d046d", "score": "0.39015713", "text": "func (reference *ApiEntityReference) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) {\n\tif reference == nil {\n\t\treturn nil, nil\n\t}\n\tresult := &ApiEntityReference_ARM{}\n\n\t// Set property \"Id\":\n\tif reference.Reference != nil {\n\t\treferenceARMID, err := resolved.ResolvedReferences.Lookup(*reference.Reference)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treference1 := referenceARMID\n\t\tresult.Id = &reference1\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "65df1d45e17319f40ee8b58031326118", "score": "0.38987005", "text": "func (s InputMediaClassArray) AsInputMediaContact() (to InputMediaContactArray) {\n\tfor _, elem := range s {\n\t\tvalue, ok := elem.(*InputMediaContact)\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\t\tto = append(to, *value)\n\t}\n\n\treturn to\n}", "title": "" }, { "docid": "5154017f2427eb06706c6c91090d9491", "score": "0.3885607", "text": "func (inst *Attachment) As(dst interface{}) error {\n\treturn coll.CopyProperties(inst, dst)\n}", "title": "" }, { "docid": "5e2d404a6cddd490c214ced9a93ef500", "score": "0.38839608", "text": "func (topic *Namespaces_Topic_Spec) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) {\n\tif topic == nil {\n\t\treturn nil, nil\n\t}\n\tresult := &Namespaces_Topic_Spec_ARM{}\n\n\t// Set property \"Name\":\n\tresult.Name = resolved.Name\n\n\t// Set property \"Properties\":\n\tif topic.AutoDeleteOnIdle != nil ||\n\t\ttopic.DefaultMessageTimeToLive != nil ||\n\t\ttopic.DuplicateDetectionHistoryTimeWindow != nil ||\n\t\ttopic.EnableBatchedOperations != nil ||\n\t\ttopic.EnableExpress != nil ||\n\t\ttopic.EnablePartitioning != nil ||\n\t\ttopic.MaxSizeInMegabytes != nil ||\n\t\ttopic.RequiresDuplicateDetection != nil ||\n\t\ttopic.SupportOrdering != nil {\n\t\tresult.Properties = &SBTopicProperties_ARM{}\n\t}\n\tif topic.AutoDeleteOnIdle != nil {\n\t\tautoDeleteOnIdle := *topic.AutoDeleteOnIdle\n\t\tresult.Properties.AutoDeleteOnIdle = &autoDeleteOnIdle\n\t}\n\tif topic.DefaultMessageTimeToLive != nil {\n\t\tdefaultMessageTimeToLive := *topic.DefaultMessageTimeToLive\n\t\tresult.Properties.DefaultMessageTimeToLive = &defaultMessageTimeToLive\n\t}\n\tif topic.DuplicateDetectionHistoryTimeWindow != nil {\n\t\tduplicateDetectionHistoryTimeWindow := *topic.DuplicateDetectionHistoryTimeWindow\n\t\tresult.Properties.DuplicateDetectionHistoryTimeWindow = &duplicateDetectionHistoryTimeWindow\n\t}\n\tif topic.EnableBatchedOperations != nil {\n\t\tenableBatchedOperations := *topic.EnableBatchedOperations\n\t\tresult.Properties.EnableBatchedOperations = &enableBatchedOperations\n\t}\n\tif topic.EnableExpress != nil {\n\t\tenableExpress := *topic.EnableExpress\n\t\tresult.Properties.EnableExpress = &enableExpress\n\t}\n\tif topic.EnablePartitioning != nil {\n\t\tenablePartitioning := *topic.EnablePartitioning\n\t\tresult.Properties.EnablePartitioning = &enablePartitioning\n\t}\n\tif topic.MaxSizeInMegabytes != nil {\n\t\tmaxSizeInMegabytes := *topic.MaxSizeInMegabytes\n\t\tresult.Properties.MaxSizeInMegabytes = &maxSizeInMegabytes\n\t}\n\tif topic.RequiresDuplicateDetection != nil {\n\t\trequiresDuplicateDetection := *topic.RequiresDuplicateDetection\n\t\tresult.Properties.RequiresDuplicateDetection = &requiresDuplicateDetection\n\t}\n\tif topic.SupportOrdering != nil {\n\t\tsupportOrdering := *topic.SupportOrdering\n\t\tresult.Properties.SupportOrdering = &supportOrdering\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "053efe11baa0a6b531b8654b9410e89f", "score": "0.38717246", "text": "func (o *TalkToChatbot200Response) GetMedia() []interface{} {\n\tif o == nil {\n\t\tvar ret []interface{}\n\t\treturn ret\n\t}\n\n\treturn o.Media\n}", "title": "" }, { "docid": "04e6696a58a877c23c97e59623ab45db", "score": "0.38716725", "text": "func (ser *MediaGenreService) mapFromModel(vlist []db.Model) ([]*models.MediaGenre, error) {\n\tlist := make([]*models.MediaGenre, len(vlist))\n\tvar err error\n\tfor i, v := range vlist {\n\t\tlist[i], err = ser.AssertType(v)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"%s: %w\", errmsgModelAssertType, err)\n\t\t}\n\t}\n\treturn list, nil\n}", "title": "" } ]
b6e3798720acec73de7e1c0dd116020d
// Only print the directory names
[ { "docid": "ea5c6913b3c0d24decc4362f78d34c44", "score": "0.0", "text": "func ExampleHiTree_dirOnly() {\n\tcleaner, _, root := helper.SetupTestDir(\"RootA\")\n\tdefer cleaner()\n\t// $ hitree root --dironly\n\texecute(\"hitree\", root, \"--dironly\")\n\t// Output:\n\t// RootA\n\t// └──a\n\t// ├──b\n\t// └──c\n\t// │ └──d\n\t// │ │ └──e\n\t//\n\t// 5 directories, 5 files\n}", "title": "" } ]
[ { "docid": "0846117bc3270e5828a558ad4cacd9f4", "score": "0.6790658", "text": "func printFiles(directory string, fileSize int64) {\n\tfiles, err := ioutil.ReadDir(directory)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfor _, file := range files {\n\t\tif file.IsDir() {\n\t\t\tprintFiles(path.Join(directory, file.Name()), fileSize)\n\t\t}\n\n\t\tif file.Size() == fileSize {\n\t\t\tfmt.Println(\"Name :\", file.Name())\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "585cf32ccce5fba545facbfec34c48f1", "score": "0.67453", "text": "func (fl *fileList) print() error {\n\tfor _, f := range fl.files {\n\t\tif f.isHidden && !allFiles {\n\t\t\tcontinue\n\t\t}\n\t\tif f.isDir && !onlyFiles && f.absolutPath != \"\" {\n\t\t\tfmt.Printf(\"%v/\\n\", f.absolutPath)\n\t\t} else if !f.isDir && !onlyDir && f.absolutPath != \"\" {\n\t\t\tfmt.Printf(\"%v\\n\", f.absolutPath)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "264c1f81f3784e7ad9fa96ddc7afbb6f", "score": "0.67204964", "text": "func printDirContentsRecursively(dir *api.Dir, prefix string, w io.Writer) {\n\n\tsort.Sort(api.SortDirByName(dir.SubDirs))\n\tsort.Sort(api.SortSecretByName(dir.Secrets))\n\n\ttotal := len(dir.SubDirs) + len(dir.Secrets)\n\n\ti := 0\n\tfor _, sub := range dir.SubDirs {\n\t\tname := colorizeByStatus(sub.Status, sub.Name)\n\n\t\tif i == total-1 {\n\t\t\tfmt.Fprintf(w, \"%s└── %s/\\n\", prefix, name)\n\t\t\tprintDirContentsRecursively(sub, prefix+\" \", w)\n\t\t} else {\n\t\t\tfmt.Fprintf(w, \"%s├── %s/\\n\", prefix, name)\n\t\t\tprintDirContentsRecursively(sub, prefix+\"│ \", w)\n\t\t}\n\t\ti++\n\t}\n\n\tfor _, secret := range dir.Secrets {\n\t\tname := colorizeByStatus(secret.Status, secret.Name)\n\n\t\tif i == total-1 {\n\t\t\tfmt.Fprintf(w, \"%s└── %s\\n\", prefix, name)\n\t\t} else {\n\t\t\tfmt.Fprintf(w, \"%s├── %s\\n\", prefix, name)\n\t\t}\n\t\ti++\n\t}\n}", "title": "" }, { "docid": "7e610a1955ea8cadf8dfcbd784f570d0", "score": "0.6608123", "text": "func (l *localLister) showDirs() bool {\n\treturn !l.recurse\n}", "title": "" }, { "docid": "426e369f9907cdbe3b7906e57ba66be7", "score": "0.6549643", "text": "func printDirectory(directory sshhostdump.DirectoryEntry) {\n\tfor _, val := range directory.Hosts {\n\t\tfmt.Println(val)\n\t}\n\n\tfor _, val := range directory.Directories {\n\t\tprintDirectory(val)\n\t}\n}", "title": "" }, { "docid": "3c3e42eef7dc8ec4c141bfc0bf9ffead", "score": "0.6544227", "text": "func showContent(dir *string) error {\n files, err := ioutil.ReadDir(*dir)\n fmt.Println(\"gobash> showing files\")\n for _, v := range files {\n if v.IsDir() {\n color.Blue(\"%v\", v.Name())\n } else {\n color.Green(\"%v\", v.Name())\n }\n }\n return err\n}", "title": "" }, { "docid": "ca796051d80a434072cbf5ff28b987c7", "score": "0.6450912", "text": "func directoryListing(dirname string, levels int, dirsOnly bool) ([]string, error) {\n\tres := []string{}\n\terr := filepath.Walk(dirname, func(path string, info os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif dirsOnly && !info.IsDir() {\n\t\t\treturn nil\n\t\t}\n\t\ttmp := path\n\t\tfor i := 0; i < levels; i++ {\n\t\t\ttmp = filepath.Dir(tmp)\n\t\t\tif tmp == dirname {\n\t\t\t\tres = append(res, path)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlog.Printf(\"directoryListing %s %v\", dirname, res)\n\treturn res, nil\n}", "title": "" }, { "docid": "5d28cb4456e2238141348c52ba41de41", "score": "0.64306843", "text": "func (d *DirPath) Print() {\n\tfmt.Printf(\"%s+%s\\n\", d.device, d.directory)\n}", "title": "" }, { "docid": "40b80371bd0149bb5187a9a623316658", "score": "0.6403249", "text": "func listFilesInDirectory(files []os.FileInfo) string {\n\tvar str strings.Builder\n\tstr.WriteString(\"<div><ul>\")\n\tfor _,f := range files {\n\t\tif !f.IsDir() {\n\t\t\tarr := strings.Split(f.Name(), \".\")\n\t\t\tif arr[len(arr)-1] == \"md\" {\n\t\t\t\tli := \"<li><a href='\" + f.Name() + \"'>\" + f.Name() + \"</a></li>\"\n\t\t\t\tstr.WriteString(li)\n\t\t\t}\n\t\t}\n\t}\n\tstr.WriteString(\"</ul></div>\")\n\treturn str.String()\n}", "title": "" }, { "docid": "6699e6485881e0686346a4df5b22a643", "score": "0.62964267", "text": "func ListDirNames(fd []os.FileInfo) []string {\n\tdirs := []string{}\n\tfor _, pDir := range fd {\n\t\tif pDir.IsDir() && !strings.HasPrefix(pDir.Name(), \".\") {\n\t\t\t//fmt.Printf(\"%v: %s\\n\", i, pDir.Name())\n\t\t\tdirs = append(dirs, pDir.Name())\n\t\t}\n\t}\n\treturn dirs\n}", "title": "" }, { "docid": "11e13326848fff207bafe9d1f81cbf93", "score": "0.628999", "text": "func printTree(t *api.Tree, w io.Writer) {\n\tname := colorizeByStatus(t.RootDir.Status, t.RootDir.Name)\n\tfmt.Fprintf(w, \"%s/\\n\", name)\n\n\tprintDirContentsRecursively(t.RootDir, \"\", w)\n\n\tfmt.Fprintf(w,\n\t\t\"\\n%s, %s\\n\",\n\t\tpluralize(\"directory\", \"directories\", t.DirCount()),\n\t\tpluralize(\"secret\", \"secrets\", t.SecretCount()),\n\t)\n}", "title": "" }, { "docid": "3f96aff8c976e7f01dbd0ee51dfd5894", "score": "0.6267963", "text": "func (currdir *Dir) dump() {\n for _, file := range currdir.Files {\n fmt.Printf(\"%s %03d %s\\n\", file.Digest, file.Level, file.Pathname)\n }\n for _, subdir := range currdir.Dirs {\n subdir.dump()\n }\n fmt.Printf(\"%s %03d %s\\n\", currdir.Digest, currdir.Level, currdir.Pathname)\n}", "title": "" }, { "docid": "d2988408651cc8b3adc3d4f9b06a1697", "score": "0.62375945", "text": "func Ls(path string) {\n\tfiles, err := ioutil.ReadDir(path)\n\tif err != nil {\n\t\tDirectoryNotFound(path)\n\t\treturn\n\t}\n\tfmt.Println(\" \\033[0;32m# name type \\033[0m\")\n\tfmt.Println(\" ╭━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━╮\")\n\tfor i, file := range files {\n\t\ti++\n\t\tx := 3 - len(string(i))\n\t\tz := 33 - len(file.Name())\n\t\tspaces := strings.Repeat(\" \", z)\n\t\tspaces2 := strings.Repeat(\" \", x)\n\t\tif file.IsDir() {\n\t\t\tif i >= 10 {\n\t\t\t\tfmt.Println(\" │ \\033[0;32m\" + strconv.Itoa(i) + spaces2 + \"\\033[0m│ \\033[0;36m\" +\n\t\t\t\t\tfile.Name() + spaces + \"\\033[0m│ Directory \\033[0m│\")\n\t\t\t} else {\n\t\t\t\tfmt.Println(\" │ \\033[0;32m\" + strconv.Itoa(i) + spaces2 + \"\\033[0m │ \\033[0;36m\" +\n\t\t\t\t\tfile.Name() + spaces + \"\\033[0m│ Directory \\033[0m│\")\n\t\t\t}\n\t\t} else {\n\t\t\tif i >= 10 {\n\t\t\t\tfmt.Println(\" │ \\033[0;32m\" + strconv.Itoa(i) + spaces2 + \"\\033[0m│ \" + file.Name() + spaces +\n\t\t\t\t\t\"\\033[0m│ File \\033[0m│\")\n\t\t\t} else {\n\t\t\t\tfmt.Println(\" │ \\033[0;32m\" + strconv.Itoa(i) + spaces2 + \"\\033[0m │ \" + file.Name() + spaces +\n\t\t\t\t\t\"\\033[0m│ File \\033[0m│\")\n\t\t\t}\n\n\n\n\n\n\n\n\t\t\t\n\t\t}\n\t}\n\tfmt.Println(\" ╰━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━╯\")\n}", "title": "" }, { "docid": "a1f737fc1f7d86f2073df9ca2bdecb5b", "score": "0.6196462", "text": "func (mf *MockFilesystem) Print() {\n\tvar (\n\t\tdirs []string\n\t\tlines [][]interface{}\n\t\tpath string\n\t\tf File\n\t\tfi os.FileInfo\n\t\tfiles []os.FileInfo\n\t\tmaxlen int\n\t)\n\tdirs = append(dirs, \"/\")\n\tmaxlen = 1\n\tfor len(dirs) > 0 {\n\t\tpath = dirs[0]\n\t\tdirs = dirs[1:]\n\t\tf, _ = mf.Open(path)\n\t\tfi, _ = f.Stat()\n\t\tfiles, _ = f.Readdir(100)\n\t\tfor _, fi = range files {\n\t\t\tname := filepath.Join(path, fi.Name())\n\t\t\tline := []interface{}{name, fi.Mode(), fi.IsDir()}\n\t\t\tlines = append(lines, line)\n\t\t\tif len(name) > maxlen {\n\t\t\t\tmaxlen = len(name)\n\t\t\t}\n\t\t\tif fi.IsDir() {\n\t\t\t\tdirs = append(dirs, name)\n\t\t\t}\n\t\t}\n\t}\n\tfmtstr := fmt.Sprintf(\"%%-%vv %%v %%v\\n\", maxlen)\n\tfor _, line := range lines {\n\t\tfmt.Printf(fmtstr, line[0], line[1], line[2])\n\t}\n}", "title": "" }, { "docid": "c6d7e1c06940bf983ffd04b2eded104d", "score": "0.61771566", "text": "func Dir(startDirectory string, maxFiles int) {\n\tfiles, err := ioutil.ReadDir(startDirectory)\n\tif err != nil {\n\t\tlog.Fatal(\"Error by list files \", err)\n\t}\n\tfor i, f := range files {\n\t\tif i < maxFiles {\n\t\t\tfmt.Println(getFilePrefix(f.IsDir()), f.Name())\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0377c559d5987b700be44dd75930b0ce", "score": "0.61678046", "text": "func main() {\n\t// max concurrency out\n\truntime.GOMAXPROCS(runtime.NumCPU())\n\n\tvar seenLock sync.Mutex\n\tseen := make(map[string]string)\n\twalkFunc := func(p string, info os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"%v\\n\", err)\n\t\t\treturn nil\n\t\t}\n\t\tdir := filepath.Dir(p)\n\t\tseenLock.Lock()\n\t\tif info.IsDir() {\n\t\t\tseen[p+\"/\"] = dir + \"/\"\n\t\t} else {\n\t\t\tseen[p] = dir\n\t\t}\n\t\tseenLock.Unlock()\n\t\treturn nil\n\t}\n\n\tflag.Parse()\n\tdirname := \".\"\n\tif len(os.Args) > 1 {\n\t\tdirname = os.Args[1]\n\t}\n\n\tsymwalk.Walk(dirname, walkFunc)\n\n\t// Find all values (directory names) and use them as keys in a new map\n\tdirnameKeys := make(map[string]bool)\n\tfor _, dir := range seen {\n\t\tdirnameKeys[dir] = true\n\t}\n\tdirnames := make([]string, len(dirnameKeys))\n\ti := 0\n\tfor dir := range dirnameKeys {\n\t\tdirnames[i] = dir\n\t\ti++\n\t}\n\tsort.Strings(dirnames)\n\n\tprintedDir := make(map[string]bool)\n\n\tvar sb strings.Builder\n\n\t// Output a list of all found files, per directory\n\tfor _, dir := range dirnames {\n\t\tif dir != \"./\" {\n\t\t\tif strings.HasSuffix(dir, \"/\") {\n\t\t\t\tif _, found := printedDir[dir]; !found {\n\t\t\t\t\tif dir != \"./\" {\n\t\t\t\t\t\tsb.WriteString(dir + \"\\n\")\n\t\t\t\t\t}\n\t\t\t\t\tprintedDir[dir] = true\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif _, found := printedDir[dir+\"/\"]; !found {\n\t\t\t\t\tif dir != \".\" {\n\t\t\t\t\t\tsb.WriteString(dir + \"/\\n\")\n\t\t\t\t\t}\n\t\t\t\t\tprintedDir[dir+\"/\"] = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor p, seenDir := range seen {\n\t\t\tif seenDir == dir {\n\t\t\t\tdepth := len(filepath.SplitList(p))\n\t\t\t\tif dir == \".\" {\n\t\t\t\t\tdepth--\n\t\t\t\t}\n\t\t\t\tif !strings.HasSuffix(p, \"/\") {\n\t\t\t\t\tindent := strings.Repeat(\"\\t\", depth)\n\t\t\t\t\tfilename := filepath.Base(p)\n\t\t\t\t\tsb.WriteString(indent + filename + \"\\n\")\n\t\t\t\t}\n\t\t\t\tdelete(seen, p)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Output the text\n\tfmt.Print(sb.String())\n}", "title": "" }, { "docid": "7451faf9b50e4da26854e5324c1e9228", "score": "0.61673427", "text": "func printTree(out io.Writer, path string, printFiles bool, before string) error {\n\n\tfile, err := os.Open(path) // For read access.\n\tdefer func() {\n\t\tfile.Close()\n\t}()\n\n\tdirInfo, err := file.Readdir(-1)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\t//Clear slice of files(if neccesary)\n\tif !printFiles {\n\t\tfilterFileStructer(&dirInfo)\n\t}\n\n\tif len(dirInfo) == 0 {\n\t\treturn nil\n\t}\n\t//Sort dorectory List by name\n\tsort.SliceStable(dirInfo, func(i, j int) bool {\n\t\tiEelem := dirInfo[i].Name()\n\t\tjElem := dirInfo[j].Name()\n\t\treturn iEelem < jElem\n\t})\n\n\tfor i, value := range dirInfo {\n\t\t//Create string for output\n\t\tcurrentLeveldelimiter := createEntityPrefix(before, len(dirInfo)-1 == i)\n\t\tnexLevelFirstDeliment := createParentPrefix(before, value.IsDir(), len(dirInfo)-1 == i)\n\t\tpathString := currentLeveldelimiter + value.Name()\n\t\tif !value.IsDir() {\n\t\t\tpathString += createEntitySuffix(value.Size())\n\t\t}\n\t\t//Write to output\n\t\tfmt.Fprintln(out, pathString)\n\t\t//If is directory, start all process againe\n\t\tif value.IsDir() {\n\t\t\t//Create path for scan child direcoty\n\t\t\tchildPath := path + string(os.PathSeparator) + value.Name()\n\t\t\t//Run recursive alghoritm\n\t\t\terr := printTree(out, childPath, printFiles, nexLevelFirstDeliment)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4839723a72d1f6741c754d31261dd308", "score": "0.6105576", "text": "func ShowAll() (string, error) {\n\tmp, err := Dir()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tvar aliases bytes.Buffer\n\n\terr = filepath.Walk(mp, func(path string, info os.FileInfo, err error) error {\n\t\tif !info.IsDir() {\n\t\t\text := filepath.Ext(path)\n\t\t\tif ext == \".toml\" {\n\t\t\t\tal, err := showAlias(path)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\taliases.WriteString(al)\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn aliases.String(), nil\n}", "title": "" }, { "docid": "041d5bb063376fa743fa223bc0c7b755", "score": "0.6039642", "text": "func DirList(ctx *context.Context, dirOptions DirOptions, dirName string, dir http.File) error {\n\tdirs, err := dir.Readdir(-1)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsort.Slice(dirs, func(i, j int) bool { return dirs[i].Name() < dirs[j].Name() })\n\n\tctx.ContentType(context.ContentHTMLHeaderValue)\n\t_, err = ctx.WriteString(\"<div>\\n\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// show current directory\n\t_, err = ctx.Writef(\"<h2>Current Directory: %s</h2>\", ctx.Request().RequestURI)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = ctx.WriteString(\"<ul style=\\\"list-style: none; padding-left: 20px\\\">\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// link to parent directory\n\t_, err = ctx.WriteString(\"<li><span style=\\\"width: 150px; float: left; display: inline-block;\\\">drwxrwxrwx</span><a href=\\\"./\\\">../</a><li>\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, d := range dirs {\n\t\tif !dirOptions.ShowHidden && IsHidden(d) {\n\t\t\tcontinue\n\t\t}\n\n\t\tname := toBaseName(d.Name())\n\n\t\tu, err := url.Parse(ctx.Request().RequestURI) // clone url and remove query (#1882).\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"name: %s: error: %w\", name, err)\n\t\t}\n\t\tu.RawQuery = \"\"\n\n\t\tupath := url.URL{Path: path.Join(u.String(), name)}\n\n\t\tdownloadAttr := \"\"\n\t\tif dirOptions.Attachments.Enable && !d.IsDir() {\n\t\t\tdownloadAttr = \" download\" // fixes chrome Resource interpreted, other browsers will just ignore this <a> attribute.\n\t\t}\n\n\t\tviewName := name\n\t\tif d.IsDir() {\n\t\t\tviewName += \"/\"\n\t\t}\n\n\t\t// name may contain '?' or '#', which must be escaped to remain\n\t\t// part of the URL path, and not indicate the start of a query\n\t\t// string or fragment.\n\t\t_, err = ctx.Writef(\"<li>\"+\n\t\t\t\"<span style=\\\"width: 150px; float: left; display: inline-block;\\\">%s</span>\"+\n\t\t\t\"<a href=\\\"%s\\\"%s>%s</a>\"+\n\t\t\t\"</li>\",\n\t\t\td.Mode().String(), upath.String(), downloadAttr, html.EscapeString(viewName))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t_, err = ctx.WriteString(\"</ul></div>\\n\")\n\treturn err\n}", "title": "" }, { "docid": "05ed397ee9c5f806312367f68884baf0", "score": "0.60388345", "text": "func (d DirEnt) Print() string {\n\tsflag := fmt.Sprintf(\" Directory Entry: 0x%x\\n\", d.Header)\n\tdflags := sarflags.FlagD()\n\t// sarflags.FrameD(\"dirent\")\n\tfor _, f := range dflags {\n\t\tn := sarflags.GetDStr(d.Header, f)\n\t\tsflag += fmt.Sprintf(\" %s:%s\\n\", f, n)\n\t}\n\tsflag += fmt.Sprintf(\" Path:%s\\n\", d.Path)\n\tsflag += fmt.Sprintf(\" Size:%d\\n\", d.Size)\n\tsflag += fmt.Sprintf(\" Mtime:%s\\n\", d.Mtime.Print())\n\tsflag += fmt.Sprintf(\" Ctime:%s\", d.Ctime.Print())\n\treturn sflag\n}", "title": "" }, { "docid": "e7793cc3c0cda1b6af0d2c38e87a822e", "score": "0.60144144", "text": "func printFile(str string) {\n\tstat, err := os.Lstat(str)\n\t// Check for presence\n\tif os.IsNotExist(err){\n\t\tfmt.Printf(\"Not %v doesn't exist.\\n\",str)\n\t\treturn\n\t}\n // Check is not a directory\n\tif !stat.IsDir() {\n\t\tfmt.Printf(\"The %v is not a directory.\\n\",str)\n\t\treturn\n\t}\n\n // Print all files\n\tfilepath.Walk(str, func(path string, info os.FileInfo, err error) error {\n\t\tif !info.IsDir(){\n\t\t\tfmt.Println(path)\n\t\t\treturn err\n\t\t}\n\t\treturn err\n\t})\n}", "title": "" }, { "docid": "7e89b880d54c89136c842105480f3140", "score": "0.59856296", "text": "func (lf *ListFile) TextPrint(level int) {\n\n for i := 0; i < level; i++ {\n fmt.Print(\"\\t\")\n }\n\n displayName := lf.Name\n\n if lf.IsLink {\n displayName += \"* -> \" + lf.LinksTo\n } else if lf.IsDir {\n displayName += \"/\"\n }\n\n fmt.Println(displayName)\n\n for _, child := range(lf.Children) {\n child.TextPrint(level + 1)\n }\n\n}", "title": "" }, { "docid": "35cff6d6729397ec64adbb3e3f9fa955", "score": "0.5977458", "text": "func printDirectoryHeaderLine() {\n\t// print the first line of dashes\n\tprintDirectoryLine()\n\t// print header line\n\tfmt.Printf(\"Name | Phone Number | Email \\n\")\n\t// print a line of dashes under the header line\n\tprintDirectoryLine()\n}", "title": "" }, { "docid": "ffa60230b6e0566610bc5c535d97f38c", "score": "0.5954364", "text": "func PrintFiles(files []DirItem) []byte {\n\tb := bytes.NewBuffer([]byte{})\n\tb.WriteString(fmt.Sprintf(\"total %d\\n\", len(files)))\n\tfor _, f := range files {\n\t\tvar t string = \"f\"\n\t\tvar s = f.Size\n\t\tif f.IsDir {\n\t\t\tt = \"d\"\n\t\t\ts = 0\n\t\t} else if f.Error != \"\" {\n\t\t\tt = \"e\"\n\t\t\ts = 0\n\t\t}\n\t\tif f.Error != \"\" {\n\t\t\tb.WriteString(fmt.Sprintf(\"%s %15d %30s %s(%s)\\n\", t, s, \"\", f.Name, f.Error))\n\t\t} else {\n\t\t\tb.WriteString(fmt.Sprintf(\"%s %15d %30s %s\\n\", t, s, f.Modified, f.Name))\n\t\t}\n\t}\n\treturn b.Bytes()\n}", "title": "" }, { "docid": "e1bfac1d13d28a9691035cc4eea55981", "score": "0.5939061", "text": "func scanDirectory(directory string, level int) {\n\tcurrentDirectoryListing, _ := ioutil.ReadDir(directory)\n\tlevelIncrement := level + 1\n\n\tfor _, element := range currentDirectoryListing {\n\t\tfmt.Print(strings.Repeat(\" \", level))\n\n\t\t// Is the element a directory?\n\t\tif element.IsDir() {\n\t\t\t// Output the current folder\n\t\t\tfmt.Print( \"📁 \", element.Name(), \"\\n\")\n\t\t\t// Then go and rerun the for loop within.\n\t\t\tscanDirectory(directory + \"/\" + element.Name(), levelIncrement)\n\t\t} else {\n\t\t\t// Output the file\n\t\t\tfmt.Print(\"📄 \", element.Name(), \"\\n\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "605a162985077c895c4d51cb293e9076", "score": "0.5936296", "text": "func printDirectoryLine() {\n\t// print a line\n\tfmt.Printf(\"----------------------+----------------+------------------------------------------\\n\")\n}", "title": "" }, { "docid": "105b5bb540b022e76cbea5eaaf60f4f5", "score": "0.5930988", "text": "func printDirectoryData(person gsuitemdm.DirectoryData) {\n\tfmt.Printf(\"%-21.21s | %s | %s\\n\", person.Name, person.PhoneNumber, person.Email)\n\n\t// fmt.Printf(\"%21.21s | %-16.16s | %-14.14s | %-16.16s | %-15.15s | %-13.13s | %-18.18s | %-20.20s\\n\", device.Domain, device.Model, fnum, device.SN, device.IMEI, device.Status, humanize.Time(lts), device.Name)\n}", "title": "" }, { "docid": "85000975ff34fae3f8c57777e7655673", "score": "0.5904268", "text": "func checkListingNoSize(t *testing.T, dir string, want []string) {\n\tvar got []string\n\tnodes, err := os.ReadDir(dir)\n\trequire.NoError(t, err)\n\tfor _, node := range nodes {\n\t\tgot = append(got, fmt.Sprintf(\"%s,%v\", node.Name(), node.IsDir()))\n\t}\n\tassert.Equal(t, want, got)\n}", "title": "" }, { "docid": "6e96ef00ad113eeee516dccef09ebaa4", "score": "0.58868384", "text": "func doList(dir string, out io.Writer, arg, indent string) error {\n\tfileInfos, err := ioutil.ReadDir(dir)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Sort case-insensitive. ioutil.ReadDir returns results in sorted order,\n\t// but it's not stable across platforms.\n\tsort.Slice(fileInfos, func(i, j int) bool {\n\t\treturn strings.ToLower(fileInfos[i].Name()) < strings.ToLower(fileInfos[j].Name())\n\t})\n\n\tfor _, fi := range fileInfos {\n\t\tif arg != \"\" && arg != fi.Name() {\n\t\t\tcontinue\n\t\t}\n\t\tif fi.IsDir() {\n\t\t\tfmt.Fprintf(out, \"%s%s/\\n\", indent, fi.Name())\n\t\t\tif err := doList(filepath.Join(dir, fi.Name()), out, \"\", indent+\" \"); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else {\n\t\t\tfmt.Fprintf(out, \"%s%s\\n\", indent, fi.Name())\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9833ec630d4d0fb40440881fe966b48b", "score": "0.5863803", "text": "func (twc TWConf) printUniqueDirParts(dir string, prevParts []string) []string {\n\tdirParts := []string{}\n\tif dir != \"\" {\n\t\tdir = filepath.Clean(dir)\n\t\tpathSep := string(filepath.Separator)\n\t\tdirParts = strings.Split(dir, pathSep)\n\t\tfor i, dp := range dirParts {\n\t\t\tif i >= len(prevParts) || dp != prevParts[i] {\n\t\t\t\ttwc.Print(strings.Join(dirParts[i:], pathSep))\n\t\t\t\ttwc.Print(pathSep)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\ttwc.Print(strings.Repeat(\" \", len(dp)+len(pathSep)))\n\t\t}\n\t}\n\treturn dirParts\n}", "title": "" }, { "docid": "702dfd3f7d83ccc690e46d318835cfc7", "score": "0.5835909", "text": "func printTree(arr []*lib.SearchResult, i int) {\n\tfor _, c := range arr {\n\t\tvar t string\n\t\tif c.IsDir {\n\t\t\tt = \"folder\"\n\t\t} else {\n\t\t\tt = \"file\"\n\t\t}\n\t\tfmt.Printf(\"%s> %s (TYPE: %s ID: %s PATH: %s)\\n\", strings.Repeat(\"| \", i), c.Name, t, c.InternalID, c.Path)\n\t\tif len(c.Children) > 0 {\n\t\t\tprintTree(c.Children, i+1)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "68e6e5e0fc56090b1b0a0b939a98f279", "score": "0.5818221", "text": "func main() {\n\tflag.Parse()\n\tvar dir string = \".\"\n\tif flag.NArg() > 0 {\n\t\tdir = flag.Args()[0]\n\t}\n\tfiles, err := ioutil.ReadDir(dir)\n\tif err != nil {\n\t\tlog.Fatal(\"Error reading dir: \", err)\n\t}\n\tfor _, f := range files {\n\t\tfmt.Printf(\"%s\\n\", f.Name())\n\t}\n}", "title": "" }, { "docid": "a3c2691ea787fcb7f393ff6932e3abd2", "score": "0.5771634", "text": "func (o DirectoryOutput) DirectoryName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Directory) pulumi.StringPtrOutput { return v.DirectoryName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "c60514cdabd9632a3ead123837daca49", "score": "0.5748646", "text": "func (o GetDirectoriesDirectoryOutput) DirectoryName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetDirectoriesDirectory) string { return v.DirectoryName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "0eb52bf7f05226045628b5d543607346", "score": "0.5743154", "text": "func main() {\n\tdir, err := os.Open(\".\") //use os.Open function to get the contents of a directory and give it a directory path instead of a filename\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer dir.Close()\n\n\tfileInfos, err := dir.Readdir(-1) // Readdir takes a single argument that limits the number of entries returned.\n\t// Passing -1 returns all of the entries\n\tif err != nil {\n\t\treturn\n\t}\n\tfor _, fi := range fileInfos {\n\t\tfmt.Println(fi.Name())\n\t}\n}", "title": "" }, { "docid": "5fcb6271af3b986eb77d9985d48a3d29", "score": "0.5696467", "text": "func (o LookupDirectoryResultOutput) DirectoryName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupDirectoryResult) string { return v.DirectoryName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "c1dffc7f2cacb9d97f06da727efd8321", "score": "0.5675543", "text": "func ListDir(w http.ResponseWriter, r *http.Request) {\n\n}", "title": "" }, { "docid": "2d7c61b78740a4c9d0a12b52ee9bef25", "score": "0.566034", "text": "func dirList(w http.ResponseWriter, f http.File) {\n\tw.Header().Set(\"Content-Type\", \"text/html; charset=utf-8\")\n\tfmt.Fprintf(w, \"<pre>\\n\")\n\t// Datastructures to populate and output.\n\ttopLevelSymlinks := make([]os.FileInfo, 0)\n\tappToLogs := make(map[string][]os.FileInfo)\n\tfor {\n\t\tfileInfos, err := f.Readdir(10000)\n\t\tif err != nil || len(fileInfos) == 0 {\n\t\t\tbreak\n\t\t}\n\t\t// Prepopulate the datastructures.\n\t\tfor _, fileInfo := range fileInfos {\n\t\t\tname := fileInfo.Name()\n\t\t\tnameTokens := strings.Split(name, \".\")\n\t\t\tif len(nameTokens) == 2 {\n\t\t\t\ttopLevelSymlinks = append(topLevelSymlinks, fileInfo)\n\t\t\t} else if len(nameTokens) > 1 {\n\t\t\t\tappToLogs[nameTokens[0]] = append(appToLogs[nameTokens[0]], fileInfo)\n\t\t\t} else {\n\t\t\t\t// File all directories or files created by something other than\n\t\t\t\t// glog under \"unknown\" app.\n\t\t\t\tappToLogs[\"unknown\"] = append(appToLogs[\"unknown\"], fileInfo)\n\t\t\t}\n\t\t}\n\t}\n\n\t// First output the top level symlinks.\n\tsort.Sort(FileInfoModifiedSlice{fileInfos: topLevelSymlinks, reverseSort: true})\n\tfor _, fileInfo := range topLevelSymlinks {\n\t\twriteFileInfo(w, fileInfo)\n\t}\n\t// Second output app links to their anchors.\n\tvar keys []string\n\tfor k := range appToLogs {\n\t\tkeys = append(keys, k)\n\t}\n\tsort.Strings(keys)\n\tif len(keys) != 0 {\n\t\tfmt.Fprint(w, \"\\nJump to sections:\\n\")\n\t}\n\tfor _, app := range keys {\n\t\tfmt.Fprintf(w, \"<a href=\\\"#%s\\\">%s</a>\\n\", app, template.HTMLEscapeString(app))\n\t}\n\tfmt.Fprint(w, \"\\n\")\n\t// Then output the logs of all the different apps.\n\tfor _, app := range keys {\n\t\tappFileInfos := appToLogs[app]\n\t\tsort.Sort(FileInfoModifiedSlice{fileInfos: appFileInfos, reverseSort: true})\n\t\tfmt.Fprintf(w, \"\\n===== <a name=\\\"%s\\\">%s</a> =====\\n\\n\", app, template.HTMLEscapeString(app))\n\t\tfor _, fileInfo := range appFileInfos {\n\t\t\twriteFileInfo(w, fileInfo)\n\t\t}\n\t}\n\tfmt.Fprintf(w, \"</pre>\\n\")\n}", "title": "" }, { "docid": "f3a107b6f8cda19f30c65895e7df5127", "score": "0.56272274", "text": "func (s Directory) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3a79ff772f99d6e205a299c0d5d77742", "score": "0.5596212", "text": "func (f *FileManager) showWd() {\n\tf.ui.Wd.Reset()\n\tfprintDirLst(f.ui.Wd, f.wd)\n\tf.showTitle()\n\tf.showWf()\n\tf.showUpwd()\n}", "title": "" }, { "docid": "9b5966f40e486fe51686d1d36d290157", "score": "0.5593554", "text": "func listFilesOnly(dir string) []string {\n\tfiles := fileutils.ListDirSimple(dir, true)\n\tfiles = funk.Filter(files, func(f string) bool {\n\t\treturn !fileutils.IsDir(f)\n\t}).([]string)\n\treturn funk.Map(files, filepath.Base).([]string)\n}", "title": "" }, { "docid": "881ed092cada126d0a34f800545eebf4", "score": "0.55582905", "text": "func (s *Server) listDir(r *Request, f http.File) {\n\tfiles, err := f.Readdir(-1)\n\tif err != nil {\n\t\tr.Response.WriteStatus(http.StatusInternalServerError, \"Error reading directory\")\n\t\treturn\n\t}\n\t// The folder type has the most priority than file.\n\tsort.Slice(files, func(i, j int) bool {\n\t\tif files[i].IsDir() && !files[j].IsDir() {\n\t\t\treturn true\n\t\t}\n\t\tif !files[i].IsDir() && files[j].IsDir() {\n\t\t\treturn false\n\t\t}\n\t\treturn files[i].Name() < files[j].Name()\n\t})\n\tif r.Response.Header().Get(\"Content-Type\") == \"\" {\n\t\tr.Response.Header().Set(\"Content-Type\", \"text/html; charset=utf-8\")\n\t}\n\tr.Response.Write(`<html>`)\n\tr.Response.Write(`<head>`)\n\tr.Response.Write(`<style>`)\n\tr.Response.Write(`body {font-family:Consolas, Monaco, \"Andale Mono\", \"Ubuntu Mono\", monospace;}`)\n\tr.Response.Write(`</style>`)\n\tr.Response.Write(`</head>`)\n\tr.Response.Write(`<body>`)\n\tr.Response.Writef(`<h1>Index of %s</h1>`, r.URL.Path)\n\tr.Response.Writef(`<hr />`)\n\tr.Response.Write(`<table>`)\n\tif r.URL.Path != \"/\" {\n\t\tr.Response.Write(`<tr>`)\n\t\tr.Response.Writef(`<td><a href=\"%s\">..</a></td>`, gfile.Dir(r.URL.Path))\n\t\tr.Response.Write(`</tr>`)\n\t}\n\tname := \"\"\n\tsize := \"\"\n\tprefix := gstr.TrimRight(r.URL.Path, \"/\")\n\tfor _, file := range files {\n\t\tname = file.Name()\n\t\tsize = gfile.FormatSize(file.Size())\n\t\tif file.IsDir() {\n\t\t\tname += \"/\"\n\t\t\tsize = \"-\"\n\t\t}\n\t\tr.Response.Write(`<tr>`)\n\t\tr.Response.Writef(`<td><a href=\"%s/%s\">%s</a></td>`, prefix, name, ghtml.SpecialChars(name))\n\t\tr.Response.Writef(`<td style=\"width:300px;text-align:center;\">%s</td>`, gtime.New(file.ModTime()).ISO8601())\n\t\tr.Response.Writef(`<td style=\"width:80px;text-align:right;\">%s</td>`, size)\n\t\tr.Response.Write(`</tr>`)\n\t}\n\tr.Response.Write(`</table>`)\n\tr.Response.Write(`</body>`)\n\tr.Response.Write(`</html>`)\n}", "title": "" }, { "docid": "6dcbe50996ce5b442c03f95ab2c2f3f4", "score": "0.55378175", "text": "func checkListing(t *testing.T, dir *Dir, want []string) {\n\tvar got []string\n\tnodes, err := dir.ReadDirAll()\n\trequire.NoError(t, err)\n\tfor _, node := range nodes {\n\t\tgot = append(got, fmt.Sprintf(\"%s,%d,%v\", node.Name(), node.Size(), node.IsDir()))\n\t}\n\tassert.Equal(t, want, got)\n}", "title": "" }, { "docid": "d04322324168eecd7e8fbf34270d5c93", "score": "0.55104494", "text": "func getDirectoryListing(dir string) (lastModified time.Time, html string, err error) {\n modTime := time.Now();\n\n // check for index.md\n indexfile := dir + \"/index.md\"\n if _, err := os.Stat(indexfile); err == nil {\n return getMarkdownFile(indexfile)\n }\n\n page := Page{}\n page.Title = filepath.Base(dir)\n page.Layout = \"category\"\n page.Category = filepath.Base(dir)\n\n var files []string\n\n files = readDirListAndAppend(dir)\n\n readPagesFiles(files, &page, &modTime)\n\n page.Pages.Sort()\n html = applyTemplates(page)\n\n return modTime, html, err\n}", "title": "" }, { "docid": "1e37332a217352577debf289e827b326", "score": "0.55063885", "text": "func SkipUnderscoreDirs(path, name string) bool { return strings.HasPrefix(name, \"_\") }", "title": "" }, { "docid": "803814fe1b691da90bc47d5e1b1e654c", "score": "0.5502736", "text": "func listDir(dirPath string) (newFilePath []string) {\n\n\tfiles, err := ioutil.ReadDir(dirPath)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfor _, f := range files {\n\t\tif f.IsDir() {\n\t\t\t// Call this function again if the child is a folder\n\t\t\tlistDir(dirPath + \"/\" + f.Name())\n\t\t} else {\n\t\t\tfullPath := dirPath + \"/\" + f.Name()\n\t\t\tnewFilePath = append(newFilePath, fullPath)\n\t\t}\n\t}\n\tfmt.Println(newFilePath)\n\treturn newFilePath\n}", "title": "" }, { "docid": "c97da0c35c37b39dc0d244af368b3ab7", "score": "0.549515", "text": "func onlyDirectories(inLs []os.FileInfo) (outLs []os.FileInfo) {\n\tfor _, fd := range inLs {\n\t\tif fd.IsDir() {\n\t\t\toutLs = append(outLs, fd)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "a312f9de90b2e388f6a256b550406a1d", "score": "0.54869634", "text": "func (m Model) previewDirectoryListingCmd(name string) tea.Cmd {\n\treturn func() tea.Msg {\n\t\tcurrentDir, err := dirfs.GetWorkingDirectory()\n\t\tif err != nil {\n\t\t\treturn errorMsg(err.Error())\n\t\t}\n\n\t\tfiles, err := dirfs.GetDirectoryListing(filepath.Join(currentDir, name), m.dirTree.ShowHidden)\n\t\tif err != nil {\n\t\t\treturn errorMsg(err.Error())\n\t\t}\n\n\t\treturn previewDirectoryListingMsg(files)\n\t}\n}", "title": "" }, { "docid": "1ae10540df852a770e7380d6ba54cd8d", "score": "0.5478985", "text": "func listDirectory(dir string, filterFunc func(string) bool) ([]string, error) {\n\tfis, err := ioutil.ReadDir(dir)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tunits := make([]string, 0)\n\tfor _, fi := range fis {\n\t\tname := fi.Name()\n\t\tif filterFunc(name) {\n\t\t\tcontinue\n\t\t}\n\t\tunits = append(units, name)\n\t}\n\n\treturn units, nil\n}", "title": "" }, { "docid": "75ae1aab4a12f4af6797a74047b602c7", "score": "0.5465139", "text": "func (d *demo) listBucketDirMode() {\n\tio.WriteString(d.w, \"\\nListbucket directory mode result:\\n\")\n\td.listDir(\"b\", \"\")\n}", "title": "" }, { "docid": "68a229f6390e5aa8c9e5b1cd65297329", "score": "0.5464448", "text": "func List(dir, suffix string, isDir ...bool) (files []string, err error) {\n\tfiles = make([]string, 0, 10)\n\tdirIo, err := os.ReadDir(dir)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpthSep := string(os.PathSeparator)\n\tsuffix = strings.ToUpper(suffix)\n\tfor _, fi := range dirIo {\n\t\tif len(isDir) > 0 {\n\t\t\tif !fi.IsDir() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t} else {\n\t\t\tif fi.IsDir() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tif strings.HasSuffix(strings.ToUpper(fi.Name()), suffix) {\n\t\t\tfiles = append(files, dir+pthSep+fi.Name())\n\t\t}\n\t}\n\n\treturn files, nil\n}", "title": "" }, { "docid": "4c00542b77263075c116d3bfe24dba59", "score": "0.5463727", "text": "func (m NoopMounter) Dir() string {\n\treturn \"\"\n}", "title": "" }, { "docid": "abbe4af55a44c17e742798c1e1f8daf9", "score": "0.544907", "text": "func Print(dir string) string {\n\tb := new(bytes.Buffer)\n\ttr := tree.New(dir)\n\topts := &tree.Options{\n\t\tFs: new(FS),\n\t\tOutFile: b,\n\t}\n\ttr.Visit(opts)\n\ttr.Print(opts)\n\treturn b.String()\n}", "title": "" }, { "docid": "3af8e671eda824c98216902878f6060a", "score": "0.54451346", "text": "func checkListing(t *testing.T, dir string, want []string) {\n\tvar got []string\n\tnodes, err := os.ReadDir(dir)\n\trequire.NoError(t, err)\n\tfor _, node := range nodes {\n\t\tinfo, err := node.Info()\n\t\tassert.NoError(t, err)\n\t\tgot = append(got, fmt.Sprintf(\"%s,%d,%v\", node.Name(), info.Size(), node.IsDir()))\n\t}\n\tassert.Equal(t, want, got)\n}", "title": "" }, { "docid": "49afc44372891b8bbb372e3a68db266d", "score": "0.5432907", "text": "func prefixDirectory(directory string, names []string) {\n\tif directory != \".\" {\n\t\tfor i, name := range names {\n\t\t\tnames[i] = filepath.Join(directory, name)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d6e3d9d62cabfb050663ba9af3742f4f", "score": "0.54181343", "text": "func visit(p string, info os.FileInfo, err error) error {\r\n if err != nil {\r\n return err\r\n }\r\n fmt.Println(\" \", p, info.IsDir())\r\n return nil\r\n}", "title": "" }, { "docid": "8e869bd3307c3b06c15624d469e1b09a", "score": "0.54178584", "text": "func (d *Dirs) String() string {\n\treturn \"dirs\"\n}", "title": "" }, { "docid": "a6b12b17708deca2be42869713d70dae", "score": "0.54066795", "text": "func textWalk(path string, listing []*ListFile, logger *log.Logger) {\n\n if !strings.HasSuffix(path, \"/\") {\n path += \"/\"\n }\n\n fmt.Println(path)\n\n for _, lf := range(listing) {\n lf.TextPrint(1)\n }\n\n}", "title": "" }, { "docid": "e6da05939f3f3be649682cc53ddfa82f", "score": "0.54056394", "text": "func (d Directory) String() string {\n\tif d == \"\" {\n\t\treturn \".\"\n\t}\n\tdir, file := filepath.Split(string(d))\n\tif file == \"\" {\n\t\treturn dir\n\t}\n\tif file == \".\" || file == \"..\" {\n\t\treturn dir + file\n\t}\n\treturn dir + file + string(filepath.Separator)\n}", "title": "" }, { "docid": "30fb7f9800288952993612d2b12d9fa8", "score": "0.5380248", "text": "func main() {\n\tlog.Info(\"Start\")\n\n\tif len(os.Args) != 2 {\n\t\tlog.Fatal(\"Usage: ./enumerate-directories <rootdir>\")\n\t}\n\n\tf, err := os.Create(\"dirs.csv\")\n\tdefer f.Close()\n\twriter := csv.NewWriter(f)\n\n\trootDir := os.Args[1]\n\tdirs, err := ioutil.ReadDir(rootDir)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfor i, dir := range dirs {\n\t\tif i%1000 == 0 {\n\t\t\tlog.Infof(\"Processed %d directories\", i)\n\t\t}\n\n\t\tsubdirs, err := ioutil.ReadDir(path.Join(rootDir, dir.Name()))\n\t\tif err != nil {\n\t\t\tlog.Error(\"Error for \", dir.Name(), \" : \", err)\n\t\t}\n\n\t\tfor _, sd := range subdirs {\n\t\t\terr = writer.Write([]string{dir.Name(), sd.Name()})\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(err)\n\t\t\t}\n\t\t\twriter.Flush()\n\t\t}\n\n\t}\n\n\tlog.Info(\"End\")\n}", "title": "" }, { "docid": "932583960e3b29a2ecaa12455811e695", "score": "0.53802073", "text": "func ListDirectory(w http.ResponseWriter, r *http.Request, f http.File, templateName string) {\n\tRootDir, err := f.Stat()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tvar dirContents DirectoryContent\n\tdirContents.DirName = RootDir.Name()\n\tdirContents.Files = make([]FileContent, 0)\n\tdirs, err := f.Readdir(-1)\n\tif err != nil {\n\t\tlog.Printf(\"http: error reading directory: %v\", err)\n\t\thttp.Error(w, \"Error reading directory\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\tsort.Slice(dirs, func(i, j int) bool { return dirs[i].Name() < dirs[j].Name() })\n\tw.Header().Set(\"Content-Type\", \"text/html; charset=utf-8\")\n\tfor _, d := range dirs {\n\t\tname := d.Name()\n\t\tfileExtension := \"page\"\n\t\tif d.IsDir() {\n\t\t\tname += \"/\"\n\t\t\tfileExtension = \"folder\"\n\t\t} else if len(filepath.Ext(name)) > 1 {\n\t\t\tfileExtension = filepath.Ext(name)[1:]\n\t\t}\n\n\t\turl := url.URL{Path: name}\n\t\tfileContent := FileContent{Name: name, Size: utils.GetHumanReadableSize(d), URL: url, Extension: fileExtension}\n\t\tdirContents.Files = append(dirContents.Files, fileContent)\n\t}\n\tdirContents.IPAddr = r.Host\n\trenderTemplate(w, templateName, dirContents)\n}", "title": "" }, { "docid": "587fe15b4ca8a47bf24f0f12d7ea9f4e", "score": "0.53546387", "text": "func readDirectory(directory string, paths *[]string) {\n\tfileInfos, err := ioutil.ReadDir(directory)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tuseDirectory := false\n\tfor _, fileInfo := range fileInfos {\n\t\tif strings.HasSuffix(fileInfo.Name(), \"docs\") {\n\t\t\tcontinue\n\t\t}\n\n\t\tif fileInfo.IsDir() == true && fileInfo.Name()[0] != '.' {\n\t\t\treadDirectory(directory+\"/\"+fileInfo.Name(), paths)\n\t\t\tcontinue\n\t\t}\n\n\t\tif useDirectory == true {\n\t\t\tcontinue\n\t\t}\n\n\t\tif path.Ext(fileInfo.Name()) == \".go\" {\n\t\t\t*paths = append(*paths, directory)\n\t\t\tuseDirectory = true\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "1557ba7527f0ce3a14e5b7a87037142d", "score": "0.5333157", "text": "func DirsReport(path string, pm Mounted) {\n\tp, n, e := SeparatePath(path)\n\t// Obtener Fecha y Hora actual\n\tct := getCurrentTime()\n\t// Recuperar el SuperBoot\n\tsb := ReadSuperBoot(pm.Path, pm.Part.PartStart)\n\t// Obtener el directorio raíz\n\trootDir := ReadAVD(pm.Path, sb.AptArbolDirectorio)\n\t// Generar contenido Dot\n\tcodir := int64(1)\n\tcDot := \"digraph {\\nedge[arrowhead=vee]\\n\"\n\tcDot += \"labelloc=\\\"t\\\";\\nlabel=<REPORTE DE DIRECTORIOS<BR /><FONT POINT-SIZE=\\\"10\\\">Generado:\" + GetDateAsString(ct) + \"</FONT><BR /><BR />>;\\n\"\n\tcDot += \"d1 [label=<\" + GetString(rootDir.NombreDirectorio) + \"<BR /><FONT POINT-SIZE=\\\"6\\\">\" + GetDateAsString(rootDir.FechaCreacion) + \"</FONT>> shape=folder style=filled fillcolor=darkgoldenrod1 fontsize=11];\\n\"\n\t// Creo los apuntadores a subdirectorios ...\n\tfor i, apt := range rootDir.AptArregloSubDir {\n\t\tif apt > 0 {\n\t\t\tcDot += \"aptr\" + strconv.Itoa(int(codir)) + \"\" + strconv.Itoa(int(apt)) + \"[label=\\\"[Apt\" + strconv.Itoa(int(i+1)) + \"]: \" + strconv.Itoa(int(apt)) + \"\\\" fillcolor=white fontcolor=black fontname=\\\"Helvetica\\\" shape=plaintext height=0.1 width=0.1 fontsize=8];\\n\"\n\t\t}\n\t}\n\t// Apunto la carpeta padre a los subdirectorios\n\tfor _, apt := range rootDir.AptArregloSubDir {\n\t\tif apt > 0 {\n\t\t\tcDot += \"d\" + strconv.Itoa(int(codir)) + \"->\" + \"aptr\" + strconv.Itoa(int(codir)) + \"\" + strconv.Itoa(int(apt)) + \" [dir=none]\\n\"\n\t\t}\n\t}\n\tfor _, apt := range rootDir.AptArregloSubDir {\n\t\tif apt > 0 {\n\t\t\tposition := sb.AptArbolDirectorio + (sb.TamStrcArbolDirectorio * (apt - 1))\n\t\t\tsubdir := ReadAVD(pm.Path, position)\n\t\t\tcDot += CreateDirDot(subdir, codir, apt, pm.Path, sb.TamStrcArbolDirectorio, sb.AptArbolDirectorio)\n\t\t}\n\t}\n\n\t// Si existe creo el apuntador indirecto\n\tif rootDir.AptIndirecto > 0 {\n\t\tcDot += \"aptr\" + strconv.Itoa(int(codir)) + \"\" + strconv.Itoa(int(rootDir.AptIndirecto)) + \"[label=\\\"[IND]: \" + strconv.Itoa(int(rootDir.AptIndirecto)) + \"\\\" fillcolor=white fontcolor=black fontname=\\\"Helvetica\\\" shape=plaintext height=0.1 width=0.1 fontsize=8];\\n\"\n\n\t\tcDot += \"d\" + strconv.Itoa(int(codir)) + \"->\" + \"aptr\" + strconv.Itoa(int(codir)) + \"\" + strconv.Itoa(int(rootDir.AptIndirecto)) + \" [dir=none]\\n\"\n\n\t\t// Generar el codigo del directorio indirecto\n\t\tposition := sb.AptArbolDirectorio + (sb.TamStrcArbolDirectorio * (rootDir.AptIndirecto - 1))\n\t\tsubdir := ReadAVD(pm.Path, position)\n\t\tcDot += CreateDirDot(subdir, codir, rootDir.AptIndirecto, pm.Path, sb.TamStrcArbolDirectorio, sb.AptArbolDirectorio)\n\t}\n\n\tcDot += \"}\"\n\t// Se escribirá el archivo dot\n\tstate := WriteFile(p, n, \"dot\", cDot)\n\tif state {\n\t\tfmt.Println(\"> DOT escrito exitosamente...\")\n\t\toutType := \"-T\" + e\n\t\tpathDot := p + n + \".dot\"\n\t\tpathRep := path\n\t\tDotGenerator(outType, pathDot, pathRep)\n\t}\n}", "title": "" }, { "docid": "b9a00e073627e51eb70ff63eb64fc21f", "score": "0.53298175", "text": "func (info Info) IsDir() bool { return len(info.Files) != 0 }", "title": "" }, { "docid": "f7a8e0af1fd42a5e4528b7ef684908a3", "score": "0.5329186", "text": "func main() {\n\tfilepath.Walk(\".\", func(path string, info os.FileInfo, err error) error { //the function passed to Walk is called for every file and folder in the root folder\n\t\t//Walk function iw passed 3 arguments: path which is the path to the ffile; info, which is the information for the file; and err, which is any error received while walking the directory\n\t\tfmt.Println(path)\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "a8d0054e0e84cdb2b33e7e0cd0d9e01b", "score": "0.53284025", "text": "func List(dir string) {\n\tsuite := Walk(dir)\n\tsuite.Println()\n}", "title": "" }, { "docid": "b999f6a390df1fbffd6f64358235131a", "score": "0.53100055", "text": "func readDirNames(dirname string) ([]string, error) {\n\t// #nosec G304 - False positive\n\tf, err := os.Open(dirname)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tnames, err := f.Readdirnames(-1)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = f.Close()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsort.Strings(names)\n\treturn names, nil\n}", "title": "" }, { "docid": "b45531f5b8fd8973d9d303f1f666a8ac", "score": "0.5299157", "text": "func readDirNames(dirname string) ([]string, error) {\n\tf, err := os.Open(dirname)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tnames, err := f.Readdirnames(-1)\n\tf.Close()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsort.Strings(names)\n\treturn names, nil\n}", "title": "" }, { "docid": "b45531f5b8fd8973d9d303f1f666a8ac", "score": "0.5299157", "text": "func readDirNames(dirname string) ([]string, error) {\n\tf, err := os.Open(dirname)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tnames, err := f.Readdirnames(-1)\n\tf.Close()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsort.Strings(names)\n\treturn names, nil\n}", "title": "" }, { "docid": "b45531f5b8fd8973d9d303f1f666a8ac", "score": "0.5299157", "text": "func readDirNames(dirname string) ([]string, error) {\n\tf, err := os.Open(dirname)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tnames, err := f.Readdirnames(-1)\n\tf.Close()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsort.Strings(names)\n\treturn names, nil\n}", "title": "" }, { "docid": "80279a1078bd251206ac5cbfd5848661", "score": "0.5297238", "text": "func listFiles(dir string) error {\n\tlog.Println(\"Listing files under \" + dir)\n\treturn filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\tlog.Printf(\"%v\\n\", err)\n\t\t\treturn err\n\t\t}\n\t\tlog.Println(path)\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "f1ef53eaa68fe8b331895c7f0e4e9be0", "score": "0.52959186", "text": "func main() {\n\tdirectoryFiles()\n}", "title": "" }, { "docid": "49f048ec06e060106c9803787bb73e36", "score": "0.52925843", "text": "func readDirNames(dirname string) ([]string, error) {\n\tf, err := os.Open(dirname)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tnames, err := f.Readdirnames(-1)\n\tf.Close()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn names, nil\n}", "title": "" }, { "docid": "5517b563a0555ae1ceeab27201e7dff6", "score": "0.52871287", "text": "func readCurrentDir() {\n\tfile, err := os.Open(\".\")\n\tif err != nil {\n\t\tlog.Fatalf(\"failed opening directory: %s\", err)\n\t}\n\tdefer file.Close()\n\n\tfileList, _ := file.Readdir(0)\n\n\tfmt.Printf(\"\\nName\\t\\tSize\\tIsDirectory Last Modification\\n\")\n\n\tfor _, files := range fileList {\n\t\tfmt.Printf(\"\\nName: %-15s Size: %-7v Directory?: %-12v Modified: %v\\n\", files.Name(), files.Size(), files.IsDir(), files.ModTime())\n\t}\n}", "title": "" }, { "docid": "557c579bf01835b41f3caa52f6858e18", "score": "0.5284359", "text": "func (c *Compile) inspectDir(to time.Duration) (main bool, err error) {\n\tctx, cancel := context.WithTimeout(context.Background(), to)\n\tdefer cancel()\n\n\tstdo, stde, err := c.runGo(ctx, \"list\", \"-json\")\n\tif err != nil {\n\t\tfor exp, err := range listErrs {\n\t\t\tif exp.Match(stde.Bytes()) {\n\t\t\t\treturn false, fmt.Errorf(\"inspecting '%s': %w\", c.dir, err)\n\t\t\t}\n\t\t}\n\n\t\treturn false, err\n\t}\n\n\tvar info struct {\n\t\tName string\n\t}\n\n\tdec := json.NewDecoder(stdo)\n\terr = dec.Decode(&info)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"failed to unmarshal `go list -json` output\\n: %w\", err)\n\t}\n\n\treturn info.Name == \"main\", nil\n}", "title": "" }, { "docid": "0a09241c38e501801817deea21db225a", "score": "0.5283518", "text": "func filterDirectoryList(regex string) []string {\n\tvar results []string\n\n\t// Walk the read_dir and check each file to see if it belongs in one of our slices.\n\tfilepath.Walk(*read_dir, func(path string, file os.FileInfo, _ error) error {\n\t\tif !file.IsDir() {\n\t\t\tr, err := regexp.MatchString(regex, file.Name())\n\t\t\tif err == nil && r {\n\t\t\t\tresults = append(results, file.Name())\n\t\t\t} else {\n\t\t\t\tcheckError(err)\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n\n\treturn results\n}", "title": "" }, { "docid": "674f9888a597bb6ec282253a7f10ed1e", "score": "0.5281299", "text": "func lsDir(dir string) []string {\n\tfiles, err := ioutil.ReadDir(dir)\n\tif err != nil {\n\t\treturn nil\n\t}\n\tnames := make([]string, len(files))\n\tfor i, fi := range files {\n\t\tnames[i] = fi.Name()\n\t}\n\treturn names\n}", "title": "" }, { "docid": "41e506e6eec913e5e70e20c65bb99f39", "score": "0.5276951", "text": "func readDirNames(dirname string) ([]string, error) {\n\tf, err := os.Open(dirname)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer f.Close()\n\n\tnames, err := f.Readdirnames(-1)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsort.Strings(names)\n\treturn names, nil\n}", "title": "" }, { "docid": "9a8aff48645c7748705504401764e4af", "score": "0.5275207", "text": "func (app *userRepository) List() ([]string, error) {\n\tfiles, err := ioutil.ReadDir(app.basePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnames := []string{}\n\tfor _, oneFile := range files {\n\t\tif !oneFile.IsDir() {\n\t\t\tcontinue\n\t\t}\n\n\t\tnames = append(names, oneFile.Name())\n\t}\n\n\treturn names, nil\n}", "title": "" }, { "docid": "6e37d064d302d56035d0457e5378cc29", "score": "0.5275074", "text": "func readDirNames(dirname string) ([]string, error) {\n\tf, err := os.Open(dirname)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tnames, err := f.Readdirnames(-1)\n\tif e := f.Close(); e != nil && err == nil {\n\t\terr = e\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsort.Strings(names)\n\treturn names, nil\n}", "title": "" }, { "docid": "f9fd926e166ef6b498332f81e820a207", "score": "0.5262959", "text": "func ListDir(dirPth string, suffix string) (files []string, err error) {\n\tfiles = []string{} //make([]string, 0, 10)\n\n\tdir, err := ioutil.ReadDir(dirPth)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tPthSep := string(os.PathSeparator)\n\tsuffix = strings.ToUpper(suffix)\n\n\tfor _, fi := range dir {\n\t\tif fi.IsDir() {\n\t\t\tcontinue\n\t\t}\n\t\tif strings.HasSuffix(strings.ToUpper(fi.Name()), suffix) {\n\t\t\tfiles = append(files, dirPth+PthSep+fi.Name())\n\t\t}\n\t}\n\n\treturn files, nil\n}", "title": "" }, { "docid": "313bc71de74869703f2f5d8b0f4d9d56", "score": "0.5262109", "text": "func (c *conf) directoryWalk() ([]string, error) {\n\tvar files []string\n\terr := filepath.Walk(c.InventoryRoot, func(path string, info os.FileInfo, err error) error {\n\t\tif !info.IsDir() {\n\t\t\tif strings.Contains(info.Name(), c.SecretFileName) {\n\t\t\t\tfiles = append(files, path)\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n\treturn files, err\n}", "title": "" }, { "docid": "da2d2a36eb04c1ce25114c8335c8d3df", "score": "0.524761", "text": "func findDirs(fs http.FileSystem, names []string) (map[string]*dir, error) {\n\tdirs := make(map[string]*dir)\n\n\tfor _, name := range names {\n\t\tf, err := fs.Open(name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tinf, err := f.Stat()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tdirName := path.Dir(name)\n\t\td, ok := dirs[dirName]\n\t\tif !ok {\n\t\t\tfi := newFileInfo(path.Base(dirName), os.ModeDir, inf.ModTime())\n\t\t\td = newDir(fi, dirName)\n\t\t\tdirs[dirName] = d\n\t\t}\n\n\t\tfi := newFileInfo(path.Base(name), inf.Mode(), inf.ModTime())\n\n\t\t// Add the directory file info (=this dir) to the parent one,\n\t\t// so `ShowList` can render sub-directories of this dir.\n\t\tparentName := path.Dir(dirName)\n\t\tif parent, hasParent := dirs[parentName]; hasParent {\n\t\t\tparent.children = append(parent.children, d)\n\t\t}\n\n\t\td.children = append(d.children, fi)\n\t}\n\n\treturn dirs, nil\n}", "title": "" }, { "docid": "38ee6301560a146e502fa7331f4de225", "score": "0.5244303", "text": "func (p Path) IsDirWhiteout() bool {\n\treturn p.Basename() == OpaqueWhiteout\n}", "title": "" }, { "docid": "5a6fd33c06728b3331461373d6f1c1ab", "score": "0.5227258", "text": "func getMigrationDirectoryNames(dir string) ([]string, error) {\n\tnames := []string{}\n\tfiles, err := ioutil.ReadDir(dir)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error listing migration files: %v\", err)\n\t}\n\n\tfor _, file := range files {\n\t\tname := file.Name()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif file.IsDir() && isMigration(name) {\n\t\t\tnames = append(names, name)\n\t\t}\n\t}\n\treturn names, nil\n}", "title": "" }, { "docid": "3a3293e5339dc7b610c7ad547c1a6316", "score": "0.52244705", "text": "func ListDir(path string) ([]string, error) {\n\tfiles, err := ioutil.ReadDir(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar dirName []string\n\tfor _, f := range files {\n\t\tif f.IsDir() {\n\t\t\tdirName = append(dirName, f.Name())\n\t\t}\n\t}\n\treturn dirName, nil\n}", "title": "" }, { "docid": "3a3293e5339dc7b610c7ad547c1a6316", "score": "0.52244705", "text": "func ListDir(path string) ([]string, error) {\n\tfiles, err := ioutil.ReadDir(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar dirName []string\n\tfor _, f := range files {\n\t\tif f.IsDir() {\n\t\t\tdirName = append(dirName, f.Name())\n\t\t}\n\t}\n\treturn dirName, nil\n}", "title": "" }, { "docid": "d62183d80b910e5872e08de81aed50aa", "score": "0.52141196", "text": "func printDepTree(buf *bufio.Writer, depTree *DependencyTree, level int, skipDuplicates bool) {\n\tfor idx := 0; idx < level; idx++ {\n\t\tio.WriteString(buf, \"\\t\")\n\t}\n\n\tio.WriteString(buf, fmt.Sprintf(\"- %s@%s\\n\", depTree.Mod.Path, depTree.Mod.Version))\n\tfor _, depSubtree := range depTree.Dependencies {\n\t\tprintDepTree(buf, &depSubtree, level+1, skipDuplicates)\n\t}\n}", "title": "" }, { "docid": "44fad9795eef3ca378252ef31bbe2a7e", "score": "0.5210333", "text": "func (gnc *GNC) PrintRoots() {\n\tfmt.Printf(\"\\nRoot accounts are : \")\n\tfor _, guid := range gnc.Roots {\n\t\tfmt.Printf(\"\\n %20.20s\\t:\\t%s\", guid, gnc.AccountName(guid))\n\t}\n}", "title": "" }, { "docid": "4959b583d8fbcf88dbd5bf8557305175", "score": "0.52072865", "text": "func listPassDir(args ...string) ([]os.FileInfo, error) {\n\tpassDir := getPassDir()\n\tp := path.Join(append([]string{passDir, PASS_FOLDER}, args...)...)\n\tentries, err := os.ReadDir(p)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn []os.FileInfo{}, nil\n\t\t}\n\t\treturn nil, err\n\t}\n\tinfos := make([]fs.FileInfo, 0, len(entries))\n\tfor _, entry := range entries {\n\t\tinfo, err := entry.Info()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tinfos = append(infos, info)\n\t}\n\treturn infos, nil\n}", "title": "" }, { "docid": "277ad7f631b02bc4fac78ac36ed1177f", "score": "0.5204641", "text": "func (find *FileFinder) SearchAndPrint() {\n\tfmt.Println(info(\"Searching in \", find.rootDir, \" for \", find.renderCriterias()))\n\n\tfilepath.Walk(find.rootDir, func(fp string, fi os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\tlog.Println(warn(err)) // can't walk here,\n\t\t\treturn nil // but continue walking elsewhere\n\t\t}\n\t\tif fi.IsDir() && find.dirname == \"\" {\n\t\t\treturn nil // not a file, and we're not looking for dirnames\n\t\t}\n\t\t// cannot search for both\n\t\tq := find.filename\n\t\tif find.dirname != \"\" {\n\t\t\tq = find.dirname\n\t\t}\n\t\tmatched, err := filepath.Match(q, fi.Name())\n\t\tif err != nil {\n\t\t\tlog.Println(err) // malformed pattern\n\t\t\treturn err // this is fatal.\n\t\t}\n\t\tif find.minSize != 0 {\n\t\t\tif fi.Size() < find.minSize {\n\t\t\t\tmatched = false\n\t\t\t}\n\t\t}\n\t\tif find.maxSize != 0 {\n\t\t\tif fi.Size() > find.maxSize {\n\t\t\t\tmatched = false\n\t\t\t}\n\t\t}\n\t\tif matched {\n\t\t\tif fi.IsDir() {\n\t\t\t\tfind.totalDirsFound++\n\t\t\t} else {\n\t\t\t\tfmt.Println(fp, prettyDataSize(fi.Size()))\n\t\t\t\tfind.totalFileSize += fi.Size()\n\t\t\t\tfind.totalFilesFound++\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n\n\tif find.totalFilesFound > 0 {\n\t\tfmt.Println(info(\"Found \", find.totalFilesFound, \" files in \", prettyDataSize(find.totalFileSize)))\n\t}\n\tif find.totalDirsFound > 0 {\n\t\tfmt.Println(info(\"Found \", find.totalDirsFound, \" directories\"))\n\t}\n}", "title": "" }, { "docid": "1fd7b075f92439ae4d293b6161150eee", "score": "0.5191963", "text": "func printNames(names []name) {\n\tfor _, n := range names {\n\t\tfmt.Println(n.fname, n.lname)\n\t}\n}", "title": "" }, { "docid": "4d7d905dfa4f075593d05fdcbf537293", "score": "0.51916695", "text": "func readDirFancy(dirPath string) ([]string, error) {\n\tnames := []string{}\n\tf, err := os.Open(dirPath)\n\tif err != nil {\n\t\treturn names, err\n\t}\n\tdefer func() {\n\t\t_ = f.Close()\n\t}()\n\tfor {\n\t\tdirs, err := f.Readdir(1024)\n\t\tif err != nil || len(dirs) == 0 {\n\t\t\tbreak\n\t\t}\n\t\tfor _, d := range dirs {\n\t\t\tname := d.Name()\n\t\t\tif d.IsDir() {\n\t\t\t\tname += \"/\"\n\t\t\t}\n\t\t\tnames = append(names, name)\n\t\t}\n\t}\n\treturn names, err\n}", "title": "" }, { "docid": "5124c2eb4066d50ccbd3c5be716d8ccd", "score": "0.5183153", "text": "func listDirHndl(w http.ResponseWriter, r *http.Request) {\n\t// parse / validate request parameter\n\tparams, paramsValid := parseParams(w, r, \"path:string\")\n\tif !paramsValid {\n\t\treturn\n\t}\n\n\tpath := params[\"path\"].(string)\n\n\t// verify path\n\tverifyPathIsUnderZMP(path, w, r)\n\n\tdirEntries, err := ScanDirEntries(path)\n\tif err != nil {\n\t\tlogError.Println(err.Error())\n\t\thttp.Error(w, err.Error(), 500)\n\t\treturn\n\t}\n\n\t// marshal\n\tjs, err := json.Marshal(dirEntries)\n\tif err != nil {\n\t\tlogError.Println(err.Error())\n\t\thttp.Error(w, err.Error(), 500)\n\t\treturn\n\t}\n\n\t// respond\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.Write(js)\n}", "title": "" }, { "docid": "6d4c0e83b431e21bf06ebae084ea8d90", "score": "0.5180035", "text": "func (ci *allfinfos) processDir(fqn string) error {\n\tif len(fqn) <= ci.rootLength {\n\t\treturn nil\n\t}\n\n\t// every directory has to either:\n\t// - start with prefix (for levels higher than prefix: prefix=\"ab\", directory=\"abcd/def\")\n\t// - or include prefix (for levels deeper than prefix: prefix=\"a/\", directory=\"a/b/\")\n\trelname := fqn[ci.rootLength:]\n\tif ci.prefix != \"\" && !strings.HasPrefix(ci.prefix, relname) && !strings.HasPrefix(relname, ci.prefix) {\n\t\treturn filepath.SkipDir\n\t}\n\n\tif ci.markerDir != \"\" && relname < ci.markerDir {\n\t\treturn filepath.SkipDir\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5e25e017765727ddab7e8f72e793f7fe", "score": "0.51770914", "text": "func skipDir(info os.FileInfo) bool {\n\treturn skipFile(info) && info.Name() != \".\" && info.Name() != \"..\"\n}", "title": "" }, { "docid": "7fac1eef0d845d79871e69de30b38876", "score": "0.5174396", "text": "func readDirectoryContents(root string) ([]string, error) {\n\tvar fileNames []string\n\tfilesInfo, err := ioutil.ReadDir(root)\n\n\tif err != nil {\n\t\treturn fileNames, err\n\t}\n\n\tfor _, file := range filesInfo {\n\t\tfileNames = append(fileNames, file.Name())\n\t}\n\n\treturn fileNames, nil\n}", "title": "" }, { "docid": "cd2dffda9bf4ce1d39bbfdad5fa31377", "score": "0.5169179", "text": "func (l ListType) Dirs() bool {\n\treturn (l & ListDirs) != 0\n}", "title": "" }, { "docid": "01ac4068d4417bbcc7e7d53e683df7ca", "score": "0.5163146", "text": "func (o *Object) IsDir() bool {\n return false\n}", "title": "" }, { "docid": "ea2db84c1549efd1c8fd03f001de69c4", "score": "0.5153784", "text": "func (n Node) IsDir() bool { return len(n.Spec.Name) == 0 || n.Spec.Name[len(n.Spec.Name)-1] == '/' }", "title": "" }, { "docid": "3342d938cdb86533f736135b8b98d8e6", "score": "0.51537657", "text": "func readDirNames(dirPath string) ([]string, error) {\n\tf, err := os.Open(dirPath)\n\tif err != nil {\n\t\treturn []string{}, err\n\t}\n\tdefer func() {\n\t\t_ = f.Close()\n\t}()\n\treturn f.Readdirnames(0)\n}", "title": "" } ]
d7b84dc62115ced35f27b2114976c855
Fatalf similar to log.Fatalf()
[ { "docid": "09b7e4e7235ea90602f64f7af1428f76", "score": "0.7736369", "text": "func Fatalf(format string, v ...interface{}) {\n\tlogger.Fatalf(format, v...)\n}", "title": "" } ]
[ { "docid": "3bcb5dd0aeb6e68a846352ad2ce6cf88", "score": "0.80112314", "text": "func Fatal(format string, v ...interface{}) {\n errlog.Fatalf(format, v...)\n}", "title": "" }, { "docid": "2b24e7327dcea313cc790bf6d38c0d8c", "score": "0.7983977", "text": "func Fatalf(format string, v ...interface{}) { logf(fatal, format, v...); os.Exit(1) }", "title": "" }, { "docid": "1d4d7805f9f469db883ac879ea4e6140", "score": "0.7850481", "text": "func Fatalf(format string, args ...interface{}) {\n\tsugaredLogger.Fatalf(format, args...)\n}", "title": "" }, { "docid": "697b2f2ad6c8ce994ab465c2fde20e08", "score": "0.78491503", "text": "func (l *fakeLogger) Fatalf(format string, v ...interface{}) {}", "title": "" }, { "docid": "1fedbbefdb3384b24c6db5e9c20aa9b0", "score": "0.7803964", "text": "func LogFatalf(err error, format string, args ...interface{}) {\n\tif err != nil {\n\t\tlog.Fatalf(\"%s, %v\", fmt.Sprintf(format, args...), err)\n\t}\n}", "title": "" }, { "docid": "cf0a2e7a8953f8406418c7ed13cfa040", "score": "0.7790782", "text": "func fatalf(t *T, format string, args ...interface{}) {\n\tt.Helper()\n\tt.Fatalf(format, args...)\n}", "title": "" }, { "docid": "3c3518655f5a933a8eb2c87efce20917", "score": "0.776869", "text": "func (l NoopLog) Fatalf(format string, v ...interface{}) {}", "title": "" }, { "docid": "d9e61531b8e789cbf0a19519060fe74d", "score": "0.77642137", "text": "func Fatalf(format string, v ...interface{}) {\n\tlog.Fatalf(format, v...)\n}", "title": "" }, { "docid": "fa16715153621355ad18a0e4e4cc98cd", "score": "0.77446896", "text": "func Fatalf(format string, args ...interface{}) {\n\tlog.Fatalf(format, args...)\n}", "title": "" }, { "docid": "fa16715153621355ad18a0e4e4cc98cd", "score": "0.77446896", "text": "func Fatalf(format string, args ...interface{}) {\n\tlog.Fatalf(format, args...)\n}", "title": "" }, { "docid": "fa16715153621355ad18a0e4e4cc98cd", "score": "0.77446896", "text": "func Fatalf(format string, args ...interface{}) {\n\tlog.Fatalf(format, args...)\n}", "title": "" }, { "docid": "e1e78b407679e806f8bb7452cfad6265", "score": "0.77443707", "text": "func Fatalf(format string, v ...interface{}) { logger.lprintf(FATAL, format, v...) }", "title": "" }, { "docid": "d1079a42f6b3443eaf29b2771f3c77bc", "score": "0.7734319", "text": "func Fatalf(format string, args ...interface{}) {\n\tglobalLogger.Fatalf(format, args...)\n}", "title": "" }, { "docid": "072acb82ae20c66eb39b8c801fe94f6b", "score": "0.7730227", "text": "func Fatalf(format string, args ...interface{}) {\n\tlogger.Fatalf(format, args...)\n}", "title": "" }, { "docid": "072acb82ae20c66eb39b8c801fe94f6b", "score": "0.7730227", "text": "func Fatalf(format string, args ...interface{}) {\n\tlogger.Fatalf(format, args...)\n}", "title": "" }, { "docid": "72665b470279da0eb926da90d7dc8247", "score": "0.7724508", "text": "func Fatalf(format string, v ...interface{}) {\n\tdefaultLogger.Fatalf(format, v)\n}", "title": "" }, { "docid": "28bc277d066f26a63bf29ea2017df915", "score": "0.7722242", "text": "func Fatalf(template string, args ...interface{}) {\n\tGetSugaredLogger().Fatalf(template, args...)\n}", "title": "" }, { "docid": "449c08a20644dd2528bdf507b35a1260", "score": "0.77176577", "text": "func Fatalf(format string, v ...interface{}) {\n\tdefaultLogger.Fatalf(format, v...)\n}", "title": "" }, { "docid": "961874c4732b418cd0ca0342040c10e2", "score": "0.77088", "text": "func Fatalf(format string, args ...interface{}) {\n\tlogger.log.Fatalf(format, args...)\n}", "title": "" }, { "docid": "1896ae772dd16669689e23dc95a62ac7", "score": "0.7701601", "text": "func Fatalf(format string, v ...interface{}) {\n\tstdLog.Fatalf(format, v...)\n}", "title": "" }, { "docid": "b0642787dfd5f5e7d1bf818808344451", "score": "0.7690072", "text": "func Fatalf(format string, args ...interface{}) {\n\tDefaultLogger.Fatalf(format, args...)\n}", "title": "" }, { "docid": "b0642787dfd5f5e7d1bf818808344451", "score": "0.7690072", "text": "func Fatalf(format string, args ...interface{}) {\n\tDefaultLogger.Fatalf(format, args...)\n}", "title": "" }, { "docid": "f4106c2bbc9f8657ce51fc99b50c8620", "score": "0.76871634", "text": "func Fatalf(s string, args ...interface{}) {\n\tlog.Fatalf(s, args...)\n}", "title": "" }, { "docid": "6037bc2e67bf24ac9ac0a53d67365b93", "score": "0.76830214", "text": "func Fatalf(format string, args ...interface{}) {\n\tstd.Fatalf(format, args...)\n}", "title": "" }, { "docid": "6037bc2e67bf24ac9ac0a53d67365b93", "score": "0.76830214", "text": "func Fatalf(format string, args ...interface{}) {\n\tstd.Fatalf(format, args...)\n}", "title": "" }, { "docid": "6cbb566d8c0b6277df4e1a96da4da81a", "score": "0.7676727", "text": "func (l *stdLogger) Fatalf(format string, args ...interface{}) {\n\tlog.Fatalf(format, args...)\n}", "title": "" }, { "docid": "908fa633ae456a7da92d081a8b663a91", "score": "0.767653", "text": "func Fatalf(format string, v ...interface{}) {\n\tinstance.Fatalf(format, v...)\n}", "title": "" }, { "docid": "ff2293d6ab35f17b0457d7237d8acb99", "score": "0.76717657", "text": "func Fatalf(format string, args ...interface{}) {\n\tpriLogger.Fatalf(format, args...)\n}", "title": "" }, { "docid": "e79166b41b53a3ffc669a303f1643724", "score": "0.76627225", "text": "func Fatalf(format string, v ...interface{}) {\n\tLogger.Fatalf(format+\"\\n\", v...)\n}", "title": "" }, { "docid": "9231ba50b5a13228127b2b96b2f41170", "score": "0.76445246", "text": "func Fatalf(msg string, args ...interface{}) {\n\tlog.Fatalf(msg, args...)\n}", "title": "" }, { "docid": "9d20f7713f68ea29baa27ba369e3299b", "score": "0.76336867", "text": "func Fatalf(template string, args ...interface{}) {\n\tlogger.Fatalf(template, args)\n}", "title": "" }, { "docid": "315cb0023b7bc739b058bb1ee75d31c3", "score": "0.7629397", "text": "func Fatalf(format string, v ...interface{}) {\n\trealFormat := makeFmt(\"ERROR\", format)\n\tlog.Fatalf(realFormat, v...)\n}", "title": "" }, { "docid": "6ad9e856e9bd56e4075702b6ceafbaa4", "score": "0.76230806", "text": "func (*nopLogger) Fatalf(string, ...interface{}) {}", "title": "" }, { "docid": "fe81ae06b8a6a55b03a329d7c0e0d184", "score": "0.7610167", "text": "func Fatalf(format string, a ...interface{}) {\n\tFatal(fmt.Sprintf(format, a...))\n}", "title": "" }, { "docid": "cba9d75a88b2366ab39d39d3de276fa0", "score": "0.7603154", "text": "func Fatalf(format string, args ...interface{}) {\n\tskipLogger().Errorf(format, args...)\n\tos.Exit(255)\n}", "title": "" }, { "docid": "6a372884432d1f7e4cb64c1fac8c6dad", "score": "0.7596556", "text": "func (z *NoopLogger) Fatalf(format string, args ...interface{}) {}", "title": "" }, { "docid": "2dc80f13c48b0aa99bda49d8bf6a05e6", "score": "0.75900704", "text": "func Fatalf(format string, args ...interface{}) {\n\t_logger.Errorf(format, args...)\n}", "title": "" }, { "docid": "582f5557359cba83e1716f21721d526b", "score": "0.7587912", "text": "func (td TestData) Fatalf(tb testing.TB, format string, args ...interface{}) {\n\ttb.Helper()\n\ttb.Fatalf(\"%s: %s\", td.Pos, fmt.Sprintf(format, args...))\n}", "title": "" }, { "docid": "573a48f89044b4947f04ce2f65ddffb4", "score": "0.7580359", "text": "func Fatalf(format string, args ...interface{}) {\n\tFatal(fmt.Sprintf(format, args...))\n}", "title": "" }, { "docid": "573a48f89044b4947f04ce2f65ddffb4", "score": "0.7580359", "text": "func Fatalf(format string, args ...interface{}) {\n\tFatal(fmt.Sprintf(format, args...))\n}", "title": "" }, { "docid": "573a48f89044b4947f04ce2f65ddffb4", "score": "0.7580359", "text": "func Fatalf(format string, args ...interface{}) {\n\tFatal(fmt.Sprintf(format, args...))\n}", "title": "" }, { "docid": "39482e8355a392ad760df6f3716d66b5", "score": "0.75639886", "text": "func Fatalf(format string, args ...interface{}) {\n\t//gglog.Fatalf(format, args)\n\tlogger.Fatalf(format, args)\n}", "title": "" }, { "docid": "07b4386296410bb8cbbfa91d54088bae", "score": "0.75634", "text": "func Fatalf(format string, args ...interface{}) {\n\tlogf(Fatal, format, args...)\n}", "title": "" }, { "docid": "40d61e7bade5651aac01d0aa329d0788", "score": "0.75629365", "text": "func Fatalf(source string, v ...interface{}) {\n\tif v != nil {\n\t\tErrorf(source, v...)\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "b607db08ebfc3299efeb5648d2124f99", "score": "0.75615877", "text": "func Fatalf(template string, args ...interface{}) {\n\tDefault().Fatalf(template, args...)\n}", "title": "" }, { "docid": "38b920c6b87f0244f5545fee7c902542", "score": "0.75585747", "text": "func (s *Server) Fatalf(format string, v ...interface{})", "title": "" }, { "docid": "4ef402bb0e8b92155226b4af74349b0e", "score": "0.75559694", "text": "func Fatalf(msg string, args ...interface{}) {\n\tstd.Fatalf(msg, args...)\n}", "title": "" }, { "docid": "b278ddc20fb31da624a9b198547cbeb6", "score": "0.75510013", "text": "func Fatalf(format string, args ...interface{}) {\n\tlogInstance.Fatalf(format, args...)\n}", "title": "" }, { "docid": "75efcd285b8a9d63906c8a87c55810f8", "score": "0.75482655", "text": "func Fatalf(format string, args ...interface{}) {\n\tLogrusEntry.Fatalf(format, args...)\n}", "title": "" }, { "docid": "e7ec4ddac9e0b58a09f1256a36ed4597", "score": "0.75463516", "text": "func Fatalf(format string, args ...interface{}) {\n\tglog.FatalDepth(1, fmt.Sprintf(format, args...))\n}", "title": "" }, { "docid": "7aa124dfb466bf2fcf959f7595d0352f", "score": "0.754534", "text": "func Fatalf(template string, args ...interface{}) {\n\ts.Fatalf(template, args...)\n}", "title": "" }, { "docid": "e8140bd6c0124f73d360a4eb5c443ed8", "score": "0.7503667", "text": "func (l *logger) Fatalf(format string, args ...interface{}) {\n\tl.sugar.Fatalf(format, args...)\n}", "title": "" }, { "docid": "75ab3632ff4e37bf63881107c2e14efa", "score": "0.7500466", "text": "func (z *ZapLogger) Fatalf(format string, args ...interface{}) {\n\tz.sugaredLogger.Fatalf(format, args...)\n}", "title": "" }, { "docid": "fb937c1fb6ec91fe72dc566af11bceaf", "score": "0.74964035", "text": "func Fatalf(format string, values ...interface{}) {\n\tif Quiet && len(logBuffer) > 0 {\n\t\tlog.Print(strings.Join(logBuffer, \"\\n\"))\n\t}\n\tlog.Fatalf(format, values...)\n}", "title": "" }, { "docid": "1453541077083a7e93bcc6c13a651f32", "score": "0.7496209", "text": "func (t *T) Fatalf(format string, args ...interface{}) {\n\tt.DispatchEvent(\"FAIL\")\n\tif t.useLogPkg {\n\t\tlog.Fatalf(format, args...)\n\t} else {\n\t\tt.origin.Fatalf(format, args...)\n\t}\n}", "title": "" }, { "docid": "43fc1b3cb97dc35cf32351cee7ef9814", "score": "0.7490917", "text": "func LogFatalf(format string, arg ...interface{}) {\n\ts := fmt.Sprintf(format, arg...)\n\tif pc, _, _, ok := runtime.Caller(1); ok {\n\t\ts = functionFromPc(pc) + \": \" + s\n\t}\n\tfmt.Print(s)\n\tlogFile.Print(s)\n\n\tCloseLogFiles()\n\tlog.Fatal(s)\n}", "title": "" }, { "docid": "9bf99e0a5e39a05ce010ec863f0a055c", "score": "0.7482096", "text": "func Fatalf(format string, a ...interface{}) {\n\tfatalWrapper(Printf(format, a...))\n}", "title": "" }, { "docid": "caad0c401bd5004c6fe9525a599fb13a", "score": "0.7477518", "text": "func (l *Logger) Fatalf(format string, args ...any) { l.logf(FatalLevel, format, args) }", "title": "" }, { "docid": "4863dc81baa945330f1e9203bcb9e780", "score": "0.7468241", "text": "func Fatalf(message string, args ...interface{}) {\n\tLogger.Fatalf(message, args...)\n}", "title": "" }, { "docid": "6f10e44b8dd8fd0fa27d11910db1b494", "score": "0.746746", "text": "func (bootstrap *Bootstrap) Fatalf(format string, v ...interface{}) {\n\tlogger.Fatalf(format, v...)\n}", "title": "" }, { "docid": "2b1594a0ded7d1fb4194bec43e5e9a9f", "score": "0.74660945", "text": "func Fatalf(msg string, args ...interface{}) {\n\tDefault.Fatalf(msg, args...)\n}", "title": "" }, { "docid": "f18718926f4cc7355dabf7f8bd550db7", "score": "0.7458619", "text": "func fatalf(calldepth int, format string, v ...interface{}) {\n\t_log(calldepth + 1, fmt.Sprintf(format, v...))\n\tos.Exit(1)\n}", "title": "" }, { "docid": "215bdc4b51d942619febcca09fc2677b", "score": "0.74565804", "text": "func Fatalf(format string, args ...interface{}) {\n\troot.Fatal(fmt.Sprintf(format, args...))\n}", "title": "" }, { "docid": "b98254d5267fbd06dd4a5f99975bf6ce", "score": "0.7455934", "text": "func (tb *TBMock) Fatalf(format string, args ...interface{}) {\n\ttb.FatalfMsg = fmt.Sprintf(format, args...)\n}", "title": "" }, { "docid": "58a3f0e2346ebfe34caeca8d9eef7515", "score": "0.7451771", "text": "func Fatalf(template string, args ...interface{}) {\n\tappLogger.Fatalf(template, args)\n}", "title": "" }, { "docid": "92785ee7e09d0b378246512515670d33", "score": "0.74404", "text": "func (manager LogManager) LogFatalf(format string, v ...interface{}) {\n\tif !manager.Enabled {\n\t\treturn\n\t}\n\n\tlog.Fatalf(format, v...)\n}", "title": "" }, { "docid": "7b9805d8891e20e446841b361b46f0de", "score": "0.7438639", "text": "func Fatalf(msg string, args ...interface{}) {\n\tlogrus.Fatalf(msg, args...)\n}", "title": "" }, { "docid": "8a5ab4487a7b86669515e3d671f9567e", "score": "0.74246943", "text": "func (l *Logger) Fatalf(msg string, args ...interface{}) {\n\tl.SugaredLogger.Fatalf(msg, args...)\n}", "title": "" }, { "docid": "31fd0ae49a95d899613cc792a94613d1", "score": "0.7404238", "text": "func (l *Logger) Fatalf(format string, args ...interface{}) {\n\tl.logger.Fatalf(format, args...)\n}", "title": "" }, { "docid": "214cdc14a862898ac73501b06017b4fa", "score": "0.7402764", "text": "func Fatalf(format string, args ...interface{}) {\n\tfileLineEntry().Fatalf(format, args...)\n}", "title": "" }, { "docid": "e0892250203f39e5cb53e7368db79d4d", "score": "0.7394098", "text": "func CtxFatalf(ctx context.Context, format string, v ...interface{}) {\n\tdefaultLogger.CtxFatalf(ctx, format, v)\n}", "title": "" }, { "docid": "613214116454670bdfe7296f048a1118", "score": "0.73937374", "text": "func Fatalf(format string, args ...interface{}) {\n\tnewEntry().Fatalf(format, args...)\n}", "title": "" }, { "docid": "b8712657b67b05cd083fb83e1d95d00f", "score": "0.7382378", "text": "func Fatalf(template string, args ...interface{}) {\n\tlogger.Fatal(fmt.Sprintf(template, args...))\n}", "title": "" }, { "docid": "c58a9bae349d32c73db87174148cafde", "score": "0.73751885", "text": "func Fatalf(format string, v ...interface{}) {\n\trootLogger.Log(2, CRITICAL, fmt.Sprintf(format, v...))\n\tos.Exit(1)\n}", "title": "" }, { "docid": "eca8c7dda36592ac38ad20d0737bcc53", "score": "0.73724645", "text": "func Fatalf(format string, args ...interface{}) {\n\tlogger.Fatalf(format, args...)\n\tgo sendTelegramMsg(\"FATAL, \" + fmt.Sprintf(format, args...))\n}", "title": "" }, { "docid": "e70ea92f2677c2a655d0bd29e5426584", "score": "0.7356058", "text": "func Fatalf(format string, args ...interface{}) {\n\tentry := logrus.NewEntry(LogError)\n\tSetCallFrame(entry, CallerSkip)\n\tentry.Fatalf(format, args...)\n}", "title": "" }, { "docid": "cce2668c3fd83754b2c03266310e995f", "score": "0.73459756", "text": "func (l *zapLogger) Fatalf(format string, args ...interface{}) {\n\tl.sugaredLogger.Fatalf(format, args...)\n}", "title": "" }, { "docid": "cce2668c3fd83754b2c03266310e995f", "score": "0.73459756", "text": "func (l *zapLogger) Fatalf(format string, args ...interface{}) {\n\tl.sugaredLogger.Fatalf(format, args...)\n}", "title": "" }, { "docid": "d638b15d4ea51efbbb45f14d6442c224", "score": "0.73191655", "text": "func (sl *SimpleLogger) Fatalf(format string, v ...interface{}) {\n\tsl.errorLogger.Fatalf(format, v...)\n}", "title": "" }, { "docid": "a2fb4c81da6d58f0fa8a947875ae2ac1", "score": "0.73167604", "text": "func Fatalf(format string, v ...interface{}) {\n\tlog.Fatal(LinePos(1), \": \", fmt.Sprintf(format, v...))\n}", "title": "" }, { "docid": "cfaeb42d7573ac121b4971c089d7e291", "score": "0.73121774", "text": "func Fatalf(format string, args ...interface{}) {\n\tqLogger.Fatalf(format, args...)\n}", "title": "" }, { "docid": "ac0f6c1f77ff1da56987f1a1f17cdf44", "score": "0.73048246", "text": "func (l *Log) Fatalf(format string, v ...interface{}) {\n\tfmt.Printf(format, v...)\n\tlog.Fatalf(format, v...)\n}", "title": "" }, { "docid": "07e230d27d7ef9b4607b18b412721199", "score": "0.73017484", "text": "func Fatalf(format string, args ...interface{}) {\n\tdef.logf(format, args...)\n\tdef.fatal()\n}", "title": "" }, { "docid": "ce831e074e77a0c1d6192fae28373274", "score": "0.7301198", "text": "func (t *MockT) Fatalf(msg string, args ...interface{}) {\n\tt.T.Logf(\"MockT Fatal called: \"+msg, args...)\n\tt.HasFailed = true\n}", "title": "" }, { "docid": "3188aa06426b12bb32e737b6fda24b47", "score": "0.7296773", "text": "func Fatalf(format string, v ...interface{}) {\n\tglobal.intLog(ERROR, fmt.Sprintf(format, v...))\n\tos.Exit(0)\n}", "title": "" }, { "docid": "1ed76d3c9797654287a91a2887e4e241", "score": "0.7289935", "text": "func fatalf(format string, params ...interface{}) {\n\tfmt.Fprintf(os.Stderr, os.Args[0]+\": \"+format+\"\\n\", params...)\n\tos.Exit(1)\n}", "title": "" }, { "docid": "ce9467cc2476cf5e3a044c70c483d2b0", "score": "0.7277533", "text": "func (sc *SyncContext) Fatalf(s string, v ...interface{}) {\n\tfmt.Printf(s, v...)\n}", "title": "" }, { "docid": "cea99adfa358a6954ce13aa2138d14a1", "score": "0.72722024", "text": "func Fatalf(format string, x ...interface{}) {\n\tFlog.Output(2, fmt.Sprintf(format, x...))\n\tos.Exit(1)\n}", "title": "" }, { "docid": "e956935319224cf7ad4e8d655d9dc0b3", "score": "0.7270276", "text": "func (l *ExtLog) Fatalf(format string, v ...interface{}) {\n\tl.Logger.Fatalf(format, v...)\n}", "title": "" }, { "docid": "81c6cc086373363e5698974b38c03aa5", "score": "0.72691166", "text": "func Fatalf(format string, args ...interface{}) {\n\tmoreInfo := retrieveCallInfo()\n\tlog.WithFields(log.Fields{\n\t\t\"filename\": moreInfo.fileName,\n\t\t\"package\": moreInfo.packageName,\n\t\t\"function\": moreInfo.funcName,\n\t\t\"line\": moreInfo.line,\n\t}).Fatalf(format, args...)\n}", "title": "" }, { "docid": "85ee699df8bb3c7c8535048bf30ce891", "score": "0.7267284", "text": "func Fatalf(format string, v ...interface{}) {\n\t_ = out.Output(2, Error, fmt.Sprintf(format, v...))\n\tos.Exit(1)\n}", "title": "" }, { "docid": "c72120b871dfe108762be6fb40a59386", "score": "0.7265816", "text": "func (l dummyLogger) Fatalf(message string, v ...interface{}) {\n}", "title": "" }, { "docid": "5ee820f98507ebabbec00be0cad2a1c7", "score": "0.7241345", "text": "func Fatalf(format string, v ...interface{}) {\n\tlogger.Printf(\"[FATAL] \"+format, v...)\n}", "title": "" }, { "docid": "d27f25227b9ae7e69ec2d557dee42036", "score": "0.7218675", "text": "func Fatalf(format string, a ...interface{}) {\n\tlogAtLevel(Fatal, format, a...)\n\tos.Exit(1)\n}", "title": "" }, { "docid": "4a5e7048233cbdd639d65db42ebcb066", "score": "0.7218461", "text": "func logAndFatalf(fmtString string, args ...interface{}) {\n\tlogAndPrintf(fmtString, args...)\n\texitWithCode(1)\n}", "title": "" }, { "docid": "a73913048e3cb43a01e1c454c8d97117", "score": "0.72126156", "text": "func Fatalf(format string, args ...interface{}) {\n\tmodule, mehtod, lineNum := getLogMetadata()\n\tfields := log.Fields{\n\t\tKEY_MODULE_NAME: module,\n\t\tKEY_FUNCTION_NAME: mehtod,\n\t\tKEY_LINE_NUM: lineNum,\n\t}\n\tlog.WithFields(fields).Fatalf(format, args...)\n}", "title": "" }, { "docid": "ab26a2bd821ac1eda70a5b6456509b3d", "score": "0.7210099", "text": "func Fatalf(format string, args ...interface{}) {\n\tfmt.Fprintf(os.Stderr, format, args...)\n\tos.Exit(1)\n}", "title": "" }, { "docid": "7351f986799b404fb3213a7e9f268dbb", "score": "0.7204149", "text": "func fatalf(format string, values ...interface{}) {\n\tfmt.Fprintf(os.Stderr, format, values...)\n\tos.Exit(1)\n}", "title": "" }, { "docid": "02f7b41cc4e54fca64679ebe3012dafa", "score": "0.7195743", "text": "func Fatalf(format string, args ...interface{}) {\n\tlogMutex.RLock()\n\tdefer logMutex.RUnlock()\n\tinfo := retrieveCallInfo().verboseFormat()\n\tmsg := fmt.Sprintf(format, args...)\n\n\tlogBackend.Fatal(info, msg)\n\tlogFatalExiter()\n}", "title": "" }, { "docid": "87d0287bfc30e8b7057ecff05b559ce7", "score": "0.7191546", "text": "func Fatalf(format string, args ...interface{}) {\n\t// _, fn, line, _ := runtime.Caller(1)\n\n\t// payload := fn + \":[\" + now + \"] \" + fn + \":\" + strconv.Itoa(line) + \": \" + getHostName() + \" : \" + fmt.Sprintf(format, args...)\n\t// log.Fatalf(format, payload)\n\tloc, _ := time.LoadLocation(\"Asia/Bangkok\")\n\tnow = time.Now().In(loc).Format(\"2006-01-02 15:04:05\")\n\tpc, fn, line, _ := runtime.Caller(1)\n\tfuc := runtime.FuncForPC(pc)\n\tproject := GetFillName(fuc.Name())\n\t// payload := fn + \":\" + strconv.Itoa(line) + \": \" + getHostName() + \" : \" + fmt.Sprint(args...)\n\t// log.Println(payload)\n\n\tlog.WithFields(logs.Fields{\"time\": now, \"Line\": fn + \":\" + strconv.Itoa(line), \"func\": project}).Fatalf(format, fmt.Sprint(args...))\n}", "title": "" } ]
5847d1833e55425a5f246009d05d296d
/ Creates a new manager that will manage the files used for block persistence. This manager manages the file system FS including the directory where the files are stored the individual files where the blocks are stored the blockfilesInfo which tracks the latest file being persisted to the index which tracks what block and transaction is in what file When a new blockfile manager is started (i.e. only on startup), it checks if this startup is the first time the system is coming up or is this a restart of the system. The blockfile manager stores blocks of data into a file system. That file storage is done by creating sequentially numbered files of a configured size i.e blockfile_000000, blockfile_000001, etc.. Each transaction in a block is stored with information about the number of bytes in that transaction Adding txLoc [fileSuffixNum=0, offset=3, bytesLength=104] for tx [1:0] to index Adding txLoc [fileSuffixNum=0, offset=107, bytesLength=104] for tx [1:1] to index Each block is stored with the total encoded length of that block as well as the tx location offsets. Remember that these steps are only done once at startup of the system. At start up a new manager: ) Checks if the directory for storing files exists, if not creates the dir ) Checks if the key value database exists, if not creates one (will create a db dir) ) Determines the blockfilesInfo used for storage Loads from db if exist, if not instantiate a new blockfilesInfo If blockfilesInfo was loaded from db, compares to FS If blockfilesInfo and file system are not in sync, syncs blockfilesInfo from FS ) Starts a new file writer truncates file per blockfilesInfo to remove any excess past last block ) Determines the index information used to find tx and blocks in the file blkstorage Instantiates a new blockIdxInfo Loads the index from the db if exists syncIndex comparing the last block indexed to what is in the FS If index and file system are not in sync, syncs index from the FS ) Updates blockchain info used by the APIs
[ { "docid": "096527ccbba606d9f3b163fbb554d112", "score": "0.7859977", "text": "func newBlockfileMgr(id string, conf *Conf, indexConfig *IndexConfig, indexStore *leveldbhelper.DBHandle) (*blockfileMgr, error) {\n\tlogger.Debugf(\"newBlockfileMgr() initializing file-based block storage for ledger: %s \", id)\n\trootDir := conf.getLedgerBlockDir(id)\n\t_, err := fileutil.CreateDirIfMissing(rootDir)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"Error creating block storage root dir [%s]: %s\", rootDir, err))\n\t}\n\tmgr := &blockfileMgr{rootDir: rootDir, conf: conf, db: indexStore, cache: newCache(defaultBlockCacheSizeBytes)}\n\n\tblockfilesInfo, err := mgr.loadBlkfilesInfo()\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"Could not get block file info for current block file from db: %s\", err))\n\t}\n\tif blockfilesInfo == nil {\n\t\tlogger.Info(`Getting block information from block storage`)\n\t\tif blockfilesInfo, err = constructBlockfilesInfo(rootDir); err != nil {\n\t\t\tpanic(fmt.Sprintf(\"Could not build blockfilesInfo info from block files: %s\", err))\n\t\t}\n\t\tlogger.Debugf(\"Info constructed by scanning the blocks dir = %s\", spew.Sdump(blockfilesInfo))\n\t} else {\n\t\tlogger.Debug(`Synching block information from block storage (if needed)`)\n\t\tsyncBlockfilesInfoFromFS(rootDir, blockfilesInfo)\n\t}\n\terr = mgr.saveBlkfilesInfo(blockfilesInfo, true)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"Could not save next block file info to db: %s\", err))\n\t}\n\n\tcurrentFileWriter, err := newBlockfileWriter(deriveBlockfilePath(rootDir, blockfilesInfo.latestFileNumber))\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"Could not open writer to current file: %s\", err))\n\t}\n\terr = currentFileWriter.truncateFile(blockfilesInfo.latestFileSize)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"Could not truncate current file to known size in db: %s\", err))\n\t}\n\tif mgr.index, err = newBlockIndex(indexConfig, indexStore); err != nil {\n\t\tpanic(fmt.Sprintf(\"error in block index: %s\", err))\n\t}\n\n\tmgr.blockfilesInfo = blockfilesInfo\n\tbsi, err := loadBootstrappingSnapshotInfo(rootDir)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmgr.bootstrappingSnapshotInfo = bsi\n\tmgr.currentFileWriter = currentFileWriter\n\tmgr.blkfilesInfoCond = sync.NewCond(&sync.Mutex{})\n\n\tif err := mgr.syncIndex(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tbcInfo := &common.BlockchainInfo{}\n\n\tif mgr.bootstrappingSnapshotInfo != nil {\n\t\tbcInfo.Height = mgr.bootstrappingSnapshotInfo.LastBlockNum + 1\n\t\tbcInfo.CurrentBlockHash = mgr.bootstrappingSnapshotInfo.LastBlockHash\n\t\tbcInfo.PreviousBlockHash = mgr.bootstrappingSnapshotInfo.PreviousBlockHash\n\t\tbcInfo.BootstrappingSnapshotInfo = &common.BootstrappingSnapshotInfo{}\n\t\tbcInfo.BootstrappingSnapshotInfo.LastBlockInSnapshot = mgr.bootstrappingSnapshotInfo.LastBlockNum\n\t}\n\n\tif !blockfilesInfo.noBlockFiles {\n\t\tlastBlockHeader, err := mgr.retrieveBlockHeaderByNumber(blockfilesInfo.lastPersistedBlock)\n\t\tif err != nil {\n\t\t\tpanic(fmt.Sprintf(\"Could not retrieve header of the last block form file: %s\", err))\n\t\t}\n\t\t// update bcInfo with lastPersistedBlock\n\t\tbcInfo.Height = blockfilesInfo.lastPersistedBlock + 1\n\t\tbcInfo.CurrentBlockHash = protoutil.BlockHeaderHash(lastBlockHeader)\n\t\tbcInfo.PreviousBlockHash = lastBlockHeader.PreviousHash\n\t}\n\tmgr.bcInfo.Store(bcInfo)\n\treturn mgr, nil\n}", "title": "" } ]
[ { "docid": "2142c6fa1458f90f2ff624fb8b1c7def", "score": "0.5993251", "text": "func newContractManager(dependencies modules.Dependencies, persistDir string) (*ContractManager, error) {\n\tcm := &ContractManager{\n\t\tstorageFolders: make(map[uint16]*storageFolder),\n\t\tsectorLocations: make(map[sectorID]sectorLocation),\n\n\t\tlockedSectors: make(map[sectorID]*sectorLock),\n\n\t\tdependencies: dependencies,\n\t\tpersistDir: persistDir,\n\t}\n\tcm.wal.cm = cm\n\tcm.tg.AfterStop(func() {\n\t\tdependencies.Destruct()\n\t})\n\n\t// Perform clean shutdown of already-initialized features if startup fails.\n\tvar err error\n\tdefer func() {\n\t\tif err != nil {\n\t\t\terr1 := build.ExtendErr(\"error during contract manager startup\", err)\n\t\t\terr2 := build.ExtendErr(\"error while stopping a partially started contract manager\", cm.tg.Stop())\n\t\t\terr = build.ComposeErrors(err1, err2)\n\t\t}\n\t}()\n\n\t// Create the perist directory if it does not yet exist.\n\terr = dependencies.MkdirAll(cm.persistDir, 0700)\n\tif err != nil {\n\t\treturn nil, build.ExtendErr(\"error while creating the persist directory for the contract manager\", err)\n\t}\n\n\t// Logger is always the first thing initialized.\n\tcm.log, err = dependencies.NewLogger(filepath.Join(cm.persistDir, logFile))\n\tif err != nil {\n\t\treturn nil, build.ExtendErr(\"error while creating the logger for the contract manager\", err)\n\t}\n\t// Set up the clean shutdown of the logger.\n\tcm.tg.AfterStop(func() {\n\t\terr = build.ComposeErrors(cm.log.Close(), err)\n\t})\n\n\t// Load the atomic state of the contract manager. Unclean shutdown may have\n\t// wiped out some changes that got made. Anything really important will be\n\t// recovered when the WAL is loaded.\n\terr = cm.loadSettings()\n\tif err != nil {\n\t\tcm.log.Println(\"ERROR: Unable to load contract manager settings:\", err)\n\t\treturn nil, build.ExtendErr(\"error while loading contract manager atomic data\", err)\n\t}\n\n\t// Load the WAL, repairing any corruption caused by unclean shutdown.\n\terr = cm.wal.load()\n\tif err != nil {\n\t\tcm.log.Println(\"ERROR: Unable to load the contract manager write-ahead-log:\", err)\n\t\treturn nil, build.ExtendErr(\"error while loading the WAL at startup\", err)\n\t}\n\t// Upon shudown, unload all of the files.\n\tcm.tg.AfterStop(func() {\n\t\tcm.wal.mu.Lock()\n\t\tdefer cm.wal.mu.Unlock()\n\n\t\tfor _, sf := range cm.storageFolders {\n\t\t\t// No storage folder to close if the folder is not available.\n\t\t\tif atomic.LoadUint64(&sf.atomicUnavailable) == 1 {\n\t\t\t\t// File handles will either already be closed or may even be\n\t\t\t\t// nil.\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\terr = sf.metadataFile.Close()\n\t\t\tif err != nil {\n\t\t\t\tcm.log.Println(\"Error closing the storage folder file handle\", err)\n\t\t\t}\n\t\t\terr = sf.sectorFile.Close()\n\t\t\tif err != nil {\n\t\t\t\tcm.log.Println(\"Error closing the storage folder file handle\", err)\n\t\t\t}\n\t\t}\n\t})\n\n\t// The sector location data is loaded last. Any corruption that happened\n\t// during unclean shutdown has already been fixed by the WAL.\n\tfor _, sf := range cm.storageFolders {\n\t\tif atomic.LoadUint64(&sf.atomicUnavailable) == 1 {\n\t\t\t// Metadata unavailable, just count the number of sectors instead of\n\t\t\t// loading them.\n\t\t\tsf.sectors = uint64(len(usageSectors(sf.usage)))\n\t\t\tcontinue\n\t\t}\n\t\tcm.loadSectorLocations(sf)\n\t}\n\n\t// Launch the sync loop that periodically flushes changes from the WAL to\n\t// disk.\n\terr = cm.wal.spawnSyncLoop()\n\tif err != nil {\n\t\tcm.log.Println(\"ERROR: Unable to spawn the contract manager synchronization loop:\", err)\n\t\treturn nil, build.ExtendErr(\"error while spawning contract manager sync loop\", err)\n\t}\n\n\t// Spin up the thread that continuously looks for missing storage folders\n\t// and adds them if they are discovered.\n\tgo cm.threadedFolderRecheck()\n\n\t// Simulate an error to make sure the cleanup code is triggered correctly.\n\tif cm.dependencies.Disrupt(\"erroredStartup\") {\n\t\terr = errors.New(\"startup disrupted\")\n\t\treturn nil, err\n\t}\n\treturn cm, nil\n}", "title": "" }, { "docid": "a3037526c8545256ab7ddaa821adb3ea", "score": "0.59177685", "text": "func NewFSManager() FSManager {\n\treturn newFSManager(blocksFilePath)\n}", "title": "" }, { "docid": "fb264934aa3ff8f7568b79fda6d95883", "score": "0.59156007", "text": "func NewManager(db database.Transactor, enabledIndexes []blockchain.Indexer) *Manager {\n\treturn &Manager{\n\t\tdb: db,\n\t\tenabledIndexes: enabledIndexes,\n\t}\n}", "title": "" }, { "docid": "c96c65b7d5a539c5aa2c98efaa3b1a6f", "score": "0.5872743", "text": "func newManager(t *testing.T, db *sql.DB) *Manager {\n\tm := &Manager{}\n\ttx, err := db.Begin()\n\trequire.NoError(t, err)\n\tdefer tx.Commit()\n\n\terr = Up0000002(tx)\n\trequire.NoError(t, err)\n\n\treturn m\n}", "title": "" }, { "docid": "125eb2ca3bbf7ec120f4103efcda786c", "score": "0.5845762", "text": "func newManager(t *testing.T, privKeys []string, bs *waddrmgr.BlockStamp) *waddrmgr.Manager {\n\tdbPath := filepath.Join(os.TempDir(), \"wallet.bin\")\n\tos.Remove(dbPath)\n\tdb, err := walletdb.Create(\"bdb\", dbPath)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tnamespace, err := db.Namespace(waddrmgrNamespaceKey)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tseed, err := hdkeychain.GenerateSeed(hdkeychain.RecommendedSeedLen)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tpubPassphrase := []byte(\"pub\")\n\tprivPassphrase := []byte(\"priv\")\n\tmgr, err := waddrmgr.Create(namespace, seed, pubPassphrase,\n\t\tprivPassphrase, &chaincfg.TestNet3Params, fastScrypt)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tfor _, key := range privKeys {\n\t\twif, err := btcutil.DecodeWIF(key)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\tif err = mgr.Unlock(privPassphrase); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\t_, err = mgr.ImportPrivateKey(wif, bs)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t}\n\treturn mgr\n}", "title": "" }, { "docid": "90aea209b82e2138e6182cac977c5fc6", "score": "0.58248794", "text": "func CreateManager(dataStore string) (manager Manager, err error) {\n\tmanager.dataStore = dataStore\n\tmanager.coverage = make(map[string]bool)\n\tmanager.files = make(map[string]File)\n\n\t// Get a list of files\n\tfiles, err := ioutil.ReadDir(dataStore)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// Add each file to the coverage map\n\tfor _, file := range files {\n\t\tfilename := file.Name()\n\t\tif len(filename) < 7 {\n\t\t\tfmt.Printf(\"[SRTM-Manager] File '%s' is not named correctly, skipping...\\n\", filename)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Check if the filename is correct\n\t\t_, _, err = FilenameToCoordinates(filename[:7])\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"[SRTM-Manager] File '%s' is not named correctly, skipping...\\n\", filename)\n\t\t\tcontinue\n\t\t}\n\n\t\tmanager.coverage[filename[:7]] = true\n\t}\n\n\treturn manager, nil\n}", "title": "" }, { "docid": "5749c0117eb425d5b064b5aa036e43b3", "score": "0.58029675", "text": "func New(cfg *core.Core, logger *zap.Logger) (*Manager, error) {\n\tm := &Manager{\n\t\tstorages: map[string]coreStorage.CoreStorage{},\n\t\tlogger: logger,\n\t}\n\n\tm.storages[\"memory\"] = memory.New()\n\n\tif cfg == nil {\n\t\treturn m, nil\n\t}\n\n\tfor _, c := range cfg.Sqlite {\n\t\ts, err := sql.New(\"sqlite.\"+c.Name, \"sqlite3\", c.Path, c.TableAlerts, c.TableKV, time.Millisecond*time.Duration(c.Timeout), logger)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error create file storage, %w\", err)\n\t\t}\n\n\t\tm.storages[s.Name()] = s\n\t}\n\n\tfor _, c := range cfg.Postgres {\n\t\tconnectionString := fmt.Sprintf(\"postgres://%s:%s@%s:%d/%s?sslmode=%s&sslrootcert=%s\",\n\t\t\tc.Username,\n\t\t\tc.Password,\n\t\t\tc.Host,\n\t\t\tc.Port,\n\t\t\tc.Database,\n\t\t\tc.SSLMode,\n\t\t\tc.SSLCertPath,\n\t\t)\n\n\t\ts, err := sql.New(\n\t\t\t\"postgres.\"+c.Name,\n\t\t\t\"postgres\",\n\t\t\tconnectionString,\n\t\t\tc.TableAlerts,\n\t\t\tc.TableKV,\n\t\t\ttime.Millisecond*time.Duration(c.Timeout),\n\t\t\tlogger,\n\t\t)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error create postgres storage, %w\", err)\n\t\t}\n\n\t\tm.storages[s.Name()] = s\n\t}\n\n\treturn m, nil\n}", "title": "" }, { "docid": "44da80be621e0ba1746eda8cf6e92897", "score": "0.5783093", "text": "func newCDBBlockStore(blockStore *couchdb.CouchDatabase, txnStore *couchdb.CouchDatabase, ledgerID string, opts ...option) *cdbBlockStore {\n\tcp := newCheckpoint(blockStore)\n\n\tstore := newStore(ledgerID, blockStore, txnStore)\n\n\tcdbBlockStore := &cdbBlockStore{\n\t\tledgerID: ledgerID,\n\t\tstore: store,\n\t\tcp: cp,\n\t}\n\n\t// cp = checkpointInfo, retrieve from the database the last block number that was written to that db.\n\tcpInfo := cdbBlockStore.cp.getCheckpointInfo()\n\terr := cdbBlockStore.cp.saveCurrentInfo(cpInfo)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"Could not save cpInfo info to db: %s\", err))\n\t}\n\n\t// Update the manager with the checkpoint info and the file writer\n\tcdbBlockStore.cpInfo = cpInfo\n\n\t// Create a checkpoint condition (event) variable, for the goroutine waiting for\n\t// or announcing the occurrence of an event.\n\tcdbBlockStore.cpInfoCond = sync.NewCond(&sync.Mutex{})\n\n\tvar bcInfo *common.BlockchainInfo\n\n\tif cpInfo.isChainEmpty {\n\t\tbcInfo = &common.BlockchainInfo{}\n\t} else {\n\t\tlogger.Debugf(\"[%s] Loading block %d from database\", ledgerID, cpInfo.lastBlockNumber)\n\n\t\t//If start up is a restart of an existing storage, update BlockchainInfo for external API's\n\t\tlastBlock, err := store.RetrieveBlockByNumber(cpInfo.lastBlockNumber)\n\t\tif err != nil {\n\t\t\tpanic(fmt.Sprintf(\"Could not load block %d from database: %s\", cpInfo.lastBlockNumber, err))\n\t\t}\n\n\t\tlastBlockHeader := lastBlock.GetHeader()\n\n\t\tbcInfo = &common.BlockchainInfo{\n\t\t\tHeight: lastBlockHeader.GetNumber() + 1,\n\t\t\tCurrentBlockHash: protoutil.BlockHeaderHash(lastBlockHeader),\n\t\t\tPreviousBlockHash: lastBlockHeader.GetPreviousHash(),\n\t\t}\n\t}\n\n\tcdbBlockStore.cache = newCache(ledgerID, store, bcInfo, resolveOptions(opts))\n\n\treturn cdbBlockStore\n}", "title": "" }, { "docid": "d77639d112387d7f35dc9c7acd4802fc", "score": "0.576454", "text": "func New(directory string, metricsProvider metrics.Provider) (blockledger.Factory, error) {\n\tp, err := blkstorage.NewProvider(\n\t\tblkstorage.NewConf(directory, -1),\n\t\t&blkstorage.IndexConfig{\n\t\t\tAttrsToIndex: []blkstorage.IndexableAttr{blkstorage.IndexableAttrBlockNum}},\n\t\tmetricsProvider,\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &fileLedgerFactory{\n\t\tblkstorageProvider: p,\n\t\tledgers: make(map[string]blockledger.ReadWriter),\n\t}, nil\n}", "title": "" }, { "docid": "15b8f88566233e59123b4bb0d31afedc", "score": "0.5746309", "text": "func NewManager(context *common.Context, workItemID, objOrFileID int64, itemType, requestedBy, instApprover, aptrustApprover string) *Manager {\n\treturn &Manager{\n\t\tContext: context,\n\t\tObjOrFileID: objOrFileID,\n\t\tItemType: itemType,\n\t\tWorkItemID: workItemID,\n\t\tRequestedBy: requestedBy,\n\t\tInstApprover: instApprover,\n\t\tAPTrustApprover: aptrustApprover,\n\t\titemIdentifier: fmt.Sprintf(\"%s:%d\", itemType, objOrFileID),\n\t}\n}", "title": "" }, { "docid": "3d6414c0743f0c07fbdfb36cc1356eaa", "score": "0.57377934", "text": "func NewTileManager(mbtilePath []string, useCache bool) *TileManager {\n\n\ttm := TileManager{}\n\tutils.GetLogging().Info(\"Initializing tile manager...\")\n\ttm.Metadatas = make([]DBMetadata, 0)\n\t//initialize cache....100mb by default\n\tconfig := bigcache.Config{Shards: 1024, Verbose: false, HardMaxCacheSize: utils.GetSettings().GetCacheSizeMB() * 1000}\n\tcache, initErr := bigcache.NewBigCache(config)\n\ttm.cache = cache\n\n\tif initErr != nil {\n\t\tutils.GetLogging().Error(\"Error creating cache!\")\n\t}\n\tutils.GetLogging().Debug(\"Cache initialized\")\n\n\tfor _, connStr := range mbtilePath {\n\n\t\tfi, err := os.Stat(connStr)\n\t\tif err != nil {\n\t\t\tutils.GetLogging().Error(\"Database %v does not exist...exiting\", connStr)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Open database file\n\t\tdb, err := sql.Open(\"sqlite3\", connStr)\n\t\tif err != nil {\n\t\t\tutils.GetLogging().Error(\"Error opening database!\")\n\t\t\tcontinue\n\t\t}\n\t\t//initialize database info\n\t\tdbMetadata := DBMetadata{}\n\t\t_, dbMetadata.Id = filepath.Split(connStr)\n\t\tdbMetadata.Fields = make(map[string]string)\n\t\tdbMetadata.Conn = db\n\n\t\t//load metadata\n\t\tmetadataRows, err := db.Query(\"Select name, value FROM metadata\")\n\t\tfor metadataRows.Next() {\n\t\t\tvar name string\n\t\t\tvar val string\n\t\t\tmetadataRows.Scan(&name, &val)\n\t\t\tif name == \"json\" {\n\t\t\t\tjson.Unmarshal(bytes.NewBufferString(val).Bytes(), &dbMetadata.LayerInfo)\n\t\t\t} else {\n\t\t\t\tdbMetadata.Fields[name] = val\n\t\t\t}\n\n\t\t\tutils.GetLogging().Warn(\"key %v val: %v\", name, val)\n\n\t\t}\n\n\t\t//see if we can fit the whole thing...\n\t\tif fi.Size() < int64(utils.GetSettings().GetCacheSizeMB())*1000000 {\n\t\t\tutils.GetLogging().Info(\"Database %v is %v MB....going to try to fit it into RAM\", connStr, fi.Size()/1000000)\n\n\t\t\tfor i := 0; i < 15; i++ {\n\t\t\t\tloadTileLevelIntoCache(i, db, cache)\n\t\t\t}\n\t\t} else {\n\t\t\tutils.GetLogging().Info(\"Database %v is %v MB - too big to cache\", connStr, fi.Size()/1000000)\n\t\t}\n\n\t\tvar count int\n\t\trows := db.QueryRow(\"SELECT COUNT(*) as count from tiles\")\n\t\trows.Scan(&count)\n\t\tutils.GetLogging().Info(\"Found %v tiles in db\", count)\n\n\t\t////prepare statement\n\t\tprepStmt, _ := db.Prepare(\"SELECT tile_data as tile FROM tiles where zoom_level=? AND tile_column=? AND tile_row=?\")\n\t\tdbMetadata.Prep = prepStmt\n\t\ttm.Metadatas = append(tm.Metadatas, dbMetadata)\n\n\t}\n\treturn &tm\n\n}", "title": "" }, { "docid": "f9817453850ec12f00951f98813f9a0b", "score": "0.5715195", "text": "func NewManager(config *ManagerConfig) *Manager {\n\tif config.Net == nil {\n\t\tconfig.Net = vnet.NewNet(nil) // defaults to native operation\n\t}\n\treturn &Manager{\n\t\tlog: config.LeveledLogger,\n\t\tnet: config.Net,\n\t\tallocations: make(map[string]*Allocation, 64),\n\t\textIPMap: make(map[string]net.IP),\n\t}\n}", "title": "" }, { "docid": "9f8ddded2d8e3cddc195e1005e0cc8a0", "score": "0.56862044", "text": "func NewManager() *Manager {\n\treturn &Manager{\n\t\t// defName: driverName,\n\t\tdrivers: make(map[string]Cache, 8),\n\t}\n}", "title": "" }, { "docid": "d3c481575a146cb983d98eab8665750d", "score": "0.56616235", "text": "func NewManager(imagesDir, volumesDir string, dockerLogDriver string, dockerLogConfig map[string]string) *Manager {\n\tloadvolumes()\n\n\tmanager := &Manager{\n\t\timagesDir: imagesDir,\n\t\tvolumesDir: volumesDir,\n\t\trequests: make(chan managerRequest),\n\t\tservices: make(map[string]*IService),\n\t\tstartGroups: make(map[int][]string),\n\t\tdockerLogDriver: dockerLogDriver,\n\t\tdockerLogConfig: dockerLogConfig,\n\t}\n\tgo manager.loop()\n\treturn manager\n}", "title": "" }, { "docid": "242a8bc2e4a959ab38759e17958d487f", "score": "0.5633452", "text": "func NewManager() *Manager {\n\treturn &Manager{\n\t\tlocks: locks{},\n\t}\n}", "title": "" }, { "docid": "35169a9ac96b562487841be932684281", "score": "0.5628966", "text": "func NewManager(fileName string) (ConfigManager, error) {\n\tw := &configManager{}\n\terr := w.writeInit(fileName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn w, nil\n}", "title": "" }, { "docid": "7130df40362918c44e6d827029e9b1f8", "score": "0.5625893", "text": "func NewManager(ctx context.Context, st blob.Storage, f *FormattingOptions, caching CachingOptions, repositoryFormatBytes []byte) (*Manager, error) {\n\treturn newManagerWithOptions(ctx, st, f, caching, time.Now, repositoryFormatBytes)\n}", "title": "" }, { "docid": "cd875d35c1cbea40d923c11f81f6c929", "score": "0.56016165", "text": "func newManager(kv kvdb.Kvdb) (*configManager, error) {\n\tmanager := new(configManager)\n\n\tmanager.cbCluster = make(map[string]CallbackClusterConfigFunc)\n\tmanager.cbNode = make(map[string]CallbackNodeConfigFunc)\n\n\t// kvdb pointer\n\tmanager.kv = kv\n\n\t// register function with kvdb to watch cluster level changes\n\tif err := kv.WatchTree(filepath.Join(baseKey, clusterKey), 0,\n\t\t&dataToKvdb{Type: clusterWatcher}, manager.kvdbCallback); err != nil {\n\t\tlogrus.Error(err)\n\t\treturn nil, err\n\t}\n\tif err := kv.WatchTree(filepath.Join(baseKey, nodeKey), 0,\n\t\t&dataToKvdb{Type: nodeWatcher}, manager.kvdbCallback); err != nil {\n\t\tlogrus.Error(err)\n\t\treturn nil, err\n\t}\n\n\treturn manager, nil\n}", "title": "" }, { "docid": "9119830172cd1903f3fafb30bdb2b2c9", "score": "0.5593314", "text": "func New(config *Config) (*SyncManager, error) {\n\tsm := SyncManager{\n\t\tpeerNotifier: config.PeerNotifier,\n\t\tchain: config.Chain,\n\t\ttxMemPool: config.TxMemPool,\n\t\tchainParams: config.ChainParams,\n\t\trejectedTxns: make(map[chainhash.Hash]struct{}),\n\t\trequestedTxns: make(map[chainhash.Hash]struct{}),\n\t\trequestedBlocks: make(map[chainhash.Hash]struct{}),\n\t\tpeerStates: make(map[*peerpkg.Peer]*peerSyncState),\n\t\tprogressLogger: newBlockProgressLogger(\"Processed\", log),\n\t\tmsgChan: make(chan interface{}, config.MaxPeers*3),\n\t\theaderList: list.New(),\n\t\tquit: make(chan struct{}),\n\t\tfeeEstimator: config.FeeEstimator,\n\t}\n\n\tbest := sm.chain.BestSnapshot()\n\tif !config.DisableCheckpoints {\n\t\t// Initialize the next checkpoint based on the current height.\n\t\tsm.nextCheckpoint = sm.findNextHeaderCheckpoint(best.Height)\n\t\tif sm.nextCheckpoint != nil {\n\t\t\tsm.resetHeaderState(&best.Hash, best.Height)\n\t\t}\n\t} else {\n\t\tlog.Info(\"Checkpoints are disabled\")\n\t}\n\n\tsm.chain.Subscribe(sm.handleBlockchainNotification)\n\n\treturn &sm, nil\n}", "title": "" }, { "docid": "7b931b90f5d5dc33d4ee291648b0c213", "score": "0.55914646", "text": "func NewManager(l log.Logger, e *common.Etcd, c *cluster.Cluster) *Manager {\n\thm := &Manager{\n\t\tlogger: l,\n\t\trqt: &common.Registry{Items: make(map[string]common.Worker)},\n\t\tstop: make(chan struct{}),\n\t\tetcdcli: e,\n\t\tncin: make(map[string]chan map[string]string),\n\t\tncout: make(map[string]chan map[string]string),\n\t\tcluster: c,\n\t}\n\texporter.ReportNumberOfHealers(cluster.GetID(), 0)\n\thm.load()\n\thm.state = model.StateActive\n\treturn hm\n}", "title": "" }, { "docid": "f22ce0a305f5ac2f421d3d86fc32872d", "score": "0.5588864", "text": "func NewManager(ctx *ManagerContext) *Manager {\n\tif err := ValidateManagerContext(ctx); err != nil {\n\t\tlog.Fatalf(\"tx manager context is invalid: %v\", err)\n\t}\n\ttm := &Manager{\n\t\tnetworkID: ctx.NetworkID,\n\t\tdatabase: ctx.Database,\n\t\tbucket: \"TXSTATUS\",\n\t\ttxBucket: \"TX\",\n\t\tseed: ctx.Seed,\n\t\tbaseReserve: ctx.BaseReserve,\n\t\tam: ctx.AM,\n\t\tpm: ctx.PM,\n\t\tem: ctx.EM,\n\t\ttxSet: mapset.NewSet(),\n\t\taccTxMap: make(map[string]*TxHistory),\n\t\ttxChan: make(chan *ultpb.Tx),\n\t\tstopChan: make(chan struct{}),\n\t}\n\terr := tm.database.NewBucket(tm.bucket)\n\tif err != nil {\n\t\tlog.Fatalf(\"create tx status bucket failed: %v\", err)\n\t}\n\terr = tm.database.NewBucket(tm.txBucket)\n\tif err != nil {\n\t\tlog.Fatalf(\"create tx bucket failed: %v\", err)\n\t}\n\tcache, err := lru.New(100)\n\tif err != nil {\n\t\tlog.Fatalf(\"create tx status LRU cache failed: %v\", err)\n\t}\n\ttm.txStatus = cache\n\treturn tm\n}", "title": "" }, { "docid": "7742059598d324cb905982190f7751a5", "score": "0.5551646", "text": "func NewManager() (*Manager, error) {\n\treturn &Manager{\n\t\tsuperProgress: newStateSyncMap(),\n\t\tclientProgress: newStateSyncMap(),\n\t\tpeerProgress: newStateSyncMap(),\n\t\tpieceProgress: newStateSyncMap(),\n\t\tclientBlackInfo: cutil.NewSyncMap(),\n\t}, nil\n}", "title": "" }, { "docid": "6c1c8ccea29f2c4c5fe1658c95c9a815", "score": "0.5533334", "text": "func NewBlockSyncMgr(server p2pserprotocol.SyncP2PSer) *BlockSyncMgr {\n\treturn &BlockSyncMgr{\n\t\tflightBlocks: make(map[common.Hash][]*SyncFlightInfo, 0),\n\t\tflightHeaders: make(map[uint64]*SyncFlightInfo, 0),\n\t\tblocksCache: make(map[uint64]*BlockInfo, 0),\n\t\tserver: server,\n\t\tledger: server.GetLedger(),\n\t\tradar: mainchain.GetLeagueConsumersInstance(),\n\t\texitCh: make(chan interface{}, 1),\n\t\tnodeWeights: make(map[uint64]*NodeWeight, 0),\n\t}\n}", "title": "" }, { "docid": "1aa9924f34febb37ae789f9d3d47c419", "score": "0.5531123", "text": "func NewManager(rootPath string) (*ConfigMapManager, error) {\n\tmanager := new(ConfigMapManager)\n\n\tif !filepath.IsAbs(rootPath) {\n\t\treturn nil, fmt.Errorf(\"path must be absolute: %s: %w\", rootPath, errInvalidPath)\n\t}\n\t// the lockfile functions require that the rootPath dir is executable\n\tif err := os.MkdirAll(rootPath, 0o700); err != nil {\n\t\treturn nil, err\n\t}\n\n\tlock, err := lockfile.GetLockFile(filepath.Join(rootPath, \"configMaps.lock\"))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmanager.lockfile = lock\n\tmanager.configMapDBPath = filepath.Join(rootPath, configMapsFile)\n\tmanager.db = new(db)\n\tmanager.db.ConfigMaps = make(map[string]ConfigMap)\n\tmanager.db.NameToID = make(map[string]string)\n\tmanager.db.IDToName = make(map[string]string)\n\treturn manager, nil\n}", "title": "" }, { "docid": "c705d04fcf4b889a694dc5b21fb3df91", "score": "0.5508319", "text": "func NewManager(lbName, binPath, cfgPath, generatePath, backupPath, templatePath string, statusFetchPeriod int) conf.Manager {\n\tmanager := &Manager{\n\t\tLoadbalanceName: lbName,\n\t\thaproxyBin: binPath,\n\t\tcfgFile: cfgPath,\n\t\ttmpDir: generatePath,\n\t\tbackupDir: backupPath,\n\t\ttemplateFile: filepath.Join(templatePath, \"haproxy.cfg.template\"),\n\t\tstatusFetchPeriod: statusFetchPeriod,\n\t\tstopCh: make(chan struct{}),\n\t\thealthInfo: metric.HealthMeta{\n\t\t\tIsHealthy: conf.HealthStatusOK,\n\t\t\tMessage: conf.HealthStatusOKMsg,\n\t\t\tCurrentRole: metric.SlaveRole,\n\t\t},\n\t}\n\tmanager.initMetric()\n\treturn manager\n}", "title": "" }, { "docid": "2023dd754dd18f97137bcde03d27b5d3", "score": "0.54989856", "text": "func newManager(options Options) *manager {\n\treturn &manager{\n\t\tclose: make(chan bool),\n\t\tclient: options.Client,\n\t\tnow: time.Now,\n\t\tsyncRate: defaultSyncRate,\n\t\tbuckets: map[string]*bucket{},\n\t\tbucketToSyncQueue: make(chan *bucket, syncQueueSize),\n\t\tbaseURL: options.BaseURL,\n\t\tnumSyncWorkers: defaultNumSyncWorkers,\n\t\tdupCache: ResultCache{size: resultCacheBufferSize},\n\t\tbucketsSyncing: map[*bucket]struct{}{},\n\t\torg: options.Org,\n\t}\n}", "title": "" }, { "docid": "2290dc057d6dce4b65d978f664c61018", "score": "0.54970014", "text": "func New(nodeID, clusterID, storeType, runnerAddr string, adminMan AdminSyncmanInterface, integrationMan integrationInterface, ssl *config.SSL) (*Manager, error) {\n\n\t// Create a new manager instance\n\tm := &Manager{nodeID: nodeID, clusterID: clusterID, storeType: storeType, runnerAddr: runnerAddr, adminMan: adminMan, integrationMan: integrationMan}\n\n\t// Initialise the consul client if enabled\n\tvar s Store\n\tvar err error\n\tswitch storeType {\n\tcase \"local\":\n\t\ts, err = NewLocalStore(nodeID, ssl)\n\tcase \"kube\":\n\t\ts, err = NewKubeStore(clusterID)\n\tdefault:\n\t\treturn nil, helpers.Logger.LogError(helpers.GetRequestID(context.TODO()), fmt.Sprintf(\"Cannot initialize syncaman as invalid store type (%v) provided\", storeType), nil, nil)\n\t}\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tm.store = s\n\tm.store.Register()\n\n\tpubsubClient, err := pubsub.New(\"license-manager\", os.Getenv(\"REDIS_CONN\"))\n\tif err != nil {\n\t\treturn nil, helpers.Logger.LogError(\"syncman-new\", \"Unable to initialize pub sub client required for sync module, ensure that redis database is running\", err, nil)\n\t}\n\tm.pubsubClient = pubsubClient\n\tm.leader = leader.New(nodeID, pubsubClient)\n\n\treturn m, nil\n}", "title": "" }, { "docid": "e7e6591a6d9f6748b1da0528a84c59b1", "score": "0.5489598", "text": "func NewManager(db *db.DB) (*Manager, error) {\n\tmgr := &Manager{\n\t\tdb: db,\n\t\tsesslist: map[string]*otInfo{},\n\t\tclientReq: make(chan otClientRequest),\n\t\tserverReq: make(chan otServerRequest),\n\t\ttimeout: make(chan string),\n\t\tstop: make(chan string),\n\t}\n\treturn mgr, nil\n}", "title": "" }, { "docid": "709e0272296c1daab8e860649854b3c8", "score": "0.54720396", "text": "func NewManager(name string, fns ...OptionFn) *Manager {\n\tem := &Manager{\n\t\tname: name,\n\t\tsample: &BasicEvent{},\n\t\t// events storage\n\t\teventFc: make(map[string]FactoryFunc),\n\t\t// listeners\n\t\tlisteners: make(map[string]*ListenerQueue),\n\t\tlistenedNames: make(map[string]int),\n\t}\n\n\tem.EnableLock = true\n\t// for async fire by goroutine\n\tem.ConsumerNum = defaultConsumerNum\n\tem.ChannelSize = defaultChannelSize\n\n\t// apply options\n\treturn em.WithOptions(fns...)\n}", "title": "" }, { "docid": "44897ce75d0b0423b1c0c0b432af6d16", "score": "0.54560685", "text": "func New() *FileManager {\n\treturn &FileManager{}\n}", "title": "" }, { "docid": "27bb1f60732857eac99aaed69db5744b", "score": "0.54173195", "text": "func NewManager(generators []Generator, client api.Client) *Manager {\n\treturn &Manager{\n\t\tcollector: newCollector(generators),\n\t\tsender: newSender(client),\n\t}\n}", "title": "" }, { "docid": "39e8393eb34dc7a6213c113a2cd13c6f", "score": "0.5416761", "text": "func NewManager(lbName, binPath, cfgPath, generatePath, backupPath, templatePath string, statusFetchPeriod int) (conf.Manager, error) {\n\tenvConfig := loadEnvConfig()\n\thaproxyClient, err := NewRuntimeClient(envConfig.SockPath)\n\tif err != nil {\n\t\tblog.Infof(\"create haproxy runtime client with sockpath %s failed, err %s\", envConfig.SockPath, err.Error())\n\t\treturn nil, fmt.Errorf(\"create haproxy runtime client with sockpath %s failed, err %s\", envConfig.SockPath, err.Error())\n\t}\n\tmanager := &Manager{\n\t\tLoadbalanceName: lbName,\n\t\thaproxyBin: binPath,\n\t\tcfgFile: cfgPath,\n\t\ttmpDir: generatePath,\n\t\tbackupDir: backupPath,\n\t\ttemplateFile: filepath.Join(templatePath, \"haproxy.cfg.template\"),\n\t\tstatusFetchPeriod: statusFetchPeriod,\n\t\tstopCh: make(chan struct{}),\n\t\thealthInfo: metric.HealthMeta{\n\t\t\tIsHealthy: conf.HealthStatusOK,\n\t\t\tMessage: conf.HealthStatusOKMsg,\n\t\t\tCurrentRole: metric.SlaveRole,\n\t\t},\n\t\tenvConfig: envConfig,\n\t\thaproxyClient: haproxyClient,\n\t}\n\tmanager.initMetric()\n\treturn manager, nil\n}", "title": "" }, { "docid": "3fdb92612c3a1698f6e07197375f87e7", "score": "0.54154587", "text": "func NewManager() *Manager {\n\treturn &Manager{\n\t\tInputs: map[string]*Input{},\n\t\tCaches: map[string]map[string]CacheItem{},\n\t\tRateLimits: map[string]RateLimit{},\n\t\tOutputs: map[string]OutputWriter{},\n\t\tProcessors: map[string]Processor{},\n\t\tPipes: map[string]<-chan message.Transaction{},\n\t\tM: metrics.Noop(),\n\t\tL: log.Noop(),\n\t}\n}", "title": "" }, { "docid": "6eb863d7d2b65f4c2833f1b5132d582c", "score": "0.54049534", "text": "func NewManager() *Manager {\n\treturn &Manager{\n\t\tNemesisDict: make(map[string]Nemesis),\n\t\t//\t\tIn: make(chan *Task),\n\t}\n}", "title": "" }, { "docid": "f723822bd454d1ff490e329a05fa4e1d", "score": "0.53918624", "text": "func New(folder string, options ...Option) (*DB, error) {\n\tdb := &DB{\n\t\tfolder: folder,\n\t\tbuffer: 100000,\n\n\t\tmu: &sync.Mutex{},\n\t\treadonly: false,\n\t}\n\n\tfor _, opt := range options {\n\t\terr := opt(db)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tif db.logger == nil {\n\t\tdb.logger = defaultLogger()\n\t\tdb.logger.Info(\"using default logger\")\n\t}\n\n\t// checking for nil allows us to create an options which supersede these routines.\n\tif db.fileLock == nil {\n\t\tdb.logger.Info(\"creating file lock\")\n\t\t// Create the lockile\n\t\tfile := flock.New(fmt.Sprintf(\"%s/%s\", folder, lockfile))\n\t\tlocked, err := file.TryLock()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif !locked {\n\t\t\treturn nil, errors.New(\"cellar: unable to acquire filelock\")\n\t\t}\n\n\t\tdb.fileLock = file\n\t}\n\n\t//TODO create a mock cipher which does not decrypt and encrypt\n\tif db.cipher == nil {\n\t\tdb.logger.Info(\"creating cipher\")\n\t\tdb.cipher = NewAES(defaultEncryptionKey)\n\t}\n\n\tif db.compressor == nil {\n\t\tdb.logger.Info(\"creating ChainCompressor\")\n\t\tdb.compressor = ChainCompressor{CompressionLevel: 10}\n\t}\n\n\tif db.decompressor == nil {\n\t\tdb.logger.Info(\"creating ChainDecompressor\")\n\t\tdb.decompressor = ChainDecompressor{}\n\t}\n\n\tif db.meta == nil {\n\t\tdb.logger.Info(\"creating metadb\", zap.String(\"IMPLEMENTATION\", \"BOLTDB\"))\n\t\tblt, err := bolt.Open(fmt.Sprintf(\"%s/%s\", folder, \"meta.bolt\"), 0600, &bolt.Options{Timeout: 1 * time.Second})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdb.meta = &BoltMetaDB{DB: blt}\n\t\terr = db.meta.Init()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tif db.writer == nil && !db.readonly {\n\t\tdb.logger.Info(\"creating new writer\", zap.Bool(\"READONLY\", false))\n\t\terr := db.newWriter()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn db, nil\n}", "title": "" }, { "docid": "6537e1b3766353f4cf65d8688d355c73", "score": "0.53863096", "text": "func NewManager(configpath string) (*Manager, error) {\n\tmanager := new(Manager)\n\tmanager.configs = make(map[string]*Macro)\n\tfiles, _ := filepath.Glob(configpath)\n\n\tfor _, file := range files {\n\t\tdata, err := ioutil.ReadFile(file)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tvar config map[string]*Macro\n\t\tif err := hcl.Unmarshal(data, &config); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor k, v := range config {\n\t\t\tmanager.configs[k] = v\n\t\t}\n\t}\n\n\tmanager.macros = template.New(\"main\")\n\tfor k, v := range manager.configs {\n\t\t_, err := manager.macros.New(k).Parse(v.Exec)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn manager, nil\n}", "title": "" }, { "docid": "159cac9655eec585fb8256bf7db310bc", "score": "0.5384965", "text": "func newManager(sm StateManagerApi, pchstore *Store) *Manager {\n\treturn &Manager{\n\t\tstore: pchstore,\n\t\tsm: sm,\n\t}\n}", "title": "" }, { "docid": "ac0ef42ca548cd7be79f2f52a43aa1f9", "score": "0.53690284", "text": "func NewManager(idLength int, signingKeys []string, store Store) Manager {\n\t//convert string keys to byte slices\n\tbkeys := make([][]byte, len(signingKeys))\n\tfor i, v := range signingKeys {\n\t\tbkeys[i] = []byte(v)\n\t}\n\treturn &manager{\n\t\tidLength: idLength,\n\t\tsigningKeys: bkeys,\n\t\tstore: store,\n\t}\n}", "title": "" }, { "docid": "2ae919a36cc28d8d8d69b928ac2805dd", "score": "0.53673273", "text": "func NewManager(mode Mode) (c Manager, err error) {\n\tswitch mode {\n\tcase ModeInMem:\n\t\treturn NewInMemManager(), nil\n\t}\n\n\treturn nil, errors.New(\"syncd: unable to init manager without mode\")\n}", "title": "" }, { "docid": "da7ac1daec9c68760996bcf8c9e9bdca", "score": "0.5349223", "text": "func NewManager(dbClient db.Client, vkClient vk.Client, tgClient tg.Client, tgUsers []string) Manager {\n\treturn &manager{\n\t\tdbClient: dbClient,\n\t\ttgClient: tgClient,\n\t\ttgUsers: tgUsers,\n\t\tvkClient: vkClient,\n\t}\n}", "title": "" }, { "docid": "0c74d778ccae93126360017df67c9b5a", "score": "0.53479004", "text": "func NewManager(config *Config) (Manager, error) {\n\tcert, forceRotation, err := getCurrentCertificateOrBootstrap(\n\t\tconfig.CertificateStore,\n\t\tconfig.BootstrapCertificatePEM,\n\t\tconfig.BootstrapKeyPEM)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tm := manager{\n\t\tcertSigningRequestClient: config.CertificateSigningRequestClient,\n\t\ttemplate: config.Template,\n\t\tusages: config.Usages,\n\t\tcertStore: config.CertificateStore,\n\t\tcert: cert,\n\t\tforceRotation: forceRotation,\n\t}\n\n\treturn &m, nil\n}", "title": "" }, { "docid": "f355c5470ce982503de9fe8795184603", "score": "0.5343319", "text": "func New(root string, files file.Repository, idxkeys idxkey.Repository, idxvolumes idxvolume.Repository, rp replica.Repository, sr state.Repository, fileSystem afero.Fs, logger kitlog.Logger, suow uow.StartUnitOfWork) (Local, error) {\n\tctx, cancel := context.WithCancel(context.Background())\n\tsroot := strings.Split(root, \":\")\n\tts := -1\n\tif len(sroot) > 1 {\n\t\tb, err := bytefmt.ToBytes(sroot[1])\n\t\tif err != nil {\n\t\t\tcancel()\n\t\t\treturn nil, err\n\t\t}\n\t\tts = int(b)\n\t\troot = sroot[0]\n\t}\n\tl := &local{\n\t\tfileDir: path.Join(root, \"file\"),\n\t\ttempDir: path.Join(root, \"tmps\"),\n\t\troot: root,\n\t\ttotalSize: ts,\n\n\t\tfiles: files,\n\t\tfs: fileSystem,\n\t\tidxkeys: idxkeys,\n\t\tidxvolumes: idxvolumes,\n\t\treplicas: rp,\n\t\tstate: sr,\n\n\t\toriginalLogger: logger,\n\n\t\tstartUnitOfWork: suow,\n\n\t\tctx: ctx,\n\t\tcancel: cancel,\n\t}\n\n\terr := l.fs.MkdirAll(l.fileDir, os.ModePerm)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = l.fs.MkdirAll(l.tempDir, os.ModePerm)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar id string\n\tidPath := path.Join(root, \"id\")\n\t// Creates or reads the id from the idPath as a Volume\n\t// must have always the same ID\n\tif _, err = l.fs.Stat(idPath); os.IsNotExist(err) {\n\t\tid, err = l.createID(idPath)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\tfh, err := l.fs.Open(idPath)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdefer fh.Close()\n\n\t\t// This 36 is the length is the length of\n\t\t// a UUID string: https://github.com/satori/go.uuid/blob/master/uuid.go#L116\n\t\tbid := make([]byte, 36)\n\t\t_, err = io.ReadFull(fh, bid)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tid = string(bid)\n\t}\n\n\tl.id = id\n\tl.logger = kitlog.With(logger, \"src\", \"volume\", \"id\", id)\n\n\t// Initialize state\n\terr = l.startUnitOfWork(ctx, uow.Write, func(ctx context.Context, uw uow.UnitOfWork) error {\n\t\terr = l.calculateSize(ctx, uw, root, ts)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t}, l.state)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Loop that updates the State so\n\t// we can check if anything has changed on\n\t// the overall System\n\tgo func() {\n\t\ttk := time.NewTicker(TickerDuration)\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\ttk.Stop()\n\t\t\tcase <-tk.C:\n\t\t\t\terr = l.startUnitOfWork(ctx, uow.Write, func(ctx context.Context, uw uow.UnitOfWork) error {\n\t\t\t\t\terr = l.calculateSize(ctx, uw, root, ts)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tl.logger.Log(\"msg\", err.Error())\n\t\t\t\t\t}\n\t\t\t\t\treturn nil\n\t\t\t\t}, l.state)\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn l, nil\n}", "title": "" }, { "docid": "730df569b04dc63f7f3e22f250c7edca", "score": "0.5340072", "text": "func NewObjectManager(ctx context.Context, bm blockManager, f config.RepositoryObjectFormat, opts ManagerOptions) (*Manager, error) {\n\tif err := validateFormat(&f); err != nil {\n\t\treturn nil, err\n\t}\n\n\tom := &Manager{\n\t\tblockMgr: bm,\n\t\tFormat: f,\n\t\ttrace: nullTrace,\n\t}\n\n\tsplitterID := f.Splitter\n\tif splitterID == \"\" {\n\t\tsplitterID = \"FIXED\"\n\t}\n\n\tos := splitterFactories[splitterID]\n\tif os == nil {\n\t\treturn nil, fmt.Errorf(\"unsupported splitter %q\", f.Splitter)\n\t}\n\n\tom.newSplitter = func() objectSplitter {\n\t\treturn os(&f)\n\t}\n\n\tif opts.Trace != nil {\n\t\tom.trace = opts.Trace\n\t} else {\n\t\tom.trace = nullTrace\n\t}\n\n\tif opts.WriteBack > 0 {\n\t\tom.async = true\n\t\tom.writeBackSemaphore = make(semaphore, opts.WriteBack)\n\t}\n\n\treturn om, nil\n}", "title": "" }, { "docid": "6c0cc950a3bb0f8d6081833d562cc18c", "score": "0.5339665", "text": "func newManager(t *testing.T, db *sql.DB) *Manager {\n\tm := &Manager{\n\t\tConfig: &Config{},\n\t\tUserSet: &UserSet{},\n\t\tOwnerSet: &OwnerSet{},\n\t}\n\ttx, err := db.Begin()\n\trequire.NoError(t, err)\n\tdefer tx.Commit()\n\n\trequire.NoError(t, goose.SetDialect(\"sqlite3\"))\n\trequire.NoError(t, goose.Up(db, \".\"))\n\n\treturn m\n}", "title": "" }, { "docid": "89b7b43db39d2243791463ac5fb78a75", "score": "0.5317594", "text": "func New() *Manager {\n\treturn &Manager{\n\t\tdisks: make(map[string]Disk),\n\t}\n}", "title": "" }, { "docid": "59df5c57995744cdc0edcf8b3f6c28ec", "score": "0.53139657", "text": "func NewManager(settings *Settings) *Manager {\n\tvar (\n\t\tprivateKey crypto.PrivateKey\n\t\tcertInfo = map[string]*Info{}\n\t\tcaBundle = []*x509.Certificate{}\n\t)\n\tif settings.Cert != nil {\n\t\tprivateKey = settings.Cert.PrivateKey\n\t\tcertInfo = map[string]*Info{settings.CertID: {certID: settings.CertID, cert: settings.Cert.Leaf}}\n\t\tcaBundle = []*x509.Certificate{settings.CA}\n\t} else {\n\t\tvar err error\n\t\tprivateKey, err = generatePrivateKey()\n\t\tif err != nil {\n\t\t\tlog.Exit(\"couldn't generate private key for manager: \", err)\n\t\t}\n\t}\n\treturn &Manager{\n\t\tprivateKey: privateKey,\n\t\tcertInfo: certInfo,\n\t\tcaBundle: caBundle,\n\t\tlocks: map[string]bool{},\n\t\tnotifiers: []Notifier{},\n\t}\n}", "title": "" }, { "docid": "d32a923f56a53b16377dd4c81a00a02d", "score": "0.53113335", "text": "func NewManager() *Manager {\n\treturn &Manager{\n\t\tvmCache: make(map[string]string),\n\t}\n}", "title": "" }, { "docid": "bf3d41d2633f01868ab1961854685d6a", "score": "0.53109306", "text": "func NewManager() (*Manager, error) {\n\t// First things first, setup the namespace\n\tif err := ConfigureNamespace(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tman := &Manager{\n\t\tcancelled: false,\n\t\tactivePID: 0,\n\t\tupdateMode: false,\n\t\tlockfile: nil,\n\t\tdidStart: false,\n\t}\n\n\t// Now load the configuration in\n\tif config, err := NewConfig(); err == nil {\n\t\tman.Config = config\n\t} else {\n\t\tlog.Errorf(\"Failed to load solbuild configuration %s\\n\", err)\n\t\treturn nil, err\n\t}\n\n\tman.lock = new(sync.Mutex)\n\n\treturn man, nil\n}", "title": "" }, { "docid": "eb86117c745d8ea336aa5f2fe1303eba", "score": "0.52999884", "text": "func (p *CDBBlockstoreProvider) createNonCommitterBlockStore(ledgerid, blockStoreDBName, txnStoreDBName string) (blkstorage.BlockStore, error) {\n\n\t//create new block store db\n\tblockStoreDB, err := p.openCouchDB(blockStoreDBName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t//check if indexes exists\n\tindexExists, err := blockStoreDB.IndexDesignDocExistsWithRetry(blockHashIndexDoc)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !indexExists {\n\t\treturn nil, errors.Errorf(\"DB index not found: [%s]\", blockStoreDBName)\n\t}\n\n\t//create new txn store db\n\ttxnStoreDB, err := p.openCouchDB(txnStoreDBName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn newCDBBlockStore(blockStoreDB, txnStoreDB, ledgerid), nil\n}", "title": "" }, { "docid": "fabf9de1b81366bf8dccca60b57b8c1a", "score": "0.5295504", "text": "func (mgr *blockfileMgr) loadBlkfilesInfo() (*blockfilesInfo, error) {\n\tvar b []byte\n\tvar err error\n\tif b, err = mgr.db.Get(blkMgrInfoKey); b == nil || err != nil {\n\t\treturn nil, err\n\t}\n\ti := &blockfilesInfo{}\n\tif err = i.unmarshal(b); err != nil {\n\t\treturn nil, err\n\t}\n\tlogger.Debugf(\"loaded blockfilesInfo:%s\", i)\n\treturn i, nil\n}", "title": "" }, { "docid": "7b89831d8fb1282fd61c4b58308ccab4", "score": "0.52750987", "text": "func NewManager(param Param) *Manager {\n\tmng := &Manager{\n\t\tUsername: param.Username,\n\t\tPassword: param.Password,\n\t\tFetcherBackendVersion: param.FetcherBackendVersion,\n\t\tEnricherBackendVersion: param.EnricherBackendVersion,\n\t\tEnrichOnly: param.EnrichOnly,\n\t\tEnrich: param.Enrich,\n\t\tESUrl: param.ESUrl,\n\t\tHTTPTimeout: param.HTTPTimeout,\n\t\tRepositories: param.Repositories,\n\t\tFromDate: param.FromDate,\n\t\tNoIncremental: param.NoIncremental,\n\t\tRetries: param.Retries,\n\t\tDelay: param.Delay,\n\t\tGapURL: param.GapURL,\n\t\tAffAPI: param.AffAPI,\n\t\tProjectSlug: param.ProjectSlug,\n\t\tAffBaseURL: param.AffBaseURL,\n\t\tESCacheURL: param.ESCacheURL,\n\t\tESCacheUsername: param.ESCacheUsername,\n\t\tESCachePassword: param.ESCachePassword,\n\t\tAuthGrantType: param.AuthGrantType,\n\t\tAuthClientID: param.AuthClientID,\n\t\tAuthClientSecret: param.AuthClientSecret,\n\t\tAuthAudience: param.AuthAudience,\n\t\tAuth0URL: param.Auth0URL,\n\t\tEnvironment: param.Environment,\n\t\tSlug: param.Slug,\n\t}\n\n\treturn mng\n}", "title": "" }, { "docid": "d711b53f951301e88c124fb1721751fc", "score": "0.52327406", "text": "func loadBlockDB(cx *pod.State) (db database.DB, e error) {\n\t// The memdb backend does not have a file path associated with it, so handle it\n\t// uniquely. We also don't want to worry about the multiple database type\n\t// warnings when running with the memory database.\n\tif cx.Config.DbType.V() == \"memdb\" {\n\t\tI.Ln(\"creating block database in memory\")\n\t\tif db, e = database.Create(cx.Config.DbType.V()); E.Chk(e) {\n\t\t\treturn nil, e\n\t\t}\n\t\treturn db, nil\n\t}\n\twarnMultipleDBs(cx)\n\t// The database name is based on the database type.\n\tdbPath := path.BlockDb(cx, cx.Config.DbType.V(), blockdb.NamePrefix)\n\t// The regression test is special in that it needs a clean database for each\n\t// run, so remove it now if it already exists.\n\te = removeRegressionDB(cx, dbPath)\n\tif e != nil {\n\t\tD.Ln(\"failed to remove regression db:\", e)\n\t}\n\tI.F(\"loading block database from '%s'\", dbPath)\n\tif db, e = database.Open(cx.Config.DbType.V(), dbPath, cx.ActiveNet.Net); E.Chk(e) {\n\t\tT.Ln(e) // return the error if it's not because the database doesn't exist\n\t\tif dbErr, ok := e.(database.DBError); !ok || dbErr.ErrorCode !=\n\t\t\tdatabase.ErrDbDoesNotExist {\n\t\t\treturn nil, e\n\t\t}\n\t\t// create the db if it does not exist\n\t\te = os.MkdirAll(cx.Config.DataDir.V(), 0700)\n\t\tif e != nil {\n\t\t\treturn nil, e\n\t\t}\n\t\tdb, e = database.Create(cx.Config.DbType.V(), dbPath, cx.ActiveNet.Net)\n\t\tif e != nil {\n\t\t\treturn nil, e\n\t\t}\n\t}\n\tT.Ln(\"block database loaded\")\n\treturn db, nil\n}", "title": "" }, { "docid": "67cce0deb6f444d3b9be82f29c37fc25", "score": "0.5206336", "text": "func NewManager(info torrent.Info, pieceRepo Repository) *manager {\n\tlastPieceSize, pieceCount := info.CalculateLastPieceSize()\n\tpieces := make([]pieceStatus, pieceCount)\n\n\treturn &manager{\n\t\tinfo: info,\n\t\tpieces: pieces,\n\t\tpeersPieces: map[string][]bool{},\n\t\tlastPieceSize: uint32(lastPieceSize),\n\t\tpieceSize: uint32(info.PieceSize),\n\t\tpieceRepo: pieceRepo,\n\t}\n}", "title": "" }, { "docid": "0ecb0967bd6cabd3db6891567186c29d", "score": "0.5204536", "text": "func newManagerTest(configReader io.Reader) (*Manager, error) {\n\tcfg := &Config{}\n\tif configReader != nil {\n\t\tbody, err := ioutil.ReadAll(configReader)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\terr = json.Unmarshal(body, cfg)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tif cfg.Token == \"\" {\n\t\treturn nil, errors.New(\"access token is not provided\")\n\t}\n\tif cfg.ClusterID == \"\" {\n\t\treturn nil, errors.New(\"cluster ID is not provided\")\n\t}\n\n\tbizflyClient, err := gobizfly.NewClient()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"couldn't initialize Bizflycloud client: %s\", err)\n\t}\n\n\tm := &Manager{\n\t\tclient: bizflyClient.KubernetesEngine,\n\t\tclusterID: cfg.ClusterID,\n\t\tnodeGroups: make([]*NodeGroup, 0),\n\t}\n\n\treturn m, nil\n}", "title": "" }, { "docid": "2192a9b81077c01cfd1fbbadb48ade3c", "score": "0.52002263", "text": "func NewManager() *Manager {\n\treturn &Manager{\n\t\tsync.Mutex{},\n\t\t0,\n\t\tmake(map[string]eventsStore),\n\t}\n}", "title": "" }, { "docid": "752d095a93453ce8f6d89a630860c70b", "score": "0.519868", "text": "func NewManager(ctx context.Context, dataDir, artifactsURL string) (*Manager, error) {\n\tvar all []string\n\tif err := filepath.Walk(dataDir, func(linkPath string, info os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif !strings.HasSuffix(linkPath, testing.ExternalLinkSuffix) {\n\t\t\treturn nil\n\t\t}\n\t\tdestPath := strings.TrimSuffix(linkPath, testing.ExternalLinkSuffix)\n\t\tall = append(all, destPath)\n\t\treturn nil\n\t}); err != nil && !os.IsNotExist(err) {\n\t\treturn nil, fmt.Errorf(\"Failed to walk data directory: %v\", err)\n\t}\n\tsort.Strings(all)\n\n\treturn &Manager{\n\t\tdataDir: dataDir,\n\t\tartifactsURL: artifactsURL,\n\t\tall: all,\n\t\tinuse: make(map[string]int),\n\t}, nil\n}", "title": "" }, { "docid": "eb57f9c0d07bfb3d9528c4a7e5b0174d", "score": "0.51934487", "text": "func loadBlockDB(cx *conte.Xt) (database.DB, error) {\n\t// The memdb backend does not have a file path associated with it,\n\t// so handle it uniquely.\n\t// We also don't want to worry about the multiple database type\n\t// warnings when running with the memory database.\n\tif *cx.Config.DbType == \"memdb\" {\n\t\tlog <- cl.Info{\"creating block database in memory\", cl.Ine()}\n\t\tdb, err := database.Create(*cx.Config.DbType)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn db, nil\n\t}\n\twarnMultipleDBs(cx)\n\t// The database name is based on the database type.\n\tdbPath := path.BlockDb(cx, *cx.Config.DbType)\n\t// The regression test is special in that it needs a clean database\n\t// for each run, so remove it now if it already exists.\n\te := removeRegressionDB(cx, dbPath)\n\tif e != nil {\n\t\tlog <- cl.Debug{\"failed to remove regression db:\", e, cl.Ine()}\n\t}\n\tlog <- cl.Infof{\"loading block database from '%s' %s\", dbPath, cl.Ine()}\n\tdb, err := database.Open(*cx.Config.DbType, dbPath, cx.ActiveNet.Net)\n\tif err != nil {\n\t\t// return the error if it's not because the database doesn't exist\n\t\tif dbErr, ok := err.(database.Error); !ok || dbErr.ErrorCode !=\n\t\t\tdatabase.ErrDbDoesNotExist {\n\t\t\treturn nil, err\n\t\t}\n\t\t// create the db if it does not exist\n\t\terr = os.MkdirAll(*cx.Config.DataDir, 0700)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdb, err = database.Create(*cx.Config.DbType, dbPath, cx.ActiveNet.Net)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tlog <- cl.Trace{\"block database loaded\", cl.Ine()}\n\treturn db, nil\n}", "title": "" }, { "docid": "e44a8fff9787f8163f610e8464a868d4", "score": "0.51853573", "text": "func NewBaseManager() *BaseManager {\n\treturn &BaseManager{\n\t\tSources: map[string]*DataSource{},\n\t\tFactories: map[string]Factory{},\n\t}\n}", "title": "" }, { "docid": "6eebf66ce92ea55785ebe8c08c1dcd05", "score": "0.5179699", "text": "func newWalManager(directory string, maxWalSegmentSize uint64) (*walManager, error) {\n\t// Create/verify that the directory exists. If it does not exist then this will create it. If\n\t// the dir does exist then nothing will happen here.\n\tif err := newDirectory(directory); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &walManager{\n\t\tDirectory: directory,\n\t\tMaxWALSegmentSize: maxWalSegmentSize,\n\t\tcurrentSegment: nil,\n\t}, nil\n}", "title": "" }, { "docid": "2e4d59095590d59b14c787dfd4510a43", "score": "0.5171937", "text": "func New() *Mgr { return &Mgr{} }", "title": "" }, { "docid": "dc2cc30927113533a5bad8139dc3dae6", "score": "0.51657957", "text": "func (p *FsBlockstoreProvider) CreateBlockStore(ledgerid string) (blkstorage.BlockStore, error) {\r\n\treturn p.OpenBlockStore(ledgerid)\r\n}", "title": "" }, { "docid": "79b04053e13af76875a8c366edbd190d", "score": "0.516267", "text": "func NewManager(gitClient git.Git) RepoManager {\n\treturn &Manager{\n\t\tworkingDir: gitClient.GetDirectory(),\n\t\tgitClient: gitClient,\n\t}\n}", "title": "" }, { "docid": "2fea972f089f4df605aee32cba05cca0", "score": "0.514892", "text": "func NewManager(dir string, s kubernetes.SecretStore, o ...ManagerOption) (*Manager, error) {\n\tm := &Manager{\n\t\tlog: zap.NewNop(),\n\t\tmetric: newNopMetrics(),\n\t\tfs: afero.NewOsFs(),\n\t\trecorder: &event.NopRecorder{},\n\t\ttlsDir: dir,\n\t\tv: &optimisticValidator{},\n\t\tsecretStore: s,\n\t\tsecretRefs: make(map[metadata]map[string]bool),\n\t\tsubscribers: make([]Subscriber, 0),\n\t\tforceHTTPSTable: forceHTTPSTable{},\n\t}\n\tfor _, mo := range o {\n\t\tif err := mo(m); err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"cannot apply manager option\")\n\t\t}\n\t}\n\treturn m, nil\n}", "title": "" }, { "docid": "df0a4a3b278d688128196f8159a007c8", "score": "0.51457024", "text": "func New(options ...ManagerOption) *Manager {\n\tm := &Manager{\n\t\tlogger: stdLogger{},\n\t\tst: NewInMemoryStore(),\n\t\tbackoff: exponentialBackoff,\n\t\ttm: make(map[string]Processor),\n\t\tconcurrency: map[int]int{0: defaultConcurrency},\n\t\tworking: map[int]int{0: 0},\n\t\tstartupBehaviour: None,\n\t\ttestManagerStarted: nop,\n\t\ttestManagerStopped: nop,\n\t\ttestSchedulerStarted: nop,\n\t\ttestSchedulerStopped: nop,\n\t\ttestJobAdded: nop,\n\t\ttestJobScheduled: nop,\n\t\ttestJobStarted: nop,\n\t\ttestJobRetry: nop,\n\t\ttestJobFailed: nop,\n\t\ttestJobSucceeded: nop,\n\t}\n\tfor _, opt := range options {\n\t\topt(m)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "8695b76778f7afde4deffa6562b377a9", "score": "0.5141628", "text": "func NewManager() Manager {\n\treturn &manager{}\n}", "title": "" }, { "docid": "6169b8cffd6ae1c2a8b265a2d3e9be5b", "score": "0.5140457", "text": "func NewManager(logger log.Logger) *Manager {\n\treturn &Manager{\n\t\tmodules: make(map[string]*module),\n\t\tlogger: logger,\n\t}\n}", "title": "" }, { "docid": "d1b3237a0334a324c7bd5d3342329b18", "score": "0.5129775", "text": "func NewManager() *Manager {\n\trm := &Manager{\n\t\trbs: make(map[string]*resbeat),\n\t\tstate: rmStateInit,\n\t}\n\treturn rm\n}", "title": "" }, { "docid": "c870bc0864af6c8a25a8fc8bcf6b08d8", "score": "0.51287025", "text": "func NewManager(brk brokers.Broker, str stores.Store, sndr Sender) *Manager {\n\tmgr := Manager{}\n\tmgr.broker = brk\n\tmgr.store = str\n\tmgr.sender = sndr\n\tmgr.list = make(map[string]*Pusher)\n\tlog.Info(\"PUSH\", \"\\t\", \"Manager Initialized\")\n\treturn &mgr\n}", "title": "" }, { "docid": "ab4d69fa3004c1522371dfad6681ddbc", "score": "0.512391", "text": "func NewBlockchain() *Blockchain {\n\tvar tip []byte\n\n\t//open a BoltDB file\n\tdb, err := bolt.Open(dbFile, 0600, nil)\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\n\t//db.Update open a read-write transcation for putting genesis Block into the DB\n\terr = db.Update(func(tx *bolt.Tx) error {\n\n\t\t//obtain bucket stores the blocks\n\t\tb := tx.Bucket([]byte(blocksBucket))\n\n\t\t//check if there is a blockchain stored in it\n\t\tif b == nil {\n\n\t\t\t//there is no existing blockchain\n\t\t\tfmt.Println(\"No existing blockchain found. Create a new one...\")\n\n\t\t\t//create the genesis block\n\t\t\tgenesis := NewGenesisBlock()\n\n\t\t\tb, err := tx.CreateBucket([]byte(blocksBucket))\n\t\t\tif err != nil {\n\t\t\t\tlog.Panic(err)\n\t\t\t}\n\n\t\t\t//store the genesis block in the DB\n\t\t\terr = b.Put(genesis.Hash, genesis.Serialize())\n\t\t\tif err != nil {\n\t\t\t\tlog.Panic(err)\n\t\t\t}\n\n\t\t\t//save the genesis block's hash as the last block's hash\n\t\t\terr = b.Put([]byte(\"l\"), genesis.Hash)\n\t\t\tif err != nil {\n\t\t\t\tlog.Panic(err)\n\t\t\t}\n\n\t\t\ttip = genesis.Hash\n\t\t} else {\n\t\t\t//blockchain instance is not nil, there is a blockchain\n\t\t\t//create a new blockchain instance to the last block hash stored in the DB\n\t\t\ttip = b.Get([]byte(\"l\"))\n\t\t}\n\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\n\tbc := Blockchain{tip, db}\n\treturn &bc\n}", "title": "" }, { "docid": "0988cab4acbad37b314a09a177d2f238", "score": "0.5123597", "text": "func NewChannelManager(cfg *config.Config) (*ChannelManager, error) {\n\tm := new(ChannelManager)\n\tvar err error\n\tm.signalCh = make(chan bool, 1)\n\tm.stopCh = make(chan bool, 1)\n\tm.Channels = make(map[string]*channel.Manager)\n\t// set identity\n\tif m.identity, err = cfg.GetIdentity(); err != nil {\n\t\treturn nil, err\n\t}\n\t// set db\n\tdb, err := newDB(cfg.DB.LevelDB.Dir)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tm.db = db\n\t// set path\n\tm.path = cfg.BlockChain.Path\n\t// set order clients\n\tif m.ordererClients, err = getOrdererClients(cfg); err != nil {\n\t\treturn nil, err\n\t}\n\tm.coordinator = channel.NewCoordinator()\n\tif err := m.loadChannels(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn m, nil\n}", "title": "" }, { "docid": "d9f9ac3cba57483a26a7d7629b411d40", "score": "0.5117524", "text": "func (_this *Index) Init() (err error) {\n\tidxFileName := _this.getIndexFileName()\n\tif _this.idxFile, err = os.OpenFile(idxFileName, os.O_RDWR|os.O_CREATE|O_NOATIME, 0664); err != nil {\n\t\tlog.Errorf(\"Index.Init() open file %s failed. %v\", idxFileName, err)\n\t\t_this.Close()\n\t\treturn\n\t}\n\n\tvar filesize uint64\n\tif filesize, err = utils.GetFileSize(_this.idxFile); err != nil {\n\t\treturn\n\t}\n\n\tif filesize == 0 {\n\t\t// 为文件预分配物理空间,仅Linux适用。\n\t\tif err = Fallocate(_this.idxFile.Fd(), uint32(FALLOC_FL_KEEP_SIZE), 0, uint64(IndexfileMaxSize)); err != nil {\n\t\t\tlog.Errorf(\"Index.Init() Fallocate() failed. vid:%d Dir:%s. %v\", _this.vid, _this.Dir, err)\n\t\t\treturn\n\t\t}\n\t\tif err = _this.writeSuperBlock(); err != nil {\n\t\t\treturn\n\t\t}\n\t\t_this.FileSize = SuperBlockSize\n\t\t_this.syncedSize = _this.FileSize\n\t} else {\n\t\tif err = _this.loadSuperBlock(); err != nil {\n\t\t\treturn\n\t\t}\n\t\t_this.FileSize = filesize\n\t\t_this.syncedSize = _this.FileSize\n\t}\n\n\tif err = _this.loadIndices(); err != nil {\n\t\tlog.Errorf(\"Index.Init() call _this.loadIndices() failed. vid:%d. %v\", _this.vid, err)\n\t\treturn\n\t}\n\n\t_this.idxFile.Seek(int64(_this.FileSize), os.SEEK_SET)\n\n\treturn\n}", "title": "" }, { "docid": "c748a803c877abe307dd2e293a2379c1", "score": "0.51157963", "text": "func NewManager(kv kvdb.Kvdb) (ConfigManager, error) {\n\treturn newManager(kv)\n}", "title": "" }, { "docid": "e956b485d09e7e35a53f5e2c093c4b87", "score": "0.51136106", "text": "func init() {\n\t_, err := os.Stat(db)\n\n\tif err != nil {\n\t\tif !os.IsNotExist(err) {\n\t\t\tcanUseStorage = false\n\t\t\treturn\n\t\t}\n\n\t\tcreateConfigFile()\n\t}\n}", "title": "" }, { "docid": "b4f3226807d2afabd0bbcaf4a78123cc", "score": "0.5109247", "text": "func NewManager(opts ...Option) *Manager {\n\tm := DefaultManager\n\tfor _, opt := range opts {\n\t\topt(m)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "93309274b89e47ec0b2d19c7a001e056", "score": "0.50961894", "text": "func newStore(name, path string, option StoreOption) (s Store, err error) {\n\tvar info *storeInfo\n\tvar isCreate bool\n\toptionsFile := filepath.Join(path, version.Options)\n\t// need check options cfg file if exist, because kv path maybe created but option file persisted\n\tif fileutil.Exist(optionsFile) {\n\t\t// exist store, open it, load store info and config from INFO\n\t\tinfo = &storeInfo{}\n\t\tif err = decodeTomlFunc(optionsFile, info); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"load store info file:%s, error:%s\", optionsFile, err)\n\t\t}\n\t} else {\n\t\t// create store, initialize path and store info\n\t\tif err = mkDirFunc(path); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"create store path error:%s\", err)\n\t\t}\n\t\tinfo = newStoreInfo(option)\n\t\tisCreate = true\n\t}\n\t// try lock\n\tlock, err := newFileLockFunc(filepath.Join(path, version.Lock))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err0 := lock.Lock(); err0 != nil {\n\t\treturn nil, err0\n\t}\n\n\tctx, cancel := context.WithCancel(context.Background())\n\tstore1 := &store{\n\t\tname: name,\n\t\tpath: path,\n\t\toption: option,\n\t\tlock: lock,\n\t\tfamilies: make(map[string]Family),\n\t\tstoreInfo: info,\n\t\tctx: ctx,\n\t\tcancel: cancel,\n\t}\n\n\tdefer func() {\n\t\tif err != nil {\n\t\t\t// if init err, need close store for release resource\n\t\t\tif err2 := store1.close(); err2 != nil {\n\t\t\t\tkvLogger.Error(\"close store err when create store fail\",\n\t\t\t\t\tlogger.String(\"store\", path), logger.Error(err), logger.Error(err2))\n\t\t\t}\n\t\t}\n\n\t\t// finally, try delete obsolete files\n\t\tstore1.deleteObsoleteFiles()\n\t\tstore1.deleteFamilyObsoleteFiles()\n\t}()\n\n\t// build store reader cache\n\tstore1.cache = table.NewCache(path, option.TTL.Duration())\n\t// init version set\n\tstore1.versions = newVersionSetFunc(path, store1.cache, store1.option.Levels)\n\n\tif isCreate {\n\t\t// if store is new created, need dump store info to INFO file\n\t\terr = store1.dumpStoreInfo()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\t// existed store calc family sequence\n\t\tfor familyName, familyOption := range info.Families {\n\t\t\tif int(store1.familySeq.Load()) < familyOption.ID {\n\t\t\t\tstore1.familySeq.Store(int32(familyOption.ID))\n\t\t\t}\n\t\t\tvar family Family\n\t\t\t// open existed family\n\t\t\tfamily, err = newFamily(store1, familyOption)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"building family instance for existed store[%s] error:%s\", path, err)\n\t\t\t}\n\t\t\tstore1.families[familyName] = family\n\t\t}\n\t}\n\t// recover version set, after recovering family options\n\terr = store1.versions.Recover()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"recover store version set error:%s\", err)\n\t}\n\n\treturn store1, nil\n}", "title": "" }, { "docid": "36873060aa2079c8170a004b6f4eda13", "score": "0.50871027", "text": "func NewBlockchain() (*Blockchain, error) {\n\tresp, err := http.Get(\"http://127.0.0.1:8080/getBlockchainMangerInfo\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\tvar blockchainInfo BlockchainInfo\n\n\tdec := gob.NewDecoder(resp.Body)\n\terr = dec.Decode(&blockchainInfo)\n\n\tbc := &Blockchain{blockchainInfo.Hash}\n\treturn bc, nil\n}", "title": "" }, { "docid": "632a48747a23775ca3b95dedc28dffb5", "score": "0.5083551", "text": "func NewManager(configMap string) (*Manager, error) {\n\tvar clientset *kubernetes.Clientset\n\tif OutSideCluster == false {\n\t\t// This will attempt to load the configuration when running within a POD\n\t\tcfg, err := rest.InClusterConfig()\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error creating kubernetes client config: %s\", err.Error())\n\t\t}\n\t\tclientset, err = kubernetes.NewForConfig(cfg)\n\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error creating kubernetes client: %s\", err.Error())\n\t\t}\n\t\t// use the current context in kubeconfig\n\t} else {\n\t\tconfig, err := clientcmd.BuildConfigFromFlags(\"\", filepath.Join(os.Getenv(\"HOME\"), \".kube\", \"config\"))\n\t\tif err != nil {\n\t\t\tpanic(err.Error())\n\t\t}\n\t\tclientset, err = kubernetes.NewForConfig(config)\n\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error creating kubernetes client: %s\", err.Error())\n\t\t}\n\t}\n\n\treturn &Manager{\n\t\tclientSet: clientset,\n\t\tconfigMap: configMap,\n\t}, nil\n}", "title": "" }, { "docid": "215412b63e666a0725afe61579d3b4d3", "score": "0.5074805", "text": "func Create(dir string, config *Config) (*Database, error) {\n\n // Test whether directory exists already\n _, err := os.Stat(dir)\n if err == nil {\n return nil, errors.New(\"directory already used\")\n }\n\n // Create directory\n err = os.MkdirAll(dir, os.ModePerm)\n if err != nil {\n return nil, err\n }\n\n // Create first chunk file\n _, err = os.Create(path.Join(dir, \"chunk.0\"))\n if err != nil {\n return nil, err\n }\n\n // Store configuration\n file, err := os.Create(path.Join(dir, \"config.json\"))\n if err != nil {\n return nil, err\n }\n\n config.NextBlock = 0\n b, err := json.Marshal(config)\n if err != nil {\n return nil, err\n }\n\n _, err = file.Write(b)\n if err != nil {\n return nil, err\n }\n\n file.Close()\n\n return Open(dir)\n\n}", "title": "" }, { "docid": "2382b0e5d7596d9ddfab80b438fb6631", "score": "0.5070948", "text": "func LoadBlockDB(dataPath string) (database.DB, error) {\n\t// The memdb backend does not have a file path associated with it, so\n\t// handle it uniquely. We also don't want to worry about the multiple\n\t// database type warnings when running with the memory database.\n\n\t// The database name is based on the database type.\n\tdbType := \"ffldb\"\n\tdbPath := blockDbPath(dataPath, dbType)\n\n\tlog.Infof(\"Loading block database from '%s'\", dbPath)\n\tdb, err := database.Open(dbType, dbPath, wire.MainNet)\n\tif err != nil {\n\t\t// Return the error if it's not because the database doesn't\n\t\t// exist.\n\t\tif dbErr, ok := err.(database.Error); !ok || dbErr.ErrorCode !=\n\t\t\tdatabase.ErrDbDoesNotExist {\n\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// Create the db if it does not exist.\n\t\terr = os.MkdirAll(dataPath, 0700)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdb, err = database.Create(dbType, dbPath, wire.MainNet)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tlog.Info(\"Block database loaded\")\n\treturn db, nil\n}", "title": "" }, { "docid": "af479acaa00c943615bcfd1f66c333d4", "score": "0.5066421", "text": "func newClusterManager() *cm.ClusterManager {\n\tclustersConfigFile := \"/var/configs/clusters/default-clusters.yaml\"\n\n\t// Return a memory-backed cluster manager populated by configmap\n\treturn cm.NewConfiguredClusterManager(cm.NewMapDBClusterStorage(), clustersConfigFile)\n\n\t// NOTE: The following should be used with a persistent disk store. Since the\n\t// NOTE: configmap approach is currently the \"persistent\" source (entries are read-only\n\t// NOTE: on the backend), we don't currently need to store on disk.\n\t/*\n\t\tpath := env.GetConfigPath()\n\t\tdb, err := bolt.Open(path+\"costmodel.db\", 0600, nil)\n\t\tif err != nil {\n\t\t\tklog.V(1).Infof(\"[Error] Failed to create costmodel.db: %s\", err.Error())\n\t\t\treturn cm.NewConfiguredClusterManager(cm.NewMapDBClusterStorage(), clustersConfigFile)\n\t\t}\n\n\t\tstore, err := cm.NewBoltDBClusterStorage(\"clusters\", db)\n\t\tif err != nil {\n\t\t\tklog.V(1).Infof(\"[Error] Failed to Create Cluster Storage: %s\", err.Error())\n\t\t\treturn cm.NewConfiguredClusterManager(cm.NewMapDBClusterStorage(), clustersConfigFile)\n\t\t}\n\n\t\treturn cm.NewConfiguredClusterManager(store, clustersConfigFile)\n\t*/\n}", "title": "" }, { "docid": "26f7fd9666403792d5f5ebe01f415f78", "score": "0.50600415", "text": "func NewManager(pipes []internal.Pipe) (Manager, error) {\n\tm := Manager{\n\t\tpipes: pipes,\n\t\tinstances: make(map[string]instance),\n\t}\n\n\tif err := m.init(); err != nil {\n\t\treturn m, errors.Wrap(err, \"initialization error\")\n\t}\n\n\treturn m, nil\n}", "title": "" }, { "docid": "5329c7bfcbbfa0c0498d526ca07e1476", "score": "0.5059042", "text": "func New(gitCommandPath, managementDirectoryPath string) (m *Manager) {\n\tm = &Manager{\n\t\tgitCommandPath: gitCommandPath,\n\t\tmanagementDirectoryPath: managementDirectoryPath,\n\t}\n\n\treturn m\n}", "title": "" }, { "docid": "deceee461919c3f8052ec741241a07a3", "score": "0.5052842", "text": "func NewManager(config *Config) (Manager, error) {\n\tcert, forceRotation, err := getCurrentCertificateOrBootstrap(\n\t\tconfig.CertificateStore,\n\t\tconfig.BootstrapCertificatePEM,\n\t\tconfig.BootstrapKeyPEM)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tgetTemplate := config.GetTemplate\n\tif getTemplate == nil {\n\t\tgetTemplate = func() *x509.CertificateRequest { return config.Template }\n\t}\n\n\tif config.GetUsages != nil && config.Usages != nil {\n\t\treturn nil, errors.New(\"cannot specify both GetUsages and Usages\")\n\t}\n\tif config.GetUsages == nil && config.Usages == nil {\n\t\treturn nil, errors.New(\"either GetUsages or Usages should be specified\")\n\t}\n\tvar getUsages func(interface{}) []certificates.KeyUsage\n\tif config.GetUsages != nil {\n\t\tgetUsages = config.GetUsages\n\t} else {\n\t\tgetUsages = func(interface{}) []certificates.KeyUsage { return config.Usages }\n\t}\n\tm := manager{\n\t\tstopCh: make(chan struct{}),\n\t\tclientsetFn: config.ClientsetFn,\n\t\tgetTemplate: getTemplate,\n\t\tdynamicTemplate: config.GetTemplate != nil,\n\t\tsignerName: config.SignerName,\n\t\trequestedCertificateLifetime: config.RequestedCertificateLifetime,\n\t\tgetUsages: getUsages,\n\t\tcertStore: config.CertificateStore,\n\t\tcert: cert,\n\t\tforceRotation: forceRotation,\n\t\tcertificateRotation: config.CertificateRotation,\n\t\tcertificateRenewFailure: config.CertificateRenewFailure,\n\t\tnow: time.Now,\n\t}\n\n\tname := config.Name\n\tif len(name) == 0 {\n\t\tname = m.signerName\n\t}\n\tif len(name) == 0 {\n\t\tusages := getUsages(nil)\n\t\tswitch {\n\t\tcase hasKeyUsage(usages, certificates.UsageClientAuth):\n\t\t\tname = string(certificates.UsageClientAuth)\n\t\tdefault:\n\t\t\tname = \"certificate\"\n\t\t}\n\t}\n\n\tm.name = name\n\tm.logf = config.Logf\n\tif m.logf == nil {\n\t\tm.logf = func(format string, args ...interface{}) { klog.V(2).Infof(format, args...) }\n\t}\n\n\treturn &m, nil\n}", "title": "" }, { "docid": "fa0662df31879394fd60e2fda57746a1", "score": "0.5050995", "text": "func NewManager(db hub.DB, opts ...func(m *Manager)) *Manager {\n\tm := &Manager{\n\t\tdb: db,\n\t\thelmIndexLoader: &HelmIndexLoader{},\n\t}\n\tfor _, o := range opts {\n\t\to(m)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "3f6b72a0bfe166b4f3ca567cd8b804a7", "score": "0.5049293", "text": "func NewManager(client vend.Client) *Manager {\n\treturn &Manager{client}\n}", "title": "" }, { "docid": "4b225023e51827fb85c6ed81e01485c8", "score": "0.5047605", "text": "func NewManager(students []Student) *Manager {\n\treturn &Manager{\n\t\twg: sync.WaitGroup{},\n\t\tstuList: students,\n\t}\n}", "title": "" }, { "docid": "ecf21ce52f543681bb808e460162e441", "score": "0.5046222", "text": "func NewManager(pg plugingetter.PluginGetter, secrets exec.SecretGetter) exec.VolumesManager {\n\tr := &volumes{\n\t\tvolumes: map[string]volumeState{},\n\t\tplugins: plugin.NewManager(pg, secrets),\n\t\tpendingVolumes: volumequeue.NewVolumeQueue(),\n\t}\n\tgo r.retryVolumes()\n\n\treturn r\n}", "title": "" }, { "docid": "adae144fbb713d64a50780792d652fc3", "score": "0.50459385", "text": "func NewManager(cfg *Config) (Manager, error) {\n\tvar (\n\t\tm = Manager{}\n\t\terr = func() error {\n\t\t\tfor lType, lCfg := range cfg.Lights {\n\t\t\t\tlights, err := newLights(lType, lCfg)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tfor _, l := range lights {\n\t\t\t\t\tm[l.GetName()] = l\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t}()\n\t)\n\tif err != nil {\n\t\tm.Close()\n\t\treturn nil, err\n\t}\n\treturn m, nil\n}", "title": "" }, { "docid": "152b886fc55ed906749e58d430dae70b", "score": "0.5044681", "text": "func (f *SplitFactory) Manager() *SplitManager {\n\treturn &SplitManager{\n\t\tsplitStorage: f.storages.splits,\n\t\tvalidator: inputValidation{logger: f.logger},\n\t\tlogger: f.logger,\n\t\tfactory: f,\n\t}\n}", "title": "" }, { "docid": "b8d71db4099becc2afbe50cf6806c727", "score": "0.50406337", "text": "func NewManager(sysName string, specManager *spec.SpecManager, bindVersion spec.BindVersion) *Manager {\n\treturn &Manager{\n\t\tsysName: sysName,\n\t\tspecManager: specManager,\n\t\tbindVersion: bindVersion,\n\t}\n}", "title": "" }, { "docid": "f5035d010b951275936a4c6f77543172", "score": "0.5040295", "text": "func newPackerManager(be Saver, key *crypto.Key) *packerManager {\n\treturn &packerManager{\n\t\tbe: be,\n\t\tkey: key,\n\t}\n}", "title": "" }, { "docid": "f64f52ebc7a3cf1e1f8e3c19b961a842", "score": "0.5040138", "text": "func CreateBlockchain(isGenesisNode bool, address, nodeID string) *Blockchain {\n\tdbFile := storage.GetDBFileName(nodeID)\n\tif util.ExitFile(dbFile) {\n\t\tfmt.Println(\"Blockchain already exists.\")\n\t\tos.Exit(1)\n\t}\n\n\tfmt.Println(\"CreateBlockchain Begin\")\n\n\n\tdb, err := bolt.Open(dbFile, 0600, nil)\n\tif err != nil {\n\t\tlog.Panic(\"Open db error\", err)\n\t}\n\n\t//create bolt block bucket\n\terr = storage.CreateBlockBucket(db)\n\tif err != nil {\n\t\tlog.Panic(\"CreateBlockBucket error\", err)\n\t}\n\n\tvar lastBlockHash []byte\n\tvar genesis *Block\n\tif isGenesisNode {\n\t\tgenesis = NewGenesisBlock(address)\n\n\t\terr =storage.SaveBlock(db, genesis.Hash, SerializeBlock(genesis))\n\t\tif err != nil {\n\t\t\tlog.Panic(\"SaveBlock error\", err)\n\t\t}else{\n\t\t\tlastBlockHash = genesis.Hash\n\t\t}\n\t}\n\n\n\n\tbc := Blockchain{\n\t\tlastBlockHash:lastBlockHash,\n\t\tdb:db,\n\t\tchainLock:new(sync.RWMutex),\n\t\torphanLock:new(sync.RWMutex),\n\t\torphanBlocks:make(map[hashx.Hash]*Block),\n\t\tprevOrphanBlocks:make(map[hashx.Hash][]*Block),\n\t\tminingQuit:make(chan struct{}),\n\t\tchainIndex:newChainIndex(db, nil),\n\t}\n\n\t//create block index bucket\n\tbc.createChainIndex(genesis)\n\n\n\tfmt.Println(\"CreateBlockchain Success!\")\n\tfmt.Println(fmt.Sprintf(\"lastBlockHash %x\", bc.lastBlockHash))\n\n\tif isGenesisNode {\n\t\t//Rebuild UTXO data\n\t\tbc.GetUTXOSet().Rebuild()\n\t}\n\n\treturn &bc\n}", "title": "" }, { "docid": "4579faea68c93b2636c4bf5ac8a4970f", "score": "0.50379544", "text": "func New(cfg *config.Config) settings.Manager {\n\ts := Store{\n\t\t//Logger: olog.NewLogger(\n\t\t//\tolog.Color(cfg.Log.Color),\n\t\t//\tolog.Pretty(cfg.Log.Pretty),\n\t\t//\tolog.Level(cfg.Log.Level),\n\t\t//\tolog.File(cfg.Log.File),\n\t\t//),\n\t}\n\n\tif _, err := os.Stat(cfg.DataPath); err != nil {\n\t\ts.Logger.Info().Msgf(\"creating container on %v\", cfg.DataPath)\n\t\terr = os.MkdirAll(cfg.DataPath, 0700)\n\n\t\tif err != nil {\n\t\t\ts.Logger.Err(err).Msgf(\"providing container on %v\", cfg.DataPath)\n\t\t}\n\t}\n\n\ts.dataPath = cfg.DataPath\n\treturn &s\n}", "title": "" }, { "docid": "855f6db86a5e73d55f1f7dbc4d05a351", "score": "0.5035131", "text": "func CreateBlockchain(address, nodeID string) *Blockchain {\n\n\tdbFile := fmt.Sprintf(dbFile, nodeID)//nodeID不同,文件名字就会不同\n\tif dbExists(dbFile) {\n\t\tfmt.Println(\"Blockchain already exists.\")\n\t\tos.Exit(1)\n\t}\n\n\n\n\tvar tip []byte\n\n\ttransaction:=NewCoinbaseTX(address,genesisCoinbaseData)\n\tgenesis := NewGenesisBlock([]*Transaction{transaction})\n\n\tdb, err := bolt.Open(dbFile, 0600, nil)\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\n\terr = db.Update(func(tx *bolt.Tx) error {\n\t\tb, err := tx.CreateBucket([]byte(blocksBucket))\n\t\tif err != nil {\n\t\t\tlog.Panic(err)\n\t\t}\n\n\t\terr = b.Put(genesis.Hash, genesis.Serialize())\n\t\tif err != nil {\n\t\t\tlog.Panic(err)\n\t\t}\n\n\t\terr = b.Put([]byte(\"l\"), genesis.Hash)\n\t\tif err != nil {\n\t\t\tlog.Panic(err)\n\t\t}\n\t\ttip = genesis.Hash\n\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\n\tbc := Blockchain{tip, db}\n\n\treturn &bc\n}", "title": "" }, { "docid": "049da677263ca814ad06a48aed7d934f", "score": "0.50321275", "text": "func CreateBlockFileInMapper(mapper Mapper) (*BlockFile, error) {\n\treturn CreateBlockFileInMapperWithSize(mapper, DefaultBlocksize)\n}", "title": "" }, { "docid": "fe66f28b31275a34e3afdbd5dcf1c317", "score": "0.5030112", "text": "func New(nodeID, clusterID string, isDev bool, adminUserInfo *config.AdminUser) *Manager {\n\tm := new(Manager)\n\tm.user = adminUserInfo\n\tm.quotas = model.UsageQuotas{MaxDatabases: 1, MaxProjects: 1}\n\tm.nodeID = nodeID\n\tm.clusterID = clusterID\n\tm.isProd = !isDev\n\treturn m\n}", "title": "" }, { "docid": "dd80e52b1f10a89188f7b3e297c927e6", "score": "0.5029768", "text": "func newStorageManager(cfg *storage.Config) (storage.Manager, error) {\n\tif len(cfg.DriverConfigs) != 2 {\n\t\treturn nil, fmt.Errorf(\"disk storage manager should have two driver, cfg's driver number is wrong : %v\", cfg)\n\t}\n\tdiskDriver, ok := storedriver.Get(local.DiskDriverName)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"can not find disk driver for hybrid storage manager, config is %v\", cfg)\n\t}\n\tmemoryDriver, ok := storedriver.Get(local.MemoryDriverName)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"can not find memory driver for hybrid storage manager, config %v\", cfg)\n\t}\n\tstorageMgr := &hybridStorageMgr{\n\t\tcfg: cfg,\n\t\tmemoryDriver: memoryDriver,\n\t\tdiskDriver: diskDriver,\n\t\thasShm: true,\n\t\tshmSwitch: newShmSwitch(),\n\t}\n\tgc.Register(\"hybridStorage\", cfg.GCInitialDelay, cfg.GCInterval, storageMgr)\n\treturn storageMgr, nil\n}", "title": "" }, { "docid": "6a5dab56004eb1689a777b18732066e8", "score": "0.5026647", "text": "func initGenFiles(\n\tconfig *testnetConfig,\n\tclientCtx client.Context,\n\tgenAccounts []types4.GenesisAccount,\n\tgenBalances []banktypes.Balance,\n\tchainId string,\n\tgenFiles []string,\n) error {\n\t// Generate default state and set the accounts in the genesis state\n\tappGenState := config.BasicAppManager.DefaultGenesis(config.Encoding.Marshaler)\n\tvar authGenState types4.GenesisState\n\tclientCtx.JSONMarshaler.MustUnmarshalJSON(appGenState[types4.ModuleName], &authGenState)\n\n\taccounts, err := types4.PackAccounts(genAccounts)\n\tif err != nil {\n\t\treturn err\n\t}\n\tauthGenState.Accounts = accounts\n\tappGenState[types4.ModuleName] = clientCtx.JSONMarshaler.MustMarshalJSON(&authGenState)\n\n\t// set the balances in the genesis state\n\tvar bankGenState banktypes.GenesisState\n\tclientCtx.JSONMarshaler.MustUnmarshalJSON(appGenState[banktypes.ModuleName], &bankGenState)\n\tbankGenState.Balances = genBalances\n\tappGenState[banktypes.ModuleName] = clientCtx.JSONMarshaler.MustMarshalJSON(&bankGenState)\n\n\t// save updated state for each node\n\tappGenStateJSON, err := json.MarshalIndent(appGenState, \"\", \" \")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// GenesisDoc defines the initial conditions for a tendermint blockchain, in particular its validator set.\n\tdoc := types3.GenesisDoc{\n\t\tChainID: chainId,\n\t\tAppState: appGenStateJSON,\n\t}\n\n\t// generate empty genesis files for each validator and save\n\tfor i := 0; i < config.NumValidators; i++ {\n\t\tif err := doc.SaveAs(genFiles[i]); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5e3d103989131ef1e51f16de0b772b1d", "score": "0.5025703", "text": "func NewManager(configMap string, config *kubevip.Config) (*Manager, error) {\n\tvar clientset *kubernetes.Clientset\n\tif OutSideCluster == false {\n\t\t// This will attempt to load the configuration when running within a POD\n\t\tcfg, err := rest.InClusterConfig()\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error creating kubernetes client config: %s\", err.Error())\n\t\t}\n\t\tclientset, err = kubernetes.NewForConfig(cfg)\n\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error creating kubernetes client: %s\", err.Error())\n\t\t}\n\t\t// use the current context in kubeconfig\n\t} else {\n\t\tconfig, err := clientcmd.BuildConfigFromFlags(\"\", filepath.Join(os.Getenv(\"HOME\"), \".kube\", \"config\"))\n\t\tif err != nil {\n\t\t\tpanic(err.Error())\n\t\t}\n\t\tclientset, err = kubernetes.NewForConfig(config)\n\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error creating kubernetes client: %s\", err.Error())\n\t\t}\n\t}\n\n\treturn &Manager{\n\t\tclientSet: clientset,\n\t\tconfigMap: configMap,\n\t\tconfig: config,\n\t}, nil\n}", "title": "" }, { "docid": "1f5235426c8eaefde7123276a1d6f381", "score": "0.50253296", "text": "func NewManager(self string) *Manager {\n\treturn &Manager{\n\t\tself: self,\n\t\tbyPath: make(map[string]*Imp),\n\t\tbyPkg: make(map[string][]*Imp),\n\t}\n}", "title": "" } ]
d6340243b3c59a3012d56ea99b31154d
Patch apply the non nil value of a SparseTrustedCA to the object.
[ { "docid": "9af5bc0aa9f7eccef28780daf096d34f", "score": "0.8218151", "text": "func (o *TrustedCA) Patch(sparse elemental.SparseIdentifiable) {\n\tif !sparse.Identity().IsEqual(o.Identity()) {\n\t\tpanic(\"cannot patch from a parse with different identity\")\n\t}\n\n\tso := sparse.(*SparseTrustedCA)\n\tif so.Certificate != nil {\n\t\to.Certificate = *so.Certificate\n\t}\n\tif so.Controller != nil {\n\t\to.Controller = *so.Controller\n\t}\n\tif so.Namespace != nil {\n\t\to.Namespace = *so.Namespace\n\t}\n\tif so.NamespaceID != nil {\n\t\to.NamespaceID = *so.NamespaceID\n\t}\n\tif so.Serialnumber != nil {\n\t\to.Serialnumber = *so.Serialnumber\n\t}\n\tif so.Type != nil {\n\t\to.Type = *so.Type\n\t}\n}", "title": "" } ]
[ { "docid": "e5a43395cf1fba3163cb4f58624205d7", "score": "0.6678075", "text": "func (o *ServiceCertificate) Patch(sparse elemental.SparseIdentifiable) {\n\tif !sparse.Identity().IsEqual(o.Identity()) {\n\t\tpanic(\"cannot patch from a parse with different identity\")\n\t}\n\n\tso := sparse.(*SparseServiceCertificate)\n\tif so.ID != nil {\n\t\to.ID = *so.ID\n\t}\n\tif so.Annotations != nil {\n\t\to.Annotations = *so.Annotations\n\t}\n\tif so.AssociatedTags != nil {\n\t\to.AssociatedTags = *so.AssociatedTags\n\t}\n\tif so.CreateIdempotencyKey != nil {\n\t\to.CreateIdempotencyKey = *so.CreateIdempotencyKey\n\t}\n\tif so.CreateTime != nil {\n\t\to.CreateTime = *so.CreateTime\n\t}\n\tif so.Description != nil {\n\t\to.Description = *so.Description\n\t}\n\tif so.Fingerprint != nil {\n\t\to.Fingerprint = *so.Fingerprint\n\t}\n\tif so.Name != nil {\n\t\to.Name = *so.Name\n\t}\n\tif so.Namespace != nil {\n\t\to.Namespace = *so.Namespace\n\t}\n\tif so.NormalizedTags != nil {\n\t\to.NormalizedTags = *so.NormalizedTags\n\t}\n\tif so.Private != nil {\n\t\to.Private = *so.Private\n\t}\n\tif so.Propagate != nil {\n\t\to.Propagate = *so.Propagate\n\t}\n\tif so.Protected != nil {\n\t\to.Protected = *so.Protected\n\t}\n\tif so.Public != nil {\n\t\to.Public = *so.Public\n\t}\n\tif so.UpdateIdempotencyKey != nil {\n\t\to.UpdateIdempotencyKey = *so.UpdateIdempotencyKey\n\t}\n\tif so.UpdateTime != nil {\n\t\to.UpdateTime = *so.UpdateTime\n\t}\n\tif so.ZHash != nil {\n\t\to.ZHash = *so.ZHash\n\t}\n\tif so.Zone != nil {\n\t\to.Zone = *so.Zone\n\t}\n}", "title": "" }, { "docid": "a7fcb33c9a12e9ea4fb21181fcf49eaa", "score": "0.59610677", "text": "func (o *LDAPProvider) Patch(sparse elemental.SparseIdentifiable) {\n\tif !sparse.Identity().IsEqual(o.Identity()) {\n\t\tpanic(\"cannot patch from a parse with different identity\")\n\t}\n\n\tso := sparse.(*SparseLDAPProvider)\n\tif so.ID != nil {\n\t\to.ID = *so.ID\n\t}\n\tif so.Address != nil {\n\t\to.Address = *so.Address\n\t}\n\tif so.Annotations != nil {\n\t\to.Annotations = *so.Annotations\n\t}\n\tif so.AssociatedTags != nil {\n\t\to.AssociatedTags = *so.AssociatedTags\n\t}\n\tif so.BaseDN != nil {\n\t\to.BaseDN = *so.BaseDN\n\t}\n\tif so.BindDN != nil {\n\t\to.BindDN = *so.BindDN\n\t}\n\tif so.BindPassword != nil {\n\t\to.BindPassword = *so.BindPassword\n\t}\n\tif so.BindSearchFilter != nil {\n\t\to.BindSearchFilter = *so.BindSearchFilter\n\t}\n\tif so.CertificateAuthority != nil {\n\t\to.CertificateAuthority = *so.CertificateAuthority\n\t}\n\tif so.ConnSecurityProtocol != nil {\n\t\to.ConnSecurityProtocol = *so.ConnSecurityProtocol\n\t}\n\tif so.CreateIdempotencyKey != nil {\n\t\to.CreateIdempotencyKey = *so.CreateIdempotencyKey\n\t}\n\tif so.CreateTime != nil {\n\t\to.CreateTime = *so.CreateTime\n\t}\n\tif so.Default != nil {\n\t\to.Default = *so.Default\n\t}\n\tif so.Description != nil {\n\t\to.Description = *so.Description\n\t}\n\tif so.IgnoredKeys != nil {\n\t\to.IgnoredKeys = *so.IgnoredKeys\n\t}\n\tif so.IncludedKeys != nil {\n\t\to.IncludedKeys = *so.IncludedKeys\n\t}\n\tif so.MigrationsLog != nil {\n\t\to.MigrationsLog = *so.MigrationsLog\n\t}\n\tif so.Name != nil {\n\t\to.Name = *so.Name\n\t}\n\tif so.Namespace != nil {\n\t\to.Namespace = *so.Namespace\n\t}\n\tif so.NormalizedTags != nil {\n\t\to.NormalizedTags = *so.NormalizedTags\n\t}\n\tif so.Protected != nil {\n\t\to.Protected = *so.Protected\n\t}\n\tif so.SubjectKey != nil {\n\t\to.SubjectKey = *so.SubjectKey\n\t}\n\tif so.UpdateIdempotencyKey != nil {\n\t\to.UpdateIdempotencyKey = *so.UpdateIdempotencyKey\n\t}\n\tif so.UpdateTime != nil {\n\t\to.UpdateTime = *so.UpdateTime\n\t}\n\tif so.ZHash != nil {\n\t\to.ZHash = *so.ZHash\n\t}\n\tif so.Zone != nil {\n\t\to.Zone = *so.Zone\n\t}\n}", "title": "" }, { "docid": "67b9d060c5b43d1e62681e6c2411a766", "score": "0.56891614", "text": "func (o *TrustedCA) ToSparse(fields ...string) elemental.SparseIdentifiable {\n\n\tif len(fields) == 0 {\n\t\t// nolint: goimports\n\t\treturn &SparseTrustedCA{\n\t\t\tCertificate: &o.Certificate,\n\t\t\tController: &o.Controller,\n\t\t\tNamespace: &o.Namespace,\n\t\t\tNamespaceID: &o.NamespaceID,\n\t\t\tSerialnumber: &o.Serialnumber,\n\t\t\tType: &o.Type,\n\t\t}\n\t}\n\n\tsp := &SparseTrustedCA{}\n\tfor _, f := range fields {\n\t\tswitch f {\n\t\tcase \"certificate\":\n\t\t\tsp.Certificate = &(o.Certificate)\n\t\tcase \"controller\":\n\t\t\tsp.Controller = &(o.Controller)\n\t\tcase \"namespace\":\n\t\t\tsp.Namespace = &(o.Namespace)\n\t\tcase \"namespaceID\":\n\t\t\tsp.NamespaceID = &(o.NamespaceID)\n\t\tcase \"serialnumber\":\n\t\t\tsp.Serialnumber = &(o.Serialnumber)\n\t\tcase \"type\":\n\t\t\tsp.Type = &(o.Type)\n\t\t}\n\t}\n\n\treturn sp\n}", "title": "" }, { "docid": "64237ecec446275f9455f36f71a63975", "score": "0.5649754", "text": "func (o *CloudGraph) Patch(sparse elemental.SparseIdentifiable) {\n\tif !sparse.Identity().IsEqual(o.Identity()) {\n\t\tpanic(\"cannot patch from a parse with different identity\")\n\t}\n\n\tso := sparse.(*SparseCloudGraph)\n\tif so.InternalEdges != nil {\n\t\to.InternalEdges = *so.InternalEdges\n\t}\n\tif so.Nodes != nil {\n\t\to.Nodes = *so.Nodes\n\t}\n\tif so.Paths != nil {\n\t\to.Paths = *so.Paths\n\t}\n\tif so.PublicEdges != nil {\n\t\to.PublicEdges = *so.PublicEdges\n\t}\n\tif so.Query != nil {\n\t\to.Query = so.Query\n\t}\n\tif so.SourceDestinationMap != nil {\n\t\to.SourceDestinationMap = *so.SourceDestinationMap\n\t}\n}", "title": "" }, { "docid": "c1c8cbcc3f8c4452d494c21e7362641c", "score": "0.5631835", "text": "func (o *SuggestedPolicy) Patch(sparse elemental.SparseIdentifiable) {\n\tif !sparse.Identity().IsEqual(o.Identity()) {\n\t\tpanic(\"cannot patch from a parse with different identity\")\n\t}\n\n\tso := sparse.(*SparseSuggestedPolicy)\n\tif so.NetworkAccessPolicies != nil {\n\t\to.NetworkAccessPolicies = *so.NetworkAccessPolicies\n\t}\n}", "title": "" }, { "docid": "6910d1ef983e470f727b16a5d27d00c5", "score": "0.5571287", "text": "func (o *HealthCheck) Patch(sparse elemental.SparseIdentifiable) {\n\tif !sparse.Identity().IsEqual(o.Identity()) {\n\t\tpanic(\"cannot patch from a parse with different identity\")\n\t}\n\n\tso := sparse.(*SparseHealthCheck)\n\tif so.Alerts != nil {\n\t\to.Alerts = *so.Alerts\n\t}\n\tif so.Name != nil {\n\t\to.Name = *so.Name\n\t}\n\tif so.ResponseTime != nil {\n\t\to.ResponseTime = *so.ResponseTime\n\t}\n\tif so.Status != nil {\n\t\to.Status = *so.Status\n\t}\n\tif so.Type != nil {\n\t\to.Type = *so.Type\n\t}\n}", "title": "" }, { "docid": "e9b1aaa7ea1fca84c9e848b7b887427b", "score": "0.55586207", "text": "func (o *PingProbe) Patch(sparse elemental.SparseIdentifiable) {\n\tif !sparse.Identity().IsEqual(o.Identity()) {\n\t\tpanic(\"cannot patch from a parse with different identity\")\n\t}\n\n\tso := sparse.(*SparsePingProbe)\n\tif so.ACLPolicyAction != nil {\n\t\to.ACLPolicyAction = *so.ACLPolicyAction\n\t}\n\tif so.ACLPolicyID != nil {\n\t\to.ACLPolicyID = *so.ACLPolicyID\n\t}\n\tif so.ID != nil {\n\t\to.ID = *so.ID\n\t}\n\tif so.RTT != nil {\n\t\to.RTT = *so.RTT\n\t}\n\tif so.ApplicationListening != nil {\n\t\to.ApplicationListening = *so.ApplicationListening\n\t}\n\tif so.Claims != nil {\n\t\to.Claims = *so.Claims\n\t}\n\tif so.ClaimsType != nil {\n\t\to.ClaimsType = *so.ClaimsType\n\t}\n\tif so.CreateTime != nil {\n\t\to.CreateTime = *so.CreateTime\n\t}\n\tif so.EnforcerID != nil {\n\t\to.EnforcerID = *so.EnforcerID\n\t}\n\tif so.EnforcerNamespace != nil {\n\t\to.EnforcerNamespace = *so.EnforcerNamespace\n\t}\n\tif so.EnforcerVersion != nil {\n\t\to.EnforcerVersion = *so.EnforcerVersion\n\t}\n\tif so.Error != nil {\n\t\to.Error = *so.Error\n\t}\n\tif so.ExcludedNetworks != nil {\n\t\to.ExcludedNetworks = *so.ExcludedNetworks\n\t}\n\tif so.FourTuple != nil {\n\t\to.FourTuple = *so.FourTuple\n\t}\n\tif so.IsServer != nil {\n\t\to.IsServer = *so.IsServer\n\t}\n\tif so.IterationIndex != nil {\n\t\to.IterationIndex = *so.IterationIndex\n\t}\n\tif so.MigrationsLog != nil {\n\t\to.MigrationsLog = *so.MigrationsLog\n\t}\n\tif so.Namespace != nil {\n\t\to.Namespace = *so.Namespace\n\t}\n\tif so.PayloadSize != nil {\n\t\to.PayloadSize = *so.PayloadSize\n\t}\n\tif so.PayloadSizeType != nil {\n\t\to.PayloadSizeType = *so.PayloadSizeType\n\t}\n\tif so.PeerCertExpiry != nil {\n\t\to.PeerCertExpiry = *so.PeerCertExpiry\n\t}\n\tif so.PeerCertIssuer != nil {\n\t\to.PeerCertIssuer = *so.PeerCertIssuer\n\t}\n\tif so.PeerCertSubject != nil {\n\t\to.PeerCertSubject = *so.PeerCertSubject\n\t}\n\tif so.PingID != nil {\n\t\to.PingID = *so.PingID\n\t}\n\tif so.PolicyAction != nil {\n\t\to.PolicyAction = *so.PolicyAction\n\t}\n\tif so.PolicyID != nil {\n\t\to.PolicyID = *so.PolicyID\n\t}\n\tif so.PolicyNamespace != nil {\n\t\to.PolicyNamespace = *so.PolicyNamespace\n\t}\n\tif so.ProcessingUnitID != nil {\n\t\to.ProcessingUnitID = *so.ProcessingUnitID\n\t}\n\tif so.Protocol != nil {\n\t\to.Protocol = *so.Protocol\n\t}\n\tif so.RemoteController != nil {\n\t\to.RemoteController = *so.RemoteController\n\t}\n\tif so.RemoteEndpointType != nil {\n\t\to.RemoteEndpointType = *so.RemoteEndpointType\n\t}\n\tif so.RemoteNamespace != nil {\n\t\to.RemoteNamespace = *so.RemoteNamespace\n\t}\n\tif so.RemoteNamespaceType != nil {\n\t\to.RemoteNamespaceType = *so.RemoteNamespaceType\n\t}\n\tif so.RemoteProcessingUnitID != nil {\n\t\to.RemoteProcessingUnitID = *so.RemoteProcessingUnitID\n\t}\n\tif so.SeqNum != nil {\n\t\to.SeqNum = *so.SeqNum\n\t}\n\tif so.ServiceID != nil {\n\t\to.ServiceID = *so.ServiceID\n\t}\n\tif so.ServiceType != nil {\n\t\to.ServiceType = *so.ServiceType\n\t}\n\tif so.TargetTCPNetworks != nil {\n\t\to.TargetTCPNetworks = *so.TargetTCPNetworks\n\t}\n\tif so.Type != nil {\n\t\to.Type = *so.Type\n\t}\n\tif so.UpdateTime != nil {\n\t\to.UpdateTime = *so.UpdateTime\n\t}\n\tif so.ZHash != nil {\n\t\to.ZHash = *so.ZHash\n\t}\n\tif so.Zone != nil {\n\t\to.Zone = *so.Zone\n\t}\n}", "title": "" }, { "docid": "7b5ac6d20898f92ca677e288d7acc13b", "score": "0.5510257", "text": "func (o *RemoteProcessor) Patch(sparse elemental.SparseIdentifiable) {\n\tif !sparse.Identity().IsEqual(o.Identity()) {\n\t\tpanic(\"cannot patch from a parse with different identity\")\n\t}\n\n\tso := sparse.(*SparseRemoteProcessor)\n\tif so.Claims != nil {\n\t\to.Claims = *so.Claims\n\t}\n\tif so.Input != nil {\n\t\to.Input = *so.Input\n\t}\n\tif so.Mode != nil {\n\t\to.Mode = *so.Mode\n\t}\n\tif so.Namespace != nil {\n\t\to.Namespace = *so.Namespace\n\t}\n\tif so.Operation != nil {\n\t\to.Operation = *so.Operation\n\t}\n\tif so.Output != nil {\n\t\to.Output = *so.Output\n\t}\n\tif so.RequestID != nil {\n\t\to.RequestID = *so.RequestID\n\t}\n\tif so.TargetIdentity != nil {\n\t\to.TargetIdentity = *so.TargetIdentity\n\t}\n}", "title": "" }, { "docid": "eaf95f106d2e89b627f8c0aa27bd2a9f", "score": "0.5398216", "text": "func (o *Report) Patch(sparse elemental.SparseIdentifiable) {\n\tif !sparse.Identity().IsEqual(o.Identity()) {\n\t\tpanic(\"cannot patch from a parse with different identity\")\n\t}\n\n\tso := sparse.(*SparseReport)\n\tif so.Fields != nil {\n\t\to.Fields = *so.Fields\n\t}\n\tif so.Kind != nil {\n\t\to.Kind = *so.Kind\n\t}\n\tif so.Tags != nil {\n\t\to.Tags = *so.Tags\n\t}\n\tif so.Timestamp != nil {\n\t\to.Timestamp = *so.Timestamp\n\t}\n\tif so.Value != nil {\n\t\to.Value = *so.Value\n\t}\n}", "title": "" }, { "docid": "3fa2389a209dd7c00e66ed32e44c2db1", "score": "0.5371988", "text": "func (o *Automation) Patch(sparse elemental.SparseIdentifiable) {\n\tif !sparse.Identity().IsEqual(o.Identity()) {\n\t\tpanic(\"cannot patch from a parse with different identity\")\n\t}\n\n\tso := sparse.(*SparseAutomation)\n\tif so.ID != nil {\n\t\to.ID = *so.ID\n\t}\n\tif so.Actions != nil {\n\t\to.Actions = *so.Actions\n\t}\n\tif so.Annotations != nil {\n\t\to.Annotations = *so.Annotations\n\t}\n\tif so.AporetoToken != nil {\n\t\to.AporetoToken = *so.AporetoToken\n\t}\n\tif so.AppCredential != nil {\n\t\to.AppCredential = *so.AppCredential\n\t}\n\tif so.AssociatedTags != nil {\n\t\to.AssociatedTags = *so.AssociatedTags\n\t}\n\tif so.Condition != nil {\n\t\to.Condition = *so.Condition\n\t}\n\tif so.CreateIdempotencyKey != nil {\n\t\to.CreateIdempotencyKey = *so.CreateIdempotencyKey\n\t}\n\tif so.CreateTime != nil {\n\t\to.CreateTime = *so.CreateTime\n\t}\n\tif so.Description != nil {\n\t\to.Description = *so.Description\n\t}\n\tif so.Disabled != nil {\n\t\to.Disabled = *so.Disabled\n\t}\n\tif so.Entitlements != nil {\n\t\to.Entitlements = *so.Entitlements\n\t}\n\tif so.Errors != nil {\n\t\to.Errors = *so.Errors\n\t}\n\tif so.Events != nil {\n\t\to.Events = *so.Events\n\t}\n\tif so.ImmediateExecution != nil {\n\t\to.ImmediateExecution = *so.ImmediateExecution\n\t}\n\tif so.LastExecTime != nil {\n\t\to.LastExecTime = *so.LastExecTime\n\t}\n\tif so.MigrationsLog != nil {\n\t\to.MigrationsLog = *so.MigrationsLog\n\t}\n\tif so.Name != nil {\n\t\to.Name = *so.Name\n\t}\n\tif so.Namespace != nil {\n\t\to.Namespace = *so.Namespace\n\t}\n\tif so.NormalizedTags != nil {\n\t\to.NormalizedTags = *so.NormalizedTags\n\t}\n\tif so.Parameters != nil {\n\t\to.Parameters = *so.Parameters\n\t}\n\tif so.Protected != nil {\n\t\to.Protected = *so.Protected\n\t}\n\tif so.Schedule != nil {\n\t\to.Schedule = *so.Schedule\n\t}\n\tif so.Signature != nil {\n\t\to.Signature = *so.Signature\n\t}\n\tif so.Stdout != nil {\n\t\to.Stdout = *so.Stdout\n\t}\n\tif so.Token != nil {\n\t\to.Token = *so.Token\n\t}\n\tif so.TokenRenew != nil {\n\t\to.TokenRenew = *so.TokenRenew\n\t}\n\tif so.Trigger != nil {\n\t\to.Trigger = *so.Trigger\n\t}\n\tif so.UpdateIdempotencyKey != nil {\n\t\to.UpdateIdempotencyKey = *so.UpdateIdempotencyKey\n\t}\n\tif so.UpdateTime != nil {\n\t\to.UpdateTime = *so.UpdateTime\n\t}\n\tif so.ZHash != nil {\n\t\to.ZHash = *so.ZHash\n\t}\n\tif so.Zone != nil {\n\t\to.Zone = *so.Zone\n\t}\n}", "title": "" }, { "docid": "4543a7f5e34762618457f34262b92caa", "score": "0.5334813", "text": "func (o TrustedCAsList) ToSparse(fields ...string) elemental.Identifiables {\n\n\tout := make(SparseTrustedCAsList, len(o))\n\tfor i := 0; i < len(o); i++ {\n\t\tout[i] = o[i].ToSparse(fields...).(*SparseTrustedCA)\n\t}\n\n\treturn out\n}", "title": "" }, { "docid": "521324647d8b88220caa5540c43c22f5", "score": "0.5310992", "text": "func (o *ContainerImage) Patch(sparse elemental.SparseIdentifiable) {\n\tif !sparse.Identity().IsEqual(o.Identity()) {\n\t\tpanic(\"cannot patch from a parse with different identity\")\n\t}\n\n\tso := sparse.(*SparseContainerImage)\n\tif so.ID != nil {\n\t\to.ID = *so.ID\n\t}\n\tif so.Annotations != nil {\n\t\to.Annotations = *so.Annotations\n\t}\n\tif so.AssociatedTags != nil {\n\t\to.AssociatedTags = *so.AssociatedTags\n\t}\n\tif so.ComplianceRiskScore != nil {\n\t\to.ComplianceRiskScore = *so.ComplianceRiskScore\n\t}\n\tif so.CreateIdempotencyKey != nil {\n\t\to.CreateIdempotencyKey = *so.CreateIdempotencyKey\n\t}\n\tif so.CreateTime != nil {\n\t\to.CreateTime = *so.CreateTime\n\t}\n\tif so.CriticalComplianceIssueCount != nil {\n\t\to.CriticalComplianceIssueCount = *so.CriticalComplianceIssueCount\n\t}\n\tif so.CriticalVulnerabilityCount != nil {\n\t\to.CriticalVulnerabilityCount = *so.CriticalVulnerabilityCount\n\t}\n\tif so.Description != nil {\n\t\to.Description = *so.Description\n\t}\n\tif so.Distro != nil {\n\t\to.Distro = *so.Distro\n\t}\n\tif so.ExternalID != nil {\n\t\to.ExternalID = *so.ExternalID\n\t}\n\tif so.HighComplianceIssueCount != nil {\n\t\to.HighComplianceIssueCount = *so.HighComplianceIssueCount\n\t}\n\tif so.HighVulnerabilityCount != nil {\n\t\to.HighVulnerabilityCount = *so.HighVulnerabilityCount\n\t}\n\tif so.LowComplianceIssueCount != nil {\n\t\to.LowComplianceIssueCount = *so.LowComplianceIssueCount\n\t}\n\tif so.LowVulnerabilityCount != nil {\n\t\to.LowVulnerabilityCount = *so.LowVulnerabilityCount\n\t}\n\tif so.MediumComplianceIssueCount != nil {\n\t\to.MediumComplianceIssueCount = *so.MediumComplianceIssueCount\n\t}\n\tif so.MediumVulnerabilityCount != nil {\n\t\to.MediumVulnerabilityCount = *so.MediumVulnerabilityCount\n\t}\n\tif so.Metadata != nil {\n\t\to.Metadata = *so.Metadata\n\t}\n\tif so.MigrationsLog != nil {\n\t\to.MigrationsLog = *so.MigrationsLog\n\t}\n\tif so.Name != nil {\n\t\to.Name = *so.Name\n\t}\n\tif so.Namespace != nil {\n\t\to.Namespace = *so.Namespace\n\t}\n\tif so.NormalizedTags != nil {\n\t\to.NormalizedTags = *so.NormalizedTags\n\t}\n\tif so.OsDistro != nil {\n\t\to.OsDistro = *so.OsDistro\n\t}\n\tif so.OsDistroRelease != nil {\n\t\to.OsDistroRelease = *so.OsDistroRelease\n\t}\n\tif so.Protected != nil {\n\t\to.Protected = *so.Protected\n\t}\n\tif so.TotalComplianceIssueCount != nil {\n\t\to.TotalComplianceIssueCount = *so.TotalComplianceIssueCount\n\t}\n\tif so.TotalVulnerabilityCount != nil {\n\t\to.TotalVulnerabilityCount = *so.TotalVulnerabilityCount\n\t}\n\tif so.UpdateIdempotencyKey != nil {\n\t\to.UpdateIdempotencyKey = *so.UpdateIdempotencyKey\n\t}\n\tif so.UpdateTime != nil {\n\t\to.UpdateTime = *so.UpdateTime\n\t}\n\tif so.VulnerabilitiesCount != nil {\n\t\to.VulnerabilitiesCount = *so.VulnerabilitiesCount\n\t}\n\tif so.VulnerabilityRiskScore != nil {\n\t\to.VulnerabilityRiskScore = *so.VulnerabilityRiskScore\n\t}\n\tif so.ZHash != nil {\n\t\to.ZHash = *so.ZHash\n\t}\n\tif so.Zone != nil {\n\t\to.Zone = *so.Zone\n\t}\n}", "title": "" }, { "docid": "ea205389cf977a47a6f2401063967c36", "score": "0.52059525", "text": "func (o *SparseTrustedCA) DeepCopy() *SparseTrustedCA {\n\n\tif o == nil {\n\t\treturn nil\n\t}\n\n\tout := &SparseTrustedCA{}\n\to.DeepCopyInto(out)\n\n\treturn out\n}", "title": "" }, { "docid": "64b141321e19d7af3819c2ea01446160", "score": "0.5204112", "text": "func (tc *TeleportClient) UpdateTrustedCA(ctx context.Context, getter services.AuthorityGetter) error {\n\tctx, span := tc.Tracer.Start(\n\t\tctx,\n\t\t\"teleportClient/UpdateTrustedCA\",\n\t\toteltrace.WithSpanKind(oteltrace.SpanKindClient),\n\t)\n\tdefer span.End()\n\n\tif tc.localAgent == nil {\n\t\treturn trace.BadParameter(\"UpdateTrustedCA called on a client without localAgent\")\n\t}\n\t// Get the list of host certificates that this cluster knows about.\n\thostCerts, err := getter.GetCertAuthorities(ctx, types.HostCA, false)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\ttrustedCerts := auth.AuthoritiesToTrustedCerts(hostCerts)\n\n\t// Update the CA pool and known hosts for all CAs the cluster knows about.\n\terr = tc.localAgent.SaveTrustedCerts(trustedCerts)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b65abfe0605d85726b7e38c5f354f7c6", "score": "0.5115668", "text": "func (o *SparseTrustedCA) ToPlain() elemental.PlainIdentifiable {\n\n\tout := NewTrustedCA()\n\tif o.Certificate != nil {\n\t\tout.Certificate = *o.Certificate\n\t}\n\tif o.Controller != nil {\n\t\tout.Controller = *o.Controller\n\t}\n\tif o.Namespace != nil {\n\t\tout.Namespace = *o.Namespace\n\t}\n\tif o.NamespaceID != nil {\n\t\tout.NamespaceID = *o.NamespaceID\n\t}\n\tif o.Serialnumber != nil {\n\t\tout.Serialnumber = *o.Serialnumber\n\t}\n\tif o.Type != nil {\n\t\tout.Type = *o.Type\n\t}\n\n\treturn out\n}", "title": "" }, { "docid": "7b2b66c1a27598c0daa3f821ebb36fe6", "score": "0.503365", "text": "func (b *ClientSelectorBuilder) TrustedCA(value interface{}) *ClientSelectorBuilder {\n\tif value != nil {\n\t\tb.trustedCAs = append(b.trustedCAs, value)\n\t}\n\treturn b\n}", "title": "" }, { "docid": "9c2b1afb2d09fe901ccd43239b79e713", "score": "0.4985508", "text": "func NewSparseTrustedCA() *SparseTrustedCA {\n\treturn &SparseTrustedCA{}\n}", "title": "" }, { "docid": "9255e1c9200ccd0612924e9597cc4d07", "score": "0.4836446", "text": "func (o *ServiceCertificate) ToSparse(fields ...string) elemental.SparseIdentifiable {\n\n\tif len(fields) == 0 {\n\t\t// nolint: goimports\n\t\treturn &SparseServiceCertificate{\n\t\t\tID: &o.ID,\n\t\t\tAnnotations: &o.Annotations,\n\t\t\tAssociatedTags: &o.AssociatedTags,\n\t\t\tCreateIdempotencyKey: &o.CreateIdempotencyKey,\n\t\t\tCreateTime: &o.CreateTime,\n\t\t\tDescription: &o.Description,\n\t\t\tFingerprint: &o.Fingerprint,\n\t\t\tName: &o.Name,\n\t\t\tNamespace: &o.Namespace,\n\t\t\tNormalizedTags: &o.NormalizedTags,\n\t\t\tPrivate: &o.Private,\n\t\t\tPropagate: &o.Propagate,\n\t\t\tProtected: &o.Protected,\n\t\t\tPublic: &o.Public,\n\t\t\tUpdateIdempotencyKey: &o.UpdateIdempotencyKey,\n\t\t\tUpdateTime: &o.UpdateTime,\n\t\t\tZHash: &o.ZHash,\n\t\t\tZone: &o.Zone,\n\t\t}\n\t}\n\n\tsp := &SparseServiceCertificate{}\n\tfor _, f := range fields {\n\t\tswitch f {\n\t\tcase \"ID\":\n\t\t\tsp.ID = &(o.ID)\n\t\tcase \"annotations\":\n\t\t\tsp.Annotations = &(o.Annotations)\n\t\tcase \"associatedTags\":\n\t\t\tsp.AssociatedTags = &(o.AssociatedTags)\n\t\tcase \"createIdempotencyKey\":\n\t\t\tsp.CreateIdempotencyKey = &(o.CreateIdempotencyKey)\n\t\tcase \"createTime\":\n\t\t\tsp.CreateTime = &(o.CreateTime)\n\t\tcase \"description\":\n\t\t\tsp.Description = &(o.Description)\n\t\tcase \"fingerprint\":\n\t\t\tsp.Fingerprint = &(o.Fingerprint)\n\t\tcase \"name\":\n\t\t\tsp.Name = &(o.Name)\n\t\tcase \"namespace\":\n\t\t\tsp.Namespace = &(o.Namespace)\n\t\tcase \"normalizedTags\":\n\t\t\tsp.NormalizedTags = &(o.NormalizedTags)\n\t\tcase \"private\":\n\t\t\tsp.Private = &(o.Private)\n\t\tcase \"propagate\":\n\t\t\tsp.Propagate = &(o.Propagate)\n\t\tcase \"protected\":\n\t\t\tsp.Protected = &(o.Protected)\n\t\tcase \"public\":\n\t\t\tsp.Public = &(o.Public)\n\t\tcase \"updateIdempotencyKey\":\n\t\t\tsp.UpdateIdempotencyKey = &(o.UpdateIdempotencyKey)\n\t\tcase \"updateTime\":\n\t\t\tsp.UpdateTime = &(o.UpdateTime)\n\t\tcase \"zHash\":\n\t\t\tsp.ZHash = &(o.ZHash)\n\t\tcase \"zone\":\n\t\t\tsp.Zone = &(o.Zone)\n\t\t}\n\t}\n\n\treturn sp\n}", "title": "" }, { "docid": "ceb7122474e783eaac0d94bcc12f58ae", "score": "0.476668", "text": "func (o SparseTrustedCAsList) Identity() elemental.Identity {\n\n\treturn TrustedCAIdentity\n}", "title": "" }, { "docid": "2bf9e03da069ba7669eae71aa1db5ec6", "score": "0.47209275", "text": "func (r *WindowsPhone81TrustedRootCertificateRequest) Update(ctx context.Context, reqObj *WindowsPhone81TrustedRootCertificate) error {\n\treturn r.JSONRequest(ctx, \"PATCH\", \"\", reqObj, nil)\n}", "title": "" }, { "docid": "e74e1872b1c1b328b7928f12af12d9b3", "score": "0.4696534", "text": "func (o *SparseTrustedCA) Identity() elemental.Identity {\n\n\treturn TrustedCAIdentity\n}", "title": "" }, { "docid": "36640971e2d0a8f155d2ffe5f8bdd1ce", "score": "0.46308428", "text": "func (k Keeper) SetTrust(ctx sdk.Context, trustor, trusting sdk.AccAddress) {\n\tstore := ctx.KVStore(k.storeKey)\n\tbz := k.cdc.MustMarshalBinary(Trust{Trusting: trusting, Trustor: trustor})\n\tstore.Set(KeyTrust(trustor, trusting), bz)\n}", "title": "" }, { "docid": "730b628b7170d6c38857255a48b3da2b", "score": "0.46041527", "text": "func (o *SparseServiceCertificate) SetBSON(raw bson.Raw) error {\n\n\tif o == nil {\n\t\treturn nil\n\t}\n\n\ts := &mongoAttributesSparseServiceCertificate{}\n\tif err := raw.Unmarshal(s); err != nil {\n\t\treturn err\n\t}\n\n\tid := s.ID.Hex()\n\to.ID = &id\n\tif s.Annotations != nil {\n\t\to.Annotations = s.Annotations\n\t}\n\tif s.AssociatedTags != nil {\n\t\to.AssociatedTags = s.AssociatedTags\n\t}\n\tif s.CreateIdempotencyKey != nil {\n\t\to.CreateIdempotencyKey = s.CreateIdempotencyKey\n\t}\n\tif s.CreateTime != nil {\n\t\to.CreateTime = s.CreateTime\n\t}\n\tif s.Description != nil {\n\t\to.Description = s.Description\n\t}\n\tif s.Fingerprint != nil {\n\t\to.Fingerprint = s.Fingerprint\n\t}\n\tif s.Name != nil {\n\t\to.Name = s.Name\n\t}\n\tif s.Namespace != nil {\n\t\to.Namespace = s.Namespace\n\t}\n\tif s.NormalizedTags != nil {\n\t\to.NormalizedTags = s.NormalizedTags\n\t}\n\tif s.Private != nil {\n\t\to.Private = s.Private\n\t}\n\tif s.Propagate != nil {\n\t\to.Propagate = s.Propagate\n\t}\n\tif s.Protected != nil {\n\t\to.Protected = s.Protected\n\t}\n\tif s.Public != nil {\n\t\to.Public = s.Public\n\t}\n\tif s.UpdateIdempotencyKey != nil {\n\t\to.UpdateIdempotencyKey = s.UpdateIdempotencyKey\n\t}\n\tif s.UpdateTime != nil {\n\t\to.UpdateTime = s.UpdateTime\n\t}\n\tif s.ZHash != nil {\n\t\to.ZHash = s.ZHash\n\t}\n\tif s.Zone != nil {\n\t\to.Zone = s.Zone\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "961bf9e522481d705e899bba1231ca7a", "score": "0.4598798", "text": "func (o *SparseServiceCertificate) ToPlain() elemental.PlainIdentifiable {\n\n\tout := NewServiceCertificate()\n\tif o.ID != nil {\n\t\tout.ID = *o.ID\n\t}\n\tif o.Annotations != nil {\n\t\tout.Annotations = *o.Annotations\n\t}\n\tif o.AssociatedTags != nil {\n\t\tout.AssociatedTags = *o.AssociatedTags\n\t}\n\tif o.CreateIdempotencyKey != nil {\n\t\tout.CreateIdempotencyKey = *o.CreateIdempotencyKey\n\t}\n\tif o.CreateTime != nil {\n\t\tout.CreateTime = *o.CreateTime\n\t}\n\tif o.Description != nil {\n\t\tout.Description = *o.Description\n\t}\n\tif o.Fingerprint != nil {\n\t\tout.Fingerprint = *o.Fingerprint\n\t}\n\tif o.Name != nil {\n\t\tout.Name = *o.Name\n\t}\n\tif o.Namespace != nil {\n\t\tout.Namespace = *o.Namespace\n\t}\n\tif o.NormalizedTags != nil {\n\t\tout.NormalizedTags = *o.NormalizedTags\n\t}\n\tif o.Private != nil {\n\t\tout.Private = *o.Private\n\t}\n\tif o.Propagate != nil {\n\t\tout.Propagate = *o.Propagate\n\t}\n\tif o.Protected != nil {\n\t\tout.Protected = *o.Protected\n\t}\n\tif o.Public != nil {\n\t\tout.Public = *o.Public\n\t}\n\tif o.UpdateIdempotencyKey != nil {\n\t\tout.UpdateIdempotencyKey = *o.UpdateIdempotencyKey\n\t}\n\tif o.UpdateTime != nil {\n\t\tout.UpdateTime = *o.UpdateTime\n\t}\n\tif o.ZHash != nil {\n\t\tout.ZHash = *o.ZHash\n\t}\n\tif o.Zone != nil {\n\t\tout.Zone = *o.Zone\n\t}\n\n\treturn out\n}", "title": "" }, { "docid": "6cd3707e8f4c25c0b04c4c05dd5ad614", "score": "0.459406", "text": "func (o *LDAPProvider) ToSparse(fields ...string) elemental.SparseIdentifiable {\n\n\tif len(fields) == 0 {\n\t\t// nolint: goimports\n\t\treturn &SparseLDAPProvider{\n\t\t\tID: &o.ID,\n\t\t\tAddress: &o.Address,\n\t\t\tAnnotations: &o.Annotations,\n\t\t\tAssociatedTags: &o.AssociatedTags,\n\t\t\tBaseDN: &o.BaseDN,\n\t\t\tBindDN: &o.BindDN,\n\t\t\tBindPassword: &o.BindPassword,\n\t\t\tBindSearchFilter: &o.BindSearchFilter,\n\t\t\tCertificateAuthority: &o.CertificateAuthority,\n\t\t\tConnSecurityProtocol: &o.ConnSecurityProtocol,\n\t\t\tCreateIdempotencyKey: &o.CreateIdempotencyKey,\n\t\t\tCreateTime: &o.CreateTime,\n\t\t\tDefault: &o.Default,\n\t\t\tDescription: &o.Description,\n\t\t\tIgnoredKeys: &o.IgnoredKeys,\n\t\t\tIncludedKeys: &o.IncludedKeys,\n\t\t\tMigrationsLog: &o.MigrationsLog,\n\t\t\tName: &o.Name,\n\t\t\tNamespace: &o.Namespace,\n\t\t\tNormalizedTags: &o.NormalizedTags,\n\t\t\tProtected: &o.Protected,\n\t\t\tSubjectKey: &o.SubjectKey,\n\t\t\tUpdateIdempotencyKey: &o.UpdateIdempotencyKey,\n\t\t\tUpdateTime: &o.UpdateTime,\n\t\t\tZHash: &o.ZHash,\n\t\t\tZone: &o.Zone,\n\t\t}\n\t}\n\n\tsp := &SparseLDAPProvider{}\n\tfor _, f := range fields {\n\t\tswitch f {\n\t\tcase \"ID\":\n\t\t\tsp.ID = &(o.ID)\n\t\tcase \"address\":\n\t\t\tsp.Address = &(o.Address)\n\t\tcase \"annotations\":\n\t\t\tsp.Annotations = &(o.Annotations)\n\t\tcase \"associatedTags\":\n\t\t\tsp.AssociatedTags = &(o.AssociatedTags)\n\t\tcase \"baseDN\":\n\t\t\tsp.BaseDN = &(o.BaseDN)\n\t\tcase \"bindDN\":\n\t\t\tsp.BindDN = &(o.BindDN)\n\t\tcase \"bindPassword\":\n\t\t\tsp.BindPassword = &(o.BindPassword)\n\t\tcase \"bindSearchFilter\":\n\t\t\tsp.BindSearchFilter = &(o.BindSearchFilter)\n\t\tcase \"certificateAuthority\":\n\t\t\tsp.CertificateAuthority = &(o.CertificateAuthority)\n\t\tcase \"connSecurityProtocol\":\n\t\t\tsp.ConnSecurityProtocol = &(o.ConnSecurityProtocol)\n\t\tcase \"createIdempotencyKey\":\n\t\t\tsp.CreateIdempotencyKey = &(o.CreateIdempotencyKey)\n\t\tcase \"createTime\":\n\t\t\tsp.CreateTime = &(o.CreateTime)\n\t\tcase \"default\":\n\t\t\tsp.Default = &(o.Default)\n\t\tcase \"description\":\n\t\t\tsp.Description = &(o.Description)\n\t\tcase \"ignoredKeys\":\n\t\t\tsp.IgnoredKeys = &(o.IgnoredKeys)\n\t\tcase \"includedKeys\":\n\t\t\tsp.IncludedKeys = &(o.IncludedKeys)\n\t\tcase \"migrationsLog\":\n\t\t\tsp.MigrationsLog = &(o.MigrationsLog)\n\t\tcase \"name\":\n\t\t\tsp.Name = &(o.Name)\n\t\tcase \"namespace\":\n\t\t\tsp.Namespace = &(o.Namespace)\n\t\tcase \"normalizedTags\":\n\t\t\tsp.NormalizedTags = &(o.NormalizedTags)\n\t\tcase \"protected\":\n\t\t\tsp.Protected = &(o.Protected)\n\t\tcase \"subjectKey\":\n\t\t\tsp.SubjectKey = &(o.SubjectKey)\n\t\tcase \"updateIdempotencyKey\":\n\t\t\tsp.UpdateIdempotencyKey = &(o.UpdateIdempotencyKey)\n\t\tcase \"updateTime\":\n\t\t\tsp.UpdateTime = &(o.UpdateTime)\n\t\tcase \"zHash\":\n\t\t\tsp.ZHash = &(o.ZHash)\n\t\tcase \"zone\":\n\t\t\tsp.Zone = &(o.Zone)\n\t\t}\n\t}\n\n\treturn sp\n}", "title": "" }, { "docid": "557e991e6cec127c8945655d6315f42c", "score": "0.4564942", "text": "func resourceVolterraCertificateChainUpdate(d *schema.ResourceData, meta interface{}) error {\n\tclient := meta.(*APIClient)\n\n\tupdateMeta := &ves_io_schema.ObjectReplaceMetaType{}\n\tupdateSpec := &ves_io_schema_certificate_chain.ReplaceSpecType{}\n\tupdateReq := &ves_io_schema_certificate_chain.ReplaceRequest{\n\t\tMetadata: updateMeta,\n\t\tSpec: updateSpec,\n\t}\n\tif v, ok := d.GetOk(\"annotations\"); ok && !isIntfNil(v) {\n\n\t\tms := map[string]string{}\n\n\t\tfor k, v := range v.(map[string]interface{}) {\n\t\t\tval := v.(string)\n\t\t\tms[k] = val\n\t\t}\n\t\tupdateMeta.Annotations = ms\n\t}\n\n\tif v, ok := d.GetOk(\"description\"); ok && !isIntfNil(v) {\n\t\tupdateMeta.Description =\n\t\t\tv.(string)\n\t}\n\n\tif v, ok := d.GetOk(\"disable\"); ok && !isIntfNil(v) {\n\t\tupdateMeta.Disable =\n\t\t\tv.(bool)\n\t}\n\n\tif v, ok := d.GetOk(\"labels\"); ok && !isIntfNil(v) {\n\n\t\tms := map[string]string{}\n\n\t\tfor k, v := range v.(map[string]interface{}) {\n\t\t\tval := v.(string)\n\t\t\tms[k] = val\n\t\t}\n\t\tupdateMeta.Labels = ms\n\t}\n\n\tif v, ok := d.GetOk(\"name\"); ok && !isIntfNil(v) {\n\t\tupdateMeta.Name =\n\t\t\tv.(string)\n\t}\n\n\tif v, ok := d.GetOk(\"namespace\"); ok && !isIntfNil(v) {\n\t\tupdateMeta.Namespace =\n\t\t\tv.(string)\n\t}\n\n\tlog.Printf(\"[DEBUG] Updating Volterra CertificateChain obj with struct: %+v\", updateReq)\n\n\terr := client.ReplaceObject(context.Background(), ves_io_schema_certificate_chain.ObjectType, updateReq)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error updating CertificateChain: %s\", err)\n\t}\n\n\treturn resourceVolterraCertificateChainRead(d, meta)\n}", "title": "" }, { "docid": "ce5b1c56f8bc1cea25c1e4a5417c1bf9", "score": "0.4536796", "text": "func (o *SparseTrustedCA) SetBSON(raw bson.Raw) error {\n\n\tif o == nil {\n\t\treturn nil\n\t}\n\n\ts := &mongoAttributesSparseTrustedCA{}\n\tif err := raw.Unmarshal(s); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3bffbde176109ecbcd6c7ff8142a50a0", "score": "0.45344174", "text": "func (r *ReconcileProxyConfig) syncTrustedCABundle(trustedCABundle *corev1.ConfigMap) error {\n\tcurrentCfgMap := &corev1.ConfigMap{}\n\tif err := r.client.Get(context.TODO(), names.TrustedCABundleConfigMap(), currentCfgMap); err != nil {\n\t\tif !apierrors.IsNotFound(err) {\n\t\t\treturn fmt.Errorf(\"failed to get trusted CA bundle configmap '%s/%s': %v\",\n\t\t\t\ttrustedCABundle.Namespace, trustedCABundle.Name, err)\n\t\t}\n\t\tif err := r.client.Create(context.TODO(), trustedCABundle); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to create trusted CA bundle configmap '%s/%s': %v\",\n\t\t\t\ttrustedCABundle.Namespace, trustedCABundle.Name, err)\n\t\t}\n\t}\n\n\tif !configMapsEqual(names.TRUSTED_CA_BUNDLE_CONFIGMAP_KEY, currentCfgMap, trustedCABundle) {\n\t\tif err := r.client.Update(context.TODO(), trustedCABundle); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to update trusted CA bundle configmap '%s/%s': %v\",\n\t\t\t\ttrustedCABundle.Namespace, trustedCABundle.Name, err)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "de0dd2c92952819a969217b7335285b1", "score": "0.45336035", "text": "func (o *SparseServiceCertificate) EncryptAttributes(encrypter elemental.AttributeEncrypter) (err error) {\n\n\tif *o.Private, err = encrypter.EncryptString(*o.Private); err != nil {\n\t\treturn fmt.Errorf(\"unable to encrypt attribute 'Private' for 'SparseServiceCertificate' (%s): %s\", o.Identifier(), err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "da133da68ec92415ae2ecc5e76475173", "score": "0.45278683", "text": "func (o *SparseTrustedCA) SetIdentifier(id string) {\n\n}", "title": "" }, { "docid": "085e0d2eaa58d9c5d56d9f2e7c63f6f9", "score": "0.45052493", "text": "func (r *AndroidForWorkTrustedRootCertificateRequest) Update(ctx context.Context, reqObj *AndroidForWorkTrustedRootCertificate) error {\n\treturn r.JSONRequest(ctx, \"PATCH\", \"\", reqObj, nil)\n}", "title": "" }, { "docid": "61ab7dd1dc922a441627d24016f4713b", "score": "0.44948426", "text": "func (f *Factory) HashTrustedCA(caBundleCM *v1.ConfigMap, prefix string) *v1.ConfigMap {\n\tcaBundle, ok := caBundleCM.Data[\"ca-bundle.crt\"]\n\tif !ok || caBundle == \"\" {\n\t\t// We return here instead of erroring out as we need\n\t\t// \"ca-bundle.crt\" to be there. This can mean that\n\t\t// the CA was not propagated yet. In that case we\n\t\t// will catch this on next sync loop.\n\t\treturn nil\n\t}\n\n\th := fnv.New64()\n\th.Write([]byte(caBundle))\n\thash := strconv.FormatUint(h.Sum64(), 32)\n\n\treturn &v1.ConfigMap{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tNamespace: \"openshift-monitoring\",\n\t\t\tName: fmt.Sprintf(\"%s-trusted-ca-bundle-%s\", prefix, hash),\n\t\t\tLabels: map[string]string{\n\t\t\t\t\"monitoring.openshift.io/name\": prefix,\n\t\t\t\t\"monitoring.openshift.io/hash\": hash,\n\t\t\t},\n\t\t},\n\t\tData: map[string]string{\n\t\t\t\"ca-bundle.crt\": caBundle,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "d2854d39f7ad7986d2091448f5c78f64", "score": "0.44667146", "text": "func PreserveUserSpecifiedLegacyField(original, reconciled *k8s.Resource, path ...string) error {\n\tvo, found, err := unstructured.NestedFieldCopy(original.Spec, path...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !found {\n\t\treturn nil\n\t}\n\tif err := unstructured.SetNestedField(reconciled.Spec, vo, path...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0d0b215fd4d15b8420ff32e2ec59ebcb", "score": "0.4428269", "text": "func (a *Authority) Sign(csr *x509.CertificateRequest, signOpts provisioner.SignOptions, extraOpts ...provisioner.SignOption) ([]*x509.Certificate, error) {\n\tvar (\n\t\tcertOptions []x509util.Option\n\t\tcertValidators []provisioner.CertificateValidator\n\t\tcertModifiers []provisioner.CertificateModifier\n\t\tcertEnforcers []provisioner.CertificateEnforcer\n\t)\n\n\topts := []interface{}{errs.WithKeyVal(\"csr\", csr), errs.WithKeyVal(\"signOptions\", signOpts)}\n\tif err := csr.CheckSignature(); err != nil {\n\t\treturn nil, errs.Wrap(http.StatusBadRequest, err, \"authority.Sign; invalid certificate request\", opts...)\n\t}\n\n\t// Set backdate with the configured value\n\tsignOpts.Backdate = a.config.AuthorityConfig.Backdate.Duration\n\n\tfor _, op := range extraOpts {\n\t\tswitch k := op.(type) {\n\t\t// Adds new options to NewCertificate\n\t\tcase provisioner.CertificateOptions:\n\t\t\tcertOptions = append(certOptions, k.Options(signOpts)...)\n\n\t\t// Validate the given certificate request.\n\t\tcase provisioner.CertificateRequestValidator:\n\t\t\tif err := k.Valid(csr); err != nil {\n\t\t\t\treturn nil, errs.Wrap(http.StatusUnauthorized, err, \"authority.Sign\", opts...)\n\t\t\t}\n\n\t\t// Validates the unsigned certificate template.\n\t\tcase provisioner.CertificateValidator:\n\t\t\tcertValidators = append(certValidators, k)\n\n\t\t// Modifies a certificate before validating it.\n\t\tcase provisioner.CertificateModifier:\n\t\t\tcertModifiers = append(certModifiers, k)\n\n\t\t// Modifies a certificate after validating it.\n\t\tcase provisioner.CertificateEnforcer:\n\t\t\tcertEnforcers = append(certEnforcers, k)\n\n\t\tdefault:\n\t\t\treturn nil, errs.InternalServer(\"authority.Sign; invalid extra option type %T\", append([]interface{}{k}, opts...)...)\n\t\t}\n\t}\n\n\tcert, err := x509util.NewCertificate(csr, certOptions...)\n\tif err != nil {\n\t\tif _, ok := err.(*x509util.TemplateError); ok {\n\t\t\treturn nil, errs.NewErr(http.StatusBadRequest, err,\n\t\t\t\terrs.WithMessage(err.Error()),\n\t\t\t\terrs.WithKeyVal(\"csr\", csr),\n\t\t\t\terrs.WithKeyVal(\"signOptions\", signOpts),\n\t\t\t)\n\t\t}\n\t\treturn nil, errs.Wrap(http.StatusInternalServerError, err, \"authority.Sign\", opts...)\n\t}\n\n\t// Certificate modifiers before validation\n\tleaf := cert.GetCertificate()\n\n\t// Set default subject\n\tif err := withDefaultASN1DN(a.config.AuthorityConfig.Template).Modify(leaf, signOpts); err != nil {\n\t\treturn nil, errs.Wrap(http.StatusUnauthorized, err, \"authority.Sign\", opts...)\n\t}\n\n\tfor _, m := range certModifiers {\n\t\tif err := m.Modify(leaf, signOpts); err != nil {\n\t\t\treturn nil, errs.Wrap(http.StatusUnauthorized, err, \"authority.Sign\", opts...)\n\t\t}\n\t}\n\n\t// Certificate validation.\n\tfor _, v := range certValidators {\n\t\tif err := v.Valid(leaf, signOpts); err != nil {\n\t\t\treturn nil, errs.Wrap(http.StatusUnauthorized, err, \"authority.Sign\", opts...)\n\t\t}\n\t}\n\n\t// Certificate modifiers after validation\n\tfor _, m := range certEnforcers {\n\t\tif err := m.Enforce(leaf); err != nil {\n\t\t\treturn nil, errs.Wrap(http.StatusUnauthorized, err, \"authority.Sign\", opts...)\n\t\t}\n\t}\n\n\tlifetime := leaf.NotAfter.Sub(leaf.NotBefore.Add(signOpts.Backdate))\n\tresp, err := a.x509CAService.CreateCertificate(&casapi.CreateCertificateRequest{\n\t\tTemplate: leaf,\n\t\tLifetime: lifetime,\n\t\tBackdate: signOpts.Backdate,\n\t})\n\tif err != nil {\n\t\treturn nil, errs.Wrap(http.StatusInternalServerError, err, \"authority.Sign; error creating certificate\", opts...)\n\t}\n\n\tif err = a.db.StoreCertificate(resp.Certificate); err != nil {\n\t\tif err != db.ErrNotImplemented {\n\t\t\treturn nil, errs.Wrap(http.StatusInternalServerError, err,\n\t\t\t\t\"authority.Sign; error storing certificate in db\", opts...)\n\t\t}\n\t}\n\n\treturn append([]*x509.Certificate{resp.Certificate}, resp.CertificateChain...), nil\n}", "title": "" }, { "docid": "743f2d82fa0bd2a8f83a022f6674dce0", "score": "0.44029477", "text": "func TestXattrWriteCasSimple(t *testing.T) {\n\n\tSkipXattrTestsIfNotEnabled(t)\n\n\tbucket := GetTestBucket(t)\n\tdefer bucket.Close()\n\tdataStore := bucket.GetSingleDataStore()\n\tkey := t.Name()\n\txattrName := SyncXattrName\n\tval := make(map[string]interface{})\n\tval[\"body_field\"] = \"1234\"\n\n\tvalBytes, marshalErr := JSONMarshal(val)\n\tassert.NoError(t, marshalErr, \"Error marshalling document body\")\n\n\txattrVal := make(map[string]interface{})\n\txattrVal[\"seq\"] = float64(123)\n\txattrVal[\"rev\"] = \"1-1234\"\n\n\tvar existsVal map[string]interface{}\n\t_, err := dataStore.Get(key, existsVal)\n\tif err == nil {\n\t\tlog.Printf(\"Key should not exist yet, expected error but got nil. Doing cleanup, assuming couchbase bucket testing\")\n\t\terr = dataStore.DeleteWithXattr(key, xattrName)\n\t\trequire.NoError(t, err)\n\t}\n\n\tcas := uint64(0)\n\tcas, err = dataStore.WriteCasWithXattr(key, xattrName, 0, cas, nil, val, xattrVal)\n\tassert.NoError(t, err, \"WriteCasWithXattr error\")\n\tlog.Printf(\"Post-write, cas is %d\", cas)\n\n\tvar retrievedVal map[string]interface{}\n\tvar retrievedXattr map[string]interface{}\n\tgetCas, err := dataStore.GetWithXattr(key, xattrName, \"\", &retrievedVal, &retrievedXattr, nil)\n\tif err != nil {\n\t\tt.Errorf(\"Error doing GetWithXattr: %+v\", err)\n\t}\n\n\tassert.Equal(t, cas, getCas)\n\tassert.Equal(t, val[\"body_field\"], retrievedVal[\"body_field\"])\n\tassert.Equal(t, xattrVal[\"seq\"], retrievedXattr[\"seq\"])\n\tassert.Equal(t, xattrVal[\"rev\"], retrievedXattr[\"rev\"])\n\tmacroCasString, ok := retrievedXattr[xattrMacroCas].(string)\n\tassert.True(t, ok, \"Unable to retrieve xattrMacroCas as string\")\n\tassert.Equal(t, cas, HexCasToUint64(macroCasString))\n\tmacroBodyHashString, ok := retrievedXattr[xattrMacroValueCrc32c].(string)\n\tassert.True(t, ok, \"Unable to retrieve xattrMacroValueCrc32c as string\")\n\tassert.Equal(t, Crc32cHashString(valBytes), macroBodyHashString)\n\n\t// Validate against $document.value_crc32c\n\tvar retrievedVxattr map[string]interface{}\n\t_, err = dataStore.GetWithXattr(key, \"$document\", \"\", retrievedVal, &retrievedVxattr, nil)\n\trequire.NoError(t, err)\n\tvxattrCrc32c, ok := retrievedVxattr[\"value_crc32c\"].(string)\n\tassert.True(t, ok, \"Unable to retrieve virtual xattr crc32c as string\")\n\n\tassert.Equal(t, Crc32cHashString(valBytes), vxattrCrc32c)\n\tassert.Equal(t, macroBodyHashString, vxattrCrc32c)\n\n}", "title": "" }, { "docid": "c3e735fac2e23c97bebe6ff20bf22da4", "score": "0.43932718", "text": "func (o SparseTrustedCAsList) Append(objects ...elemental.Identifiable) elemental.Identifiables {\n\n\tout := append(SparseTrustedCAsList{}, o...)\n\tfor _, obj := range objects {\n\t\tout = append(out, obj.(*SparseTrustedCA))\n\t}\n\n\treturn out\n}", "title": "" }, { "docid": "fced64326ece2b3f008a8766d38e80f3", "score": "0.43916345", "text": "func (s Store) Update(certificate x509.Certificate) error {\n\treturn s.updateAttribute(\n\t\ts.config.GetCertificateTemplate(),\n\t\t[]*pkcs11.Attribute{pkcs11.NewAttribute(pkcs11.CKA_VALUE, certificate.Raw)},\n\t)\n}", "title": "" }, { "docid": "17d7d9d553ffceeb3127ca56179597ea", "score": "0.4391084", "text": "func ARCWithSWA() testing.Precondition { return arcWithSWA }", "title": "" }, { "docid": "28920edbbd742aa20447c78bc8c49fc8", "score": "0.4365759", "text": "func (r *FirstAndThirdPartyAudiencesService) Patch(firstAndThirdPartyAudienceId int64, firstandthirdpartyaudience *FirstAndThirdPartyAudience) *FirstAndThirdPartyAudiencesPatchCall {\n\tc := &FirstAndThirdPartyAudiencesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.firstAndThirdPartyAudienceId = firstAndThirdPartyAudienceId\n\tc.firstandthirdpartyaudience = firstandthirdpartyaudience\n\treturn c\n}", "title": "" }, { "docid": "676ba51ec3886e31fa66eb8d701afef1", "score": "0.4359849", "text": "func (s *ClusterScope) PatchObject() error {\n\treturn s.patchHelper.Patch(context.TODO(), s.IBMVPCCluster)\n}", "title": "" }, { "docid": "8367a5169cc38425ec6276bf115985f4", "score": "0.43537956", "text": "func (m *UserExperienceAnalyticsWorkFromAnywhereDevice) SetCloudIdentityScore(value *float64)() {\n err := m.GetBackingStore().Set(\"cloudIdentityScore\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "b64e981331845910010cbc3d507affc8", "score": "0.4352165", "text": "func (m *UserExperienceAnalyticsWorkFromAnywhereModelPerformance) SetCloudIdentityScore(value *float64)() {\n err := m.GetBackingStore().Set(\"cloudIdentityScore\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "09465332dbff695214d2161a33f7a626", "score": "0.4347689", "text": "func (o SparseTrustedCAsList) ToPlain() elemental.IdentifiablesList {\n\n\tout := make(elemental.IdentifiablesList, len(o))\n\tfor i := 0; i < len(o); i++ {\n\t\tout[i] = o[i].ToPlain()\n\t}\n\n\treturn out\n}", "title": "" }, { "docid": "8157d2737fa5112abaefd2eeff35c7ef", "score": "0.4335333", "text": "func (client *Client) ModifyCenAttributeWithOptions(request *ModifyCenAttributeRequest, runtime *util.RuntimeOptions) (_result *ModifyCenAttributeResponse, _err error) {\n\t_err = util.ValidateModel(request)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\tquery := map[string]interface{}{}\n\tif !tea.BoolValue(util.IsUnset(request.CenId)) {\n\t\tquery[\"CenId\"] = request.CenId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.Description)) {\n\t\tquery[\"Description\"] = request.Description\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.Name)) {\n\t\tquery[\"Name\"] = request.Name\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.OwnerAccount)) {\n\t\tquery[\"OwnerAccount\"] = request.OwnerAccount\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.OwnerId)) {\n\t\tquery[\"OwnerId\"] = request.OwnerId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.ProtectionLevel)) {\n\t\tquery[\"ProtectionLevel\"] = request.ProtectionLevel\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.ResourceOwnerAccount)) {\n\t\tquery[\"ResourceOwnerAccount\"] = request.ResourceOwnerAccount\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.ResourceOwnerId)) {\n\t\tquery[\"ResourceOwnerId\"] = request.ResourceOwnerId\n\t}\n\n\treq := &openapi.OpenApiRequest{\n\t\tQuery: openapiutil.Query(query),\n\t}\n\tparams := &openapi.Params{\n\t\tAction: tea.String(\"ModifyCenAttribute\"),\n\t\tVersion: tea.String(\"2017-09-12\"),\n\t\tProtocol: tea.String(\"HTTPS\"),\n\t\tPathname: tea.String(\"/\"),\n\t\tMethod: tea.String(\"POST\"),\n\t\tAuthType: tea.String(\"AK\"),\n\t\tStyle: tea.String(\"RPC\"),\n\t\tReqBodyType: tea.String(\"formData\"),\n\t\tBodyType: tea.String(\"json\"),\n\t}\n\t_result = &ModifyCenAttributeResponse{}\n\t_body, _err := client.CallApi(params, req, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_err = tea.Convert(_body, &_result)\n\treturn _result, _err\n}", "title": "" }, { "docid": "8b5a1733117fe58856280249fe9924fe", "score": "0.43282098", "text": "func (s *gkeSigner) sign(csr *capi.CertificateSigningRequest) (*capi.CertificateSigningRequest, error) {\n\tvar statusCode int\n\tvar result rest.Result\n\twebhook.WithExponentialBackoff(context.TODO(), *ClusterSigningGKERetryBackoff, func() error {\n\t\trecordMetric := csrmetrics.OutboundRPCStartRecorder(\"container.webhook.Sign\")\n\t\tresult = s.webhook.RestClient.Post().Body(csr).Do(context.TODO())\n\t\tif result.Error() != nil {\n\t\t\trecordMetric(csrmetrics.OutboundRPCStatusError)\n\t\t\treturn result.Error()\n\t\t}\n\t\tif result.StatusCode(&statusCode); statusCode < 200 && statusCode >= 300 {\n\t\t\trecordMetric(csrmetrics.OutboundRPCStatusError)\n\t\t} else {\n\t\t\trecordMetric(csrmetrics.OutboundRPCStatusOK)\n\t\t}\n\t\treturn nil\n\t}, webhook.DefaultShouldRetry)\n\n\tif err := result.Error(); err != nil {\n\t\tvar webhookError error\n\t\tif bodyErr := s.resultBodyError(result); bodyErr != nil {\n\t\t\twebhookError = s.webhookError(csr, bodyErr)\n\t\t} else {\n\t\t\twebhookError = s.webhookError(csr, err)\n\t\t}\n\t\treturn nil, webhookError\n\t}\n\n\tif statusCode < 200 || statusCode >= 300 {\n\t\treturn nil, s.webhookError(csr, fmt.Errorf(\"received unsuccessful response code from webhook: %d\", statusCode))\n\t}\n\n\tresultCSR := &capi.CertificateSigningRequest{}\n\n\tif err := result.Into(resultCSR); err != nil {\n\t\treturn nil, s.webhookError(resultCSR, err)\n\t}\n\n\t// Keep the original CSR intact, and only update fields we expect to change.\n\tcsr.Status.Certificate = resultCSR.Status.Certificate\n\treturn csr, nil\n}", "title": "" }, { "docid": "ae94d2c3df286c5162f57ba39ee761e6", "score": "0.4317133", "text": "func (r UpdateCACertificateRequest) Send(ctx context.Context) (*UpdateCACertificateResponse, error) {\n\tr.Request.SetContext(ctx)\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := &UpdateCACertificateResponse{\n\t\tUpdateCACertificateOutput: r.Request.Data.(*UpdateCACertificateOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "0e60228eaab769edf6005e57abe5d345", "score": "0.4313038", "text": "func getOrCreateTrustedCAConfigMap(n ClusterPolicyController, name string) (*corev1.ConfigMap, error) {\n\tconfigMap := &corev1.ConfigMap{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: \"ConfigMap\",\n\t\t\tAPIVersion: corev1.SchemeGroupVersion.String(),\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: name,\n\t\t\tNamespace: \"gpu-operator-resources\",\n\t\t},\n\t\tData: map[string]string{\n\t\t\tTrustedCABundleFileName: \"\",\n\t\t},\n\t}\n\n\t// apply label \"config.openshift.io/inject-trusted-cabundle: true\", so that cert is automatically filled/updated.\n\tconfigMap.ObjectMeta.Labels = make(map[string]string)\n\tconfigMap.ObjectMeta.Labels[\"config.openshift.io/inject-trusted-cabundle\"] = \"true\"\n\n\tlogger := n.rec.Log.WithValues(\"ConfigMap\", configMap.ObjectMeta.Name, \"Namespace\", configMap.ObjectMeta.Namespace)\n\n\tif err := controllerutil.SetControllerReference(n.singleton, configMap, n.rec.Scheme); err != nil {\n\t\treturn nil, err\n\t}\n\n\tfound := &corev1.ConfigMap{}\n\terr := n.rec.Client.Get(context.TODO(), types.NamespacedName{Namespace: configMap.ObjectMeta.Namespace, Name: configMap.ObjectMeta.Name}, found)\n\tif err != nil && errors.IsNotFound(err) {\n\t\tlogger.Info(\"Not found, creating\")\n\t\terr = n.rec.Client.Create(context.TODO(), configMap)\n\t\tif err != nil {\n\t\t\tlogger.Info(\"Couldn't create\")\n\t\t\treturn nil, fmt.Errorf(\"failed to create trusted CA bundle config map %q: %s\", name, err)\n\t\t}\n\t\treturn configMap, nil\n\t} else if err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get trusted CA bundle config map %q: %s\", name, err)\n\t}\n\n\treturn found, nil\n}", "title": "" }, { "docid": "970402d032b3072ad49407e61af304f0", "score": "0.43048397", "text": "func PreserveUserSpecifiedLegacyFieldUnderSlice(original, reconciled *k8s.Resource, upToSlicePath []string, path []string) error {\n\toriginalSlice, foundOriginal, err := unstructured.NestedSlice(original.Spec, upToSlicePath...)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error getting the nested slice under path %s for the original resource: %v\", strings.Join(upToSlicePath, \".\"), err)\n\t}\n\treconciledSlice, foundReconciled, err := unstructured.NestedSlice(reconciled.Spec, upToSlicePath...)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error getting the nested slice under path %s for the reconciled resource: %v\", strings.Join(upToSlicePath, \".\"), err)\n\t}\n\tif !foundOriginal || !foundReconciled {\n\t\treturn nil\n\t}\n\tfor i, v := range originalSlice {\n\t\tpathFieldValue, foundPathField, err := unstructured.NestedFieldCopy(v.(map[string]interface{}), path...)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error getting the user-specified value from the path %s within the slice field: %v\", strings.Join(path, \".\"), err)\n\t\t}\n\t\tif !foundPathField {\n\t\t\tcontinue\n\t\t}\n\t\tif err := unstructured.SetNestedField(reconciledSlice[i].(map[string]interface{}), pathFieldValue, path...); err != nil {\n\t\t\treturn fmt.Errorf(\"error setting original value to reconciled slice element: %v\", err)\n\t\t}\n\t}\n\tif err := unstructured.SetNestedSlice(reconciled.Spec, reconciledSlice, upToSlicePath...); err != nil {\n\t\treturn fmt.Errorf(\"error setting preserved values back into reconciled object: %v\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2b95bc4212e179b7364531e8a1181161", "score": "0.42737705", "text": "func TestXattrWriteCasTombstoneUpdate(t *testing.T) {\n\n\tt.Skip(\"Test does not pass with errors: https://gist.github.com/tleyden/d261fe2b92bdaaa6e78f9f1c00fdfd58. Needs investigation\")\n\n\tSkipXattrTestsIfNotEnabled(t)\n\n\tbucket := GetTestBucket(t)\n\tdefer bucket.Close()\n\tdataStore := bucket.GetSingleDataStore()\n\tkey := t.Name()\n\txattrName := SyncXattrName\n\tval := make(map[string]interface{})\n\tval[\"body_field\"] = \"1234\"\n\n\txattrVal := make(map[string]interface{})\n\txattrVal[\"seq\"] = float64(123)\n\txattrVal[\"rev\"] = \"1-1234\"\n\n\tvar existsVal map[string]interface{}\n\t_, err := dataStore.Get(key, existsVal)\n\tif err == nil {\n\t\tlog.Printf(\"Key should not exist yet, expected error but got nil. Doing cleanup, assuming couchbase bucket testing\")\n\t\terr = dataStore.DeleteWithXattr(key, xattrName)\n\t\trequire.NoError(t, err)\n\t}\n\n\t// Write document with xattr\n\tcas := uint64(0)\n\tcas, err = dataStore.WriteCasWithXattr(key, xattrName, 0, cas, nil, val, xattrVal)\n\tif err != nil {\n\t\tt.Errorf(\"Error doing WriteCasWithXattr: %+v\", err)\n\t}\n\tlog.Printf(\"Wrote document\")\n\tlog.Printf(\"Post-write, cas is %d\", cas)\n\n\tvar retrievedVal map[string]interface{}\n\tvar retrievedXattr map[string]interface{}\n\tgetCas, err := dataStore.GetWithXattr(key, xattrName, \"\", &retrievedVal, &retrievedXattr, nil)\n\tif err != nil {\n\t\tt.Errorf(\"Error doing GetWithXattr: %+v\", err)\n\t}\n\tlog.Printf(\"Retrieved document\")\n\t// TODO: Cas check fails, pending xattr code to make it to gocb master\n\tlog.Printf(\"TestWriteCasXATTR retrieved: %s, %s\", retrievedVal, retrievedXattr)\n\tassert.Equal(t, cas, getCas)\n\tassert.Equal(t, val[\"body_field\"], retrievedVal[\"body_field\"])\n\tassert.Equal(t, xattrVal[\"seq\"], retrievedXattr[\"seq\"])\n\tassert.Equal(t, xattrVal[\"rev\"], retrievedXattr[\"rev\"])\n\n\terr = dataStore.Delete(key)\n\tif err != nil {\n\t\tt.Errorf(\"Error doing Delete: %+v\", err)\n\t}\n\n\tlog.Printf(\"Deleted document\")\n\t// Update the xattr\n\txattrVal = make(map[string]interface{})\n\txattrVal[\"seq\"] = float64(456)\n\txattrVal[\"rev\"] = \"2-2345\"\n\t_, err = dataStore.WriteCasWithXattr(key, xattrName, 0, cas, nil, nil, xattrVal)\n\tif err != nil {\n\t\tt.Errorf(\"Error doing WriteCasWithXattr: %+v\", err)\n\t}\n\n\tlog.Printf(\"Updated tombstoned document\")\n\t// Verify retrieval\n\tvar modifiedVal map[string]interface{}\n\tvar modifiedXattr map[string]interface{}\n\t_, err = dataStore.GetWithXattr(key, xattrName, \"\", &modifiedVal, &modifiedXattr, nil)\n\tif err != nil {\n\t\tt.Errorf(\"Error doing GetWithXattr: %+v\", err)\n\t}\n\tlog.Printf(\"Retrieved tombstoned document\")\n\t// TODO: Cas check fails, pending xattr code to make it to gocb master\n\tlog.Printf(\"TestWriteCasXATTR retrieved modified: %s, %s\", modifiedVal, modifiedXattr)\n\tassert.Equal(t, xattrVal[\"seq\"], modifiedXattr[\"seq\"])\n\tassert.Equal(t, xattrVal[\"rev\"], modifiedXattr[\"rev\"])\n}", "title": "" }, { "docid": "1609dc2dc2c00084d1425e3b1cc4876c", "score": "0.42733663", "text": "func TestXattrWriteCasUpsert(t *testing.T) {\n\n\tSkipXattrTestsIfNotEnabled(t)\n\n\tbucket := GetTestBucket(t)\n\tdefer bucket.Close()\n\tdataStore := bucket.GetSingleDataStore()\n\n\tkey := t.Name()\n\txattrName := SyncXattrName\n\tval := make(map[string]interface{})\n\tval[\"body_field\"] = \"1234\"\n\n\txattrVal := make(map[string]interface{})\n\txattrVal[\"seq\"] = float64(123)\n\txattrVal[\"rev\"] = \"1-1234\"\n\n\tvar existsVal map[string]interface{}\n\t_, err := dataStore.Get(key, existsVal)\n\tif err == nil {\n\t\tlog.Printf(\"Key should not exist yet, expected error but got nil. Doing cleanup, assuming couchbase bucket testing\")\n\t\terr = dataStore.DeleteWithXattr(key, xattrName)\n\t\trequire.NoError(t, err)\n\t}\n\n\tcas := uint64(0)\n\tcas, err = dataStore.WriteCasWithXattr(key, xattrName, 0, cas, nil, val, xattrVal)\n\tassert.NoError(t, err, \"WriteCasWithXattr error\")\n\tlog.Printf(\"Post-write, cas is %d\", cas)\n\n\tvar retrievedVal map[string]interface{}\n\tvar retrievedXattr map[string]interface{}\n\tgetCas, err := dataStore.GetWithXattr(key, xattrName, \"\", &retrievedVal, &retrievedXattr, nil)\n\tif err != nil {\n\t\tt.Errorf(\"Error doing GetWithXattr: %+v\", err)\n\t}\n\t// TODO: Cas check fails, pending xattr code to make it to gocb master\n\tlog.Printf(\"TestWriteCasXATTR retrieved: %s, %s\", retrievedVal, retrievedXattr)\n\tassert.Equal(t, cas, getCas)\n\tassert.Equal(t, val[\"body_field\"], retrievedVal[\"body_field\"])\n\tassert.Equal(t, xattrVal[\"seq\"], retrievedXattr[\"seq\"])\n\tassert.Equal(t, xattrVal[\"rev\"], retrievedXattr[\"rev\"])\n\n\tval2 := make(map[string]interface{})\n\tval2[\"body_field\"] = \"5678\"\n\txattrVal2 := make(map[string]interface{})\n\txattrVal2[\"seq\"] = float64(124)\n\txattrVal2[\"rev\"] = \"2-5678\"\n\tcas, err = dataStore.WriteCasWithXattr(key, xattrName, 0, getCas, nil, val2, xattrVal2)\n\tassert.NoError(t, err, \"WriteCasWithXattr error\")\n\tlog.Printf(\"Post-write, cas is %d\", cas)\n\n\tvar retrievedVal2 map[string]interface{}\n\tvar retrievedXattr2 map[string]interface{}\n\tgetCas, err = dataStore.GetWithXattr(key, xattrName, \"\", &retrievedVal2, &retrievedXattr2, nil)\n\tif err != nil {\n\t\tt.Errorf(\"Error doing GetWithXattr: %+v\", err)\n\t}\n\tlog.Printf(\"TestWriteCasXATTR retrieved: %s, %s\", retrievedVal2, retrievedXattr2)\n\tassert.Equal(t, cas, getCas)\n\tassert.Equal(t, val2[\"body_field\"], retrievedVal2[\"body_field\"])\n\tassert.Equal(t, xattrVal2[\"seq\"], retrievedXattr2[\"seq\"])\n\tassert.Equal(t, xattrVal2[\"rev\"], retrievedXattr2[\"rev\"])\n\n}", "title": "" }, { "docid": "5e454dabd291050763eb294c918bb1d6", "score": "0.42719236", "text": "func (c *Config) SaveTrustedCAFile(file string) error {\n\tif file != \"\" {\n\t\tabsolute, err := filepath.Abs(file)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tc.Cluster.TrustedCAFile = absolute\n\t} else {\n\t\tc.Cluster.TrustedCAFile = \"\"\n\t}\n\n\treturn write(c.Cluster, filepath.Join(c.path, clusterFilename))\n}", "title": "" }, { "docid": "b5a80b985993c8de66a4b2a41f82fc51", "score": "0.4271833", "text": "func (m *AndroidForWorkPkcsCertificateProfile) SetCertificationAuthority(value *string)() {\n err := m.GetBackingStore().Set(\"certificationAuthority\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "061232316df93cb6126b0d065ceb5568", "score": "0.42644587", "text": "func PreserveUserSpecifiedLegacyArrayField(original, reconciled *k8s.Resource, path ...string) error {\n\tvo, found, err := unstructured.NestedSlice(original.Spec, path...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !found {\n\t\treturn nil\n\t}\n\tif err := unstructured.SetNestedSlice(reconciled.Spec, vo, path...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "67ea4c6d3a87f61d627786dcbc637801", "score": "0.4260457", "text": "func (s *ClusterScope) PatchObject() error {\n\treturn s.patchHelper.Patch(context.TODO(), s.GCPCluster)\n}", "title": "" }, { "docid": "f640ff884f3d3fd30a4428880c631fd7", "score": "0.42603827", "text": "func (state *CSPState[T]) MakeArcConsistent(ctx context.Context) error {\n\t_, err := RunWithContext(ctx, func() bool {\n\t\tstate.arcConsistency()\n\t\treturn true\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "06ac9731064b3ba830c1385ea7fb2869", "score": "0.4246669", "text": "func (o ServiceCertificatesList) ToSparse(fields ...string) elemental.Identifiables {\n\n\tout := make(SparseServiceCertificatesList, len(o))\n\tfor i := 0; i < len(o); i++ {\n\t\tout[i] = o[i].ToSparse(fields...).(*SparseServiceCertificate)\n\t}\n\n\treturn out\n}", "title": "" }, { "docid": "0b4d0624280d4ba1150d2ccbc1149623", "score": "0.42436615", "text": "func TestXattrWriteCasTombstoneResurrect(t *testing.T) {\n\n\tSkipXattrTestsIfNotEnabled(t)\n\n\tbucket := GetTestBucket(t)\n\tdefer bucket.Close()\n\tdataStore := bucket.GetSingleDataStore()\n\tkey := t.Name()\n\txattrName := SyncXattrName\n\tval := make(map[string]interface{})\n\tval[\"body_field\"] = \"1234\"\n\n\txattrVal := make(map[string]interface{})\n\txattrVal[\"seq\"] = float64(123)\n\txattrVal[\"rev\"] = \"1-1234\"\n\n\tvar existsVal map[string]interface{}\n\t_, err := dataStore.Get(key, existsVal)\n\tif err == nil {\n\t\tlog.Printf(\"Key should not exist yet, expected error but got nil. Doing cleanup, assuming couchbase bucket testing\")\n\t\terr = dataStore.DeleteWithXattr(key, xattrName)\n\t\trequire.NoError(t, err)\n\t}\n\n\t// Write document with xattr\n\tcas := uint64(0)\n\tcas, err = dataStore.WriteCasWithXattr(key, xattrName, 0, cas, nil, val, xattrVal)\n\tif err != nil {\n\t\tt.Errorf(\"Error doing WriteCasWithXattr: %+v\", err)\n\t}\n\tlog.Printf(\"Post-write, cas is %d\", cas)\n\n\tvar retrievedVal map[string]interface{}\n\tvar retrievedXattr map[string]interface{}\n\tgetCas, err := dataStore.GetWithXattr(key, xattrName, \"\", &retrievedVal, &retrievedXattr, nil)\n\tif err != nil {\n\t\tt.Errorf(\"Error doing GetWithXattr: %+v\", err)\n\t}\n\t// TODO: Cas check fails, pending xattr code to make it to gocb master\n\tlog.Printf(\"TestWriteCasXATTR retrieved: %s, %s\", retrievedVal, retrievedXattr)\n\tassert.Equal(t, cas, getCas)\n\tassert.Equal(t, val[\"body_field\"], retrievedVal[\"body_field\"])\n\tassert.Equal(t, xattrVal[\"seq\"], retrievedXattr[\"seq\"])\n\tassert.Equal(t, xattrVal[\"rev\"], retrievedXattr[\"rev\"])\n\n\t// Delete the body (retains xattr)\n\terr = dataStore.Delete(key)\n\tif err != nil {\n\t\tt.Errorf(\"Error doing Delete: %+v\", err)\n\t}\n\n\t// Update the doc and xattr\n\tval = make(map[string]interface{})\n\tval[\"body_field\"] = \"5678\"\n\txattrVal = make(map[string]interface{})\n\txattrVal[\"seq\"] = float64(456)\n\txattrVal[\"rev\"] = \"2-2345\"\n\t_, err = dataStore.WriteCasWithXattr(key, xattrName, 0, cas, nil, val, xattrVal)\n\tif err != nil {\n\t\tt.Errorf(\"Error doing WriteCasWithXattr: %+v\", err)\n\t}\n\n\t// Verify retrieval\n\t_, err = dataStore.GetWithXattr(key, xattrName, \"\", &retrievedVal, &retrievedXattr, nil)\n\tif err != nil {\n\t\tt.Errorf(\"Error doing GetWithXattr: %+v\", err)\n\t}\n\t// TODO: Cas check fails, pending xattr code to make it to gocb master\n\tlog.Printf(\"TestWriteCasXATTR retrieved: %s, %s\", retrievedVal, retrievedXattr)\n\tassert.Equal(t, val[\"body_field\"], retrievedVal[\"body_field\"])\n\tassert.Equal(t, xattrVal[\"seq\"], retrievedXattr[\"seq\"])\n\tassert.Equal(t, xattrVal[\"rev\"], retrievedXattr[\"rev\"])\n}", "title": "" }, { "docid": "502015f10a9a7960a3eec15a66c4e79a", "score": "0.42422903", "text": "func (o SparseTrustedCAsList) Copy() elemental.Identifiables {\n\n\tcopy := append(SparseTrustedCAsList{}, o...)\n\treturn &copy\n}", "title": "" }, { "docid": "3264cc10403b18167da159d8f5a423e9", "score": "0.42368972", "text": "func (o *SparseServiceCertificate) Identity() elemental.Identity {\n\n\treturn ServiceCertificateIdentity\n}", "title": "" }, { "docid": "c24c58c007c45c17681919bb96adc023", "score": "0.42352042", "text": "func (o *SparseTrustedCA) Version() int {\n\n\treturn 1\n}", "title": "" }, { "docid": "5ac48acb6405bfa3c4070fca73c060fc", "score": "0.4231609", "text": "func (o *SuggestedPolicy) ToSparse(fields ...string) elemental.SparseIdentifiable {\n\n\tif len(fields) == 0 {\n\t\t// nolint: goimports\n\t\treturn &SparseSuggestedPolicy{\n\t\t\tNetworkAccessPolicies: &o.NetworkAccessPolicies,\n\t\t}\n\t}\n\n\tsp := &SparseSuggestedPolicy{}\n\tfor _, f := range fields {\n\t\tswitch f {\n\t\tcase \"networkAccessPolicies\":\n\t\t\tsp.NetworkAccessPolicies = &(o.NetworkAccessPolicies)\n\t\t}\n\t}\n\n\treturn sp\n}", "title": "" }, { "docid": "06a53497a2302553aacbbd75f8ed4075", "score": "0.4217618", "text": "func TestXattrWriteCasRaw(t *testing.T) {\n\n\tSkipXattrTestsIfNotEnabled(t)\n\n\tbucket := GetTestBucket(t)\n\tdefer bucket.Close()\n\tdataStore := bucket.GetSingleDataStore()\n\n\tkey := t.Name()\n\txattrName := SyncXattrName\n\tval := make(map[string]interface{})\n\tval[\"body_field\"] = \"1234\"\n\tvalRaw, _ := JSONMarshal(val)\n\n\txattrVal := make(map[string]interface{})\n\txattrVal[\"seq\"] = float64(123)\n\txattrVal[\"rev\"] = \"1-1234\"\n\txattrValRaw, _ := JSONMarshal(xattrVal)\n\n\tvar existsVal map[string]interface{}\n\t_, err := dataStore.Get(key, existsVal)\n\tif err == nil {\n\t\tlog.Printf(\"Key should not exist yet, expected error but got nil. Doing cleanup, assuming couchbase bucket testing\")\n\t\terr = dataStore.DeleteWithXattr(key, xattrName)\n\t\trequire.NoError(t, err)\n\t}\n\n\tcas := uint64(0)\n\tcas, err = dataStore.WriteCasWithXattr(key, xattrName, 0, cas, nil, valRaw, xattrValRaw)\n\tif err != nil {\n\t\tt.Errorf(\"Error doing WriteCasWithXattr: %+v\", err)\n\t}\n\n\tvar retrievedValByte []byte\n\tvar retrievedXattrByte []byte\n\tgetCas, err := dataStore.GetWithXattr(key, xattrName, \"\", &retrievedValByte, &retrievedXattrByte, nil)\n\tif err != nil {\n\t\tt.Errorf(\"Error doing GetWithXattr: %+v\", err)\n\t}\n\n\tvar retrievedVal map[string]interface{}\n\tvar retrievedXattr map[string]interface{}\n\t_ = json.Unmarshal(retrievedValByte, &retrievedVal)\n\t_ = json.Unmarshal(retrievedXattrByte, &retrievedXattr)\n\tlog.Printf(\"TestWriteCasXATTR retrieved: %s, %s\", retrievedVal, retrievedXattr)\n\tassert.Equal(t, cas, getCas)\n\tassert.Equal(t, val[\"body_field\"], retrievedVal[\"body_field\"])\n\tassert.Equal(t, xattrVal[\"seq\"], retrievedXattr[\"seq\"])\n\tassert.Equal(t, xattrVal[\"rev\"], retrievedXattr[\"rev\"])\n}", "title": "" }, { "docid": "9d56bb1c1c2f3e9a49d91bb5b03ca5ea", "score": "0.4216976", "text": "func (c *CertificateController) updateCertSigned(certRequestObj *certificatev1alpha2.Certificate, cert, token []byte) {\n\tcertRequest := certRequestObj.DeepCopy()\n\tcertRequest.Status.Certificate = cert\n\tcertRequest.Status.Ca = c.issuer.GetCACert()\n\tcertRequest.Status.Token = token\n\tcertRequest.Status.Phase = certificatev1alpha2.CertificateSigned\n\tcertRequest.Status.Reason = certificatev1alpha2.StatusReasonProcessedApprovedSignedIssued\n\tcertRequest.Status.Message = \"CSR has been processed and approved, and the Certificate has been signed and issued\"\n\n\t// we can not use UpdateStatus until this issue gets resolved afaik\n\t// https://github.com/kubernetes/kubernetes/issues/38113\n\t_, err := c.certificateClient.CertmanagerV1alpha2().Certificates().Update(certRequest)\n\tif err != nil {\n\t\tzap.L().Error(\"Error Updating the Certificate ressource\", zap.Error(err), zap.String(\"name\", certRequest.Name), zap.String(\"resource_version\", certRequest.ResourceVersion))\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "b9b6a0d662bd5ffa421310222e4ddad8", "score": "0.41975734", "text": "func (m *ItemPatent) SetIssuingAuthority(value *string)() {\n err := m.GetBackingStore().Set(\"issuingAuthority\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "3b4447027ccb880bf3b2ea43455df788", "score": "0.41926116", "text": "func TestXattrWriteCasWithXattrCasCheck(t *testing.T) {\n\n\tSkipXattrTestsIfNotEnabled(t)\n\n\tbucket := GetTestBucket(t)\n\tdefer bucket.Close()\n\tdataStore := bucket.GetSingleDataStore()\n\n\tkey := t.Name()\n\txattrName := SyncXattrName\n\tval := make(map[string]interface{})\n\tval[\"sg_field\"] = \"sg_value\"\n\n\txattrVal := make(map[string]interface{})\n\txattrVal[\"seq\"] = float64(123)\n\txattrVal[\"rev\"] = \"1-1234\"\n\n\tvar existsVal map[string]interface{}\n\t_, err := dataStore.Get(key, existsVal)\n\tif err == nil {\n\t\tlog.Printf(\"Key should not exist yet, expected error but got nil. Doing cleanup, assuming couchbase bucket testing\")\n\t\terr = dataStore.DeleteWithXattr(key, xattrName)\n\t\trequire.NoError(t, err)\n\t}\n\n\tcas := uint64(0)\n\tcas, err = dataStore.WriteCasWithXattr(key, xattrName, 0, cas, nil, val, xattrVal)\n\tassert.NoError(t, err, \"WriteCasWithXattr error\")\n\tlog.Printf(\"Post-write, cas is %d\", cas)\n\n\tvar retrievedVal map[string]interface{}\n\tvar retrievedXattr map[string]interface{}\n\tgetCas, err := dataStore.GetWithXattr(key, xattrName, \"\", &retrievedVal, &retrievedXattr, \"\")\n\tif err != nil {\n\t\tt.Errorf(\"Error doing GetWithXattr: %+v\", err)\n\t}\n\tlog.Printf(\"TestWriteCasXATTR retrieved: %s, %s\", retrievedVal, retrievedXattr)\n\tassert.Equal(t, cas, getCas)\n\tassert.Equal(t, val[\"sg_field\"], retrievedVal[\"sg_field\"])\n\tassert.Equal(t, xattrVal[\"seq\"], retrievedXattr[\"seq\"])\n\tassert.Equal(t, xattrVal[\"rev\"], retrievedXattr[\"rev\"])\n\n\t// Simulate an SDK update\n\tupdatedVal := make(map[string]interface{})\n\tupdatedVal[\"sdk_field\"] = \"abc\"\n\trequire.NoError(t, dataStore.Set(key, 0, nil, updatedVal))\n\n\t// Attempt to update with the previous CAS\n\tval[\"sg_field\"] = \"sg_value_mod\"\n\txattrVal[\"rev\"] = \"2-1234\"\n\t_, err = dataStore.WriteCasWithXattr(key, xattrName, 0, getCas, nil, val, xattrVal)\n\tassert.True(t, IsCasMismatch(err))\n\n\t// Retrieve again, ensure we get the SDK value, SG xattr\n\tretrievedVal = nil\n\tretrievedXattr = nil\n\t_, err = dataStore.GetWithXattr(key, xattrName, \"\", &retrievedVal, &retrievedXattr, nil)\n\tif err != nil {\n\t\tt.Errorf(\"Error doing GetWithXattr: %+v\", err)\n\t}\n\tlog.Printf(\"TestWriteCasXATTR retrieved: %s, %s\", retrievedVal, retrievedXattr)\n\tassert.Equal(t, nil, retrievedVal[\"sg_field\"])\n\tassert.Equal(t, updatedVal[\"sdk_field\"], retrievedVal[\"sdk_field\"])\n\tassert.Equal(t, xattrVal[\"seq\"], retrievedXattr[\"seq\"])\n\tassert.Equal(t, \"1-1234\", retrievedXattr[\"rev\"])\n\n}", "title": "" }, { "docid": "590d5c836d8c661cb4fa3b2aeaa90bfd", "score": "0.4192583", "text": "func (a *clusterProxyAddOnAgent) csrApproveCheck(cluster *clusterv1.ManagedCluster, addon *v1alpha1.ManagedClusterAddOn, csr *certificatesv1.CertificateSigningRequest) bool {\n\t// check signer\n\tif csr.Spec.SignerName != config.SIGNER_NAME && csr.Spec.SignerName != certificatesv1.KubeAPIServerClientSignerName {\n\t\tklog.Infof(\"CSR Approve Check Falied signerName not right: signerName: %s\", csr.Name, csr.Spec.SignerName)\n\t\treturn false\n\t}\n\n\t// check org field and commonName field\n\tblock, _ := pem.Decode(csr.Spec.Request)\n\tif block == nil || block.Type != \"CERTIFICATE REQUEST\" {\n\t\tklog.Infof(\"CSR Approve Check Falied csr %q was not recognized: PEM block type is not CERTIFICATE REQUEST\", csr.Name)\n\t\treturn false\n\t}\n\n\tx509cr, err := x509.ParseCertificateRequest(block.Bytes)\n\tif err != nil {\n\t\tklog.Infof(\"CSR Approve Check Falied csr %q was not recognized: %v\", csr.Name, err)\n\t\treturn false\n\t}\n\n\trequestingOrgs := sets.NewString(x509cr.Subject.Organization...)\n\tif requestingOrgs.Len() != 3 {\n\t\tklog.Infof(\"CSR Approve Check Falied csr %q org is not equal to 3\", csr.Name)\n\t\treturn false\n\t}\n\n\tif !requestingOrgs.Has(authenticatedGroup) {\n\t\tklog.Infof(\"CSR Approve Check Falied csr requesting orgs doesn't contain %s\", authenticatedGroup)\n\t\treturn false\n\t}\n\n\tif !requestingOrgs.Has(addOnGroup) {\n\t\tklog.Infof(\"CSR Approve Check Falied csr requesting orgs doesn't contain %s\", addOnGroup)\n\t\treturn false\n\t}\n\n\tif !requestingOrgs.Has(fmt.Sprintf(clusterAddOnGroup, cluster.Name)) {\n\t\tklog.Infof(\"CSR Approve Check Falied csr requesting orgs doesn't contain %s\", fmt.Sprintf(clusterAddOnGroup, cluster.Name))\n\t\treturn false\n\t}\n\n\t// check commonName field\n\tif fmt.Sprintf(agentUserName, cluster.Name) != x509cr.Subject.CommonName {\n\t\tklog.Infof(\"CSR Approve Check Falied commonName not right; request %s get %s\", x509cr.Subject.CommonName, fmt.Sprintf(agentUserName, cluster.Name))\n\t\treturn false\n\t}\n\n\t// check user name\n\tif strings.HasPrefix(csr.Spec.Username, \"system:open-cluster-management:\"+cluster.Name) {\n\t\tklog.Info(\"CSR approved\")\n\t\treturn true\n\t} else {\n\t\tklog.Info(\"CSR not approved due to illegal requester\", \"requester\", csr.Spec.Username)\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "07fc1c36d8be2dc539dbf65d5ebb1d07", "score": "0.41856003", "text": "func (pc *PatchClient) ApplyVerifiedUpdate(binary io.ReadCloser, hexChecksum, hexSignature string) error {\n\tdefer binary.Close()\n\tchecksum, err := hex.DecodeString(hexChecksum)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed checksum: %v\", err)\n\t}\n\tsignature, err := hex.DecodeString(hexSignature)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed signature: %v\", err)\n\t}\n\topts := update.Options{\n\t\tChecksum: checksum,\n\t\tSignature: signature,\n\t\tHash: crypto.SHA256,\n\t\tVerifier: update.NewECDSAVerifier(),\n\t}\n\terr = opts.SetPublicKeyPEM(pc.PublicKey)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed set opts: %v\", err)\n\t}\n\terr = update.Apply(binary, opts)\n\tif err != nil {\n\t\tif rerr := update.RollbackError(err); rerr != nil {\n\t\t\treturn fmt.Errorf(\"failed to rollback from bad signed update: %v\", rerr)\n\t\t}\n\t\tlog.Println(\"Rolled back signed patch Update\")\n\t\treturn fmt.Errorf(\"successfully rolled back signed update with options %v: %v\", opts, err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a76a8fd6d97cf6a6d1ee081657a4d85a", "score": "0.4184724", "text": "func (m *HostSecurityState) SetRiskScore(value *string)() {\n err := m.GetBackingStore().Set(\"riskScore\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "2ca7fe3f9c29042f340c000a5775ebdd", "score": "0.41782084", "text": "func (s *Sparse) AddScalarInPlace(n float64) Matrix {\n\tpanic(\"mat: AddScalarInPlace not implemented for Sparse matrices\")\n}", "title": "" }, { "docid": "526da02ab0aa939cc5160cd8ac39e4f2", "score": "0.41706952", "text": "func (m *LearningContent) SetIsPremium(value *bool)() {\n err := m.GetBackingStore().Set(\"isPremium\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "3a4c082e5c044222612241b654689eac", "score": "0.4168121", "text": "func (m *ItemItemsItemWorkbookFunctionsConfidence_TPostRequestBody) SetStandardDev(value iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.Jsonable)() {\n err := m.GetBackingStore().Set(\"standardDev\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "7e259a9f54744bbab695d23ec7be7930", "score": "0.41651434", "text": "func (o *SparseAutomation) EncryptAttributes(encrypter elemental.AttributeEncrypter) (err error) {\n\n\tif *o.AporetoToken, err = encrypter.EncryptString(*o.AporetoToken); err != nil {\n\t\treturn fmt.Errorf(\"unable to encrypt attribute 'AporetoToken' for 'SparseAutomation' (%s): %s\", o.Identifier(), err)\n\t}\n\tif *o.AppCredential, err = encrypter.EncryptString(*o.AppCredential); err != nil {\n\t\treturn fmt.Errorf(\"unable to encrypt attribute 'AppCredential' for 'SparseAutomation' (%s): %s\", o.Identifier(), err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "fe4f4f42c852dcb2a446279a22cd5636", "score": "0.416174", "text": "func (s *Sparse) ProdInPlace(other Matrix) Matrix {\n\tswitch other := other.(type) {\n\tcase *Sparse:\n\t\tresult := s.prodSparse(other)\n\t\ts.colsIndex = result.colsIndex\n\t\ts.nnzRow = result.nnzRow\n\t\ts.nzElements = result.nzElements\n\tdefault:\n\t\tpanic(\"mat: ProdInPlace(Dense) not implemented for Sparse matrices\")\n\t}\n\treturn s\n}", "title": "" }, { "docid": "4f9be03037cc0476eb023ca342154f6d", "score": "0.41570833", "text": "func (l *LP) AddConstraintSparse(row []Entry, ct ConstraintType, rightHand float64) error {\n\tcRow := make([]C.double, len(row))\n\tcColNums := make([]C.int, len(row))\n\tfor i, entry := range row {\n\t\tcRow[i] = C.double(entry.Val)\n\t\tcColNums[i] = C.int(entry.Col + 1)\n\t}\n\tC.add_constraintex(l.ptr, C.int(len(row)), &cRow[0], &cColNums[0], C.int(ct), C.double(rightHand))\n\treturn nil\n}", "title": "" }, { "docid": "8b52cca632281f1362d8783cb345f908", "score": "0.41493437", "text": "func (r *ReconcileCSR) Reconcile(request reconcile.Request) (reconcile.Result, error) {\n\treqLogger := log.WithValues(\"Request.Namespace\", request.Namespace, \"Request.Name\", request.Name)\n\treqLogger.Info(\"Reconciling CSR\")\n\n\t// Fetch the CertificateSigningRequest instance\n\tinstance := &certificatesv1beta1.CertificateSigningRequest{}\n\n\tif err := r.client.Get(context.TODO(), request.NamespacedName, instance); err != nil {\n\t\tif errors.IsNotFound(err) {\n\t\t\treqLogger.Info(\"CSR \", instance.Name, \" not found\")\n\t\t\t// Request object not found, could have been deleted after reconcile request.\n\t\t\t// Owned objects are automatically garbage collected. For additional cleanup logic use finalizers.\n\t\t\t// Return and don't requeue\n\t\t\treturn reconcile.Result{}, nil\n\t\t}\n\t\t// Error reading the object - requeue the request.\n\t\treturn reconcile.Result{}, err\n\t}\n\n\tif instance.DeletionTimestamp != nil {\n\t\treqLogger.Info(\"CSR \", instance.Name, \" has deletiontimestamp set\")\n\t\treturn reconcile.Result{}, nil\n\t}\n\n\tclusterName := getClusterName(instance)\n\n\tcluster := clusterv1.ManagedCluster{}\n\terr := r.client.Get(context.TODO(), types.NamespacedName{Name: clusterName}, &cluster)\n\tif err != nil {\n\t\treqLogger.Info(\"Warning\", \"error\", err.Error())\n\t\treturn reconcile.Result{}, nil\n\t}\n\n\treqLogger.Info(\"Approving CSR\", \"name\", instance.Name)\n\tif instance.Status.Conditions == nil {\n\t\tinstance.Status.Conditions = make([]certificatesv1beta1.CertificateSigningRequestCondition, 0)\n\t}\n\n\tinstance.Status.Conditions = append(instance.Status.Conditions, certificatesv1beta1.CertificateSigningRequestCondition{\n\t\tType: certificatesv1beta1.CertificateApproved,\n\t\tReason: \"AutoApprovedByCSRController\",\n\t\tMessage: \"The managedcluster-import-controller auto approval automatically approved this CSR\",\n\t\tLastUpdateTime: metav1.Now(),\n\t})\n\n\tsigningRequest := r.kubeClient.CertificatesV1beta1().CertificateSigningRequests()\n\tif _, err := signingRequest.UpdateApproval(context.TODO(), instance, metav1.UpdateOptions{}); err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\n\treturn reconcile.Result{}, nil\n}", "title": "" }, { "docid": "5fff024ba01bc90fc1a9e50f4deaef55", "score": "0.4132297", "text": "func patch(trampolineStart uintptr, trampoline []byte, magicVal, infoAddr, entryPoint uintptr) ([]byte, error) {\n\treplace := func(start uintptr, d []byte, fPC uintptr, val uint32) error {\n\t\tbuf := make([]byte, 4)\n\t\tubinary.NativeEndian.PutUint32(buf, val)\n\n\t\toffset := fPC - start\n\t\tif int(offset+4) > len(d) {\n\t\t\treturn io.ErrUnexpectedEOF\n\t\t}\n\t\tcopy(d[int(offset):], buf)\n\t\treturn nil\n\t}\n\n\tif err := replace(trampolineStart, trampoline, addrOfInfo(), uint32(infoAddr)); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := replace(trampolineStart, trampoline, addrOfEntry(), uint32(entryPoint)); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := replace(trampolineStart, trampoline, addrOfMagic(), uint32(magicVal)); err != nil {\n\t\treturn nil, err\n\t}\n\treturn trampoline, nil\n}", "title": "" }, { "docid": "ad501d3aef1240523d0ee1e21837735b", "score": "0.41247076", "text": "func (m *AndroidPkcsCertificateProfile) SetCertificationAuthority(value *string)() {\n err := m.GetBackingStore().Set(\"certificationAuthority\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "1ac9d5275473082210271f0f4283cb53", "score": "0.411615", "text": "func (spec *Spec) EnforcePKI(enableActions bool) error {\n\n\tupdateReason := \"\"\n\tvar currentCA *x509.Certificate\n\tvar err error\n\tif spec.renewalForced {\n\t\tupdateReason = \"key\"\n\t} else {\n\t\tcurrentCA, err = spec.CA.getRemoteCert()\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"spec %s: failed getting remote: %s\", spec, err)\n\t\t\treturn err\n\t\t}\n\n\t\tif spec.CA.File != nil {\n\t\t\texistingCA, err := spec.CA.File.ReadCertificate()\n\t\t\tif err != nil {\n\t\t\t\tlog.Infof(\"spec %s: ca on disk needs regeneration: %s\", spec, err)\n\t\t\t\tupdateReason = \"CA\"\n\t\t\t} else {\n\t\t\t\tspec.updateCAExpiry(existingCA.NotAfter)\n\t\t\t\tif !existingCA.Equal(currentCA) {\n\t\t\t\t\tlog.Debugf(\"spec %s: ca has changed\", spec)\n\t\t\t\t\tupdateReason = \"CA\"\n\t\t\t\t} else {\n\t\t\t\t\tlog.Debugf(\"spec %s: ca is the same\", spec)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif updateReason == \"\" {\n\t\t\terr := spec.checkDiskCertKey(currentCA)\n\t\t\tif err != nil {\n\t\t\t\tlog.Infof(\"spec %s: forcing refresh due to %s\", spec, err)\n\t\t\t\tupdateReason = \"key\"\n\t\t\t}\n\t\t}\n\t}\n\n\tif updateReason == \"\" {\n\t\tlog.Debugf(\"spec %s: still up to date\", spec)\n\t\treturn nil\n\t}\n\n\terr = spec.renewPKI(currentCA)\n\tif err != nil {\n\t\tlog.Errorf(\"manager: failed to renew %s; requeuing cert\", spec)\n\t\treturn err\n\t}\n\n\tif enableActions {\n\t\terr = spec.TakeAction(updateReason)\n\t} else {\n\t\tlog.Infof(\"skipping actions for %s due to calling mode\", spec)\n\t}\n\n\t// Even though there was an error managing the service\n\t// associated with the certificate, the certificate has been\n\t// renewed.\n\tif err != nil {\n\t\tmetrics.ActionFailure.WithLabelValues(spec.Path, \"key\").Inc()\n\t\tlog.Errorf(\"manager: %s\", err)\n\t}\n\n\tlog.Info(\"manager: certificate successfully processed\")\n\n\treturn nil\n}", "title": "" }, { "docid": "0217651a3af18590c9a65e0a4c189f04", "score": "0.41155693", "text": "func TestRebuildCtx(t *testing.T) {\n\topentracing.SetGlobalTracer(mocktracer.New())\n\tattach := make(map[string]interface{}, 10)\n\tattach[constant.VersionKey] = \"1.0\"\n\tattach[constant.GroupKey] = \"MyGroup\"\n\tinv := invocation.NewRPCInvocation(\"MethodName\", []interface{}{\"OK\", \"Hello\"}, attach)\n\n\t// attachment doesn't contains any tracing key-value pair,\n\tctx := rebuildCtx(inv)\n\tassert.NotNil(t, ctx)\n\tassert.Nil(t, ctx.Value(constant.TracingRemoteSpanCtx))\n\n\tspan, ctx := opentracing.StartSpanFromContext(ctx, \"Test-Client\")\n\tassert.NotNil(t, ctx)\n\terr := injectTraceCtx(span, inv)\n\tassert.NoError(t, err)\n\n\t// rebuild the context success\n\tinv = invocation.NewRPCInvocation(\"MethodName\", []interface{}{\"OK\", \"Hello\"}, attach)\n\tctx = rebuildCtx(inv)\n\tspan.Finish()\n\tassert.NotNil(t, ctx)\n\tassert.NotNil(t, ctx.Value(constant.TracingRemoteSpanCtx))\n}", "title": "" }, { "docid": "777ecc82ab485c12c8048a251fdc9680", "score": "0.41119", "text": "func updateSCtoDefault(ctx context.Context, client clientset.Interface, scName, isDefault string) error {\n\n\tsc, err := client.StorageV1().StorageClasses().Get(ctx, scName, metav1.GetOptions{})\n\tif err != nil {\n\t\tframework.Failf(\"Failed to get storage class %s from cluster, err=%+v\", sc.Name, err)\n\t\treturn err\n\t}\n\n\tpatch := map[string]interface{}{\n\t\t\"metadata\": map[string]interface{}{\n\t\t\t\"annotations\": map[string]string{\n\t\t\t\t\"storageclass.kubernetes.io/is-default-class\": isDefault,\n\t\t\t},\n\t\t},\n\t}\n\tpatchBytes, err := json.Marshal(patch)\n\tif err != nil {\n\t\tframework.Failf(\"Failed to marshal patch(%s): %s\", patch, err)\n\t\treturn err\n\t}\n\n\t// Patch the storage class with the updated annotation.\n\tupdatedSC, err := client.StorageV1().StorageClasses().Patch(ctx,\n\t\tscName, \"application/merge-patch+json\", patchBytes, metav1.PatchOptions{})\n\tif err != nil {\n\t\tframework.Failf(\"Failed to patch the storage class object with isDefault. Err = %+v\", err)\n\t\treturn err\n\t}\n\tframework.Logf(\"Successfully updated annotations of storage class '%s' to:\\n%v\", scName, updatedSC.Annotations)\n\treturn nil\n}", "title": "" }, { "docid": "f37982dbe43aa3f7835e03c8bb521e25", "score": "0.41089746", "text": "func (ess *ExternalSigningServer) EnableCASigning() error {\n\tess.handler.mu.Lock()\n\tdefer ess.handler.mu.Unlock()\n\n\tcopied := *ess.handler.origPolicy\n\tif copied.Profiles == nil {\n\t\tcopied.Profiles = make(map[string]*config.SigningProfile)\n\t}\n\tcopied.Profiles[ca.ExternalCrossSignProfile] = &crossSignPolicy\n\n\tess.handler.localSigner.SetPolicy(&copied)\n\treturn nil\n}", "title": "" }, { "docid": "93741bd8f5446c3d168f817ee129b63a", "score": "0.4102827", "text": "func (o *Automation) ToSparse(fields ...string) elemental.SparseIdentifiable {\n\n\tif len(fields) == 0 {\n\t\t// nolint: goimports\n\t\treturn &SparseAutomation{\n\t\t\tID: &o.ID,\n\t\t\tActions: &o.Actions,\n\t\t\tAnnotations: &o.Annotations,\n\t\t\tAporetoToken: &o.AporetoToken,\n\t\t\tAppCredential: &o.AppCredential,\n\t\t\tAssociatedTags: &o.AssociatedTags,\n\t\t\tCondition: &o.Condition,\n\t\t\tCreateIdempotencyKey: &o.CreateIdempotencyKey,\n\t\t\tCreateTime: &o.CreateTime,\n\t\t\tDescription: &o.Description,\n\t\t\tDisabled: &o.Disabled,\n\t\t\tEntitlements: &o.Entitlements,\n\t\t\tErrors: &o.Errors,\n\t\t\tEvents: &o.Events,\n\t\t\tImmediateExecution: &o.ImmediateExecution,\n\t\t\tLastExecTime: &o.LastExecTime,\n\t\t\tMigrationsLog: &o.MigrationsLog,\n\t\t\tName: &o.Name,\n\t\t\tNamespace: &o.Namespace,\n\t\t\tNormalizedTags: &o.NormalizedTags,\n\t\t\tParameters: &o.Parameters,\n\t\t\tProtected: &o.Protected,\n\t\t\tSchedule: &o.Schedule,\n\t\t\tSignature: &o.Signature,\n\t\t\tStdout: &o.Stdout,\n\t\t\tToken: &o.Token,\n\t\t\tTokenRenew: &o.TokenRenew,\n\t\t\tTrigger: &o.Trigger,\n\t\t\tUpdateIdempotencyKey: &o.UpdateIdempotencyKey,\n\t\t\tUpdateTime: &o.UpdateTime,\n\t\t\tZHash: &o.ZHash,\n\t\t\tZone: &o.Zone,\n\t\t}\n\t}\n\n\tsp := &SparseAutomation{}\n\tfor _, f := range fields {\n\t\tswitch f {\n\t\tcase \"ID\":\n\t\t\tsp.ID = &(o.ID)\n\t\tcase \"actions\":\n\t\t\tsp.Actions = &(o.Actions)\n\t\tcase \"annotations\":\n\t\t\tsp.Annotations = &(o.Annotations)\n\t\tcase \"aporetoToken\":\n\t\t\tsp.AporetoToken = &(o.AporetoToken)\n\t\tcase \"appCredential\":\n\t\t\tsp.AppCredential = &(o.AppCredential)\n\t\tcase \"associatedTags\":\n\t\t\tsp.AssociatedTags = &(o.AssociatedTags)\n\t\tcase \"condition\":\n\t\t\tsp.Condition = &(o.Condition)\n\t\tcase \"createIdempotencyKey\":\n\t\t\tsp.CreateIdempotencyKey = &(o.CreateIdempotencyKey)\n\t\tcase \"createTime\":\n\t\t\tsp.CreateTime = &(o.CreateTime)\n\t\tcase \"description\":\n\t\t\tsp.Description = &(o.Description)\n\t\tcase \"disabled\":\n\t\t\tsp.Disabled = &(o.Disabled)\n\t\tcase \"entitlements\":\n\t\t\tsp.Entitlements = &(o.Entitlements)\n\t\tcase \"errors\":\n\t\t\tsp.Errors = &(o.Errors)\n\t\tcase \"events\":\n\t\t\tsp.Events = &(o.Events)\n\t\tcase \"immediateExecution\":\n\t\t\tsp.ImmediateExecution = &(o.ImmediateExecution)\n\t\tcase \"lastExecTime\":\n\t\t\tsp.LastExecTime = &(o.LastExecTime)\n\t\tcase \"migrationsLog\":\n\t\t\tsp.MigrationsLog = &(o.MigrationsLog)\n\t\tcase \"name\":\n\t\t\tsp.Name = &(o.Name)\n\t\tcase \"namespace\":\n\t\t\tsp.Namespace = &(o.Namespace)\n\t\tcase \"normalizedTags\":\n\t\t\tsp.NormalizedTags = &(o.NormalizedTags)\n\t\tcase \"parameters\":\n\t\t\tsp.Parameters = &(o.Parameters)\n\t\tcase \"protected\":\n\t\t\tsp.Protected = &(o.Protected)\n\t\tcase \"schedule\":\n\t\t\tsp.Schedule = &(o.Schedule)\n\t\tcase \"signature\":\n\t\t\tsp.Signature = &(o.Signature)\n\t\tcase \"stdout\":\n\t\t\tsp.Stdout = &(o.Stdout)\n\t\tcase \"token\":\n\t\t\tsp.Token = &(o.Token)\n\t\tcase \"tokenRenew\":\n\t\t\tsp.TokenRenew = &(o.TokenRenew)\n\t\tcase \"trigger\":\n\t\t\tsp.Trigger = &(o.Trigger)\n\t\tcase \"updateIdempotencyKey\":\n\t\t\tsp.UpdateIdempotencyKey = &(o.UpdateIdempotencyKey)\n\t\tcase \"updateTime\":\n\t\t\tsp.UpdateTime = &(o.UpdateTime)\n\t\tcase \"zHash\":\n\t\t\tsp.ZHash = &(o.ZHash)\n\t\tcase \"zone\":\n\t\t\tsp.Zone = &(o.Zone)\n\t\t}\n\t}\n\n\treturn sp\n}", "title": "" }, { "docid": "7b3855ec123d579e931eeadfa4c2110f", "score": "0.40990114", "text": "func NewTrustedCA() *TrustedCA {\n\n\treturn &TrustedCA{\n\t\tModelVersion: 1,\n\t}\n}", "title": "" }, { "docid": "2622b8d135128ed4003fb29f3e938b8b", "score": "0.40962964", "text": "func (b BasicConstraints) Set(c *x509.Certificate) {\n\tc.IsCA = b.IsCA\n\tif c.IsCA {\n\t\tc.BasicConstraintsValid = true\n\t\tswitch {\n\t\tcase b.MaxPathLen == 0:\n\t\t\tc.MaxPathLen = 0\n\t\t\tc.MaxPathLenZero = true\n\t\tcase b.MaxPathLen < 0:\n\t\t\tc.MaxPathLen = -1\n\t\t\tc.MaxPathLenZero = false\n\t\tdefault:\n\t\t\tc.MaxPathLen = b.MaxPathLen\n\t\t\tc.MaxPathLenZero = false\n\t\t}\n\t} else {\n\t\tc.BasicConstraintsValid = false\n\t\tc.MaxPathLen = 0\n\t\tc.MaxPathLenZero = false\n\t}\n}", "title": "" }, { "docid": "874196983d97b3d45348a99274c39933", "score": "0.40747845", "text": "func (o *TrustedCA) SetIdentifier(id string) {\n\n}", "title": "" }, { "docid": "8a41442e5c28df3171fd3774188a0eb3", "score": "0.40728143", "text": "func (m *SslCertificate) SetFingerprint(value *string)() {\n err := m.GetBackingStore().Set(\"fingerprint\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "9ff945e6b1f325b0d6ab49a25de253c3", "score": "0.40680298", "text": "func (m *SslCertificate) SetSha1(value *string)() {\n err := m.GetBackingStore().Set(\"sha1\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "00f205f1cf0b33d69c32b9f9742bb065", "score": "0.40601617", "text": "func (m *UserExperienceAnalyticsWorkFromAnywhereDevice) SetCloudProvisioningScore(value *float64)() {\n err := m.GetBackingStore().Set(\"cloudProvisioningScore\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "ab956a9c91a6624ad116affe4bfc86c8", "score": "0.40594676", "text": "func PruneDefaultedAuthoritativeFieldIfOnlyLegacyFieldSpecifiedUnderSlice(original, reconciled *k8s.Resource, pathUpToSlice, nonReferenceFieldPath, referenceFieldPath []string) error {\n\toriginalSlice, foundOriginal, err := unstructured.NestedSlice(original.Spec, pathUpToSlice...)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error getting the nested slice under path %s for the original resource: %v\", strings.Join(pathUpToSlice, \".\"), err)\n\t}\n\treconciledSlice, foundReconciled, err := unstructured.NestedSlice(reconciled.Spec, pathUpToSlice...)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error getting the nested slice under path %s for the reconciled resource: %v\", strings.Join(pathUpToSlice, \".\"), err)\n\t}\n\tif !foundOriginal || !foundReconciled {\n\t\treturn nil\n\t}\n\tfor i, v := range originalSlice {\n\t\t_, foundReferenceField, err := unstructured.NestedFieldCopy(v.(map[string]interface{}), referenceFieldPath...)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error checking the existence of the nested reference field %s within the slice field of the original resource: %v\", strings.Join(referenceFieldPath, \".\"), err)\n\t\t}\n\t\t_, foundNonReferenceField, err := unstructured.NestedFieldCopy(v.(map[string]interface{}), nonReferenceFieldPath...)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error checking the existence of the nested non-reference field %s within the slice field of the original resource: %v\", strings.Join(nonReferenceFieldPath, \".\"), err)\n\t\t}\n\t\tif !foundReferenceField && foundNonReferenceField {\n\t\t\tunstructured.RemoveNestedField(reconciledSlice[i].(map[string]interface{}), referenceFieldPath...)\n\t\t}\n\t}\n\tif err := unstructured.SetNestedSlice(reconciled.Spec, reconciledSlice, pathUpToSlice...); err != nil {\n\t\treturn fmt.Errorf(\"error setting the altered slice field %s back into the reconciled resource: %v\", strings.Join(pathUpToSlice, \".\"), err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b7b0f452fe11366831da902c0996cca0", "score": "0.40474686", "text": "func (m *SslCertificate) SetSerialNumber(value *string)() {\n err := m.GetBackingStore().Set(\"serialNumber\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "b751556edc620a10ba0b1903782d9f98", "score": "0.40460333", "text": "func (s *Sparse) ProdMatrixScalarInPlace(m Matrix, n float64) Matrix {\n\tif _, ok := m.(*Sparse); !ok {\n\t\tpanic(\"mat: incompatible matrix types.\")\n\t}\n\tif !SameDims(s, m) {\n\t\tpanic(\"mat: incompatible matrix dimensions.\")\n\t}\n\tif n == 0.0 {\n\t\treturn NewEmptySparse(s.rows, s.cols)\n\t}\n\tfor _, elem := range m.(*Sparse).colsIndex {\n\t\ts.colsIndex = append(s.colsIndex, elem)\n\t}\n\tfor i := 0; i < len(m.(*Sparse).nnzRow); i++ {\n\t\ts.nnzRow[i] = m.(*Sparse).nnzRow[i]\n\t}\n\tfor _, elem := range m.(*Sparse).nzElements {\n\t\ts.nzElements = append(s.nzElements, elem*n)\n\t}\n\treturn s\n}", "title": "" }, { "docid": "572f9066cb40479cda3c3593ab16d37e", "score": "0.4045991", "text": "func (r *reconciler) updateServiceCAConfigMap(current, desired *corev1.ConfigMap) (bool, error) {\n\tif current.Annotations[\"service.beta.openshift.io/inject-cabundle\"] == \"true\" {\n\t\treturn false, nil\n\t}\n\n\tupdated := current.DeepCopy()\n\tupdated.Annotations[\"service.beta.openshift.io/inject-cabundle\"] = \"true\"\n\t// Diff before updating because the client may mutate the object.\n\tdiff := cmp.Diff(current, updated, cmpopts.EquateEmpty())\n\tif err := r.client.Update(context.TODO(), updated); err != nil {\n\t\tif errors.IsAlreadyExists(err) {\n\t\t\treturn false, nil\n\t\t}\n\t\treturn false, err\n\t}\n\tlog.Info(\"updated configmap\", \"namespace\", updated.Namespace, \"name\", updated.Name, \"diff\", diff)\n\treturn true, nil\n}", "title": "" }, { "docid": "62d0d7c8a1acc1016460d12a094d1884", "score": "0.40434006", "text": "func NewSparseLDAPProvider() *SparseLDAPProvider {\n\treturn &SparseLDAPProvider{}\n}", "title": "" }, { "docid": "6d89a54da6af12b12bba6e916c80e2a2", "score": "0.40397215", "text": "func (m *CertificateAuthority) SetIsRootAuthority(value *bool)() {\n m.isRootAuthority = value\n}", "title": "" }, { "docid": "8a3c017f512103634a3bbf8ded6148b2", "score": "0.40393087", "text": "func (m *AospDeviceOwnerCompliancePolicy) SetSecurityBlockJailbrokenDevices(value *bool)() {\n err := m.GetBackingStore().Set(\"securityBlockJailbrokenDevices\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "ee1cc1bf2c107bf8ba8a4992667fdd56", "score": "0.403252", "text": "func (m *Incident) SetSeverity(value *AlertSeverity)() {\n err := m.GetBackingStore().Set(\"severity\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "f99c8620a3ba49734874466bb66a8f3f", "score": "0.403166", "text": "func (s *lockServer) patchLock(w http.ResponseWriter, r *http.Request) {\n\tkey := r.URL.Query().Get(\"key\")\n\tif key == \"\" {\n\t\tif err := socket.WriteError(w, \"key missing\", http.StatusNotFound); err != nil {\n\t\t\ts.logger.Error(\"Agent API: couldn't write error: %v\", err)\n\t\t}\n\t\treturn\n\t}\n\n\tvar req LockCASRequest\n\tif err := json.NewDecoder(r.Body).Decode(&req); err != nil {\n\t\tif err := socket.WriteError(w, fmt.Sprintf(\"couldn't decode request body: %v\", err), http.StatusBadRequest); err != nil {\n\t\t\ts.logger.Error(\"Agent API: couldn't write error: %v\", err)\n\t\t}\n\t\treturn\n\t}\n\n\tv, ok := s.locks.cas(key, req.Old, req.New)\n\tresp := &LockCASResponse{\n\t\tValue: v,\n\t\tSwapped: ok,\n\t}\n\tif err := json.NewEncoder(w).Encode(resp); err != nil {\n\t\ts.logger.Error(\"Agent API: couldn't encode response body: %v\", err)\n\t}\n}", "title": "" }, { "docid": "ea16ca343d19f9f6036e5c922cf93318", "score": "0.40263253", "text": "func (o *TrustedCA) DeepCopy() *TrustedCA {\n\n\tif o == nil {\n\t\treturn nil\n\t}\n\n\tout := &TrustedCA{}\n\to.DeepCopyInto(out)\n\n\treturn out\n}", "title": "" }, { "docid": "5090d289009625155332881ab80be521", "score": "0.40248773", "text": "func (o LDAPProvidersList) ToSparse(fields ...string) elemental.Identifiables {\n\n\tout := make(SparseLDAPProvidersList, len(o))\n\tfor i := 0; i < len(o); i++ {\n\t\tout[i] = o[i].ToSparse(fields...).(*SparseLDAPProvider)\n\t}\n\n\treturn out\n}", "title": "" }, { "docid": "555a16f46f1f958a945b8c708c1fbcc6", "score": "0.40243796", "text": "func (o *PingProbe) ToSparse(fields ...string) elemental.SparseIdentifiable {\n\n\tif len(fields) == 0 {\n\t\t// nolint: goimports\n\t\treturn &SparsePingProbe{\n\t\t\tACLPolicyAction: &o.ACLPolicyAction,\n\t\t\tACLPolicyID: &o.ACLPolicyID,\n\t\t\tID: &o.ID,\n\t\t\tRTT: &o.RTT,\n\t\t\tApplicationListening: &o.ApplicationListening,\n\t\t\tClaims: &o.Claims,\n\t\t\tClaimsType: &o.ClaimsType,\n\t\t\tCreateTime: &o.CreateTime,\n\t\t\tEnforcerID: &o.EnforcerID,\n\t\t\tEnforcerNamespace: &o.EnforcerNamespace,\n\t\t\tEnforcerVersion: &o.EnforcerVersion,\n\t\t\tError: &o.Error,\n\t\t\tExcludedNetworks: &o.ExcludedNetworks,\n\t\t\tFourTuple: &o.FourTuple,\n\t\t\tIsServer: &o.IsServer,\n\t\t\tIterationIndex: &o.IterationIndex,\n\t\t\tMigrationsLog: &o.MigrationsLog,\n\t\t\tNamespace: &o.Namespace,\n\t\t\tPayloadSize: &o.PayloadSize,\n\t\t\tPayloadSizeType: &o.PayloadSizeType,\n\t\t\tPeerCertExpiry: &o.PeerCertExpiry,\n\t\t\tPeerCertIssuer: &o.PeerCertIssuer,\n\t\t\tPeerCertSubject: &o.PeerCertSubject,\n\t\t\tPingID: &o.PingID,\n\t\t\tPolicyAction: &o.PolicyAction,\n\t\t\tPolicyID: &o.PolicyID,\n\t\t\tPolicyNamespace: &o.PolicyNamespace,\n\t\t\tProcessingUnitID: &o.ProcessingUnitID,\n\t\t\tProtocol: &o.Protocol,\n\t\t\tRemoteController: &o.RemoteController,\n\t\t\tRemoteEndpointType: &o.RemoteEndpointType,\n\t\t\tRemoteNamespace: &o.RemoteNamespace,\n\t\t\tRemoteNamespaceType: &o.RemoteNamespaceType,\n\t\t\tRemoteProcessingUnitID: &o.RemoteProcessingUnitID,\n\t\t\tSeqNum: &o.SeqNum,\n\t\t\tServiceID: &o.ServiceID,\n\t\t\tServiceType: &o.ServiceType,\n\t\t\tTargetTCPNetworks: &o.TargetTCPNetworks,\n\t\t\tType: &o.Type,\n\t\t\tUpdateTime: &o.UpdateTime,\n\t\t\tZHash: &o.ZHash,\n\t\t\tZone: &o.Zone,\n\t\t}\n\t}\n\n\tsp := &SparsePingProbe{}\n\tfor _, f := range fields {\n\t\tswitch f {\n\t\tcase \"ACLPolicyAction\":\n\t\t\tsp.ACLPolicyAction = &(o.ACLPolicyAction)\n\t\tcase \"ACLPolicyID\":\n\t\t\tsp.ACLPolicyID = &(o.ACLPolicyID)\n\t\tcase \"ID\":\n\t\t\tsp.ID = &(o.ID)\n\t\tcase \"RTT\":\n\t\t\tsp.RTT = &(o.RTT)\n\t\tcase \"applicationListening\":\n\t\t\tsp.ApplicationListening = &(o.ApplicationListening)\n\t\tcase \"claims\":\n\t\t\tsp.Claims = &(o.Claims)\n\t\tcase \"claimsType\":\n\t\t\tsp.ClaimsType = &(o.ClaimsType)\n\t\tcase \"createTime\":\n\t\t\tsp.CreateTime = &(o.CreateTime)\n\t\tcase \"enforcerID\":\n\t\t\tsp.EnforcerID = &(o.EnforcerID)\n\t\tcase \"enforcerNamespace\":\n\t\t\tsp.EnforcerNamespace = &(o.EnforcerNamespace)\n\t\tcase \"enforcerVersion\":\n\t\t\tsp.EnforcerVersion = &(o.EnforcerVersion)\n\t\tcase \"error\":\n\t\t\tsp.Error = &(o.Error)\n\t\tcase \"excludedNetworks\":\n\t\t\tsp.ExcludedNetworks = &(o.ExcludedNetworks)\n\t\tcase \"fourTuple\":\n\t\t\tsp.FourTuple = &(o.FourTuple)\n\t\tcase \"isServer\":\n\t\t\tsp.IsServer = &(o.IsServer)\n\t\tcase \"iterationIndex\":\n\t\t\tsp.IterationIndex = &(o.IterationIndex)\n\t\tcase \"migrationsLog\":\n\t\t\tsp.MigrationsLog = &(o.MigrationsLog)\n\t\tcase \"namespace\":\n\t\t\tsp.Namespace = &(o.Namespace)\n\t\tcase \"payloadSize\":\n\t\t\tsp.PayloadSize = &(o.PayloadSize)\n\t\tcase \"payloadSizeType\":\n\t\t\tsp.PayloadSizeType = &(o.PayloadSizeType)\n\t\tcase \"peerCertExpiry\":\n\t\t\tsp.PeerCertExpiry = &(o.PeerCertExpiry)\n\t\tcase \"peerCertIssuer\":\n\t\t\tsp.PeerCertIssuer = &(o.PeerCertIssuer)\n\t\tcase \"peerCertSubject\":\n\t\t\tsp.PeerCertSubject = &(o.PeerCertSubject)\n\t\tcase \"pingID\":\n\t\t\tsp.PingID = &(o.PingID)\n\t\tcase \"policyAction\":\n\t\t\tsp.PolicyAction = &(o.PolicyAction)\n\t\tcase \"policyID\":\n\t\t\tsp.PolicyID = &(o.PolicyID)\n\t\tcase \"policyNamespace\":\n\t\t\tsp.PolicyNamespace = &(o.PolicyNamespace)\n\t\tcase \"processingUnitID\":\n\t\t\tsp.ProcessingUnitID = &(o.ProcessingUnitID)\n\t\tcase \"protocol\":\n\t\t\tsp.Protocol = &(o.Protocol)\n\t\tcase \"remoteController\":\n\t\t\tsp.RemoteController = &(o.RemoteController)\n\t\tcase \"remoteEndpointType\":\n\t\t\tsp.RemoteEndpointType = &(o.RemoteEndpointType)\n\t\tcase \"remoteNamespace\":\n\t\t\tsp.RemoteNamespace = &(o.RemoteNamespace)\n\t\tcase \"remoteNamespaceType\":\n\t\t\tsp.RemoteNamespaceType = &(o.RemoteNamespaceType)\n\t\tcase \"remoteProcessingUnitID\":\n\t\t\tsp.RemoteProcessingUnitID = &(o.RemoteProcessingUnitID)\n\t\tcase \"seqNum\":\n\t\t\tsp.SeqNum = &(o.SeqNum)\n\t\tcase \"serviceID\":\n\t\t\tsp.ServiceID = &(o.ServiceID)\n\t\tcase \"serviceType\":\n\t\t\tsp.ServiceType = &(o.ServiceType)\n\t\tcase \"targetTCPNetworks\":\n\t\t\tsp.TargetTCPNetworks = &(o.TargetTCPNetworks)\n\t\tcase \"type\":\n\t\t\tsp.Type = &(o.Type)\n\t\tcase \"updateTime\":\n\t\t\tsp.UpdateTime = &(o.UpdateTime)\n\t\tcase \"zHash\":\n\t\t\tsp.ZHash = &(o.ZHash)\n\t\tcase \"zone\":\n\t\t\tsp.Zone = &(o.Zone)\n\t\t}\n\t}\n\n\treturn sp\n}", "title": "" } ]
b3f15e7a1836e612bbc165eb0c7626ac
Float64sX is like Float64s, but panics if an error occurs.
[ { "docid": "4263856c9f6da703b0311c31e6772395", "score": "0.75168294", "text": "func (dvls *DeletedVlanLogSelect) Float64sX(ctx context.Context) []float64 {\n\tv, err := dvls.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" } ]
[ { "docid": "442f898c74908164c2c93c53785e2f0b", "score": "0.75781363", "text": "func (ns *NetworkSelect) Float64sX(ctx context.Context) []float64 {\n\tv, err := ns.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "40492f125583bd3245b646afc40bada6", "score": "0.75347567", "text": "func (lms *LogMsgSelect) Float64sX(ctx context.Context) []float64 {\n\tv, err := lms.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "5dbab33fed735f99e447416ebea88bab", "score": "0.7523544", "text": "func (sos *StatusOpinionSelect) Float64sX(ctx context.Context) []float64 {\n\tv, err := sos.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "b998fe38c3aca64c398f84c7d9e98ae4", "score": "0.74945575", "text": "func (tts *TreatmentTypeSelect) Float64sX(ctx context.Context) []float64 {\n\tv, err := tts.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "d476b8dddc7597dae2f1dce0cdc2b013", "score": "0.7489455", "text": "func (os *OperationSelect) Float64sX(ctx context.Context) []float64 {\n\tv, err := os.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "0d25353f2d72e2783ab8fbdff6410b57", "score": "0.7477025", "text": "func (hs *HistorySelect) Float64sX(ctx context.Context) []float64 {\n\tv, err := hs.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "8037610ab377b9e167f67610bd79f8e7", "score": "0.7460402", "text": "func (vs *VariantSelect) Float64sX(ctx context.Context) []float64 {\n\tv, err := vs.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "8037610ab377b9e167f67610bd79f8e7", "score": "0.7460402", "text": "func (vs *VariantSelect) Float64sX(ctx context.Context) []float64 {\n\tv, err := vs.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "aca52f22280ef7b8007250ade9268ba8", "score": "0.7450152", "text": "func (afs *AlarmFilterSelect) Float64sX(ctx context.Context) []float64 {\n\tv, err := afs.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "0515ab38318cb0ada4699fda8f5b34c5", "score": "0.7447818", "text": "func (fets *FlowExecutionTemplateSelect) Float64sX(ctx context.Context) []float64 {\n\tv, err := fets.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "8e9ba11bcaf3503be6d6a3267619df2a", "score": "0.7442927", "text": "func (qis *QueueItemSelect) Float64sX(ctx context.Context) []float64 {\n\tv, err := qis.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "4c1f6f16fb75e302e8141b8cb7ef491d", "score": "0.7437018", "text": "func (is *InsuranceSelect) Float64sX(ctx context.Context) []float64 {\n\tv, err := is.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "0f7a39423f100e38168f758108050951", "score": "0.74277794", "text": "func (is *InstanceSelect) Float64sX(ctx context.Context) []float64 {\n\tv, err := is.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "433904e4e12e48e55a991b0a5457e08d", "score": "0.7417594", "text": "func (os *OptSelect) Float64sX(ctx context.Context) []float64 {\n\tv, err := os.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "de5413c6e5d6b358d57c96d585c79b74", "score": "0.7410465", "text": "func (ts *TransportSelect) Float64sX(ctx context.Context) []float64 {\n\tv, err := ts.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "4d93c58e3d6dd14228c3ed7e55d561a7", "score": "0.7408734", "text": "func (nts *NetTopologySelect) Float64sX(ctx context.Context) []float64 {\n\tv, err := nts.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "9b1eb8e06e25f9d850f8758f4a4946b3", "score": "0.74048316", "text": "func (nms *NodeMetadataSelect) Float64sX(ctx context.Context) []float64 {\n\tv, err := nms.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "ccbcc61444f422d7370395349714ce7c", "score": "0.739365", "text": "func (wots *WorkOrderTypeSelect) Float64sX(ctx context.Context) []float64 {\n\tv, err := wots.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "f18bedeece7933888f4542f894ac5968", "score": "0.738893", "text": "func (rs *RestaurantSelect) Float64sX(ctx context.Context) []float64 {\n\tv, err := rs.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "dcc690e58a2d4174c2a279ab2984e4b8", "score": "0.7368112", "text": "func (ps *PhotoSelect) Float64sX(ctx context.Context) []float64 {\n\tv, err := ps.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "8f64ddce92fac77fe590c3a04cfdfa44", "score": "0.7335766", "text": "func (stqs *SurveyTemplateQuestionSelect) Float64sX(ctx context.Context) []float64 {\n\tv, err := stqs.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "2cc159107e816dc12419b5a07aa80de5", "score": "0.7331683", "text": "func (ds *DoctorinfoSelect) Float64sX(ctx context.Context) []float64 {\n\tv, err := ds.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "745c3d96a74c3284948ff3339178bf4b", "score": "0.7326669", "text": "func (gsos *GoodsSpecsOptionSelect) Float64sX(ctx context.Context) []float64 {\n\tv, err := gsos.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "89c6f47b12b3807f9a5d85cdf046ffc9", "score": "0.73008925", "text": "func (utrs *UserTagRelationSelect) Float64sX(ctx context.Context) []float64 {\n\tv, err := utrs.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "517a1d3933d7075e98c8df794f43604a", "score": "0.7296663", "text": "func (ots *OtherTestSelect) Float64sX(ctx context.Context) []float64 {\n\tv, err := ots.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "74d9169c7b1e3fbac621edacacedc2da", "score": "0.7292304", "text": "func (sps *ServicePointSelect) Float64sX(ctx context.Context) []float64 {\n\tv, err := sps.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "77fec82b3cd78fa39bee96dcbc8ff7f3", "score": "0.7260135", "text": "func (ts *TestSelect) Float64sX(ctx context.Context) []float64 {\n\tv, err := ts.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "28a4b42c2f2eb0a822fba354946d9b3c", "score": "0.72440803", "text": "func (ts *TreatmentSelect) Float64sX(ctx context.Context) []float64 {\n\tv, err := ts.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "b087a05e17e7cad30dffbc14d638f731", "score": "0.72223663", "text": "func (rs *RankingSelect) Float64sX(ctx context.Context) []float64 {\n\tv, err := rs.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "bedca7612d36317eab92be9c14b4c32c", "score": "0.7185918", "text": "func (tws *TwoWordSelect) Float64sX(ctx context.Context) []float64 {\n\tv, err := tws.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "589ba4133355677cb7c3401d92ea8141", "score": "0.71808493", "text": "func (kts *KqiTargetSelect) Float64sX(ctx context.Context) []float64 {\n\tv, err := kts.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "93d6819fbcef3593fba90e6428034aa2", "score": "0.71622103", "text": "func (dvlgb *DeletedVlanLogGroupBy) Float64sX(ctx context.Context) []float64 {\n\tv, err := dvlgb.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "0b023d78f84c4bd7994c586cf5608d81", "score": "0.71603566", "text": "func (bds *BankingDataSelect) Float64sX(ctx context.Context) []float64 {\n\tv, err := bds.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "0c1d1b403324b55573e4d5b53cdea960", "score": "0.7138844", "text": "func (igb *InsuranceGroupBy) Float64sX(ctx context.Context) []float64 {\n\tv, err := igb.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "a78f770f05f4d2e7af42454a88f5828d", "score": "0.7138312", "text": "func (vgb *VariantGroupBy) Float64sX(ctx context.Context) []float64 {\n\tv, err := vgb.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "a78f770f05f4d2e7af42454a88f5828d", "score": "0.7138312", "text": "func (vgb *VariantGroupBy) Float64sX(ctx context.Context) []float64 {\n\tv, err := vgb.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "e08b2c50c3155227e7baa98a3a164fcb", "score": "0.71362686", "text": "func (wts *WidgetTypeSelect) Float64sX(ctx context.Context) []float64 {\n\tv, err := wts.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "f25796f789b671fcbae7b5083b2ffb98", "score": "0.7108617", "text": "func (jps *JobPositionSelect) Float64sX(ctx context.Context) []float64 {\n\tv, err := jps.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "257bbed7641bc5ca714d80517953e18c", "score": "0.7101578", "text": "func (afgb *AlarmFilterGroupBy) Float64sX(ctx context.Context) []float64 {\n\tv, err := afgb.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "8b8b97656b7f90e18e577c510e292f6d", "score": "0.70829326", "text": "func (ngb *NetworkGroupBy) Float64sX(ctx context.Context) []float64 {\n\tv, err := ngb.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "efe682141d45956322118d9406c551db", "score": "0.70697796", "text": "func (wotgb *WorkOrderTypeGroupBy) Float64sX(ctx context.Context) []float64 {\n\tv, err := wotgb.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "f5e4b517257e92b3d742f6f065eaede6", "score": "0.70598197", "text": "func (ps *PreemptionSelect) Float64sX(ctx context.Context) []float64 {\n\tv, err := ps.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "8d6e0ef121ba480c6e5fef732eb22cb0", "score": "0.70514965", "text": "func (as *AuthorSelect) Float64sX(ctx context.Context) []float64 {\n\tv, err := as.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "04fbf581dafbc37ebfa8f9ce975a2ead", "score": "0.7046463", "text": "func (fprps *FloorPlanReferencePointSelect) Float64sX(ctx context.Context) []float64 {\n\tv, err := fprps.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "92ef2f629f2629acd39c693307256062", "score": "0.704422", "text": "func (utrgb *UserTagRelationGroupBy) Float64sX(ctx context.Context) []float64 {\n\tv, err := utrgb.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "32fafa161aeddd88bf4923a00d157fa6", "score": "0.7041301", "text": "func (kcs *KqiCategorySelect) Float64sX(ctx context.Context) []float64 {\n\tv, err := kcs.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "deacc9928fa0002f7a973e619d66f904", "score": "0.70401406", "text": "func (ttgb *TreatmentTypeGroupBy) Float64sX(ctx context.Context) []float64 {\n\tv, err := ttgb.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "6918fc990cb188d38ff0c888b93ea96b", "score": "0.7034793", "text": "func (sogb *StatusOpinionGroupBy) Float64sX(ctx context.Context) []float64 {\n\tv, err := sogb.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "1dc0e2d18e093b5f24b99d7b138d05f3", "score": "0.7024763", "text": "func (igb *InstanceGroupBy) Float64sX(ctx context.Context) []float64 {\n\tv, err := igb.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "77cfde8d4f4031e4bcd6b1d67533bb2c", "score": "0.70171136", "text": "func (hgb *HistoryGroupBy) Float64sX(ctx context.Context) []float64 {\n\tv, err := hgb.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "f5adabf48b21f8cd5ed0b05abdbb25d9", "score": "0.7015615", "text": "func (fetgb *FlowExecutionTemplateGroupBy) Float64sX(ctx context.Context) []float64 {\n\tv, err := fetgb.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "6b3f02e7276499083f605cc5292497f7", "score": "0.6989853", "text": "func (fps *FloorPlanSelect) Float64sX(ctx context.Context) []float64 {\n\tv, err := fps.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "a2ad2787ee7f932393a824a72047941d", "score": "0.697822", "text": "func (lmgb *LogMsgGroupBy) Float64sX(ctx context.Context) []float64 {\n\tv, err := lmgb.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "5aecb4af67ebbf720bbb6692385e23c1", "score": "0.69607943", "text": "func (ntgb *NetTopologyGroupBy) Float64sX(ctx context.Context) []float64 {\n\tv, err := ntgb.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "ef96ababde5dc21ea3b8f33f71fa5131", "score": "0.6958343", "text": "func (qigb *QueueItemGroupBy) Float64sX(ctx context.Context) []float64 {\n\tv, err := qigb.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "095350f4d4f75276088f65d917b2ed31", "score": "0.6956727", "text": "func (tgb *TransportGroupBy) Float64sX(ctx context.Context) []float64 {\n\tv, err := tgb.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "1122c29d729630485f3360358f6f4c10", "score": "0.6926833", "text": "func (rgb *RestaurantGroupBy) Float64sX(ctx context.Context) []float64 {\n\tv, err := rgb.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "cc8569770189923a8709d6c5663551d6", "score": "0.6925922", "text": "func (dgb *DoctorinfoGroupBy) Float64sX(ctx context.Context) []float64 {\n\tv, err := dgb.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "cec8f7ddf367dc602334bd1327c1f040", "score": "0.6914015", "text": "func (pgb *PhotoGroupBy) Float64sX(ctx context.Context) []float64 {\n\tv, err := pgb.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "a7c05d85cfd89bf0c117f22f0f85172a", "score": "0.6904624", "text": "func (stqgb *SurveyTemplateQuestionGroupBy) Float64sX(ctx context.Context) []float64 {\n\tv, err := stqgb.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "e6f42b624538161d1a4f949afe2ad915", "score": "0.68955386", "text": "func (nmgb *NodeMetadataGroupBy) Float64sX(ctx context.Context) []float64 {\n\tv, err := nmgb.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "5ca1b97d0bc0dc2829e231c62213cbcb", "score": "0.6882831", "text": "func (fpgb *FloorPlanGroupBy) Float64sX(ctx context.Context) []float64 {\n\tv, err := fpgb.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "ce5b2f0837a0e825e6baf717d9dcc1cf", "score": "0.68794465", "text": "func (gsogb *GoodsSpecsOptionGroupBy) Float64sX(ctx context.Context) []float64 {\n\tv, err := gsogb.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "bc01daddabc5c8cd5d74242bd3c2a002", "score": "0.68680525", "text": "func (ogb *OptGroupBy) Float64sX(ctx context.Context) []float64 {\n\tv, err := ogb.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "374a74cbaaa9ab11c22e96449e540dd3", "score": "0.6856499", "text": "func (spgb *ServicePointGroupBy) Float64sX(ctx context.Context) []float64 {\n\tv, err := spgb.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "8d4ac9c2821524b9088e1442fdcb2ab8", "score": "0.6850721", "text": "func (otgb *OtherTestGroupBy) Float64sX(ctx context.Context) []float64 {\n\tv, err := otgb.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "5a3845816bdc3e90d0b675cbe93ab0fc", "score": "0.6839956", "text": "func (jpgb *JobPositionGroupBy) Float64sX(ctx context.Context) []float64 {\n\tv, err := jpgb.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "83c7df561cb2eaf75b5eb0efcc611c28", "score": "0.682601", "text": "func (dvls *DeletedVlanLogSelect) Float64s(ctx context.Context) ([]float64, error) {\n\tif len(dvls.fields) > 1 {\n\t\treturn nil, errors.New(\"ent: DeletedVlanLogSelect.Float64s is not achievable when selecting more than 1 field\")\n\t}\n\tvar v []float64\n\tif err := dvls.Scan(ctx, &v); err != nil {\n\t\treturn nil, err\n\t}\n\treturn v, nil\n}", "title": "" }, { "docid": "b5ce8124e404f13489df84ee3ad6bb2d", "score": "0.68236494", "text": "func (fprpgb *FloorPlanReferencePointGroupBy) Float64sX(ctx context.Context) []float64 {\n\tv, err := fprpgb.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "f44e6a7075966faa0e3cd5607fe6f0a0", "score": "0.6796881", "text": "func (ktgb *KqiTargetGroupBy) Float64sX(ctx context.Context) []float64 {\n\tv, err := ktgb.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "143334d27938e5e6b157f9637e75baff", "score": "0.67966413", "text": "func (tgb *TestGroupBy) Float64sX(ctx context.Context) []float64 {\n\tv, err := tgb.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "1c63a9b2846609a0522c3eda02615144", "score": "0.6791011", "text": "func (wtgb *WidgetTypeGroupBy) Float64sX(ctx context.Context) []float64 {\n\tv, err := wtgb.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "709d38d208f5c3ff3c4e5d276ee33dc2", "score": "0.6790367", "text": "func (ogb *OperationGroupBy) Float64sX(ctx context.Context) []float64 {\n\tv, err := ogb.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "185a9d2698a75696dbfdbc85071a22a3", "score": "0.6779192", "text": "func (tgb *TreatmentGroupBy) Float64sX(ctx context.Context) []float64 {\n\tv, err := tgb.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "8f5a21c91cb2e96ab56f2a8d2c087cc4", "score": "0.6772733", "text": "func (bdgb *BankingDataGroupBy) Float64sX(ctx context.Context) []float64 {\n\tv, err := bdgb.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "d6771a002d9054a6b989bea6fdc77198", "score": "0.6764126", "text": "func (twgb *TwoWordGroupBy) Float64sX(ctx context.Context) []float64 {\n\tv, err := twgb.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "8e6075ec2b4036824aa8bea7cabdc44c", "score": "0.6762903", "text": "func (fets *FlowExecutionTemplateSelect) Float64s(ctx context.Context) ([]float64, error) {\n\tif len(fets.fields) > 1 {\n\t\treturn nil, errors.New(\"ent: FlowExecutionTemplateSelect.Float64s is not achievable when selecting more than 1 field\")\n\t}\n\tvar v []float64\n\tif err := fets.Scan(ctx, &v); err != nil {\n\t\treturn nil, err\n\t}\n\treturn v, nil\n}", "title": "" }, { "docid": "52cb63177b51d67c9d3d81538d151be2", "score": "0.6743959", "text": "func (nts *NetTopologySelect) Float64s(ctx context.Context) ([]float64, error) {\n\tif len(nts.fields) > 1 {\n\t\treturn nil, errors.New(\"ent: NetTopologySelect.Float64s is not achievable when selecting more than 1 field\")\n\t}\n\tvar v []float64\n\tif err := nts.Scan(ctx, &v); err != nil {\n\t\treturn nil, err\n\t}\n\treturn v, nil\n}", "title": "" }, { "docid": "439b02016c312bb4832941c7bd710a44", "score": "0.673838", "text": "func (stqs *SurveyTemplateQuestionSelect) Float64s(ctx context.Context) ([]float64, error) {\n\tif len(stqs.fields) > 1 {\n\t\treturn nil, errors.New(\"ent: SurveyTemplateQuestionSelect.Float64s is not achievable when selecting more than 1 field\")\n\t}\n\tvar v []float64\n\tif err := stqs.Scan(ctx, &v); err != nil {\n\t\treturn nil, err\n\t}\n\treturn v, nil\n}", "title": "" }, { "docid": "9e9f899182085185f1ca494657654dcb", "score": "0.67361933", "text": "func (lms *LogMsgSelect) Float64s(ctx context.Context) ([]float64, error) {\n\tif len(lms.fields) > 1 {\n\t\treturn nil, errors.New(\"ent: LogMsgSelect.Float64s is not achievable when selecting more than 1 field\")\n\t}\n\tvar v []float64\n\tif err := lms.Scan(ctx, &v); err != nil {\n\t\treturn nil, err\n\t}\n\treturn v, nil\n}", "title": "" }, { "docid": "71132f65f586c7a498c933019176e70d", "score": "0.67312825", "text": "func (sos *StatusOpinionSelect) Float64s(ctx context.Context) ([]float64, error) {\n\tif len(sos.fields) > 1 {\n\t\treturn nil, errors.New(\"ent: StatusOpinionSelect.Float64s is not achievable when selecting more than 1 field\")\n\t}\n\tvar v []float64\n\tif err := sos.Scan(ctx, &v); err != nil {\n\t\treturn nil, err\n\t}\n\treturn v, nil\n}", "title": "" }, { "docid": "fe4b86258ec16d0a6502c165ad85242d", "score": "0.673086", "text": "func (ns *NetworkSelect) Float64s(ctx context.Context) ([]float64, error) {\n\tif len(ns.fields) > 1 {\n\t\treturn nil, errors.New(\"ent: NetworkSelect.Float64s is not achievable when selecting more than 1 field\")\n\t}\n\tvar v []float64\n\tif err := ns.Scan(ctx, &v); err != nil {\n\t\treturn nil, err\n\t}\n\treturn v, nil\n}", "title": "" }, { "docid": "c89dda68ec7dd9311c3b8b4d67a7bfc3", "score": "0.6696879", "text": "func (e *Event) Floats64(key string, f []float64) *Event {\n\tif e == nil {\n\t\treturn nil\n\t}\n\te.key(key)\n\te.buf = append(e.buf, '[')\n\tfor i, a := range f {\n\t\tif i != 0 {\n\t\t\te.buf = append(e.buf, ',')\n\t\t}\n\t\te.buf = strconv.AppendFloat(e.buf, a, 'f', -1, 64)\n\t}\n\te.buf = append(e.buf, ']')\n\treturn e\n}", "title": "" }, { "docid": "323299b6aeaf13e1bc85e6db9766f23f", "score": "0.66905826", "text": "func (hs *HistorySelect) Float64s(ctx context.Context) ([]float64, error) {\n\tif len(hs.fields) > 1 {\n\t\treturn nil, errors.New(\"ent: HistorySelect.Float64s is not achievable when selecting more than 1 field\")\n\t}\n\tvar v []float64\n\tif err := hs.Scan(ctx, &v); err != nil {\n\t\treturn nil, err\n\t}\n\treturn v, nil\n}", "title": "" }, { "docid": "45eb96b5e640bbcb3b4d60509084083b", "score": "0.6673895", "text": "func (rgb *RankingGroupBy) Float64sX(ctx context.Context) []float64 {\n\tv, err := rgb.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "1a0e135235ead38823558905f24e0a44", "score": "0.66698235", "text": "func (is *InsuranceSelect) Float64s(ctx context.Context) ([]float64, error) {\n\tif len(is.fields) > 1 {\n\t\treturn nil, errors.New(\"ent: InsuranceSelect.Float64s is not achievable when selecting more than 1 field\")\n\t}\n\tvar v []float64\n\tif err := is.Scan(ctx, &v); err != nil {\n\t\treturn nil, err\n\t}\n\treturn v, nil\n}", "title": "" }, { "docid": "b1f279e8022e53603603ecc6ae9123e2", "score": "0.66679335", "text": "func (pgb *PreemptionGroupBy) Float64sX(ctx context.Context) []float64 {\n\tv, err := pgb.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "e53dc5f119f023afb3d49d0f7dd652b7", "score": "0.6653032", "text": "func (tts *TreatmentTypeSelect) Float64s(ctx context.Context) ([]float64, error) {\n\tif len(tts.fields) > 1 {\n\t\treturn nil, errors.New(\"ent: TreatmentTypeSelect.Float64s is not achievable when selecting more than 1 field\")\n\t}\n\tvar v []float64\n\tif err := tts.Scan(ctx, &v); err != nil {\n\t\treturn nil, err\n\t}\n\treturn v, nil\n}", "title": "" }, { "docid": "0eb2122af13482c2189be76077a40705", "score": "0.66438407", "text": "func (vs *VariantSelect) Float64s(ctx context.Context) ([]float64, error) {\n\tif len(vs.fields) > 1 {\n\t\treturn nil, errors.New(\"ent: VariantSelect.Float64s is not achievable when selecting more than 1 field\")\n\t}\n\tvar v []float64\n\tif err := vs.Scan(ctx, &v); err != nil {\n\t\treturn nil, err\n\t}\n\treturn v, nil\n}", "title": "" }, { "docid": "0eb2122af13482c2189be76077a40705", "score": "0.66438407", "text": "func (vs *VariantSelect) Float64s(ctx context.Context) ([]float64, error) {\n\tif len(vs.fields) > 1 {\n\t\treturn nil, errors.New(\"ent: VariantSelect.Float64s is not achievable when selecting more than 1 field\")\n\t}\n\tvar v []float64\n\tif err := vs.Scan(ctx, &v); err != nil {\n\t\treturn nil, err\n\t}\n\treturn v, nil\n}", "title": "" }, { "docid": "24d459e793234cfc72110e827f6c0c6b", "score": "0.6633012", "text": "func (sps *ServicePointSelect) Float64s(ctx context.Context) ([]float64, error) {\n\tif len(sps.fields) > 1 {\n\t\treturn nil, errors.New(\"ent: ServicePointSelect.Float64s is not achievable when selecting more than 1 field\")\n\t}\n\tvar v []float64\n\tif err := sps.Scan(ctx, &v); err != nil {\n\t\treturn nil, err\n\t}\n\treturn v, nil\n}", "title": "" }, { "docid": "bedc5c0e36703047b686863223ccbc2c", "score": "0.66136616", "text": "func (qis *QueueItemSelect) Float64s(ctx context.Context) ([]float64, error) {\n\tif len(qis.fields) > 1 {\n\t\treturn nil, errors.New(\"ent: QueueItemSelect.Float64s is not achievable when selecting more than 1 field\")\n\t}\n\tvar v []float64\n\tif err := qis.Scan(ctx, &v); err != nil {\n\t\treturn nil, err\n\t}\n\treturn v, nil\n}", "title": "" }, { "docid": "36790a4b23ea1378799d53380aa407ae", "score": "0.66110855", "text": "func (afs *AlarmFilterSelect) Float64s(ctx context.Context) ([]float64, error) {\n\tif len(afs.fields) > 1 {\n\t\treturn nil, errors.New(\"ent: AlarmFilterSelect.Float64s is not achievable when selecting more than 1 field\")\n\t}\n\tvar v []float64\n\tif err := afs.Scan(ctx, &v); err != nil {\n\t\treturn nil, err\n\t}\n\treturn v, nil\n}", "title": "" }, { "docid": "db25f41c221e152f2dee23b3b5724498", "score": "0.65996563", "text": "func (os *OperationSelect) Float64s(ctx context.Context) ([]float64, error) {\n\tif len(os.fields) > 1 {\n\t\treturn nil, errors.New(\"ent: OperationSelect.Float64s is not achievable when selecting more than 1 field\")\n\t}\n\tvar v []float64\n\tif err := os.Scan(ctx, &v); err != nil {\n\t\treturn nil, err\n\t}\n\treturn v, nil\n}", "title": "" }, { "docid": "70c37bd58ad1d7fe59c76888b5699388", "score": "0.6592157", "text": "func (agb *AuthorGroupBy) Float64sX(ctx context.Context) []float64 {\n\tv, err := agb.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "fccd5871cf83e1ea3b8c9043a2931041", "score": "0.6591092", "text": "func (ts *TransportSelect) Float64s(ctx context.Context) ([]float64, error) {\n\tif len(ts.fields) > 1 {\n\t\treturn nil, errors.New(\"ent: TransportSelect.Float64s is not achievable when selecting more than 1 field\")\n\t}\n\tvar v []float64\n\tif err := ts.Scan(ctx, &v); err != nil {\n\t\treturn nil, err\n\t}\n\treturn v, nil\n}", "title": "" }, { "docid": "3b4178e0cf11dbe64b94a56b46352343", "score": "0.6586662", "text": "func (ots *OtherTestSelect) Float64s(ctx context.Context) ([]float64, error) {\n\tif len(ots.fields) > 1 {\n\t\treturn nil, errors.New(\"ent: OtherTestSelect.Float64s is not achievable when selecting more than 1 field\")\n\t}\n\tvar v []float64\n\tif err := ots.Scan(ctx, &v); err != nil {\n\t\treturn nil, err\n\t}\n\treturn v, nil\n}", "title": "" }, { "docid": "8302625455ea3396237a8e3e1b35efb4", "score": "0.6580312", "text": "func (wots *WorkOrderTypeSelect) Float64s(ctx context.Context) ([]float64, error) {\n\tif len(wots.fields) > 1 {\n\t\treturn nil, errors.New(\"ent: WorkOrderTypeSelect.Float64s is not achievable when selecting more than 1 field\")\n\t}\n\tvar v []float64\n\tif err := wots.Scan(ctx, &v); err != nil {\n\t\treturn nil, err\n\t}\n\treturn v, nil\n}", "title": "" }, { "docid": "2c9612566c952e7f36a1123f887272ef", "score": "0.65788656", "text": "func (kcgb *KqiCategoryGroupBy) Float64sX(ctx context.Context) []float64 {\n\tv, err := kcgb.Float64s(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "6ecd0003db1098547c16bc80a3388743", "score": "0.6577225", "text": "func (is *InstanceSelect) Float64s(ctx context.Context) ([]float64, error) {\n\tif len(is.fields) > 1 {\n\t\treturn nil, errors.New(\"ent: InstanceSelect.Float64s is not achievable when selecting more than 1 field\")\n\t}\n\tvar v []float64\n\tif err := is.Scan(ctx, &v); err != nil {\n\t\treturn nil, err\n\t}\n\treturn v, nil\n}", "title": "" } ]
d1dbf4865ae763542e50bebdcf722913
GetLifecyclePolicyPreviewWithContext indicates an expected call of GetLifecyclePolicyPreviewWithContext
[ { "docid": "7619e9caa6b5b33290428b93b33c90a6", "score": "0.79360163", "text": "func (mr *MockECRAPIMockRecorder) GetLifecyclePolicyPreviewWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetLifecyclePolicyPreviewWithContext\", reflect.TypeOf((*MockECRAPI)(nil).GetLifecyclePolicyPreviewWithContext), varargs...)\n}", "title": "" } ]
[ { "docid": "0ddcf113c38587c87cc59cab64b6ffb2", "score": "0.7182998", "text": "func (m *MockECRAPI) GetLifecyclePolicyPreviewWithContext(arg0 aws.Context, arg1 *ecr.GetLifecyclePolicyPreviewInput, arg2 ...request.Option) (*ecr.GetLifecyclePolicyPreviewOutput, 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, \"GetLifecyclePolicyPreviewWithContext\", varargs...)\n\tret0, _ := ret[0].(*ecr.GetLifecyclePolicyPreviewOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "7fbbe27a2caea2f47f38d74dbbb86a42", "score": "0.70590377", "text": "func (mr *MockECRAPIMockRecorder) StartLifecyclePolicyPreviewWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"StartLifecyclePolicyPreviewWithContext\", reflect.TypeOf((*MockECRAPI)(nil).StartLifecyclePolicyPreviewWithContext), varargs...)\n}", "title": "" }, { "docid": "c9979c4f9b333abd00cc0744f1153e5e", "score": "0.70195335", "text": "func (mr *MockECRAPIMockRecorder) GetLifecyclePolicyPreview(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetLifecyclePolicyPreview\", reflect.TypeOf((*MockECRAPI)(nil).GetLifecyclePolicyPreview), arg0)\n}", "title": "" }, { "docid": "ce4ed0e62dbf5c12d26c95648bdeab6e", "score": "0.66827", "text": "func (mr *MockECRAPIMockRecorder) GetLifecyclePolicyPreviewRequest(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetLifecyclePolicyPreviewRequest\", reflect.TypeOf((*MockECRAPI)(nil).GetLifecyclePolicyPreviewRequest), arg0)\n}", "title": "" }, { "docid": "b76338ec439bff399e59b915bf881473", "score": "0.6562896", "text": "func (mr *MockECRAPIMockRecorder) GetLifecyclePolicyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetLifecyclePolicyWithContext\", reflect.TypeOf((*MockECRAPI)(nil).GetLifecyclePolicyWithContext), varargs...)\n}", "title": "" }, { "docid": "0a0ffc437d05c92164dd2dc003dbb697", "score": "0.629418", "text": "func (m *MockECRAPI) StartLifecyclePolicyPreviewWithContext(arg0 aws.Context, arg1 *ecr.StartLifecyclePolicyPreviewInput, arg2 ...request.Option) (*ecr.StartLifecyclePolicyPreviewOutput, 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, \"StartLifecyclePolicyPreviewWithContext\", varargs...)\n\tret0, _ := ret[0].(*ecr.StartLifecyclePolicyPreviewOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "c73d1f9ef2384412b78dd1e158d0603a", "score": "0.62291247", "text": "func (m *MockECRAPI) GetLifecyclePolicyPreview(arg0 *ecr.GetLifecyclePolicyPreviewInput) (*ecr.GetLifecyclePolicyPreviewOutput, error) {\n\tret := m.ctrl.Call(m, \"GetLifecyclePolicyPreview\", arg0)\n\tret0, _ := ret[0].(*ecr.GetLifecyclePolicyPreviewOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "d3345578f0cd3122b7473ac918841671", "score": "0.61112905", "text": "func (c *ECR) GetLifecyclePolicyPreviewPagesWithContext(ctx aws.Context, input *GetLifecyclePolicyPreviewInput, fn func(*GetLifecyclePolicyPreviewOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *GetLifecyclePolicyPreviewInput\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.GetLifecyclePolicyPreviewRequest(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().(*GetLifecyclePolicyPreviewOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "title": "" }, { "docid": "eaac161cfcdc76e237b67ceaa353d847", "score": "0.61072797", "text": "func (m *MockECRAPI) GetLifecyclePolicyPreviewRequest(arg0 *ecr.GetLifecyclePolicyPreviewInput) (*request.Request, *ecr.GetLifecyclePolicyPreviewOutput) {\n\tret := m.ctrl.Call(m, \"GetLifecyclePolicyPreviewRequest\", arg0)\n\tret0, _ := ret[0].(*request.Request)\n\tret1, _ := ret[1].(*ecr.GetLifecyclePolicyPreviewOutput)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "fefcfb2dab731b031345323825bdf2b2", "score": "0.60246843", "text": "func (mr *MockECRAPIMockRecorder) StartLifecyclePolicyPreview(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"StartLifecyclePolicyPreview\", reflect.TypeOf((*MockECRAPI)(nil).StartLifecyclePolicyPreview), arg0)\n}", "title": "" }, { "docid": "b60fff682e369e9b99702bc8053a1b91", "score": "0.5837608", "text": "func (mr *MockBucketMockRecorder) GetLifecycleWithContext(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetLifecycleWithContext\", reflect.TypeOf((*MockBucket)(nil).GetLifecycleWithContext), arg0)\n}", "title": "" }, { "docid": "1fecb691a854d3b89ef182ad2dc7402a", "score": "0.5783231", "text": "func (mr *MockECRAPIMockRecorder) GetLifecyclePolicy(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetLifecyclePolicy\", reflect.TypeOf((*MockECRAPI)(nil).GetLifecyclePolicy), arg0)\n}", "title": "" }, { "docid": "d4453d16f8f6deea3c3a2ec5cd6d6471", "score": "0.57601815", "text": "func (mr *MockECRAPIMockRecorder) PutLifecyclePolicyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"PutLifecyclePolicyWithContext\", reflect.TypeOf((*MockECRAPI)(nil).PutLifecyclePolicyWithContext), varargs...)\n}", "title": "" }, { "docid": "49c392b3d0c9af1be144ddd07ea02021", "score": "0.56685257", "text": "func (mr *MockECRAPIMockRecorder) StartLifecyclePolicyPreviewRequest(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"StartLifecyclePolicyPreviewRequest\", reflect.TypeOf((*MockECRAPI)(nil).StartLifecyclePolicyPreviewRequest), arg0)\n}", "title": "" }, { "docid": "01916a98835824476f16744459eccb1b", "score": "0.5614799", "text": "func (m *MockECRAPI) GetLifecyclePolicyWithContext(arg0 aws.Context, arg1 *ecr.GetLifecyclePolicyInput, arg2 ...request.Option) (*ecr.GetLifecyclePolicyOutput, 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, \"GetLifecyclePolicyWithContext\", varargs...)\n\tret0, _ := ret[0].(*ecr.GetLifecyclePolicyOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "ea5a2a27e8044fca10a0350aab2653bb", "score": "0.5595392", "text": "func (mr *MockLambdaAPIMockRecorder) GetLayerVersionPolicyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetLayerVersionPolicyWithContext\", reflect.TypeOf((*MockLambdaAPI)(nil).GetLayerVersionPolicyWithContext), varargs...)\n}", "title": "" }, { "docid": "46cb97fc81b2d8b1e26fdcc5793bb281", "score": "0.54979086", "text": "func (mr *MockECRAPIMockRecorder) GetLifecyclePolicyRequest(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetLifecyclePolicyRequest\", reflect.TypeOf((*MockECRAPI)(nil).GetLifecyclePolicyRequest), arg0)\n}", "title": "" }, { "docid": "3cd65b84d1134138f9c11be3820aef70", "score": "0.54669017", "text": "func (m *MockBucket) GetLifecycleWithContext(arg0 context.Context) (*service.GetBucketLifecycleOutput, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetLifecycleWithContext\", arg0)\n\tret0, _ := ret[0].(*service.GetBucketLifecycleOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "b48e6aa6bc6e2500dc4b776c90b67224", "score": "0.54365635", "text": "func (mr *MockECRAPIMockRecorder) DeleteLifecyclePolicyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DeleteLifecyclePolicyWithContext\", reflect.TypeOf((*MockECRAPI)(nil).DeleteLifecyclePolicyWithContext), varargs...)\n}", "title": "" }, { "docid": "ce10b73635352f2e356b4c751e9225a6", "score": "0.512806", "text": "func (mr *MockLambdaAPIMockRecorder) GetPolicyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetPolicyWithContext\", reflect.TypeOf((*MockLambdaAPI)(nil).GetPolicyWithContext), varargs...)\n}", "title": "" }, { "docid": "384cf4c466e5e6397e1bb19b4f30cd48", "score": "0.5124991", "text": "func (mr *MockBucketMockRecorder) GetPolicyWithContext(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetPolicyWithContext\", reflect.TypeOf((*MockBucket)(nil).GetPolicyWithContext), arg0)\n}", "title": "" }, { "docid": "2b70b13a99abe0ea814a62ce70afc952", "score": "0.5108844", "text": "func (mr *MockECRAPIMockRecorder) GetRepositoryPolicyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetRepositoryPolicyWithContext\", reflect.TypeOf((*MockECRAPI)(nil).GetRepositoryPolicyWithContext), varargs...)\n}", "title": "" }, { "docid": "b3349b7690f83ca7c045bf74aaaf4cd8", "score": "0.50616443", "text": "func (m *MockECRAPI) StartLifecyclePolicyPreview(arg0 *ecr.StartLifecyclePolicyPreviewInput) (*ecr.StartLifecyclePolicyPreviewOutput, error) {\n\tret := m.ctrl.Call(m, \"StartLifecyclePolicyPreview\", arg0)\n\tret0, _ := ret[0].(*ecr.StartLifecyclePolicyPreviewOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "905bcf6eafab23fa000e91ca234b572b", "score": "0.49942285", "text": "func (mr *MockBucketMockRecorder) DeleteLifecycleWithContext(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DeleteLifecycleWithContext\", reflect.TypeOf((*MockBucket)(nil).DeleteLifecycleWithContext), arg0)\n}", "title": "" }, { "docid": "3c93f18c4a5355c2d529e83b9e9badf0", "score": "0.49764058", "text": "func (c *ECR) GetLifecyclePolicyPreviewWithContext(ctx aws.Context, input *GetLifecyclePolicyPreviewInput, opts ...request.Option) (*GetLifecyclePolicyPreviewOutput, error) {\n\treq, out := c.GetLifecyclePolicyPreviewRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "489a78cb211ba253d3411084f260caed", "score": "0.49375972", "text": "func (mock *s3ClientMock) GetBucketLifecycleConfigurationWithContextCalls() []struct {\n\tContextMoqParam context.Context\n\tGetBucketLifecycleConfigurationInput *s3.GetBucketLifecycleConfigurationInput\n\tOptions []request.Option\n} {\n\tvar calls []struct {\n\t\tContextMoqParam context.Context\n\t\tGetBucketLifecycleConfigurationInput *s3.GetBucketLifecycleConfigurationInput\n\t\tOptions []request.Option\n\t}\n\tmock.lockGetBucketLifecycleConfigurationWithContext.RLock()\n\tcalls = mock.calls.GetBucketLifecycleConfigurationWithContext\n\tmock.lockGetBucketLifecycleConfigurationWithContext.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "f8c929f652d269a3e38c895bf6a4616e", "score": "0.4929165", "text": "func (mock *s3ClientMock) GetBucketLifecycleWithContextCalls() []struct {\n\tContextMoqParam context.Context\n\tGetBucketLifecycleInput *s3.GetBucketLifecycleInput\n\tOptions []request.Option\n} {\n\tvar calls []struct {\n\t\tContextMoqParam context.Context\n\t\tGetBucketLifecycleInput *s3.GetBucketLifecycleInput\n\t\tOptions []request.Option\n\t}\n\tmock.lockGetBucketLifecycleWithContext.RLock()\n\tcalls = mock.calls.GetBucketLifecycleWithContext\n\tmock.lockGetBucketLifecycleWithContext.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "bd6a00eeb5efb1a044d430299549d633", "score": "0.4901836", "text": "func (m *MockLambdaAPI) GetLayerVersionPolicyWithContext(arg0 context.Context, arg1 *lambda.GetLayerVersionPolicyInput, arg2 ...request.Option) (*lambda.GetLayerVersionPolicyOutput, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"GetLayerVersionPolicyWithContext\", varargs...)\n\tret0, _ := ret[0].(*lambda.GetLayerVersionPolicyOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "90951c7a25976b8b04542c30191ddb8b", "score": "0.48985544", "text": "func (m *MockECRAPI) StartLifecyclePolicyPreviewRequest(arg0 *ecr.StartLifecyclePolicyPreviewInput) (*request.Request, *ecr.StartLifecyclePolicyPreviewOutput) {\n\tret := m.ctrl.Call(m, \"StartLifecyclePolicyPreviewRequest\", arg0)\n\tret0, _ := ret[0].(*request.Request)\n\tret1, _ := ret[1].(*ecr.StartLifecyclePolicyPreviewOutput)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "12c52cb3f56378b5ea92d59725ca2365", "score": "0.48834687", "text": "func (mr *MockBucketMockRecorder) PutLifecycleWithContext(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"PutLifecycleWithContext\", reflect.TypeOf((*MockBucket)(nil).PutLifecycleWithContext), arg0, arg1)\n}", "title": "" }, { "docid": "6d1052dfef1853aab49578216b49f97c", "score": "0.4880707", "text": "func (mr *MockECRAPIMockRecorder) DeleteLifecyclePolicy(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DeleteLifecyclePolicy\", reflect.TypeOf((*MockECRAPI)(nil).DeleteLifecyclePolicy), arg0)\n}", "title": "" }, { "docid": "12165f4e654f353ea2b3c61d8508ec9b", "score": "0.4841316", "text": "func (mr *MockBucketMockRecorder) GetExternalMirrorWithContext(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetExternalMirrorWithContext\", reflect.TypeOf((*MockBucket)(nil).GetExternalMirrorWithContext), arg0)\n}", "title": "" }, { "docid": "f23813145734d1a8f48f8f3fdeaff192", "score": "0.48390007", "text": "func (mr *MockServiceCatalogAPIMockRecorder) ListProvisionedProductPlansWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ListProvisionedProductPlansWithContext\", reflect.TypeOf((*MockServiceCatalogAPI)(nil).ListProvisionedProductPlansWithContext), varargs...)\n}", "title": "" }, { "docid": "d508dd47945d730f39a9be1195f68466", "score": "0.4805028", "text": "func (m *MockECRAPI) PutLifecyclePolicyWithContext(arg0 aws.Context, arg1 *ecr.PutLifecyclePolicyInput, arg2 ...request.Option) (*ecr.PutLifecyclePolicyOutput, 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, \"PutLifecyclePolicyWithContext\", varargs...)\n\tret0, _ := ret[0].(*ecr.PutLifecyclePolicyOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "c92d9e6322ed06746eddfebaf0eb66c5", "score": "0.4797288", "text": "func (mr *MockECRAPIMockRecorder) PutLifecyclePolicy(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"PutLifecyclePolicy\", reflect.TypeOf((*MockECRAPI)(nil).PutLifecyclePolicy), arg0)\n}", "title": "" }, { "docid": "c65e503e34fefa02ce63425ac99a781a", "score": "0.4753261", "text": "func LifecyclePrinter(logger kitlog.Logger) runner.LifecycleHook {\n\treturn runner.DefaultLifecycleHook{\n\t\tAttachingToPodFunc: func(csl *workloadsv1alpha1.Console) error {\n\t\t\tlogger.Log(\n\t\t\t\t\"msg\", \"Attaching to pod\",\n\t\t\t\t\"console\", csl.Name,\n\t\t\t\t\"namespace\", csl.Namespace,\n\t\t\t\t\"pod\", csl.Status.PodName,\n\t\t\t)\n\t\t\treturn nil\n\t\t},\n\t\tConsoleRequiresAuthorisationFunc: func(csl *workloadsv1alpha1.Console, rule *workloadsv1alpha1.ConsoleAuthorisationRule) error {\n\t\t\tauthoriserSlice := make([]string, 0, len(rule.ConsoleAuthorisers.Subjects))\n\t\t\tfor _, authoriser := range rule.ConsoleAuthorisers.Subjects {\n\t\t\t\tauthoriserSlice = append(authoriserSlice, authoriser.Kind+\":\"+authoriser.Name)\n\t\t\t}\n\t\t\tauthorisers := strings.Join(authoriserSlice, \",\")\n\n\t\t\tlogger.Log(\n\t\t\t\t\"msg\", \"Console requires authorisation\",\n\t\t\t\t\"prompt\", fmt.Sprintf(\"Please get a user from the list of authorisers to approve by running `theatre-consoles authorise --name %s --namespace %s --username {THEIR_USERNAME}`\", csl.Name, csl.Namespace),\n\t\t\t\t\"authorisers\", authorisers,\n\t\t\t\t\"console\", csl.Name,\n\t\t\t\t\"namespace\", csl.Namespace,\n\t\t\t\t\"pod\", csl.Status.PodName,\n\t\t\t)\n\t\t\treturn nil\n\t\t},\n\t\tConsoleReadyFunc: func(csl *workloadsv1alpha1.Console) error {\n\t\t\tlogger.Log(\n\t\t\t\t\"msg\", \"Console is ready\",\n\t\t\t\t\"console\", csl.Name,\n\t\t\t\t\"namespace\", csl.Namespace,\n\t\t\t\t\"pod\", csl.Status.PodName,\n\t\t\t)\n\t\t\treturn nil\n\t\t},\n\t\tConsoleCreatedFunc: func(csl *workloadsv1alpha1.Console) error {\n\t\t\tlogger.Log(\n\t\t\t\t\"msg\", \"Console has been requested\",\n\t\t\t\t\"console\", csl.Name,\n\t\t\t\t\"namespace\", csl.Namespace,\n\t\t\t)\n\t\t\treturn nil\n\t\t},\n\t}\n}", "title": "" }, { "docid": "feb2e5ac7e87fc2cb91b8e6f1fba8b7e", "score": "0.47530264", "text": "func (m *S3BucketSvmInlineQosPolicy) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateLinks(ctx, 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": "f813df223f86ee306173d3c3d433f94c", "score": "0.47257942", "text": "func (m *MockECRAPI) GetLifecyclePolicyRequest(arg0 *ecr.GetLifecyclePolicyInput) (*request.Request, *ecr.GetLifecyclePolicyOutput) {\n\tret := m.ctrl.Call(m, \"GetLifecyclePolicyRequest\", arg0)\n\tret0, _ := ret[0].(*request.Request)\n\tret1, _ := ret[1].(*ecr.GetLifecyclePolicyOutput)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "23afce0cbcb91548eb3eb499292bde94", "score": "0.47082", "text": "func (mr *MockSESAPIMockRecorder) ListIdentityPoliciesWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ListIdentityPoliciesWithContext\", reflect.TypeOf((*MockSESAPI)(nil).ListIdentityPoliciesWithContext), varargs...)\n}", "title": "" }, { "docid": "1e332b6a46201a9585b6d05e230e210f", "score": "0.47041294", "text": "func (m *MockBucket) DeleteLifecycleWithContext(arg0 context.Context) (*service.DeleteBucketLifecycleOutput, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"DeleteLifecycleWithContext\", arg0)\n\tret0, _ := ret[0].(*service.DeleteBucketLifecycleOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "3d99cd21088fdeb7521edb7e1d4611cf", "score": "0.46514338", "text": "func (o SecurityPolicyRuleOutput) Preview() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v SecurityPolicyRule) *bool { return v.Preview }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "152ea383af2b1174673c873eaf2291e0", "score": "0.46387643", "text": "func (mr *MockServiceCatalogAPIMockRecorder) ProvisionProductWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ProvisionProductWithContext\", reflect.TypeOf((*MockServiceCatalogAPI)(nil).ProvisionProductWithContext), varargs...)\n}", "title": "" }, { "docid": "7698fd8049cea78030fdfc50a02ebb5c", "score": "0.4622704", "text": "func (m VMVolumeElfStoragePolicyType) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "a36215270700c80a2be6b7fc6102819a", "score": "0.4567989", "text": "func (m *MockServiceCatalogAPI) ListProvisionedProductPlansWithContext(arg0 context.Context, arg1 *servicecatalog.ListProvisionedProductPlansInput, arg2 ...request.Option) (*servicecatalog.ListProvisionedProductPlansOutput, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"ListProvisionedProductPlansWithContext\", varargs...)\n\tret0, _ := ret[0].(*servicecatalog.ListProvisionedProductPlansOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "38f509f00c8ff18d15dfea8b37ea3ec3", "score": "0.45671833", "text": "func (mr *MockECRAPIMockRecorder) DeleteLifecyclePolicyRequest(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DeleteLifecyclePolicyRequest\", reflect.TypeOf((*MockECRAPI)(nil).DeleteLifecyclePolicyRequest), arg0)\n}", "title": "" }, { "docid": "1295c2fe64b173935483bbb6aeacf9f0", "score": "0.45617023", "text": "func (m *SnapmirrorRelationshipInlinePolicy) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateLinks(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateType(ctx, 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": "b216375d083ef4cad912af4ad724e71c", "score": "0.45562953", "text": "func (mr *MockLambdaAPIMockRecorder) GetLayerVersionPolicy(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetLayerVersionPolicy\", reflect.TypeOf((*MockLambdaAPI)(nil).GetLayerVersionPolicy), arg0)\n}", "title": "" }, { "docid": "205c0e923746123a632cbc5c0366caff", "score": "0.45385802", "text": "func (mr *MockLambdaAPIMockRecorder) GetPolicy(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetPolicy\", reflect.TypeOf((*MockLambdaAPI)(nil).GetPolicy), arg0)\n}", "title": "" }, { "docid": "a6016e1066196b70c6e47c51de5c317f", "score": "0.45374805", "text": "func (mr *MockBucketMockRecorder) GetLifecycle() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetLifecycle\", reflect.TypeOf((*MockBucket)(nil).GetLifecycle))\n}", "title": "" }, { "docid": "8c1d0715c1b9305f87b98f133db5f2a6", "score": "0.4528839", "text": "func (m *MockECRAPI) GetLifecyclePolicy(arg0 *ecr.GetLifecyclePolicyInput) (*ecr.GetLifecyclePolicyOutput, error) {\n\tret := m.ctrl.Call(m, \"GetLifecyclePolicy\", arg0)\n\tret0, _ := ret[0].(*ecr.GetLifecyclePolicyOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "de471b068a15abb19199094b54e86516", "score": "0.45085406", "text": "func (mr *MockBucketMockRecorder) PutPolicyWithContext(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"PutPolicyWithContext\", reflect.TypeOf((*MockBucket)(nil).PutPolicyWithContext), arg0, arg1)\n}", "title": "" }, { "docid": "1630390a7895e7d28f8a23bb0bc51938", "score": "0.45073238", "text": "func (mr *MockServiceCatalogAPIMockRecorder) ListStackInstancesForProvisionedProductWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ListStackInstancesForProvisionedProductWithContext\", reflect.TypeOf((*MockServiceCatalogAPI)(nil).ListStackInstancesForProvisionedProductWithContext), varargs...)\n}", "title": "" }, { "docid": "4ff89209bfb5820c395c45ff17d02cba", "score": "0.4503551", "text": "func (mr *MockECRAPIMockRecorder) PutLifecyclePolicyRequest(arg0 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"PutLifecyclePolicyRequest\", reflect.TypeOf((*MockECRAPI)(nil).PutLifecyclePolicyRequest), arg0)\n}", "title": "" }, { "docid": "757bc84379810bda7d533651f9130a77", "score": "0.45001286", "text": "func (m *FalconxSandboxParametersV1) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "d565cd017d7f85969b43ff8ef81d7044", "score": "0.4490681", "text": "func (mock *s3ClientMock) PutBucketLifecycleConfigurationWithContextCalls() []struct {\n\tContextMoqParam context.Context\n\tPutBucketLifecycleConfigurationInput *s3.PutBucketLifecycleConfigurationInput\n\tOptions []request.Option\n} {\n\tvar calls []struct {\n\t\tContextMoqParam context.Context\n\t\tPutBucketLifecycleConfigurationInput *s3.PutBucketLifecycleConfigurationInput\n\t\tOptions []request.Option\n\t}\n\tmock.lockPutBucketLifecycleConfigurationWithContext.RLock()\n\tcalls = mock.calls.PutBucketLifecycleConfigurationWithContext\n\tmock.lockPutBucketLifecycleConfigurationWithContext.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "5b44f683994da45de832b84d8324057f", "score": "0.44728008", "text": "func (mr *MockSESAPIMockRecorder) GetIdentityPoliciesWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetIdentityPoliciesWithContext\", reflect.TypeOf((*MockSESAPI)(nil).GetIdentityPoliciesWithContext), varargs...)\n}", "title": "" }, { "docid": "ce508cf95c32cc695b20251583548232", "score": "0.447054", "text": "func (mr *MockBucketMockRecorder) GetNotificationWithContext(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetNotificationWithContext\", reflect.TypeOf((*MockBucket)(nil).GetNotificationWithContext), arg0)\n}", "title": "" }, { "docid": "7ec37c042eb9157274356eeb4b9a8a30", "score": "0.4461105", "text": "func (page *WorkflowVersionListResultPage) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/WorkflowVersionListResultPage.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif page.Response().Response.Response != nil {\n\t\t\t\tsc = page.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tnext, err := page.fn(ctx, page.wvlr)\n\tif err != nil {\n\t\treturn err\n\t}\n\tpage.wvlr = next\n\treturn nil\n}", "title": "" }, { "docid": "5726d60768cb8b75e32d38b3665b0c06", "score": "0.44582832", "text": "func (m *MockLambdaAPI) GetPolicyWithContext(arg0 context.Context, arg1 *lambda.GetPolicyInput, arg2 ...request.Option) (*lambda.GetPolicyOutput, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"GetPolicyWithContext\", varargs...)\n\tret0, _ := ret[0].(*lambda.GetPolicyOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "b2189d72c0d66544ceef724fa5474e7d", "score": "0.4445098", "text": "func (mr *MockBucketMockRecorder) DeletePolicyWithContext(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DeletePolicyWithContext\", reflect.TypeOf((*MockBucket)(nil).DeletePolicyWithContext), arg0)\n}", "title": "" }, { "docid": "89af0a27a9b6281ea8237e28a1fca25a", "score": "0.44411382", "text": "func (mr *MockECRAPIMockRecorder) SetRepositoryPolicyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SetRepositoryPolicyWithContext\", reflect.TypeOf((*MockECRAPI)(nil).SetRepositoryPolicyWithContext), varargs...)\n}", "title": "" }, { "docid": "a9b8758fb78e3e92e6b54516461bd0bd", "score": "0.44378027", "text": "func (mock *s3ClientMock) PutBucketLifecycleWithContextCalls() []struct {\n\tContextMoqParam context.Context\n\tPutBucketLifecycleInput *s3.PutBucketLifecycleInput\n\tOptions []request.Option\n} {\n\tvar calls []struct {\n\t\tContextMoqParam context.Context\n\t\tPutBucketLifecycleInput *s3.PutBucketLifecycleInput\n\t\tOptions []request.Option\n\t}\n\tmock.lockPutBucketLifecycleWithContext.RLock()\n\tcalls = mock.calls.PutBucketLifecycleWithContext\n\tmock.lockPutBucketLifecycleWithContext.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "80c51967f99b5c597e4961cd01598307", "score": "0.4409453", "text": "func GetLifecyclePolicy(ctx *pulumi.Context,\n\tname string, id pulumi.ID, state *LifecyclePolicyState, opts ...pulumi.ResourceOpt) (*LifecyclePolicy, error) {\n\tinputs := make(map[string]interface{})\n\tif state != nil {\n\t\tinputs[\"arn\"] = state.Arn\n\t\tinputs[\"description\"] = state.Description\n\t\tinputs[\"executionRoleArn\"] = state.ExecutionRoleArn\n\t\tinputs[\"policyDetails\"] = state.PolicyDetails\n\t\tinputs[\"state\"] = state.State\n\t\tinputs[\"tags\"] = state.Tags\n\t}\n\ts, err := ctx.ReadResource(\"aws:dlm/lifecyclePolicy:LifecyclePolicy\", name, id, inputs, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &LifecyclePolicy{s: s}, nil\n}", "title": "" }, { "docid": "3b0e3d64ae06d4e36e8b2a42d47201b0", "score": "0.4381763", "text": "func (m *MockSESAPI) ListIdentityPoliciesWithContext(arg0 context.Context, arg1 *ses.ListIdentityPoliciesInput, arg2 ...request.Option) (*ses.ListIdentityPoliciesOutput, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"ListIdentityPoliciesWithContext\", varargs...)\n\tret0, _ := ret[0].(*ses.ListIdentityPoliciesOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "f4d41a92462fbc26a67d1e201c5fae83", "score": "0.43755484", "text": "func (con *Controller) GetPreview(webInput interceptor.WebInput) apihandler.ResponseEntity {\n\tctx := webInput.Context.Ctx\n\n\t// set param\n\tvar reqVo GetPreviewReqVo\n\tif err := paramhandler.Set(webInput.Context, &reqVo); err != nil {\n\t\treturn responseEntity.Error(ctx, api.FormatError, err)\n\t}\n\n\tbucketName, _ := con.userDao.GetBucketName(webInput.Payload.Acc)\n\n\tURL, err := minio.PresignedGetObject(bucketName, reqVo.Prefix, reqVo.FileName, time.Second*60*60)\n\tif err != nil {\n\t\treturn responseEntity.Error(ctx, api.MinioError, err)\n\t}\n\n\tresp, err := http.Get(URL.String())\n\tif err != nil {\n\t\tresponseEntity.Error(ctx, api.ServerError, err)\n\t}\n\n\tctx.Response.Header.Add(\"Accept-Ranges\", resp.Header.Get(\"Accept-Ranges\"))\n\tctx.Response.Header.Add(\"Content-Length\", resp.Header.Get(\"Content-Length\"))\n\tctx.Response.Header.Add(\"Content-Type\", resp.Header.Get(\"Content-Type\"))\n\tctx.SetBodyStream(resp.Body, int(resp.ContentLength))\n\n\treturn responseEntity.Empty()\n}", "title": "" }, { "docid": "5f6bd58f70b2a58b94c1cf4d7aa97158", "score": "0.4360774", "text": "func (m *MockLambdaAPI) WaitUntilPublishedVersionActiveWithContext(arg0 context.Context, arg1 *lambda.GetFunctionConfigurationInput, arg2 ...request.WaiterOption) error {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"WaitUntilPublishedVersionActiveWithContext\", varargs...)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "6e27d9d73f6be9f076f680967e7db49d", "score": "0.4339748", "text": "func (mr *MockLambdaAPIMockRecorder) GetLayerVersionPolicyRequest(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetLayerVersionPolicyRequest\", reflect.TypeOf((*MockLambdaAPI)(nil).GetLayerVersionPolicyRequest), arg0)\n}", "title": "" }, { "docid": "b01297d9b45350fd6ac798ad2e26531e", "score": "0.43263394", "text": "func (mr *MockLambdaAPIMockRecorder) GetRuntimeManagementConfigWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetRuntimeManagementConfigWithContext\", reflect.TypeOf((*MockLambdaAPI)(nil).GetRuntimeManagementConfigWithContext), varargs...)\n}", "title": "" }, { "docid": "6a5dbed28824b6495c4247caf4e66719", "score": "0.4322032", "text": "func (mr *MockLambdaAPIMockRecorder) WaitUntilPublishedVersionActiveWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"WaitUntilPublishedVersionActiveWithContext\", reflect.TypeOf((*MockLambdaAPI)(nil).WaitUntilPublishedVersionActiveWithContext), varargs...)\n}", "title": "" }, { "docid": "83ae5a5a7ab70a079b46702a62d76063", "score": "0.43185055", "text": "func (mr *MockLambdaAPIMockRecorder) ListLayersWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ListLayersWithContext\", reflect.TypeOf((*MockLambdaAPI)(nil).ListLayersWithContext), varargs...)\n}", "title": "" }, { "docid": "38a58733f943168445e270083b7f9922", "score": "0.43114647", "text": "func (mr *MockLambdaAPIMockRecorder) PublishLayerVersionWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"PublishLayerVersionWithContext\", reflect.TypeOf((*MockLambdaAPI)(nil).PublishLayerVersionWithContext), varargs...)\n}", "title": "" }, { "docid": "83d63404dbd7f003a48e532fb6b86d76", "score": "0.4311324", "text": "func (m SnmpPrivacyProtocol) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "1b2b2973876e28c871d3640ad3020981", "score": "0.43051815", "text": "func (m *MockBucket) GetExternalMirrorWithContext(arg0 context.Context) (*service.GetBucketExternalMirrorOutput, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetExternalMirrorWithContext\", arg0)\n\tret0, _ := ret[0].(*service.GetBucketExternalMirrorOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "d680c2782d5e856dd0ab3092e9c73b1e", "score": "0.4299521", "text": "func (mock *s3ClientMock) DeleteBucketLifecycleWithContextCalls() []struct {\n\tContextMoqParam context.Context\n\tDeleteBucketLifecycleInput *s3.DeleteBucketLifecycleInput\n\tOptions []request.Option\n} {\n\tvar calls []struct {\n\t\tContextMoqParam context.Context\n\t\tDeleteBucketLifecycleInput *s3.DeleteBucketLifecycleInput\n\t\tOptions []request.Option\n\t}\n\tmock.lockDeleteBucketLifecycleWithContext.RLock()\n\tcalls = mock.calls.DeleteBucketLifecycleWithContext\n\tmock.lockDeleteBucketLifecycleWithContext.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "d0b9bcd8213aa643e572a140ae8a91c3", "score": "0.42913264", "text": "func (m *dockerRegistryWebhookPatch) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "5249940525976109e9ee0dab7d94ccc1", "score": "0.42888534", "text": "func (mr *MockLambdaAPIMockRecorder) GetLayerVersionWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetLayerVersionWithContext\", reflect.TypeOf((*MockLambdaAPI)(nil).GetLayerVersionWithContext), varargs...)\n}", "title": "" }, { "docid": "1015294caacdb6d6e0324f55fc7fcf65", "score": "0.4284909", "text": "func (mr *MockSESAPIMockRecorder) PutIdentityPolicyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"PutIdentityPolicyWithContext\", reflect.TypeOf((*MockSESAPI)(nil).PutIdentityPolicyWithContext), varargs...)\n}", "title": "" }, { "docid": "7fdeffc728855c070f214c155761ee2c", "score": "0.42784792", "text": "func WithPreview(printer printers.ResourcePrinter) Option {\n\treturn func(o *opt) {\n\t\to.printer = printer\n\t}\n}", "title": "" }, { "docid": "3a20767c3d81c2efb820a8319f0d9332", "score": "0.42783117", "text": "func (m *ReviewPathItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateAPIEventsPaths(ctx, 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": "914e6265452bfdeacc6ff568d308eaa2", "score": "0.42680255", "text": "func (m *VMVlanCreationParams) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "cae08c97d15a38b6fa3379e151810e3f", "score": "0.42577225", "text": "func (e Environment) IsPreview() bool {\n\treturn e.Environment.Spec.Kind == v1.EnvironmentKindTypePreview\n}", "title": "" }, { "docid": "cd1b5365c7e10075a28ff39f1b5efeb3", "score": "0.4255618", "text": "func (mr *MockECRAPIMockRecorder) DeleteRepositoryPolicyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DeleteRepositoryPolicyWithContext\", reflect.TypeOf((*MockECRAPI)(nil).DeleteRepositoryPolicyWithContext), varargs...)\n}", "title": "" }, { "docid": "e353a9a2e772769f84f4bcd88a6e3544", "score": "0.42449397", "text": "func (m *NotesListResponseEmbedded) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateNotes(ctx, 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": "8c12027c312c3c78e758a2037b616e6c", "score": "0.4242402", "text": "func (mr *MockServiceCatalogAPIMockRecorder) DescribeProvisionedProductWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DescribeProvisionedProductWithContext\", reflect.TypeOf((*MockServiceCatalogAPI)(nil).DescribeProvisionedProductWithContext), varargs...)\n}", "title": "" }, { "docid": "6f29f88f0d9c472e84e45043244c0d71", "score": "0.4238225", "text": "func (m *MockBucket) GetPolicyWithContext(arg0 context.Context) (*service.GetBucketPolicyOutput, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetPolicyWithContext\", arg0)\n\tret0, _ := ret[0].(*service.GetBucketPolicyOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "615ea892c8b24876c8518ba9f20d4984", "score": "0.42355305", "text": "func (mr *MockServiceCatalogAPIMockRecorder) UpdateProvisionedProductPropertiesWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"UpdateProvisionedProductPropertiesWithContext\", reflect.TypeOf((*MockServiceCatalogAPI)(nil).UpdateProvisionedProductPropertiesWithContext), varargs...)\n}", "title": "" }, { "docid": "56e5d9f5b7c7484de89b80b9940286c1", "score": "0.42353243", "text": "func (mr *MockServiceCatalogAPIMockRecorder) DescribeProvisionedProductPlanWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DescribeProvisionedProductPlanWithContext\", reflect.TypeOf((*MockServiceCatalogAPI)(nil).DescribeProvisionedProductPlanWithContext), varargs...)\n}", "title": "" }, { "docid": "831a756c4079953401e79d4766bdc12b", "score": "0.42321432", "text": "func (m *DSSEV001SchemaProposedContent) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "6dc7865fe986fb0c5672e2ac1d447e1e", "score": "0.42242625", "text": "func (iter *WorkflowVersionListResultIterator) NextWithContext(ctx context.Context) (err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/WorkflowVersionListResultIterator.NextWithContext\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif iter.Response().Response.Response != nil {\n\t\t\t\tsc = iter.Response().Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\titer.i++\n\tif iter.i < len(iter.page.Values()) {\n\t\treturn nil\n\t}\n\terr = iter.page.NextWithContext(ctx)\n\tif err != nil {\n\t\titer.i--\n\t\treturn err\n\t}\n\titer.i = 0\n\treturn nil\n}", "title": "" }, { "docid": "6b55d3e71dd5302ef4a3614967f7f0c9", "score": "0.42195114", "text": "func (m GatewayCheckedInRecently) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "389a87039f7b0962195c3a5cc220221c", "score": "0.42175654", "text": "func (m *MockBucket) PutLifecycleWithContext(arg0 context.Context, arg1 *service.PutBucketLifecycleInput) (*service.PutBucketLifecycleOutput, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"PutLifecycleWithContext\", arg0, arg1)\n\tret0, _ := ret[0].(*service.PutBucketLifecycleOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "3e1828097f93f0b7f0fa55401bb71ca6", "score": "0.4196764", "text": "func (o DeploymentOutput) Preview() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v *Deployment) pulumi.BoolPtrOutput { return v.Preview }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "750f99d9f033b40c536ceff8a83156c0", "score": "0.41898888", "text": "func (mock *s3ClientMock) GetBucketPolicyWithContextCalls() []struct {\n\tContextMoqParam context.Context\n\tGetBucketPolicyInput *s3.GetBucketPolicyInput\n\tOptions []request.Option\n} {\n\tvar calls []struct {\n\t\tContextMoqParam context.Context\n\t\tGetBucketPolicyInput *s3.GetBucketPolicyInput\n\t\tOptions []request.Option\n\t}\n\tmock.lockGetBucketPolicyWithContext.RLock()\n\tcalls = mock.calls.GetBucketPolicyWithContext\n\tmock.lockGetBucketPolicyWithContext.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "2bced37eea9a29672f887fbafb4bfa3a", "score": "0.41842276", "text": "func (mr *MockSESAPIMockRecorder) GetIdentityNotificationAttributesWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetIdentityNotificationAttributesWithContext\", reflect.TypeOf((*MockSESAPI)(nil).GetIdentityNotificationAttributesWithContext), varargs...)\n}", "title": "" }, { "docid": "3ebc82cdaeb6c07fe816e61bc97c58bb", "score": "0.41814485", "text": "func (mr *MockSESAPIMockRecorder) DeleteIdentityPolicyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"DeleteIdentityPolicyWithContext\", reflect.TypeOf((*MockSESAPI)(nil).DeleteIdentityPolicyWithContext), varargs...)\n}", "title": "" }, { "docid": "935f4efc2459481c4ebd2dee3b5ceaed", "score": "0.4172018", "text": "func (m *S3BucketSvmInlineQosPolicyInlineLinks) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateSelf(ctx, 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": "f3a03396554ac4357aec20d59a1f26fd", "score": "0.41714832", "text": "func (mr *MockLambdaAPIMockRecorder) PublishVersionWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"PublishVersionWithContext\", reflect.TypeOf((*MockLambdaAPI)(nil).PublishVersionWithContext), varargs...)\n}", "title": "" }, { "docid": "5246645773cb13e53fca917e352417c6", "score": "0.4165246", "text": "func (con *Controller) GetPreviewURL(webInput interceptor.WebInput) apihandler.ResponseEntity {\n\tctx := webInput.Context.Ctx\n\n\t// set param\n\tvar reqVo GetPreviewURLReqVo\n\tif err := paramhandler.Set(webInput.Context, &reqVo); err != nil {\n\t\treturn responseEntity.Error(ctx, api.FormatError, err)\n\t}\n\n\tbucketName, _ := con.userDao.GetBucketName(webInput.Payload.Acc)\n\n\tURL, err := minio.PresignedGetObject(bucketName, reqVo.Prefix, reqVo.FileName, time.Second*60*60*24)\n\tif err != nil {\n\t\treturn responseEntity.Error(ctx, api.MinioError, err)\n\t}\n\n\turl := base64.StdEncoding.EncodeToString([]byte(URL.String()))\n\treturn responseEntity.OK(ctx, GetPreviewURLResVo{URL: url})\n}", "title": "" }, { "docid": "88ab8c5426b4c75f1904f36c216d7d8b", "score": "0.4164742", "text": "func (m *MockLambdaAPI) ListLayersWithContext(arg0 context.Context, arg1 *lambda.ListLayersInput, arg2 ...request.Option) (*lambda.ListLayersOutput, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{arg0, arg1}\n\tfor _, a := range arg2 {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"ListLayersWithContext\", varargs...)\n\tret0, _ := ret[0].(*lambda.ListLayersOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "846528611d7b567949256c50100c94cf", "score": "0.41502005", "text": "func (m *Policy) ContextValidate(ctx context.Context, formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.contextValidateCriteria(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateDefinitionLegend(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateScopeCriteria(ctx, formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.contextValidateStatistics(ctx, 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": "" } ]
6d7c770b483c51393c2bd4015a407dc1
WithoutBuiltin disables all the builtin detectors, including the telemetry.sdk., host., and the environment detector.
[ { "docid": "531fd73a66ae609238945dfa50d66802", "score": "0.6732847", "text": "func WithoutBuiltin() Option {\n\treturn noBuiltinOption{}\n}", "title": "" } ]
[ { "docid": "23439315ac57b52b980d07f6a530a48f", "score": "0.57865095", "text": "func DisableMonkeyTest() {\n\tenabled = false\n}", "title": "" }, { "docid": "8142e654949b9ae87af5441e49665121", "score": "0.57863903", "text": "func Disable(names ...string) {\n\tfeatureFlags.set.Delete(names...)\n}", "title": "" }, { "docid": "bfdd434974aae6968c366722d14e8da9", "score": "0.56742585", "text": "func WithoutAutodetect() Option {\n\treturn func(r *Renderer) {\n\t\tr.Autodetect = false\n\t}\n}", "title": "" }, { "docid": "76b878e36057e442abc0069c22945162", "score": "0.5354128", "text": "func globallyDisabled(d *Debug, w *CustomWrite, t *testing.T) {\n\tresetEnv()\n\tos.Setenv(\"DEBUG\", \"*\")\n\tDisable()\n\td.Option.Reset()\n\tmustMatch(\n\t\tw, d, \"\",\n\t\t\"globallyDisabled: wtf i say NOTHING should be print !\",\n\t\tt, \"not printing message\")\n}", "title": "" }, { "docid": "b350390e9ac709c364b38ed0be1ef723", "score": "0.5338798", "text": "func builtinUnused() {\n\tgraceful.GetManager().InformCleanup()\n}", "title": "" }, { "docid": "7ad5eb315ba8b410edec1ef3dc78e0fa", "score": "0.52997935", "text": "func WithoutTelemetry() Option {\n\treturn func(o *Options) error {\n\t\to.Telemetry = false\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "252aea86d11219b8ee30caa08cbb89e4", "score": "0.52258724", "text": "func WithoutBaseImageVulnerabilities() Ops {\n\treturn func(provider *Options) error {\n\t\tprovider.flags = append(provider.flags, \"--exclude-base-image-vulns\")\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "a9b57b4a6af6e2a66af7a876df5527b4", "score": "0.5221572", "text": "func nonTrivialBuiltin(t xsd.Type) bool {\n\tb, ok := t.(xsd.Builtin)\n\tif !ok {\n\t\treturn false\n\t}\n\tswitch b {\n\tcase xsd.Base64Binary, xsd.HexBinary,\n\t\txsd.Date, xsd.Time, xsd.DateTime,\n\t\txsd.GDay, xsd.GMonth, xsd.GMonthDay, xsd.GYear, xsd.GYearMonth:\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "72128e4e282a081c89d7234cf6e0c441", "score": "0.5194164", "text": "func New() ([]collector.Collector, error) {\n\tnone := []collector.Collector{}\n\tl := log.With().Str(\"pkg\", pkgName).Logger()\n\n\tif runtime.GOOS != \"windows\" {\n\t\tl.Warn().Msg(\"not windows, skipping nvidia\")\n\t\treturn none, nil\n\t}\n\n\tenbledCollectors := viper.GetStringSlice(config.KeyCollectors)\n\tif len(enbledCollectors) == 0 {\n\t\tl.Info().Msg(\"no builtin collectors enabled\")\n\t\treturn none, nil\n\t}\n\n\tlogError := func(name string, err error) {\n\t\tl.Error().\n\t\t\tStr(\"name\", name).\n\t\t\tErr(err).\n\t\t\tMsg(\"initializing builtin collector\")\n\t}\n\n\tcollectors := make([]collector.Collector, 0, len(enbledCollectors))\n\tfor _, name := range enbledCollectors {\n\t\tif !strings.HasPrefix(name, prefix) {\n\t\t\tcontinue\n\t\t}\n\t\tname = strings.ReplaceAll(name, prefix, \"\")\n\t\tcfgBase := \"nvidia_\" + name + \"_collector\"\n\t\tswitch name {\n\t\tcase \"gpu\":\n\t\t\tc, err := NewGPUCollector(path.Join(defaults.EtcPath, cfgBase))\n\t\t\tif err != nil {\n\t\t\t\tlogError(name, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcollectors = append(collectors, c)\n\n\t\tdefault:\n\t\t\tl.Warn().\n\t\t\t\tStr(\"name\", name).\n\t\t\t\tMsg(\"unknown builtin collector for this OS, ignoring\")\n\t\t}\n\t}\n\n\treturn collectors, nil\n}", "title": "" }, { "docid": "f81636fba1cde3d6dc33af305bd682a4", "score": "0.51722217", "text": "func NoShutdownHook(p *Profile) { p.noShutdownHook = true }", "title": "" }, { "docid": "dba1465ce429b9a6fd559236911847ee", "score": "0.51419944", "text": "func GloballyDisableDebugLogForTest() {\n\tglobalLogger.consoleLevel.SetLevel(zapcore.ErrorLevel)\n}", "title": "" }, { "docid": "bbe8ad50f81caa615b29808b91a3bb6e", "score": "0.50191087", "text": "func DisableWarnings() {\n\toptionWarnings = false\n}", "title": "" }, { "docid": "8dbf8383b81f895426e35fbd97743188", "score": "0.5014626", "text": "func DisableLoggers() {\n\tSetDebugLogger(nil)\n\tSetInfoLogger(nil)\n\tSetStatsLogger(nil)\n}", "title": "" }, { "docid": "8a0a7b07b90f38509599e48dc0f5c3d4", "score": "0.49645564", "text": "func noDisabledLinter() {}", "title": "" }, { "docid": "4705362c4dafe069947db2fa3a48266b", "score": "0.4953108", "text": "func Disable() {\n\tlogging.SetBackend(logging.NewLogBackend(ioutil.Discard, \"\", 0))\n}", "title": "" }, { "docid": "1b0a52ad1312fbc4d839f356158822c3", "score": "0.49489436", "text": "func (native *OpenGL) Disable(capability uint32) {\n\tgl.Disable(capability)\n}", "title": "" }, { "docid": "a153dddaff09c6b40b8c5355019f384d", "score": "0.4947249", "text": "func DisableChrome() {\n\terr := utils.DockerStop(\"chrome\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "e5182c49d68309e7e718c7c537d5971c", "score": "0.48772633", "text": "func DisableLogging() {\n\tactuator.Logger.SetOutput(ioutil.Discard)\n}", "title": "" }, { "docid": "941425c7aad7933bd6d0c8aff5ee4df7", "score": "0.48646238", "text": "func debugOff() {\n\tflaggy.DebugMode = false\n}", "title": "" }, { "docid": "f4633e13e3c004aa94031d03638a5275", "score": "0.4821588", "text": "func debugOff() {\n\t// flaggy.DebugMode = false\n}", "title": "" }, { "docid": "b5d8636774a68fd5ccd2fbae0f829dc3", "score": "0.48155192", "text": "func (c *config) NonHermeticHostSystemTool(name string) string {\n\tfor _, dir := range filepath.SplitList(c.Getenv(\"PATH\")) {\n\t\tpath := filepath.Join(dir, name)\n\t\tif s, err := os.Stat(path); err != nil {\n\t\t\tcontinue\n\t\t} else if m := s.Mode(); !s.IsDir() && m&0111 != 0 {\n\t\t\treturn path\n\t\t}\n\t}\n\tpanic(fmt.Errorf(\n\t\t\"Unable to use '%s' as a host system tool for build system \"+\n\t\t\t\"hermeticity reasons. See build/soong/ui/build/paths/config.go \"+\n\t\t\t\"for the full list of allowed host tools on your system.\", name))\n}", "title": "" }, { "docid": "cf707c23a1a6cd707b60b12a87c59412", "score": "0.48013514", "text": "func DisableVerboseLogging() {\n\tatomic.StoreInt32(&enableVerbose, 0)\n}", "title": "" }, { "docid": "a934d9ff04f43fbdba361495682f411a", "score": "0.47948965", "text": "func ResetTelemetry() {\n\tExpect(os.Setenv(segment.TrackingConsentEnv, \"no\")).NotTo(HaveOccurred())\n\tExpect(os.Unsetenv(DebugTelemetryFileEnv))\n\n\tctx := context.Background()\n\tenvConfig, err := config.GetConfiguration()\n\tExpect(err).To(BeNil())\n\tctx = envcontext.WithEnvConfig(ctx, *envConfig)\n\n\tcfg, _ := preference.NewClient(ctx)\n\terr = cfg.SetConfiguration(preference.ConsentTelemetrySetting, \"true\")\n\tExpect(err).NotTo(HaveOccurred())\n\tExpect(segment.IsTelemetryEnabled(cfg, *envConfig)).To(BeFalse())\n}", "title": "" }, { "docid": "68d0c7e933f5ff7c0850015565d8cbe1", "score": "0.4788452", "text": "func Disable(flag Flag) {\n\tgl.Disable(uint32(flag))\n}", "title": "" }, { "docid": "ef0220142762cc631c0b933d09f9968e", "score": "0.47828573", "text": "func (m *Windows10GeneralConfiguration) SetNetworkProxyDisableAutoDetect(value *bool)() {\n m.networkProxyDisableAutoDetect = value\n}", "title": "" }, { "docid": "a68c27be454820bda181025e6ea8cecc", "score": "0.472809", "text": "func Disable() {\n\tif initialized {\n\t\tpanic(\"Initialize/Disable called more than once\")\n\t}\n\tinitialized = true\n\n\tm := pb.MetricRegistration{}\n\tif err := eventchannel.Emit(&m); err != nil {\n\t\tpanic(\"unable to emit metric disable event: \" + err.Error())\n\t}\n}", "title": "" }, { "docid": "0f663caa2587dcb7a1953b0827567009", "score": "0.47259966", "text": "func (g *GroupOnSystem) NoProvGroups() {\n\tg.AdditionalObjects = NewGroupOnSystemAdditionalObject()\n}", "title": "" }, { "docid": "717b173d2ecca12f3833eb0ac0fc1dad", "score": "0.46789393", "text": "func TrackWithoutMonitoring() ListenerOpt {\n\treturn func(opts *listenerOpts) {\n\t\topts.monitoring = false\n\t}\n}", "title": "" }, { "docid": "0e8fcb749bac97526bb998ac49d383d6", "score": "0.46779552", "text": "func fetchRuntimeInfoUnprivileged(t *testing.T, clients *test.Clients, opts ...ServiceOption) (*test.ResourceNames, *types.RuntimeInfo, error) {\n\treturn runtimeInfo(t, clients, &test.ResourceNames{Image: test.RuntimeUnprivileged}, opts...)\n}", "title": "" }, { "docid": "a394a845b34adaf1198626d00d7b7ce2", "score": "0.46193075", "text": "func NoVerify(g *types.Cmd) {\n\tg.AddOptions(\"--no-verify\")\n}", "title": "" }, { "docid": "9d4edf10c18183cdbb2df83b25b9a574", "score": "0.46019515", "text": "func NoSniff(activate bool) Option {\n\treturn func(f *securityHeaders) {\n\t\tf.activateNoSniff = activate\n\t}\n}", "title": "" }, { "docid": "de457871e37df9ab574e97c63866ab1a", "score": "0.4600311", "text": "func (b *Builder) DisableIntrospection() {\n\tb.disableIntrospection = true\n}", "title": "" }, { "docid": "7544df716c93051e8ec8cb2e73850a6f", "score": "0.45776966", "text": "func notEnabled(w *CustomWrite, d *Debug, t *testing.T) {\n\tresetEnv()\n\td.Option.Reset()\n\tmustMatch(\n\t\tw, d, \"\",\n\t\t\"notEnabled: seems to print something, wtf ?\",\n\t\tt, \"this msg will not be printed\")\n}", "title": "" }, { "docid": "7d79904a2510c2307c9b56d46c4e45e7", "score": "0.4572957", "text": "func (m *AuthenticationMethodFeatureConfiguration) SetExcludeTarget(value FeatureTargetable)() {\n m.excludeTarget = value\n}", "title": "" }, { "docid": "de4af3c56a631332d6f8bf8fe1311ddd", "score": "0.45675135", "text": "func (t *RFTest) unmapBrowsers() {\n\tt.Browsers = []string{}\n\tfor _, browserMap := range t.BrowsersMap {\n\t\tif browserMap[\"state\"] == \"enabled\" {\n\t\t\tt.Browsers = append(t.Browsers, browserMap[\"name\"].(string))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2ca95ed31bb0b361d3da77786198f564", "score": "0.45627472", "text": "func (v *VIF) Disable() {\n\tv.mutex.Lock()\n\tdefer v.mutex.Unlock()\n\n\tif v.enabled {\n\t\tif v.output != nil {\n\t\t\tv.disable()\n\t\t}\n\t\tv.enabled = false\n\t\tv.lastChange = time.Now()\n\t}\n}", "title": "" }, { "docid": "7d0db148daad30cfd057339ca8ef7db3", "score": "0.4525487", "text": "func (o *CapabilitySwitchCapability) UnsetSystemLimits() {\n\to.SystemLimits.Unset()\n}", "title": "" }, { "docid": "b42e88e70cfe6fd9c8e73e298b50de56", "score": "0.4515242", "text": "func (d *serverDebug) disableMetricsStats() {\n\tif d.enabled.Load() {\n\t\td.enabled.Store(false)\n\t\td.metricsCounts.closeChan <- struct{}{}\n\t}\n\n\td.log.Info(\"Disabling DogStatsD debug metrics stats.\")\n}", "title": "" }, { "docid": "c33fd1a7153a67088d0857a28ee86451", "score": "0.45064765", "text": "func DisableTestLogging(tb testing.TB) {\n\tcaller := \"\"\n\tcleanup := setTestLogging(LevelNone, caller, KeyNone)\n\ttb.Cleanup(cleanup)\n}", "title": "" }, { "docid": "dd1d4a00425654304427b1316025faf8", "score": "0.4499017", "text": "func Disable() {\r\n\tlog.Out = ioutil.Discard\r\n}", "title": "" }, { "docid": "a4dd2b9eb693c5938e0f6e609d53dd26", "score": "0.4495607", "text": "func DisableStats4Test() {\n\tSetStatsLease(-1)\n}", "title": "" }, { "docid": "02e5d34b2b7311503666f664efb1845c", "score": "0.44936016", "text": "func (e *SettingEngine) DisableCertificateFingerprintVerification(isDisabled bool) {\n\te.disableCertificateFingerprintVerification = isDisabled\n}", "title": "" }, { "docid": "8d94ea437a1c494d98527e96728a0488", "score": "0.4482198", "text": "func Disable() { atomic.StoreUint64(&enabled, 0) }", "title": "" }, { "docid": "d42978ab6dc7ed77880ac81d8f97801b", "score": "0.44755015", "text": "func (*NoopStorage) DisableRuleSystemWide(\n\t_ types.OrgID, _ types.RuleID,\n\t_ types.ErrorKey, _ string,\n) error {\n\treturn nil\n}", "title": "" }, { "docid": "3b625097e0b06714629cf79d9458847a", "score": "0.44548416", "text": "func withoutProxy(namespace string) *helm.Options {\n\treturn &helm.Options{\n\t\tKubectlOptions: &k8s.KubectlOptions{Namespace: namespace},\n\t\tSetValues: map[string]string{\n\t\t\t\"proxy.enabled\": \"false\",\n\t\t\t\"pachd.service.type\": exposedServiceType(),\n\t\t},\n\t}\n}", "title": "" }, { "docid": "03eef03210e76672433723c28b5614cc", "score": "0.4442421", "text": "func DisableMonitoring(out *opsmngr.AutomationConfig, hostname string) error {\n\tfor i, v := range out.MonitoringVersions {\n\t\tif v.Hostname == hostname {\n\t\t\tout.MonitoringVersions = append(out.MonitoringVersions[:i], out.MonitoringVersions[i+1:]...)\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn fmt.Errorf(\"no monitoring for '%s'\", hostname)\n}", "title": "" }, { "docid": "579c6c30124834b841fb62dc0142ca0a", "score": "0.44333157", "text": "func TestRunApictlWithoutAnyEnvironments(t *testing.T) {\n\n\toutput, err := testutils.InitApictl(t)\n\n\t// Validate apictl initialization\n\ttestutils.ValidateApictlInit(t, err, output)\n}", "title": "" }, { "docid": "76d2561be0a95aa0810b14d2c86dd8d0", "score": "0.4432009", "text": "func (l *Logger) Disable() {\n\tl.Trace.SetOutput(ioutil.Discard)\n\tl.Info.SetOutput(ioutil.Discard)\n\tl.Warn.SetOutput(ioutil.Discard)\n\tl.Error.SetOutput(ioutil.Discard)\n}", "title": "" }, { "docid": "da76fb8396f4e7d0dea08f7b1e96859b", "score": "0.44108963", "text": "func userAgentWithoutVersion(userAgent string) string {\n\tif !strings.Contains(userAgent, \"/\") {\n\t\treturn userAgent\n\t}\n\treturn strings.SplitN(userAgent, \"/\", 2)[0]\n}", "title": "" }, { "docid": "44776aaea882a4cbe8627478175160e5", "score": "0.4410654", "text": "func (s *SingleRuntime) DisableAgentCheck(backend, server string) error {\n\tcmd := fmt.Sprintf(\"disable agent %s/%s\", backend, server)\n\treturn s.Execute(cmd)\n}", "title": "" }, { "docid": "0c4089947111f32f7b3a50d72124a199", "score": "0.44004625", "text": "func Unset() {\n\tSet(Disabled)\n}", "title": "" }, { "docid": "b48cabc9fa294daca165902179bf54b1", "score": "0.4398721", "text": "func TestBlockRetrieverDoesNotInvokeOnRetrieveWithGlobalFlag(t *testing.T) {\n\ttestBlockRetrieverOnRetrieve(t, false, true)\n}", "title": "" }, { "docid": "b7f5dd1f11b7b7758371bd3ca675564b", "score": "0.43956944", "text": "func TestUnconditionalEnvVarDiagnosticTeardown(t *testing.T) {\n\ttdcounter := 0\n\n\tteardown.AddDiagnosticTeardown(\"name\", false, func() {\n\t\ttdcounter++\n\t\trequire.Equal(t, 1, tdcounter)\n\t})\n\n\tteardown.AddTeardown(\"name\", func() {\n\t\ttdcounter++\n\t\trequire.Equal(t, 3, tdcounter)\n\t})\n\n\tteardown.AddTeardown(\"name\", func() {\n\t\ttdcounter++\n\t\trequire.Equal(t, 2, tdcounter)\n\t})\n\n\tteardown.AlwaysRunDiagnosticTeardowns = true\n\tdefer func() { teardown.AlwaysRunDiagnosticTeardowns = false }()\n\n\tteardown.Teardown(\"name\")\n\n\trequire.Equal(t, 3, tdcounter)\n\n\tteardown.VerifyTeardown(t)\n}", "title": "" }, { "docid": "58056b2cdc49fe11bf5da70607003531", "score": "0.43886706", "text": "func (*NoopStorage) PrintRuleDisableDebugInfo() {\n}", "title": "" }, { "docid": "92db33cc901088bb4e8fbef93dac2efe", "score": "0.43783596", "text": "func (m *Windows10GeneralConfiguration) GetDefenderFileExtensionsToExclude()([]string) {\n return m.defenderFileExtensionsToExclude\n}", "title": "" }, { "docid": "39237a4fdd29fb8bab76b2a951448280", "score": "0.4377256", "text": "func NewNoopBlacklist() Blacklist { return noopBlacklist{} }", "title": "" }, { "docid": "75e20a044e0885fe7670d09206b5b620", "score": "0.43746153", "text": "func debugOff() {\n\tDebugMode = false\n}", "title": "" }, { "docid": "76638419719674614a50ee9e94bdb3d0", "score": "0.43713984", "text": "func NoStat(g *types.Cmd) {\n\tg.AddOptions(\"--no-stat\")\n}", "title": "" }, { "docid": "b5cafb693cb0d1bccc6ac8799f1e338d", "score": "0.43710527", "text": "func (m *Windows10GeneralConfiguration) SetDefenderFileExtensionsToExclude(value []string)() {\n m.defenderFileExtensionsToExclude = value\n}", "title": "" }, { "docid": "0e6b0178cdceaa1bc8ab746fa7996879", "score": "0.43685064", "text": "func DisableLogging() {\n\tlogger.SetFlags(0)\n\tlogger.SetOutput(ioutil.Discard)\n}", "title": "" }, { "docid": "34205b88f77974dfd4d9b75e93ea3171", "score": "0.436597", "text": "func TestNoLastUpdateAndDisabled(t *testing.T) {\n\tconfig := prepareConfigForCLI(`{\"UsageStatsEnabled\": false}`, t)\n\n\t// check\n\tcheckUsageStats(false, false, config, t)\n\n\t// enabled\n\tconfig.SetUsageStatsEnabled(true)\n\tcheckUsageStats(true, true, config, t)\n\n\t// disabled\n\tconfig.SetUsageStatsEnabled(false)\n\tcheckUsageStats(false, true, config, t)\n\n\tt.Cleanup(cleanupConfigFiles)\n}", "title": "" }, { "docid": "52a4dbdebf17564d2f3ce1a538debe4c", "score": "0.43615296", "text": "func TestNonexistentDisable(t *testing.T) {\n\t// This test's behavior is not dependent on whether the pod is a legacy or uuid pod\n\thl, sb := FakeHoistLaunchableForDirLegacyPod(\"nonexistent_scripts_test_hoist_launchable\")\n\tdefer CleanupFakeLaunchable(hl, sb)\n\n\tdisableOutput, err := hl.disable()\n\tAssert(t).IsNil(err, \"Got an unexpected error when calling disable on the test hoist launchable\")\n\n\texpectedDisableOutput := \"\"\n\n\tAssert(t).AreEqual(disableOutput, expectedDisableOutput, \"Did not get expected output from test disable script\")\n}", "title": "" }, { "docid": "ff3d3e93e7c9b7bffd0688c2c68c6565", "score": "0.43552116", "text": "func DisableGrnInit() error {\n\tgrnCntMutex.Lock()\n\tdefer grnCntMutex.Unlock()\n\tif grnCnt != 0 {\n\t\treturn fmt.Errorf(\"grnCnt = %d\", grnCnt)\n\t}\n\tgrnCnt++\n\treturn nil\n}", "title": "" }, { "docid": "80433fbc63db1a18723d7d6aadd13873", "score": "0.43547234", "text": "func init() {\n\tfor _, arg := range os.Args {\n\t\tif flag := strings.TrimLeft(arg, \"-\"); flag == TracingEnabledFlag {\n\t\t\tEnabled = true\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d0e478b86d7f46d8a0e4114d43ce9c40", "score": "0.4353244", "text": "func NoopSupport(_ *logp.Logger, info beat.Info, config *common.Config) (Supporter, error) {\n\treturn NewNoopSupport(info, config)\n}", "title": "" }, { "docid": "f34023310b5e8cd1a1b053327a837336", "score": "0.4352643", "text": "func NonGraceful() {\n\tinterrupts = false\n}", "title": "" }, { "docid": "37f1fcb5be2235e6d6af732261078310", "score": "0.43434784", "text": "func (s *Set) Disable(capabs ...Capability) {\n\ts.Lock()\n\tdefer s.Unlock()\n\n\tfor _, capab := range capabs {\n\t\tdelete(s.capabilities, capab)\n\t}\n}", "title": "" }, { "docid": "26219ee3acf4492f60d5f8f27e9c9096", "score": "0.4342785", "text": "func (led *LED) NonDimmable() {\n\tled.dimmable = false\n\tif isNativePWMPin(led.pin) {\n\t\tled.pin.Mode(rpio.Output)\n\t}\n\tled.brightness = -1\n}", "title": "" }, { "docid": "8313224bfb292bff8876cfb78c159870", "score": "0.4338476", "text": "func (s *Svc) NonRoots() []*api.Operation {\n\tvar ops []*api.Operation\n\tfor _, op := range s.Operations {\n\t\tif isScanAPI(op, false) {\n\t\t\tops = append(ops, op)\n\t\t}\n\t}\n\tsort.Slice(ops, func(i, j int) bool {\n\t\treturn ops[i].ExportedName < ops[j].ExportedName\n\t})\n\treturn ops\n}", "title": "" }, { "docid": "26b50abaa746d06a8c11172ab048818e", "score": "0.43351752", "text": "func (m *Windows10GeneralConfiguration) SetDefenderProcessesToExclude(value []string)() {\n m.defenderProcessesToExclude = value\n}", "title": "" }, { "docid": "f3412a9e45a13c727fab10aadd17b04f", "score": "0.43345362", "text": "func (d *Driver) Disable() {\n\td.p.StoreENABLE(false)\n}", "title": "" }, { "docid": "9b6c9b2a6942007277a2637c185fa2ca", "score": "0.43325883", "text": "func DiscardXORMLogger() {\n\tXORMLogger = &XORMLogBridge{\n\t\tshowSQL: false,\n\t}\n}", "title": "" }, { "docid": "88affd27077e7bd00647881ca57d9cbe", "score": "0.432946", "text": "func (m *Windows10GeneralConfiguration) SetDefenderRequireNetworkInspectionSystem(value *bool)() {\n m.defenderRequireNetworkInspectionSystem = value\n}", "title": "" }, { "docid": "aa1c2758805914974896d5aff75cedfa", "score": "0.4327978", "text": "func DisableStackTraces() {\n\tuseStackTracesMutex.Lock()\n\tdefer useStackTracesMutex.Unlock()\n\tuseStackTraces = false\n}", "title": "" }, { "docid": "a8a389c770bb3e65cf6906140313e130", "score": "0.43242225", "text": "func (c *Context) noOp(name string) {\n}", "title": "" }, { "docid": "08c84f6a9d8c5841afdf5da3c0a3f897", "score": "0.43185714", "text": "func (m *AuthenticationMethodFeatureConfiguration) GetExcludeTarget()(FeatureTargetable) {\n return m.excludeTarget\n}", "title": "" }, { "docid": "d1f8ab1dd7bd26a7f8e1bbbf25a4f964", "score": "0.4317786", "text": "func (c *Runtime) Disable() (*gcdmessage.ChromeResponse, error) {\n\treturn gcdmessage.SendDefaultRequest(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: \"Runtime.disable\"})\n}", "title": "" }, { "docid": "071d8f072bde00b684e9d053ef96e7ce", "score": "0.43122184", "text": "func (m *Windows10GeneralConfiguration) GetDefenderProcessesToExclude()([]string) {\n return m.defenderProcessesToExclude\n}", "title": "" }, { "docid": "62cb2e33eb4a674386e6042c9553c6ac", "score": "0.4310953", "text": "func (cs *commonStore) RemoveNonPersistable(cfg *model.Config) *model.Config {\n\tnewCfg := cs.RemoveEnvironmentOverrides(cfg)\n\tnewCfg.FeatureFlags = nil\n\treturn newCfg\n}", "title": "" }, { "docid": "3a66aad34c1f2d011d008f443f48b177", "score": "0.4300878", "text": "func (h *Health) DisableLogging() {\n\th.Logger = loggers.NewNoop()\n}", "title": "" }, { "docid": "239e6463a21c68cff3f189cbc532a79d", "score": "0.4287229", "text": "func DisableDebug() {\n\tdebugLogLevelEnabled = false\n}", "title": "" }, { "docid": "b126e441fd85acdb9e642d1180a4a380", "score": "0.42854324", "text": "func Disable() nirvana.Configurer {\n\treturn func(c *nirvana.Config) error {\n\t\t// Set to nil will delete plugin config from nirvana config.\n\t\tc.Set(ExternalConfigName, nil)\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "3ddc867e90a37e0b9fc809ae3c78a939", "score": "0.42794207", "text": "func nonCAPIOnlyFeature(convertedValue, defaultValue interface{}, isCapi bool) error {\n\tif convertedValue != defaultValue {\n\t\tif isCapi {\n\t\t\treturn errors.New(\"The value can not be specified for CAPI replication\")\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "aae2003fe0aaa2c775df71e1f6bd85ec", "score": "0.42659333", "text": "func NoRaw() {\n\tC.noraw()\n}", "title": "" }, { "docid": "ff9c05ced5bb80ff8f5653ea26b6f650", "score": "0.42647353", "text": "func TestNoLastUpdateAndNoEnabled(t *testing.T) {\n\tconfig := prepareConfigForCLI(\"\", t)\n\n\t// check\n\tcheckUsageStats(false, false, config, t)\n\n\t// enabled\n\tconfig.SetUsageStatsEnabled(true)\n\tcheckUsageStats(true, true, config, t)\n\n\t// disabled\n\tconfig.SetUsageStatsEnabled(false)\n\tcheckUsageStats(false, true, config, t)\n\n\tt.Cleanup(cleanupConfigFiles)\n}", "title": "" }, { "docid": "b8065a4d1b9b2968e39e45e691971f18", "score": "0.42606965", "text": "func WithoutSD() InvocationOption {\n\treturn func(o *InvokeOptions) {\n\t\to.DisableSD = true\n\t}\n}", "title": "" }, { "docid": "45e824a29cbb479940d2ce4c65ab5f55", "score": "0.42576322", "text": "func DenyAll() Enabler { return &denyAll{} }", "title": "" }, { "docid": "45d3a6203f610c6a27ce2d850e1c82c0", "score": "0.4256558", "text": "func DisableProviders() Option {\n\treturn func(c *dhtcfg.Config) error {\n\t\tc.EnableProviders = false\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "471f2161e0937e5534006edb0e7262ea", "score": "0.42561883", "text": "func NewTokenInfoWithoutSupply(symbol Symbol, issuer string, isSendEnabled bool, decimals uint64) *TokenInfoWithoutSupply {\n\treturn &TokenInfoWithoutSupply{\n\t\tSymbol: symbol,\n\t\tIssuer: issuer,\n\t\tIsSendEnabled: isSendEnabled,\n\t\tDecimals: decimals,\n\t}\n}", "title": "" }, { "docid": "42579c3bb14496eb7a3c10a96a1461d0", "score": "0.4255606", "text": "func (l *Logger) Disable(flags ...Flag) {\n\tl.flagsLock.Lock()\n\tdefer l.flagsLock.Unlock()\n\tfor _, flag := range flags {\n\t\tl.flags.Disable(flag)\n\t}\n}", "title": "" }, { "docid": "49d4322134ac82bef483748b3291520f", "score": "0.42501253", "text": "func (b *BuildConfig) Disable() {\n\tb.List = false\n\tb.Render = false\n\tb.PublishResources = false\n\tb.set = true\n}", "title": "" }, { "docid": "3de83877b914bc2f4486020c012f757f", "score": "0.42444348", "text": "func (m *Windows10EndpointProtectionConfiguration) SetDefenderDisableIntrusionPreventionSystem(value *bool)() {\n err := m.GetBackingStore().Set(\"defenderDisableIntrusionPreventionSystem\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "cb113f723bfe79770e8ec5bff1377e3f", "score": "0.42433617", "text": "func (b *MockPrBuilder) WithoutLabels() *MockPrBuilder {\n\tb.pullRequest.Labels = make([]*gogh.Label, 0)\n\treturn b\n}", "title": "" }, { "docid": "41dd7cbd6f0396c4bb236197c03d5212", "score": "0.4241919", "text": "func (m *Windows10GeneralConfiguration) GetNetworkProxyDisableAutoDetect()(*bool) {\n return m.networkProxyDisableAutoDetect\n}", "title": "" }, { "docid": "e2ef0cce0ea00cc8ad53c86079c9b811", "score": "0.42379642", "text": "func Init() {\n\tif initialized {\n\t\treturn\n\t}\n\tinitialized = true\n\n\t// Keep in sync with WillBeEnabled. We perform extra validation here, and\n\t// there are lots of diagnostics and side effects, so we can't use\n\t// WillBeEnabled directly.\n\tvar mustUseModules bool\n\tenv := cfg.Getenv(\"GO111MODULE\")\n\tswitch env {\n\tdefault:\n\t\tbase.Fatalf(\"go: unknown environment setting GO111MODULE=%s\", env)\n\tcase \"auto\":\n\t\tmustUseModules = ForceUseModules\n\tcase \"on\", \"\":\n\t\tmustUseModules = true\n\tcase \"off\":\n\t\tif ForceUseModules {\n\t\t\tbase.Fatalf(\"go: modules disabled by GO111MODULE=off; see 'go help modules'\")\n\t\t}\n\t\tmustUseModules = false\n\t\treturn\n\t}\n\n\tif err := fsys.Init(base.Cwd()); err != nil {\n\t\tbase.Fatalf(\"go: %v\", err)\n\t}\n\n\t// Disable any prompting for passwords by Git.\n\t// Only has an effect for 2.3.0 or later, but avoiding\n\t// the prompt in earlier versions is just too hard.\n\t// If user has explicitly set GIT_TERMINAL_PROMPT=1, keep\n\t// prompting.\n\t// See golang.org/issue/9341 and golang.org/issue/12706.\n\tif os.Getenv(\"GIT_TERMINAL_PROMPT\") == \"\" {\n\t\tos.Setenv(\"GIT_TERMINAL_PROMPT\", \"0\")\n\t}\n\n\t// Disable any ssh connection pooling by Git.\n\t// If a Git subprocess forks a child into the background to cache a new connection,\n\t// that child keeps stdout/stderr open. After the Git subprocess exits,\n\t// os /exec expects to be able to read from the stdout/stderr pipe\n\t// until EOF to get all the data that the Git subprocess wrote before exiting.\n\t// The EOF doesn't come until the child exits too, because the child\n\t// is holding the write end of the pipe.\n\t// This is unfortunate, but it has come up at least twice\n\t// (see golang.org/issue/13453 and golang.org/issue/16104)\n\t// and confuses users when it does.\n\t// If the user has explicitly set GIT_SSH or GIT_SSH_COMMAND,\n\t// assume they know what they are doing and don't step on it.\n\t// But default to turning off ControlMaster.\n\tif os.Getenv(\"GIT_SSH\") == \"\" && os.Getenv(\"GIT_SSH_COMMAND\") == \"\" {\n\t\tos.Setenv(\"GIT_SSH_COMMAND\", \"ssh -o ControlMaster=no -o BatchMode=yes\")\n\t}\n\n\tif os.Getenv(\"GCM_INTERACTIVE\") == \"\" {\n\t\tos.Setenv(\"GCM_INTERACTIVE\", \"never\")\n\t}\n\tif modRoots != nil {\n\t\t// modRoot set before Init was called (\"go mod init\" does this).\n\t\t// No need to search for go.mod.\n\t} else if RootMode == NoRoot {\n\t\tif cfg.ModFile != \"\" && !base.InGOFLAGS(\"-modfile\") {\n\t\t\tbase.Fatalf(\"go: -modfile cannot be used with commands that ignore the current module\")\n\t\t}\n\t\tmodRoots = nil\n\t} else if inWorkspaceMode() {\n\t\t// We're in workspace mode.\n\t} else {\n\t\tif modRoot := findModuleRoot(base.Cwd()); modRoot == \"\" {\n\t\t\tif cfg.ModFile != \"\" {\n\t\t\t\tbase.Fatalf(\"go: cannot find main module, but -modfile was set.\\n\\t-modfile cannot be used to set the module root directory.\")\n\t\t\t}\n\t\t\tif RootMode == NeedRoot {\n\t\t\t\tbase.Fatalf(\"go: %v\", ErrNoModRoot)\n\t\t\t}\n\t\t\tif !mustUseModules {\n\t\t\t\t// GO111MODULE is 'auto', and we can't find a module root.\n\t\t\t\t// Stay in GOPATH mode.\n\t\t\t\treturn\n\t\t\t}\n\t\t} else if search.InDir(modRoot, os.TempDir()) == \".\" {\n\t\t\t// If you create /tmp/go.mod for experimenting,\n\t\t\t// then any tests that create work directories under /tmp\n\t\t\t// will find it and get modules when they're not expecting them.\n\t\t\t// It's a bit of a peculiar thing to disallow but quite mysterious\n\t\t\t// when it happens. See golang.org/issue/26708.\n\t\t\tfmt.Fprintf(os.Stderr, \"go: warning: ignoring go.mod in system temp root %v\\n\", os.TempDir())\n\t\t\tif !mustUseModules {\n\t\t\t\treturn\n\t\t\t}\n\t\t} else {\n\t\t\tmodRoots = []string{modRoot}\n\t\t}\n\t}\n\tif cfg.ModFile != \"\" && !strings.HasSuffix(cfg.ModFile, \".mod\") {\n\t\tbase.Fatalf(\"go: -modfile=%s: file does not have .mod extension\", cfg.ModFile)\n\t}\n\n\t// We're in module mode. Set any global variables that need to be set.\n\tcfg.ModulesEnabled = true\n\tsetDefaultBuildMod()\n\tlist := filepath.SplitList(cfg.BuildContext.GOPATH)\n\tif len(list) > 0 && list[0] != \"\" {\n\t\tgopath = list[0]\n\t\tif _, err := fsys.Stat(filepath.Join(gopath, \"go.mod\")); err == nil {\n\t\t\tbase.Fatalf(\"$GOPATH/go.mod exists but should not\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "afd92b5e7afd456cc3121fea821d99af", "score": "0.42360952", "text": "func (e *Env) RunWithoutChroot(ctx context.Context, args ...string) error {\n\tnetnsArgs := []string{\"netns\", \"exec\", e.NetNSName}\n\targs = append(netnsArgs, args...)\n\tif o, err := testexec.CommandContext(ctx, \"ip\", args...).CombinedOutput(); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to run cmd in netns %s with output %s\", e.NetNSName, string(o))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "178fed381b04540a51d2d2b5e7bcf351", "score": "0.42285275", "text": "func NewMemoryTiltAnalyticsForTest(opter AnalyticsOpter) (*analytics.MemoryAnalytics, *TiltAnalytics) {\n\tma := analytics.NewMemoryAnalytics()\n\tta, err := NewTiltAnalytics(opter, ma, \"v0.0.0\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn ma, ta\n}", "title": "" }, { "docid": "a7330fb33fccd1bf9843bf57f03a7a52", "score": "0.4220775", "text": "func (s *Systemd) Disable(svc string) error {\n\tcmd := exec.Command(\"sudo\", \"systemctl\", \"disable\", svc)\n\t// See https://github.com/kubernetes/minikube/issues/11615#issuecomment-861794258\n\tcmd.Env = append(cmd.Env, \"SYSTEMCTL_SKIP_SYSV=1\")\n\t_, err := s.r.RunCmd(cmd)\n\treturn err\n}", "title": "" }, { "docid": "7779218147d7e71b0eff776d566c2a68", "score": "0.42159575", "text": "func (o *CapabilitySwitchCapability) UnsetNetworkLimits() {\n\to.NetworkLimits.Unset()\n}", "title": "" }, { "docid": "8d0ebb35356646599788cf7cc9a9760f", "score": "0.4211099", "text": "func ScopeWithoutShowLogs(t tShim) *TestLogScope {\n\ttempDir, err := ioutil.TempDir(\"\", \"log\"+fileutil.EscapeFilename(t.Name()))\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif err := dirTestOverride(\"\", tempDir); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tundo, err := enableLogFileOutput(tempDir, Severity_ERROR)\n\tif err != nil {\n\t\tundo()\n\t\tt.Fatal(err)\n\t}\n\tt.Logf(\"test logs captured to: %s\", tempDir)\n\treturn &TestLogScope{logDir: tempDir, cleanup: undo}\n}", "title": "" } ]
d7c6ed540efcacc09903d889362379b4
Encrypt indicates an expected call of Encrypt
[ { "docid": "6f85644850d059643463dd728c2aafa6", "score": "0.68015873", "text": "func (mr *MockSecretsMockRecorder) Encrypt(arg0, arg1, arg2 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Encrypt\", reflect.TypeOf((*MockSecrets)(nil).Encrypt), arg0, arg1, arg2)\n}", "title": "" } ]
[ { "docid": "eb8d7fb6cba7edd8311bfabaddaa7330", "score": "0.7031394", "text": "func (mr *MockKeyManagementServiceClientMockRecorder) Encrypt(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Encrypt\", reflect.TypeOf((*MockKeyManagementServiceClient)(nil).Encrypt), varargs...)\n}", "title": "" }, { "docid": "f6bcb89a37d7436aa68bcd5b877ce017", "score": "0.69538724", "text": "func (mr *MockEncryptionWriterMockRecorder) Encrypt(value, pkey interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Encrypt\", reflect.TypeOf((*MockEncryptionWriter)(nil).Encrypt), value, pkey)\n}", "title": "" }, { "docid": "704e8fe952b4e3e66f7eeb5a14478747", "score": "0.68899596", "text": "func (_m *KeyContainerInterface) Encrypt(wmid string, keyPassword string) {\n\t_m.Called(wmid, keyPassword)\n}", "title": "" }, { "docid": "92bcffdb1a988fe5158f7ed0d85c5a95", "score": "0.68397915", "text": "func (mr *MockCryptoClientMockRecorder) Encrypt(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Encrypt\", reflect.TypeOf((*MockCryptoClient)(nil).Encrypt), varargs...)\n}", "title": "" }, { "docid": "5ae626c14a5ddb315749eb3f845f04d0", "score": "0.68255", "text": "func (mr *MockEncrypterMockRecorder) Encrypt(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Encrypt\", reflect.TypeOf((*MockEncrypter)(nil).Encrypt), arg0)\n}", "title": "" }, { "docid": "06c82014cf6a66f3b11fe549da018fdd", "score": "0.66784257", "text": "func TestEncryption(t *testing.T) {\n\tt.Parallel()\n\n\tassertEqual(t, rave.Encrypt3Des(\"Hello world\"), \"fus4LnqrvKWXqm7wueoj2Q==\")\n}", "title": "" }, { "docid": "ecd72cd3f24d2695caec8ed29a761752", "score": "0.66499496", "text": "func (cs *LoginCryptoService) Encrypt(src []byte, dst []byte) error {\n\tpanic(errors.New(\"login crypto service cannot encrypt data\"))\n}", "title": "" }, { "docid": "dd9ca3e18c8f60f81cda1101c31de427", "score": "0.6599813", "text": "func (c *failingCryptoKey) Encrypt(in []byte) ([]byte, error) {\n\treturn nil, errors.New(\"failed to encrypt\")\n}", "title": "" }, { "docid": "d4649249557cd015e3d2d2690925561b", "score": "0.6496215", "text": "func TestStuffCanEncryption(t *testing.T) {\n\tassert := assert.New(t)\n\n\tmessage := \"{\\\"this stuff\\\":{\\\"can get\\\":\\\"complicated!\\\"}}\"\n\tencrypted := EncryptString(\"enigma\", message, false)\n\tassert.Equal(\"zMqH/RTPlC8yrAZ2UhpEgLKUVzkMI2cikiaVg30AyUu7B6J0FLqCazRzDOmrsFsF\", encrypted)\n}", "title": "" }, { "docid": "feb0b9b920845cf89a255162f0b7ea0d", "score": "0.6444189", "text": "func (d dummyEncryptor) Encrypt(ctx context.Context, key []byte, keyContext keystore.KeyContext) ([]byte, error) {\n\treturn key, nil\n}", "title": "" }, { "docid": "16568b7aaa4fe614c676832baac07e45", "score": "0.6416954", "text": "func TestEncrypt(t *testing.T) {\n\tlog.SetFlags(log.Lshortfile)\n\tiaes, _ := NewAesPackage([]byte(\"\"))\n\tcipherstring := iaes.EncryptCFB(msg).ToStringBase64()\n\tlog.Println(\"EncryptCFB\", cipherstring)\n\tdecodestring, _ := base.Base64Decode(cipherstring)\n\tlog.Println(\"DecryptCFB\", iaes.DecryptCFB(decodestring).ToString())\n\n\t// cbc\n\tcipherstring2 := iaes.EncryptCBC(msg, PaddingPkcs7).ToStringBase64()\n\tlog.Println(\"EncryptCBC\", cipherstring2)\n\tcbcstr, _ := base.Base64Decode(cipherstring2)\n\tlog.Println(\"DecryptCBC\", iaes.DecryptCBC(cbcstr, iaes.CurrentCipher, PaddingPkcs7).ToString())\n}", "title": "" }, { "docid": "610a144802c4c15194070dcb15a88881", "score": "0.6410706", "text": "func (c *MockClient) Encrypt(ctx context.Context, name string, context, data []byte) (string, error) {\n\tkey, err := c.deriveTransitKey(name, context)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tencryptedData, err := crypto.Encrypt(key, data)\n\treturn string(encryptedData), err\n}", "title": "" }, { "docid": "4c083ea76c9844f360687c149386c640", "score": "0.6376919", "text": "func TestStuffCanEncryption(t *testing.T) {\n\tmessage := \"{\\\"this stuff\\\":{\\\"can get\\\":\\\"complicated!\\\"}}\"\n\t//encrypt\n\tencrypted := messaging.EncryptString(\"enigma\", message)\n\tif \"zMqH/RTPlC8yrAZ2UhpEgLKUVzkMI2cikiaVg30AyUu7B6J0FLqCazRzDOmrsFsF\" == encrypted {\n\t\tfmt.Println(\"StuffCan encryption: passed.\")\n\t} else {\n\t\tt.Error(\"StuffCan encryption: failed.\")\n\t}\n}", "title": "" }, { "docid": "d24773dcd7a5c930b65a523c52ee6fca", "score": "0.6376135", "text": "func TestEncrypt(t *testing.T) {\n\tvar cur, prev []byte\n\tvar err error\n\n\tfor i := ivIterations; i != 0; i-- {\n\t\tcur, err = crypto.Encrypt(plaintext, key)\n\t\tassert.Nil(t, err)\n\t\tassert.NotNil(t, cur)\n\t\tassert.NotEqual(t, prev, cur, \"IV re-used\")\n\t\tprev = make([]byte, len(cur))\n\t\tcopy(prev, cur)\n\t}\n}", "title": "" }, { "docid": "0577ef17d2e4164930aac729469f012b", "score": "0.63661873", "text": "func (n *noLockAEAD) Encrypt(plaintext, additionalData []byte) ([]byte, error) {\n\treturn plaintext, nil\n}", "title": "" }, { "docid": "061818bd6432d0fe27a5dc7291ca6ee5", "score": "0.6334749", "text": "func (s *SecurityNull) Encrypt(w io.Writer, data []byte) (int, error) {\n\treturn w.Write(data)\n}", "title": "" }, { "docid": "65c81efa1c7d1a717dc0331802a191e5", "score": "0.6303944", "text": "func (m *mockAliCloudKMSSealClient) Encrypt(request *kms.EncryptRequest) (response *kms.EncryptResponse, err error) {\n\tm.keyID = request.KeyId\n\n\tencoded := make([]byte, base64.StdEncoding.EncodedLen(len(request.Plaintext)))\n\tbase64.StdEncoding.Encode(encoded, []byte(request.Plaintext))\n\n\toutput := kms.CreateEncryptResponse()\n\toutput.CiphertextBlob = string(encoded)\n\toutput.KeyId = request.KeyId\n\treturn output, nil\n}", "title": "" }, { "docid": "6460df42609b0edf0d34d830322bd2f2", "score": "0.6290301", "text": "func (mr *MockCryptoClientMockRecorder) EncryptInit(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"EncryptInit\", reflect.TypeOf((*MockCryptoClient)(nil).EncryptInit), varargs...)\n}", "title": "" }, { "docid": "4c13bb12249b9e2744efababa1c03ade", "score": "0.62628967", "text": "func (pc *plainCipherKey) Encrypt(plaintext []byte) ([]byte, error) { return plaintext[:], nil }", "title": "" }, { "docid": "6159fdeb62f2974fe2308009ee163a39", "score": "0.6247757", "text": "func (security) Encrypt(w io.Writer, data []byte) (int, error) {\n\treturn w.Write(data)\n}", "title": "" }, { "docid": "9c4c81724243d4edda4eb1a6886d8ae7", "score": "0.6233721", "text": "func TestYayEncryptionBasic(t *testing.T) {\n\tassert := assert.New(t)\n\n\tmessage := \"yay!\"\n\tencrypted := EncryptString(\"enigma\", message, false)\n\n\tassert.Equal(\"q/xJqqN6qbiZMXYmiQC1Fw==\", encrypted)\n}", "title": "" }, { "docid": "fe4e34d643ed401b7ead5ffa0873c5d2", "score": "0.6194591", "text": "func TestObjectEncryption(t *testing.T) {\n\tassert := assert.New(t)\n\n\tmessage := emptyStruct{}\n\n\tb, err := json.Marshal(message)\n\tassert.NoError(err)\n\n\tencrypted := EncryptString(\"enigma\", string(b), false)\n\n\tassert.Equal(\"IDjZE9BHSjcX67RddfCYYg==\", encrypted)\n}", "title": "" }, { "docid": "b694d5c8c45393204dcb50f12ca3d672", "score": "0.6183988", "text": "func (m *MockKeyManagementServiceClient) Encrypt(arg0 context.Context, arg1 *v1beta1.EncryptRequest, arg2 ...grpc.CallOption) (*v1beta1.EncryptResponse, 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, \"Encrypt\", varargs...)\n\tret0, _ := ret[0].(*v1beta1.EncryptResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "60ee1a3818cadde345a1d1869e967143", "score": "0.6174412", "text": "func (m *MockSecrets) Encrypt(arg0, arg1 string, arg2 map[string]string) (string, error) {\n\tret := m.ctrl.Call(m, \"Encrypt\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(string)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "618b4144b2a1a65dc0affb8884c088cf", "score": "0.61574817", "text": "func (i *ibmKpSecretStorage) Encrypt(\n\tsecretID string,\n\tplaintTextData string,\n\tkeyContext map[string]string,\n) (string, error) {\n\treturn \"\", secrets.ErrNotSupported\n}", "title": "" }, { "docid": "7ac8f9226d0bb28d61f5dfa1562371fd", "score": "0.61322385", "text": "func (c NilCryptoService) Encrypt(src []byte, dst []byte) error {\n\tcopy(dst, src)\n\n\treturn nil\n}", "title": "" }, { "docid": "af967f2c3ecd79739129ca979e0d367f", "score": "0.612627", "text": "func Encrypt(text, key string) (string, error) {\n\treturn text, nil\n}", "title": "" }, { "docid": "48961499e26cc6b936e04458f1498940", "score": "0.6120416", "text": "func (c *Crypto) Encrypt(msg, aad []byte, kh interface{}) ([]byte, []byte, error) {\n\treturn c.EncryptValue, c.EncryptNonceValue, c.EncryptErr\n}", "title": "" }, { "docid": "9cdd62ab55db8c49d59a55a318db37c1", "score": "0.6115393", "text": "func TestYayEncryption(t *testing.T) {\n\tassert := assert.New(t)\n\n\tmessage := \"yay!\"\n\tb, err := json.Marshal(message)\n\tassert.NoError(err)\n\n\tencrypted := EncryptString(\"enigma\", string(b), false)\n\tassert.Equal(\"Wi24KS4pcTzvyuGOHubiXg==\", encrypted)\n}", "title": "" }, { "docid": "99bf07e4d7ad8a46dd975290954e6a81", "score": "0.61137754", "text": "func TestObjectEncryption(t *testing.T) {\n\tmessage := EmptyStruct{}\n\t//serialize\n\tb, err := json.Marshal(message)\n\tif err != nil {\n\t\tfmt.Println(\"error:\", err)\n\t\tt.Error(\"Object encryption: failed.\")\n\t} else {\n\t\t//encrypt\n\t\tencrypted := messaging.EncryptString(\"enigma\", string(b))\n\t\tif \"IDjZE9BHSjcX67RddfCYYg==\" == encrypted {\n\t\t\tfmt.Println(\"Object encryption: passed.\")\n\t\t} else {\n\t\t\tt.Error(\"Object encryption: failed.\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "885c2f8222717c4f3cc57d0032ca2516", "score": "0.60977626", "text": "func TestEncryption(t *testing.T) {\n\tt.Parallel()\n\n\tmockChainWriter := mock.NewChainWriter()\n\twriter := encryption.NewEncryptionWriter(mockenc.NewChunkEncrypter(key), mockChainWriter)\n\n\targs := pipeline.PipeWriteArgs{Ref: addr, Data: data}\n\terr := writer.ChainWrite(&args)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif !bytes.Equal(encryptedData, args.Data) {\n\t\tt.Fatalf(\"data mismatch. got %v want %v\", args.Data, encryptedData)\n\t}\n\n\tif calls := mockChainWriter.ChainWriteCalls(); calls != 1 {\n\t\tt.Errorf(\"wanted 1 ChainWrite call, got %d\", calls)\n\t}\n}", "title": "" }, { "docid": "ac01d3bf3d5c58c79e954837920d342e", "score": "0.60818315", "text": "func (m *MockEncryptionWriter) Encrypt(value string, pkey []byte) (string, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Encrypt\", value, pkey)\n\tret0, _ := ret[0].(string)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "f5a862eab7573b2e1f0b9be33770d30f", "score": "0.6072243", "text": "func Example_Encrypt() {\n\n\tdata := []byte(\"Four score and seven years ago\")\n\n\t// Create a keypair\n\tkeys, err := GeneratePKCipher(\"rsa-oaep-2048\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Marshal the public key out to JSON\n\tpublicjson, err := json.Marshal(keys.PublicKey())\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Read the public key back in\n\tpublic := PublicKey{}\n\terr = json.Unmarshal(publicjson, &public)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tencrypter, err := NewEncrypter(public)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Encrypt the data from the unmarshaled public key\n\tciphertext, err := encrypter.Encrypt(data)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Decrypt the data with the original private key\n\tcleartext, err := keys.Decrypt(ciphertext)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tif bytes.Compare(cleartext, data) != 0 {\n\t\tpanic(\"Data mismatch!\")\n\t}\n\n\tfmt.Println(\"Received\")\n\n\t// Output: Received\n}", "title": "" }, { "docid": "60ecc46d02416e201e18cfff47f33726", "score": "0.60504967", "text": "func (h *Hill) Encrypt(raw string) (string, error) {\n\tpt, err := h.verifyText(raw)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn h.performOperations(h.mKey, pt), nil\n}", "title": "" }, { "docid": "5bd3c595f98b63cb5ced6fa92726303f", "score": "0.60490435", "text": "func (k *KeyEncryptionStrategy) Encrypt(plaintext []byte) (string, error) {\n\treturn encryptEnvelope(k.PublicKey, k.PrivateKey, plaintext)\n}", "title": "" }, { "docid": "e7cbb6c15e5683f0bad5c3290498ff73", "score": "0.60438293", "text": "func (s *KeyManagementServiceServer) Encrypt(ctx context.Context, request *k8spb.EncryptRequest) (*k8spb.EncryptResponse, error) {\n\n\tlog.Println(\"Processing EncryptRequest: \")\n\n\tresponse, err := encrypt(s.config, string(request.Plain))\n\treturn &k8spb.EncryptResponse{Cipher: []byte(response)}, err\n}", "title": "" }, { "docid": "0e66ebc9cfba0ac709b113a68d729750", "score": "0.6029315", "text": "func (e *AESEncryptor) Encrypt(plaintext []byte) ([]byte, error) {\n\tvar encryptCall aes.CipherCall\n\tswitch e.mode {\n\tcase aes.CFB:\n\t\tencryptCall = aes.EncryptCFB\n\tcase aes.CTR:\n\t\tencryptCall = aes.EncryptCTR\n\tcase aes.GCM:\n\t\tencryptCall = aes.EncryptGCM\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unsupported encryption cipher mode: %s\", e.mode)\n\t}\n\treturn encryptCall(e.keyLen, e.secret.Open(), plaintext)\n}", "title": "" }, { "docid": "cef156bda671f90296fcc74239b7c3ad", "score": "0.60105824", "text": "func (crypt *MessageEncryptor) Encrypt(value interface{}) (string, error) {\n\tswitch crypt.Cipher {\n\tcase \"aes-cbc\":\n\t\treturn crypt.aesCbcEncrypt(value)\n\tcase \"aes-256-gcm\":\n\t\treturn crypt.aesGCMEncrypt(value)\n\tcase \"\":\n\t\t// using a default if not set\n\t\treturn crypt.aesCbcEncrypt(value)\n\t}\n\treturn \"\", errors.New(\"cipher not set or not supported\")\n}", "title": "" }, { "docid": "7ea5b4631baaac810c1bf670eeb9169a", "score": "0.6005755", "text": "func (s *standard) Encrypt(payload []byte) (string, error) {\n\treturn s.encryption.Encrypt(payload)\n}", "title": "" }, { "docid": "d7b9a0d2f7ec2c700e34e81fc67cbadb", "score": "0.6004146", "text": "func TestHashEncryption(t *testing.T) {\n\tassert := assert.New(t)\n\n\tmessage := \"{\\\"foo\\\":{\\\"bar\\\":\\\"foobar\\\"}}\"\n\n\tencrypted := EncryptString(\"enigma\", message, false)\n\tassert.Equal(\"GsvkCYZoYylL5a7/DKhysDjNbwn+BtBtHj2CvzC4Y4g=\", encrypted)\n}", "title": "" }, { "docid": "6a94ae36b323f554b2176f88c6842d60", "score": "0.60032797", "text": "func TestYayEncryptionBasic(t *testing.T) {\n\tmessage := \"yay!\"\n\t//encrypt\n\tencrypted := messaging.EncryptString(\"enigma\", message)\n\n\tif \"q/xJqqN6qbiZMXYmiQC1Fw==\" == encrypted {\n\t\tfmt.Println(\"Yay encryption basic: passed.\")\n\t} else {\n\t\tt.Error(\"Yay encryption basic: failed.\")\n\t}\n}", "title": "" }, { "docid": "ba9f2a435869892acbde508bbc809351", "score": "0.5999046", "text": "func TestEncryptAndDecrypt(t *testing.T) {\n\n\ttext := \"helloworld\"\n\n\tr, err := Encrypt(text)\n\n\tif err != nil {\n\t\tt.Error(\"Error while encrypting.\")\n\t}\n\n\tif r == nil {\n\t\tt.Error(\"Encrypted text is nil.\")\n\t}\n\n\to, err := Decrypt(*r)\n\n\tif err != nil {\n\t\tt.Error(\"Error while decrypting.\")\n\t}\n\n\tvalue := *o\n\n\tif value != text {\n\t\tt.Error(\"Decrypted text is different from original text.\")\n\t}\n\n}", "title": "" }, { "docid": "7fb7cfc5e0c0949dd318896ecbeb8dc3", "score": "0.59951633", "text": "func Encrypt(data []byte) (string, error) {\n\tif Config.secretString != \"\" {\n\t\treturn encrypt(CryptoAlgAES, data)\n\t}\n\treturn encrypt(CryptoAlgNone, data)\n}", "title": "" }, { "docid": "d37203f5cea8ccbc6e4250d214b240c8", "score": "0.5991595", "text": "func (a *RSA) Encrypt(plaintext []byte, key []byte) ([]byte, error) {\n\n\treturn nil, errors.New(\"unsupported\")\n}", "title": "" }, { "docid": "a97512acd0fd45cd967eb86b50ff5ecb", "score": "0.59872955", "text": "func (secretAgent *SecretAgent) Encrypt(decrypted string) (string, error) {\n\tif secretAgent.key == nil {\n\t\treturn \"\", errors.New(\"SecretAgent missing key\")\n\t}\n\tb, err := secconf.Encode(\n\t\t[]byte(decrypted),\n\t\tbytes.NewBuffer(secretAgent.key))\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"encode: %w\", err)\n\t}\n\n\treturn string(b), nil\n}", "title": "" }, { "docid": "ea491b79a9321b204d7e13e57a6e8341", "score": "0.59761924", "text": "func TestEncryptWithAes(t *testing.T) {\n\tpasswordCryptoService := PasswordCryptoService{}\n\tencryptedPassword, err := passwordCryptoService.EncryptWithAes(\"TestPassword\", []byte(validEncryptionKey))\n\tassert.Nil(t, err, \"Should not return any errors\")\n\tassert.NotNil(t, encryptedPassword, \"Should return an encrypted value\")\n}", "title": "" }, { "docid": "fa4912c44b73ddcae58bc855829f7bb3", "score": "0.5958554", "text": "func Encrypt(plaintext string)(cryptedtext string){\n\tcryptedtext = fmt.Sprintf(\"%x\", sha1.Sum([]byte(plaintext)))\n\treturn\n}", "title": "" }, { "docid": "fe8fc67d3e62fc1b3993e76cdf45dc0d", "score": "0.5952738", "text": "func TestAesEcbEncrypt(t *testing.T) {\n\tplainText := []byte(`abcdefghijklmnopqrstuvwxyz`)\n\tt.Log(plainText)\n\tsecretKey := []byte(`0123456789012345`)\n\tcipherText, _ := AesEcbEncrypt(plainText, secretKey)\n\tt.Log(cipherText)\n\tt.Log(string(cipherText))\n}", "title": "" }, { "docid": "75b120cf39bd56a7b21f244f9af8a2e2", "score": "0.5949415", "text": "func (mr *MockCryptoClientMockRecorder) EncryptFinal(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"EncryptFinal\", reflect.TypeOf((*MockCryptoClient)(nil).EncryptFinal), varargs...)\n}", "title": "" }, { "docid": "5f0fd538dcf19d0fdcc1da5ea8e8bb5b", "score": "0.59473", "text": "func TestYayEncryption(t *testing.T) {\n\tmessage := \"yay!\"\n\t//serialize\n\tb, err := json.Marshal(message)\n\tif err != nil {\n\t\tfmt.Println(\"error:\", err)\n\t\tt.Error(\"My object encryption: failed.\")\n\t} else {\n\t\t//encrypt\n\t\tencrypted := messaging.EncryptString(\"enigma\", string(b))\n\t\tif \"Wi24KS4pcTzvyuGOHubiXg==\" == encrypted {\n\t\t\tfmt.Println(\"Yay encryption: passed.\")\n\t\t} else {\n\t\t\tt.Error(\"Yay encryption: failed.\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d432689b7b3199f6e85608253a16a9d1", "score": "0.59459114", "text": "func (mw LoggingMiddleware) Encrypt(ctx context.Context, key string, text string) (output string, err error) {\n\tdefer func(begin time.Time) {\n\t\t_ = mw.Logger.Log(\n\t\t\t\"method\", \"encrypt\",\n\t\t\t\"key\", key,\n\t\t\t\"text\", text,\n\t\t\t\"output\", output,\n\t\t\t\"err\", err,\n\t\t\t\"took\", time.Since(begin),\n\t\t)\n\t}(time.Now())\n\n\toutput, err = mw.Next.Encrypt(ctx, key, text)\n\treturn\n}", "title": "" }, { "docid": "3d5b97258f9dc49b2b425b0fcc2982a4", "score": "0.59412843", "text": "func Encrypt(key []byte, payload, footer interface{}) (string, error) {\n\treturn NewV2().Encrypt(key, payload, footer)\n}", "title": "" }, { "docid": "4be5e84964373f1bec0cd4a00b107170", "score": "0.594047", "text": "func TestInvalidKeyEncryption(t *testing.T) {\n\tt.Parallel()\n\n\tvar b bytes.Buffer\n\terr := encryptPayloadToWriter(b, &b, &mockKeyRing{true})\n\tif err == nil {\n\t\tt.Fatalf(\"expected error due to fail key gen\")\n\t}\n}", "title": "" }, { "docid": "1f6cec63495d7bf779bb3c2ce862c4a7", "score": "0.59375525", "text": "func Encrypt(plaintext string) (cryptext string) {\n\tcryptext = fmt.Sprintf(\"%x\", sha1.Sum([]byte(plaintext)))\n\treturn\n}", "title": "" }, { "docid": "1a2ebc3c04f8655c0b8e84fc0ea52557", "score": "0.5936057", "text": "func (e *AESEncrypter) Encrypt(_ context.Context, plaintext []byte, key []byte) ([]byte, error) {\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tgcm, err := cipher.NewGCM(block)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tnonce := make([]byte, gcm.NonceSize())\n\tif _, err := io.ReadFull(rand.Reader, nonce); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn gcm.Seal(nonce, nonce, plaintext, nil), nil\n}", "title": "" }, { "docid": "fa07a460423ff9ca9a5ec2ef36100862", "score": "0.5926324", "text": "func (s *Supervisor) encrypt(kex *auth.Kex, token *auth.Token, mr *msg.Result) error {\n\tvar plain, data []byte\n\tvar err error\n\n\t// serialize token\n\tif plain, err = json.Marshal(token); err != nil {\n\t\treturn err\n\t}\n\n\t// encrypt serialized token\n\tif err = kex.EncryptAndEncode(&plain, &data); err != nil {\n\t\treturn err\n\t}\n\n\t// update result for dispatching encrypted result data\n\tmr.Super.Verdict = 200\n\tmr.Super.Encrypted.Data = data\n\tmr.OK()\n\tmr.Super.Audit = mr.Super.Audit.WithField(`Verdict`, mr.Super.Verdict).\n\t\tWithField(`Code`, mr.Code)\n\treturn nil\n}", "title": "" }, { "docid": "69cb95e3e0167691c95b18564eb4485b", "score": "0.59158564", "text": "func TestAESGCMEncryptorEncrypt(t *testing.T) {\n\te, err := NewAESGCM([]byte(\"anAesTestKey1234\"))\n\tif err != nil {\n\t\tt.Fatalf(\"Encrypt. NewAESGCM() = %s\", err)\n\t}\n\n\tencrypted, err := e.Encrypt([]byte(\"i am a secret\"))\n\tif err != nil {\n\t\tt.Fatalf(\"Encrypt. Encrypt() = %s\", err)\n\t}\n\n\tif encrypted.Type != AESGCM {\n\t\tt.Fatalf(\"Type. Encrypt() got = %v, want %v\", encrypted.Type, AESGCM)\n\t}\n}", "title": "" }, { "docid": "d7ff1201f94f90146d9f13849eccc4c8", "score": "0.5910295", "text": "func (c Crypt) Encrypt(req Request) (result string, err error) {\n\n\tif len(c.Key)+len(req.Pin) != 32 {\n\t\treturn \"\", fmt.Errorf(\"key+pin should be 32 bytes\")\n\t}\n\tkey := []byte(fmt.Sprintf(\"%s%s\", c.Key, req.Pin))\n\n\tvar block cipher.Block\n\n\tif block, err = aes.NewCipher(key); err != nil {\n\t\treturn \"\", err\n\t}\n\n\tciphertext := make([]byte, aes.BlockSize+len(req.Data))\n\n\t// iv = initialization vector\n\tiv := ciphertext[:aes.BlockSize]\n\tif _, err = io.ReadFull(rand.Reader, iv); err != nil {\n\t\treturn \"\", err\n\t}\n\n\tcfb := cipher.NewCFBEncrypter(block, iv)\n\tcfb.XORKeyStream(ciphertext[aes.BlockSize:], []byte(req.Data))\n\n\thexRes := make([]byte, hex.EncodedLen(len(ciphertext)))\n\thex.Encode(hexRes, ciphertext)\n\treturn string(hexRes), nil\n}", "title": "" }, { "docid": "cb561f1c9f9f81a012679a614c19716b", "score": "0.59090054", "text": "func encrypt_none(securityPolicy []UA_SecurityPolicy, channelContext interface{}, data []UA_ByteString) UA_StatusCode {\n\treturn 0\n}", "title": "" }, { "docid": "2251dc8f88ecd1534de8c5cf20384ab8", "score": "0.59074706", "text": "func testEncryptDecrypt(t *testing.T, newHarness HarnessMaker) {\n\tctx := context.Background()\n\tharness, err := newHarness(ctx, t)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer harness.Close()\n\n\tdrv, _, err := harness.MakeDriver(ctx)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tkeeper := secrets.NewKeeper(drv)\n\tdefer keeper.Close()\n\n\tmsg := []byte(\"I'm a secret message!\")\n\tencryptedMsg, err := keeper.Encrypt(ctx, msg)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif cmp.Equal(msg, encryptedMsg) {\n\t\tt.Errorf(\"Got encrypted message %v, want it to differ from original message %v\", string(msg), string(encryptedMsg))\n\t}\n\tdecryptedMsg, err := keeper.Decrypt(ctx, encryptedMsg)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif !cmp.Equal(msg, decryptedMsg) {\n\t\tt.Errorf(\"Got decrypted message %v, want it to match original message %v\", string(msg), string(decryptedMsg))\n\t}\n\n}", "title": "" }, { "docid": "d688beaac7fb466986f5fcf0505f10b2", "score": "0.5903133", "text": "func (v VaultTransit) Encrypt(key SecretKey, plaintext string) (string, error) {\n\tvaultSecret, err := v.client.Write(v.encryptPath(key), map[string]interface{}{\n\t\t\"plaintext\": plaintext,\n\t})\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif vaultSecret.Data == nil {\n\t\treturn \"\", fmt.Errorf(\"secret data is impty\")\n\t}\n\tcipher, ok := vaultSecret.Data[\"ciphertext\"].(string)\n\tif !ok {\n\t\treturn \"\", fmt.Errorf(\"ciphertext is not set\")\n\t}\n\n\treturn cipher, nil\n}", "title": "" }, { "docid": "30a414ce4e222bf59b5f1f8083fa32ae", "score": "0.5897626", "text": "func (d uploadDisableTwoFAFileDelegate) ShouldEncrypt() bool {\n\treturn true\n}", "title": "" }, { "docid": "b3f8a40d49fce9b56ab2ec363d53e472", "score": "0.5896892", "text": "func (csp *impl) Encrypt(k bccsp.Key, plaintext []byte, opts bccsp.EncrypterOpts) (ciphertext []byte, err error) {\n\treturn nil, errors.Errorf(\"Unsupported 'EncryptKey' provided [%v]\", k)\n}", "title": "" }, { "docid": "18e959ba7d33ab8b95d888791d857929", "score": "0.5893143", "text": "func TestEncryptDecrypt(t *testing.T) {\n\tkey := []byte(\"X5B1s#ryFvr1rysXv@%6!@#Axq&sr19Z\") // 32 chars = 8 x 32 = 256 bit key\n\ttext := []byte(\"If to do were as easy as to know what were good to do, chapels had been churches, and poor men's cottage princes palaces.\")\n\n\tencrypted, err := Encrypt(key, text)\n\n\tif err != nil {\n\t\tt.Error(\"Error while encrypting text\")\n\t}\n\n\tif len(encrypted) == 0 {\n\t\tt.Error(\"Encrypted text is empty\")\n\t}\n\n\tdecrypted, err := Decrypt(key, encrypted)\n\n\tif err != nil {\n\t\tt.Error(\"Error while decrypting text\")\n\t}\n\n\tif len(decrypted) == 0 {\n\t\tt.Error(\"Decrypted text is empty\")\n\t}\n\n\tif strings.Compare(string(decrypted), string(text)) != 0 {\n\t\tt.Error(\"Decrypted text is not equal to original text\")\n\t}\n}", "title": "" }, { "docid": "58d7d936a64cdac55c7ff89fedd1c2e2", "score": "0.5889199", "text": "func TestHashEncryption(t *testing.T) {\n\tmessage := \"{\\\"foo\\\":{\\\"bar\\\":\\\"foobar\\\"}}\"\n\t//encrypt\n\tencrypted := messaging.EncryptString(\"enigma\", message)\n\tif \"GsvkCYZoYylL5a7/DKhysDjNbwn+BtBtHj2CvzC4Y4g=\" == encrypted {\n\t\tfmt.Println(\"Hash encryption: passed.\")\n\t} else {\n\t\tt.Error(\"Hash encryption: failed.\")\n\t}\n}", "title": "" }, { "docid": "d6d3fb6c504e9bbe6accbbef1f92d6b2", "score": "0.5888088", "text": "func TestAesCbcEncrypt(t *testing.T) {\n\tplainText := []byte(`abcdefghijklmnopqrstuvwxyz`)\n\tsecretKey := []byte(`0123456789012345`)\n\tiv := []byte(`1234567812345678`)\n\tcipherText, _ := AesCbcEncrypt(plainText, secretKey, iv)\n\tt.Log(cipherText)\n\tplainText = []byte(``)\n\tsecretKey = []byte(`0123456789012345`)\n\tcipherText, _ = AesCbcEncrypt(plainText, secretKey, iv)\n\tt.Log(cipherText)\n\tt.Log(string(cipherText))\n}", "title": "" }, { "docid": "4963fc770a6ee577389433cf85c5390f", "score": "0.58761686", "text": "func TestComplexClassEncryption(t *testing.T) {\n\tcustomComplexMessage := InitComplexMessage()\n\t//serialize\n\tb1, err := json.Marshal(customComplexMessage)\n\tif err != nil {\n\t\tfmt.Println(\"error:\", err)\n\t\tt.Error(\"Custom complex encryption: failed.\")\n\t} else {\n\t\t//encrypt\n\t\tencrypted := messaging.EncryptString(\"enigma\", string(b1))\n\t\tfmt.Println(\"enc:\", encrypted)\n\t\tif \"Bc846Ri5HK1ixqP/dzAyZq23Z/NBlcPn2UX8h38xTGINs72yF5gtU0t9fFEMxjY+DmezWt0nG7eN7RABrj697tK1nooVHYIxgDLMsjMTw5N0K+rUM823n7LcHfEoXaX8oH2E6zkg6iK5pmT8nlh6LF6Bw1G5zkluT8oTjnbFJcpEvTyT2ZKzcqptgYsE9XZiEn84zv0wjDMxSJzlM7cbe2JpLtR99mdkUf8SMVr+J0ym6Z9c02MKLP6bygWzdG9zTdkLSIxJE3R9Yt76XeRFdrbRNWkuQM/uItDsE23+8RKwZRyAScoDMwFAg+BSa6KF1tS6cJlyjxA8o5e9iWykKuHO0h1uAiapzTx9iZluOH2bVZgTUu1GABjXveMBAkrZ1eG4nVOlytsAr1oSekKvWxzyUEP2kFSrtQbg6oGECb1OMmj5bd21cx0vpDWr/juGT7/n4sBr7gYsWDvBaU7awN9Y7bcq14jtiXq/2iNNW0zoI3xe6+qByimHaiAgVoqO\" == encrypted {\n\t\t\tfmt.Println(\"Custom complex encryption: passed.\")\n\t\t} else {\n\t\t\tt.Error(\"Custom complex encryption: failed.\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3e78dd6845b820d94443efa1103f7876", "score": "0.587508", "text": "func TestMultiplexingEncrypted(t *testing.T) {\n\tSendMultiplexingRequest(t, \"testEncryptedMultiplexing\", false, true)\n}", "title": "" }, { "docid": "7078961cabc833b84a40628de7e60aa6", "score": "0.5871083", "text": "func Encrypt(data []byte, key []byte, tweak []byte) {\n\tif len(data) != 64 {\n\t\tpanic(\"Encrypt requires that data is exactly 64 bytes\")\n\t}\n\tif len(key) != 72 {\n\t\tpanic(\"Encrypt requires that key is exactly 72 bytes\")\n\t}\n\tif len(tweak) != 24 {\n\t\tpanic(\"Encrypt requires that tweak is exactly 24 bytes\")\n\t}\n\tencrypt512(convert.Inplace64BytesToUInt64(data), convert.Inplace72BytesToUInt64(key), convert.Inplace24BytesToUInt64(tweak))\n}", "title": "" }, { "docid": "8276c7ed93654fbe988aad97e6e1f63e", "score": "0.5847273", "text": "func (cfg *CertConfig) Encrypt(password string) error {\n\tcfg.CertPem = encrypt(cfg.CertPem, password)\n\tcfg.KeyPem = encrypt(cfg.KeyPem, password)\n\treturn nil\n}", "title": "" }, { "docid": "8f8622f3156280da0128f9ae0c57dff8", "score": "0.58469814", "text": "func (v *vermanCipher) Encrypt(text string) string {\n\tv.key = generateShiftKey(len(text))\n\tencryptedText := vermanShift(v.key, text, false)\n\tv.encryptedText = &encryptedText\n\treturn encryptedText\n}", "title": "" }, { "docid": "442b62d9616eb3f811b8a8251e6b3dc1", "score": "0.5843568", "text": "func Encrypt(data []byte, key []byte, tweak []byte) {\n\tif len(data) != 32 {\n\t\tpanic(\"Encrypt requires that data is exactly 32 bytes\")\n\t}\n\tif len(key) != 40 {\n\t\tpanic(\"Encrypt requires that key is exactly 40 bytes\")\n\t}\n\tif len(tweak) != 24 {\n\t\tpanic(\"Encrypt requires that tweak is exactly 24 bytes\")\n\t}\n\tencrypt256(convert.Inplace32BytesToUInt64(data), convert.Inplace40BytesToUInt64(key), convert.Inplace24BytesToUInt64(tweak))\n}", "title": "" }, { "docid": "6db034f201599c9ab4fbd47bc84b7d0f", "score": "0.5840978", "text": "func TestEncryptWithAesWithCipherBlockCreationError(t *testing.T) {\n\tgenerateNewCipherBlock = func(key []byte) (cipher.Block, error) { return nil, errors.New(mockedErrorMessage) }\n\tdefer func() { generateNewCipherBlock = aes.NewCipher }()\n\n\tpasswordCryptoService := PasswordCryptoService{}\n\tencryptedPassword, err := passwordCryptoService.EncryptWithAes(\"test\", []byte(validEncryptionKey))\n\tassert.Equal(t, err, errors.New(mockedErrorMessage), \"Should return root error\")\n\tassert.Nil(t, encryptedPassword, \"Should not return any encrypted value\")\n}", "title": "" }, { "docid": "6b5cb3ffb6a0575bf03a521f89c97e0a", "score": "0.5840547", "text": "func (e encryptedDatum) Encrypt(value string) (string, error) {\n\treturn \"\", nil\n}", "title": "" }, { "docid": "4aa173a146ab1851e4b69cd3ed1aca43", "score": "0.5840093", "text": "func (h *Handler) Encrypt() (string, error) {\n\n\t// Only support the `String` and `SecureString`\n\tvar (\n\t\toverwrite = true\n\t\terr error\n\t)\n\n\t// Initial PutParameterInput\n\tswitch {\n\tcase len(h.KMSKeyID) != 0:\n\t\t// Encrypted Parameter keys\n\t\th.setParameterType(\"SecureString\")\n\t\t_, err = h.Service.PutParameter(&ssm.PutParameterInput{\n\t\t\tName: &(h.ParameterKeyName),\n\t\t\tKeyId: &(h.KMSKeyID),\n\t\t\tType: &(h.ParameterType),\n\t\t\tValue: &(h.ParameterValue),\n\t\t\tOverwrite: &overwrite,\n\t\t})\n\tdefault:\n\t\t// Unencrypted Parameter keys\n\t\th.setParameterType(\"String\")\n\t\t_, err = h.Service.PutParameter(&ssm.PutParameterInput{\n\t\t\tName: &(h.ParameterKeyName),\n\t\t\tType: &(h.ParameterType),\n\t\t\tValue: &(h.ParameterValue),\n\t\t\tOverwrite: &overwrite,\n\t\t})\n\t}\n\n\tif err != nil {\n\t\tlog.Printf(\"Error Encrypt the SSM value: %v\", err)\n\t\treturn \"\", err\n\t}\n\treturn h.ParameterKeyName, nil\n}", "title": "" }, { "docid": "67417baef1cb29f21e2fce8c2fdda2d4", "score": "0.58317465", "text": "func TestMyObjectEncryption(t *testing.T) {\n\tassert := assert.New(t)\n\n\tmessage := customStruct{\n\t\tFoo: \"hi!\",\n\t\tBar: []int{1, 2, 3, 4, 5},\n\t}\n\n\tb1, err := json.Marshal(message)\n\tassert.NoError(err)\n\n\tencrypted := EncryptString(\"enigma\", string(b1), false)\n\tassert.Equal(\"BMhiHh363wsb7kNk7krTtDcey/O6ZcoKDTvVc4yDhZY=\", encrypted)\n}", "title": "" }, { "docid": "53a706210a1134c3ce98f2f656629077", "score": "0.5819693", "text": "func (constr Construction) Encrypt(dst, src []byte) {\n\tconstr.crypt(dst, src)\n}", "title": "" }, { "docid": "1ab52066f5d07c9d4ef37738a5b06ed8", "score": "0.58168614", "text": "func Encrypt(plainText string) (string, error) {\n\tsvc := kms.New(session.New())\n\tinput := &kms.EncryptInput{\n\t\tKeyId: aws.String(config.KmsKeyAlias),\n\t\tPlaintext: []byte(plainText),\n\t}\n\n\tresult, err := svc.Encrypt(input)\n\tif err != nil {\n\t\tif aerr, ok := err.(awserr.Error); ok {\n\t\t\tswitch aerr.Code() {\n\t\t\tcase kms.ErrCodeNotFoundException:\n\t\t\t\tfmt.Println(kms.ErrCodeNotFoundException, aerr.Error())\n\t\t\tcase kms.ErrCodeDisabledException:\n\t\t\t\tfmt.Println(kms.ErrCodeDisabledException, aerr.Error())\n\t\t\tcase kms.ErrCodeKeyUnavailableException:\n\t\t\t\tfmt.Println(kms.ErrCodeKeyUnavailableException, aerr.Error())\n\t\t\tcase kms.ErrCodeDependencyTimeoutException:\n\t\t\t\tfmt.Println(kms.ErrCodeDependencyTimeoutException, aerr.Error())\n\t\t\tcase kms.ErrCodeInvalidKeyUsageException:\n\t\t\t\tfmt.Println(kms.ErrCodeInvalidKeyUsageException, aerr.Error())\n\t\t\tcase kms.ErrCodeInvalidGrantTokenException:\n\t\t\t\tfmt.Println(kms.ErrCodeInvalidGrantTokenException, aerr.Error())\n\t\t\tcase kms.ErrCodeInternalException:\n\t\t\t\tfmt.Println(kms.ErrCodeInternalException, aerr.Error())\n\t\t\tcase kms.ErrCodeInvalidStateException:\n\t\t\t\tfmt.Println(kms.ErrCodeInvalidStateException, 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 \"\", err\n\t}\n\treturn string(result.CiphertextBlob), nil\n}", "title": "" }, { "docid": "854289b86b3b5b66b026134efe4318bf", "score": "0.58093244", "text": "func Encrypt(plaintext []byte, gcm cipher.AEAD, nonceSize int) (ciphertext []byte) {\n\tnonce := RandBytes(nonceSize)\n\tc := gcm.Seal(nil, nonce, plaintext, nil)\n\treturn append(nonce, c...)\n}", "title": "" }, { "docid": "26a0ba069724c89257fad7bc8c5280b8", "score": "0.5805434", "text": "func Encrypt(plaintext string) (cryptoText string) {\n\thashPassword, _ := bcrypt.GenerateFromPassword([]byte(plaintext), bcrypt.DefaultCost)\n\tcryptoText = string(hashPassword)\n\treturn\n}", "title": "" }, { "docid": "5b3ad078c7c5a699f9a22ceff334814f", "score": "0.5802063", "text": "func (pv3 *ProtoV3Local) Encrypt(key *SymKey, claims Claims, ops ...ProvidedOption) (string, error) {\n\n\tif !key.isValidFor(Version3, purposeLocal) {\n\t\treturn \"\", ErrWrongKey\n\t}\n\n\topts := &optional{}\n\tfor i := range ops {\n\t\terr := ops[i](opts)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\n\tpayload, optionalFooter, err := encode(claims, opts.footer)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn pv3.encrypt(key.keyMaterial, payload, optionalFooter, opts.assertion)\n}", "title": "" }, { "docid": "2a6c052bee9b3cd5abb2b3f258f95982", "score": "0.5793922", "text": "func encrypt(password string) (encrypted string) {\n\tswitch config.PrestConf.AuthEncrypt {\n\tcase \"MD5\":\n\t\treturn fmt.Sprintf(\"%x\", md5.Sum([]byte(password)))\n\tcase \"SHA1\":\n\t\treturn fmt.Sprintf(\"%x\", sha1.Sum([]byte(password)))\n\t}\n\treturn\n}", "title": "" }, { "docid": "ddea45730f59431db35a72e9e97ace2a", "score": "0.57901484", "text": "func (oracle *CtrOracle) Encrypt(plaintext []byte) []byte {\n\treturn oracle.cipher.Encrypt(random.Prefix(plaintext))\n}", "title": "" }, { "docid": "9e20e11de00ceffe4205549a362dcbf9", "score": "0.57895315", "text": "func (a *APIKeysProvider) Encrypt(ctx context.Context, secret []byte) ([]byte, error) {\n\treturn bcrypt.GenerateFromPassword(secret, bcrypt.DefaultCost)\n}", "title": "" }, { "docid": "b63d1b2a87ea9887bf5f67eb51f80916", "score": "0.57857794", "text": "func TestMyObjectEncryption(t *testing.T) {\n\tmessage := CustomStruct{\n\t\tFoo: \"hi!\",\n\t\tBar: []int{1, 2, 3, 4, 5},\n\t}\n\t//serialize\n\tb1, err := json.Marshal(message)\n\tif err != nil {\n\t\tfmt.Println(\"error:\", err)\n\t\tt.Error(\"My object encryption: failed.\")\n\t} else {\n\t\t//encrypt\n\t\tencrypted := messaging.EncryptString(\"enigma\", string(b1))\n\t\tif \"BMhiHh363wsb7kNk7krTtDcey/O6ZcoKDTvVc4yDhZY=\" == encrypted {\n\t\t\tfmt.Println(\"My object encryption: passed.\")\n\t\t} else {\n\t\t\tt.Error(\"My object encryption: failed.\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "73b589db9342edcc2dbdf3276a0a7d19", "score": "0.57653064", "text": "func Encrypt(raw, key string, rfc ...string) (val string, err error) {\n\tif len(key) != keyLength {\n\t\terr = fmt.Errorf(\"provided key does not satisfy the key length of 64 chars\")\n\t\treturn\n\t}\n\n\tb, err := encrypt(raw, key)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tval = out(b, rfc)\n\n\treturn\n}", "title": "" }, { "docid": "9855ab3a2951368952f1d16d2af8bdac", "score": "0.5761443", "text": "func (elg *Elgamal) Encrypt(x, i int) (y, ke int) {\n\tke = pkg.Snm(elg.alpha, i, elg.p)\n\tkm := pkg.Snm(elg.beta, i, elg.p)\n\ty = (x * km) % elg.p\n\treturn\n}", "title": "" }, { "docid": "44a6ede2a695865ebc91e4531c2fc77a", "score": "0.57557344", "text": "func TestEncryptDecryptBlock(t *testing.T) {\n\tm := []byte(\"Hello, world.\")\n\n\te, err := Encrypt(testSymKey, testMacKey, m)\n\tif err != nil {\n\t\tFailWithError(t, err)\n\t}\n\n\tdecrypted, err := Decrypt(testSymKey, testMacKey, e)\n\tif err != nil {\n\t\tFailWithError(t, err)\n\t}\n\n\tif !bytes.Equal(decrypted, m) {\n\t\terr = fmt.Errorf(\"plaintext doesn't match original message\")\n\t\tFailWithError(t, err)\n\t}\n}", "title": "" }, { "docid": "a95490fb27e2f0a7afe1b94525ad6247", "score": "0.5748837", "text": "func encrypt(aead tink.AEAD, msg proto.Message, context string) ([]byte, error) {\n\tblob, err := proto.Marshal(msg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn aead.Encrypt(blob, []byte(context))\n}", "title": "" }, { "docid": "ff38be43a0dfe0423d58097766862cce", "score": "0.57356644", "text": "func Encrypt(pk *rsa.PublicKey, plaintext []byte) ([]byte, error) {\n\treturn rsa.EncryptOAEP(sha256.New(), rand.Reader, pk, plaintext, []byte(\"\"))\n}", "title": "" }, { "docid": "3040222f31665c1da330fbbdd817f815", "score": "0.5733294", "text": "func (mr *MockCryptoClientMockRecorder) EncryptSingle(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"EncryptSingle\", reflect.TypeOf((*MockCryptoClient)(nil).EncryptSingle), varargs...)\n}", "title": "" }, { "docid": "cc9d2a5afc45a8c04655f8b62bf24eaf", "score": "0.5731923", "text": "func (s *CipherState) Encrypt(out, ad, plaintext []byte) []byte {\n\tout = s.c.Encrypt(out, s.n, ad, plaintext)\n\ts.n++\n\treturn out\n}", "title": "" }, { "docid": "41c40d9114480b2ce7e3bfa175334bd3", "score": "0.5723685", "text": "func (k *keeper) Encrypt(ctx context.Context, plaintext []byte) ([]byte, error) {\n\tb64Text := base64.StdEncoding.EncodeToString(plaintext)\n\tkeyOpsResult, err := k.client.Encrypt(ctx, k.getKeyVaultURI(), k.keyName, k.keyVersion, keyvault.KeyOperationsParameters{\n\t\tAlgorithm: keyvault.JSONWebKeyEncryptionAlgorithm(k.options.Algorithm),\n\t\tValue: &b64Text,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn []byte(*keyOpsResult.Result), nil\n}", "title": "" }, { "docid": "aebffdb7df1e9b8775b5fd33ed8532aa", "score": "0.571769", "text": "func (g *gRPCService) Encrypt(ctx context.Context, uid string, plaintext []byte) (*kmsservice.EncryptResponse, error) {\n\tctx, cancel := context.WithTimeout(ctx, g.callTimeout)\n\tdefer cancel()\n\n\trequest := &kmsapi.EncryptRequest{\n\t\tPlaintext: plaintext,\n\t\tUid: uid,\n\t}\n\tresponse, err := g.kmsClient.Encrypt(ctx, request)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &kmsservice.EncryptResponse{\n\t\tCiphertext: response.Ciphertext,\n\t\tKeyID: response.KeyId,\n\t\tAnnotations: response.Annotations,\n\t}, nil\n}", "title": "" }, { "docid": "81a90d533b434d12a4fcbc27f9165c9e", "score": "0.57166755", "text": "func TestEncryptDecrypt(t *testing.T) {\n\tfor _, orig := range originals {\n\t\t//fmt.Printf(\"Encrypt/decrypt test %v: %v byte original\\n\", testNum, len(orig))\n\n\t\t// Encrypt\n\t\tencrypted, err := encryptExample(orig)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"Encryption failed: %v\", err)\n\t\t\treturn\n\t\t}\n\n\t\t// Decrypt\n\t\tdecrypted, err := decryptExample(encrypted)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"Decryption failed: %v\", err)\n\t\t\treturn\n\t\t}\n\n\t\tif !bytes.Equal(orig, decrypted) {\n\t\t\tt.Error(\"Decrypted bytes do not match original\")\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "dc699532f9e970a15efdf9a50a3b7ee8", "score": "0.571065", "text": "func (x *RSAOAEPCipher) Encrypt(data []byte) ([]byte, error) {\n\n\tif x.Public == nil {\n\t\treturn nil, ErrNotEncrypter\n\t}\n\n\treturn rsa.EncryptOAEP(sha256.New(), rand.Reader, x.Public, data, []byte{})\n\n}", "title": "" }, { "docid": "965aefbdf2936d489bb51bff74cc3ace", "score": "0.57091606", "text": "func (v *Vault) encrypt(data []byte) (string, error) {\n\tif len(data) < 1 {\n\t\t// User has deleted all the secrets. the file will be empty.\n\t\treturn \"\", nil\n\t}\n\tkey := v.key\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tv.counter++\n\tnonce := make([]byte, 12)\n\tbinary.LittleEndian.PutUint64(nonce, v.counter)\n\taesgcm, err := cipher.NewGCM(block)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tciphertext := aesgcm.Seal(nil, nonce, data, nil)\n\thexNonce := hex.EncodeToString(nonce)\n\thexChiperText := hex.EncodeToString(ciphertext)\n\tcontent := fmt.Sprintf(\"%s||%s\", hexNonce, hexChiperText)\n\tfinalMsg := hex.EncodeToString([]byte(content))\n\treturn finalMsg, nil\n}", "title": "" }, { "docid": "ea8ba422c34f40aed577f44b6e8d33f9", "score": "0.5706497", "text": "func TestAesCBCEncrypt(t *testing.T) {\n\tkey := []byte(\"D7810B832347228614268C0DADDFE6C5\")\n\tplaintext := []byte(\"size=20&page=1&cityid=1\")\n\tiv := []byte(\"14268C0DADDFE6C5\")\n\n\tt.Logf(\"plaintext: %s, key: %s, iv: %s \\n\", string(plaintext), string(key), string(iv))\n\n\tciphertext, err := CBCEncrypt(plaintext, key, iv)\n\tif err != nil {\n\t\tt.Error(err)\n\t\treturn\n\t}\n\n\tbase64Data := base64.StdEncoding.EncodeToString(ciphertext)\n\tt.Logf(\"base64 encode encrypt: %s\", base64Data)\n}", "title": "" }, { "docid": "97bbcd386e2486f5139b2b5973addfc4", "score": "0.57008666", "text": "func Encrypt(key *[KeySize]byte, message []byte) ([]byte, error) {\n\t// randomly generated nonces will be used;\n\tnonce, err := GenerateNonce()\n\tif err != nil {\n\t\treturn nil, ErrEncrypt\n\t}\n\n\t// The recipient will need some way of recovering the nonce, so it will be prepended to the message.\n\n\tout := make([]byte, len(nonce))\n\tcopy(out, nonce[:])\n\tfmt.Println(\"copy out : \",out)\n\tout = secretbox.Seal(out, message, nonce, key)\n\treturn out, nil\n}", "title": "" }, { "docid": "ecec4d4ddc80a7355c895ecfe2c00598", "score": "0.5688568", "text": "func TestPubNubEncryption(t *testing.T) {\n\tassert := assert.New(t)\n\n\tmessage := \"Pubnub Messaging API 1\"\n\tb, err := json.Marshal(message)\n\tassert.NoError(err)\n\tencrypted := EncryptString(\"enigma\", string(b), false)\n\tassert.Equal(\"f42pIQcWZ9zbTbH8cyLwByD/GsviOE0vcREIEVPARR0=\", encrypted)\n}", "title": "" } ]
ce4d9568785605067db30f9ccb35f607
RemoveUserByID function removes an user if id matches otherwise return an empty object with an error message
[ { "docid": "1aeb44b717ff3d634e85a22f7e894982", "score": "0.75420797", "text": "func RemoveUserByID(id int) error {\n\tfor i, u := range users {\n\t\tif id == u.ID {\n\t\t\tusers = append(users[:i], users[i+1:]...)\n\t\t\treturn nil\n\t\t}\n\t}\n\n\treturn fmt.Errorf(\"User with id %v not found\", id)\n}", "title": "" } ]
[ { "docid": "641c6f8267b365115ddf42fc57bfff9a", "score": "0.7607103", "text": "func RemoveUserByID(id int) error {\n\tfor i, candidate := range users {\n\t\tif candidate.ID == id {\n\t\t\tusers = append(users[:i], users[i+1:]...)\n\t\t\treturn nil\n\t\t}\n\t}\n\n\treturn fmt.Errorf(\"User with ID '&v' could not be found\")\n}", "title": "" }, { "docid": "462e37e991e61016ec2ee8c74ae2f81b", "score": "0.7604284", "text": "func RemoveUserByID(id int) error {\n\tfmt.Println(\"models.RemoveUserById\")\n\tfor i, u := range users {\n\t\tif u.ID == id {\n\t\t\tusers = append(users[:i], users[i+1:]...)\n\t\t\treturn nil\n\t\t}\n\t}\n\n\treturn fmt.Errorf(\"User with ID '%v' not found\", id)\n}", "title": "" }, { "docid": "defb286736f5d4b0641c4aa63fe90dce", "score": "0.74879473", "text": "func RemoveUserById(id int) error {\n\tfor i, u := range users {\n\t\tif u.ID == id {\n\t\t\tusers = append(users[:i], users[i+1:]...)\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn fmt.Errorf(\"User with ID '%v' is not found\", id)\n}", "title": "" }, { "docid": "d1099f87f46c903a1e3a1efc122b26ba", "score": "0.7273327", "text": "func DeleteByID(w http.ResponseWriter, r *http.Request) {\n\tdb := db.Conn()\n\tdefer db.Close()\n\n\tvar user User\n\tvar msg util.Message\n\n\tmsg = util.Message{\n\t\tContent: \"Invalid ID, not a int\",\n\t\tStatus: \"ERROR\",\n\t\tBody: nil,\n\t}\n\n\tvars := mux.Vars(r)\n\tid, err := strconv.Atoi(vars[\"id\"])\n\tif err != nil {\n\t\tutil.RespondWithJSON(w, http.StatusOK, msg)\n\t\treturn\n\t}\n\n\tdb.Find(&user, id)\n\tif user.ID != 0 {\n\t\tdb.Delete(&user)\n\t\tmsg = util.Message{\n\t\t\tContent: \"Deleted user successfully\",\n\t\t\tStatus: \"OK\",\n\t\t\tBody: user,\n\t\t}\n\n\t\tutil.RespondWithJSON(w, http.StatusAccepted, msg)\n\t\treturn\n\t}\n\n\tmsg = util.Message{\n\t\tContent: \"Not exist this user\",\n\t\tStatus: \"ERROR\",\n\t\tBody: nil,\n\t}\n\tutil.RespondWithJSON(w, http.StatusOK, msg)\n\n}", "title": "" }, { "docid": "5cc60b8cc1f99330d7205d4098cd21cc", "score": "0.7179134", "text": "func DeleteUserByID(w http.ResponseWriter, r *http.Request) {\n\ttype Payload struct {\n\t\tID int `json:\"id\"`\n\t}\n\tvar payload Payload\n\terr := json.NewDecoder(r.Body).Decode(&payload)\n\tfmt.Println(payload)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), 500)\n\t\treturn\n\t}\n\tcontext := model.GetContext()\n\tc := context.DBCollection()\n\terr2 := c.Remove(bson.M{\"id\": payload.ID})\n\tif err2 != nil {\n\t\thttp.Error(w, err2.Error(), 500)\n\t\treturn\n\t}\n\n\tcode := struct {\n\t\tStatusCode int\n\t}{\n\t\t204,\n\t}\n\tpayload2, err4 := json.Marshal(code)\n\tif err4 != nil {\n\t\thttp.Error(w, err4.Error(), 500)\n\t\treturn\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\tw.Write(payload2)\n}", "title": "" }, { "docid": "78b02acabf53e17718d59106d1d24555", "score": "0.71226645", "text": "func (s *Service) DeleteUserById(id string) (*mongo.DeleteResult, error) {\n\tcollection := s.Mongoclient.Database(\"test\").Collection(\"consultants\")\n\n\tobjID, err := primitive.ObjectIDFromHex(id)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlog.Println(objID)\n\tres, err := collection.DeleteOne(context.Background(), bson.M{\"_id\": objID})\n\tif err != nil {\n\t\tlog.Println(\"error from getting an object \", err)\n\t\treturn nil, err\n\t}\n\n\treturn res, nil\n\n}", "title": "" }, { "docid": "8442f671136efc06051522fd4ecab6d2", "score": "0.7071894", "text": "func (s *server) remove(c *gin.Context) {\n\tid := c.Param(\"id\")\n\n\t// ensure that the user exists.\n\t_, err := s.getUser(id)\n\tif err != nil {\n\t\ts.withError(c, err)\n\t\treturn\n\t}\n\n\t// then update in the data-store.\n\tif err := s.store.Remove(id); err != nil {\n\t\ts.withError(c, err)\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, object.WithSuccess(\"OK\"))\n}", "title": "" }, { "docid": "57ecd3a2577796b772ce418719b1294c", "score": "0.7026569", "text": "func RemoveUserById(id string) error {\n\tss, e := Submissions(bson.M{USER: id}, bson.M{ID: 1})\n\tif e != nil {\n\t\treturn e\n\t}\n\tfor _, s := range ss {\n\t\tif e = RemoveSubmissionById(s.Id); e != nil {\n\t\t\treturn e\n\t\t}\n\t}\n\treturn RemoveById(USERS, id)\n}", "title": "" }, { "docid": "2776c9e544b9172aa98333502b6294e1", "score": "0.70205355", "text": "func (userController UserController) RemoveUser(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {\n\n\t// Grab id\n\tvars := mux.Vars(r)\n\tid := vars[\"id\"]\n\n\t// Verify id is ObjectId, otherwise bail\n\tif !bson.IsObjectIdHex(id) {\n\t\tw.WriteHeader(404)\n\t\treturn\n\t}\n\n\t// Grab id\n\toid := bson.ObjectIdHex(id)\n\n\t// Remove user\n\tif err := userController.session.DB(common.AppConfig.Database).C(\"users\").RemoveId(oid); err != nil {\n\t\tw.WriteHeader(404)\n\t\treturn\n\t}\n\n\t// Write status\n\tw.WriteHeader(200)\n}", "title": "" }, { "docid": "4d112f6720009bb1e4ab617fd89ce2d0", "score": "0.6997924", "text": "func (uc UserCollection) DeleteUserByID(id string) (string, error) {\n\t// Get Logger\n\tlogger := common.GetLoggerInstance()\n\t// Get DB Connection\n\tcollection, err := common.GetDBConnection()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"Error in getting DB instance\")\n\t}\n\n\tuserID, err := primitive.ObjectIDFromHex(id)\n\tif err != nil {\n\t\tlogger.Info().Msg(\"Invalid ObjectID\")\n\t\treturn \"\", fmt.Errorf(\"Invalid Object ID\")\n\t}\n\n\tfilter := bson.D{{\"_id\", userID}}\n\n\tresult, err1 := collection.DeleteMany(context.TODO(), filter)\n\tif err1 != nil {\n\t\tlogger.Info().Msg(err1.Error())\n\t\treturn \"\", fmt.Errorf(\"Failed to delete: %s\", err1)\n\t}\n\n\tlogger.Info().Msgf(\"DeleteMany removed %v document(s)\\n\", result.DeletedCount)\n\tif result.DeletedCount == 0 {\n\t\treturn \"\", fmt.Errorf(\"No user found\")\n\t}\n\treturn \"User Details Deleted successfully\", nil\n}", "title": "" }, { "docid": "6f03f9f3ae750daf2433f3de9ae6d109", "score": "0.6926053", "text": "func RemoveUser(w http.ResponseWriter, r *http.Request) {\n\t// get id\n\tvars := mux.Vars(r)\n\tnum, err := strconv.Atoi(vars[\"id\"])\n\t// err never must be != nil\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\tid := int32(num)\n\n\t// get connection to serviceusers\n\tconn, err := grpc.Dial(addrUsers, optUsers...)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\tdefer conn.Close()\n\n\t// create a client against serviceusers\n\tcusers := user.NewUsersClient(conn)\n\n\t// create the request for the rpc\n\treq := &user.RemoveRequest{\n\t\tId: id,\n\t}\n\n\t// rpc to remove a user\n\treply, err := cusers.Remove(context.Background(), req)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\tif reply.GetStatus() != user.Status_OK {\n\t\tw.WriteHeader(http.StatusConflict)\n\t\treturn\n\t}\n\n\t// marshal the response to json content\n\tresponse, err := json.Marshal(reply.GetUser())\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tlog.Println(err)\n\t\treturn\n\t}\n\n\t// send back a http response to the client\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.Write(response)\n}", "title": "" }, { "docid": "ef253e966ed85020fe09db6914f7f930", "score": "0.6895941", "text": "func (usrRep *UserRepositoryImpl) DeleteUser(id uint) (*models.User,[]error){\n user,err := usrRep.GetUser(id)\n if len(err)>0{\n return nil,err\n }\n err = usrRep.conn.Delete(user,id).GetErrors()\n if len(err)>0{\n return nil,err\n }\n return user,nil\n}", "title": "" }, { "docid": "3bcdc1be5c8c9b6ab29805ce1b92a21d", "score": "0.6875334", "text": "func (u *User) RemoveByID() error {\n\n\t// delete user from db by id\n\terr := utils.DB.C(\"users\").RemoveId(u.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// if all went well, return nil\n\treturn nil\n}", "title": "" }, { "docid": "46887ab93da73e23812bee60694a0c6f", "score": "0.6858916", "text": "func DeleteUser(res http.ResponseWriter, req *http.Request) {\n\tparams := mux.Vars(req)\n\n\treqID, _ := strconv.ParseInt(params[\"id\"], 10, 64)\n\n\tfor index, user := range users {\n\t\tif user.ID == reqID {\n\t\t\tusers = append(users[:index], users[index+1:]...)\n\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "2bd00a63edcc372ac7b44417591589c7", "score": "0.6855047", "text": "func DeleteUser(s *db.Dispatch) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\tss := s.MongoDB.Copy()\n\t\tdefer ss.Close()\n\n\t\tid := chi.URLParam(r, \"id\")\n\n\t\tif !bson.IsObjectIdHex(id) {\n\t\t\tmsg := []byte(`{\"message\":\"ObjectId invalid\"}`)\n\t\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\t\tw.WriteHeader(http.StatusNotFound)\n\t\t\tfmt.Fprintf(w, \"%s\", msg)\n\t\t\treturn\n\t\t}\n\n\t\tc := ss.DB(\"login\").C(\"users\")\n\n\t\tif err := c.Remove(bson.M{\"_id\": bson.ObjectIdHex(id)}); err != nil {\n\t\t\tswitch err {\n\t\t\tdefault:\n\t\t\t\tmsg := []byte(`{\"message\":\"ObjectId invalid\"}`)\n\t\t\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\t\t\tw.WriteHeader(http.StatusNotFound)\n\t\t\t\tfmt.Fprintf(w, \"%s\", msg)\n\n\t\t\tcase mgo.ErrNotFound:\n\t\t\t\tmsg := []byte(`{\"message\":\"ObjectId not found\"}`)\n\t\t\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\t\t\tw.WriteHeader(http.StatusNotFound)\n\t\t\t\tfmt.Fprintf(w, \"%s\", msg)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\tw.WriteHeader(http.StatusNoContent)\n\t}\n}", "title": "" }, { "docid": "798c43cc22b7589b4c0b6989b8abb0c9", "score": "0.68483686", "text": "func DeleteUserByID(wr http.ResponseWriter, req *http.Request, ps httprouter.Params) {\n\tresponse, _ := http.NewRequest(\"DELETE\", \"http://localhost:8000/users/\"+ps.ByName(\"id\"), nil)\n\n\tnew(http.Client).Do(response)\n\n\tGetAllUser(wr, req, ps)\n}", "title": "" }, { "docid": "d86b5624115920910c5d7e0f638151d5", "score": "0.6806934", "text": "func DeleteUserByID(w http.ResponseWriter, r *http.Request) {\n\tuserID := chi.URLParam(r, \"userID\")\n\terr := validateRequest(userID) //In common.go, this is where we will add all our validation routines\n\tif err != nil {\n\t\tlog.Print(\"Invalid User ID entered, stopping before database hit, error was: \", err, \" Requested ID was: \", userID)\n\t\tw.Write([]byte(\"Must enter a valid userID to perform a DELETE, hit error: \" + err.Error())) //Might redirect user to their own homepage? OR 404? Not sure.\n\t\treturn\n\t}\n\tresult, err := DB.Exec(`DELETE FROM users where id = $1`, userID)\n\tif err != nil {\n\t\tlog.Print(\"Error deleting user by ID\", userID)\n\t\treturn\n\t}\n\tlog.Print(\"Sql Result\", result)\n\tw.Write([]byte(\"Deleted User by ID\" + userID))\n}", "title": "" }, { "docid": "41502d32a73e11fbe2a94ddb4f44d831", "score": "0.6803532", "text": "func Delete(ctx context.Context, dbConn *db.DB, id string) error {\n\tctx, span := trace.StartSpan(ctx, \"internal.user.Update\")\n\tdefer span.End()\n\n\tif !bson.IsObjectIdHex(id) {\n\t\treturn ErrInvalidID\n\t}\n\n\tq := bson.M{\"_id\": bson.ObjectIdHex(id)}\n\n\tf := func(collection *mgo.Collection) error {\n\t\treturn collection.Remove(q)\n\t}\n\tif err := dbConn.Execute(ctx, usersCollection, f); err != nil {\n\t\tif err == mgo.ErrNotFound {\n\t\t\treturn ErrNotFound\n\t\t}\n\t\treturn errors.Wrap(err, fmt.Sprintf(\"db.users.remove(%s)\", db.Query(q)))\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1081468b98e73840c1cdaf1486ebae5b", "score": "0.6778797", "text": "func DeleteUserByID(id uint32) (deleted bool) {\n\treturn\n}", "title": "" }, { "docid": "e3c67b146b9137c5080d05a5ddc1c57c", "score": "0.6764013", "text": "func (u *UserHandler) deleteUserByID(ctx *gin.Context) {\n\tuserID, err := strconv.ParseUint(ctx.Param(\"id\"), 10, 64)\n\tif err != nil {\n\t\tError(ctx, err, http.StatusBadRequest, nil)\n\t\treturn\n\t}\n\ttokenData, err := extractTokenDataFromRequestContext(ctx)\n\tif err != nil {\n\t\tError(ctx, err, http.StatusInternalServerError, u.Logger)\n\t\treturn\n\t}\n\tif tokenData.Role != pub.AdministratorRole && tokenData.ID != userID {\n\t\tError(ctx, pub.ErrUnauthorized, http.StatusUnauthorized, nil)\n\t\treturn\n\t}\n\n\t_, err = u.UserService.User(userID)\n\n\tif err == pub.ErrObjNotFound {\n\t\tError(ctx, pub.ErrUserNotFound, http.StatusNotFound, nil)\n\t\treturn\n\t} else if err != nil {\n\t\tError(ctx, err, http.StatusInternalServerError, u.Logger)\n\t\treturn\n\t}\n\terr = u.UserService.DeleteUser(userID)\n\tif err != nil {\n\t\tError(ctx, err, http.StatusInternalServerError, u.Logger)\n\t\treturn\n\t}\n\tctx.IndentedJSON(http.StatusOK, &msgResponse{Msg: \"Delete user success\"})\n}", "title": "" }, { "docid": "4e6483646183c1a674deda4ce4335018", "score": "0.67419887", "text": "func deleteUserById(id string, logEntry *utils.REntry) (bool, error) {\n\t//Delete the blogUser\n\tdeleteFilter := bson.D{{\"id\", id}}\n\n\tblogCollection, ctx := utils.GetUserCollection()\n\t//Check to see if user exist\n\t_, err := getBlogUserByid(id, logEntry)\n\tif err != nil {\n\t\t// If get user fails that means the user is not in the system, delete will be treated as success.\n\t\t// TODO: If the failure is not able to connect to DB this behaviour needs to be changed.\n\t\tlogEntry.Errorf(\"Unable to get the user with id: %s. Error : %v\", id, err)\n\t\treturn true, nil\n\t}\n\n\tdeletedUser, err := blogCollection.DeleteOne(ctx, deleteFilter)\n\tif err != nil {\n\t\tlogEntry.Errorf(\"Delete failed %v\", err)\n\t}\n\n\tif deletedUser.DeletedCount != 1 {\n\t\tlogEntry.Errorf(\"Delete count is not 1 %d\", deletedUser.DeletedCount)\n\t\treturn false, err\n\t}\n\treturn true, nil\n}", "title": "" }, { "docid": "f2fba5181adaa6d55fbbd81d61416de5", "score": "0.6728065", "text": "func (uc UserController) RemoveUser(w http.ResponseWriter, r *http.Request, p httprouter.Params) {\n\t// Grab id\n\tid := p.ByName(\"id\")\n\n\t// Verify id is ObjectId, otherwise bail\n\tif !bson.IsObjectIdHex(id) {\n\t\tw.WriteHeader(404)\n\t\treturn\n\t}\n\n\t// Grab id\n\toid := bson.ObjectIdHex(id)\n\n\t//\n\tc := uc.session.DB(ReturnDbName()).C(UserCollections)\n\n\t// Remove user\n\tif err := c.RemoveId(oid); err != nil {\n\t\tw.WriteHeader(404)\n\t\treturn\n\t}\n\n\t// Write status\n\tw.WriteHeader(200)\n}", "title": "" }, { "docid": "fc086e77dc186c7cb1b98905fe1ca9e1", "score": "0.6719902", "text": "func (bc BeerController) RemoveBeer(w http.ResponseWriter, r *http.Request, p httprouter.Params) {\n // Grab id\n id := p.ByName(\"id\")\n\n // Verify id is ObjectId, otherwise bail\n if !bson.IsObjectIdHex(id) {\n w.WriteHeader(404)\n return\n }\n\n // Grab id\n oid := bson.ObjectIdHex(id)\n\n // Remove user\n if err := bc.session.DB(\"go_beer_me\").C(\"beer\").RemoveId(oid); err != nil {\n w.WriteHeader(404)\n return\n }\n\n // Write status\n w.WriteHeader(200)\n log.Println(\"Removed beer \" + oid)\n}", "title": "" }, { "docid": "e449b1623f0508edb5f99dd972a11c9b", "score": "0.66777617", "text": "func DeleteUserByID(uid string) (OutUser, error) {\n\tvar user OutUser\n\n\terr := sqlDB.QueryRow(`DELETE FROM users WHERE id=$1\n\tRETURNING id, roles, first_name, last_name, email, birth_date, createdate;`, uid).Scan(&user.ID, &user.Roles, &user.FirstName, &user.LastName, &user.Email, &user.BirthDate, &user.CreateDate)\n\n\tif err != nil {\n\t\tlog.Println(\"DeleteUserByID...\", err)\n\t\treturn user, err\n\t}\n\n\treturn user, nil\n}", "title": "" }, { "docid": "bc10a0f48d03a59d2c4d3e9bfaa9cba8", "score": "0.65884537", "text": "func (c RepSysCtrl) Delete(id uint32) revel.Result {\n u := models.User{}\n if err := Dbm.Debug().Where(\"user_id = ?\", id).Delete(&u).Error; err != nil {\n return c.RenderJson(err) \n }\n \n return c.RenderText(\"Deleted user %v\", id)\n}", "title": "" }, { "docid": "7d52004bafe2961353e6acf1d3f04b9a", "score": "0.6574576", "text": "func DeleteUser(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {\n\tvars := mux.Vars(r)\n\tuserIDStr := vars[\"userId\"]\n\tvar userID bson.ObjectId\n\n\tif isValid := bson.IsObjectIdHex(userIDStr); isValid == false {\n\t\trespondWithError(w, http.StatusBadRequest, \"invalid id\")\n\t} else {\n\t\tuserID = bson.ObjectIdHex(userIDStr)\n\t}\n\n\tif err := domain.DeleteUserByID(userID); err != nil {\n\t\trespondWithError(w, http.StatusBadRequest, err.Error())\n\t} else {\n\t\trespondWithJSON(w, http.StatusNoContent, nil)\n\t}\n}", "title": "" }, { "docid": "b1560e348758a6f0290cf8e9755ebdfd", "score": "0.6568481", "text": "func (app *App) deleteUser(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\tid, err := strconv.Atoi(vars[\"id\"])\n\tif err != nil {\n\t\tutil.RespondWithError(w, http.StatusBadRequest, \"Invalid User ID\")\n\t\treturn\n\t}\n\n\tu := model.User{ID: id}\n\tif err := u.DeleteUser(app.DB); err != nil {\n\t\tutil.RespondWithError(w, http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\n\tutil.RespondWithJSON(w, http.StatusOK, map[string]string{\"result\": \"success\"})\n}", "title": "" }, { "docid": "7727ac259344bc9361db7409e2374dd8", "score": "0.655306", "text": "func DeleteUser(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tvars := mux.Vars(r)\n\tid := vars[\"id\"]\n\n\tvar user User\n\tdb.Where(\"ID = ?\", id).Find(&user)\n\tdb.Delete(&user)\n\tfmt.Fprintf(w, `{\"notice\": \"User %s was deleted.\"}`, user.Email)\n}", "title": "" }, { "docid": "5e7ed82a6e41cfefd5f70edbe4bd525d", "score": "0.6548824", "text": "func (b Backend) DeleteUser(id string) (int, error) {\n\tcontent, err := b.datastore.Read()\n\tif err != nil {\n\t\treturn http.StatusInternalServerError, err\n\t}\n\tlog.Printf(\"The content found was %+v\", content)\n\n\tcontent.Lock()\n\t_, ok := content.Users[id]\n\tif !ok {\n\t\tcontent.Unlock()\n\t\treturn http.StatusNotFound, fmt.Errorf(\"User %s was not found\", id)\n\t} else {\n\t\tdelete(content.Users, id)\n\t\tcontent.Unlock()\n\t}\n\n\terr = b.datastore.Write(content)\n\tif err != nil {\n\t\treturn http.StatusInternalServerError, err\n\t}\n\treturn http.StatusOK, nil\n}", "title": "" }, { "docid": "436d20da0cbbc5427ca56adfa1e4835d", "score": "0.65309876", "text": "func (_ UserRepository) DeleteByID(id int) error {\n\tdb := db.GetDB()\n\tvar u User\n\n\tif err := db.Where(\"id = ?\", id).Delete(&u).Error; err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2fcaa092d80cc435c0973b88afa06430", "score": "0.65303844", "text": "func (uc UserController) RemoveLocations(w http.ResponseWriter, r *http.Request, p httprouter.Params) { \n // Grab id\n id := p.ByName(\"id\")\n\n // Verify id is ObjectId, otherwise bail\n if !bson.IsObjectIdHex(id) {\n w.WriteHeader(404)\n return\n }\n\n // Grab id\n oid := bson.ObjectIdHex(id)\n\n // Remove user\n if err := uc.session.DB(\"cmpe273\").C(\"assignment2\").RemoveId(oid); err != nil {\n w.WriteHeader(404)\n return\n }\n\n // Write status\n w.WriteHeader(200)\n\n}", "title": "" }, { "docid": "e51c0c3f929f41327ad7b0a657acd5f0", "score": "0.6518944", "text": "func (inst MySQLUserController) DeleteUser(id string, authToken *jwtuserdata.JWTUserData) (string, error) {\n\t// A user MUST be authorized to edit a user\n\tif authToken == nil {\n\t\treturn \"\", errors.New(\"invalid credentials\")\n\t}\n\n\t// We'll get the UserType from the auth token\n\teditorUserType := inst.GetUserType(authToken.UserType)\n\n\t// If the userType doesn't allow editing they can't delete a user.\n\tcanEditUser := inst.CanEditUser(editorUserType)\n\tif !canEditUser {\n\t\treturn \"\", errors.New(\"you do not have permission to perform that action\")\n\t}\n\n\t// superAdmin cannot delete itself\n\tsuperRank := ^uint16(0)\n\tif id == authToken.ID && editorUserType.Rank == superRank {\n\t\treturn \"\", errors.New(\"superAdmin cannot delete itself\")\n\t}\n\n\tdeletedUser := inst.GetUserByID(id)\n\n\tif (deletedUser == User{}) {\n\t\treturn \"\", errors.New(\"user does not exist\")\n\t}\n\n\tres, err := inst.Controller.Instance.Exec(\"DELETE FROM users WHERE id = ? LIMIT 1\", id)\n\n\tif err != nil {\n\t\treturnError := err\n\t\tfmt.Println(\"Error\", err)\n\n\t\tdriverErr, ok := err.(*mysql.MySQLError)\n\t\tif ok {\n\t\t\tcode := driverErr.Number\n\t\t\tif code == mysqlerr.ER_DUP_ENTRY {\n\t\t\t\treturnError = errors.New(\"duplicate entry. username or email already exists\")\n\t\t\t}\n\n\t\t\tfmt.Println(driverErr.Number, ok)\n\t\t}\n\n\t\treturn \"\", returnError\n\t}\n\n\trows, err := res.RowsAffected()\n\n\tif err != nil {\n\t\tfmt.Println(\"Rows Affected Error\", err)\n\t\treturn \"\", err\n\t}\n\n\t// We indicate that no rows were affected.\n\tif rows < 1 {\n\t\treturn \"\", errors.New(\"user id does not exist\")\n\t}\n\n\treturn id, nil\n}", "title": "" }, { "docid": "78a9065cebf15b55bdf14d38807ddb88", "score": "0.6501017", "text": "func DeleteUser(c *gin.Context, ctx *endpoints.Context) {\n\tid, err := strconv.Atoi(c.Param(\"id\"))\n\n\tif err != nil {\n\t\tc.String(http.StatusBadRequest, \"Invalid ID: must be numerical\")\n\t\treturn\n\t}\n\n\tvar user *User\n\tctx.DB.First(user, id)\n\n\tif user == nil {\n\t\tc.String(http.StatusNotFound, \"Not found\")\n\t\treturn\n\t}\n\n\tclaims := jwt.ExtractClaims(c)\n\tvar me User\n\tctx.DB.Where(\"username = ?\", claims[\"id\"]).First(&me)\n\n\tif user.ID != me.ID {\n\t\tc.String(http.StatusForbidden, \"Cannot alter foreign user\")\n\t\treturn\n\t}\n\n\tctx.DB.Delete(&user)\n\n\tc.String(http.StatusOK, \"\")\n}", "title": "" }, { "docid": "e6b93b08c5603aa079324b0bb5d436a1", "score": "0.64789504", "text": "func Removeuser(userdb userdatabase)error{\n\tcoll := conn.Database(DBName).Collection(usersCollection)\n\n\tfilter := bson.D{{\"number\", userdb.Number}}\n\n\tresult, err := coll.DeleteOne(ctx, filter)\n\tif err != nil {\n\t\tfmt.Printf(\"Could not delete the user. Id: %s\\n\", userdb.ID)\n return err\n\t}\n\tfmt.Printf(\"DeleteOne removed %v document(s)\\n\", result.DeletedCount)\n\treturn nil\n}", "title": "" }, { "docid": "00a92d2ed406f5ca640452c03c8380eb", "score": "0.64773744", "text": "func (h *Hub) RemoveUser(id int) (err error) {\n\tif id <= 0 {\n\t\treturn errors.New(\"must specify an ID above 0\")\n\t}\n\n\t_, ok := h.Users[id]\n\n\tif !ok {\n\t\treturn errors.New(\"user to remove does not exist\")\n\t}\n\n\tdelete(h.Users, id)\n\n\treturn nil\n}", "title": "" }, { "docid": "587bdf17c9c686ce2a523bedc642a43f", "score": "0.6471559", "text": "func (db *sqlRepository) DeleteUser(ID int) error {\n\tvar users usersModel.Users\n\n\t// cek id is exist\n\tvar count int\n\tisExist := db.Conn.Model(&usersModel.Users{}).Where(\"id = ?\", ID).Count(&count)\n\n\tif count == 0 {\n\t\t// return error string \"1\" for ID not exist\n\t\treturn errors.New(\"1\")\n\t}\n\n\tif isExist.Error != nil {\n\t\treturn errors.New(\"usersRepository.DeleteUser err = \" + isExist.Error.Error())\n\t}\n\n\t// delete users\n\tqueryDelete := db.Conn.Where(\"id = ?\", ID).Delete(&users)\n\n\tif queryDelete.Error != nil {\n\t\treturn errors.New(\"usersRepository.DeleteUser err = \" + queryDelete.Error.Error())\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b3f2ec0ec4059d928338d7baa9d2564d", "score": "0.6470934", "text": "func (uv *userValidator) Delete(id uint) error {\n\tvar user User\n\tuser.ID = id\n\tif err := runUserValFuncs(&user, uv.idGreaterThan(0)); err != nil {\n\t\treturn err\n\t}\n\treturn uv.UserDB.Delete(id)\n}", "title": "" }, { "docid": "92a0b5c8e66871df7fd509c0bda8358f", "score": "0.6466589", "text": "func DeleteUser(c *gin.Context) {\r\n\tvar user User\r\n\tid := c.Params.ByName(\"id\")\r\n\tdb.First(&user, id)\r\n\tif user.Id != 0 {\r\n\t\tdb.Delete(&user)\r\n\t\tc.JSON(http.StatusOK, gin.H{\r\n\t\t\t\"success\": \"User# \" + id + \" deleted!\",\r\n\t\t})\r\n\t} else {\r\n\t\tc.JSON(404, gin.H{\r\n\t\t\t\"error\": \"User not found\",\r\n\t\t})\r\n\t}\r\n}", "title": "" }, { "docid": "c0cbe30015cc06fe1ee6eda083a2f989", "score": "0.646336", "text": "func (r userRepository) DeleteById(id uint) error {\n\tif err := r.db.Delete(&models.User{}, id).Error; err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5bd8ef6bb29ac5a71eb191e1f4e9467b", "score": "0.6451925", "text": "func (ss *SecretSanta) RemoveUser(id string) error {\n\tuid, err := uuid.Parse(id)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to parse uuid\")\n\t}\n\tkey, err := uid.MarshalText()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to marshal uuid\")\n\t}\n\terr = ss.db.Update(func(tx *bolt.Tx) error {\n\t\tb := tx.Bucket([]byte(userBucket))\n\t\treturn b.Delete(key)\n\t})\n\treturn err\n}", "title": "" }, { "docid": "927f8bbfa31bf4e05df5341aec339cb0", "score": "0.6450608", "text": "func DeleteUser(w http.ResponseWriter, r *http.Request) {\n\tdb := database.DbConn\n\tID := r.FormValue(\"ID\")\n\n\tvar user models.User\n\terr := db.Where(\"id = ?\", ID).Find(&user)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdb.Delete(&user)\n}", "title": "" }, { "docid": "c7521b25df67e61c60d09e271fdace5b", "score": "0.64302593", "text": "func (db *MockDB) DeleteUser(id string) error {\n\tdb.Lock()\n\tdefer db.Unlock()\n\t//if the entry exists then delete it\n\tif _, ok := db.Users[id]; ok {\n\t\tdelete(db.Users, id)\n\t\tlog.Printf(\"[MOCK_DB] Deleted User: {\\\"id\\\":\\\"%s\\\"} from DB\", id)\n\t\treturn nil\n\t}\n\t//if user not found\n\treturn fmt.Errorf(\"User with id=%s not found in store\", id)\n}", "title": "" }, { "docid": "9fd134108ab88649d4c19f2c1f96827f", "score": "0.64246935", "text": "func (uv *userValidator) Delete(id uint) error {\n\tvar user User\n\tuser.ID = id\n\n\terr := runUserValFns(&user, uv.idGreaterThan(0))\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn uv.UserDB.Delete(id)\n}", "title": "" }, { "docid": "2de277c0b39bb7ca096b4f3347e1358e", "score": "0.6412094", "text": "func DeleteUser(dni int64) {\n // eliminamos el usuario del mapa\n delete(users, dni)\n}", "title": "" }, { "docid": "1e34ed215ddef7fd58b8f8ccf73989bc", "score": "0.6402244", "text": "func (u *User) DeleteByID(id string) error {\r\n\tvar err error\r\n\terr = u.utils.ValidateObjectID(id)\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\r\n\tsessionCopy := db.Database.MgDbSession.Copy()\r\n\tdefer sessionCopy.Close()\r\n\r\n\t// Get a collection to execute the query against.\r\n\tcollection := sessionCopy.DB(db.Database.Databasename).C(common.ColUsers)\r\n\r\n\terr = collection.Remove(bson.M{\"_id\": bson.ObjectIdHex(id)})\r\n\treturn err\r\n}", "title": "" }, { "docid": "431f6f513e7f9490b42e3b4ab11e05a0", "score": "0.6401452", "text": "func Delete(c *gin.Context) {\n\tvar json models.User\n\tvar err error\n\tif err = c.BindJSON(&json); err == nil {\n\t\tdb := c.MustGet(\"db\").(*mgo.Database)\n\t\tcol := bootstrap(db)\n\t\terr := col.RemoveId(json.ID)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"Can't delete user, go error %v\\n\", err)\n\t\t\tc.JSON(400, gin.H{\n\t\t\t\t\"result\": false,\n\t\t\t})\n\t\t} else {\n\t\t\tc.JSON(200, gin.H{\n\t\t\t\t\"result\": true,\n\t\t\t})\n\t\t}\n\t} else {\n\t\tfmt.Printf(err.Error())\n\t\tc.JSON(400, err.Error())\n\t}\n}", "title": "" }, { "docid": "289fdf32aa61f8426351df121fcf541e", "score": "0.6393598", "text": "func DeleteUser(w http.ResponseWriter, r *http.Request) {\n\tparams := mux.Vars(r)\n\tid := params[\"id\"]\n\tvar user models.User\n\tdb.First(&user, id)\n\tdb.Delete(&user)\n\tjson.NewEncoder(w).Encode(\"User deleted\")\n}", "title": "" }, { "docid": "d8f1d9550dca37a3d3e559b7dcd5c6bf", "score": "0.6383364", "text": "func (dao GORMUserDAO) DeleteUserByID(id uint) bool {\n\tuser := User{\n\t\tModel: gorm.Model{ID: id},\n\t}\n\tdao.DB.Delete(&user)\n\treturn true\n}", "title": "" }, { "docid": "edc9d3b6c259e048d4d1eef35cce0f5e", "score": "0.6380416", "text": "func (g *Game) RemoveUserFromGame(id int) error {\n\tfor key, usr := range g.Users {\n\t\tif usr.Id == id {\n\t\t\t// if the user is the game, remove\n\t\t\tfmt.Println(\"Removing User:\", usr.Username, \"from game:\", g.Id)\n\t\t\tg.Users = append(g.Users[:key], g.Users[key+1:]...)\n\t\t\t// Set the game to be deleted if the user count == 0\n\t\t\tif len(g.Users) == 0 {\n\t\t\t\tg.GameOver = true\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\t}\n\n\treturn errors.New(\"Error: Failure to delete, user not in game\")\n}", "title": "" }, { "docid": "45f339a10728a404f0d31a10e90ad3c7", "score": "0.6371208", "text": "func deleteUser(response http.ResponseWriter, request *http.Request) {\n\t// Setting the header\n\tresponse.Header().Add(\"content-type\", \"application/json\")\n\tvar user structs.User\n\tvar result structs.ResponseResult\n\tjson.NewDecoder(request.Body).Decode(&user) //Assign the json body into the local variable person\n\n\t// open up collection and write data\n\t// create a new database if it doesn't already exist\n\tcollection := client.Database(\"users\").Collection(\"students\")\n\tif user.Level == 1 {\n\t\tcollection = client.Database(\"users\").Collection(\"tutors\")\n\t} else if user.Level == 2 {\n\t\tcollection = client.Database(\"users\").Collection(\"professors\")\n\t}\n\n\t// specify the SetCollation option to provide a collation that will ignore case for string comparisons\n\topts := options.Delete().SetCollation(&options.Collation{\n\t\tLocale: \"en_US\",\n\t\tStrength: 1,\n\t\tCaseLevel: false,\n\t})\n\n\tres, err := collection.DeleteOne(context.TODO(), bson.D{{\"username\", user.Username}}, opts)\n\n\tif err != nil {\n\t\tresult.Error = \"Cannot find user\"\n\t\tjson.NewEncoder(response).Encode(result)\n\t\tlog.Fatal(err)\n\t\treturn\n\t}\n\n\tfmt.Sprintf(\"Removed %s: %d\", user.Username, res.DeletedCount)\n\tresult.Result = \"Successfully remove of user!\"\n\tjson.NewEncoder(response).Encode(result)\n\treturn\n}", "title": "" }, { "docid": "6fd92b9b398630e5f20b71ec8f92b1cc", "score": "0.6366199", "text": "func (accessorGroup *AccessorGroup) DeleteUserByID(ID int) error {\n\t_, err := accessorGroup.Database.Query(\"DELETE FROM Users WHERE ID=?\", ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5ffe11c6525e9490fb16793292854ffd", "score": "0.6360641", "text": "func Delete(id string) (bool, helpers.HTTPError) {\n\tvar errorDetails helpers.HTTPError\n\tuserObj := new(UserModel.User)\n\n\terr := config.Config.Db.Where(\"id=?\", id).First(&userObj).Error\n\tif err != nil {\n\t\tif userObj.ID == \"\" {\n\t\t\terrorDetails = helpers.HTTPError{Code: 404, Message: \"User does not exist.\", Error: errors.New(\"User does not exist.\")}\n\t\t\treturn false, errorDetails\n\t\t}\n\t\terrorDetails = helpers.HTTPError{Code: 500, Message: \"Something went wrong.\", Error: errors.New(\"Something went wrong.\")}\n\t\treturn false, errorDetails\n\t}\n\n\tdeleteErr := config.Config.Db.Delete(&userObj).Error\n\tif deleteErr != nil {\n\t\terrorDetails = helpers.HTTPError{Code: 500, Message: \"Something went wrong.\", Error: errors.New(\"Something went wrong.\")}\n\t\treturn false, errorDetails\n\t}\n\n\treturn true, errorDetails\n}", "title": "" }, { "docid": "c8defd2d38381d15660d05c548b7248a", "score": "0.6359459", "text": "func UserDel(ctx *macaron.Context, auth *auth.Auth, sess session.Store, dbb *db.Db, x csrf.CSRF) {\n\tif err := auth.VerificationAuth(ctx, sess, []string{\"del.user\"}); err != nil {\n\t\treturn\n\t}\n\tid, _ := strconv.ParseUint(ctx.Params(\":id\"), 10, 64)\n\tuser, err := dbb.GetUser(db.User{ID: id})\n\tif err != nil {\n\t\tctx.Data[\"message_categorie\"] = \"negative\"\n\t\tctx.Data[\"message_icon\"] = \"user\"\n\t\tctx.Data[\"message_header\"] = \"User not found !\"\n\t\tctx.Data[\"message_text\"] = \"The user seems to not be in the database\"\n\t\tctx.Data[\"message_redirect\"] = \"/admin/users\"\n\t\tctx.HTML(200, \"other/message\")\n\t} else if user.ID == 1 {\n\t\tctx.Data[\"message_categorie\"] = \"negative\"\n\t\tctx.Data[\"message_icon\"] = \"user\"\n\t\tctx.Data[\"message_header\"] = \"User is master !\"\n\t\tctx.Data[\"message_text\"] = \"You can't delete the master user.\"\n\t\tctx.Data[\"message_redirect\"] = \"/admin/users\"\n\t\tctx.HTML(200, \"other/message\")\n\t} else if !csrf.ValidToken(ctx.Query(\"confirm\"), \"8e82e24bca448c990f69f5c364fc15ae\", string(sess.Get(\"user\").(db.User).ID), \"del.user\") {\n\t\t// Ask for confirmation\n\t\tctx.Data[\"message_categorie\"] = \"\"\n\t\tctx.Data[\"message_icon\"] = \"user\"\n\t\tctx.Data[\"message_header\"] = \"Confirm user deletion!\"\n\t\tctx.Data[\"csrf_token\"] = csrf.GenerateToken(\"8e82e24bca448c990f69f5c364fc15ae\", string(sess.Get(\"user\").(db.User).ID), \"del.user\")\n\t\tsess.Set(\"crsf_user_id\", user.ID)\n\t\tctx.Data[\"message_text\"] = strings.Join([]string{\"Do you really want to delete : \", user.Username}, \" \")\n\n\t\tctx.HTML(200, \"other/confirmation\")\n\t} else {\n\t\t// We del the user if all is good\n\t\tif sess.Get(\"crsf_user_id\") != user.ID {\n\t\t\tctx.Data[\"message_categorie\"] = \"negative\"\n\t\t\tctx.Data[\"message_icon\"] = \"user\"\n\t\t\tctx.Data[\"message_header\"] = \"Hummm ...\"\n\t\t\tctx.Data[\"message_text\"] = template.HTML(\"It's seem there is a problem with the <a href='fr.wikipedia.org/wiki/Cross-Site_Request_Forgery' target='_blank'>CRSF</a> protection please retry.\")\n\t\t\tctx.Data[\"message_redirect\"] = \"/admin/users\"\n\t\t\tctx.HTML(200, \"other/message\")\n\t\t\treturn\n\t\t}\n\t\terr := user.Delete()\n\t\tif err != nil {\n\t\t\tctx.Data[\"message_categorie\"] = \"\"\n\t\t\tctx.Data[\"message_icon\"] = \"user\"\n\t\t\tctx.Data[\"message_header\"] = \"Oups\"\n\t\t\tctx.Data[\"message_text\"] = \"It's seem there is a problem during deletion\"\n\t\t\tctx.Data[\"message_redirect\"] = \"/admin/users\"\n\t\t\tctx.HTML(200, \"other/message\")\n\t\t\treturn\n\t\t}\n\t\tctx.Data[\"message_categorie\"] = \"\"\n\t\tctx.Data[\"message_icon\"] = \"user\"\n\t\tctx.Data[\"message_header\"] = \"User is deleted !\"\n\t\tctx.Data[\"message_text\"] = \"The user has been deleted from the database.\"\n\t\tctx.Data[\"message_redirect\"] = \"/admin/users\"\n\t\tctx.HTML(200, \"other/message\")\n\t\tsess.Delete(\"crsf_user_id\")\n\t}\n\n}", "title": "" }, { "docid": "e71654c7c8d1e0433603354e000d1aba", "score": "0.63566077", "text": "func DeleteUser(w http.ResponseWriter, r *http.Request) {\n\tparameters := mux.Vars(r)\n\n\tuserID, err := strconv.ParseUint(parameters[\"id\"], 10, 64)\n\tif err != nil {\n\t\tresponses.Error(w, http.StatusBadRequest, err)\n\t\treturn\n\t}\n\n\tuserIDToken, err := authentication.ExtractUserID(r)\n\tif err != nil {\n\t\tresponses.Error(w, http.StatusUnauthorized, err)\n\t\treturn\n\t}\n\n\tif userID != userIDToken {\n\t\tresponses.Error(w, http.StatusForbidden, errors.New(\"Without authorization for that request\"))\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.NewUserRepository(db)\n\tif err = repository.DeleteUser(userID); 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": "e02110af67ec04dc6b48a83cefba6907", "score": "0.6352234", "text": "func RemoveUser(w http.ResponseWriter, r *http.Request) {\n\n}", "title": "" }, { "docid": "ab70d45e1f745614be9e6b1f299a16d7", "score": "0.63505685", "text": "func (uv *userValidator) Delete(id uint) error {\n\tuser := User{\n\t\tModel: gorm.Model{\n\t\t\tID: id,\n\t\t},\n\t}\n\t// Validating if the user.ID <= 0\n\tif err := runUserValFuncs(&user, uv.isGreaterThan(0)); err != nil {\n\t\treturn err\n\t}\n\tuser = User{Model: gorm.Model{ID: id}}\n\treturn uv.UserDB.Delete(user.ID)\n}", "title": "" }, { "docid": "254835d7f6edd972f87faf362ae9f396", "score": "0.6348063", "text": "func deleteUser(w http.ResponseWriter, r *http.Request) {\n\n\tuserID := mux.Vars(r)[\"ID\"]\n\n\trows, err := db.Query(fmt.Sprintf(\"Delete from users where ID=%v\", userID))\n\tif err != nil {\n\t\tfmt.Println(\"Couldn't make it into rows\")\n\t\tpanic(err)\n\t}\n\t_ = rows\n\n}", "title": "" }, { "docid": "f0a9ce59ef623df4754273d3692b32d6", "score": "0.6346006", "text": "func (server *Server) DeleteUser(w http.ResponseWriter, r *http.Request) {\n\n\tvars := mux.Vars(r)\n\n\tuser := models.User{}\n\n\tuid, err := strconv.ParseUint(vars[\"id\"], 10, 32)\n\tif err != nil {\n\t\tresponses.ERROR(w, http.StatusBadRequest, err)\n\t\treturn\n\t}\n\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\tif tokenID != 0 && tokenID != uint32(uid) {\n\t\tresponses.ERROR(w, http.StatusUnauthorized, errors.New(http.StatusText(http.StatusUnauthorized)))\n\t\treturn\n\t}\n\t_, err = user.DeleteUser(server.DB, uint32(uid))\n\tif err != nil {\n\t\tresponses.ERROR(w, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Entity\", fmt.Sprintf(\"%d\", uid))\n\tresponses.JSON(w, http.StatusNoContent, \"\")\n}", "title": "" }, { "docid": "3976d06123b887ef59d734c9a2f79940", "score": "0.6336069", "text": "func DeleteUser(w http.ResponseWriter, r *http.Request, db *gorm.DB) {\n\n\tvars := mux.Vars(r)\n\n\tuser := models.User{}\n\n\tuid, err := strconv.ParseUint(vars[\"id\"], 10, 32)\n\tif err != nil {\n\t\tutils.ERROR(w, http.StatusBadRequest, err)\n\t\treturn\n\t}\n\ttokenID, err := auth.ExtractTokenID(r)\n\tif err != nil {\n\t\tutils.ERROR(w, http.StatusUnauthorized, errors.New(\"Unauthorized\"))\n\t\treturn\n\t}\n\tif tokenID != 0 && tokenID != uint32(uid) {\n\t\tutils.ERROR(w, http.StatusUnauthorized, errors.New(http.StatusText(http.StatusUnauthorized)))\n\t\treturn\n\t}\n\t_, err = user.DeleteAUser(db, uint32(uid))\n\tif err != nil {\n\t\tutils.ERROR(w, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\tw.Header().Set(\"Entity\", fmt.Sprintf(\"%d\", uid))\n\tutils.JSON(w, http.StatusNoContent, \"\")\n}", "title": "" }, { "docid": "e44ab55066f33a2637a41d84a16d659e", "score": "0.63238645", "text": "func deleteUser(c echo.Context) error {\n\tid := c.Param(\"id\")\n\n\tnewUsers := []User{}\n\n\tstorageFile, err := os.Open(\"storage.json\")\n\tif err != nil {\n\t\treturn c.JSON(http.StatusUnprocessableEntity, \"Unable to open storage file\")\n\t}\n\n\tdefer storageFile.Close()\n\n\tjsonParser := json.NewDecoder(storageFile)\n\tjsonParser.Decode(&newUsers)\n\n\tfor i := range newUsers {\n\t\tif newUsers[i].ID == id {\n\t\t\tnewUsers[i] = newUsers[len(newUsers)-1]\n\t\t\tnewUsers[len(newUsers)-1] = User{}\n\t\t\tnewUsers = newUsers[:len(newUsers)-1]\n\n\t\t\tfile, err := json.MarshalIndent(newUsers, \"\", \" \")\n\t\t\tif err != nil {\n\t\t\t\treturn c.JSON(http.StatusUnprocessableEntity, \"Unable to marshal data in JSON\")\n\t\t\t}\n\n\t\t\terr = ioutil.WriteFile(\"storage.json\", file, 0644)\n\t\t\tif err != nil {\n\t\t\t\treturn c.JSON(http.StatusUnprocessableEntity, \"Unable to write JSON in file\")\n\t\t\t}\n\n\t\t\treturn c.JSON(http.StatusOK, \"Successfully deleted User with selected ID\")\n\t\t}\n\t}\n\treturn c.JSON(http.StatusBadRequest, \"Unable to find User with selected ID\")\n}", "title": "" }, { "docid": "2b4c017bde016d00a26fd7e6067597a2", "score": "0.63156503", "text": "func (r *mongoUserRepository) Delete(\n\tctx context.Context,\n\tuserID primitive.ObjectID,\n) (model.User, error) {\n\n\tupdateResult, err := r.Users.UpdateByID(ctx, userID, bson.M{\"$set\": bson.M{\"status\": \"DELETED\"}})\n\tif err != nil {\n\t\treturn model.User{}, apperrors.NewConflict(\"login\", userID.Hex())\n\t}\n\n\tif updateResult.MatchedCount == 0 {\n\t\tlog.Printf(\"Couldn't update user. Id %v doesn't exit.\", userID)\n\t\treturn model.User{}, apperrors.NewNotFound(\"id\", userID.Hex())\n\t}\n\n\tvar updatedUser model.User\n\n\terr = r.Users.FindOne(ctx, model.User{ID: userID}).Decode(&updatedUser)\n\tif err != nil {\n\t\treturn model.User{}, apperrors.NewNotFound(\"id\", userID.Hex())\n\t}\n\n\treturn updatedUser, nil\n}", "title": "" }, { "docid": "bcdb3f5e5f250016814137ad5d1cb56b", "score": "0.63098896", "text": "func (s service) Delete(ctx context.Context, id string) (User, error) {\n\tuser, err := s.Get(ctx, id)\n\tif err != nil {\n\t\treturn User{}, err\n\t}\n\tif err = s.repo.Delete(ctx, id); err != nil {\n\t\treturn User{}, err\n\t}\n\treturn user, nil\n}", "title": "" }, { "docid": "2e4c5ef112e2f842d39ba9409bc1e068", "score": "0.6301844", "text": "func (c *Controller) DeleteUserByID(uid uint64) error {\n\t_, err := c.Exec(`\n\t\t\tdelete from participants where participants.userid = $1;\n\t\t`, uid)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = c.Exec(`\n\t\t\tdelete from winners where winners.userid = $1;\n\t\t`, uid)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = c.Exec(`delete from users where id = $1;`,\n\t\tuid)\n\treturn err\n}", "title": "" }, { "docid": "2b00b4736088e73d2b8c7499618303e4", "score": "0.63002855", "text": "func removeUser(db *pg.DB, name string) (err error) {\n\tuq := models.UserQuery{\n\t\tDB: db,\n\t}\n\n\tu, err := uq.GetUserByName(name)\n\tif u == nil {\n\t\terr = fmt.Errorf(\"User '%s' does not exist\", name)\n\t\treturn\n\t}\n\t// clear the error from no user?\n\terr = nil\n\n\terr = uq.DeleteUserByID(u.ID)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfmt.Printf(\"Deleated user %+v\\n\", u)\n\n\treturn\n\n}", "title": "" }, { "docid": "4c5ecef62795fc2219b0a03c6c4a80d1", "score": "0.6291498", "text": "func DeleteUser(rw http.ResponseWriter, r *http.Request) {\n\tparams := mux.Vars(r)\n\tID, err := strconv.ParseUint(params[\"id\"], 10, 32)\n\n\tif err != nil {\n\t\trw.Write([]byte(\"Error on convert the paramter\"))\n\t}\n\n\tdb, err := db.Connect()\n\tif err != nil {\n\t\trw.Write([]byte(\"Error on connect with db.\"))\n\t\treturn\n\t}\n\tdefer db.Close()\n\n\tstatement, err := db.Prepare(\"delete from users where id = ?\")\n\tif err != nil {\n\t\trw.Write([]byte(\"Error on create the statement\"))\n\t\treturn\n\t}\n\tdefer statement.Close()\n\n\tif _, err := statement.Exec(ID); err != nil {\n\t\trw.Write([]byte(\"Error on execute the statement\"))\n\t\treturn\n\t}\n\n\trw.WriteHeader(http.StatusNoContent)\n\n}", "title": "" }, { "docid": "2c1cab3354ecd688d78db69d54440d88", "score": "0.6290797", "text": "func RemoveUserFromDatabase(id string) error {\n\tdb := *NewDB()\n\n\tif _, ok := db[id]; !ok {\n\t\treturn errors.New(\"id is not in the database\")\n\t}\n\n\tdelete(db, id)\n\tdb.Write()\n\n\treturn nil\n}", "title": "" }, { "docid": "b6809b852607fa69185e18d2c0ff66ef", "score": "0.62854636", "text": "func DeleteUser(c *gin.Context) {\n\tidstr := c.Params.ByName(\"user_id\")\n\tid, errparse := strconv.ParseInt(idstr, 10, 64)\n\n\tif errparse != nil {\n\t\tc.JSON(http.StatusBadRequest, errors.NewBadRequestError(\"Invalid Id\"))\n\t\treturn\n\t}\n\n\tsaveErr := services.DeleteUser(id)\n\tif saveErr != nil {\n\t\tc.JSON(saveErr.Status, saveErr)\n\t\treturn\n\t}\n\n\tuser := users.User{}\n\tuser.ID = id\n\n\tc.JSON(http.StatusOK, user)\n}", "title": "" }, { "docid": "ba5fd1af301c98215bcb8ac01ea2eda4", "score": "0.6264189", "text": "func (svc *userSvcImpl) Delete(id string) *Error {\n\texisting, err := svc.GetByID(id)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif existing == nil {\n\t\treturn NewError(ErrNotFound, nil)\n\t}\n\n\t_, err2 := r.Table(\"Users\").Get(id).Delete().RunWrite(svc.session)\n\tif err2 != nil {\n\t\treturn NewError(ErrDB, err2)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0774e93b0c49a12ceeae95c9960a8cbc", "score": "0.62629914", "text": "func (repository *UserCommandRepositoryCircuitBreaker) DeleteUserByID(userID int) error {\n\thystrix.ConfigureCommand(\"delete_user_by_id\", config.Settings())\n\terrors := hystrix.Go(\"delete_user_by_id\", func() error {\n\t\terr := repository.UserCommandRepositoryInterface.DeleteUserByID(userID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\t}, nil)\n\n\tselect {\n\tcase err := <-errors:\n\t\treturn err\n\tdefault:\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "01503ec30691f5c9e0b1c54141ad9925", "score": "0.62430567", "text": "func (cri *MockUserRepository) DeleteUser(id string) error {\n\tres := entity.UserMock\n\tif id != res.Username {\n\t\treturn errors.New(\"Not found\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "203aee66039c678cbb5eb5ab7d8f1fbc", "score": "0.6242529", "text": "func (uh *UserHandler) DeleteUser(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\tw.Header().Set(\"Content-type\", \"application/json\")\n\n\tid, err := strconv.Atoi(ps.ByName(\"id\"))\n\n\tif err != nil {\n\t\thttp.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)\n\t\treturn\n\t}\n\n\tuser, errs := uh.userService.DeleteUser(uint(id))\n\n\tif len(errs) > 0 {\n\t\thttp.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)\n\t\treturn\n\t}\n\n\t_, err = json.MarshalIndent(user, \"\", \"\\n\")\n\n\tif err != nil {\n\t\thttp.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)\n\t\treturn\n\t}\n\n\tw.WriteHeader(http.StatusNoContent)\n\treturn\n\n}", "title": "" }, { "docid": "6d7ba1fb1abca346fac28956e241e903", "score": "0.6240684", "text": "func deleteUser(w http.ResponseWriter, r *http.Request) {\n\t//setting the header with content type\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tparams := mux.Vars(r)\n\n\t//find the book to update based on the ID\n\tfor index, item := range users {\n\t\tif item.ID == params[\"id\"] {\n\t\t\tusers = append(users[:index], users[index+1:]...)\n\t\t\tbreak\n\t\t}\n\t}\n\t//output the book found from ID\n\tjson.NewEncoder(w).Encode(users)\n\n}", "title": "" }, { "docid": "afe152df997757edda4872ba8cfe09f2", "score": "0.623868", "text": "func deleteData(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\n\tid := vars[\"id\"]\n\n\tvar user User\n\n\tdb.First(&user, id)\n\tdb.Delete(&user)\n\n\tjson.NewEncoder(w).Encode(\"User \" + id + \" deleted successfully!\")\n}", "title": "" }, { "docid": "3f447e9490132c4e85cc32e13080ebf5", "score": "0.6234116", "text": "func DeleteUser(id string) (err error) {\n\n\treturn\n}", "title": "" }, { "docid": "4ad77257263a472bda7742ff9f5ad258", "score": "0.6232188", "text": "func (u *User) DeleteUserByID(db *gorm.DB, uid uint32) (int64, error) {\n\tdb = db.Debug().Model(&User{}).Where(\"id = ?\", uid).Take(&User{}).Delete(&User{})\n\tif db.Error != nil {\n\t\treturn 0, db.Error\n\t}\n\n\treturn db.RowsAffected, nil\n}", "title": "" }, { "docid": "1caf15e7dba7ed4064148b7fabc43225", "score": "0.622824", "text": "func removeUser(username string) (err error) {\n\tgetMtx.Lock()\n\tdefer getMtx.Unlock()\n\n\t// Last user cannot be deleted.\n\tif 2 > len(get.Users) {\n\t\terr = errors.New(\"last user cannot be removed\")\n\t\treturn\n\t}\n\n\t// Acquire user object.\n\tvar u *user\n\tif u, err = getUserFromIndex(username); nil != err {\n\t\treturn\n\t}\n\n\t// Find index of user.\n\tindex := 0\n\tfound := false\n\tfor i, usr := range get.Users {\n\t\tif u == usr {\n\t\t\tindex = i\n\t\t\tfound = true\n\t\t\tbreak\n\t\t}\n\t}\n\n\t// Found in index, but not in database.\n\tif !found {\n\t\trefreshIndex()\n\t\treturn\n\t}\n\n\t// Memory-leak-safe implementation for removing an item from a list.\n\tcopy(get.Users[index:], get.Users[index+1:]) // Shift left to remove user.\n\tget.Users[len(get.Users)-1] = nil // Garbage collect the trailing item.\n\tget.Users = get.Users[:len(get.Users)-1] // Slice the tail from the slice.\n\n\t// Update index.\n\tremoveUserFromIndex(username)\n\n\treturn save()\n}", "title": "" }, { "docid": "0fffa050a60bc3e90b25c42df7dac2ae", "score": "0.62281394", "text": "func (m *MongoManager) DeleteUser(id string) error {\n\tcollection := m.DB.C(mongo.CollectionUsers).With(m.DB.Session.Copy())\n\tdefer collection.Database.Session.Close()\n\tif err := collection.Remove(bson.M{\"_id\": id}); err != nil {\n\t\tif err == mgo.ErrNotFound {\n\t\t\treturn fosite.ErrNotFound\n\t\t}\n\t\treturn errors.WithStack(err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c810e1cae3ee0c5e4260b2183b6331c9", "score": "0.6227721", "text": "func (uc UserController) DeleteUser(w http.ResponseWriter, r *http.Request, p httprouter.Params) {\n\t// TODO: write code to delete user\n\tid := p.ByName(\"id\")\n\n\tif !bson.IsObjectIdHex(id) {\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\treturn\n\t}\n\n\toid := bson.ObjectIdHex(id)\n\n\t// Delete user\n\tif err := uc.session.DB(\"go-web-dev-db\").C(\"users\").RemoveId(oid); err != nil {\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\treturn\n\t}\n\tw.WriteHeader(http.StatusOK) // 200\n\tfmt.Fprint(w, \"Write code to delete user\\n\")\n}", "title": "" }, { "docid": "141f13fdfbe371d45f95a6ca405daab0", "score": "0.6222805", "text": "func removeUser(w http.ResponseWriter, r *http.Request, t *auth.Token) error {\n\tu, err := t.User()\n\tif err != nil {\n\t\treturn err\n\t}\n\tgURL := repository.ServerURL()\n\tc := gandalf.Client{Endpoint: gURL}\n\talwdApps, err := u.AllowedApps()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := c.RevokeAccess(alwdApps, []string{u.Email}); err != nil {\n\t\tlog.Printf(\"Failed to revoke access in Gandalf: %s\", err)\n\t\treturn fmt.Errorf(\"Failed to revoke acess from git repositories: %s\", err)\n\t}\n\tteams, err := u.Teams()\n\tif err != nil {\n\t\treturn err\n\t}\n\tconn, err := db.Conn()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer conn.Close()\n\tfor _, team := range teams {\n\t\tif len(team.Users) < 2 {\n\t\t\tmsg := fmt.Sprintf(`This user is the last member of the team \"%s\", so it cannot be removed.\n\nPlease remove the team, them remove the user.`, team.Name)\n\t\t\treturn &errors.HTTP{Code: http.StatusForbidden, Message: msg}\n\t\t}\n\t\terr = team.RemoveUser(u)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// this can be done without the loop\n\t\terr = conn.Teams().Update(bson.M{\"_id\": team.Name}, team)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\trec.Log(u.Email, \"remove-user\")\n\tif err := c.RemoveUser(u.Email); err != nil {\n\t\tlog.Printf(\"Failed to remove user from gandalf: %s\", err)\n\t\treturn fmt.Errorf(\"Failed to remove the user from the git server: %s\", err)\n\t}\n\tquota.Delete(u.Email)\n\treturn conn.Users().Remove(bson.M{\"email\": u.Email})\n}", "title": "" }, { "docid": "9d6024ebfd4f2cac2c0c9636fc3bdc0b", "score": "0.6219546", "text": "func (delete) User(ctx context.Context, db *sqlx.DB, id string) error {\n\tctx, span := global.Tracer(\"service\").Start(ctx, \"internal.data.delete.user\")\n\tdefer span.End()\n\n\tif _, err := uuid.Parse(id); err != nil {\n\t\treturn ErrInvalidID\n\t}\n\n\tconst q = `DELETE FROM users WHERE user_id = $1`\n\tif _, err := db.ExecContext(ctx, q, id); err != nil {\n\t\treturn errors.Wrapf(err, \"deleting user %s\", id)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "4666e8de0151458ba71a1ddc10d5acef", "score": "0.62120366", "text": "func (uv *userValidator) Delete(id uint) error {\n\tif id == 0 {\n\t\treturn ErrInvalidID\n\t}\n\treturn uv.UserDB.Delete(id)\n}", "title": "" }, { "docid": "2d9b283eec9ed549719626a16d9c1a64", "score": "0.6196045", "text": "func DeleteUser(id int64) (uint, string, error) {\n\tresponse, err := client.DeleteRequest(config.Config.UsersURI, fmt.Sprint(id))\n\tif err != nil {\n\t\treturn uint(response.StatusCode), \"0\", err\n\t}\n\tbody, err := ioutil.ReadAll(response.Body)\n\tif err != nil {\n\t\treturn uint(response.StatusCode), \"0\", err\n\t}\n\treturn uint(response.StatusCode), string(body), nil\n}", "title": "" }, { "docid": "ac0464ea5030c880fda58be7867b2e31", "score": "0.6194609", "text": "func DeleteUser(id int) (interface{}, error) {\n\tvar user, deletedUser models.Users\n\tdb.First(&user, id)\n\tdb.First(&deletedUser, id)\n\n\tif err := db.Delete(&user).Error; err != nil {\n\t\treturn nil, err\n\t}\n\treturn deletedUser, nil\n}", "title": "" }, { "docid": "1b5df4ae498a0437c89ecb89fc415e61", "score": "0.61932474", "text": "func (t *Tournament) RemoveUserID(c appengine.Context, uID int64) error {\n\n\thasUser := false\n\ti := 0\n\n\tif hasUser, i = t.ContainsUserID(uID); !hasUser {\n\t\treturn fmt.Errorf(\"RemoveUserID, not a member\")\n\t}\n\n\t// as the order of index in usersId is not important,\n\t// replace elem at index i with last element and resize slice.\n\tt.UserIds[i] = t.UserIds[len(t.UserIds)-1]\n\tt.UserIds = t.UserIds[0 : len(t.UserIds)-1]\n\n\tif err := t.Update(c); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ba8195fa546092d1f05a8d789276b6e2", "score": "0.61876184", "text": "func delUser(dsum *DataStoreUserManager, w http.ResponseWriter, r *http.Request) {\n\tid := r.URL.Path[len(\"/user/delete/\"):]\n\tdone, e := dsum.Delete(id)\n\treturnJSON(errorOrData(done, e), w)\n}", "title": "" }, { "docid": "46dbee30aac4c5309eaf4e44615362cf", "score": "0.618615", "text": "func deleteUser(Writer http.ResponseWriter, Request *http.Request) {\n\tdefer Request.Body.Close()\n\terr := jwt.ValidateToken(Request.Header[\"Authorization\"][0])\n\tif err != nil {\n\t\tWriter.WriteHeader(http.StatusUnauthorized)\n\t\tWriter.Write([]byte(err.Error()))\n\t\treturn\n\t}\n\n\tAccountsCollection := DBClient.Database(\"db\").Collection(\"Accounts\")\n\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\tdefer cancel()\n\n\tDeleteRequest, err := parseAuthRequest(Request)\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, err.Error())\n\t\tWriter.WriteHeader(http.StatusInternalServerError)\n\t\tWriter.Write([]byte(\"Error parsing data\"))\n\t\treturn\n\t}\n\t_, err = AccountsCollection.DeleteOne(ctx, bson.M{\"id\": DeleteRequest.ID})\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, err.Error())\n\t\tWriter.WriteHeader(http.StatusInternalServerError)\n\t\tWriter.Write([]byte(\"Error parsing data\"))\n\t\treturn\n\t}\n\tkeyhook.DeleteKeyHookAccount(DeleteRequest.ID)\n\tWriter.WriteHeader(http.StatusOK)\n\treturn\n\n}", "title": "" }, { "docid": "17cdd6a371c4bf7ef40b8c73ea301285", "score": "0.61786866", "text": "func deleteUser(id string) bool {\n\tdb := openConnDB()\n\ttx := db.MustBegin()\n\ttx.MustExec(\"DELETE FROM users WHERE user_id=\" + id)\n\terr := tx.Commit()\n\tif err != nil {\n\t\treturn false\n\t}\n\tcloseConnDB(db)\n\treturn true\n}", "title": "" }, { "docid": "f523b72a9d405207d308d4dfa7249b95", "score": "0.617226", "text": "func (uri *UserRepositoryImpl) DeleteUser(id uint) (*entity.User,error) {\n\tuser := entity.User{}\n\trows,err:= uri.conn.Raw(\"DELETE FROM users WHERE id = ?\",id).Rows()\n\tif rows != nil{\n\tfor rows.Next(){\n\t\turi.conn.ScanRows(rows,&user)\n\t}\n\tif err != nil{\n\t\treturn &user,err\n\t}\n\treturn &user,nil\n\t\t\n\t}\n\treturn &user,errors.New(\"user not found\")\n\n\n\t\t// _, err := uri.conn.Exec(\"DELETE FROM users WHERE id = $1\", id)\n\t\t// if err != nil {\n\t\t// \treturn errors.New(\"Delete has faild\")\n\t\t// }\n\t\t// return nil\n}", "title": "" }, { "docid": "4e9c0c21ac8ecd618d8e9934a24a6e65", "score": "0.6171055", "text": "func (e mainEnv) userDelete(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\tidentity := ps.ByName(\"identity\")\n\tmode := ps.ByName(\"mode\")\n\tevent := audit(\"delete user record by \"+mode, identity, mode, identity)\n\tdefer func() { event.submit(e.db) }()\n\n\tif validateMode(mode) == false {\n\t\treturnError(w, r, \"bad mode\", 405, nil, event)\n\t\treturn\n\t}\n\tvar err error\n\tvar userBSON bson.M\n\tvar userJSON []byte\n\tuserTOKEN := identity\n\tif mode == \"token\" {\n\t\tif enforceUUID(w, identity, event) == false {\n\t\t\treturn\n\t\t}\n\t\tuserJSON, userBSON, err = e.db.getUser(identity)\n\t} else {\n\t\tuserJSON, userTOKEN, userBSON, err = e.db.getUserByIndex(identity, mode, e.conf)\n\t\tevent.Record = userTOKEN\n\t}\n\tif err != nil {\n\t\treturnError(w, r, \"internal error\", 405, nil, event)\n\t\treturn\n\t}\n\tauthResult := e.enforceAuth(w, r, event)\n\tif authResult == \"\" {\n\t\treturn\n\t}\n\tif userJSON == nil {\n\t\tif authResult == \"root\" && mode == \"email\" {\n\t\t\te.globalUserDelete(identity)\n\t\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\t\t\tw.WriteHeader(200)\n\t\t\tfmt.Fprintf(w, `{\"status\":\"ok\",\"result\":\"done\"}`)\n\t\t}\n\t\treturnError(w, r, \"record not found\", 405, nil, event)\n\t\treturn\n\t}\n\n\tif authResult == \"login\" {\n\t\tevent.Title = \"user forget-me request\"\n\t\tif e.conf.SelfService.ForgetMe == false {\n\t\t\trtoken, rstatus, err := e.db.saveUserRequest(\"forget-me\", userTOKEN, \"\", \"\", nil, e.conf)\n\t\t\tif err != nil {\n\t\t\t\treturnError(w, r, \"internal error\", 405, err, event)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\t\t\tw.WriteHeader(200)\n\t\t\tfmt.Fprintf(w, `{\"status\":\"ok\",\"result\":\"%s\",\"rtoken\":\"%s\"}`, rstatus, rtoken)\n\t\t\treturn\n\t\t}\n\t}\n\temail := getStringValue(userBSON[\"email\"])\n\tif len(email) > 0 {\n\t\te.globalUserDelete(email)\n\t}\n\t//fmt.Printf(\"deleting user %s\\n\", userTOKEN)\n\t_, err = e.db.deleteUserRecord(userJSON, userTOKEN, e.conf)\n\tif err != nil {\n\t\treturnError(w, r, \"internal error\", 405, err, event)\n\t\treturn\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\tw.WriteHeader(200)\n\tfmt.Fprintf(w, `{\"status\":\"ok\",\"result\":\"done\"}`)\n\tnotifyURL := e.conf.Notification.NotificationURL\n\tnotifyForgetMe(notifyURL, userJSON, \"token\", userTOKEN)\n}", "title": "" }, { "docid": "6a60f5bc5531c6356561fe983d9a8dc7", "score": "0.6170697", "text": "func (UserStorage *UserStorage) Delete(id bson.ObjectId) error {\n\tcoll := UserStorage.database.C(models.UserName) // TODO this should not use memory\n\tif id == \"\" {\n\t\tutils.ErrorLog.Println(\"Given User instance has an empty ID. Can not be deleted from database.\")\n\t\treturn errors.New(\"Given User instance has an empty ID. Can not be updated from database\")\n\t}\n\tinfo, err := coll.RemoveAll(bson.M{\"_id\": id})\n\tif err != nil {\n\t\tutils.ErrorLog.Printf(\"Error while deleting User with ID %s in database: %s\", id, err.Error())\n\t\treturn err\n\t}\n\tutils.DebugLog.Printf(\"Deleted %d User with ID %s from database.\", info.Removed, id.Hex())\n\treturn nil\n}", "title": "" }, { "docid": "98bb4cdb6ace086835563b315bfcf24f", "score": "0.61646837", "text": "func (u *UserRepoMysql) DeleteByID(id int) (*model.User, error) {\n\tuser, err := u.FindByID(id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t_, err = u.db.Exec(\"DELETE FROM users WHERE id=?\", id)\n\treturn user, err\n}", "title": "" }, { "docid": "83080d4a9e5f506b6bff964a599c178f", "score": "0.61631376", "text": "func (a *Client) DeleteUserByID(params *DeleteUserByIDParams) (*DeleteUserByIDOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewDeleteUserByIDParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"deleteUserById\",\n\t\tMethod: \"DELETE\",\n\t\tPathPattern: \"/users/{id}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &DeleteUserByIDReader{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.(*DeleteUserByIDOK), nil\n\n}", "title": "" }, { "docid": "20ffe99bf977e9eba8363fb2aece51f6", "score": "0.6158851", "text": "func (s *UserService) Delete(id uint) error {\n\tif s.repo.Find(id).ID == 0 {\n\t\treturn errors.New(\"User not found\")\n\t}\n\n\ts.repo.Delete(id)\n\treturn nil\n}", "title": "" }, { "docid": "3ec1d50bfcc8269f67f6a5fd2ef016b9", "score": "0.6156339", "text": "func RemoveTestUser(db *gorm.DB, id int) error {\n\tfmt.Println(\"removing test user\")\n\tu := User{}\n\tif err := db.First(&u, id).Error; err != nil {\n\t\treturn err\n\t}\n\t// test users have a +test filter added to the email\n\tif !(strings.Index(u.Email, \"+test\") > 0) {\n\t\treturn nil\n\t}\n\t// delete the phone numbers\n\tfor _, pn := range u.PhoneNumbers {\n\t\tif err := db.Unscoped().Delete(&pn).Error; err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t// delete the address\n\tif err := db.Unscoped().Delete(&u.Address).Error; err != nil {\n\t\treturn err\n\t}\n\t// finally just delete the user record\n\tif err := db.Unscoped().Delete(&u).Error; err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a60d0a70cb173091850b22169d7335f2", "score": "0.6148824", "text": "func TestUserRemoveTeamID(t *testing.T) {\n\n\tvar c aetest.Context\n\tvar err error\n\toptions := aetest.Options{StronglyConsistentDatastore: true}\n\n\tif c, err = aetest.NewContext(&options); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer c.Close()\n\n\ttests := []struct {\n\t\ttitle string\n\t\tteamID int64\n\t\terr string\n\t}{\n\t\t{\n\t\t\t\"can remove team Id from user\",\n\t\t\t42,\n\t\t\t\"\",\n\t\t},\n\t\t{\n\t\t\t\"cannot remove team Id from user\",\n\t\t\t54,\n\t\t\t\"RemoveTeamID, not a member\",\n\t\t},\n\t}\n\n\tvar user *User\n\tif user, err = CreateUser(c, \"john.snow@winterfell.com\", \"john.snow\", \"John Snow\", \"Crow\", false, \"\"); err != nil {\n\t\tt.Errorf(\"Error: %v\", err)\n\t}\n\n\tif err = user.AddTeamID(c, tests[0].teamID); err != nil {\n\t\tt.Errorf(\"Error: %v\", err)\n\t}\n\n\tfor i, test := range tests {\n\t\tt.Log(test.title)\n\n\t\terr = user.RemoveTeamID(c, test.teamId)\n\n\t\tcontains, _ := user.ContainsTeamID(test.teamId)\n\n\t\tif !strings.Contains(gonawintest.ErrorString(err), test.err) {\n\t\t\tt.Errorf(\"test %d - Error: want err: %s, got: %q\", i, test.err, err)\n\t\t} else if test.err == \"\" && contains {\n\t\t\tt.Errorf(\"test %d - Error: team IDs should be empty\", i)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "14007379376a0ef0a95fe65af716e7c7", "score": "0.61436874", "text": "func DeleteUser(user *model.User, id string) (err error) {\n\tconfig.DB.Where(\"id = ?\", id).Delete(user)\n\treturn nil\n}", "title": "" }, { "docid": "1bc1bfd5beaad43ca94739b9a1291053", "score": "0.61429226", "text": "func DeleteUser(id int32) error {\n\tif err := config.DB.Where(\"id = ?\", id).Unscoped().Delete(User{}).Error; err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "70b1172686d77e8ad1289081bb07c0aa", "score": "0.6142125", "text": "func (p *wsclient) removeUser(user *User) {\n\tfor i, u := range p.users {\n\t\tif u.identifier == user.identifier {\n\t\t\tcopy(p.users[i:], p.users[i+1:])\n\t\t\tp.users[len(p.users)-1] = nil\n\t\t\tp.users = p.users[:len(p.users)-1]\n\t\t\tbreak\n\t\t}\n\t}\n\n\t//log.Println(\"User Disconnected\", user.identifier)\n\t//Tell everyone this user disconnected\n\t//p.Broadcast(UserIdentifyEvent{Identity: user.identifier, DisplayName: user.displayname, State: UserIdentifyDisconnect})\n}", "title": "" }, { "docid": "1d376f29c77a049e90a513863221f3fd", "score": "0.6137589", "text": "func (m *Manager) DeleteUserByID(ctx context.Context, id uuid.UUID, isHard bool) (u User, err error) {\n\tstore, err := m.Store()\n\tif err != nil {\n\t\treturn u, errors.Wrap(err, \"failed to obtain a store\")\n\t}\n\n\tif isHard {\n\t\t// hard-deleting this object\n\t\tif err = store.DeleteUserByID(ctx, id); err != nil {\n\t\t\treturn u, errors.Wrap(err, \"failed to delete user\")\n\t\t}\n\n\t\t// and finally deleting user's password if the password manager is present\n\t\t// NOTE: it should be possible that the user could not have a password\n\t\tif m.passwords != nil {\n\t\t\terr = m.passwords.Delete(ctx, password.NewOwner(password.OKUser, id))\n\t\t\tif err != nil {\n\t\t\t\treturn u, errors.Wrap(err, \"failed to delete user password\")\n\t\t\t}\n\t\t}\n\n\t\treturn u, nil\n\t}\n\n\t// obtaining deleted object\n\tu, err = m.UserByID(ctx, id)\n\tif err != nil {\n\t\treturn u, err\n\t}\n\n\t// updating to mark this object as deleted\n\tu, _, err = m.UpdateUser(ctx, id, func(ctx context.Context, u User) (_ User, err error) {\n\t\tu.DeletedAt = time.Now()\n\n\t\treturn u, nil\n\t})\n\n\treturn u, nil\n}", "title": "" }, { "docid": "72be7a397cb0059089f74dcaf160d3ad", "score": "0.61363626", "text": "func DeleteUser(userID string, w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Context-Type\", \"application/json\")\n\n\tid, err := strconv.Atoi(userID)\n\tif err != nil {\n\t\tlog.L.Fatal(\"unable to parse user_id into int\", zap.Error(err))\n\t}\n\n\tusers := NewUsers()\n\tif err := users.Delete(int64(id)); err != nil {\n\t\tlog.L.Fatal(\"unable to delete user\", zap.Error(err))\n\t}\n\n\tlog.L.Info(\"user deleted successfully\", zap.Int64(\"userID\", int64(id)))\n\n\tmsg := fmt.Sprintf(\"user deleted successfully\")\n\n\tres := response{\n\t\tID: int64(id),\n\t\tMessage: msg,\n\t}\n\n\tjson.NewEncoder(w).Encode(res)\n}", "title": "" } ]
c9ac2b3da2c6d6eddd1645716236e29f
TestNodeFindKey validates the correct positioning of where to insert elements in an elements array
[ { "docid": "d5ea5f982543051e5b7d9176308e1166", "score": "0.71821594", "text": "func TestNodeFindKey(t *testing.T) {\n\tfmt.Println(\"-- TestNodeFindKey\")\n\tn := &btnode{\n\t\telements: []*element{\n\t\t\tgetElements(testNode{3}),\n\t\t\tgetElements(testNode{4}),\n\t\t\tgetElements(testNode{5}),\n\t\t\tgetElements(testNode{7}),\n\t\t\tgetElements(testNode{30}),\n\t\t},\n\t\ttree: getTestTree(3),\n\t}\n\n\tvar tests = []struct {\n\t\tkey, expected int\n\t\tfound bool\n\t}{\n\t\t{0, 0, false},\n\t\t{1, 0, false},\n\t\t{2, 0, false},\n\t\t{3, 0, true},\n\t\t{4, 1, true},\n\t\t{7, 3, true},\n\t\t{30, 4, true},\n\t\t{31, 5, false},\n\t\t{500, len(n.elements), false},\n\t}\n\tfor i, test := range tests {\n\t\tidx, found := n.find(test.key)\n\t\tif idx != test.expected || found != test.found {\n\t\t\tt.Errorf(\"Test %d failed, expected index:%d returned_index:%d, expected found:%t returned_found:%t\", i+1, test.expected, idx, test.found, found)\n\t\t}\n\t}\n}", "title": "" } ]
[ { "docid": "910b2bba09cea70867ce0067c5cf43e5", "score": "0.6981561", "text": "func TestElementsFind(t *testing.T) {\n\tfmt.Println(\"-- TestElementsFind\")\n\tless := func(k1, k2 Key) bool {\n\t\treturn k1.(int) < k2.(int)\n\t}\n\ttester := func(name string, es elements) {\n\t\tvar cases = []struct {\n\t\t\tsearch, index int\n\t\t\tfound bool\n\t\t}{\n\t\t\t{2, 0, true}, {4, 1, true}, {6, 2, true}, {8, 3, true}, {10, 4, true},\n\t\t\t{12, 5, true}, {14, 6, true}, {16, 7, true}, {18, 8, true}, {20, 9, true},\n\t\t\t{22, 10, false}, {7, 3, false}, {1, 0, false},\n\t\t}\n\t\tstr := \"%s Case: %d -- Expected: element{%d}, index:%d, found:%t -- instead got index:%d, found:%t\"\n\t\tfor i, test := range cases {\n\t\t\tidx, found := es.indexOf((&element{test.search, nil}).Key(), less)\n\t\t\tif idx != test.index || found != test.found {\n\t\t\t\tt.Errorf(str, name, i+1, test.search, test.index, test.found, idx, found)\n\t\t\t}\n\t\t}\n\t}\n\tappended := make(elements, 0)\n\tfor i := 1; i < 11; i++ {\n\t\tappended = append(appended, &element{i * 2, nil})\n\t}\n\ttester(\"BuiltWithAppend\", appended)\n\tadded := make(elements, 0)\n\tfor i := 1; i < 11; i++ {\n\t\tadded.add(&element{i * 2, nil}, less)\n\t}\n\ttester(\"BuiltWithAdding\", added)\n}", "title": "" }, { "docid": "58ba94094a7c9501d87f8ad34e9ff4d7", "score": "0.60603374", "text": "func (n *node) find(key []byte, extend bool) (elem *node, ok bool) {\n\n var(\n k int\n N *node\n )\n\n N = n\n k = 1\n //Get below the root\n elem, ok = N.subtrees[key[0]]\n switch {\n case ok:\n N = elem\n\n case !ok && extend:\n elem = new(node)\n elem.Init(key[1:])\n N.subtrees[key[0]] = elem\n N = elem\n\n case !ok:\n return nil, false\n }\n\n for ; k < len(key); {\n var i int\n for i = 0; k + i < len(key) && i < len(N.Key) && key[k + i] == N.Key[i]; i++ {\n log.Tracef(\"%c matches at position %d\", key[k+i], i)\n }\n log.Tracef(\"k=%d, i=%d, key=%s, N.Key=%s\", k, i, key[k:], N.Key)\n\n if i < len(N.Key) {\n //Split this node.\n log.Tracef(\"Splitting the current node to have key %s with new subtree starting at %v with value %s\", N.Key[:i], N.Key[i], N.Key[i:])\n elem = new(node)\n elem.Init(N.Key[i:])\n elem.Value = N.Value\n // Copy the current subtree to the split value\n for subtree, val := range N.subtrees {\n elem.subtrees[subtree] = val\n }\n\n // Delete the old value *and subkeys*\n N.Value = nil\n\n N.subtrees = map[byte]*node{N.Key[i]: elem}\n N.Key = N.Key[:i]\n }\n\n log.Tracef(\"Subkey is '%s' at %s\",\n key[k+i:], N.Key)\n if k + i == len(key) && N.Key != nil {\n // This is only the stopping point if we're not at the root.\n // At the root we need to go down one mroe\n log.Tracef(\"Returning %#v\", N)\n return N, true\n }\n\n log.Tracef(\"Looking for %v in subtrees: %v\", key[k+i], N.subtrees)\n\n elem, ok = N.subtrees[key[k+i]]\n if !ok {\n if ! extend {\n log.Tracef(\"Didn't find subkey %s\", k)\n return nil, false\n\n } else {\n elem = new(node)\n elem.Init(key[k+i:])\n log.Tracef(\"Creating new subnode %v with Key %s\", elem, elem.Key)\n N.subtrees[key[k+i]] = elem\n N = elem\n break\n }\n }\n\n k += len(N.Key)\n N = elem\n\n }\n\n return N, true\n}", "title": "" }, { "docid": "371c1b3e80bd7d95733a0d1a2ad3b47f", "score": "0.5842594", "text": "func TestNodeElementInsert(t *testing.T) {\n\tfmt.Println(\"-- TestNodeElementInsert\")\n\n\tn := &btnode{\n\t\telements: []*element{getElements(testNode{5})},\n\t\ttree: getTestTree(3),\n\t}\n\tassertNodeValue(t, n, 0, 5)\n\tassertElementLength(t, n, 1)\n\tn.insertElement(testNode{8}, 1)\n\tassertElementLength(t, n, 2)\n\tassertNodeValue(t, n, 0, 5)\n\tassertNodeValue(t, n, 1, 8)\n\tn.insertElement(testNode{4}, 0)\n\tassertElementLength(t, n, 3)\n\tassertNodeValue(t, n, 0, 4)\n\tassertNodeValue(t, n, 1, 5)\n\tassertNodeValue(t, n, 2, 8)\n}", "title": "" }, { "docid": "9ce6eeb2ed7ecf488ace37d8ef7f6c11", "score": "0.57459426", "text": "func (s *MySuite) TestInsertSecondString(c *C) {\n\tvar ok bool\n\tvar err error\n\t// Create it\n\ttable := make([]string, 3)\n\ttree := New(0)\n\tc.Check(tree.LoudsSlice(), DeepEquals, []byte{0})\n\tkeys := tree.Keys()\n\tc.Assert(err, IsNil)\n\tc.Check(keys, IsNil)\n\n\ttable[0] = \"CCC\"\n\tok, err = tree.Insert(table[0], 0)\n\tc.Assert(err, IsNil)\n\tc.Check(ok, Equals, true)\n\tc.Check(tree.LoudsSlice(), DeepEquals,\n\t\t// SR 1\n\t\t// --- -\n\t\t[]byte{1, 0, 0})\n\tkeys = tree.Keys()\n\tc.Assert(err, IsNil)\n\tc.Check(keys, DeepEquals, []string{\"CCC\"})\n\n\ttable[1] = \"@@@\"\n\tok, err = tree.Insert(table[1], 1)\n\tc.Assert(err, IsNil)\n\tc.Check(ok, Equals, true)\n\tc.Check(tree.LoudsSlice(), DeepEquals,\n\t\t// SR 0 1 0\n\t\t// --- ----- - -\n\t\t[]byte{1, 0, 1, 1, 0, 0, 0})\n\tkeys = tree.Keys()\n\tc.Assert(err, IsNil)\n\tc.Check(keys, DeepEquals, []string{\"@@@\", \"CCC\"})\n\n\ttable[2] = \"AAA\"\n\tok, err = tree.Insert(table[2], 2)\n\tc.Assert(err, IsNil)\n\tc.Check(ok, Equals, true)\n\tc.Check(tree.LoudsSlice(), DeepEquals,\n\t\t// SR 0 1 0 1 2\n\t\t// --- ----- ----- - - -\n\t\t[]byte{1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0})\n\n\tkeys = tree.Keys()\n\tc.Assert(err, IsNil)\n\tc.Check(keys, DeepEquals, []string{\"@@@\", \"AAA\", \"CCC\"})\n}", "title": "" }, { "docid": "97f9dcdd54456f414bfc21d5ea3a8368", "score": "0.57053447", "text": "func TestLookUp2(t *testing.T) {\n\tring := NewRing()\n\tnodes := createNodes()\n\taddNodesToTree(ring, nodes)\n\tkeysShouldBe := getKeysShouldBe(nodes)\n\n\tfor _, key := range keysShouldBe {\n\t\t//lookup a key smaller than an node by one\n\t\tnode0, err0 := ring.LookUp(SubOne(key))\n\t\t//lookup a key at same position as node\n\t\tnode1, err1 := ring.LookUp(key)\n\t\t//lookup a key larger than an node by one\n\t\tnode2, err2 := ring.LookUp(AddOne(key))\n\n\t\tassert.Nil(t, err0)\n\t\tassert.Nil(t, err1)\n\t\tassert.Nil(t, err2)\n\n\t\tassert.Equal(t, node0, node1)\n\n\t\tindex := sort.SearchStrings(keysShouldBe, key)\n\t\tindex = (index + 1) % len(keysShouldBe)\n\t\tassert.True(t, contains(node2.Keys, keysShouldBe[index]))\n\t}\n}", "title": "" }, { "docid": "db2851e9457ad3766274f34b53698779", "score": "0.55807185", "text": "func TestSearchInsertPosition(t *testing.T) {\n\tvar cases = []struct {\n\t\tinput []int\n\t\ttarget int\n\t\toutput int\n\t}{\n\t\t{\n\t\t\tinput: []int{1, 3, 5, 6},\n\t\t\ttarget: 5,\n\t\t\toutput: 2,\n\t\t},\n\t\t{\n\t\t\tinput: []int{1, 3, 5, 6},\n\t\t\ttarget: 2,\n\t\t\toutput: 1,\n\t\t},\n\t\t{\n\t\t\tinput: []int{1, 3, 5, 6},\n\t\t\ttarget: 7,\n\t\t\toutput: 4,\n\t\t},\n\t\t{\n\t\t\tinput: []int{1, 3, 5, 6},\n\t\t\ttarget: 0,\n\t\t\toutput: 0,\n\t\t},\n\t\t{\n\t\t input: []int{},\n\t\t target: 1,\n\t\t output: 0,\n },\n\t}\n\tfor _, c := range cases {\n\t\tx := searchInsert(c.input, c.target)\n\t\tif x != c.output {\n\t\t\tt.Fail()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "304ad80dff70e80bdf995a1564503ed4", "score": "0.5334006", "text": "func TestLookUp1(t *testing.T) {\n\tring := NewRing()\n\tnodes := createNodes()\n\taddNodesToTree(ring, nodes)\n\tkeysShouldBe := getKeysShouldBe(nodes)\n\n\tfor _, key := range keysShouldBe {\n\t\tnode, err := ring.LookUp(SubOne(key))\n\n\t\tassert.Nil(t, err)\n\t\tassert.True(t, contains(node.Keys, key))\n\t}\n}", "title": "" }, { "docid": "1d58507ff553792c7bef0842d7883710", "score": "0.53017443", "text": "func TestInsertLocation(t *testing.T) {\n arr := make([]string, 0)\n arr = insert(arr, \":4444\")\n arr = insert(arr, \":5555\")\n arr = insert(arr, \":6666\")\n arr = insert(arr, \":4444\")\n arr = insert(arr, \":5555\")\n arr = insert(arr, \":6666\")\n arr = insert(arr, \":7777\")\n if len(arr) != 4 {\n t.Error(\"arr's length should be 4\")\n }\n fmt.Println(arr)\n}", "title": "" }, { "docid": "62628be367fc9d7fb01dfaf1c46b35a3", "score": "0.5290866", "text": "func TestCreateElements(t *testing.T) {\n\tl := createElements(10)\n\tif len(l) != 10 || l[9].Id != 9 {\n\t\tt.Error(\"fail to create elements\")\n\t}\n}", "title": "" }, { "docid": "e146c8d0d8b6c670e09ecce187c88547", "score": "0.527426", "text": "func TestArrayIndexOfAndContains(t *testing.T) {\n\tif !setupComplete {\n\t\tt.Skip()\n\t}\n\t// Array of String\n\tdata, err := table.GetKey(\"Vokome\", map[string]interface{}{\"testStringArray.*indexOf\": []interface{}{\"c\"}, \"testStringArray.*contains\": []interface{}{\"h\"}})\n\tif err.ID != 0 {\n\t\tt.Errorf(\"TestArrayIndexOfAndContains error: %v\", err)\n\t\treturn\n\t}\n\tif data[\"testStringArray.*indexOf\"] != int64(2) {\n\t\tt.Errorf(\"TestArrayIndexOfAndContains expected 2, but got: %v\", data[\"testStringArray.*indexOf\"])\n\t\treturn\n\t}\n\tif data[\"testStringArray.*contains\"] != false {\n\t\tt.Errorf(\"TestArrayIndexOfAndContains expected false, but got: %v\", data[\"testStringArray.*contains\"])\n\t\treturn\n\t}\n\t// Array of Float32\n\tdata, err = table.GetKey(\"Vokome\", map[string]interface{}{\"testFloatArray.*indexOf\": []interface{}{5.5}, \"testFloatArray.*contains\": []interface{}{45}})\n\tif err.ID != 0 {\n\t\tt.Errorf(\"TestArrayIndexOfAndContains error: %v\", err)\n\t\treturn\n\t}\n\tif data[\"testFloatArray.*indexOf\"] != int64(3) {\n\t\tt.Errorf(\"TestArrayIndexOfAndContains expected 3, but got: %v\", data[\"testFloatArray.*indexOf\"])\n\t\treturn\n\t}\n\tif data[\"testFloatArray.*contains\"] != false {\n\t\tt.Errorf(\"TestArrayIndexOfAndContains expected false, but got: %v\", data[\"testFloatArray.*contains\"])\n\t}\n}", "title": "" }, { "docid": "327786dba35fa3f8bcb1852817c4c116", "score": "0.52716345", "text": "func (s *sortedArray) find(key uint64) ContextOffset {\n\tif len(s.keys) == 0 || s.keys[0] > key || s.keys[len(s.keys) - 1] < key {\n\t\treturn InvalidContextOffset\n\t}\n\n\ti := sort.Search(len(s.keys), func(i int) bool { return s.keys[i] >= key })\n\n\tif i < 0 || i >= len(s.keys) || s.keys[i] != key {\n\t\treturn InvalidContextOffset\n\t}\n\n\treturn ContextOffset(i)\n}", "title": "" }, { "docid": "f44feba5d4b3a0d97f8172274730cca7", "score": "0.52225053", "text": "func (self *BpTree) internalInsert(n uint64, key, value []byte, allowDups bool) (a, b uint64, err error) {\n\t// log.Println(\"internalInsert\", n, key)\n\tvar i int\n\tvar ptr uint64\n\terr = self.doInternal(n, func(n *internal) (err error) {\n\t\tvar has bool\n\t\ti, has, err = find(self.varchar, n, key)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif !has && i > 0 {\n\t\t\t// if it doesn't have it and the index > 0 then we have the\n\t\t\t// next block so we have to subtract one from the index.\n\t\t\ti--\n\t\t}\n\t\tptr = *n.ptr(i)\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn 0, 0, err\n\t}\n\tp, q, err := self.insert(ptr, key, value, allowDups)\n\tif err != nil {\n\t\treturn 0, 0, err\n\t}\n\tvar must_split bool = false\n\tvar split_key []byte = nil\n\terr = self.doInternal(n, func(m *internal) error {\n\t\t*m.ptr(i) = p\n\t\terr := self.firstKey(p, func(key []byte) error {\n\t\t\treturn m.updateK(self.varchar, i, key)\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif q != 0 {\n\t\t\treturn self.firstKey(q, func(key []byte) error {\n\t\t\t\tif m.full() {\n\t\t\t\t\tmust_split = true\n\t\t\t\t\tsplit_key = make([]byte, len(key))\n\t\t\t\t\tcopy(split_key, key)\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\treturn m.putKP(self.varchar, key, q)\n\t\t\t})\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\tself.doInternal(n, func(n *internal) (err error) {\n\t\t\tlog.Println(n.Debug(self.varchar))\n\t\t\treturn nil\n\t\t})\n\t\tlog.Printf(\"n: %v, p: %v, q: %v\", n, p, q)\n\t\tlog.Println(err)\n\t\treturn 0, 0, err\n\t}\n\tif must_split {\n\t\ta, b, err = self.internalSplit(n, split_key, q)\n\t\tif err != nil {\n\t\t\treturn 0, 0, err\n\t\t}\n\t} else {\n\t\ta = n\n\t\tb = 0\n\t}\n\treturn a, b, nil\n}", "title": "" }, { "docid": "93c9b43971184d2d5758962056f4f410", "score": "0.50943476", "text": "func (t *table) insert(k string) bool {\n\ti := hash(k)\n\n\tif t.search(&k) {\n\t\t// Key already exists\n\t\tfmt.Println(\"Entry: \", k, \"-- already exists\")\n\t\treturn false\n\t}\n\n\tfmt.Println(\"Entry: \", k)\n\tt.array[i] = &node{k: &k, next: t.array[i]}\n\t\n\treturn true\n}", "title": "" }, { "docid": "bb2819b5c53aa8f3544747f408e02212", "score": "0.5047841", "text": "func (n *node) insert(key string, in *node) bool {\n\tvar found *node\n\n\tswitch in.tid {\n\tcase param:\n\t\tfound = n.find(other)\n\tcase other:\n\t\tfound = n.find(param)\n\t}\n\n\tif found != nil {\n\t\treturn false\n\t}\n\n\tif n.Children == nil {\n\t\tn.Children = make(map[string]*node)\n\t}\n\n\tn.Children[key] = in\n\n\treturn true\n}", "title": "" }, { "docid": "7ae1cf935f67b98583585b59f6882583", "score": "0.50433284", "text": "func expectNode(t *testing.T, hashRing *HashRing, key string, expectedNode string) {\n\tnode, ok := hashRing.GetNode(key)\n\tif !ok || node != expectedNode {\n\t\tt.Error(\"GetNode(\", key, \") expected\", expectedNode, \"but got\", node)\n\t}\n}", "title": "" }, { "docid": "96a1da289c14a551cf7e0ff5d1149b69", "score": "0.5032132", "text": "func (h *StubHashRing) eltKey(elt string, idx int) string {\n\t// return elt + \"|\" + strconv.Itoa(idx)\n\treturn strconv.Itoa(idx) + elt\n}", "title": "" }, { "docid": "c08f24896df642ade16345f17074a6e5", "score": "0.50249076", "text": "func (t *binarySearchTree) insert(key, value []byte, secondaryKeys [][]byte) (int, [][]byte) {\n\tif t.root == nil {\n\t\tt.root = &binarySearchNode{\n\t\t\tkey: key,\n\t\t\tvalue: value,\n\t\t\tsecondaryKeys: secondaryKeys,\n\t\t\tcolourIsRed: false, // root node is always black\n\t\t}\n\t\treturn len(key) + len(value), nil\n\t}\n\n\taddition, newRoot, previousSecondaryKeys := t.root.insert(key, value, secondaryKeys)\n\tif newRoot != nil {\n\t\tt.root = newRoot\n\t}\n\tt.root.colourIsRed = false // Can be flipped in the process of balancing, but root is always black\n\n\treturn addition, previousSecondaryKeys\n}", "title": "" }, { "docid": "09f21d92ae5fd3a74b70669d6c1bb16c", "score": "0.49856216", "text": "func ContainsNodeAddress(slice []types.NodeAddress, key types.NodeAddress) bool {\n\tfor _, v := range slice {\n\t\tif v == key {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "d73ad6f82c0265bf713478afbd84fe81", "score": "0.49673632", "text": "func (self *SuffixTree) mustBeValid() {\n\tqueue := []*node{self.root}\n\tfor len(queue) > 0 {\n\t\tn := queue[0]\n\t\tqueue = queue[1:]\n\t\tfor k, v := range n.children {\n\t\t\t// assert that each node's key is the leading character of the\n\t\t\t// string\n\t\t\tif k != self.nodeChar(v, 0) {\n\t\t\t\tpanic(fmt.Sprintf(\"Expected index %c for node %s. Got %c\",\n\t\t\t\t\tself.nodeChar(v, 0),\n\t\t\t\t\tself.nodeString(v),\n\t\t\t\t\tk))\n\t\t\t}\n\t\t\tqueue = append(queue, v.childNodes()...)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2fefc77cb61f97dad4728a37f1877851", "score": "0.49442118", "text": "func (snsa *SafeNodeStateArray) Insert(potential *NodeState) (closest bool) {\n\tsnsa.mux.Lock()\n\tdefer snsa.mux.Unlock()\n\tif snsa.exists[potential.NodeID] {\n\t\treturn false\n\t}\n\tsnsa.exists[potential.NodeID] = true\n\n\t*snsa.array = InsertOrdered(snsa.Target, *snsa.array, potential)\n\tif (*snsa.array)[0] == potential {\n\t\tclosest = true\n\t}\n\treturn\n}", "title": "" }, { "docid": "77c5b0394fdf8626424fa38dabe3aaf0", "score": "0.49403217", "text": "func TestInsert(t *testing.T) {\n\ttrie := NewTrie()\n\n\t// We need to have an empty tree to begin with.\n\tif trie.size != 0 {\n\t\tt.Errorf(\"expected size 0, got: %d\", trie.size)\n\t}\n\n\ttrie.Insert(\"key\")\n\ttrie.Insert(\"keyy\")\n\n\t// After inserting, we should have a size of two.\n\tif trie.size != 2 {\n\t\tt.Errorf(\"expected size 2, got: %d\", trie.size)\n\t}\n}", "title": "" }, { "docid": "ff1e6c35e6c14ae4e2508a35a21d95c2", "score": "0.4901146", "text": "func (tc *treeContext) insert(node *proto.RangeTreeNode) error {\n\tif tc.tree.RootKey == nil {\n\t\ttc.setRootKey(node.Key)\n\t} else {\n\t\t// Walk the tree to find the right place to insert the new node.\n\t\tcurrentKey := tc.tree.RootKey\n\t\tfor {\n\t\t\tcurrentNode, err := tc.getNode(currentKey)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif node.Key.Equal(currentNode.Key) {\n\t\t\t\treturn util.Errorf(\"key %s already exists in the range tree\", node.Key)\n\t\t\t}\n\t\t\tif node.Key.Less(currentNode.Key) {\n\t\t\t\tif currentNode.LeftKey == nil {\n\t\t\t\t\tcurrentNode.LeftKey = node.Key\n\t\t\t\t\ttc.setNode(currentNode)\n\t\t\t\t\tbreak\n\t\t\t\t} else {\n\t\t\t\t\tcurrentKey = currentNode.LeftKey\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif currentNode.RightKey == nil {\n\t\t\t\t\tcurrentNode.RightKey = node.Key\n\t\t\t\t\ttc.setNode(currentNode)\n\t\t\t\t\tbreak\n\t\t\t\t} else {\n\t\t\t\t\tcurrentKey = currentNode.RightKey\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tnode.ParentKey = currentKey\n\t\ttc.setNode(node)\n\t}\n\treturn tc.insertCase1(node)\n}", "title": "" }, { "docid": "b4011d325df62ada94439cf047dfb71c", "score": "0.4889228", "text": "func nodeSectionPositions(split []string, i int, nodes *[]*StructNode) {\n\ttemplateNodes := *nodes\n\tsplitThrice := strings.Split(split[i], \":\")\n\tif len(splitThrice) == 3 {\n\t\tidString := regexp.MustCompile(\"[0-9]+\").FindString(splitThrice[0])\n\t\tid, err := strconv.Atoi(idString)\n\t\tif err == nil {\n\t\t\tx, errX := strconv.Atoi(splitThrice[1])\n\t\t\ty, errY := strconv.Atoi(splitThrice[2])\n\t\t\tif errX == errY && errX == nil {\n\t\t\t\tfor search := 0; search < len(templateNodes); search++ {\n\t\t\t\t\tif templateNodes[search].GetID() == id {\n\t\t\t\t\t\ttemplateNodes[search].SetPosition(float64(x), float64(y))\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2fe95fc39fb2369cfd3ddffba97a63ca", "score": "0.48695007", "text": "func insert(root *TreeNode, key string, prefix int) {\n\tindex := findIndex(key[prefix:], root.LeftEdge)\n\tif index > 0 { // if index matches on left\n\t\tswitch m := root.Left.(type) {\n\t\tcase *LeafNode:\n\t\t\tif m.Key == key {\n\t\t\t\treturn\n\t\t\t}\n\t\t\troot.Left = insertHelper(m, root.LeftEdge, key, index, prefix)\n\t\t\troot.LeftEdge = root.LeftEdge[:index]\n\t\t\treturn\n\t\tcase *TreeNode:\n\t\t\tif index == len(root.LeftEdge) {\n\t\t\t\tinsert(m, key, prefix+index)\n\t\t\t\treturn\n\t\t\t}\n\t\t\troot.Left = insertHelper(m, root.LeftEdge, key, index, prefix)\n\t\t\troot.LeftEdge = root.LeftEdge[:index]\n\t\t\treturn\n\t\tdefault:\n\t\t\tprintln(\"DEFAULT CASE\")\n\t\t}\n\t}\n\n\tindex = findIndex(key[prefix:], root.RightEdge)\n\tif index > 0 { // if index matches on right\n\t\tswitch m := root.Right.(type) {\n\t\tcase *LeafNode:\n\t\t\tif m.Key == key {\n\t\t\t\treturn\n\t\t\t}\n\t\t\troot.Right = insertHelper(m, root.RightEdge, key, index, prefix)\n\t\t\troot.RightEdge = root.RightEdge[:index]\n\t\t\treturn\n\t\tcase *TreeNode:\n\t\t\tif index == len(root.RightEdge) {\n\t\t\t\tinsert(m, key, prefix+index)\n\t\t\t\treturn\n\t\t\t}\n\t\t\troot.Right = insertHelper(m, root.RightEdge, key, index, prefix)\n\t\t\troot.RightEdge = root.RightEdge[:index]\n\t\t\treturn\n\t\tdefault:\n\t\t\tprintln(\"DEFAULT CASE\")\n\t\t}\n\t} else {\n\t\t// No prefix is shared on either side, insert extension code\n\t\tswitch m := root.Right.(type) {\n\t\tcase *LeafNode:\n\t\t\tif m.Key == \"\" {\n\t\t\t\troot.Right = CreateLeafNode(key)\n\t\t\t\troot.RightEdge = key\n\t\t\t\treturn\n\t\t\t}\n\t\t\tgoto ExtensionNode\n\t\tcase *TreeNode:\n\t\t\tif root.RightEdge == \"\" {\n\t\t\t\tinsert(m, key, prefix)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tgoto ExtensionNode\n\t\tdefault:\n\t\t\tprintln(\"DEFAULT CASE\")\n\t\t}\n\tExtensionNode:\n\t\troot.Right = insertHelper(root.Right, root.RightEdge, key, index, prefix)\n\t\troot.RightEdge = \"\"\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "7bc24283051468a8a970277baabca7d3", "score": "0.48356476", "text": "func (h *HashRing) eltKey(elt string, idx int) string {\n\t// return elt + \"|\" + strconv.Itoa(idx)\n\treturn strconv.Itoa(idx) + elt\n}", "title": "" }, { "docid": "da1c0289e42d50e0c6f48d42dbba7d92", "score": "0.48268324", "text": "func mapKeysToNodes(conf *synctestConfig) {\n\tkmap := make(map[string][]int)\n\tnodemap := make(map[string][]int)\n\t//build a pot for chunk hashes\n\tnp := pot.NewPot(nil, 0)\n\tindexmap := make(map[string]int)\n\tfor i, a := range conf.addrs {\n\t\tindexmap[string(a)] = i\n\t\tnp, _, _ = pot.Add(np, a, pof)\n\t}\n\t//for each address, run EachNeighbour on the chunk hashes pot to identify closest nodes\n\tlog.Trace(fmt.Sprintf(\"Generated hash chunk(s): %v\", conf.hashes))\n\tfor i := 0; i < len(conf.hashes); i++ {\n\t\tpl := 256 //highest possible proximity\n\t\tvar nns []int\n\t\tnp.EachNeighbour([]byte(conf.hashes[i]), pof, func(val pot.Val, po int) bool {\n\t\t\ta := val.([]byte)\n\t\t\tif pl < 256 && pl != po {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tif pl == 256 || pl == po {\n\t\t\t\tlog.Trace(fmt.Sprintf(\"appending %s\", conf.addrToIdMap[string(a)]))\n\t\t\t\tnns = append(nns, indexmap[string(a)])\n\t\t\t\tnodemap[string(a)] = append(nodemap[string(a)], i)\n\t\t\t}\n\t\t\tif pl == 256 && len(nns) >= testMinProxBinSize {\n\t\t\t\t//maxProxBinSize has been reached at this po, so save it\n\t\t\t\t//we will add all other nodes at the same po\n\t\t\t\tpl = po\n\t\t\t}\n\t\t\treturn true\n\t\t})\n\t\tkmap[string(conf.hashes[i])] = nns\n\t}\n\tfor addr, chunks := range nodemap {\n\t\t//this selects which chunks are expected to be found with the given node\n\t\tconf.idToChunksMap[conf.addrToIdMap[addr]] = chunks\n\t}\n\tlog.Debug(fmt.Sprintf(\"Map of expected chunks by ID: %v\", conf.idToChunksMap))\n\tconf.chunksToNodesMap = kmap\n}", "title": "" }, { "docid": "1dcf76090efd256ee2caf8408b32dfe5", "score": "0.48209572", "text": "func (this *RandomizedSet) Insert(val int) bool {\n if _, ok := this.indexMap[val]; !ok {\n this.indexMap[val] = len(this.array)\n this.array = append(this.array, val)\n return true\n } else {\n return false\n }\n}", "title": "" }, { "docid": "6a0bdfc84b345cb4b50f330ab69c61d6", "score": "0.48160917", "text": "func (tree RBTree) findGE(key uint32) (uint32, bool) {\n\talloc := tree.storage()\n\tn := tree.root\n\tfor true {\n\t\tif n == 0 {\n\t\t\treturn 0, false\n\t\t}\n\t\tcomp := int(key) - int(alloc[n].item.Key)\n\t\tif comp == 0 {\n\t\t\treturn n, true\n\t\t} else if comp < 0 {\n\t\t\tif alloc[n].left != 0 {\n\t\t\t\tn = alloc[n].left\n\t\t\t} else {\n\t\t\t\treturn n, false\n\t\t\t}\n\t\t} else {\n\t\t\tif alloc[n].right != 0 {\n\t\t\t\tn = alloc[n].right\n\t\t\t} else {\n\t\t\t\tsucc := doNext(n, alloc)\n\t\t\t\tif succ == 0 {\n\t\t\t\t\treturn 0, false\n\t\t\t\t}\n\t\t\t\treturn succ, key == alloc[succ].item.Key\n\t\t\t}\n\t\t}\n\t}\n\tpanic(\"should not reach here\")\n}", "title": "" }, { "docid": "27ed9ce8a1f49c51b5e82dc202f5046d", "score": "0.48057872", "text": "func (tree *RbTree) find(key RbKey) *rbNode {\n for node := tree.root; node != nil; { \n switch key.ComparedTo(node.key) {\n case KeyIsLess:\n node = node.left\n case KeyIsGreater:\n node = node.right\n default:\n return node\n } \n }\n return nil\n}", "title": "" }, { "docid": "8db541810e4a0ec984e84c7085d8165c", "score": "0.48027933", "text": "func (n *leafPageElement) key() []byte {\n\tbuf := (*[maxAllocSize]byte)(unsafe.Pointer(n))\n\treturn (*[maxAllocSize]byte)(unsafe.Pointer(&buf[n.pos]))[:n.ksize:n.ksize]\n}", "title": "" }, { "docid": "82b6e1e8bb8c5a5876eda70370aaecfb", "score": "0.47916237", "text": "func (this HashTable) findWith(hash int, key int) (bool, int) {\n\ti := 0\n\tfound := false\n\tend := false\n\tvar position int\n\n\tfor i < this.size && !found && !end {\n\t\tposition = (hash + i) % this.size\n\n\t\tif this.isNull(this.array[position]) {\n\t\t\tend = true\n\t\t} else {\n\t\t\tif !this.array[position].isDeleted && this.array[position].key == key {\n\t\t\t\tfound = true\n\t\t\t}\n\t\t}\n\n\t\ti++\n\t}\n\n\treturn found, position\n}", "title": "" }, { "docid": "2b94c09ac173a5b3efd2e530a6857607", "score": "0.4788463", "text": "func (h *MinHeap) Insert(elem Elem) int {\n\ti := len(h.elems)\n\th.elems = append(h.elems, elem)\n\n\tfor {\n\t\tif i == 0 {\n\t\t\treturn 0\n\t\t}\n\t\tparent := (i+1)/2 - 1\n\t\tif h.elems[parent].Key <= h.elems[i].Key {\n\t\t\treturn i\n\t\t}\n\n\t\t// swap i and parent\n\t\ttmp := h.elems[i]\n\t\th.elems[i] = h.elems[parent]\n\t\th.elems[parent] = tmp\n\t\ti = parent\n\t}\n}", "title": "" }, { "docid": "0d766addb17da38a1bd1386d294f559a", "score": "0.4776335", "text": "func (l *List) verifyElements(ctx context.Context, bs blobstore.Store, segs *segments) error {\n\tctx = log.WithFn(ctx)\n\tl.RLock()\n\tstore := blobstore.StoreWithSet(bs, l.Set)\n\tl.RUnlock()\n\tvar ids map[ElementID]SegmentID\n\n\t// We do not get the update lock since caller may be holding it.\n\terr := segs.scores.VerifyElements(ctx, store, &ids)\n\tif err != nil {\n\t\treturn ScoreError(fmt.Errorf(\"Verifying Score Elements: %v\", err))\n\t}\n\tvar idxids map[ElementID]SegmentID\n\terr = segs.index.VerifyElements(ctx, store, &idxids)\n\tif err != nil {\n\t\treturn IndexError(fmt.Errorf(\"Verifying Index Elements: %v\", err))\n\t}\n\tfor id, segid := range ids {\n\t\tif isegid, ok := idxids[id]; !ok {\n\t\t\treturn IndexError(fmt.Errorf(\"Object %v was not indexed\", id))\n\t\t} else {\n\t\t\tif segid != isegid {\n\t\t\t\treturn IndexError(fmt.Errorf(\"Object %v is indexed to wrong segment (want:%v != got:%v)\", id, segid, isegid))\n\t\t\t}\n\t\t}\n\t\tdelete(idxids, id)\n\t}\n\tfor id := range idxids {\n\t\treturn IndexError(fmt.Errorf(\"Extra object ID %d found\", id))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "66601054599cd229b9c3dd04eb681694", "score": "0.47675544", "text": "func findNodeIndex(r []uint32, d uint32) int {\n\tfor i, v := range r {\n\t\tif v == d {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "9f046802cf581e9f99b7b720289001d4", "score": "0.47660106", "text": "func (n Nodes) indexOf(key string) int {\n\tfor i, node := range n {\n\t\tif node.Key == key {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "e7d3561bc2712f5ecc588104b01b578a", "score": "0.47654304", "text": "func (c *Consistent) eltKey(elt string, idx int) string {\n\treturn strconv.Itoa(idx) + elt\n}", "title": "" }, { "docid": "35644253ace861a7707085597afa65c4", "score": "0.47578213", "text": "func findInMap(node *yaml.Node, key string, traversed pointer) (int, error) {\n\tfor i := 0; i < len(node.Content); i += 2 {\n\t\tif node.Content[i].Value == key {\n\t\t\treturn i, nil\n\t\t}\n\t}\n\n\treturn 0, fmt.Errorf(\"key %q: %q not found in map\", strings.Join(traversed, jsonPointerSeparator), key)\n}", "title": "" }, { "docid": "07fdbbe8c3add50abdc16edb56e4b383", "score": "0.47563937", "text": "func (n *Node) split() {\n\tif len(n.elements) <= elementSize {\n\t\treturn\n\t}\n\tif len(n.elements) > 1 && n.elements[len(n.elements)-2].Lat == n.elements[len(n.elements)-1].Lat && n.elements[len(n.elements)-2].Lon == n.elements[len(n.elements)-1].Lon {\n\t\t// Allow multiple objects at the same location - the first one inserted will be returned. TODO warn?\n\t\treturn\n\t}\n\n\tleftMid := (n.right-n.left)/2 + n.left\n\ttopMid := (n.top-n.bottom)/2 + n.bottom\n\tn.topLeft = &Node{left: n.left, right: leftMid, top: n.top, bottom: topMid}\n\tn.topRight = &Node{left: leftMid, right: n.right, top: n.top, bottom: topMid}\n\tn.bottomLeft = &Node{left: n.left, right: leftMid, top: topMid, bottom: n.bottom}\n\tn.bottomRight = &Node{left: leftMid, right: n.right, top: topMid, bottom: n.bottom}\n\tfor _, e := range n.elements {\n\t\tn.insertAppropriateChild(e)\n\t}\n\tn.elements = nil\n}", "title": "" }, { "docid": "ba0317f4ef1e8d18dd0f207664e9706f", "score": "0.47553337", "text": "func testAddSubKey(t *testing.T) {\n\t// 1. define test data.\n\ttestData := []testSubKeyData{\n\t\t{\n\t\t\td: \"string\",\n\t\t\tkey: kv{\n\t\t\t\tk: []byte(\"addsubkeys1_parent_string\"),\n\t\t\t\tv: []byte(\"p1_string\"),\n\t\t\t\tp: \"\",\n\t\t\t\ts: true,\n\t\t\t},\n\t\t\tskey: kv{\n\t\t\t\tk: []byte(\"addsubkeys1_sub1_string\"),\n\t\t\t\tv: []byte(\"s1_string\"),\n\t\t\t\tp: \"\",\n\t\t\t\ts: true,\n\t\t\t},\n\t\t\ts: true,\n\t\t},\n\t}\n\tfor i, d := range testData {\n\t\tif !d.s {\n\t\t\tif ok, err := clearIfExists(d.key.k); !ok {\n\t\t\t\tt.Errorf(\"clearIfExists(%q) = (%v, %v)\", d.key.k, ok, err)\n\t\t\t}\n\t\t\tif ok, err := saveData(d.key.k, d.key.v, d.key.p); !ok {\n\t\t\t\tt.Errorf(\"saveData(%q, %q, %q) = (%v, %v)\", d.key.k, d.key.v, d.key.p, ok, err)\n\t\t\t}\n\t\t\ttestAddSubKeyArgs(d, t)\n\t\t\tcnt, keypack, err := callGetSubkeys(d.key.k)\n\t\t\t// make sure cnt is correct.\n\t\t\tif cnt == 0 {\n\t\t\t\tt.Errorf(\"callGetSubkeys(%q) should return 1, but returned %v keypack %v err %v\", d.key.k, cnt, keypack, err)\n\t\t\t}\n\t\t\tif cnt == 1 && !bytes.Equal(d.skey.k, keypack[i]) {\n\t\t\t\tt.Errorf(\"callGetSubkeys(%q) should match d.skey.k %v with keypack %v\", d.key.k, d.skey.k, keypack[i])\n\t\t\t}\n\t\t} else {\n\t\t\t// TODO string\n\t\t\tif ok, err := clearIfExists(string(d.key.k)); !ok {\n\t\t\t\tt.Errorf(\"clearIfExists(%q) = (%v, %v)\", string(d.key.k), ok, err)\n\t\t\t}\n\t\t\tif ok, err := saveData(string(d.key.k), string(d.key.v), d.key.p); !ok {\n\t\t\t\tt.Errorf(\"saveData(%q, %q, %q) = (%v, %v)\", string(d.key.k), string(d.key.v), d.key.p, ok, err)\n\t\t\t}\n\t\t\ttestAddSubKeyArgs(d, t)\n\t\t\tcnt, keypack, err := callGetSubkeysString(string(d.key.k))\n\t\t\t// make sure cnt is correct.\n\t\t\tif cnt == 0 {\n\t\t\t\tt.Errorf(\"callGetSubkeys(%q) should return 1, but returned %v keypack %v err %v\", string(d.key.k), cnt, keypack, err)\n\t\t\t}\n\t\t\tif cnt == 1 && string(d.skey.k) != string(keypack[i]) {\n\t\t\t\tt.Errorf(\"callGetSubkeys(%q) should match d.skey.k %v with keypack %v\", string(d.key.k), string(d.skey.k), string(keypack[i]))\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b8726cf83e47fee1e37111918e62451d", "score": "0.47503036", "text": "func (n *binarySearchNode) insert(key, value []byte, secondaryKeys [][]byte) (netAdditions int, newRoot *binarySearchNode, previousSecondaryKeys [][]byte) {\n\tif bytes.Equal(key, n.key) {\n\t\t// since the key already exists, we only need to take the difference\n\t\t// between the existing value and the new one to determine net change\n\t\tnetAdditions = len(n.value) - len(value)\n\t\tif netAdditions < 0 {\n\t\t\tnetAdditions *= -1\n\t\t}\n\n\t\t// assign new value to node\n\t\tn.value = value\n\n\t\t// reset tombstone in case it had one\n\t\tn.tombstone = false\n\t\tpreviousSecondaryKeys = n.secondaryKeys\n\t\tn.secondaryKeys = secondaryKeys\n\n\t\tnewRoot = nil // tree root does not change when replacing node\n\t\treturn\n\t}\n\n\tif bytes.Compare(key, n.key) < 0 {\n\t\tif n.left != nil {\n\t\t\tnetAdditions, newRoot, previousSecondaryKeys = n.left.insert(key, value, secondaryKeys)\n\t\t\treturn\n\t\t} else {\n\t\t\tn.left = &binarySearchNode{\n\t\t\t\tkey: key,\n\t\t\t\tvalue: value,\n\t\t\t\tsecondaryKeys: secondaryKeys,\n\t\t\t\tparent: n,\n\t\t\t\tcolourIsRed: true, // new nodes are always red, except root node which is handled in the tree itself\n\t\t\t}\n\t\t\tnewRoot = binarySearchNodeFromRB(rbtree.Rebalance(n.left))\n\t\t\tnetAdditions = len(key) + len(value)\n\t\t\treturn\n\t\t}\n\t} else {\n\t\tif n.right != nil {\n\t\t\tnetAdditions, newRoot, previousSecondaryKeys = n.right.insert(key, value, secondaryKeys)\n\t\t\treturn\n\t\t} else {\n\t\t\tn.right = &binarySearchNode{\n\t\t\t\tkey: key,\n\t\t\t\tvalue: value,\n\t\t\t\tsecondaryKeys: secondaryKeys,\n\t\t\t\tparent: n,\n\t\t\t\tcolourIsRed: true,\n\t\t\t}\n\t\t\tnetAdditions = len(key) + len(value)\n\t\t\tnewRoot = binarySearchNodeFromRB(rbtree.Rebalance(n.right))\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6a3800a9f0505a760f234fdea33080c9", "score": "0.47452366", "text": "func checkNodeExistence(tree *Tree, start, end int64) {\n\tmaxLevel := calcMaxLevel(end)\n\tfor level := FirstLevelAboveTwig; level <= maxLevel; level++ {\n\t\ts := maxNAtLevel(start, level)\n\t\te := maxNPlus1AtLevel(end, level)\n\t\t//fmt.Printf(\"Fuck level %d s %d e %d\\n\", level, s, e)\n\t\tfor i := s; i < e; i++ {\n\t\t\tnodePos := Pos(level, i)\n\t\t\tif _, ok := tree.nodes[nodePos]; !ok {\n\t\t\t\tfmt.Printf(\"Why? we cannot find node at %d-%d\\n\", level, i)\n\t\t\t\tpanic(fmt.Sprintf(\"Why? we cannot find node at %d-%d\\n\", level, i))\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8ad81bb458a436bd5de649dd01bd042a", "score": "0.47421533", "text": "func searchInsert(nums []int, target int) int {\n\t// Accepted\n\t// 62/62 cases passed (0 ms)\n\t// Your runtime beats 100 % of golang submissions\n\t// Your memory usage beats 58.73 % of golang submissions (3.1 MB)\n\ti, l := 0, len(nums)\n\tfor i < l {\n\t\tif nums[i] >= target {\n\t\t\treturn i\n\t\t}\n\t\ti += 1\n\t}\n\treturn l\n}", "title": "" }, { "docid": "68570aad326b998835b1f7f578d4cdba", "score": "0.47408685", "text": "func TestPredecessor(t *testing.T) {\n\tring := NewRing()\n\tnodes := createNodes()\n\taddNodesToTree(ring, nodes)\n\tkeysShouldBe := getKeysShouldBe(nodes)\n\n\tfor i, _ := range keysShouldBe {\n\t\tnode, _ := ring.Predecessor(keysShouldBe[i])\n\t\tnode2, _ := ring.Get(keysShouldBe[(i-1+len(keysShouldBe))%len(keysShouldBe)])\n\t\tassert.Equal(t, node, node2)\n\t}\n}", "title": "" }, { "docid": "ea1cd7ec63b090d2b8ead9ea3a034bf4", "score": "0.47381732", "text": "func (tree *RBTree) doInsert(item Item) uint32 {\n\tif tree.root == 0 {\n\t\tn := tree.allocator.malloc()\n\t\ttree.storage()[n].item = item\n\t\ttree.root = n\n\t\ttree.minNode = n\n\t\ttree.maxNode = n\n\t\ttree.count++\n\t\treturn n\n\t}\n\tparent := tree.root\n\tstorage := tree.storage()\n\tfor true {\n\t\tparentNode := storage[parent]\n\t\tcomp := int(item.Key) - int(parentNode.item.Key)\n\t\tif comp == 0 {\n\t\t\treturn 0\n\t\t} else if comp < 0 {\n\t\t\tif parentNode.left == 0 {\n\t\t\t\tn := tree.allocator.malloc()\n\t\t\t\tstorage = tree.storage()\n\t\t\t\tnewNode := &storage[n]\n\t\t\t\tnewNode.item = item\n\t\t\t\tnewNode.parent = parent\n\t\t\t\tstorage[parent].left = n\n\t\t\t\ttree.count++\n\t\t\t\ttree.maybeSetMinNode(n)\n\t\t\t\treturn n\n\t\t\t}\n\t\t\tparent = parentNode.left\n\t\t} else {\n\t\t\tif parentNode.right == 0 {\n\t\t\t\tn := tree.allocator.malloc()\n\t\t\t\tstorage = tree.storage()\n\t\t\t\tnewNode := &storage[n]\n\t\t\t\tnewNode.item = item\n\t\t\t\tnewNode.parent = parent\n\t\t\t\tstorage[parent].right = n\n\t\t\t\ttree.count++\n\t\t\t\ttree.maybeSetMaxNode(n)\n\t\t\t\treturn n\n\t\t\t}\n\t\t\tparent = parentNode.right\n\t\t}\n\t}\n\tpanic(\"should not reach here\")\n}", "title": "" }, { "docid": "2468cd3e7b659e6042771a24ff86b66c", "score": "0.47332716", "text": "func (t *BTree) Insert(key uint32, value []byte, noder Noder) {\n\trootNode := noder.Read(t.rootNodeID)\n\tnodes := t.lookup([]Node{rootNode}, key, noder)\n\tleafNode := nodes[len(nodes)-1].(*LeafNode)\n\tnodes = nodes[:len(nodes)-1]\n\tkeys := leafNode.Keys()\n\tnewTuples := append(leafNode.Tuples(), &Tuple{key, value})\n\tsort.Sort(ByKey(newTuples))\n\n\tif len(keys) < t.capacityPerLeafNode {\n\t\tleafNode.Update(newTuples, leafNode.PrevNodeID(), leafNode.NextNodeID())\n\t} else {\n\t\tmidIdx := len(newTuples) / 2\n\t\tleafNode2 := noder.NewLeafNode(newTuples[midIdx:])\n\t\tleafNode2.Update(newTuples[midIdx:], leafNode.ID(), leafNode.NextNodeID())\n\t\tleafNode.Update(newTuples[0:midIdx], leafNode.PrevNodeID(), leafNode2.ID())\n\t\tnodeID := leafNode2.ID()\n\t\tmiddleKey := newTuples[midIdx].key\n\n\t\tif len(nodes) == 0 {\n\t\t\tt.newRoot(middleKey, []uint32{leafNode.ID(), nodeID}, noder)\n\n\t\t} else {\n\t\t\tfor i := len(nodes); i > 0; i-- {\n\t\t\t\tparentNode := nodes[i-1].(*InternalNode)\n\t\t\t\tresult := t.addChildrenToInternalNode(middleKey, nodeID, parentNode, noder)\n\t\t\t\tif result.splited == false {\n\t\t\t\t\tbreak\n\t\t\t\t} else {\n\t\t\t\t\tmiddleKey = result.middleKey\n\t\t\t\t\tnodeID = result.newNodeId\n\t\t\t\t\tif t.RootNode(noder) == parentNode {\n\t\t\t\t\t\tt.newRoot(middleKey, []uint32{parentNode.id, nodeID}, noder)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "45fc7b77850e9a2518debaa82e48feb9", "score": "0.4730973", "text": "func (s *SkipList) Insert(key string) {\r\n\thas_key, update := s.searchImpl(key)\r\n\tif !has_key {\r\n\t\theight := RandomHeight()\r\n\t\tif height > s.height {\r\n\t\t\tfor i := s.height; i < height; i++ {\r\n\t\t\t\tupdate[i] = s.head\r\n\t\t\t}\r\n\t\t\ts.height = height\r\n\t\t}\r\n\t\tnew_node := NewNode(height)\r\n\t\tnew_node.key = key\r\n\t\tfor i := 0; i < height; i++ {\r\n\t\t\tnew_node.next[i] = update[i].next[i]\r\n\t\t\tupdate[i].next[i] = new_node\r\n\t\t}\r\n\t}\r\n}", "title": "" }, { "docid": "1478e593624c47b2186bc4e8335e1b52", "score": "0.4728008", "text": "func (r *radixAccess) insert(key,value []byte) {\n\tr.decodeRoot()\n\tparent := r.head\n\tfor {\n\t\tif len(key)==0 {\n\t\t\tif parent.leafEx_v!=0 && !parent.leafEx_v.inlined() {\n\t\t\t\tr.tx.db.freelist.free(r.tx.meta.txid,r.tx.page(pgid(parent.leafEx_v.offset())))\n\t\t\t}\n\t\t\tparent.leafIn = value\n\t\t}\n\t\ti,ok := radixBinSearch(&parent.edges_k,int(parent.n_edges),key[0])\n\t\tif !ok {\n\t\t\ti,_ = parent.insert(key[0])\n\t\t\tparent.edges_v[i] = 0\n\t\t\tparent.edges_p[i] = &radixNode{\n\t\t\t\tprefix: cloneBytes(key),\n\t\t\t\tleafIn: value,\n\t\t\t}\n\t\t\t\n\t\t\treturn\n\t\t}\n\t\tr.decodeChild2(parent.edges_v[i],&parent.edges_p[i])\n\t\tm := parent.edges_p[i]\n\t\tl := radixLongestPrefix(m.prefix,key)\n\t\tif l<len(m.prefix) {\n\t\t\tn := new(radixNode)\n\t\t\t*n = *m\n\t\t\t*m = radixNode{}\n\t\t\tm.prefix = n.prefix[:l]\n\t\t\tn.prefix = n.prefix[l:]\n\t\t\tm.n_edges = 0\n\t\t\ti,_ := m.insert(n.prefix[0])\n\t\t\tm.edges_p[i] = n\n\t\t\tm.edges_v[i] = 0\n\t\t\tif l<len(key) {\n\t\t\t\to := &radixNode{\n\t\t\t\t\tprefix: cloneBytes(key[l:]),\n\t\t\t\t\tleafIn: value,\n\t\t\t\t}\n\t\t\t\ti,_ := m.insert(key[l])\n\t\t\t\tm.edges_p[i] = o\n\t\t\t\tm.edges_v[i] = 0\n\t\t\t} else {\n\t\t\t\tm.leafIn = value\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tkey = key[l:]\n\t\tparent = m\n\t}\n}", "title": "" }, { "docid": "5b4fecdda8628c3e7d0889629aaaecdc", "score": "0.47228718", "text": "func searchInsert(nums []int, target int) int {\n\tmid := 0\n\tleft := 0\n\tright := len(nums) - 1\n\tfor left <= right {\n\t\tmid = left + (right-left)/2\n\n\t\tif target == nums[mid] {\n\t\t\treturn mid\n\t\t} else if target > nums[mid] {\n\t\t\tleft = mid + 1\n\t\t} else if target < nums[mid] {\n\t\t\tright = mid - 1\n\t\t}\n\t}\n\treturn left\n}", "title": "" }, { "docid": "2a860b66a9fca41f40a828c197906e4f", "score": "0.47195935", "text": "func TestInsertBinarySearchTree(testCase *testing.T) {\n\ttestCase.Log(\"To test the construction of binary search tree using InsertBinarySearchTree\")\n\tvar tree *Node\n\ttree = nil\n\n\tif tree, err = InsertBinarySearchTree(tree, 5); err != nil {\n\t\ttestCase.Errorf(\"Tree Error: %s\", err)\n\t}\n\tif tree.data != 5 || tree.left != nil || tree.right != nil {\n\t\ttestCase.Errorf(\"Tree Error: Node not allocated the correct value\")\n\t}\n\n\ttree, _ = InsertBinarySearchTree(tree, 2)\n\ttree, _ = InsertBinarySearchTree(tree, 4)\n\ttree, _ = InsertBinarySearchTree(tree, 7)\n\ttree, _ = InsertBinarySearchTree(tree, 6)\n\n\tif tree.left.data != 2 || tree.right.data != 7 {\n\t\ttestCase.Errorf(\"Tree Error: Binary search tree not created correctly\")\n\t}\n\tif tree.left.right.data != 4 || tree.right.left.data != 6 {\n\t\ttestCase.Errorf(\"Tree Error: Binary search tree not created correctly\")\n\t}\n\n\tif tree, err = InsertBinarySearchTree(tree, 2); err == nil {\n\t\ttestCase.Errorf(\"Tree Error: Duplicate Node error not reported\")\n\t}\n}", "title": "" }, { "docid": "e0a9d94e9b6c4ebae25478b6d51d722e", "score": "0.47116968", "text": "func TestAddKey(t *testing.T) {\n\tcases := map[string]struct{ A, B, Expected int }{\n\t\t\"foo\": {1, 1, 2},\n\t\t\"bar\": {1, -1, 0},\n\t}\n\n\tfor k, tc := range cases {\n\t\tactual := tc.A + tc.B\n\t\tif actual != expected {\n\t\t\tt.Errorf(\n\t\t\t\t\"%s: %d + %d = %d, expected %d\",\n\t\t\t\tk, tc.A, tc.B, actual, tc.Expected,\n\t\t\t)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b4fafad7b9458f2e0fbae34108032812", "score": "0.47109592", "text": "func (mpt *MerklePatriciaTrie) Insert(key string, nodeValue string) {\n\tkeyPath := ConvertStringToHexArray(key)\n\tif len(keyPath) == 0 {\n\t\tif mpt.Root == \"\" {\n\t\t\trootNode := CreateNewLeafNodeWithValue(keyPath, nodeValue)\n\t\t\tmpt.Root = rootNode.hash_node()\n\t\t\tmpt.DB[mpt.Root] = rootNode\n\t\t} else {\n\t\t\trootNode := mpt.GetNodeByHashCode(mpt.Root)\n\t\t\tif rootNode.IsBranch() {\n\t\t\t\tdelete(mpt.DB, mpt.Root)\n\t\t\t\trootNode.branch_value[16] = nodeValue\n\t\t\t\tmpt.Root = rootNode.hash_node()\n\t\t\t\tmpt.DB[mpt.Root] = rootNode\n\t\t\t} else {\n\t\t\t\tnewRootNode := mpt.MergeLE(rootNode, keyPath, nodeValue)\n\t\t\t\tmpt.Root = newRootNode.hash_node()\n\t\t\t}\n\t\t}\n\t} else if mpt.Root == \"\" {\n\t\trootNode := CreateNewLeafNodeWithValue(keyPath, nodeValue)\n\t\tmpt.Root = rootNode.hash_node()\n\t\tmpt.DB[mpt.Root] = rootNode\n\t} else {\n\t\tnodePath, remainingPath := mpt.GetNodePath(keyPath, mpt.Root)\n\t\tif len(nodePath) == 0 {\n\t\t\trootNode := mpt.GetNodeByHashCode(mpt.Root)\n\t\t\tif rootNode.IsBranch() {\n\t\t\t\tchildNode := CreateNewLeafNodeWithValue(keyPath[1:], nodeValue)\n\t\t\t\tchildHash := childNode.hash_node()\n\t\t\t\tmpt.DB[childHash] = childNode\n\t\t\t\trootNode.branch_value[keyPath[0]] = childHash\n\t\t\t\tdelete(mpt.DB, mpt.Root)\n\t\t\t\tmpt.Root = rootNode.hash_node()\n\t\t\t\tmpt.DB[mpt.Root] = rootNode\n\t\t\t} else {\n\t\t\t\tnewRootNode := mpt.MergeLE(rootNode, remainingPath, nodeValue)\n\t\t\t\tmpt.Root = newRootNode.hash_node()\n\t\t\t}\n\t\t} else {\n\t\t\tlastPrefixNode := nodePath[len(nodePath)-1]\n\t\t\tif lastPrefixNode.IsBranch() {\n\t\t\t\tif len(remainingPath) == 0 {\n\t\t\t\t\tmpt.ModifyHashChain(nodePath, 16, nodeValue)\n\t\t\t\t} else if lastPrefixNode.branch_value[remainingPath[0]] == \"\" {\n\t\t\t\t\tnewLeafNode := CreateNewLeafNodeWithValue(remainingPath[1:], nodeValue)\n\t\t\t\t\tnewLeafNodeHash := newLeafNode.hash_node()\n\t\t\t\t\tmpt.DB[newLeafNodeHash] = newLeafNode\n\t\t\t\t\tmpt.ModifyHashChain(nodePath, remainingPath[0], newLeafNodeHash)\n\t\t\t\t} else {\n\t\t\t\t\tchildNode := mpt.GetNodeByHashCode(lastPrefixNode.branch_value[remainingPath[0]])\n\t\t\t\t\tnewChildNode := mpt.MergeLE(childNode, remainingPath[1:], nodeValue)\n\t\t\t\t\tmpt.ModifyHashChain(nodePath, remainingPath[0], newChildNode.hash_node())\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif lastPrefixNode.IsLeaf() == false {\n\t\t\t\t\tfmt.Println(\"The last node on a prefix path cannot be an extension: \", nodePath)\n\t\t\t\t}\n\t\t\t\tlastPrefixNodeHash := lastPrefixNode.hash_node()\n\t\t\t\tnewLastPrefixNode := mpt.MergeLE(\n\t\t\t\t\tlastPrefixNode,\n\t\t\t\t\tappend(compact_decode(lastPrefixNode.flag_value.encoded_prefix), remainingPath...),\n\t\t\t\t\tnodeValue)\n\t\t\t\tif len(nodePath) == 1 {\n\t\t\t\t\tmpt.Root = newLastPrefixNode.hash_node()\n\t\t\t\t} else {\n\t\t\t\t\tparentNode := nodePath[len(nodePath)-2]\n\t\t\t\t\tchildIndex := parentNode.GetBranchChildIndex(lastPrefixNodeHash)\n\t\t\t\t\tmpt.ModifyHashChain(nodePath[:len(nodePath)-1], childIndex, newLastPrefixNode.hash_node())\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4826d5cd6a45e33e64124266b213bfef", "score": "0.47106293", "text": "func testDumpElementTable(t *testing.T) {\n\t// 1. Instantiate K2hash class\n\tf, err := k2hash.NewK2hash(\"/tmp/test.k2h\")\n\tif f == nil {\n\t\tdefer f.Close()\n\t\tt.Errorf(\"k2hash.NewK2hash(/tmp/test.k2h) = (nil, error), want not nil\")\n\t}\n\tif err != nil {\n\t\tt.Errorf(\"k2hash.NewK2hash(/tmp/test.k2h) error %v\", err)\n\t}\n\n\t// 2. set\n\tf.DumpElementTable()\n}", "title": "" }, { "docid": "37956287efdf0b7bcb7cf770fb3b32f3", "score": "0.46923614", "text": "func (i *IterUintptrUintptr) Seek(key uintptr) {\n\tkey = i.t.transformKey(key)\n\ti.Reset()\n\tif i.t.length == 0 {\n\t\treturn\n\t}\n\t// Walk down tree until leaf node is found or critical bit differs\n\tvar last = &i.t.root\n\tfor last.crit != ^uint(0) && last.findCrit(key) == last.crit {\n\t\ti.nodes = append(i.nodes, last)\n\t\tlast = &last.children()[last.dir(key)]\n\t}\n\t// Done if last node matches key\n\tif last.crit == ^uint(0) && key == last.key {\n\t\ti.nodes = append(i.nodes, last)\n\t\treturn\n\t}\n\t// No exact match for key found. Check if correct node would be left (smaller key) or right (larger key) of the last one.\n\tvar dir = 0\n\tif i.t.transformKey(key) > i.t.transformKey(last.key) {\n\t\tdir = 1\n\t}\n\t// Walk upwards until the shared parent of previous and next key is found.\n\tfor l := len(i.nodes); l > 0; l-- {\n\t\t// The shared parent has the last removed node as a child on the opposite side of the direction where the correct node would be.\n\t\tif &i.nodes[l-1].children()[1-dir] == last {\n\t\t\treturn\n\t\t}\n\t\tlast = i.nodes[l-1]\n\t\ti.nodes = i.nodes[0 : l-1]\n\t}\n\t// There are no other keys as high or low as the correct one. Simulate a Next or Prev call that reached the end\n\ti.lastDir = 0\n\tif i.t.transformKey(key) > i.t.transformKey(last.key) {\n\t\ti.lastDir = 1\n\t}\n}", "title": "" }, { "docid": "ac1b83f8c15300173a7d158c858e2976", "score": "0.46868894", "text": "func searchInsert(nums []int, target int) int {\n\ti, j := 0, len(nums)-1\n\tfor i <= j {\n\t\tm := i + (j-i)/2\n\t\tif target == nums[m] {\n\t\t\treturn m\n\t\t} else if 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\treturn i\n}", "title": "" }, { "docid": "887f998772f6ead98f9f7174ab38bcae", "score": "0.46861458", "text": "func btreeExample1() {\n\titems := []int{5, 9, 2, 4, 11, 6}\n\ttr := btree.New(2)\n\n\tfmt.Printf(\"tr.Size(): %d\\n\", tr.Size()) // should be 0 in the beginning\n\n\t// Insert values\n\tfmt.Printf(\"Inserting %d items: %v\\n\", len(items), items)\n\tfor _, item := range items {\n\t\ttr.ReplaceOrInsert(item)\n\t}\n\n\t// Search values\n\tfmt.Printf(\" tr.Size(): %d\\n\", tr.Size()) // should be len(items): 6 now\n\tfmt.Printf(\" tr.Min(): %v\\n\", tr.Min()) // should be 2\n\tfmt.Printf(\" tr.Max(): %v\\n\", tr.Max()) // should be 11\n\tfmt.Printf(\" tr.Has(6): %t\\n\", tr.Has(6)) // true\n\tfmt.Printf(\" tr.Get(6): %v\\n\", tr.Get(6)) // 6\n\tfmt.Printf(\" tr.Has(7): %t\\n\", tr.Has(7)) // false\n\tfmt.Printf(\" tr.Get(7): %v\\n\", tr.Get(7)) // nil\n\n\t// Delete values\n\tfmt.Println(\"Deleting items:\")\n\tfmt.Printf(\" tr.DeleteMin(): %v\\n\", tr.DeleteMin()) // 2 is deleted and returned\n\tfmt.Printf(\" tr.Min(): %v\\n\", tr.Min()) // should be 4 now\n\tfmt.Printf(\" tr.DeleteMax(): %v\\n\", tr.DeleteMax()) // 11 is deleted and returned\n\tfmt.Printf(\" tr.Max(): %v\\n\", tr.Max()) // should be 9 now\n\tfmt.Printf(\" tr.Delete(6): %v\\n\", tr.Delete(6)) // 6 is deleted and returned\n\tfmt.Printf(\" tr.Delete(7): %v\\n\", tr.Delete(7)) // 7 doesn't exist, so nil is returned\n\n\tfmt.Printf(\"tr.Size(): %d\\n\", tr.Size()) // should be 3 now because 3 items have already been removed\n}", "title": "" }, { "docid": "27a05ffb7fc0d28e7f03e9df23d7004d", "score": "0.46846572", "text": "func TestSuccessor(t *testing.T) {\n\tring := NewRing()\n\tnodes := createNodes()\n\taddNodesToTree(ring, nodes)\n\tkeysShouldBe := getKeysShouldBe(nodes)\n\n\tfor i, _ := range keysShouldBe {\n\t\tnode, _ := ring.Successor(keysShouldBe[i])\n\t\tnode2, _ := ring.Get(keysShouldBe[(i+1)%len(keysShouldBe)])\n\t\tassert.Equal(t, node, node2)\n\t}\n}", "title": "" }, { "docid": "cc9c5b3f0148e71678ffd9e285b88360", "score": "0.46678472", "text": "func (i *IterUintptrError) Seek(key uintptr) {\n\tkey = i.t.transformKey(key)\n\ti.Reset()\n\tif i.t.length == 0 {\n\t\treturn\n\t}\n\t// Walk down tree until leaf node is found or critical bit differs\n\tvar last = &i.t.root\n\tfor last.crit != ^uint(0) && last.findCrit(key) == last.crit {\n\t\ti.nodes = append(i.nodes, last)\n\t\tlast = &last.children()[last.dir(key)]\n\t}\n\t// Done if last node matches key\n\tif last.crit == ^uint(0) && key == last.key {\n\t\ti.nodes = append(i.nodes, last)\n\t\treturn\n\t}\n\t// No exact match for key found. Check if correct node would be left (smaller key) or right (larger key) of the last one.\n\tvar dir = 0\n\tif i.t.transformKey(key) > i.t.transformKey(last.key) {\n\t\tdir = 1\n\t}\n\t// Walk upwards until the shared parent of previous and next key is found.\n\tfor l := len(i.nodes); l > 0; l-- {\n\t\t// The shared parent has the last removed node as a child on the opposite side of the direction where the correct node would be.\n\t\tif &i.nodes[l-1].children()[1-dir] == last {\n\t\t\treturn\n\t\t}\n\t\tlast = i.nodes[l-1]\n\t\ti.nodes = i.nodes[0 : l-1]\n\t}\n\t// There are no other keys as high or low as the correct one. Simulate a Next or Prev call that reached the end\n\ti.lastDir = 0\n\tif i.t.transformKey(key) > i.t.transformKey(last.key) {\n\t\ti.lastDir = 1\n\t}\n}", "title": "" }, { "docid": "a19bdc4a55432527992cc59b763b7fc3", "score": "0.4656769", "text": "func TestInsertIntoEmpty(t *testing.T) {\n\tassert := assert.New(t)\n\tsk := skiplist.New(IntNodeComparator, 8)\n\tdump(\"TestInsertIntoEmpty.before.dot\", sk)\n\n\tnew := NewIntNode(10)\n\tn, status := sk.Insert(new)\n\tassert.True(status, \"Insert success\")\n\tassert.Equal(new, n, \"Inserted node returns\")\n\tdump(\"TestInsertIntoEmpty.after.dot\", sk)\n}", "title": "" }, { "docid": "ddd43d667687501fa55a831b780fca33", "score": "0.46466616", "text": "func Search(split3 func(*, *) (*, *), lo *, hi *, calc func(*, *) int) * {\n\tfor {\n\t\tvar newlo, newhi = split3(lo, hi)\n\t\tif newlo == nil {\n\t\t\treturn newhi\n\t\t}\n\n\t\tif calc(newlo, newhi) > 0 {\n\t\t\tlo = newlo\n\t\t} else {\n\t\t\thi = newhi\n\t\t}\n\t}\n}\n\n// Find finds a nearest key in integer domain [lo hi) that satisfies the find\n// function. It optionally also searches a slice. If slice element for the\n// current position does not exist, a nil is used, but index is also used.\n// Find is parametrized by the type we are searching for (the slice element).\n// Find returns the position of the global minimum.\n// The function searched must be unimodal.\n// If the slice contains duplicate elements, solution must be inbetween.\nfunc Find(dt bool, lo int, hi int, sli [], find func(*, int, *, int) int) int {\n\tvar mul = 1\n\tif dt && (len(sli) >= 2) && find(&sli[0], 0, &sli[1], 1) < 0 {\n\t\tmul = -1\n\t}\n\treturn *Search(func(low *int, high *int) (*int, *int) {\n\t\tif *low+2 >= *high {\n\t\t\tvar avg = (*low & *high) + ((*low ^ *high) >> 1)\n\t\t\treturn nil, &avg\n\t\t}\n\t\tvar lo = *low + (*high-*low)/3\n\t\tvar hi = *low + ((*high-*low)*2)/3\n\t\treturn &lo, &hi\n\t}, &lo, &hi, func(v *int, w *int) int {\n\t\tvar x * = nil\n\t\tvar y * = nil\n\t\tif (*v >= 0) && (*v < len(sli)) {\n\t\t\tx = &sli[*v]\n\t\t}\n\t\tif (*w >= 0) && (*w < len(sli)) {\n\t\t\ty = &sli[*w]\n\t\t}\n\t\treturn find(x, *v, y, *w) * mul\n\t})\n}", "title": "" }, { "docid": "a9f05b99d1e69216bdade9acf18dc683", "score": "0.4644049", "text": "func TestAppend04(t *testing.T) {\n\tse := NewSortedExtents()\n\tdelExtents, status := se.AppendWithCheck(proto.ExtentKey{FileOffset: 0, Size: 1000, ExtentId: 1}, nil)\n\tt.Logf(\"\\nstatus: %v\\ndel: %v\\neks: %v\", status, delExtents, se.eks)\n\tdelExtents, status = se.AppendWithCheck(proto.ExtentKey{FileOffset: 1000, Size: 1000, ExtentId: 2}, nil)\n\tt.Logf(\"\\nstatus: %v\\ndel: %v\\neks: %v\", status, delExtents, se.eks)\n\tdelExtents, status = se.AppendWithCheck(proto.ExtentKey{FileOffset: 1500, Size: 4000, ExtentId: 3}, nil)\n\tt.Logf(\"\\nstatus: %v\\ndel: %v\\neks: %v\", status, delExtents, se.eks)\n\tdiscard := make([]proto.ExtentKey, 0)\n\tdiscard = append(discard, proto.ExtentKey{FileOffset: 1000, Size: 1000, ExtentId: 2})\n\tdelExtents, status = se.AppendWithCheck(proto.ExtentKey{FileOffset: 500, Size: 4000, ExtentId: 4}, discard)\n\tt.Logf(\"\\nstatus: %v\\ndel: %v\\neks: %v\", status, delExtents, se.eks)\n\tif len(delExtents) != 1 || delExtents[0].ExtentId != 2 ||\n\t\tlen(se.eks) != 3 || se.Size() != 5500 ||\n\t\tse.eks[0].ExtentId != 1 || se.eks[1].ExtentId != 4 ||\n\t\tse.eks[2].ExtentId != 3 {\n\t\tt.Fail()\n\t}\n\tt.Logf(\"%v\\n\", se.Size())\n}", "title": "" }, { "docid": "b455beacdf2708c0dae2a71d19055226", "score": "0.46390516", "text": "func TestBinarySearch(t *testing.T) {\n\tindex := BinarySearch(list, \"Ofelia\")\n\tassert.Equal(t, index, 5, \"Ofelia must be in position 5\")\n}", "title": "" }, { "docid": "62facdbb2dbbde766c54b7180018204d", "score": "0.46366847", "text": "func nearestVnodeToKey(vnodes []*Vnode, key []byte) *Vnode {\n\tfor i := len(vnodes) - 1; i >= 0; i-- {\n\t\tif bytes.Compare(vnodes[i].Id, key) == -1 { // TODO : How does this promise \"nearest Vnode to Key\"?\n\t\t\treturn vnodes[i]\n\t\t}\n\t}\n\t// Return the last vnode\n\treturn vnodes[len(vnodes)-1]\n}", "title": "" }, { "docid": "65153013630d8292572e91c23547d104", "score": "0.4636041", "text": "func _AssertIndexOfFirstX(t *testing.T, s string, expectedIndex int) {\n\treader := NewReaderFromStream(strings.NewReader(s), nil)\n\tif err := reader._Wait(); err != nil {\n\t\tpanic(err)\n\t}\n\n\tcontents := _StartPaging(t, reader)\n\tfor pos, cell := range contents {\n\t\tif cell.Runes[0] != 'x' {\n\t\t\tcontinue\n\t\t}\n\n\t\tif pos == expectedIndex {\n\t\t\t// Success!\n\t\t\treturn\n\t\t}\n\n\t\tt.Errorf(\"Expected first 'x' to be at (zero-based) index %d, but was at %d: \\\"%s\\\"\",\n\t\t\texpectedIndex, pos, strings.ReplaceAll(s, \"\\x09\", \"<TAB>\"))\n\t\treturn\n\t}\n\n\tpanic(\"No 'x' found\")\n}", "title": "" }, { "docid": "73494ae28563d7620d301f37bb18512d", "score": "0.46308956", "text": "func TestNodeChildInsert(t *testing.T) {\n\tfmt.Println(\"-- TestNodeChildInsert\")\n\t//\n\t// n := &btnode{\n\t// \tchildren: make([]*btnode, 0),\n\t// }\n\t// n.insertChild(&btnode{elements: []Node{testNode{7}}}, 0)\n\t// n.insertChild(&btnode{elements: []Node{testNode{3}}}, 0)\n}", "title": "" }, { "docid": "0fd5f1e060db16b2c9ad1585b2a2e193", "score": "0.4629478", "text": "func mapKeysToNodes(conf *synctestConfig) {\n\tnodemap := make(map[string][]int)\n\t//build a pot for chunk hashes\n\tnp := pot.NewPot(nil, 0)\n\tindexmap := make(map[string]int)\n\tfor i, a := range conf.addrs {\n\t\tindexmap[string(a)] = i\n\t\tnp, _, _ = pot.Add(np, a, pof)\n\t}\n\n\tppmap := network.NewPeerPotMap(network.NewKadParams().NeighbourhoodSize, conf.addrs)\n\n\t//for each address, run EachNeighbour on the chunk hashes pot to identify closest nodes\n\tlog.Trace(fmt.Sprintf(\"Generated hash chunk(s): %v\", conf.hashes))\n\tfor i := 0; i < len(conf.hashes); i++ {\n\t\tvar a []byte\n\t\tnp.EachNeighbour([]byte(conf.hashes[i]), pof, func(val pot.Val, po int) bool {\n\t\t\t// take the first address\n\t\t\ta = val.([]byte)\n\t\t\treturn false\n\t\t})\n\n\t\tnns := ppmap[common.Bytes2Hex(a)].NNSet\n\t\tnns = append(nns, a)\n\n\t\tfor _, p := range nns {\n\t\t\tnodemap[string(p)] = append(nodemap[string(p)], i)\n\t\t}\n\t}\n\tfor addr, chunks := range nodemap {\n\t\t//this selects which chunks are expected to be found with the given node\n\t\tconf.idToChunksMap[conf.addrToIDMap[addr]] = chunks\n\t}\n\tlog.Debug(fmt.Sprintf(\"Map of expected chunks by ID: %v\", conf.idToChunksMap))\n}", "title": "" }, { "docid": "0c0d60c1a412b8154546e70553ea7e68", "score": "0.4629447", "text": "func searchSparePart(arr ArrSparepart, key string, nArr int) int {\n\tvar awal, tengah, akhir int\n\tawal = 0\n\takhir = nArr - 1\n\ttengah = (awal + akhir) / 2\n\tfor awal < akhir && strings.ToLower(arr[tengah].nama) != strings.ToLower(key) {\n\t\tif arr[tengah].nama > key {\n\t\t\takhir = tengah - 1\n\t\t} else {\n\t\t\tawal = tengah + 1\n\t\t}\n\t\ttengah = (awal + akhir) / 2\n\t}\n\tif strings.ToLower(arr[tengah].nama) == strings.ToLower(key) {\n\t\treturn tengah\n\t}else{\n\t\treturn -1\n\t}\n}", "title": "" }, { "docid": "56f5e5f87f0204adf0ecac5622294861", "score": "0.46217722", "text": "func getKeyedListEntry(node map[string]interface{}, elem *pb.PathElem, createIfNotExist bool) map[string]interface{} {\n\tcurNode, ok := node[elem.Name]\n\tif !ok {\n\t\tif !createIfNotExist {\n\t\t\treturn nil\n\t\t}\n\n\t\t// Create a keyed list as node child and initialize an entry.\n\t\tm := make(map[string]interface{})\n\t\tfor k, v := range elem.Key {\n\t\t\tm[k] = v\n\t\t\tif vAsNum, err := strconv.ParseFloat(v, 64); err == nil {\n\t\t\t\tm[k] = vAsNum\n\t\t\t}\n\t\t}\n\t\tnode[elem.Name] = []interface{}{m}\n\t\treturn m\n\t}\n\n\t// Search entry in keyed list.\n\tkeyedList, ok := curNode.([]interface{})\n\tif !ok {\n\t\treturn nil\n\t}\n\tfor _, n := range keyedList {\n\t\tm, ok := n.(map[string]interface{})\n\t\tif !ok {\n\t\t\tlog.Errorf(\"wrong keyed list entry type: %T\", n)\n\t\t\treturn nil\n\t\t}\n\t\tkeyMatching := true\n\t\t// must be exactly match\n\t\tfor k, v := range elem.Key {\n\t\t\tattrVal, ok := m[k]\n\t\t\tif !ok {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tif v != fmt.Sprintf(\"%v\", attrVal) {\n\t\t\t\tkeyMatching = false\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif keyMatching {\n\t\t\treturn m\n\t\t}\n\t}\n\tif !createIfNotExist {\n\t\treturn nil\n\t}\n\n\t// Create an entry in keyed list.\n\tm := make(map[string]interface{})\n\tfor k, v := range elem.Key {\n\t\tm[k] = v\n\t\tif vAsNum, err := strconv.ParseFloat(v, 64); err == nil {\n\t\t\tm[k] = vAsNum\n\t\t}\n\t}\n\tnode[elem.Name] = append(keyedList, m)\n\treturn m\n}", "title": "" }, { "docid": "fee1c7d52719a0f19b5a4787a884285e", "score": "0.46211848", "text": "func (t *trieView) insert(\n\tkey path,\n\tvalue maybe.Maybe[[]byte],\n) (*node, error) {\n\tif t.nodesAlreadyCalculated.Get() {\n\t\treturn nil, ErrNodesAlreadyCalculated\n\t}\n\n\t// find the node that most closely matches [key]\n\tpathToNode, err := t.getPathTo(key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// We're inserting a node whose ancestry is [pathToNode]\n\t// so we'll need to recalculate their IDs.\n\tfor _, node := range pathToNode {\n\t\tif err := t.recordNodeChange(node); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tclosestNode := pathToNode[len(pathToNode)-1]\n\n\t// a node with that exact path already exists so update its value\n\tif closestNode.key.Compare(key) == 0 {\n\t\tclosestNode.setValue(value)\n\t\treturn closestNode, nil\n\t}\n\n\tclosestNodeKeyLength := len(closestNode.key)\n\t// A node with the exact key doesn't exist so determine the portion of the\n\t// key that hasn't been matched yet\n\t// Note that [key] has prefix [closestNodeFullPath] but exactMatch was false,\n\t// so [key] must be longer than [closestNodeFullPath] and the following slice won't OOB.\n\tremainingKey := key[closestNodeKeyLength+1:]\n\n\texistingChildEntry, hasChild := closestNode.children[key[closestNodeKeyLength]]\n\t// there are no existing nodes along the path [fullPath], so create a new node to insert [value]\n\tif !hasChild {\n\t\tnewNode := newNode(\n\t\t\tclosestNode,\n\t\t\tkey,\n\t\t)\n\t\tnewNode.setValue(value)\n\t\treturn newNode, t.recordNodeChange(newNode)\n\t}\n\n\t// if we have reached this point, then the [fullpath] we are trying to insert and\n\t// the existing path node have some common prefix.\n\t// a new branching node will be created that will represent this common prefix and\n\t// have the existing path node and the value being inserted as children.\n\n\t// generate the new branch node\n\tbranchNode := newNode(\n\t\tclosestNode,\n\t\tkey[:closestNodeKeyLength+1+getLengthOfCommonPrefix(existingChildEntry.compressedPath, remainingKey)],\n\t)\n\tif err := t.recordNodeChange(closestNode); err != nil {\n\t\treturn nil, err\n\t}\n\tnodeWithValue := branchNode\n\n\tif len(key)-len(branchNode.key) == 0 {\n\t\t// there was no residual path for the inserted key, so the value goes directly into the new branch node\n\t\tbranchNode.setValue(value)\n\t} else {\n\t\t// generate a new node and add it as a child of the branch node\n\t\tnewNode := newNode(\n\t\t\tbranchNode,\n\t\t\tkey,\n\t\t)\n\t\tnewNode.setValue(value)\n\t\tif err := t.recordNodeChange(newNode); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tnodeWithValue = newNode\n\t}\n\n\texistingChildKey := key[:closestNodeKeyLength+1] + existingChildEntry.compressedPath\n\n\t// the existing child's key is of length: len(closestNodeKey) + 1 for the child index + len(existing child's compressed key)\n\t// if that length is less than or equal to the branch node's key that implies that the existing child's key matched the key to be inserted\n\t// since it matched the key to be inserted, it should have been returned by GetPathTo\n\tif len(existingChildKey) <= len(branchNode.key) {\n\t\treturn nil, ErrGetPathToFailure\n\t}\n\n\tbranchNode.addChildWithoutNode(\n\t\texistingChildKey[len(branchNode.key)],\n\t\texistingChildKey[len(branchNode.key)+1:],\n\t\texistingChildEntry.id,\n\t)\n\n\treturn nodeWithValue, t.recordNodeChange(branchNode)\n}", "title": "" }, { "docid": "5db5483fe463da478a88610aa521a163", "score": "0.46211693", "text": "func (list *SkipList) Set(key float64, value interface{}) *Element {\n list.mutex.Lock()\n defer list.mutex.Unlock()\n\n var element *Element\n prevs := list.getPrevElementNodes(key)\n\n if element = prevs[0].next[0]; element != nil && element.key <= key {\n element.value = value\n return element\n }\n\n element = &Element {\n ElementNode: ElementNode {\n next: make([]*Element, list.randLevel()),\n },\n key: key,\n value: value,\n }\n\n for i := range element.next {\n element.next[i] = prevs[i].next[i]\n prevs[i].next[i] = element\n }\n\n list.Length++\n return element\n}", "title": "" }, { "docid": "433133b005421e8ecf5cadef9bf51e82", "score": "0.4618583", "text": "func testBTreeSplitXOnEdge(t *testing.T, ts func(t testing.TB) (file.File, func())) {\n\tdb, f := tmpDB(t, ts)\n\n\tdefer f()\n\n\tbt, err := db.NewBTree(16, 16, 8, 8)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tdefer bt.remove(t)\n\n\tg := func() {\n\t\tbt.clear(t)\n\t\tkd := bt.kd\n\t\tkx := bt.kx\n\n\t\t// one index page with 2*kx+2 elements (last has .k=∞ so x.c=2*kx+1)\n\t\t// which will splitX on next Set\n\t\tfor i := 0; i <= (2*kx+1)*2*kd; i++ {\n\t\t\t// odd keys are left to be filled in second test\n\t\t\tbt.set(t, 2*i, 2*i)\n\t\t}\n\n\t\tr, err := bt.root()\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\n\t\tx0 := bt.openXPage(r)\n\t\tx0c, err := bt.lenX(x0)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\n\t\tif x0c != 2*kx+1 {\n\t\t\tt.Fatalf(\"x0.c: %v ; expected %v\", x0c, 2*kx+1)\n\t\t}\n\n\t\t// set element with k directly at x0[kx].k\n\t\tkedge := 2 * (kx + 1) * (2 * kd)\n\t\tpk, err := bt.keyX(x0, kx)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\n\t\tif pk, err = bt.r8(pk); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\n\t\tk, err := bt.r4(pk)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\n\t\tif k != kedge {\n\t\t\tt.Fatalf(\"edge key before splitX: %v ; expected %v\", k, kedge)\n\t\t}\n\n\t\tbt.set(t, kedge, 777)\n\n\t\t// if splitX was wrong kedge:777 would land into wrong place with Get failing\n\t\tv, ok := bt.get(t, kedge)\n\t\tif !(v == 777 && ok) {\n\t\t\tt.Fatalf(\"after splitX: Get(%v) -> %v, %v ; expected 777, true\", kedge, v, ok)\n\t\t}\n\n\t\t// now check the same when splitted X has parent\n\t\tif r, err = bt.root(); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\n\t\txr := bt.openXPage(r)\n\t\txrc, err := bt.lenX(xr)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\n\t\tif xrc != 1 { // second x comes with k=∞ with .c index\n\t\t\tt.Fatalf(\"after splitX: xr.c: %v ; expected 1\", xrc)\n\t\t}\n\n\t\txr0ch, err := bt.child(xr, 0)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\n\t\tif xr0ch != int64(x0) {\n\t\t\tt.Fatal(\"xr[0].ch is not x0\")\n\t\t}\n\n\t\tfor i := 0; i <= (2*kx)*kd; i++ {\n\t\t\tbt.set(t, 2*i+1, 2*i+1)\n\t\t}\n\n\t\t// check x0 is in pre-splitX condition and still at the right place\n\t\tif x0c, err = bt.lenX(x0); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\n\t\tif x0c != 2*kx+1 {\n\t\t\tt.Fatalf(\"x0.c: %v ; expected %v\", x0c, 2*kx+1)\n\t\t}\n\n\t\tif xr0ch, err = bt.child(xr, 0); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\n\t\tif xr0ch != int64(x0) {\n\t\t\tt.Fatal(\"xr[0].ch is not x0\")\n\t\t}\n\n\t\t// set element with k directly at x0[kx].k\n\t\tkedge = (kx + 1) * (2 * kd)\n\t\tif pk, err = bt.keyX(x0, kx); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\n\t\tif pk, err = bt.r8(pk); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\n\t\tx0kxk, err := bt.r4(pk)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\n\t\tif x0kxk != kedge {\n\t\t\tt.Fatalf(\"edge key before splitX: %v ; expected %v\", x0kxk, kedge)\n\t\t}\n\n\t\tbt.set(t, kedge, 888)\n\n\t\t// if splitX was wrong kedge:888 would land into wrong place\n\t\tv, ok = bt.get(t, kedge)\n\t\tif !(v == 888 && ok) {\n\t\t\tt.Fatalf(\"after splitX: Get(%v) -> %v, %v ; expected 888, true\", kedge, v, ok)\n\t\t}\n\t}\n\n\tg()\n\tif bt, err = db.OpenBTree(bt.Off); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tg()\n}", "title": "" }, { "docid": "d873714be6c6ffc4a80c071ce3342058", "score": "0.4618224", "text": "func Test_EmptyType_Insert(t *testing.T) {\n\tsize := int64(1000)\n\temptyArray := emptyArrayGenerator.New(size)\n\n\ttype testCase struct {\n\t\tsize int64\n\t\tpos int64\n\t\terrMsg string\n\t}\n\n\tcases := []testCase{\n\t\t{-100, 10, \"Expected error about negative size, got err = nil\"},\n\t\t{100, size, \"Expected error about out of bounds pos argument, got err = nil\"},\n\t\t{100, size + 1, \"Expected error about out of bounds pos argument, got err = nil\"},\n\t}\n\n\tfor _, cas := range cases {\n\t\terr := emptyArray.Insert(struct{}{}, cas.size, cas.pos)\n\t\tif err == nil {\n\t\t\tt.Fatal(cas.errMsg)\n\t\t}\n\n\t\tif emptyArray.Size() != size {\n\t\t\tt.Fatal(\"Incorrect size after failed Insert() : expected = \", size, \" got = \", emptyArray.Size())\n\t\t}\n\t}\n\n\tinsertSize := int64(300)\n\tarr := make([]struct{}, insertSize)\n\terr := emptyArray.Insert(arr, insertSize, size-1)\n\tif err != nil {\n\t\tt.Error(\"Expected err = nil, but got err = \", err)\n\t}\n\tif emptyArray.Size() != size+insertSize {\n\t\tt.Error(\"Incorrect size after Insert() : expected = \", size+insertSize, \" got = \", emptyArray.Size())\n\t}\n}", "title": "" }, { "docid": "4638379e359e39972b034ef8bc756f17", "score": "0.461786", "text": "func searchInsert(nums []int, target int) int {\n\tif target <= nums[0] {\n\t\treturn 0\n\t}\n\n\tfor i := 1; i < len(nums); i++ {\n\t\tif nums[i-1] < target && target <= nums[i] {\n\t\t\treturn i\n\t\t}\n\t}\n\n\treturn len(nums)\n}", "title": "" }, { "docid": "533da2fe2f8717ba70faea56868c52eb", "score": "0.46169293", "text": "func TestKeysValuesMatch(t *testing.T) {\n\tring := NewRing()\n\tnodes := createNodes()\n\taddNodesToTree(ring, nodes)\n\n\tkeys := ring.Keys()\n\tvalues := ring.Values()\n\n\tfor i, key := range keys {\n\t\tvalue, _ := ring.Get(key)\n\t\tassert.Equal(t, values[i], value)\n\t}\n}", "title": "" }, { "docid": "a85c709f03964f6cfe6241bdbd7fb006", "score": "0.46145567", "text": "func (t *BTree) lookup(nodes []Node, key uint32, noder Noder) []Node {\n\tnode := nodes[len(nodes)-1]\n\n\tif len(node.Children()) == 0 {\n\t\treturn nodes\n\t}\n\n\tidx := 0\n\tfor _, k := range node.Keys() {\n\t\tif key < k {\n\t\t\tbreak\n\t\t}\n\t\tidx++\n\t}\n\tnodeId := node.Children()[idx]\n\tnewNodes := append(nodes, t.getNode(nodeId, noder))\n\treturn t.lookup(newNodes, key, noder)\n}", "title": "" }, { "docid": "b2d3ecfd3e613b9d7ae982e7a905d607", "score": "0.46089205", "text": "func assignKeys(tree *category) {\n\tstart := int32(0)\n\tstart = indexTree(tree, start)\n}", "title": "" }, { "docid": "2707fec9d877a0a7a6fe41ccc8e31732", "score": "0.4607147", "text": "func FindPos(elem string, elemArray []string) int {\n\tfor p, v := range elemArray {\n\t\tif v == elem {\n\t\t\treturn p\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "83518b6369d39d36bbe73ee7b4e0d664", "score": "0.4606045", "text": "func (tree *Critbit) Insert(key string, value interface{}) (bool, error) {\n\t// Sanity check\n\tif len(key) > kMaxStringLength {\n\t\treturn false, errors.Errorf(\"Maximum string length is %d\", kMaxStringLength)\n\t}\n\n\t// Is the tree empty? Insert the first ref\n\tif tree.numExternalRefs == 0 {\n\t\terr := tree.insertFirstString(key, value)\n\t\tif err != nil {\n\t\t\treturn false, errors.Wrap(err, \"Insert() first key\")\n\t\t}\n\t\treturn true, nil\n\t}\n\n\t// Find the best external reference\n\tbestRefNum := tree.findBestExternalReference(key)\n\n\t// find critical bit\n\tidentical, off, bit, ndir := tree.findCriticalBit(bestRefNum, key)\n\n\t// Is it already in the tree?\n\tif identical {\n\t\treturn false, nil\n\t}\n\n\t// If there is only one external ref, then there are no internal nodes.\n\t// Insert the first node (and a new ref)\n\tif tree.numExternalRefs == 1 {\n\t\terr := tree.insertSecondString(key, value, off, bit, ndir)\n\t\tif err != nil {\n\t\t\treturn false, errors.Wrap(err, \"Insert() second key\")\n\t\t}\n\t\treturn true, nil\n\t}\n\n\t// Find the node from which to branch\n\tbranchNodeNum, parentNodeNum, prevDirection, insertAtRoot,\n\t\tfinalChildType := tree.findBranchNode(off, bit, key)\n\n\t// Add the new ref\n\tnewRefNum, err := tree.addExternalRef(key, value)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"Insert() adding an external ref\")\n\t}\n\n\t// Insert a new node, which be inserted where the branching node currently is.\n\tnewNodeNum, newNode := tree.addInternalNode()\n\tnewNode.setChild(1-ndir, newRefNum, kChildExtRef)\n\tnewNode.offset = off\n\tnewNode.bit = bit\n\n\tif insertAtRoot {\n\t\t// The new node becomes the new tree root\n\t\tnewNode.setChild(ndir, tree.rootItem, kChildIntNode)\n\t\ttree.rootItem = newNodeNum\n\t} else {\n\t\t// The branch node's parent points to the new node, and the new node\n\t\t// subsumes the branch node. The parent-child connection from the new\n\t\t// node to the branch node must indicate the correct child type.\n\t\tparentNode := &tree.internalNodes[parentNodeNum]\n\t\tparentNode.setChild(prevDirection, newNodeNum, kChildIntNode)\n\t\tnewNode.setChild(ndir, branchNodeNum, finalChildType)\n\t}\n\n\treturn true, nil\n}", "title": "" }, { "docid": "d848f632725b39f63edcb97eda5ea77d", "score": "0.46058983", "text": "func (db *DB) findSpliceForLevel(arena *arena, key []byte, before nodeWithAddr, level int) (nodeWithAddr, nodeWithAddr, bool) {\n\tfor {\n\t\t// Assume before.key < key.\n\t\tnextAddr := before.nexts[level]\n\t\tif nextAddr.isNull() {\n\t\t\treturn before, nodeWithAddr{}, false\n\t\t}\n\t\tdata := arena.getFrom(nextAddr)\n\t\tnext := nodeWithAddr{(*node)(unsafe.Pointer(&data[0])), nextAddr}\n\t\tnextKey := next.getKey(data)\n\t\tcmp := bytes.Compare(nextKey, key)\n\t\tif cmp >= 0 {\n\t\t\t// before.key < key < next.key. We are done for this level.\n\t\t\treturn before, next, cmp == 0\n\t\t}\n\t\tbefore = next // Keep moving right on this level.\n\t}\n}", "title": "" }, { "docid": "ee8d95cf620edd500ca4133affdbb5b2", "score": "0.45957232", "text": "func treeQualifyKey3(params *Params, qKey *oaque.PrivateKey, attrs oaque.AttributeList, left int, right int, lEnd int, rEnd int, nodeID []int, depthI int, depthJ int, keyList []*setKey) ([]*setKey, error) {\n\tif left >= right {\n\t\treturn keyList, nil\n\t}\n\n\tvar err error\n\tmid := (left + right) / 2\n\n\t//\tprintln(left, right, lEnd, rEnd, depthJ)\n\tif rEnd <= mid {\n\t\tnodeID[depthJ] = 1\n\n\t\tkeyList, err = nodeQualifyKey(params, qKey, attrs, nodeID, depthI, depthJ+1, false, keyList)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t//\t\tprintNodeID(nodeID)\n\t\t//println(depthI, depthJ+1)\n\t\t//println(\"++++\", keyList)\n\n\t\tnodeID[depthJ] = 0\n\n\t\tkeyList, err = treeQualifyKey3(params, qKey, attrs, left, mid, lEnd, rEnd, nodeID, depthI, depthJ+1, keyList)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn keyList, nil\n\n\t} else if lEnd >= mid+1 {\n\t\tnodeID[depthJ] = 0\n\n\t\tkeyList, err = nodeQualifyKey(params, qKey, attrs, nodeID, depthI, depthJ+1, false, keyList)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tnodeID[depthJ] = 1\n\n\t\tkeyList, err = treeQualifyKey3(params, qKey, attrs, mid+1, right, lEnd, rEnd, nodeID, depthI, depthJ+1, keyList)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn keyList, nil\n\t} else if lEnd <= mid && mid+1 <= rEnd {\n\t\t//left child\n\n\t\tnodeID[depthJ] = 0\n\n\t\tkeyList, err = nodeQualifyKey(params, qKey, attrs, nodeID, depthI, depthJ+1, false, keyList)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t//right child\n\t\tnodeID[depthJ] = 1\n\n\t\tkeyList, err = nodeQualifyKey(params, qKey, attrs, nodeID, depthI, depthJ+1, false, keyList)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\tpanic(\"out of bound when treeQualifyKey3\")\n\t}\n\n\treturn keyList, nil\n}", "title": "" }, { "docid": "c23fb8f8a5341b3fae3cfad621db2ac9", "score": "0.45880786", "text": "func (a DoubleArrayUint32) ExactMatchSearch(key string) (id, size int, err error) {\n\tnodePos := uint32(0)\n\tunit, err := a.at(nodePos)\n\tif err != nil {\n\t\treturn -1, -1, err\n\t}\n\tfor i := 0; i < len(key); i++ {\n\t\tnodePos ^= unit.offset() ^ uint32(key[i])\n\t\tunit, err = a.at(nodePos)\n\t\tif err != nil {\n\t\t\treturn -1, -1, err\n\t\t}\n\t\tif unit.label() != key[i] {\n\t\t\treturn -1, 0, nil\n\t\t}\n\t}\n\tif !unit.hasLeaf() {\n\t\treturn -1, 0, nil\n\t}\n\tunit, err = a.at(nodePos ^ unit.offset())\n\tif err != nil {\n\t\treturn -1, -1, err\n\t}\n\treturn int(unit.value()), len(key), nil\n}", "title": "" }, { "docid": "a25e0fab9a0e7a5388512dcf945a68ed", "score": "0.458762", "text": "func (l *ListElement) indexInKey(key []byte) int64 {\n\tidxbuf := bytes.TrimPrefix(key, l.keyPrefix())\n\treturn BytesToInt64(idxbuf[1:]) // skip sign \"0/1\"\n}", "title": "" }, { "docid": "ef920e372e906747d54f0dbb8f1f8657", "score": "0.45861337", "text": "func TestSameKeyInserts(t *testing.T) {\n\tgroup := newGroup(\"a\", 1, MinGroup, t)\n\tinfo1 := newInfo(\"a.a\", 1)\n\tif !group.addInfo(info1) {\n\t\tt.Error(\"could not insert\")\n\t}\n\n\t// Smaller timestamp should be ignored.\n\tinfo2 := newInfo(\"a.a\", 1)\n\tinfo2.Timestamp = info1.Timestamp - 1\n\tif group.addInfo(info2) {\n\t\tt.Error(\"should not allow insert\")\n\t}\n\n\t// Two successively larger timestamps always win.\n\tinfo3 := newInfo(\"a.a\", 1)\n\tinfo3.Timestamp = info1.Timestamp + 1\n\tif !group.addInfo(info3) {\n\t\tt.Error(\"could not insert\")\n\t}\n\tinfo4 := newInfo(\"a.a\", 1)\n\tinfo4.Timestamp = info1.Timestamp + 2\n\tif !group.addInfo(info4) {\n\t\tt.Error(\"could not insert\")\n\t}\n}", "title": "" }, { "docid": "7912d65a918e29963758afc33d10250f", "score": "0.45842165", "text": "func searchInsert(nums []int, target int) int {\n\tvar ret int\n\tvar insert bool\n\tfor i, v := range nums {\n\t\tif target == v {\n\t\t\tret = i\n\t\t\tinsert = true\n\t\t\tbreak\n\t\t}\n\t\tif target < v {\n\t\t\tret = i\n\t\t\tinsert = true\n\t\t\tbreak\n\t\t}\n\t}\n\tif !insert {\n\t\tret = len(nums)\n\t}\n\tif ret < 0 {\n\t\tret = 0\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "8797d0707eb60d45c5759bb956b597d4", "score": "0.45800656", "text": "func TestContainsPresentTreeSet(t *testing.T) {\n s := NewTreeSet(compInt{1}, compInt{2}, compInt{3})\n\n if !s.Contains(compInt{1}, compInt{2}) {\n t.Error(\"{1, 2} should countain {1, 2}\")\n }\n}", "title": "" }, { "docid": "a28270507c7909875866d0258238b836", "score": "0.45798153", "text": "func TestKeys(t *testing.T) {\n\tf, err := NewFilter(1000, 4, 0.01)\n\tif err != nil {\n\t\tt.Error(\"unable to create a filter\")\n\t}\n\tif f.HasKey(\"a\") {\n\t\tt.Error(\"filter shouldn't contain key a\")\n\t}\n\tif f.AddKey(\"a\"); !f.HasKey(\"a\") {\n\t\tt.Error(\"filter should contain key a\")\n\t}\n\tif f.HasKey(\"b\") {\n\t\tt.Error(\"filter should contain key b\")\n\t}\n\tif f.RemoveKey(\"a\"); f.HasKey(\"a\") {\n\t\tt.Error(\"filter shouldn't contain key a after removal\")\n\t}\n\t// Add key twice, verify it still exists after one removal.\n\tf.AddKey(\"a\")\n\tf.AddKey(\"a\")\n\tf.RemoveKey(\"a\")\n\tif !f.HasKey(\"a\") {\n\t\tt.Error(\"filter should still contain key a\")\n\t}\n}", "title": "" }, { "docid": "bf343e3bdfb9df951a387c1bf02eee8d", "score": "0.4578297", "text": "func (e ElasticNodeGroupValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "6784bd5762227abc60beba31f62b23e0", "score": "0.45759577", "text": "func (f *frontier) Insert(x, y float64, item interface{}) bool {\n\tmaxX := f.MaxX()\n\n\tthisElem := frontierItem{x: x, y: y, item: item}\n\tif f.tree.Len() == 0 {\n\t\tf.tree.Insert(thisElem)\n\t\tdoAssert((x > maxX), \" nb=\", x, \" mean=\", x, \" maxx=\", maxX)\n\t\treturn true\n\t}\n\n\tleftIter := f.tree.FindLE(thisElem)\n\trightIter := f.tree.FindGE(thisElem)\n\n\tif !rightIter.Limit() && x == getItem(rightIter).x {\n\t\t// Exact match found\n\t\tif y < getItem(rightIter).y {\n\t\t\tf.maybeRemoveLeftElements(thisElem, leftIter.Prev())\n\t\t\tf.maybeRemoveRightElements(thisElem, rightIter.Next())\n\t\t\tf.tree.DeleteWithIterator(rightIter)\n\t\t\tf.tree.Insert(thisElem)\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t}\n\tif leftIter.NegativeLimit() {\n\t\tif y < getItem(f.tree.Min()).y {\n\t\t\tf.tree.Insert(thisElem)\n\t\t\tf.maybeRemoveRightElements(thisElem, rightIter)\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t}\n\tif rightIter.Limit() {\n\t\tf.tree.Insert(thisElem)\n\t\tf.maybeRemoveLeftElements(thisElem, leftIter)\n\t\treturn true\n\t}\n\n\tif isConcave(\n\t\tgetItem(leftIter),\n\t\tthisElem,\n\t\tgetItem(rightIter)) {\n\t\tf.tree.Insert(thisElem)\n\n\t\tf.maybeRemoveLeftElements(thisElem, leftIter)\n\t\tf.maybeRemoveRightElements(thisElem, rightIter)\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "46fad99adc2ee5b6f3a55ac0cac8493b", "score": "0.45744908", "text": "func (i *IterUintUintptr) Seek(key uint) {\n\tkey = i.t.transformKey(key)\n\ti.Reset()\n\tif i.t.length == 0 {\n\t\treturn\n\t}\n\t// Walk down tree until leaf node is found or critical bit differs\n\tvar last = &i.t.root\n\tfor last.crit != ^uint(0) && last.findCrit(key) == last.crit {\n\t\ti.nodes = append(i.nodes, last)\n\t\tlast = &last.children()[last.dir(key)]\n\t}\n\t// Done if last node matches key\n\tif last.crit == ^uint(0) && key == last.key {\n\t\ti.nodes = append(i.nodes, last)\n\t\treturn\n\t}\n\t// No exact match for key found. Check if correct node would be left (smaller key) or right (larger key) of the last one.\n\tvar dir = 0\n\tif i.t.transformKey(key) > i.t.transformKey(last.key) {\n\t\tdir = 1\n\t}\n\t// Walk upwards until the shared parent of previous and next key is found.\n\tfor l := len(i.nodes); l > 0; l-- {\n\t\t// The shared parent has the last removed node as a child on the opposite side of the direction where the correct node would be.\n\t\tif &i.nodes[l-1].children()[1-dir] == last {\n\t\t\treturn\n\t\t}\n\t\tlast = i.nodes[l-1]\n\t\ti.nodes = i.nodes[0 : l-1]\n\t}\n\t// There are no other keys as high or low as the correct one. Simulate a Next or Prev call that reached the end\n\ti.lastDir = 0\n\tif i.t.transformKey(key) > i.t.transformKey(last.key) {\n\t\ti.lastDir = 1\n\t}\n}", "title": "" }, { "docid": "fce7cbd0ee98e36f5bc9853d90b28040", "score": "0.4572912", "text": "func (l *LinkedList) checkElementIndex(index int) {\n\tif index < 0 || index >= l.size {\n\t\tpanic(\"index out of bound\")\n\t}\n}", "title": "" }, { "docid": "741666d0f9067d35b5450a93b9a7aade", "score": "0.45713136", "text": "func (sc *SliceContainer) findHelper(item ContainerElement) int {\n\tfor idx, val := range sc.Backer {\n\t\tif item.Equals(val) {\n\t\t\treturn idx\n\t\t}\n\t}\n\n\treturn -1\n}", "title": "" }, { "docid": "e93e6b15738836573fc658a9175f3bae", "score": "0.4569266", "text": "func (c *nodeMapuint8error) find(key uint8) (crit uint, child, parent *nodeMapuint8error) {\n\tchild = c\n\tcrit = child.findCrit(key)\n\t// Keep going deeper until a leaf or an incompatible range is found.\n\tfor child.crit != ^uint(0) && child.crit == crit {\n\t\tparent = child\n\t\tchild = &(child.children())[child.dir(key)]\n\t\tcrit = child.findCrit(key)\n\t}\n\treturn\n}", "title": "" }, { "docid": "e808962b5cefc716333ee7caab3aa77d", "score": "0.4567742", "text": "func TestIDF(t *testing.T) {\n\thashmap := NewSafeMap()\n\tfor i := 0; i < 100; i++ {\n\t\terr := hashmap.Insert(i, i+101)\n\t\tif err != nil {\n\t\t\tt.Error(\"insert new key failed\", i, i+101)\n\t\t}\n\t}\n\n\tif hashmap.Len() != 100 {\n\t\tt.Error(\"check map len failed\")\n\t}\n\n\t// Insert already exist\n\tfor i := 0; i < 100; i++ {\n\t\terr := hashmap.Insert(i, i+201)\n\t\tif err == nil {\n\t\t\tt.Error(\"insert exist new key succ\", i, i+201)\n\t\t}\n\t}\n\n\t// Find exist\n\tfor i := 0; i < 100; i++ {\n\t\tv, find := hashmap.Find(i)\n\t\tif find != true {\n\t\t\tt.Error(\"not find the key\", i)\n\t\t} else if v != i+101 {\n\t\t\tt.Error(\"check find value failed\", i, v, i+101)\n\t\t}\n\t}\n\n\t// Find not exist\n\tfor i := 100; i < 200; i++ {\n\t\t_, find := hashmap.Find(i)\n\t\tif find != false {\n\t\t\tt.Error(\"find not exist the key\", i)\n\t\t}\n\t}\n\n\t// Delete not exist key\n\tfor i := 100; i < 200; i++ {\n\t\tv, find := hashmap.Delete(i)\n\t\tif find != false {\n\t\t\tt.Error(\"delete not exist key, but return succ\", i, v)\n\t\t}\n\t}\n\n\t// Delete exist key\n\tfor i := 0; i < 100; i++ {\n\t\tv, find := hashmap.Delete(i)\n\t\tif find != true {\n\t\t\tt.Error(\"not find exist the key\", i)\n\t\t} else if v != i+101 {\n\t\t\tt.Error(\"delete exist key,but check value failed\", i, v)\n\t\t}\n\t}\n\n\tif hashmap.Len() != 0 {\n\t\tt.Error(\"check map not empty\")\n\t}\n\n\terr := hashmap.Insert(\"test\", \"value\")\n\tif err != nil {\n\t\tt.Error(\"insert string\")\n\t}\n\tv, find := hashmap.Find(\"test\")\n\tif find != true {\n\t\tt.Error(\"find the string value failed\")\n\t} else if v != \"value\" {\n\t\tt.Error(\"check the string value failed\")\n\t}\n}", "title": "" }, { "docid": "b6fd199750bd6363967f3aa30604d592", "score": "0.4567354", "text": "func (c *nodeMapuint8string) find(key uint8) (crit uint, child, parent *nodeMapuint8string) {\n\tchild = c\n\tcrit = child.findCrit(key)\n\t// Keep going deeper until a leaf or an incompatible range is found.\n\tfor child.crit != ^uint(0) && child.crit == crit {\n\t\tparent = child\n\t\tchild = &(child.children())[child.dir(key)]\n\t\tcrit = child.findCrit(key)\n\t}\n\treturn\n}", "title": "" }, { "docid": "07936f301107bd9125775064d653cc30", "score": "0.45629084", "text": "func (e ReservedNodeGroupValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "9b1af82b102061fa77ac70b1bb5cee3b", "score": "0.45527083", "text": "func TestInsertKeyWithExistingID(t *testing.T) {\n\tnk := *testKey\n\tnk.ID = 1\n\n\tk, err := keyStore.InsertKey(nk)\n\n\t// Assertions\n\tassert.NotEqual(t, nil, err)\n\tassert.Equal(t, 0, int(k.ID))\n\tassert.Equal(t, \"\", k.UserID)\n\tassert.Equal(t, \"\", k.Key)\n\tassert.Equal(t, \"\", k.Provider)\n}", "title": "" }, { "docid": "372f28ec7a76603ef0fec6acfa9ac096", "score": "0.45486325", "text": "func (fts *FTStruct) Find(key [constants.ShaSize]byte) (string, string, error) {\n\tstart := SSA.Add(fts.n, SSA.Pow2(0)) // n + 2^0\n\tvar end [constants.ShaSize]byte\n\tfor i := uint32(0); i < constants.ShaNumBits; i++ {\n\t\tif i == constants.ShaNumBits-1 { // wrap around\n\t\t\tend = SSA.Add(fts.n, SSA.Pow2(0)) // n + 2^0\n\t\t} else {\n\t\t\tend = SSA.Add(fts.n, SSA.Pow2(i+1)) // n + s^(i+1)\n\t\t}\n\t\tif InRangeHelp(key, start, end) {\n\t\t\treturn fts.table[i].Hostname, fts.table[i].Port, nil\n\t\t\t// return start/more-left node as the predecessor is better candidate since search is done clockwise\n\t\t}\n\t\tstart = end // update start\n\t}\n\treturn \"\", \"\", NewFTFindError()\n}", "title": "" }, { "docid": "812c5e31bddf10119dff67b6df206b07", "score": "0.45478684", "text": "func (h *elementNode) findLessNode(sortable *Sortable) (*elementNode, bool) {\n\theader := h\n\tfor header.next == nil {\n\t\tif header.parentNode == nil {\n\t\t\treturn h, false\n\t\t}\n\t\theader = header.parentNode\n\t}\n\n\tnow := header.next\n\tvar res = header\n\tfor now != nil {\n\t\tisLessThan, err := (*now.value).IsLessThan(*sortable)\n\t\tif err != nil {\n\t\t\treturn nil, false\n\t\t}\n\t\tisEquals, err := (*now.value).IsEquals(*sortable)\n\t\tif err != nil {\n\t\t\treturn nil, false\n\t\t}\n\t\tif isLessThan {\n\t\t\tres = now\n\t\t\tnow = now.next\n\t\t\tcontinue\n\t\t} else if isEquals {\n\t\t\tres = now\n\t\t\treturn res.findMinLevel(), true\n\t\t} else {\n\t\t\tif now.pre != nil {\n\t\t\t\tnow = now.pre\n\t\t\t\tnow = now.parentNode\n\t\t\t} else {\n\t\t\t\treturn nil, false\n\t\t\t}\n\t\t}\n\t}\n\treturn res.findMinLevel(), false\n}", "title": "" }, { "docid": "b3a7bfe438d27f42c2b57d1773ee8165", "score": "0.45447436", "text": "func (i *IterUint32Uintptr) Seek(key uint32) {\n\tkey = i.t.transformKey(key)\n\ti.Reset()\n\tif i.t.length == 0 {\n\t\treturn\n\t}\n\t// Walk down tree until leaf node is found or critical bit differs\n\tvar last = &i.t.root\n\tfor last.crit != ^uint(0) && last.findCrit(key) == last.crit {\n\t\ti.nodes = append(i.nodes, last)\n\t\tlast = &last.children()[last.dir(key)]\n\t}\n\t// Done if last node matches key\n\tif last.crit == ^uint(0) && key == last.key {\n\t\ti.nodes = append(i.nodes, last)\n\t\treturn\n\t}\n\t// No exact match for key found. Check if correct node would be left (smaller key) or right (larger key) of the last one.\n\tvar dir = 0\n\tif i.t.transformKey(key) > i.t.transformKey(last.key) {\n\t\tdir = 1\n\t}\n\t// Walk upwards until the shared parent of previous and next key is found.\n\tfor l := len(i.nodes); l > 0; l-- {\n\t\t// The shared parent has the last removed node as a child on the opposite side of the direction where the correct node would be.\n\t\tif &i.nodes[l-1].children()[1-dir] == last {\n\t\t\treturn\n\t\t}\n\t\tlast = i.nodes[l-1]\n\t\ti.nodes = i.nodes[0 : l-1]\n\t}\n\t// There are no other keys as high or low as the correct one. Simulate a Next or Prev call that reached the end\n\ti.lastDir = 0\n\tif i.t.transformKey(key) > i.t.transformKey(last.key) {\n\t\ti.lastDir = 1\n\t}\n}", "title": "" }, { "docid": "dde72becc3e2d95f8c2d34eb15b6f48d", "score": "0.45441186", "text": "func (c *nodeMapint8string) find(key int8) (crit uint, child, parent *nodeMapint8string) {\n\tchild = c\n\tcrit = child.findCrit(key)\n\t// Keep going deeper until a leaf or an incompatible range is found.\n\tfor child.crit != ^uint(0) && child.crit == crit {\n\t\tparent = child\n\t\tchild = &(child.children())[child.dir(key)]\n\t\tcrit = child.findCrit(key)\n\t}\n\treturn\n}", "title": "" }, { "docid": "f9781a34fec0cd57356ffcf63a7895f7", "score": "0.45436132", "text": "func (a *ArrayImpl) Insert(node string) (int, error) {\n\n\t// if the slice is already empty, then no need to check for values\n\tif len(a.VertexList) == 0 {\n\t\treturn a.putValues(node), nil\n\t}\n\n\t// check if the node was already present\n\tfor _, v := range a.VertexList {\n\t\tif v == node {\n\t\t\treturn 0, errors.New(node + \" already on the vertex list\")\n\t\t}\n\t}\n\n\treturn a.putValues(node), nil\n}", "title": "" } ]
b7e05a36e4a1315725421994c9b687cc
lockKey returns a key for a lock that is specific to the operation named op being performed related to domainName and this config's CA.
[ { "docid": "9417951b5ce17bc23e263ace37866bfd", "score": "0.7961418", "text": "func (cfg *Config) lockKey(op, domainName string) string {\n\treturn fmt.Sprintf(\"%s_%s\", op, domainName)\n}", "title": "" } ]
[ { "docid": "06e80b8837d7d3f5136a9745c9cfde61", "score": "0.6550531", "text": "func (db *RedisDB) GetLockKey(key string) string {\n\treturn \"LOCK_KEY::\" + key\n}", "title": "" }, { "docid": "ae52589ead53415b38428fe58931b782", "score": "0.59630907", "text": "func KeyPeriodicLock(namespace string) string {\n\treturn fmt.Sprintf(\"%s:%s\", KeyPeriod(namespace), \"lock\")\n}", "title": "" }, { "docid": "4b9f282dbfb87f69d4450fdfe581bef2", "score": "0.58361447", "text": "func (lp *LockedPatch) GetKey() string {\n\treturn lp.Name\n}", "title": "" }, { "docid": "3f429d2778a4a8f5d45cb010e746661d", "score": "0.56355214", "text": "func makeLockKey(key string) (string, error) {\n\tif key == \"\" {\n\t\treturn \"\", errors.New(\"must specify valid mutex key\")\n\t}\n\n\treturn mutexPrefix + key, nil\n}", "title": "" }, { "docid": "0c018ff3df440f618b724bca242c696a", "score": "0.5611572", "text": "func (lp *LockedPatch) GetKey() string {\n\treturn lp.ID\n}", "title": "" }, { "docid": "ffbf763bb54bc06f38e990e35d0647f3", "score": "0.5572323", "text": "func getLockTimeBucketKey(lockValue types.LockValue) string {\n\treturn lockedByTimestampOutputsKeyPrefix + (lockValue - lockValue%7200).String()\n}", "title": "" }, { "docid": "719c52ce37fafe32350440aa388c6a92", "score": "0.55341756", "text": "func (mgr *IPAMPoolMgr) NameKey(name string) string {\n\treturn mgr.KeyPrefix() + name\n}", "title": "" }, { "docid": "82c7969ce0464b7314807e4b21edcaaa", "score": "0.54920644", "text": "func (ks *Store) Lock(addr Identity, pass string) (Identity, error) {\n\t_, err := ks.getKey(addr, pass)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tb58addr := types.EncodeAddress(addr)\n\n\tks.unlockedLock.Lock()\n\tdefer ks.unlockedLock.Unlock()\n\n\tif _, exist := ks.unlocked[b58addr]; exist {\n\t\tks.unlocked[b58addr] = nil\n\t\tdelete(ks.unlocked, b58addr)\n\t}\n\treturn addr, nil\n}", "title": "" }, { "docid": "39da812c000d6ff75b8ce67c215008a6", "score": "0.5454252", "text": "func (sm *StructMapping) GetOpLockSQLFieldName() string {\n\treturn sm.opLockSQLName\n}", "title": "" }, { "docid": "b1777e8eb8babe9aa1a94ca68aaffe58", "score": "0.5424811", "text": "func OperationKey(plan storage.OperationPlan) ops.SiteOperationKey {\n\treturn ops.SiteOperationKey{\n\t\tAccountID: plan.AccountID,\n\t\tSiteDomain: plan.ClusterName,\n\t\tOperationID: plan.OperationID,\n\t}\n}", "title": "" }, { "docid": "7464aa9603e147c4445bc527bfe45923", "score": "0.54224443", "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": "e539410148fd368fbdd5359f496bbc12", "score": "0.53298354", "text": "func (mgr *NetworkServiceMgr) NameKey(name string) string {\n\treturn mgr.KeyPrefix() + name\n}", "title": "" }, { "docid": "1844dc81c70e8cca52b26f47b2d8eab9", "score": "0.53245157", "text": "func (mgr *IPAMPoolMgr) KeyPrefix() string {\n\treturn controller.SfcControllerConfigPrefix() + \"ipam-pool/\"\n}", "title": "" }, { "docid": "8a9400de39110728b6f1c3fc3fad8eb1", "score": "0.52945715", "text": "func (PercentageOfActorsGate) Key() GateKey {\n\treturn PercentageOfActorsGateKey\n}", "title": "" }, { "docid": "c9b9c272c05bbdb7df0676d06fe6188a", "score": "0.52513945", "text": "func (e *Engine) Lock(key string) error {\n\tconn := e.pool.Get()\n\tdefer conn.Close()\n\n\t_, err := conn.Do(\"SETEX\", e.prefix+lockPrefix+key, e.cleanupTimeout.Seconds(), []byte(\"1\"))\n\treturn err\n}", "title": "" }, { "docid": "24190b9188b04cf35ad5cce31cbf510c", "score": "0.51985043", "text": "func (e LockRequestValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "0eae953efdd8e9f10d698ac6c2664765", "score": "0.5187547", "text": "func (d *DMap) Lock(key string, deadline time.Duration) (*LockContext, error) {\n\tm := &protocol.Message{\n\t\tDMap: d.name,\n\t\tKey: key,\n\t\tExtra: protocol.LockExtra{\n\t\t\tDeadline: deadline.Nanoseconds(),\n\t\t},\n\t}\n\tresp, err := d.client.Request(protocol.OpLock, m)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = checkStatusCode(resp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tctx := &LockContext{\n\t\tname: d.name,\n\t\tkey: key,\n\t\ttoken: resp.Value,\n\t\tdmap: d,\n\t}\n\treturn ctx, nil\n}", "title": "" }, { "docid": "54de11ff0066076780e6f7aace970fc3", "score": "0.51455843", "text": "func (c *Calcium) Lock(ctx context.Context, name string, timeout int) (lock.DistributedLock, error) {\n\tlock, err := c.store.CreateLock(name, timeout)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err = lock.Lock(ctx); err != nil {\n\t\treturn nil, err\n\t}\n\treturn lock, nil\n}", "title": "" }, { "docid": "9515eb41eccd20c84209ef71a93f4c70", "score": "0.5113896", "text": "func (locks *Locks) Lock(key string) {\n\tindex := locks.spread(fnv32(key))\n\tmu := locks.table[index]\n\tmu.Lock()\n}", "title": "" }, { "docid": "66c5833614d508ee046a95ff7e20007a", "score": "0.50698066", "text": "func (c *ConsulClient) Lock(key string) (Locker, error) {\n\treturn c.lockHandler(key)\n}", "title": "" }, { "docid": "a44b2b651da70edd46312217a0310087", "score": "0.5035329", "text": "func key(clusterName, ingressName, ingressNamespace string) string {\n\treturn strings.Join([]string{clusterName, ingressName, ingressNamespace}, \":\")\n}", "title": "" }, { "docid": "745da091996eb4c002eb267442eabdde", "score": "0.50232255", "text": "func (store *SessionStore) Lock(key string) sessions.Lock {\n\treturn store.Client.Lock(key)\n}", "title": "" }, { "docid": "8c323d96a539c9fe77fcc5ad0cd8ce0a", "score": "0.50139916", "text": "func (c *Conn) Key() string {\n\tc.state.Lock()\n\tdefer c.state.Unlock()\n\treturn c.key\n}", "title": "" }, { "docid": "7bdda9af9e040dfcf3cfc05aa8b944c8", "score": "0.50040907", "text": "func (l *lockable) Lock(key string, timeout int) (bool, error) {\n\tvar res string\n\tif l.lockVal == uuid.Nil {\n\t\tl.lockVal = uuid.New()\n\t}\n\tt := fmt.Sprintf(\"%d\", timeout)\n\tif err := l.client.Do(lockScript.Cmd(&res, key, l.lockVal.String(), t)); err != nil {\n\t\treturn false, nil\n\t} else {\n\t\treturn res == \"OK\", nil\n\t}\n}", "title": "" }, { "docid": "40c8bd46bf9f5793058e75a9b81a07af", "score": "0.500152", "text": "func (e ListNodePoolMgrStrategyReqValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "3c9d24212c09da02f84cc75a0b789c73", "score": "0.49883392", "text": "func (ri *RawInstruction) Key() string {\n\treturn ri.Op\n}", "title": "" }, { "docid": "407e36bc0fa5249a46e7bd360a299221", "score": "0.49807146", "text": "func (e GetNodePoolMgrStrategyReqValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "745b24b37704cfbbe1bec70e03696621", "score": "0.49702716", "text": "func (l *Lock) Lock(resourceID string) (lockID string, err error) {\n\tlockID = fmt.Sprintf(\"%s-%s-%d\", l.Resource, resourceID, GenerateTimeID())\n\treturn lockID, l.Client.XLock(\n\t\tfmt.Sprintf(\"%s-%s\", l.Resource, resourceID),\n\t\tlockID,\n\t\tlock.LockDetails{TTL: TTL},\n\t)\n}", "title": "" }, { "docid": "2ac5652221128793be66237226d3d6c6", "score": "0.49404398", "text": "func (r *pipelineRun) GetKey() string {\n\tkey, _ := cache.MetaNamespaceKeyFunc(r.apiObj)\n\treturn key\n}", "title": "" }, { "docid": "4e9005bafd211eb54a96fb6d8be3e74a", "score": "0.49245968", "text": "func GetJobKeyByReq(req *apis.Request) string {\n\treturn fmt.Sprintf(\"%s/%s\", req.Namespace, req.JobName)\n}", "title": "" }, { "docid": "904909c4830f863d830a0943bb3d8d78", "score": "0.49172986", "text": "func (s *BindOperation) key(iID internal.InstanceID, bID internal.BindingID, opID internal.OperationID) string {\n\treturn s.instanceKeyPrefix(iID) + s.bindKeyPrefix(bID) + string(opID)\n}", "title": "" }, { "docid": "ec063a7222ac847c348955357d1d1393", "score": "0.490936", "text": "func getLockPath(path string) string {\n\treturn path + \".lock\"\n}", "title": "" }, { "docid": "ec063a7222ac847c348955357d1d1393", "score": "0.490936", "text": "func getLockPath(path string) string {\n\treturn path + \".lock\"\n}", "title": "" }, { "docid": "337696aaabc63ba5f3dcddcfee9b20f8", "score": "0.49020952", "text": "func Key(node string) string {\n\treturn KeyPrefix() + node\n}", "title": "" }, { "docid": "337696aaabc63ba5f3dcddcfee9b20f8", "score": "0.49020952", "text": "func Key(node string) string {\n\treturn KeyPrefix() + node\n}", "title": "" }, { "docid": "b5e93460f94ac1ee1392ab49a511ba36", "score": "0.49019653", "text": "func (cg *Group) Key() string {\n\treturn cg.key\n}", "title": "" }, { "docid": "a1c71ca74f3e8f83ccfab3188f09cd80", "score": "0.489942", "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": "11bec9090c920ff853c2c20b6c56a919", "score": "0.48859367", "text": "func (this AggregateFunctionCall) Key() string {\n\treturn fmt.Sprintf(\"%s-%t-%v\", this.FunctionCall.Name, this.FunctionCall.Operands[0].Star, this.FunctionCall.Operands[0].Expr)\n}", "title": "" }, { "docid": "03e7c95ccbc0399e54e661689587b5ba", "score": "0.48814246", "text": "func getLockHeightBucketKey(lockValue types.LockValue) string {\n\treturn lockedByHeightOutputsKeyPrefix + lockValue.String()\n}", "title": "" }, { "docid": "225b529b1bc6a754cc89a4a88b1ca0a2", "score": "0.48770875", "text": "func (c *Contract) KeyPrefix() string { return c.ct.KeyPrefix }", "title": "" }, { "docid": "7e3a4f572e31f4808be950eb643f4956", "score": "0.48653746", "text": "func (s *Services) Lock(name string, config lock.LockClientConfig) (lock.Client, error) {\n\tsvc, err := s.service(name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif !svc.HasRole(s.ctx.Role) {\n\t\treturn nil, nil\n\t}\n\n\tif svc.Type != TypeLock {\n\t\treturn nil, fmt.Errorf(\"service %s is of type %s, not KVS\", name, svc.Type)\n\t}\n\n\t// If config is not given then use default config values.\n\tif config == nil {\n\t\tconfig = lock.MakeLockClientConfig()\n\t}\n\n\t// If a service name is given as part of the KVS config, then use that to\n\t// initialize the KVS client.\n\tif svcName, ok := svc.SvcParams[\"service\"]; ok {\n\t\treturn lock.MakeLockClient(svcName, config), nil\n\t}\n\n\treturn nil, fmt.Errorf(\"missing params for initializing lock namespace\")\n}", "title": "" }, { "docid": "505082d1e9876117b8f6f66612128935", "score": "0.48598865", "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": "920f89e97d63bf4210938225d21b6fe0", "score": "0.48591006", "text": "func getHashKey(hashKeyNames map[string]uint64, keyname string, concurrency int) uint64 {\n\tif v, ok := hashKeyNames[keyname]; ok {\n\t\treturn v\n\t}\n\treturn generateHashKey(hashKeyNames, keyname, concurrency)\n}", "title": "" }, { "docid": "9e5742b008bd42acfcef30665e743c88", "score": "0.48506206", "text": "func (e CreateNodePoolMgrStrategyReqValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "27cc7008b08cbf9c8b4b93bae4c35c8f", "score": "0.48452994", "text": "func (e *Endpoint) KeyName() string {\n\treturn \"Id\"\n}", "title": "" }, { "docid": "534b765e192de23548ebb205619cdcf4", "score": "0.48357552", "text": "func (t *Traceroute) Key() string {\n\treturn fmt.Sprintf(\"%s_%d_%d\", \"XXTR\", t.Src, t.Dst)\n}", "title": "" }, { "docid": "95b836c32dffd4cbaff49d8f5c460514", "score": "0.48189217", "text": "func (op *CreateHcxActivationKeyOperation) Name() string {\n\treturn op.lro.Name()\n}", "title": "" }, { "docid": "ea4e650db4d1f87c0a7f1203ff2bf4c0", "score": "0.48155555", "text": "func (cache *MemCache) lockForKey(category, key string) *locksutil.LockEntry {\n\t// If a lockset is present for the category, use it. Otherwise create one and add it.\n\tobj, ok := cache.locks.Load(category)\n\tif !ok {\n\t\tobj, _ = cache.locks.LoadOrStore(category, locksutil.CreateLocks())\n\t}\n\treturn locksutil.LockForKey(obj.([]*locksutil.LockEntry), key)\n}", "title": "" }, { "docid": "d3bbe934cae95b884a7a4310a1d32682", "score": "0.48136425", "text": "func (b EndpointBuilder) Key() string {\n\tparams := []string{\n\t\tb.clusterName,\n\t\tstring(b.network),\n\t\tstring(b.clusterID),\n\t\tstrconv.FormatBool(b.clusterLocal),\n\t\tutil.LocalityToString(b.locality),\n\t\tb.tunnelType.ToString(),\n\t}\n\tif b.push != nil && b.push.AuthnPolicies != nil {\n\t\tparams = append(params, b.push.AuthnPolicies.GetVersion())\n\t}\n\tif b.destinationRule != nil {\n\t\tparams = append(params, b.destinationRule.Name+\"/\"+b.destinationRule.Namespace)\n\t}\n\tif b.service != nil {\n\t\tparams = append(params, string(b.service.Hostname)+\"/\"+b.service.Attributes.Namespace)\n\t}\n\tif b.proxyView != nil {\n\t\tparams = append(params, b.proxyView.String())\n\t}\n\thash := md5.New()\n\tfor _, param := range params {\n\t\thash.Write([]byte(param))\n\t}\n\tsum := hash.Sum(nil)\n\treturn hex.EncodeToString(sum)\n}", "title": "" }, { "docid": "e8c71cc8dd12d3d50d395382a175b0c2", "score": "0.48127505", "text": "func datastoreKey(name string) *datastore.Key {\n\treturn datastore.NameKey(`DatastoreKeysCache`, name, nil)\n}", "title": "" }, { "docid": "6914c5e9524a040293bb4195f5596899", "score": "0.48060217", "text": "func (s *dbStore) tryConditionLockKey(tid uint64, key string) error {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\n\tif s.closed {\n\t\treturn errors.Trace(ErrDBClosed)\n\t}\n\n\tif _, ok := s.keysLocked[key]; ok {\n\t\treturn errors.Trace(kv.ErrLockConflict)\n\t}\n\n\tmetaKey := codec.EncodeBytes(nil, []byte(key))\n\tcurrValue, err := s.db.Get(metaKey)\n\tif errors2.ErrorEqual(err, kv.ErrNotExist) {\n\t\ts.keysLocked[key] = tid\n\t\treturn nil\n\t}\n\tif err != nil {\n\t\treturn errors.Trace(err)\n\t}\n\n\t// key not exist.\n\tif currValue == nil {\n\t\ts.keysLocked[key] = tid\n\t\treturn nil\n\t}\n\t_, ver, err := codec.DecodeUint(currValue)\n\tif err != nil {\n\t\treturn errors.Trace(err)\n\t}\n\n\t// If there's newer version of this key, returns error.\n\tif ver > tid {\n\t\tlog.Warnf(\"txn:%d, tryLockKey condition not match for key %s, currValue:%q\", tid, key, currValue)\n\t\treturn errors.Trace(kv.ErrConditionNotMatch)\n\t}\n\n\ts.keysLocked[key] = tid\n\treturn nil\n}", "title": "" }, { "docid": "da491fa9c8278385173c250b5d763104", "score": "0.4805657", "text": "func (key *Key) Lock(passphrase []byte) (*Key, error) {\n\tunlocked, err := key.IsUnlocked()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif !unlocked {\n\t\treturn nil, errors.New(\"gopenpgp: key is not unlocked\")\n\t}\n\n\tlockedKey, err := key.Copy()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif passphrase == nil {\n\t\treturn lockedKey, nil\n\t}\n\n\tif lockedKey.entity.PrivateKey != nil && !lockedKey.entity.PrivateKey.Dummy() {\n\t\terr = lockedKey.entity.PrivateKey.Encrypt(passphrase)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"gopenpgp: error in locking key\")\n\t\t}\n\t}\n\n\tfor _, sub := range lockedKey.entity.Subkeys {\n\t\tif sub.PrivateKey != nil && !sub.PrivateKey.Dummy() {\n\t\t\tif err := sub.PrivateKey.Encrypt(passphrase); err != nil {\n\t\t\t\treturn nil, errors.Wrap(err, \"gopenpgp: error in locking sub key\")\n\t\t\t}\n\t\t}\n\t}\n\n\tlocked, err := lockedKey.IsLocked()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !locked {\n\t\treturn nil, errors.New(\"gopenpgp: unable to lock key\")\n\t}\n\n\treturn lockedKey, nil\n}", "title": "" }, { "docid": "dd3eff7741b377884abcb8d7e6c4f202", "score": "0.48043936", "text": "func (e DeleteNodePoolMgrStrategyReqValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "985ebad6bffdd75eceb20c0c1a09f902", "score": "0.47993365", "text": "func getGroupKey(groupName string) string {\n return fmt.Sprintf(\"%s:%s\", KeyPrefixGroup, groupName)\n}", "title": "" }, { "docid": "d798e90af06ff5a08a7c3805e6cce122", "score": "0.4792751", "text": "func (o NodePoolOutput) KeyName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *NodePool) pulumi.StringPtrOutput { return v.KeyName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "7fe00e807c0f8498a711df87054f64ee", "score": "0.47803387", "text": "func (e UpdateNodePoolMgrStrategyReqValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "57324284c3aeadc5348e443122fb4c09", "score": "0.47607595", "text": "func (wd *WorkDir) Key() string {\n\treturn KeyWorkDir\n}", "title": "" }, { "docid": "c408b9881b418744158034cc3d9d1f69", "score": "0.47558686", "text": "func (_LockGatewayLogicV1 *LockGatewayLogicV1TransactorSession) Lock(_chain string, _to []byte, _payload []byte, _amount *big.Int) (*types.Transaction, error) {\n\treturn _LockGatewayLogicV1.Contract.Lock(&_LockGatewayLogicV1.TransactOpts, _chain, _to, _payload, _amount)\n}", "title": "" }, { "docid": "bd4d0b9774c0e937b42a1ffbff6b236a", "score": "0.4750295", "text": "func (el *endpointsLock) Identity() string {\n\treturn el.LockConfig.Identity\n}", "title": "" }, { "docid": "13f99e2f9be7fb5ea616b19d00ed9963", "score": "0.47469997", "text": "func NameKey(kind, name string, parent *Key) *Key {\n\treturn &Key{\n\t\tKind: kind,\n\t\tNameID: name,\n\t\tParent: parent,\n\t}\n}", "title": "" }, { "docid": "ccc4911393100d55ca258b2aa9ba8baf", "score": "0.47469386", "text": "func (d *diskHealthCheckingFS) Lock(name string) (io.Closer, error) {\n\treturn d.fs.Lock(name)\n}", "title": "" }, { "docid": "908cd6ddd8acd01163f5c8617360affc", "score": "0.4746877", "text": "func (fs *FSKeyStore) kubeCredLockfilePath(idx KeyIndex) string {\n\treturn keypaths.KubeCredLockfilePath(fs.KeyDir, idx.ProxyHost)\n}", "title": "" }, { "docid": "c9c6465c3b10d6cb12b586a1f83db15e", "score": "0.47422382", "text": "func (mo *DistributedVirtualPortgroup) Key() (string, error) {\n\tp, err := mo.currentProperty(\"key\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif p != nil {\n\t\treturn p.(string), nil\n\t}\n\treturn \"\", nil\n\n}", "title": "" }, { "docid": "734ab5a9034c86e724d661b86eb5aa45", "score": "0.47408718", "text": "func GetKey(name string) art.Key {\n\treturn art.Key(name)\n}", "title": "" }, { "docid": "e142ac79ef5ac96091dfc3e798df0782", "score": "0.47405386", "text": "func (o ClusterNodeGroupOptionsOutput) KeyName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ClusterNodeGroupOptions) *string { return v.KeyName }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "33a6a34b07754d49ff81372d5454f3a3", "score": "0.4739316", "text": "func (agent *Agent) GetFullKeyFor(field string) string {\n\treturn fmt.Sprintf(\"agent:%s:%s:%s\", field, agent.Organization, agent.CommonName)\n}", "title": "" }, { "docid": "a4210dabfd0b9eb5c0437dbbc8cef47d", "score": "0.47287005", "text": "func (ic *IntervalCache) MakeKey(start, end []byte) IntervalKey {\n\tif bytes.Compare(start, end) >= 0 {\n\t\tpanic(fmt.Sprintf(\"start key greater than or equal to end key %q >= %q\", start, end))\n\t}\n\treturn IntervalKey{\n\t\tRange: Range{\n\t\t\tStart: Comparable(start),\n\t\t\tEnd: Comparable(end),\n\t\t},\n\t\tid: uintptr(atomic.AddInt64(&intervalAlloc, 1)),\n\t}\n}", "title": "" }, { "docid": "07b94036f8a4708cd8c213dcca6db585", "score": "0.47197947", "text": "func Key(typ, name, namespace string) string {\n\treturn fmt.Sprintf(\"%s/%s/%s\", typ, namespace, name)\n}", "title": "" }, { "docid": "553b21d6f951e6670bb48f2cbb550013", "score": "0.4715137", "text": "func (s *PipelineBind) Key() (key string) {\n\treturn \"scheduler/pipeline_bind\"\n}", "title": "" }, { "docid": "0015a99c3031dab19a90278eec88e16a", "score": "0.47146472", "text": "func IngressKey(name, namespace string) string { return name + \".\" + namespace }", "title": "" }, { "docid": "2a0e9e1731f15665c145ad2cc1898ee7", "score": "0.4702827", "text": "func (r Resource) Key() string {\n\treturn r.Type + \":\" + r.ID\n}", "title": "" }, { "docid": "994b8471edffea8208c43483b024e548", "score": "0.46976858", "text": "func ComputeCLGroupKey(cls []*RunCL, isEquivalent bool) string {\n\tsort.Slice(cls, func(i, j int) bool {\n\t\t// ExternalID includes host and change number but not patchset; but\n\t\t// different patchsets of the same CL will never be included in the\n\t\t// same list, so sorting on only ExternalID is sufficient.\n\t\treturn cls[i].ExternalID < cls[j].ExternalID\n\t})\n\th := sha256.New()\n\t// CL group keys are meant to be opaque keys. We'd like to avoid people\n\t// depending on CL group key and equivalent CL group key sometimes being\n\t// equal. We can do this by adding a salt to the hash.\n\tif isEquivalent {\n\t\th.Write([]byte(\"equivalent_cl_group_key\"))\n\t}\n\tseparator := []byte{0}\n\tfor i, cl := range cls {\n\t\tif i > 0 {\n\t\t\th.Write(separator)\n\t\t}\n\t\th.Write([]byte(cl.Detail.GetGerrit().GetHost()))\n\t\th.Write(separator)\n\t\th.Write([]byte(strconv.FormatInt(cl.Detail.GetGerrit().GetInfo().GetNumber(), 10)))\n\t\th.Write(separator)\n\t\tif isEquivalent {\n\t\t\th.Write([]byte(strconv.FormatInt(int64(cl.Detail.GetMinEquivalentPatchset()), 10)))\n\t\t} else {\n\t\t\th.Write([]byte(strconv.FormatInt(int64(cl.Detail.GetPatchset()), 10)))\n\t\t}\n\t}\n\treturn hex.EncodeToString(h.Sum(nil)[:8])\n}", "title": "" }, { "docid": "8c31e0ab0ed95a505833f97bf400e38d", "score": "0.46962553", "text": "func (alibaba *Alibaba) GetKey(mapValue map[string]string, node *v1.Node) models.Key {\n\tslimK8sNode := generateSlimK8sNodeFromV1Node(node)\n\n\tvar aak *credentials.AccessKeyCredential\n\tvar err error\n\tvar ok bool\n\tvar client *sdk.Client\n\tvar signer *signers.AccessKeySigner\n\n\toptimizedKeyword := \"\"\n\tif slimK8sNode.IsIoOptimized {\n\t\toptimizedKeyword = ALIBABA_OPTIMIZE_KEYWORD\n\t} else {\n\t\toptimizedKeyword = ALIBABA_NON_OPTIMIZE_KEYWORD\n\t}\n\n\tvar diskCategory, diskSizeInGiB, diskPerformanceLevel string\n\n\tif !alibaba.accessKeyisLoaded() {\n\t\taak, err = alibaba.GetAlibabaAccessKey()\n\t\tif err != nil {\n\t\t\tlog.Warnf(\"unable to set the signer for node with providerID %s to retrieve the key skipping SystemDisk Retrieval with err: %v\", slimK8sNode.ProviderID, err)\n\t\t\treturn NewAlibabaNodeKey(slimK8sNode, optimizedKeyword, diskCategory, diskSizeInGiB, diskPerformanceLevel)\n\t\t}\n\t} else {\n\t\taak = alibaba.accessKey\n\t}\n\n\tsigner = signers.NewAccessKeySigner(aak)\n\n\tif aak == nil {\n\t\tlog.Warnf(\"unable to retrieve the Alibaba API keys for node with providerID %s hence skipping SystemDisk Retrieval\", slimK8sNode.ProviderID)\n\t\treturn NewAlibabaNodeKey(slimK8sNode, optimizedKeyword, diskCategory, diskSizeInGiB, diskPerformanceLevel)\n\t}\n\n\tif client, ok = alibaba.clients[slimK8sNode.RegionID]; !ok {\n\t\tclient, err = sdk.NewClientWithAccessKey(slimK8sNode.RegionID, aak.AccessKeyId, aak.AccessKeySecret)\n\t\tif err != nil {\n\t\t\tlog.Warnf(\"unable to set the client for node with providerID %s to retrieve the key skipping SystemDisk Retrieval with err: %v\", slimK8sNode.ProviderID, err)\n\t\t\treturn NewAlibabaNodeKey(slimK8sNode, optimizedKeyword, diskCategory, diskSizeInGiB, diskPerformanceLevel)\n\t\t}\n\t\talibaba.clients[slimK8sNode.RegionID] = client\n\t}\n\n\tinstanceID := getInstanceIDFromProviderID(slimK8sNode.ProviderID)\n\tslimK8sNode.SystemDisk = getSystemDiskInfoOfANode(instanceID, slimK8sNode.RegionID, client, signer)\n\n\tif slimK8sNode.SystemDisk != nil {\n\t\tdiskCategory = slimK8sNode.SystemDisk.DiskCategory\n\t\tdiskSizeInGiB = slimK8sNode.SystemDisk.SizeInGiB\n\t\tdiskPerformanceLevel = slimK8sNode.SystemDisk.PerformanceLevel\n\t}\n\treturn NewAlibabaNodeKey(slimK8sNode, optimizedKeyword, diskCategory, diskSizeInGiB, diskPerformanceLevel)\n}", "title": "" }, { "docid": "26aad7adc54b10c78c6b5368277cc267", "score": "0.46954337", "text": "func (l *Lock) GetKeyspaceName() string {\n\treturn l.Keyspace.Name\n}", "title": "" }, { "docid": "5cb4f2b3c58636872e9b0990be8a3cbd", "score": "0.4695023", "text": "func (o *KubernetesNodePoolLabel) GetKey() *string {\n\tif o == nil {\n\t\treturn nil\n\t}\n\n\treturn o.Key\n}", "title": "" }, { "docid": "5d17eec018b78cd4ce9ac39c44f8c8eb", "score": "0.46947488", "text": "func (m *Mutex) Lock(ctx context.Context) error {\n\tresp, err := m.tryAcquire(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// if no key on prefix / the minimum rev is key, already hold the lock\n\townerKey := resp.Responses[1].GetResponseRange().Kvs\n\tif len(ownerKey) == 0 || ownerKey[0].CreateRevision == m.myRev {\n\t\tm.hdr = resp.Header\n\t\treturn nil\n\t}\n\tclient := m.s.Client()\n\t// wait for deletion revisions prior to myKey\n\t// TODO: early termination if the session key is deleted before other session keys with smaller revisions.\n\t_, werr := waitDeletes(ctx, client, m.pfx, m.myRev-1)\n\t// release lock key if wait failed\n\tif werr != nil {\n\t\tm.Unlock(client.Ctx())\n\t\treturn werr\n\t}\n\n\t// make sure the session is not expired, and the owner key still exists.\n\tgresp, werr := client.Get(ctx, m.myKey)\n\tif werr != nil {\n\t\tm.Unlock(client.Ctx())\n\t\treturn werr\n\t}\n\n\tif len(gresp.Kvs) == 0 { // is the session key lost?\n\t\treturn ErrSessionExpired\n\t}\n\tm.hdr = gresp.Header\n\n\treturn nil\n}", "title": "" }, { "docid": "e0500724e93df38176f9532ccbdc8864", "score": "0.46873608", "text": "func Key(id ezkube.ResourceId) string {\n\tif clusterId, ok := id.(ezkube.ClusterResourceId); ok {\n\t\treturn clusterId.GetName() + \".\" + clusterId.GetNamespace() + \".\" + clusterId.GetClusterName()\n\t}\n\treturn id.GetName() + \".\" + id.GetNamespace() + \".\"\n}", "title": "" }, { "docid": "48294b81b047b79a6187f905d6a9115c", "score": "0.46858072", "text": "func (_LockGatewayLogicV1 *LockGatewayLogicV1Transactor) Lock(opts *bind.TransactOpts, _chain string, _to []byte, _payload []byte, _amount *big.Int) (*types.Transaction, error) {\n\treturn _LockGatewayLogicV1.contract.Transact(opts, \"lock\", _chain, _to, _payload, _amount)\n}", "title": "" }, { "docid": "45718bce8580f4f553dd7a1a6532a465", "score": "0.46849325", "text": "func (e LockResponseValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "bfcf415d5ce1fdcbd876a40ecb7d19af", "score": "0.46782097", "text": "func (_LockGatewayLogicV1 *LockGatewayLogicV1Session) Lock(_chain string, _to []byte, _payload []byte, _amount *big.Int) (*types.Transaction, error) {\n\treturn _LockGatewayLogicV1.Contract.Lock(&_LockGatewayLogicV1.TransactOpts, _chain, _to, _payload, _amount)\n}", "title": "" }, { "docid": "497674cc90dd3e619a6139f6e8f43cb1", "score": "0.46769196", "text": "func (kms *manager) NodeKey() *Key {\n\treturn kms.ownerKey\n}", "title": "" }, { "docid": "39abbbbb6e3e6c042e0401d4ecebcb46", "score": "0.46752462", "text": "func (cmt *Comment) Key() string {\n\treturn KeyComment\n}", "title": "" }, { "docid": "865f29826a01e6919ad97aed43140b8c", "score": "0.46725887", "text": "func (store *ScheduleStore) Key(ctx context.Context, client datastore.Client, id string) datastore.Key {\n\treturn client.NameKey(store.Kind(), uuid.New().String(), nil)\n}", "title": "" }, { "docid": "a4ab1e7c22255f14a3eedc09671938c4", "score": "0.46715492", "text": "func keyfunc(t *jwt.Token) (interface{}, error) {\n\treturn []byte(opSharedSecret), nil\n}", "title": "" }, { "docid": "1b51de7275feff8789e1bbc88dc91135", "score": "0.46674836", "text": "func GetLockCommand() *cobra.Command {\n\tlockCommand.Flags().StringVarP(&lockName, \"name\", \"n\", \"\", \"Name of the mutex\")\n\tlockCommand.MarkFlagRequired(\"name\")\n\tlockCommand.Flags().StringVarP(&lockOutput, \"output\", \"o\", \"json\", \"Formats the output {json|token}\")\n\tlockCommand.Flags().IntVarP(&lockTimeout, \"timeout\", \"t\", 0, \"Time in seconds with automatically trying to lock a mutex, when it is already lock by someone else\")\n\tlockCommand.Flags().StringVarP(&lockOwner, \"owner\", \"O\", \"\", \"Owner of the mutex (can be seen by everyone knowing the mutex name)\")\n\treturn lockCommand\n}", "title": "" }, { "docid": "d0bbb0c4026e3434e1088ba27a4f8076", "score": "0.4666835", "text": "func getReadDataCacheKey(queryInput SingleQueryInput, token string) string {\n\tlocale := \"\"\n\tif queryInput.Language != \"\" {\n\t\tlocale = queryInput.Language + \"-\"\n\t} else {\n\t\tlocale = queryInput.DefaultLanguage + \"-\"\n\t}\n\tif queryInput.Country != \"\" {\n\t\tlocale += queryInput.Country\n\t} else {\n\t\tlocale += queryInput.DefaultCountry\n\t}\n\n\tkey := common.GetServiceOwnerId() + \":\" + locale + \":\" + token\n\n\tif queryInput.TargetId != \"\" {\n\t\tkey += \":\" + queryInput.TargetId\n\t}\n\n\treturn key\n}", "title": "" }, { "docid": "0eb1859b230e81a00114a094b8f785e3", "score": "0.4665034", "text": "func (c *Cluster) GetUnlockKey() (string, error) {\n\tc.mu.RLock()\n\tdefer c.mu.RUnlock()\n\n\tstate := c.currentNodeState()\n\tif !state.IsActiveManager() {\n\t\treturn \"\", c.errNoManager(state)\n\t}\n\n\tctx, cancel := c.getRequestContext()\n\tdefer cancel()\n\n\tclient := swarmapi.NewCAClient(state.grpcConn)\n\n\tr, err := client.GetUnlockKey(ctx, &swarmapi.GetUnlockKeyRequest{})\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif len(r.UnlockKey) == 0 {\n\t\t// no key\n\t\treturn \"\", nil\n\t}\n\n\treturn encryption.HumanReadableKey(r.UnlockKey), nil\n}", "title": "" }, { "docid": "dd683f0fbdb535fb215bc187a5608f0e", "score": "0.46525973", "text": "func (s *Store) GetLock() *api.Lock {\n\tlock, err := s.consul.LockKey(poolLockKey)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn lock\n}", "title": "" }, { "docid": "181e77adc5f7a7700c88aa3722d579e2", "score": "0.46521288", "text": "func (authRule *AuthRule) GetKey() string {\n\treturn \"id\"\n}", "title": "" }, { "docid": "3c2d12a1328de00de78fabeacb8d2fbc", "score": "0.46408722", "text": "func (cmd *Cmd) Key() string {\n\treturn KeyCmd\n}", "title": "" }, { "docid": "30b4c65c5821d3b1ef921689cdd3635a", "score": "0.46396583", "text": "func newCacheKey(modulePin bufmoduleref.ModulePin) string {\n\treturn normalpath.Join(modulePin.Remote(), modulePin.Owner(), modulePin.Repository(), modulePin.Commit())\n}", "title": "" }, { "docid": "4ec8fdc0f963fa50821156cec454a333", "score": "0.46360666", "text": "func (np NodePort) GetKey() string {\n\treturn np.key\n}", "title": "" }, { "docid": "bc1c74d9c9dc6c90c0ea5af965cbde14", "score": "0.4633132", "text": "func (op *CreateTagKeyOperation) Name() string {\n\treturn op.lro.Name()\n}", "title": "" }, { "docid": "91f2836f7d99e3a7323ce6273ee9e23e", "score": "0.46327108", "text": "func (o ClusterNodeGroupOptionsPtrOutput) KeyName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *ClusterNodeGroupOptions) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.KeyName\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "b386e9b649ded8eeff5bd5fa39e02b66", "score": "0.46302667", "text": "func cacheKey(k string) string {\n\treturn fmt.Sprintf(\"%s:%s\", k, cacheKeyVsn)\n}", "title": "" }, { "docid": "31fe822109f2ab73b890841a9c75343f", "score": "0.46284488", "text": "func (r *remoteClient) Lock(info *statemgr.LockInfo) (string, error) {\n\tctx := context.Background()\n\n\tlockErr := &statemgr.LockError{Info: r.lockInfo}\n\n\t// Lock the workspace.\n\t_, err := r.client.Workspaces.Lock(ctx, r.workspace.ID, tfe.WorkspaceLockOptions{\n\t\tReason: tfe.String(\"Locked by Terraform\"),\n\t})\n\tif err != nil {\n\t\tif err == tfe.ErrWorkspaceLocked {\n\t\t\tlockErr.Info = info\n\t\t\terr = fmt.Errorf(\"%s (lock ID: \\\"%s/%s\\\")\", err, r.organization, r.workspace.Name)\n\t\t}\n\t\tlockErr.Err = err\n\t\treturn \"\", lockErr\n\t}\n\n\tr.lockInfo = info\n\n\treturn r.lockInfo.ID, nil\n}", "title": "" }, { "docid": "7d1522f7d646e1ccfb1dd9051920857d", "score": "0.46266574", "text": "func (op *DeleteTagKeyOperation) Name() string {\n\treturn op.lro.Name()\n}", "title": "" }, { "docid": "4bd31ef29d6b504c0b4c92702d942b8b", "score": "0.46212432", "text": "func (s *MutexMap) Lock(k string) {\n\ts.getMu(k).Lock()\n}", "title": "" }, { "docid": "c1dd6e0ccfb58be921b5f2810039fa47", "score": "0.46152866", "text": "func (cml *EtcdLock) Identity() string {\n\treturn cml.WhoAmI\n}", "title": "" }, { "docid": "0ecfff02cff5a0ca6fb1f8a868ee9232", "score": "0.46100694", "text": "func (status Status) Key() string {\n\treturn Config.GetKeyPrefix() + string(status)\n}", "title": "" } ]
9cdbc4962d24878c46d5b8a20f1d449a
NewDecoder returns a new NetFlow decoder configured using the passed configuration.
[ { "docid": "e5afd24ec6502c91aee2f5219d5440fd", "score": "0.7853845", "text": "func NewDecoder(config *config.Config) (*Decoder, error) {\n\tdecoder := &Decoder{\n\t\tprotos: make(map[uint16]protocol.Protocol, len(config.Protocols())),\n\t}\n\tfor _, protoName := range config.Protocols() {\n\t\tfactory, err := protocol.Registry.Get(protoName)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tproto := factory(*config)\n\t\tdecoder.protos[proto.Version()] = proto\n\t}\n\treturn decoder, nil\n}", "title": "" } ]
[ { "docid": "51697764593aea8fcac53a8927820cf9", "score": "0.7632243", "text": "func (cfg *Config) NewDecoder(r io.Reader) *Decoder {\n\treturn &Decoder{r, cfg}\n}", "title": "" }, { "docid": "a8124e481669bbd6e4b95cb3bfd696d4", "score": "0.734175", "text": "func NewDecoder(config *DecoderConfig) (*Decoder, error) {\n\tval := reflect.ValueOf(config.Result)\n\tif val.Kind() != reflect.Ptr {\n\t\treturn nil, errors.New(\"result must be a pointer\")\n\t}\n\n\tval = val.Elem()\n\tif !val.CanAddr() {\n\t\treturn nil, errors.New(\"result must be addressable (a pointer)\")\n\t}\n\n\tif config.Metadata != nil {\n\t\tif config.Metadata.Keys == nil {\n\t\t\tconfig.Metadata.Keys = make([]string, 0)\n\t\t}\n\n\t\tif config.Metadata.Unused == nil {\n\t\t\tconfig.Metadata.Unused = make([]string, 0)\n\t\t}\n\n\t\tif config.Metadata.Unset == nil {\n\t\t\tconfig.Metadata.Unset = make([]string, 0)\n\t\t}\n\t}\n\n\tif config.TagName == \"\" {\n\t\tconfig.TagName = \"mapstructure\"\n\t}\n\n\tif config.MatchName == nil {\n\t\tconfig.MatchName = strings.EqualFold\n\t}\n\n\tresult := &Decoder{\n\t\tconfig: config,\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "2197727ed93f38cf4fb7dd02a75ac43a", "score": "0.69520456", "text": "func NewDecoder() *Decoder {\n\treturn &Decoder{}\n}", "title": "" }, { "docid": "2197727ed93f38cf4fb7dd02a75ac43a", "score": "0.69520456", "text": "func NewDecoder() *Decoder {\n\treturn &Decoder{}\n}", "title": "" }, { "docid": "0de9434096d5d250f43d045ea6ff96a4", "score": "0.6813007", "text": "func NewDecoder(p *Parser) *Decoder {\n\treturn &Decoder{p: p}\n}", "title": "" }, { "docid": "f642c84a5a718f7e279ad35cce58fdcd", "score": "0.6806785", "text": "func NewDecoder(b []byte) *Decoder {\n\treturn &Decoder{orig: b, in: b}\n}", "title": "" }, { "docid": "e77b50fe5aafea3e6fea95125163e0fa", "score": "0.6789482", "text": "func NewDecoder(dec Decoder) Decoder {\n\treturn decoder{dec}\n}", "title": "" }, { "docid": "f742e9d9e71f0845de8f548389a3205c", "score": "0.6773054", "text": "func NewDecoder(reader io.Reader) Decoder {\n\treturn Decoder{\n\t\treader,\n\t}\n}", "title": "" }, { "docid": "e714c3952cd2c984032c0c1b722a08a7", "score": "0.6749483", "text": "func NewDecoder() codec.Decoder {\n\treturn &decoder{}\n}", "title": "" }, { "docid": "43358f226476360671521783a7984c63", "score": "0.6740749", "text": "func NewDecoder() *Decoder {\n\treturn &Decoder{\n\t\tbuf: bytes.NewBuffer(nil),\n\t\tsize: -1,\n\t}\n}", "title": "" }, { "docid": "999daae2120cc6e0b9d1f0c4b7e5f57b", "score": "0.6739218", "text": "func NewDecoder(r io.Reader) *Decoder {\n\treturn &Decoder{\n\t\tr: r,\n\t}\n}", "title": "" }, { "docid": "999daae2120cc6e0b9d1f0c4b7e5f57b", "score": "0.6739218", "text": "func NewDecoder(r io.Reader) *Decoder {\n\treturn &Decoder{\n\t\tr: r,\n\t}\n}", "title": "" }, { "docid": "a3838cc3415071ae795e6fb6fb784dbd", "score": "0.6719019", "text": "func NewDecoder() *Decoder {\n\treturn &Decoder{cache: newCache()}\n}", "title": "" }, { "docid": "896d5867cbddec55c13fac8cbbc87e5f", "score": "0.6702519", "text": "func NewDecoder() NetStringDecoder {\n\treturn NetStringDecoder{\n\t\tlength: 0,\n\t\tstate: PARSE_LENGTH,\n\t\tDataOutput: make(chan []byte, BUFFER_COUNT),\n\t\tseparatorSymbol: byte(':'),\n\t\tendSymbol: byte(','),\n\t\tdebugMode: false,\n\t}\n\n}", "title": "" }, { "docid": "1c8258a887537d69723af2011b5ea7f0", "score": "0.66950154", "text": "func (sv *server) NewDecoder(codec string, c net.Conn) Decoder {\n\tdecf, ok := sv.config.Codecs[codec]\n\tif !ok {\n\t\tlog.Panicf(\"No such decoder [%s]\", codec)\n\t}\n\treturn decf.NewDecoder(c)\n}", "title": "" }, { "docid": "7338ece95ee7f0a8033cb2d24d8077b0", "score": "0.669373", "text": "func NewDecoder(r io.Reader) *Decoder {\n\treturn &Decoder{r: r}\n}", "title": "" }, { "docid": "7338ece95ee7f0a8033cb2d24d8077b0", "score": "0.669373", "text": "func NewDecoder(r io.Reader) *Decoder {\n\treturn &Decoder{r: r}\n}", "title": "" }, { "docid": "7338ece95ee7f0a8033cb2d24d8077b0", "score": "0.669373", "text": "func NewDecoder(r io.Reader) *Decoder {\n\treturn &Decoder{r: r}\n}", "title": "" }, { "docid": "92e6ea666eb7a644fa9824bbea56340f", "score": "0.66820794", "text": "func NewDecoder() *Decoder {\n\tinterfaceRegistry := codectypes.NewInterfaceRegistry()\n\n\treturn &Decoder{\n\t\tinterfaceRegistry,\n\t}\n}", "title": "" }, { "docid": "3638779fa3525c49dde9acbd66523527", "score": "0.6677942", "text": "func NewDecoder(delegate DecoderDelegate, indexFile string) (*Decoder, error) {\n\treturn newDecoder(defaultFileIO{}, delegate, indexFile)\n}", "title": "" }, { "docid": "9a0498650a0f7df47a973f7d7a0d1575", "score": "0.6670221", "text": "func NewDecoder() *Decoder {\n\treturn (*Decoder)(allocDecoderMemory(1))\n}", "title": "" }, { "docid": "d3c00f5040cf8ec2099e6d6ef9934cec", "score": "0.66673094", "text": "func NewDecoder(md *mapstructure.Metadata, dst interface{}) (Decoder, error) {\n\treturn mapstructure.NewDecoder(\n\t\t&mapstructure.DecoderConfig{Metadata: md, Result: dst},\n\t)\n}", "title": "" }, { "docid": "dfc6dbb25861f08238448940ee2161e6", "score": "0.66594493", "text": "func NewDecoder(r *cue.Runtime, path string, src io.Reader) *Decoder {\n\treturn &Decoder{\n\t\tr: r,\n\t\tpath: path,\n\t\tdec: json.NewDecoder(src),\n\t\toffset: 1,\n\t}\n}", "title": "" }, { "docid": "67f23ccc43b6dcd7f6a64358cfa310a9", "score": "0.66393554", "text": "func NewDecoder(val interface{}) Decoder {\n\treturn &decoder{input: val}\n}", "title": "" }, { "docid": "8ebbbb724696d41d32a5effb5c23df4f", "score": "0.6638636", "text": "func NewDecoder(r io.Reader) *Decoder {\n\treturn &Decoder{reader: r}\n}", "title": "" }, { "docid": "12e7bc5db7ed8cc83ac22f049031feaa", "score": "0.66122717", "text": "func NewDecoder(data []byte) Decoder {\n\treturn Decoder{\n\t\tdata: data,\n\t\toffset: 0,\n\t}\n}", "title": "" }, { "docid": "8e4f7accd3bea79d38b3a4d3ebb5c3db", "score": "0.65977013", "text": "func NewDecoder(r io.Reader) *Decoder {\n\treturn &Decoder{\n\t\tdata: bufio.NewReader(r),\n\t}\n}", "title": "" }, { "docid": "8e4f7accd3bea79d38b3a4d3ebb5c3db", "score": "0.65977013", "text": "func NewDecoder(r io.Reader) *Decoder {\n\treturn &Decoder{\n\t\tdata: bufio.NewReader(r),\n\t}\n}", "title": "" }, { "docid": "6d4003350089b5aaf05f7a0705f6ae1d", "score": "0.6594791", "text": "func NewDecoder(b []byte) *Decoder {\n\treturn &Decoder{b, 0, false, 0}\n}", "title": "" }, { "docid": "68f00cfb27dcd5c256e5743cda6d4966", "score": "0.65925246", "text": "func NewDecoder(r io.Reader) *Decoder {\n\treturn &Decoder{\n\t\tr: r,\n\t\tbuffer: make([]byte, 240),\n\t}\n}", "title": "" }, { "docid": "9a65e6d44335c527feb1b74d6ed0e7f5", "score": "0.6582908", "text": "func NewDecoder(r io.Reader) io.Reader", "title": "" }, { "docid": "9a65e6d44335c527feb1b74d6ed0e7f5", "score": "0.6582908", "text": "func NewDecoder(r io.Reader) io.Reader", "title": "" }, { "docid": "2b639056c2e174e78d0fd1317f992b34", "score": "0.6571397", "text": "func NewDecoder(r io.Reader) Decoder {\n\treturn NewDecoderWithLineDelimiter(r, '\\n')\n}", "title": "" }, { "docid": "41a38bd2611ceaa0390db51019678c93", "score": "0.6568312", "text": "func NewDecoder(r io.Reader, bufSize int) *Decoder {\n\treturn &Decoder{\n\t\tframeReader: bufio.NewReaderSize(r, bufSize),\n\t\tblockReader: bufio.NewReaderSize(r, 4096),\n\t}\n}", "title": "" }, { "docid": "482080e95fe334a94dfc13befcd34bdd", "score": "0.65612197", "text": "func NewDecoder(r io.Reader) *Decoder {\n\treturn &Decoder{\n\t\tr: bufio.NewReader(r),\n\t}\n}", "title": "" }, { "docid": "1b1c36c7cec7714626fd22ec2746a386", "score": "0.6556243", "text": "func NewDecoder(opts DecoderOptions) *Decoder {\n\treturn &Decoder{opts: opts}\n}", "title": "" }, { "docid": "e735a31755a74417511122f45dbef43b", "score": "0.6534163", "text": "func NewDecoder(enc *Encoding, r io.Reader) *Decoder {\n\treturn &Decoder{r: r, s: &scanner{enc: enc}}\n}", "title": "" }, { "docid": "02a5945a7f7595efcc868b0592159900", "score": "0.6519801", "text": "func NewDecoder(r io.Reader) *Decoder {\r\n\treturn &Decoder{\r\n\t\tbr: bufio.NewReader(r),\r\n\t\tb: make([]byte, 1024),\r\n\t}\r\n}", "title": "" }, { "docid": "7e800fb5c039316e9f87371697e49e56", "score": "0.6476347", "text": "func (Encoding) NewDecoder(r io.Reader) io.Reader {\n\treturn &decoder{r: r}\n}", "title": "" }, { "docid": "a877fc0a1bee803368ea4c27466d885b", "score": "0.6466895", "text": "func NewDecoder(enc *Encoding, r io.Reader) io.Reader {}", "title": "" }, { "docid": "4c1af039e5dd4c4a6bd4994e2fad072e", "score": "0.6462668", "text": "func NewDecoder(r io.Reader) *Decoder {\n\treturn &Decoder{r: bufio.NewReader(r)}\n}", "title": "" }, { "docid": "979bc5b91bd13541d2e5ac9c6df61cd9", "score": "0.64590883", "text": "func (marshaller *ProtoMarshaller) NewDecoder(reader io.Reader) Decoder {\n\treturn DecoderFunc(func(value interface{}) error {\n\t\tbuffer, err := ioutil.ReadAll(reader)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn marshaller.Unmarshal(buffer, value)\n\t})\n}", "title": "" }, { "docid": "929b7d877f176c3e2f1f8bb2e86d9527", "score": "0.6442882", "text": "func NewDecoder(enc *Encoding, r io.Reader) io.Reader {\n\treturn &decoder{enc: enc, r: &newlineFilteringReader{r}}\n}", "title": "" }, { "docid": "447a28591e9d64f1e3b8280c6bee8913", "score": "0.64352435", "text": "func NewDecoder(r io.Reader, msize uint32) *Decoder {\n\treturn &Decoder{\n\t\tbuf: binary.NewBuffer(nil),\n\t\tr: bufio.NewReader(r),\n\n\t\tMaxMessageSize: msize,\n\t}\n}", "title": "" }, { "docid": "f4d9c5cc191eaf19bcbad5919124f9b2", "score": "0.6418126", "text": "func NewDecoder(r io.Reader) *Decoder {\n\treturn &Decoder{\n\t\ts: bufio.NewScanner(r),\n\t}\n}", "title": "" }, { "docid": "14ad564acb4cdd41cdbef5bb1f9c74ea", "score": "0.6408351", "text": "func NewDecoder(r io.Reader) *Decoder {\n\treturn &Decoder{\n\t\tr: bufio.NewReaderSize(r, bufioReaderSize),\n\t}\n}", "title": "" }, { "docid": "04826e9cbb52e37eaaae35451b6ff952", "score": "0.63692653", "text": "func NewDecoder(opts *options.CBEDecoderOptions) *Decoder {\n\t_this := &Decoder{}\n\t_this.Init(opts)\n\treturn _this\n}", "title": "" }, { "docid": "17a277251ec309d993271ed93399634d", "score": "0.6366471", "text": "func (s *Session) NewDecoder() *Decoder {\n\treturn NewDecoder(s.reader)\n}", "title": "" }, { "docid": "71d0ede501441a337def9ec68ef60470", "score": "0.63487244", "text": "func NewDecoder(r io.Reader) (*PacketDecoder, error) {\n\tvar closer io.Closer\n\tif limit, ok := r.(*limitReader); ok {\n\t\tcloser = limit\n\t}\n\tdefer func() {\n\t\tif closer != nil {\n\t\t\tcloser.Close()\n\t\t}\n\t}()\n\n\tb := []byte{0xff}\n\tif _, err := r.Read(b); err != nil {\n\t\treturn nil, err\n\t}\n\tmsgType := message.MessageText\n\tif b[0] == 'b' {\n\t\tif _, err := r.Read(b); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tr = base64.NewDecoder(base64.StdEncoding, r)\n\t\tmsgType = message.MessageBinary\n\t}\n\tif b[0] >= '0' {\n\t\tb[0] = b[0] - '0'\n\t} else {\n\t\tmsgType = message.MessageBinary\n\t}\n\tt, err := ByteToType(b[0])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tret := &PacketDecoder{\n\t\tcloser: closer,\n\t\tr: r,\n\t\tt: t,\n\t\tmsgType: msgType,\n\t}\n\tcloser = nil\n\treturn ret, nil\n}", "title": "" }, { "docid": "3c28df4eb3ead29d8985ac1cb503becf", "score": "0.63330185", "text": "func NewDecoder(bytes []byte) *Decoder {\n\treturn &Decoder{data: bytes}\n}", "title": "" }, { "docid": "d8e603576338ec9d324455ae9b34e3db", "score": "0.6316089", "text": "func NewDecoder(reader io.Reader) *Decoder {\n\treturn &Decoder{reader: reader, scanner: bufio.NewScanner(reader)}\n}", "title": "" }, { "docid": "040591c7906f5d2214e36347259f864b", "score": "0.6313441", "text": "func NewDecoder(r io.Reader) *Decoder {\n\tvar d Decoder\n\td.r = r\n\t// Initialize with a 64 byte buffer\n\td.buf = make([]byte, 64)\n\treturn &d\n}", "title": "" }, { "docid": "b69b7760879e96a615d66d51a27070af", "score": "0.629331", "text": "func NewDecoder(r io.Reader) *Decoder {\n\tvar d Decoder\n\td.decoder = json.NewDecoder(io.TeeReader(r, &d.input))\n\treturn &d\n}", "title": "" }, { "docid": "5f6281adaf16b6e1c5849326de18b8a8", "score": "0.6282624", "text": "func NewDecoder(reader io.Reader) *Decoder {\n\tdec := Decoder{scan: scanner.Scanner{Mode: scanner.GoTokens}}\n\tdec.scan.Init(reader)\n\treturn &dec\n}", "title": "" }, { "docid": "4cf83c70dcf13a5d4d86490c2d6bf284", "score": "0.6241565", "text": "func NewDecoder(enc *Encoding, r io.Reader) io.Reader", "title": "" }, { "docid": "2f51db87be0032e8e222aa36aa9fe930", "score": "0.62119424", "text": "func NewDecoder(r io.Reader) *FBitDecoder {\n\tdec := new(FBitDecoder)\n\tdec.r = r\n\tdec.msgpkdec = msgpack.NewDecoder(r)\n\n\treturn dec\n}", "title": "" }, { "docid": "ebc46ae5efaa6ae152f28a2436991a7d", "score": "0.62080455", "text": "func NewDecoder(reader bufio.Reader, disableFileCheck bool) *Decoder {\n\treturn &Decoder{r: &reader, fileCheck: disableFileCheck}\n}", "title": "" }, { "docid": "68fde3670d7ac14ab150830ecc61f81e", "score": "0.61944467", "text": "func NewDecoder(r io.ReadSeeker) *Decoder {\n\treturn &Decoder{r: r, byteOrder: binary.BigEndian}\n}", "title": "" }, { "docid": "013b06ac92eac8976ec6ba8be3561151", "score": "0.61915714", "text": "func NewDecoder(r io.Reader, publicKey [96]byte) (Decoder, error) {\n\tpk, err := bls.DeserializePublicKey(publicKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &decoder{\n\t\tr: r,\n\t\tpk: pk,\n\t}, nil\n}", "title": "" }, { "docid": "d3b715c31e570c5329b9c7a3d14beea4", "score": "0.6182305", "text": "func NewDecoder(r io.Reader) *Decoder {\n\treturn NewDecoderSeparator(r, \"\\t\")\n}", "title": "" }, { "docid": "30ceb7fcd0612973936ec397c777296d", "score": "0.6179532", "text": "func NewDecoder(r io.Reader) *Decoder {\n\trr, ok := r.(reader)\n\tif ok {\n\t\treturn &Decoder{r: &boltReader{r: rr}}\n\t}\n\treturn &Decoder{r: &boltReader{r: &byteReader{Reader: r, b: []byte{0}}}}\n}", "title": "" }, { "docid": "a411af6d48c091ea37649b42159223c1", "score": "0.61659807", "text": "func NewDecoder(opts ...func(*Decoder)) *Decoder {\n\td := &Decoder{}\n\tfor _, o := range opts {\n\t\to(d)\n\t}\n\n\treturn d\n}", "title": "" }, { "docid": "f0109c6915e2472ae34ba377dd44a51a", "score": "0.6146358", "text": "func NewDecoder(opts DecodingOptions) *Decoder {\n\treturn newDecoder(DefaultLegacyEncodingOptions, opts)\n}", "title": "" }, { "docid": "09d1c7c89eddf04c80b1dd1799c0e7b4", "score": "0.61462545", "text": "func NewDecoder(opts ...DecoderOption) (*Decoder, error) {\n\td := &Decoder{map[byte]ConcreteDecoder{}}\n\tfor _, opt := range opts {\n\t\tif err := opt(d); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn d, nil\n}", "title": "" }, { "docid": "396ab78e9d53616b0b3409390dadd555", "score": "0.6140244", "text": "func NewDecoder(chk *chunk.Chunk, timezone *time.Location) *Decoder {\n\ttrace_util_0.Count(_codec_00000, 169)\n\treturn &Decoder{\n\t\tchk: chk,\n\t\ttimezone: timezone,\n\t}\n}", "title": "" }, { "docid": "3068a3de96eeba2ccfa971f61b72f646", "score": "0.6127967", "text": "func NewDecoder(gauge common.MemoryGauge, r io.Reader) *Decoder {\n\treturn &Decoder{\n\t\tdec: json.NewDecoder(r),\n\t\tgauge: gauge,\n\t}\n}", "title": "" }, { "docid": "f37dc3252914c2fc11ad841ab3dcc1e3", "score": "0.61195135", "text": "func New(data []byte, dt DataType) (d *Decoder, err error) {\n\tvar intf interface{}\n\terr = dt.Unmarshal(data, &intf)\n\n\td = &Decoder{\n\t\tdata: data,\n\t\tdt: dt,\n\t\tunm: intf,\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "36a587bb646446f00ab79caa877748d3", "score": "0.6106368", "text": "func NewDecoder(r *http.Request) *Decoder {\n\tx := new(Decoder)\n\n\tx.r = r\n\n\treturn x\n}", "title": "" }, { "docid": "fa6d19fc93d5a00392852a01d938b2fa", "score": "0.60944426", "text": "func NewDecoder(r io.Reader) *Decoder {\n\treturn &Decoder{\n\t\tscanner: bufio.NewScanner(r),\n\t\tstrings: make(store),\n\t\tids: make(map[string]int64),\n\t}\n}", "title": "" }, { "docid": "231ccc99b070890fba4f9925a6903748", "score": "0.6092786", "text": "func NewDecoder(s string) Decoder {\n\treturn Decoder{buf: s}\n}", "title": "" }, { "docid": "0ee3ae87ccc31ee69f97dec47d7f7b8e", "score": "0.606253", "text": "func NewDecoder(byteLen int) (*Decoder, error) {\n\tif byteLen < 1 || 8 < byteLen {\n\t\treturn nil, fmt.Errorf(\"invalid byte length: %d\", byteLen)\n\t}\n\treturn &Decoder{l: byteLen}, nil\n}", "title": "" }, { "docid": "cc417477049c8c959b51c0e33ec27c18", "score": "0.60536367", "text": "func NewDecoder(r io.Reader, plugins ...plugin) *Decoder {\n\td := &Decoder{r: r, contentPrefix: contentPrefix, attributePrefix: attrPrefix, excludeAttrs: map[string]bool{}}\n\tfor _, p := range plugins {\n\t\td = p.AddToDecoder(d)\n\t}\n\treturn d\n}", "title": "" }, { "docid": "69d985d629b9637d126d68f043c621e9", "score": "0.60493344", "text": "func NewDecoder(data []byte) *Decoder {\n\tvar dst bytes.Buffer\n\tdst.Grow(4 * len(data))\n\t// TODO: should the scratch be more?\n\tscratch := make([]byte, 2*binary.Size(compressedBlockHeaderV1{}))\n\treturn &Decoder{\n\t\tsrc: bytes.NewReader(append(data, scratch...)),\n\t\tdst: dst,\n\t}\n}", "title": "" }, { "docid": "a8fea34d4a049be1ed351d426fa84fc8", "score": "0.6037089", "text": "func NewDecoder(r io.Reader) *Decoder {\n\tdec := &Decoder{bufio.NewReader(newNormaliser(r))}\n\treturn dec\n}", "title": "" }, { "docid": "46e884415fca669951fa8bed3b5f6fbf", "score": "0.6011115", "text": "func (c *ru10Codec) NewDecoder(messageLength int) Decoder {\n return newRU10Decoder(c, messageLength)\n}", "title": "" }, { "docid": "a943dc54ce1f0e8a46f9716605ffdc63", "score": "0.5995613", "text": "func (s stream) NewDecoder(r io.Reader) *StreamDecoder {\n\tdec := NewDecoder(r)\n\tstreamDec := &StreamDecoder{\n\t\tDecoder: dec,\n\t\tdone: make(chan struct{}, 1),\n\t\tmux: sync.RWMutex{},\n\t}\n\treturn streamDec\n}", "title": "" }, { "docid": "28343269fd9267cc6b57663e7b9cfcb7", "score": "0.59906495", "text": "func NewDecoder(v Value) *Decoder {\n\tdec := &Decoder{cval: v}\n\treturn dec\n}", "title": "" }, { "docid": "ab63eadb6b0962c124f5a729e2589354", "score": "0.59881103", "text": "func NewDecoder(r io.Reader) *Decoder {\n\td := json.NewDecoder(r)\n\td.DisallowUnknownFields()\n\treturn (*Decoder)(d)\n}", "title": "" }, { "docid": "d536844ab919c090149f0282aeac24f6", "score": "0.5898361", "text": "func NewDecoder(name string) Decoder {\n\tcs := GetCharset(name)\n\tif cs == nil {\n\t\treturn nil\n\t}\n\treturn cs.NewDecoder()\n}", "title": "" }, { "docid": "a11657ecabd78bea3ec7b94d8fb9c0e8", "score": "0.5885739", "text": "func New(pSize int, feed []int) *Decoder {\n\td := Decoder{\n\t\tWindow: make([]int, 0),\n\t\tFeed: feed,\n\t\tPreambleSize: pSize,\n\t}\n\n\tfor _, e := range feed[:pSize] {\n\t\td.Window = append(d.Window, e)\n\t}\n\n\treturn &d\n}", "title": "" }, { "docid": "20ac61374c4f56b8dbddc5b8b32e5db1", "score": "0.5796676", "text": "func NewDecoderRef(ref unsafe.Pointer) *Decoder {\n\treturn (*Decoder)(ref)\n}", "title": "" }, { "docid": "a47c26a405a9386782ce6ea03e8df1b3", "score": "0.579243", "text": "func newDecoder(r NextReader) (*jsoniter.Decoder, error) {\n\treader, err := r.NextReader()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdecoder := jsoniter.ConfigFastest.NewDecoder(reader)\n\tdecoder.UseNumber()\n\n\treturn decoder, nil\n}", "title": "" }, { "docid": "3535eec8047061b14f9bf68bdb4a7bc8", "score": "0.57816255", "text": "func NewDecoder(r Reader, header ...string) (dec *Decoder, err error) {\n\tif len(header) == 0 {\n\t\theader, err = r.Read()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\th := make([]string, len(header))\n\tcopy(h, header)\n\theader = h\n\n\tm := make(map[string]int, len(header))\n\tfor i, h := range header {\n\t\tm[h] = i\n\t}\n\n\treturn &Decoder{\n\t\tr: r,\n\t\theader: header,\n\t\thmap: m,\n\t\tunused: make([]int, 0, len(header)),\n\t}, nil\n}", "title": "" }, { "docid": "8d9e4e980ba45e08c2e441e842b44349", "score": "0.57697225", "text": "func (m *TTNMarshaler) NewDecoder(r io.Reader) runtime.Decoder {\n\treturn &TTNDecoder{d: json.NewDecoder(r), inner: m.JSONPb}\n}", "title": "" }, { "docid": "1852c4a5a59de1bbc1053a68eb81fff7", "score": "0.5745118", "text": "func NewDecoder(json *bufio.Reader) (*Decoder, error) {\n\tif json.Size() < 8192 {\n\t\tjson = bufio.NewReaderSize(json, 8192)\n\t}\n\terr := handleBOM(json)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\td := &Decoder{\n\t\tjson: json,\n\t\tmaxDepth: 200,\n\t\tscratchPool: &sync.Pool{\n\t\t\tNew: func() interface{} { buf := make([]byte, 0, 256); return &buf },\n\t\t},\n\t}\n\n\tch, err := d.readAfterWS()\n\tif err != nil {\n\t\t// Before an object is read, EOF is a valid response that\n\t\t// shouldn't be wrapped.\n\t\tif err == io.EOF {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, newReadError(err)\n\t}\n\n\tswitch ch {\n\tcase '[':\n\t\td.arrayStarted = true\n\tdefault:\n\t\t_ = d.json.UnreadByte()\n\t}\n\n\treturn d, nil\n}", "title": "" }, { "docid": "906474506560a1ba62c5ce1fd4bbeda0", "score": "0.56777585", "text": "func NewDecoder(iter RecordIterator, opts ...DecoderOption) *Decoder {\n\td := &Decoder{\n\t\tsrc: iter,\n\t}\n\n\tfor _, opt := range opts {\n\t\topt(d)\n\t}\n\n\treturn d\n}", "title": "" }, { "docid": "d4d23a562d5ba85ef22f4a4e2d78e2dd", "score": "0.5664857", "text": "func NewPacketDecoder(rd io.Reader) *PacketDecoder {\n\tp := PacketDecoder{\n\t\tbufio.NewReaderSize(rd, 4096),\n\t}\n\treturn &p\n}", "title": "" }, { "docid": "5e2b919134d57424133e7dd36598f2cf", "score": "0.5662331", "text": "func (j *JSONCustom) NewDecoder(r io.Reader) runtime.Decoder {\n\treturn json.NewDecoder(r)\n}", "title": "" }, { "docid": "8a4f77821814974b484b24d02aaaa9e9", "score": "0.5648097", "text": "func (*DecoderFactory) New(commonOTI uint64, schemeSpecificOTI uint32) (\n\tdecoder raptorq.Decoder, err error) {\n\twrapped := swig.NewBytesDecoder(swig.HostToNet64(commonOTI),\n\t\tswig.HostToNet32(schemeSpecificOTI))\n\tif wrapped.Initialized() {\n\t\tdec := new(Decoder)\n\t\tdec.wrapped = wrapped\n\t\tdec.commonOTI = commonOTI\n\t\tdec.schemeSpecificOTI = schemeSpecificOTI\n\t\tdec.rbcs.Reset(dec.NumSourceBlocks())\n\t\tgo dec.readyBlocksLoop()\n\t\tdecoder = dec\n\t\truntime.SetFinalizer(decoder, finalizeDecoder)\n\t} else {\n\t\tswig.DeleteBytesDecoder(wrapped)\n\t\terr = errors.New(\"libRaptorQ decoder failed to initialize\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "f2e430c91575ba9e3489cc6a7249efca", "score": "0.56231785", "text": "func NewProtobufDecoder(r io.Reader) Decoder {\n\treturn func(u Unmarshaler) error {\n\t\traw, err := ioutil.ReadAll(r)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn pb.Unmarshal(raw, u.(pb.Message))\n\t}\n}", "title": "" }, { "docid": "3576da747c7fec07fc0c24018dd97308", "score": "0.5565577", "text": "func Decoder(source io.Reader) io.Reader {\n\tvar dec decoder\n\tdec.source = source\n\treturn &dec\n}", "title": "" }, { "docid": "00d3412a3b1a47b2fa70ce8d21876899", "score": "0.55650926", "text": "func Decoder(reader pod.Reader) *decoder {\n\treturn &decoder{\n\t\tReader: reader,\n\t\tNamespace: registry.Global,\n\t\tAllowDynamic: true,\n\t\tentities: map[uint32]*binary.Entity{0: nil},\n\t\tobjects: map[uint32]binary.Object{0: nil},\n\t\tsubstack: substack{},\n\t}\n}", "title": "" }, { "docid": "b5816edb3e4b712cc9071b7d0961ff18", "score": "0.5554539", "text": "func NewDecoder(reader io.Reader, tmps ...*Template) *Decoder {\n\tdecoder := &Decoder{\n\t\trepo: make(map[uint]*Template),\n\t\tstorage: newStorage(),\n\t\treader: newReader(reader),\n\t\tpmc: newPMapCollector(),\n\t}\n\tfor _, t := range tmps {\n\t\tdecoder.repo[t.ID] = t\n\t}\n\treturn decoder\n}", "title": "" }, { "docid": "b58a70730c6a45b8ffde0fd2a6e6f5b8", "score": "0.5551894", "text": "func NewFramingProtobufDecoder(r io.Reader) Decoder {\n\tuf := func(b []byte, m interface{}) error {\n\t\treturn pb.Unmarshal(b, m.(pb.Message))\n\t}\n\tdec := framing.NewDecoder(recordio.NewFrameReader(r), uf)\n\treturn func(u Unmarshaler) error { return dec.Decode(u) }\n}", "title": "" }, { "docid": "59364b4bb8f65a09fa51435192282c3f", "score": "0.5546124", "text": "func NewDecoder() Decoder {\n\treturn &exifDecoder{}\n}", "title": "" }, { "docid": "5618a38153ec66c79cdf2cd290f7a986", "score": "0.55010194", "text": "func (j *JSONPb) NewDecoder(r io.Reader) gwruntime.Decoder {\n\treturn gwruntime.DecoderFunc(func(v interface{}) error {\n\t\tif pb, ok := v.(proto.Message); ok {\n\t\t\treturn jsonpb.Unmarshal(r, pb)\n\t\t}\n\t\treturn fmt.Errorf(\"unexpected type %T does not implement %s\", v, typeProtoMessage)\n\t})\n}", "title": "" }, { "docid": "6f34ca29f38b63bd30c6ceb7a44f8443", "score": "0.54800075", "text": "func New(pxlFmt PixelFormat, cpr Compression) (*Decoder, error) {\n\tavcodec.AvcodecRegisterAll()\n\tcodec := avcodec.AvcodecFindDecoder(avcodec.CodecId(cpr))\n\tif codec == nil {\n\t\treturn nil, errors.New(\"cannot find decoder\")\n\t}\n\tcontext := codec.AvcodecAllocContext3()\n\tif context == nil {\n\t\treturn nil, errors.New(\"cannot allocate context\")\n\t}\n\n\tif context.AvcodecOpen2(codec, nil) < 0 {\n\t\treturn nil, errors.New(\"cannot open content\")\n\t}\n\tparser := avcodec.AvParserInit(int(cpr))\n\tif parser == nil {\n\t\treturn nil, errors.New(\"cannot init parser\")\n\t}\n\tframe := avutil.AvFrameAlloc()\n\tif frame == nil {\n\t\treturn nil, errors.New(\"cannot allocate frame\")\n\t}\n\tpkt := avcodec.AvPacketAlloc()\n\tif pkt == nil {\n\t\treturn nil, errors.New(\"cannot allocate packet\")\n\t}\n\tpkt.AvInitPacket()\n\tpkt.SetFlags(pkt.Flags() | avcodec.AV_CODEC_FLAG_TRUNCATED)\n\n\tif cpr != H264 && cpr != H265 {\n\t\treturn nil, errors.New(\"unsupported compression\")\n\t}\n\n\tvar converterPxlFmt swscale.PixelFormat\n\tswitch pxlFmt {\n\tcase PixelFormatRGB:\n\t\tconverterPxlFmt = avcodec.AV_PIX_FMT_RGB24\n\tcase PixelFormatBGR:\n\t\tconverterPxlFmt = av_PIX_FMT_BGR24\n\tdefault:\n\t\treturn nil, errors.New(\"unsupported pixel format\")\n\t}\n\n\tconverter, err := newConverter(converterPxlFmt)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\th := &Decoder{\n\t\tcontext: context,\n\t\tparser: parser,\n\t\tframe: frame,\n\t\tpkt: pkt,\n\t\tconverter: converter,\n\t}\n\n\treturn h, nil\n}", "title": "" }, { "docid": "e9ff1e2ea2b304a996d3202060693855", "score": "0.5461704", "text": "func (m *Decoder) NewProc(ctx nn.Context) nn.Processor {\n\treturn &DecoderProcessor{\n\t\tBaseProcessor: nn.BaseProcessor{\n\t\t\tModel: m,\n\t\t\tMode: ctx.Mode,\n\t\t\tGraph: ctx.Graph,\n\t\t\tFullSeqProcessing: true,\n\t\t},\n\t\tffn1: m.DecodingFNN1.NewProc(ctx),\n\t\tffn2: m.DecodingFFN2.NewProc(ctx),\n\t\tffn3: m.DescalingFFN.NewProc(ctx),\n\t\tsequenceLength: 0, // late init\n\t\tmaxRecursions: 0, // late init\n\t\trecursions: 0, // late init\n\t}\n}", "title": "" }, { "docid": "c0b63bbadac4dcc486c907f132061d20", "score": "0.54540664", "text": "func execNewDecoder(_ int, p *gop.Context) {\n\targs := p.GetArgs(1)\n\tret := hex.NewDecoder(args[0].(io.Reader))\n\tp.Ret(1, ret)\n}", "title": "" }, { "docid": "534facbd73bb7a9f4903ea69f1fc402e", "score": "0.5426444", "text": "func NewDecodingReader(r io.Reader) Reader {\n\t// We need to compute checksums by inspecting the underlying\n\t// bytestream, however, gob uses whether the reader implements\n\t// io.ByteReader as a proxy for whether the passed reader is\n\t// buffered. io.TeeReader does not implement io.ByteReader, and thus\n\t// gob.Decoder will insert a buffered reader leaving us without\n\t// means of synchronizing stream positions, required for\n\t// checksumming. Instead we fake an implementation of io.ByteReader,\n\t// and take over the responsibility of ensuring that IO is buffered.\n\tcrc := crc32.NewIEEE()\n\tif _, ok := r.(io.ByteReader); !ok {\n\t\tr = bufio.NewReader(r)\n\t}\n\tr = io.TeeReader(r, crc)\n\treturn &decodingReader{dec: newGobDecoder(readerByteReader{Reader: r}), crc: crc}\n}", "title": "" } ]
b9efe7385a5bba8080c50a32e63cf3c1
FindStream returns an existing stream
[ { "docid": "856d34a880b22750749f726b8797ff88", "score": "0.78453803", "text": "func (me *Server) FindStream(appName string, instName string, name string) *Stream {\n\tme.mtx.RLock()\n\tdefer me.mtx.RUnlock()\n\n\tapp, ok := me.applications[appName]\n\tif ok {\n\t\treturn app.FindStream(instName, name)\n\t}\n\n\treturn nil\n}", "title": "" } ]
[ { "docid": "d6db3c504bf2af7d37a692f388738664", "score": "0.74845266", "text": "func (sp *StreamPool) FindStream(peer peer.ID) (*Stream, error) {\n\tif v, ok := sp.streams.Get(peer.Pretty()); ok {\n\t\tval, _ := v.(*Stream)\n\t\tif val != nil {\n\t\t\treturn val, nil\n\t\t}\n\t}\n\treturn nil, ErrStreamNotFound\n}", "title": "" }, { "docid": "cbfeba68938474b9a20ebaae57908e6e", "score": "0.7279353", "text": "func (s *Connection) FindStream(streamId uint32) *Stream {\n\tvar stream *Stream\n\tvar ok bool\n\ts.streamCond.L.Lock()\n\tstream, ok = s.streams[spdy.StreamId(streamId)]\n\tdebugMessage(\"(%p) Found stream %d? %t\", s, spdy.StreamId(streamId), ok)\n\tfor !ok && streamId >= uint32(s.receivedStreamId) {\n\t\ts.streamCond.Wait()\n\t\tstream, ok = s.streams[spdy.StreamId(streamId)]\n\t}\n\ts.streamCond.L.Unlock()\n\treturn stream\n}", "title": "" }, { "docid": "26e719dccf922faf0938531f727e2485", "score": "0.655375", "text": "func (s *REST) findStreamForMapping(ctx kapi.Context, mapping *api.ImageStreamMapping) (*api.ImageStream, error) {\n\tif len(mapping.Name) > 0 {\n\t\treturn s.imageStreamRegistry.GetImageStream(ctx, mapping.Name)\n\t}\n\tif len(mapping.DockerImageRepository) != 0 {\n\t\tlist, err := s.imageStreamRegistry.ListImageStreams(ctx, labels.Everything())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor i := range list.Items {\n\t\t\tif mapping.DockerImageRepository == list.Items[i].Spec.DockerImageRepository {\n\t\t\t\treturn &list.Items[i], nil\n\t\t\t}\n\t\t}\n\t\treturn nil, errors.NewInvalid(\"imageStreamMapping\", \"\", fielderrors.ValidationErrorList{\n\t\t\tfielderrors.NewFieldNotFound(\"dockerImageStream\", mapping.DockerImageRepository),\n\t\t})\n\t}\n\treturn nil, errors.NewNotFound(\"ImageStream\", \"\")\n}", "title": "" }, { "docid": "8dee9836019177496e06319fa9927f3d", "score": "0.64190924", "text": "func FindNextStreamW(hFindStream HANDLE, lpFindStreamData LPVOID) bool {\n\tret1 := syscall3(findNextStreamW, 2,\n\t\tuintptr(hFindStream),\n\t\tuintptr(unsafe.Pointer(lpFindStreamData)),\n\t\t0)\n\treturn ret1 != 0\n}", "title": "" }, { "docid": "e63942cedb9894f212f221a11fc4f0c8", "score": "0.63617766", "text": "func (h *Handlers) FindStreamRequestHandler(op string) StreamReqHandler {\n\th.streamReqHandlersMu.RLock()\n\tdefer h.streamReqHandlersMu.RUnlock()\n\tif handler := h.streamReqHandlers[op]; handler != nil {\n\t\treturn handler\n\t}\n\tif h.outer != nil {\n\t\treturn h.outer.FindStreamRequestHandler(op)\n\t}\n\treturn h.streamReqFallbackHandler\n}", "title": "" }, { "docid": "0150be582ee5bb5a81c87fb112c62021", "score": "0.62093383", "text": "func (fs *Ipfs) GetStream(path string) (io.ReadCloser, error) {\n\tp := ipath.New(path)\n\tunixfs := fs.coreAPI.Unixfs()\n\tnode, err := unixfs.Get(context.Background(), p)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// node should be files.File\n\tfile, ok := node.(files.File)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"path is not a file: '%s'\", path)\n\t}\n\n\treturn file, nil\n}", "title": "" }, { "docid": "04fad235ad436c2ad5af382f6c68bb0b", "score": "0.61542416", "text": "func (m MongoContext) Get_stream(ds_id, st_id string) (Stream, error) {\n\tlog.Trace(log.Here(), \"Get_stream() : calling method -\")\n\tvar stream Stream\n\tds_exist, err := m.checkDatasourceID(ds_id)\n\tif err != nil {\n\t\tlog.Error(log.Here(), err.Error())\n\t\treturn stream, err\n\t}\n\tif !ds_exist {\n\t\terr = errors.New(\"DatasourceID does not exist!\")\n\t\tlog.Error(log.Here(), err.Error())\n\t\treturn stream, err\n\t}\n\tmongoSession := m.Session.Clone()\n\tdefer mongoSession.Close()\n\tc := mongoSession.DB(m.MongoDbName).C(\"stream\")\n\terr = c.Find(bson.M{\"_id\": bson.ObjectIdHex(st_id)}).One(&stream)\n\tif err != nil {\n\t\tlog.Error(log.Here(), err.Error())\n\t\treturn stream, err\n\t}\n\treturn stream, nil\n}", "title": "" }, { "docid": "9d25b81aeaf3d97ef9c0b3ed9c8ed89f", "score": "0.6113235", "text": "func FindFile(ah *gcs.CAsyncHandler) *CStreamingFile {\n\tcsFile.Lock()\n\tdefer csFile.Unlock()\n\tif val, ok := gMapFile[ah]; ok {\n\t\treturn val\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0c534bff70e4a4ca8b5b03cc7fbe2362", "score": "0.6055016", "text": "func (sp *StreamPool) Get(ctx xctx.XContext, peerId peer.ID) (*Stream, error) {\n\tif v, ok := sp.streams.Get(peerId.Pretty()); ok {\n\t\tif stream, ok := v.(*Stream); ok {\n\t\t\tif stream.Valid() {\n\t\t\t\treturn stream, nil\n\t\t\t} else {\n\t\t\t\tsp.DelStream(stream)\n\t\t\t\tctx.GetLog().Warn(\"stream not valid, create new stream\", \"peerId\", peerId)\n\t\t\t}\n\t\t}\n\t}\n\n\tsp.mutex.Lock()\n\tdefer sp.mutex.Unlock()\n\tif v, ok := sp.streams.Get(peerId.Pretty()); ok {\n\t\tif stream, ok := v.(*Stream); ok {\n\t\t\tif stream.Valid() {\n\t\t\t\treturn stream, nil\n\t\t\t} else {\n\t\t\t\tsp.DelStream(stream)\n\t\t\t\tctx.GetLog().Warn(\"stream not valid, create new stream\", \"peerId\", peerId)\n\t\t\t}\n\t\t}\n\t}\n\n\tnetStream, err := sp.srv.host.NewStream(sp.ctx, peerId, protocol.ID(protocolID))\n\tif err != nil {\n\t\tctx.GetLog().Warn(\"new net stream error\", \"peerId\", peerId, \"error\", err)\n\t\treturn nil, ErrNewStream\n\t}\n\n\treturn sp.NewStream(ctx, netStream)\n}", "title": "" }, { "docid": "06ac68b8fc2968f8ba045c6e9255b469", "score": "0.58709544", "text": "func (c *DiskCache) GetStream(ctx context.Context, repo *gitalypb.Repository, req proto.Message) (_ io.ReadCloser, err error) {\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tc.missTotals.Inc()\n\t\t}\n\t}()\n\n\tc.requestTotals.Inc()\n\n\trespPath, err := c.KeyPath(ctx, repo, req)\n\tswitch {\n\tcase os.IsNotExist(err):\n\t\treturn nil, ErrReqNotFound\n\tcase err == nil:\n\t\tbreak\n\tdefault:\n\t\treturn nil, err\n\t}\n\n\tctxlogrus.Extract(ctx).\n\t\tWithField(\"stream_path\", respPath).\n\t\tInfo(\"getting stream\")\n\n\trespF, err := os.Open(respPath)\n\tswitch {\n\tcase os.IsNotExist(err):\n\t\treturn nil, ErrReqNotFound\n\tcase err == nil:\n\t\tbreak\n\tdefault:\n\t\treturn nil, err\n\t}\n\n\treturn instrumentedReadCloser{\n\t\tReadCloser: respF,\n\t\tcounter: c.bytesFetchedtotals,\n\t}, nil\n}", "title": "" }, { "docid": "7f64af504c4b7324b1f03707d5065c6d", "score": "0.5823085", "text": "func (c *Connection) GetStream(id uint32) *Stream {\n\tiid := int(id)\n\n\tif iid >= len(c.streams) {\n\t\treturn nil\n\t}\n\n\treturn &c.streams[iid]\n}", "title": "" }, { "docid": "d73593061875f64b70267a9472ae05f4", "score": "0.581527", "text": "func (c *cache) RetrieveStream(key string) io.ReadCloser {\n\tf, err := os.Open(c.path(key))\n\tif err != nil {\n\t\tif !os.IsNotExist(err) {\n\t\t\tlog.Warning(\"Failed to retrieve %s from cache: %s\", key, err)\n\t\t}\n\t\treturn nil\n\t}\n\treturn f\n}", "title": "" }, { "docid": "ce3af5676ed16af711a649a1e1ff02fa", "score": "0.5735711", "text": "func (p *StreamPublisher) GetStream(name string) (chan Streamable, error) {\n\tstream, ok := p.Streams[name]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"stream '%s' not available\", name)\n\t}\n\n\treturn stream, nil\n}", "title": "" }, { "docid": "e66abe0629c702630cbce9fe91b9e7e3", "score": "0.5686097", "text": "func (s *session) GetOrOpenStream(id protocol.StreamID) (Stream, error) {\n\tstr, err := s.streamsMap.GetOrOpenStream(id)\n\tif str != nil {\n\t\treturn str, err\n\t}\n\t// make sure to return an actual nil value here, not an Stream with value nil\n\treturn nil, err\n}", "title": "" }, { "docid": "12beb7c262dcc9c06ae56752e0394575", "score": "0.56700844", "text": "func (sc *streamsCoordinator) getStream(name string) (string, *streamGroup, error) {\n\tsc.mu.Lock()\n\tdefer sc.mu.Unlock()\n\n\tgroup, ok := sc.groups[name]\n\tif !ok {\n\t\treturn \"\", nil, errors.Errorf(\"no group for '%s'\", name)\n\t}\n\n\tif len(group.availableStreams) == 0 {\n\t\treturn \"\", nil, errors.New(\"must register first\")\n\t}\n\tid := group.availableStreams[0]\n\tgroup.availableStreams = group.availableStreams[1:]\n\n\treturn id, group, nil\n}", "title": "" }, { "docid": "5b5e2a3d3d25eeed3e4d7fb4281f0cd9", "score": "0.5669487", "text": "func (me *Server) GetStream(appName string, instName string, name string) *Stream {\n\tme.mtx.RLock()\n\tdefer me.mtx.RUnlock()\n\n\tapp, ok := me.applications[appName]\n\tif !ok {\n\t\tapp = new(Application).Init(appName, me.logger, me.factory)\n\t\tme.applications[appName] = app\n\t}\n\n\treturn app.GetStream(instName, name)\n}", "title": "" }, { "docid": "80f6b1c49cc958f407e9c32145993014", "score": "0.56689876", "text": "func (s EncoderList) Find(mime string) EncoderFactory {\n\tfor _, e := range s {\n\t\tif e.MimeType() == mime {\n\t\t\treturn e\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9d01d7cc8f0cee231f968353658002af", "score": "0.5650263", "text": "func (msh *MockStreamHandler) GetStream(string, bool) (network.Stream, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "0f6bf07cc69106ee2675a2ce8ab0b285", "score": "0.56259346", "text": "func (m *Metadata) GetStream(name string) *StreamInfo {\n\treturn m.streams[name]\n}", "title": "" }, { "docid": "479442ac50846ac19694660dc8767fe5", "score": "0.5605284", "text": "func SearchStream(requester Requester, ctx context.Context, r SearchRequest) (io.ReadCloser, error) {\n\treq, err := PrepSearchRequest(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp, err := requester(ctx, req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn DefaultReEncodeReader(resp.Body, resp.Header.Get(ContentType)), nil\n}", "title": "" }, { "docid": "407fffaa2dc74dfd18d739fc71f0eca8", "score": "0.556852", "text": "func (fctx *AvFormatContext) AvFindBestStream(typ AvMediaType, wantedStreamNb, relatedStream int, decoderRet **AvCodec, flags int) int {\n\treturn int(C.av_find_best_stream((*C.struct_AVFormatContext)(fctx),\n\t\t(C.enum_AVMediaType)(typ), C.int(wantedStreamNb), C.int(relatedStream),\n\t\t(**C.struct_AVCodec)(unsafe.Pointer(decoderRet)), C.int(flags)))\n}", "title": "" }, { "docid": "8b1374bc70c50023552a70b5d6c3581b", "score": "0.55508417", "text": "func (s DecoderList) Find(mime string) DecoderFactory {\n\tfor _, e := range s {\n\t\tif e.MimeType() == mime {\n\t\t\treturn e\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7ede111aac4dc52f2ed77acf02fe8617", "score": "0.5533549", "text": "func (fctx *AvFormatContext) AvFindProgramFromStream(last *AvProgram, streamIdx int) *AvProgram {\n\treturn (*AvProgram)(C.av_find_program_from_stream((*C.struct_AVFormatContext)(fctx),\n\t\t(*C.struct_AVProgram)(last), C.int(streamIdx)))\n}", "title": "" }, { "docid": "14e708b53894aec48832f031119d8130", "score": "0.5483998", "text": "func (sp *StreamPool) streamForPeer(p peer.ID) (*Stream, error) {\n\tif v, ok := sp.streams.Get(p.Pretty()); ok {\n\t\ts, _ := v.(*Stream)\n\t\tif s.valid() {\n\t\t\tif sp.no.srv.config.IsAuthentication && !s.auth() {\n\t\t\t\tsp.log.Warn(\"stream failed to be authenticated\")\n\t\t\t\treturn nil, ErrAuth\n\t\t\t}\n\t\t\treturn s, nil\n\t\t}\n\t}\n\n\ts, err := sp.no.host.NewStream(sp.no.ctx, p, AmperProtocolID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tstr := sp.Add(s)\n\tif str == nil {\n\t\treturn nil, ErrAddStream\n\t}\n\treturn str, nil\n}", "title": "" }, { "docid": "5cae0b3677b317f59c3b11d8dacfc7b5", "score": "0.54824907", "text": "func (d *driver) ReadStream(ctx context.Context, path string, offset int64) (io.ReadCloser, error) {\n\tdefer debugTime()()\n\treader, err := d.shell.Cat(d.fullPath(path))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t_, err = io.CopyN(ioutil.Discard, reader, offset)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn ioutil.NopCloser(reader), nil\n}", "title": "" }, { "docid": "6dd851b97b1382577c0f86ae8fa0c453", "score": "0.5357071", "text": "func (s *Conn) Stream(id uint64) (*Stream, error) {\n\treturn s.getOrCreateStream(id, true)\n}", "title": "" }, { "docid": "14e627cfc409ab98caf1e2671b0cd400", "score": "0.5352539", "text": "func GetStream(aggregateType, aggregateID string) string {\n\treturn fmt.Sprintf(\"%s!%s\", aggregateType, aggregateID)\n}", "title": "" }, { "docid": "bc6d5bf307c6f02216ce8eda81e3e7da", "score": "0.5350874", "text": "func (s *session) OpenStream() (Stream, error) {\n\treturn s.streamsMap.OpenStream()\n}", "title": "" }, { "docid": "71283b73b6c2fc75ec3c65e14d8ebe4e", "score": "0.5350711", "text": "func (c *Client) RenterStreamGet(siaPath string) (resp []byte, err error) {\n\tsiaPath = strings.TrimPrefix(siaPath, \"/\")\n\tresp, err = c.getRawResponse(\"/renter/stream/\" + siaPath)\n\treturn\n}", "title": "" }, { "docid": "1706f76ef3d0f05ef3e86e6088e415e7", "score": "0.53481925", "text": "func (s *Session) OpenStream() (*Stream, error) {\n\tif s.IsClosed() {\n\t\treturn nil, ErrSessionShutdown\n\t}\n\nGET_ID:\n\t// Get an ID, and check for stream exhaustion\n\tid := atomic.LoadUint32(&s.nextStreamID)\n\tif id >= math.MaxUint32-1 {\n\t\treturn nil, ErrStreamsExhausted\n\t}\n\tif !atomic.CompareAndSwapUint32(&s.nextStreamID, id, id+2) {\n\t\tgoto GET_ID\n\t}\n\n\t// Register the stream\n\tstream := newStream(s, id)\n\ts.streams.Store(id, stream)\n\tatomic.AddInt32(&s.streamsCounter, 1)\n\tvar timeout <-chan time.Time\n\terr := s.writeFrame(newLenFrame(flagSYN, id, 0, nil), timeout)\n\tif nil != err {\n\t\treturn nil, err\n\t}\n\treturn stream, nil\n}", "title": "" }, { "docid": "1bf85f6cc629b787acb4cb029ad43416", "score": "0.53037995", "text": "func (s Song) Stream() (io.ReadSeeker, error) {\n\t// Attempt to open the file associated with this song\n\treturn os.Open(s.FileName)\n}", "title": "" }, { "docid": "69a99f041ad9e929a62890563f359e8d", "score": "0.5295792", "text": "func (m *Manager) ForStream(id string) interop.Manager { return m }", "title": "" }, { "docid": "c410f514b3337e1a5a2157bafe6c7cb8", "score": "0.5291438", "text": "func (sp *StreamPool) Add(s net.Stream) *Stream {\n\t// filter by StreamLimit first\n\taddrStr := s.Conn().RemoteMultiaddr().String()\n\tpeerID := s.Conn().RemotePeer()\n\tif ok := sp.no.streamLimit.AddStream(addrStr, peerID); !ok {\n\t\ts.Reset()\n\t\treturn nil\n\t}\n\tstream := NewStream(s, sp.no)\n\tif err := sp.AddStream(stream); err != nil {\n\t\tstream.Close()\n\t\tsp.DelStream(stream)\n\t\tsp.no.kdht.RoutingTable().Remove(stream.p)\n\t\tsp.log.Warn(\"New stream is deleted\")\n\t\treturn nil\n\t}\n\treturn stream\n}", "title": "" }, { "docid": "c680fdbd7df4fb9e3044cf53ca9bfbe9", "score": "0.52902395", "text": "func (p *Protocol) Find(target noise.PublicKey, opts ...IteratorOption) []noise.ID {\n\treturn NewIterator(p.node, p.table, opts...).Find(target)\n}", "title": "" }, { "docid": "17516b84551624169cb3b6fe72a681af", "score": "0.52823913", "text": "func (m *memClient) GetStreamObjectAtOffset(ctx context.Context, objectName string, offset int) (io.ReadCloser, error) {\n\treturn nil, errors.New(\"unimplemented\")\n}", "title": "" }, { "docid": "85d74f7d6d5db0cac788cec8d6644b4b", "score": "0.5236401", "text": "func (fctx *AvFormatContext) AvformatFindStreamInfo(options **libavutil.AvDictionary) int {\n\treturn int(C.avformat_find_stream_info((*C.struct_AVFormatContext)(fctx),\n\t\t(**C.struct_AVDictionary)(unsafe.Pointer(options))))\n}", "title": "" }, { "docid": "3a7b458040b0a8bb92ddefcf9cea019d", "score": "0.52085763", "text": "func GetUserStream(id string) (StreamData, error) {\n\tvar stream StreamData\n\n\ttwitClient := http.Client{\n\t\tTimeout: time.Second * 200, // Maximum of 2 secs\n\t}\n\n\treq, err := http.NewRequest(http.MethodGet, \"https://api.twitch.tv/kraken/streams/\"+id, nil)\n\tif err != nil {\n\t\treturn stream, err\n\t}\n\n\treq.Header.Set(\"Accept\", accept)\n\treq.Header.Add(\"Client-ID\", tID)\n\n\tres, getErr := twitClient.Do(req)\n\tif getErr != nil {\n\t\treturn stream, getErr\n\t}\n\n\tbody, readErr := ioutil.ReadAll(res.Body)\n\tif readErr != nil {\n\t\treturn stream, readErr\n\t}\n\n\tres.Body.Close()\n\tif string(body) == `{\"stream\":null}` {\n\t\treturn stream, errors.New(\"Stream is currently offline\")\n\t}\n\n\terr = json.Unmarshal([]byte(body), &stream)\n\tif err != nil {\n\t\treturn stream, err\n\t}\n\n\treturn stream, nil\n}", "title": "" }, { "docid": "08f19d231da21f80d3d3ecff00c949d7", "score": "0.5178352", "text": "func (s StreamService) GetStream(channelID int64, streamType model.StreamType, r *core.Request) model.Stream {\n\tstream := struct {\n\t\tstream model.Stream\n\t}{}\n\tr.SendRequest(fmt.Sprintf(\"%s/%d\", core.StreamsURI, channelID), stream)\n\n\treturn stream.stream\n}", "title": "" }, { "docid": "456f6c9bcc250bfe99685cc93a07e432", "score": "0.51368934", "text": "func (s *Session) OpenReadStream(sType SessionType, fo FilterOptions) (ReadStream, error) {\n\tswitch sType {\n\tcase SessionReadCapture:\n\t\ts.wp.Add()\n\t\tparStream := newSessionStream(s, s.dbo, s.schema, s.wp)\n\t\trs, err := newReadCapStream(parStream, s.cancel, fo)\n\t\tif err != nil {\n\t\t\ts.wp.Done()\n\t\t}\n\t\treturn rs, nil\n\tcase SessionReadPrefix:\n\t\ts.wp.Add()\n\t\tparStream := newSessionStream(s, s.dbo, s.schema, s.wp)\n\t\trs, err := newReadPrefixStream(parStream, s.cancel, fo)\n\t\tif err != nil {\n\t\t\ts.wp.Done()\n\t\t}\n\t\treturn rs, nil\n\tcase SessionReadEntity:\n\t\ts.wp.Add()\n\t\tparStream := newSessionStream(s, s.dbo, s.schema, s.wp)\n\t\tes, err := newReadEntityStream(parStream, s.cancel, fo)\n\t\tif err != nil {\n\t\t\ts.wp.Done()\n\t\t}\n\t\treturn es, nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unsupported read stream type\")\n\t}\n}", "title": "" }, { "docid": "f219f6144ee4ec4916c4970ae2780d4e", "score": "0.51330924", "text": "func (handle *Handle) GetStream() (Stream, error) {\n\tvar s Stream\n\tvar some *C.cudaStream_t\n\t//x := C.cudnnHandle_t(handle.Pointer())\n\n\ty := C.cudnnGetStream(handle.x, some)\n\ts.stream = *some\n\treturn s, Status(y).error(\"(*Handle).GetStream\")\n}", "title": "" }, { "docid": "8538bb4775823f0691465535b4496c24", "score": "0.5127656", "text": "func (db *DB) GetStream(count, offset int, feedID string) ([]Bookmark, error) {\n\tvar bookmarks []Bookmark\n\tq := db.e.NewQuery(\"Bookmark\").Order(\"-CreatedAt\").Limit(count).Offset(offset)\n\tif feedID != \"\" {\n\t\tq = q.Filter(\"FeedID =\", feedID)\n\t}\n\tq.GetAll(&bookmarks)\n\treturn bookmarks, nil\n}", "title": "" }, { "docid": "df9337e13d49e42c80f1042bf0dd447c", "score": "0.5125475", "text": "func (p *Provider) Stream(streamID int) (*models.Stream, error) {\n\tstreamChan := make(chan *models.Stream, 1)\n\tp.internalRequestChan <- streamRequest{\n\t\trespChan: streamChan,\n\t\tstreamID: streamID,\n\t}\n\tselect {\n\tcase resp := <-streamChan:\n\t\tif resp == nil {\n\t\t\treturn nil, fmt.Errorf(\"stream ID %d not found\", streamID)\n\t\t}\n\t\treturn resp, nil\n\tcase <-time.After(p.queryTimeout):\n\t\tp.logger.Error(\"Stream()\",\n\t\t\tzap.Error(ErrRequestTimedOut),\n\t\t\tzap.Int(\"streamID\", streamID),\n\t\t\tzap.Duration(\"timeout-duration\", p.queryTimeout),\n\t\t)\n\t\treturn nil, ErrRequestTimedOut\n\t}\n}", "title": "" }, { "docid": "7053ff3ffd31dd87ab5f99a5f3b69690", "score": "0.5115531", "text": "func findSrc() (io.Reader, error) {\n\tif isPiped() {\n\t\treturn os.Stdin, nil\n\t}\n\treturn os.Open(os.Args[1])\n}", "title": "" }, { "docid": "9dc464c3e24d8ccad0aa8f67417967de", "score": "0.50935084", "text": "func (p *Packet) GetStreamID() (StreamID uint32) {\n}", "title": "" }, { "docid": "4ff15ac9ac54046861b904845ca999b4", "score": "0.50893706", "text": "func (ssec *SSEClient) GetStream(uri string) error {\n\tssec.Lock()\n\tdefer ssec.Unlock()\n\tvar err error\n\tif ssec.url, err = url.Parse(uri); err != nil {\n\t\treturn errors.Wrap(err, \"error parsing URL\")\n\t}\n\tssec.wg.Add(1)\n\tgo ssec.process()\n\treturn err\n}", "title": "" }, { "docid": "66e56a82bd233b7e0bb32d06a900ec9e", "score": "0.50798535", "text": "func (c Call) Find(Ref) (Value, error) {\n\treturn nil, errFindNotFound\n}", "title": "" }, { "docid": "81ee6519431dc6168900214b0565996b", "score": "0.5065495", "text": "func NewGetCameraIndexStreamNotFound() *GetCameraIndexStreamNotFound {\n\treturn &GetCameraIndexStreamNotFound{}\n}", "title": "" }, { "docid": "ef64523611c24954a5a8d92652a87c75", "score": "0.505445", "text": "func StreamPtr(registry, namespace, name string, tags map[string]imageapi.TagEventList) *imageapi.ImageStream {\n\ts := Stream(registry, namespace, name, tags)\n\treturn &s\n}", "title": "" }, { "docid": "473a053fb26388031f311583b09da014", "score": "0.5043864", "text": "func (f FFmpeg) Stream() (io.ReadCloser, error) {\n\t// Verify ffmpeg is running\n\tif !f.started {\n\t\treturn nil, ErrFFmpegNotStarted\n\t}\n\n\t// Return stream\n\treturn f.stream, nil\n}", "title": "" }, { "docid": "c13c8b3b89368937fd4db76ec5794776", "score": "0.5008696", "text": "func (b *Bucket) OpenDownloadStream(ctx context.Context, id interface{}) (*DownloadStream, error) {\n\t// create stream\n\tstream := newDownloadStream(ctx, b, id, \"\", -1)\n\n\treturn stream, nil\n}", "title": "" }, { "docid": "c3da3ff2279ef8358b541ee3a737e4f9", "score": "0.49963665", "text": "func (c *Client) OpenStream(name string) (*Stream, error) {\n\tid := c.defines.allocate(name)\n\tif id.isNumeric() {\n\t\tif err := c.define(name, uint8(id.numericID())); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\ts := &Stream{\n\t\tclient: c,\n\t\tstreamID: id,\n\t}\n\treturn s, nil\n}", "title": "" }, { "docid": "09afe4dce1252164cb12f922590d01ce", "score": "0.49908724", "text": "func (b *Bucket) OpenDownloadStream(fileID interface{}) (*DownloadStream, error) {\n\treturn b.openDownloadStream(bson.D{\n\t\t{\"_id\", fileID},\n\t})\n}", "title": "" }, { "docid": "d851784d405a482afc16b5bc2f784929", "score": "0.49893853", "text": "func (o *AudioStreamPlayer) GetStream() AudioStreamImplementer {\n\t//log.Println(\"Calling AudioStreamPlayer.GetStream()\")\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(\"AudioStreamPlayer\", \"get_stream\")\n\n\t// Call the parent method.\n\t// AudioStream\n\tretPtr := gdnative.NewEmptyObject()\n\tgdnative.MethodBindPtrCall(methodBind, o.GetBaseObject(), ptrArguments, retPtr)\n\n\t// If we have a return type, convert it from a pointer into its actual object.\n\tret := newAudioStreamFromPointer(retPtr)\n\n\t// Check to see if we already have an instance of this object in our Go instance registry.\n\tif instance, ok := InstanceRegistry.Get(ret.GetBaseObject().ID()); ok {\n\t\treturn instance.(AudioStreamImplementer)\n\t}\n\n\t// Check to see what kind of class this is and create it. This is generally used with\n\t// GetNode().\n\tclassName := ret.GetClass()\n\tif className != \"AudioStream\" {\n\t\tactualRet := getActualClass(className, ret.GetBaseObject())\n\t\treturn actualRet.(AudioStreamImplementer)\n\t}\n\n\treturn &ret\n}", "title": "" }, { "docid": "e6a434a66d06a0abfe659eaee44d7525", "score": "0.4973127", "text": "func (p2p *P2p) OpenStream(peerID peer.ID) (interfaces.Stream, error) {\n\tstream, err := p2p.host.NewStream(p2p.ctx, peerID, networkID)\n\tvar newStream *Stream\n\tif err != nil {\n\t\tp2p.Logger.Errorf(\"Stream open failed with peer %s on network %s: %s\", peerID, networkID, err)\n\t} else {\n\t\twriter := bufio.NewWriter(bufio.NewWriter(stream))\n\t\tnewStream = &Stream{stream: stream, input: writer, remotePeer: peerID}\n\t\tp2p.streams[peerID.String()] = newStream\n\t}\n\treturn newStream, err\n}", "title": "" }, { "docid": "58de9a2b1b6ca76efbf21ace571d251c", "score": "0.49723363", "text": "func (dt *Data) StreamSearch(datum *Datum, scoredDatumStream chan<- *ScoredDatum, queryWaitGroup *sync.WaitGroup, config *SearchConfig) error {\n\tcollector := dt.Search(datum, config)\n\tfor _, i := range collector.List {\n\t\tscoredDatumStream <- i\n\t}\n\tqueryWaitGroup.Done()\n\treturn nil\n}", "title": "" }, { "docid": "13ef99b1ee75c0665170eef4adc34810", "score": "0.49721536", "text": "func (qf *qfile) StreamRead(ctx context.Context, offset int64, ch chan<- StreamBytes) (otherFile bool, err error) {\n\tfileOffset, err := qf.calcFileOffset(offset)\n\tif err != nil {\n\t\tlogger.Instance().Fatal(\"calcFileOffset err\", zap.Int64(\"offset\", offset), zap.Int64(\"startOffset\", qf.startOffset))\n\t\treturn\n\t}\n\n\tqf.mappedFile.RLock()\n\tdefer qf.mappedFile.RUnlock()\n\n\tr := qf.getSizeReader(fileOffset)\n\tdefer qf.putSizeReader(r)\n\n\tvar (\n\t\tdataBytes []byte\n\t\tstartOffset int64\n\t)\n\n\tfor {\n\n\t\totherFile, startOffset, dataBytes, err = qf.readLockedFunc(ctx, r)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\n\t\tselect {\n\t\tcase ch <- StreamBytes{Bytes: dataBytes, Offset: startOffset}:\n\t\tcase <-ctx.Done():\n\t\t\terr = ctx.Err()\n\t\t\treturn\n\t\t}\n\n\t}\n\n}", "title": "" }, { "docid": "df1ff81b76f0a2ac4211b3e5b6f56ccb", "score": "0.49622673", "text": "func (c *loadingFailedClient) GetStream() rpcc.Stream { return c.Stream }", "title": "" }, { "docid": "c108628300704c40f7462cbea07241ed", "score": "0.4955266", "text": "func LookupStreamingImage(ctx *pulumi.Context, args *LookupStreamingImageArgs, opts ...pulumi.InvokeOption) (*LookupStreamingImageResult, error) {\n\topts = internal.PkgInvokeDefaultOpts(opts)\n\tvar rv LookupStreamingImageResult\n\terr := ctx.Invoke(\"aws-native:nimblestudio:getStreamingImage\", args, &rv, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &rv, nil\n}", "title": "" }, { "docid": "23c64be2d2d6c5844b38b0c3b1642117", "score": "0.49546707", "text": "func GetStream(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *StreamState, opts ...pulumi.ResourceOption) (*Stream, error) {\n\tvar resource Stream\n\terr := ctx.ReadResource(\"aws-native:kinesis:Stream\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "428d63700aab6de04bab6107aeddfea9", "score": "0.49382454", "text": "func (sc *SoundCloud) Stream(track string) (io.ReadCloser, error) {\n\t// Get the HTTP Stream\n\trsp, err := http.Get(sc.streamUrl(track).String())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// Createa http stream buffer\n\tbuff := buffer.HTTPBuffer(rsp)\n\tgo buff.Buffer() // Start buffering\n\tscs := &SoundCloudStream{\n\t\tbuffer: buff,\n\t\tdecoder: &mpa.Reader{Decoder: &mpa.Decoder{Input: buff}},\n\t}\n\treturn scs, nil\n}", "title": "" }, { "docid": "d2f8bd924e27cf11a714864ce4cf08b4", "score": "0.49360758", "text": "func GetStream(w http.ResponseWriter, r *http.Request) {\n\t// Retrieve render\n\tren := context.Get(r, CtxRender).(*render.Render)\n\n\t// Advertise that clients may send Range requests\n\tw.Header().Set(\"Accept-Ranges\", \"bytes\")\n\n\t// Check API version\n\tif version, ok := mux.Vars(r)[\"version\"]; ok {\n\t\t// Check if this API call is supported in the advertised version\n\t\tif !apiVersionSet.Has(version) {\n\t\t\tren.JSON(w, 400, errRes(400, \"unsupported API version: \"+version))\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Check for an ID parameter\n\tpID, ok := mux.Vars(r)[\"id\"]\n\tif !ok {\n\t\tren.JSON(w, 400, errRes(400, \"no integer stream ID provided\"))\n\t\treturn\n\t}\n\n\t// Verify valid integer ID\n\tid, err := strconv.Atoi(pID)\n\tif err != nil {\n\t\tren.JSON(w, 400, errRes(400, \"invalid integer stream ID\"))\n\t\treturn\n\t}\n\n\t// Attempt to load the song with matching ID\n\tsong := &data.Song{ID: id}\n\tif err := song.Load(); err != nil {\n\t\t// Check for invalid ID\n\t\tif err == sql.ErrNoRows {\n\t\t\tren.JSON(w, 404, errRes(404, \"song ID not found\"))\n\t\t\treturn\n\t\t}\n\n\t\t// All other errors\n\t\tlog.Println(err)\n\t\tren.JSON(w, 500, serverErr)\n\t\treturn\n\t}\n\n\t// Attempt to access data stream\n\tstream, err := song.Stream()\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tren.JSON(w, 500, serverErr)\n\t\treturn\n\t}\n\n\t// Generate a string used for logging this operation\n\topStr := fmt.Sprintf(\"[#%05d] %s - %s [%s %dkbps]\", song.ID, song.Artist, song.Title,\n\t\tdata.CodecMap[song.FileTypeID], song.Bitrate)\n\n\t// Attempt to send file stream over HTTP\n\tlog.Println(\"stream: starting:\", opStr)\n\n\t// Pass stream using song's file size, auto-detect MIME type\n\tif err := HTTPStream(song, \"\", song.FileSize, stream, r, w); err != nil {\n\t\t// Check for client reset\n\t\tif strings.Contains(err.Error(), \"connection reset by peer\") || strings.Contains(err.Error(), \"broken pipe\") {\n\t\t\treturn\n\t\t}\n\n\t\t// Check for invalid range, return HTTP 416\n\t\tif err == ErrInvalidRange {\n\t\t\tren.JSON(w, 416, errRes(416, \"invalid HTTP Range header boundaries\"))\n\t\t\treturn\n\t\t}\n\n\t\tlog.Println(\"stream: error:\", err)\n\t\treturn\n\t}\n\n\tlog.Println(\"stream: completed:\", opStr)\n\treturn\n}", "title": "" }, { "docid": "8c4587acb8ba5266a78cfd6b54438a84", "score": "0.49318457", "text": "func (s StreamService) GetFollowedStreams() {\n\n}", "title": "" }, { "docid": "e9b3d48dd40fa44ee498510f8678f2e0", "score": "0.49282786", "text": "func (rules *UpstreamRuleList) FindMatch(buf *[]byte) *UpstreamRule {\n\tfor _, rule := range *rules {\n\t\tif !rule.pattern.Match(*buf) {\n\t\t\tcontinue\n\t\t}\n\t\treturn rule\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d56688e9825a5376b6427de824956c69", "score": "0.49217406", "text": "func (c *Client) GetStream(songID string) (io.ReadCloser, error) {\n\turl := c.makeRequestURL(\"stream\") + \"&format=mp3&id=\" + songID\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn nil, errors.New(resp.Status)\n\t}\n\treturn resp.Body, nil\n}", "title": "" }, { "docid": "7f6bd4a741e6d71451b1e5d038153cd5", "score": "0.49020603", "text": "func (twitchAPI *TwitchAPI) GetStream(channelName string, onSuccess func(Stream),\n\tonHTTPError jsonapi.HTTPErrorCallback, onInternalError jsonapi.InternalErrorCallback) {\n\tvar streamsChannel streamsChannel\n\tonSuccessfulRequest := func() {\n\t\tonSuccess(streamsChannel.Stream)\n\t}\n\ttwitchAPI.Get(\"/streams/\"+channelName, nil, &streamsChannel, onSuccessfulRequest,\n\t\tonHTTPError, onInternalError)\n}", "title": "" }, { "docid": "f3c304a90a4e4a80016d038ec31d876b", "score": "0.48935518", "text": "func (d *Disk) Find(name string) (File, error) {\n\n\td.moot.RLock()\n\tif f, ok := d.files[name]; ok {\n\t\tif seek, ok := f.(io.Seeker); ok {\n\t\t\t_, err := seek.Seek(0, 0)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\td.moot.RUnlock()\n\t\treturn f, nil\n\t}\n\td.moot.RUnlock()\n\n\tgf := NewFile(name, bytes.NewReader([]byte(\"\")))\n\n\tosname := name\n\tif runtime.GOOS == \"windows\" {\n\t\tosname = strings.Replace(osname, \"/\", \"\\\\\", -1)\n\t}\n\tf, err := os.Open(osname)\n\tif err != nil {\n\t\treturn gf, err\n\t}\n\tdefer f.Close()\n\n\tbb := &bytes.Buffer{}\n\n\tif _, err := io.Copy(bb, f); err != nil {\n\t\treturn gf, err\n\t}\n\tgf = NewFile(name, bb)\n\td.Add(gf)\n\treturn gf, nil\n}", "title": "" }, { "docid": "a5e92671698775032b8e0559cba0c547", "score": "0.4892852", "text": "func (bn *BasicNotifiee) OpenedStream(n net.Network, s net.Stream) {\n\tglog.V(4).Infof(\"Notifiee - OpenedStream: %v - %v\", peer.IDHexEncode(s.Conn().LocalPeer()), peer.IDHexEncode(s.Conn().RemotePeer()))\n}", "title": "" }, { "docid": "1159ba02dc7cb67c81fc25eedcf41b9c", "score": "0.48927534", "text": "func (am *ArtifactMap) GetStreamID(streamName string) (string, error) {\n\tvalue, found := am.streamTitleToID.Load(streamName)\n\tif !found {\n\t\treturn \"\", errors.Errorf(\"key %s not found in map\", streamName)\n\t}\n\treturn value.(string), nil\n}", "title": "" }, { "docid": "0105d67a1b091e583d9fabe70d077ac2", "score": "0.48853046", "text": "func (f *UnZip) FindDoc(searchDoc string) (file *Document) {\n\tfor _, fi := range f.Files {\n\t\tif fi.Name == searchDoc {\n\t\t\tfile = &Document{\n\t\t\t\tDoc: fi,\n\t\t\t}\n\t\t}\n\t}\n\treturn file\n}", "title": "" }, { "docid": "37ab7d099afcd8d9c408b6a26c79aed3", "score": "0.48797655", "text": "func (c *reportingAPIReportAddedClient) GetStream() rpcc.Stream { return c.Stream }", "title": "" }, { "docid": "45d679ca74c582d7889bd073daf63825", "score": "0.4874755", "text": "func findServiceNode(data proto.FindServiceParams) (interface{}, *nprotoo.Error) {\n\tservice := data.Service\n\tmid := data.MID\n\trid := data.RID\n\n\tif mid != \"\" {\n\t\tmkey := proto.MediaInfo{\n\t\t\tDC: dc,\n\t\t\tRID: rid,\n\t\t}.BuildKey()\n\t\tlog.Infof(\"Find mids by mkey %s\", mkey)\n\t\tfor _, key := range redis.Keys(mkey + \"*\") {\n\t\t\tlog.Infof(\"Got: key => %s\", key)\n\t\t\tminfo, err := proto.ParseMediaInfo(key)\n\t\t\tif err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tfor _, node := range services {\n\t\t\t\tname := node.Info[\"name\"]\n\t\t\t\tid := node.Info[\"id\"]\n\t\t\t\tif service == node.Info[\"service\"] && minfo.NID == id {\n\t\t\t\t\trpcID := discovery.GetRPCChannel(node)\n\t\t\t\t\teventID := discovery.GetEventChannel(node)\n\t\t\t\t\tresp := proto.GetSFURPCParams{Name: name, RPCID: rpcID, EventID: eventID, Service: service, ID: id}\n\t\t\t\t\tlog.Infof(\"findServiceNode: by node ID %s, [%s] %s => %s\", minfo.NID, service, name, rpcID)\n\t\t\t\t\treturn resp, nil\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// If we don't have a MID, we must place the stream in a room\n\t// This mutex prevents a race condition which could cause\n\t// rooms to split between SFU's\n\troomMutex.Lock()\n\tdefer roomMutex.Unlock()\n\n\t// When we have a RID check for other pubs to colocate streams\n\tif rid != \"\" {\n\t\tlog.Infof(\"findServiceNode: got room id: %s, checking for existing streams\", rid)\n\t\trid := data.RID //util.Val(data, \"rid\")\n\t\tkey := proto.MediaInfo{\n\t\t\tDC: dc,\n\t\t\tRID: rid,\n\t\t}.BuildKey()\n\t\tlog.Infof(\"findServiceNode: RID root key=%s\", key)\n\n\t\tfor _, path := range redis.Keys(key + \"*\") {\n\n\t\t\tlog.Infof(\"findServiceNode media info path = %s\", path)\n\t\t\tminfo, err := proto.ParseMediaInfo(path)\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"Error parsing media info = %v\", err)\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tfor _, node := range services {\n\t\t\t\tname := node.Info[\"name\"]\n\t\t\t\tid := node.Info[\"id\"]\n\t\t\t\tif service == node.Info[\"service\"] && minfo.NID == id {\n\t\t\t\t\trpcID := discovery.GetRPCChannel(node)\n\t\t\t\t\teventID := discovery.GetEventChannel(node)\n\t\t\t\t\tresp := proto.GetSFURPCParams{Name: name, RPCID: rpcID, EventID: eventID, Service: service, ID: id}\n\t\t\t\t\tlog.Infof(\"findServiceNode: by node ID %s, [%s] %s => %s\", minfo.NID, service, name, rpcID)\n\t\t\t\t\treturn resp, nil\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t}\n\n\t// MID/RID Doesn't exist in Redis\n\t// Find least packed SFU to return\n\tsfuID := \"\"\n\tminStreamCount := math.MaxInt32\n\tfor _, sfu := range services {\n\t\tif service == sfu.Info[\"service\"] {\n\t\t\t// get stream count\n\t\t\tsfuKey := proto.MediaInfo{\n\t\t\t\tDC: dc,\n\t\t\t\tNID: sfu.Info[\"id\"],\n\t\t\t}.BuildKey()\n\t\t\tstreamCount := len(redis.Keys(sfuKey))\n\n\t\t\tlog.Infof(\"findServiceNode looking up sfu stream count [%s] = %v\", sfuKey, streamCount)\n\t\t\tif streamCount <= minStreamCount {\n\t\t\t\tsfuID = sfu.ID\n\t\t\t\tminStreamCount = streamCount\n\t\t\t}\n\t\t}\n\t}\n\tlog.Infof(\"findServiceNode: selecting SFU [%s] = %v\", sfuID, minStreamCount)\n\n\tif node, ok := services[sfuID]; ok {\n\t\tlog.Infof(\"findServiceNode: found best candidate SFU [%s]\", node)\n\t\trpcID := discovery.GetRPCChannel(node)\n\t\teventID := discovery.GetEventChannel(node)\n\t\tname := node.Info[\"name\"]\n\t\tid := node.Info[\"id\"]\n\t\tresp := proto.GetSFURPCParams{Name: name, RPCID: rpcID, EventID: eventID, Service: service, ID: id}\n\t\tlog.Infof(\"findServiceNode: [%s] %s => %s\", service, name, rpcID)\n\t\treturn resp, nil\n\t}\n\n\treturn nil, util.NewNpError(404, fmt.Sprintf(\"Service node [%s] not found\", service))\n}", "title": "" }, { "docid": "ce5c13472569fa03162afec314e46862", "score": "0.48702508", "text": "func NewGetCameraIndexStreamFound() *GetCameraIndexStreamFound {\n\treturn &GetCameraIndexStreamFound{}\n}", "title": "" }, { "docid": "b9d6b572d49b1652f89790c5020312d2", "score": "0.48686442", "text": "func (c *reportingAPIReportUpdatedClient) GetStream() rpcc.Stream { return c.Stream }", "title": "" }, { "docid": "30095427159bc7fb518626189830265f", "score": "0.48662522", "text": "func (s *Server) FindChannel(n string) (ChannelInterface, error) {\n ch, ok := s.Channels.Load(n)\n\n if !ok {\n return &Channel{}, errors.New(\"channel \" + n + \" does not exist\")\n }\n\n return ch.(ChannelInterface), nil\n}", "title": "" }, { "docid": "c2ab937b4fec6181c27771d0d90563e5", "score": "0.4856806", "text": "func (m MongoContext) checkStreamID(st_id string) (bool, error) {\n\tlog.Trace(log.Here(), \"checkStreamID() : calling method - \", st_id)\n\tif !bson.IsObjectIdHex(st_id) {\n\t\treturn false, errors.New(\"bad format for streamID!\")\n\t}\n\tmongoSession := m.Session.Clone()\n\tdefer mongoSession.Close()\n\tc := mongoSession.DB(m.MongoDbName).C(\"stream\")\n\tnb, err := c.Find(bson.M{\"_id\": bson.ObjectIdHex(st_id)}).Count()\n\tif nb == 1 && err == nil {\n\t\treturn true, nil\n\t} else {\n\t\treturn false, nil\n\t}\n}", "title": "" }, { "docid": "0340b504cf061a5fe869652ab84d1be9", "score": "0.4844552", "text": "func (r *RecordStream) StreamIndex() uint32 {\n\treturn r.index\n}", "title": "" }, { "docid": "ad7203a5c04ecc38777f1a8e8e840304", "score": "0.48420015", "text": "func (s *Yamux) OpenStream() (net.Conn, error) {\n\treturn s.session.OpenStream()\n}", "title": "" }, { "docid": "21cd60ed44273e76741cc89ef7d905b0", "score": "0.48375452", "text": "func (s StreamService) GetStreams() {\n\n}", "title": "" }, { "docid": "dd3b38a3c246a2e7190497840520c466", "score": "0.4832784", "text": "func (d Dir) Lookup(path string) (file reflow.File, ok bool) {\n\tfile, ok = d.contents[path]\n\treturn file, ok\n}", "title": "" }, { "docid": "d5360f59f163ed0fde78aa1269ca7144", "score": "0.48310235", "text": "func (c *Client) GetServiceStream(ctx context.Context, id int, decode bool) (io.ReadCloser, *http.Response, error) {\n\tu := fmt.Sprintf(\"services/%d/stream\", id)\n\n\treturn c.getTS(ctx, u, decode)\n}", "title": "" }, { "docid": "191d22ad70452391d830100c771b1f7a", "score": "0.4830726", "text": "func (s *Stream) Stream(sm Streams) Streams {\n\ts.pl.Lock()\n\tdefer s.pl.Unlock()\n\ts.pubs = append(s.pubs, sm)\n\treturn sm\n}", "title": "" }, { "docid": "b698f06d5e4bb4191c504be8f01413aa", "score": "0.4828368", "text": "func (c *requestServedFromCacheClient) GetStream() rpcc.Stream { return c.Stream }", "title": "" }, { "docid": "8cbbf6dd602ed96bea9e35ee7a578586", "score": "0.48278362", "text": "func NewStream(it Iterator) Stream {\n\treturn Stream{it: it}\n}", "title": "" }, { "docid": "2086d19193fba4de7b2e874b54134936", "score": "0.48217326", "text": "func (p *EpFF) Search(ctx context.Context, upstreams []*upstream.Fs, path string) (*upstream.Fs, error) {\n\tif len(upstreams) == 0 {\n\t\treturn nil, fs.ErrorObjectNotFound\n\t}\n\treturn p.epff(ctx, upstreams, path)\n}", "title": "" }, { "docid": "43f3f0abbb143fc19d5325216b4c04dd", "score": "0.4820776", "text": "func (ws *WrappedStream) Stream() net.Stream {\n\treturn ws.stream\n}", "title": "" }, { "docid": "3588c27e9dded7f4c8e5b46bce9bf79c", "score": "0.4820128", "text": "func (notifee *Notifee) OpenedStream(network.Network, network.Stream) {}", "title": "" }, { "docid": "a80b7823fc92456267f56272ab92b2d8", "score": "0.4818266", "text": "func (p Passengers) Find(ssn string) Passenger {\n\tif one, ok := p[ssn]; ok {\n\t\treturn one\n\t}\n\treturn Passenger{}\n}", "title": "" }, { "docid": "a80b7823fc92456267f56272ab92b2d8", "score": "0.4818266", "text": "func (p Passengers) Find(ssn string) Passenger {\n\tif one, ok := p[ssn]; ok {\n\t\treturn one\n\t}\n\treturn Passenger{}\n}", "title": "" }, { "docid": "41051523a3af4a5dcc88dea10f8116b1", "score": "0.48075143", "text": "func (h *Hub) FindRun(flowID, runID string) *Run {\n\treturn h.runs.find(flowID, runID)\n}", "title": "" }, { "docid": "ee8819a52f3371881561eb6f4f7cdd4c", "score": "0.4803986", "text": "func DownloadStream(blob *stream.SDBlob, blobsDir string) error {\n\thashes := GetStreamHashes(blob)\n\tfor _, hash := range hashes {\n\t\t_, err := os.Stat(blobsDir + hash)\n\t\tif os.IsNotExist(err) {\n\t\t\t_, err := DownloadBlob(hash, true, blobsDir)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else if err != nil {\n\t\t\treturn errors.Err(err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6baba875954631c5e257be92822b16b8", "score": "0.480318", "text": "func (s *Stream) StreamID() uint32 {\n\treturn s.id\n}", "title": "" }, { "docid": "e44e0f76060016b885ba4b6bbbcca9a4", "score": "0.48023883", "text": "func (s *Session) FindOne(dest interface{}) error {\n\ts.initStatemnt()\n\ts.Limit(1)\n\tscanner, err := NewScanner(dest)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif scanner.entityPointer.Kind() != reflect.Struct {\n\t\treturn FindOneExpectStruct\n\t}\n\tdefer scanner.Close()\n\tif s.statement.table == \"\" {\n\t\ts.statement.From(scanner.GetTableName())\n\t}\n\n\tif s.explainModel {\n\t\ts.explain()\n\t}\n\n\ts.initCtx()\n\tsql, args, err := s.statement.ToSQL()\n\tif err != nil {\n\t\treturn err\n\t}\n\ts.logger.Debugf(\"[Session FindOne] sql: %s, args: %v\", sql, args)\n\trows, err := s.QueryContext(s.ctx, sql, args...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tscanner.SetRows(rows)\n\treturn scanner.Convert()\n}", "title": "" }, { "docid": "013ba2b75e458278d0f92b7da8550b49", "score": "0.47945", "text": "func LookupStreamingPolicy(ctx *pulumi.Context, args *LookupStreamingPolicyArgs, opts ...pulumi.InvokeOption) (*LookupStreamingPolicyResult, error) {\n\tvar rv LookupStreamingPolicyResult\n\terr := ctx.Invoke(\"azure-native:media/v20200501:getStreamingPolicy\", args, &rv, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &rv, nil\n}", "title": "" }, { "docid": "e6190926d7771980c9d48d1b161529a6", "score": "0.47892708", "text": "func (p *Newest) Search(ctx context.Context, upstreams []*upstream.Fs, path string) (*upstream.Fs, error) {\n\tif len(upstreams) == 0 {\n\t\treturn nil, fs.ErrorObjectNotFound\n\t}\n\treturn p.newest(ctx, upstreams, path)\n}", "title": "" }, { "docid": "ebd16e721e7266d8f5785237f0182642", "score": "0.47887012", "text": "func (p *Port) Stream() *Port {\n\treturn p.sub\n}", "title": "" }, { "docid": "1e02d95ef9fb8b56fe096c6a112d63cc", "score": "0.47840834", "text": "func Stream(registry, namespace, name string, tags map[string]imageapi.TagEventList) imageapi.ImageStream {\n\treturn AgedStream(registry, namespace, name, -1, tags)\n}", "title": "" }, { "docid": "229feb7b51bba7c24310cac1658c93e0", "score": "0.4775632", "text": "func (s *Stream) StartStream(optionalQueryParams string) error {\n\tres, err := s.httpClient.GetSearchStream(optionalQueryParams)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ts.reader.setStreamResponseBody(res.Body)\n\n\tgo s.streamMessages(res)\n\n\treturn nil\n}", "title": "" }, { "docid": "6b607b242abefd6a5526ac5842db1899", "score": "0.47704998", "text": "func (ks *kuiperService) UpdateStream(ctx context.Context, token string, stream Stream) error {\n\tres, err := ks.auth.Identify(ctx, &mainflux.Token{Value: token})\n\tif err != nil {\n\t\treturn ErrUnauthorizedAccess\n\t}\n\tstream.Owner = res.GetValue()\n\treturn ks.streams.Update(ctx, stream)\n}", "title": "" }, { "docid": "5a8bed82143e021a68f78d36041b772e", "score": "0.47693676", "text": "func (s *streamKey) get(id string) (int, *StreamEntry) {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\n\tpos := sort.Search(len(s.entries), func(i int) bool {\n\t\treturn streamCmp(id, s.entries[i].ID) <= 0\n\t})\n\tif len(s.entries) <= pos || s.entries[pos].ID != id {\n\t\treturn 0, nil\n\t}\n\treturn pos, &s.entries[pos]\n}", "title": "" }, { "docid": "835fa08c027d25bfd19dc48f67c32bbf", "score": "0.47683463", "text": "func (s *Stream) StreamID() uint64 {\n\treturn uint64(s.s.StreamID())\n}", "title": "" } ]
185cb52fd13977bae4effc9b3df822f3
OrderQty is a nonrequired field for OrderCancelReplaceRequest.
[ { "docid": "a45a7f11e6f7da6c573235d96ca173e7", "score": "0.71626616", "text": "func (m Message) OrderQty() (*field.OrderQtyField, quickfix.MessageRejectError) {\n\tf := &field.OrderQtyField{}\n\terr := m.Body.Get(f)\n\treturn f, err\n}", "title": "" } ]
[ { "docid": "29782e935599dcef9b66ae5ec959dba8", "score": "0.6807798", "text": "func (m Message) CashOrderQty() (*field.CashOrderQtyField, quickfix.MessageRejectError) {\n\tf := &field.CashOrderQtyField{}\n\terr := m.Body.Get(f)\n\treturn f, err\n}", "title": "" }, { "docid": "083b6378df71f4bfd0420f2b2546d910", "score": "0.6707803", "text": "func (m Message) GetOrderQty(f *field.OrderQtyField) quickfix.MessageRejectError {\n\treturn m.Body.Get(f)\n}", "title": "" }, { "docid": "12e06db8e25fca3df888e8b20c3295be", "score": "0.6639825", "text": "func (m NoRelatedSym) SetOrderQty(value decimal.Decimal, scale int32) {\n\tm.Set(field.NewOrderQty(value, scale))\n}", "title": "" }, { "docid": "57c9ddb194c5d992309a610707bc4687", "score": "0.6383352", "text": "func (m NoRelatedSym) GetOrderQty() (v decimal.Decimal, err quickfix.MessageRejectError) {\n\tvar f field.OrderQtyField\n\tif err = m.Get(&f); err == nil {\n\t\tv = f.Value()\n\t}\n\treturn\n}", "title": "" }, { "docid": "98e371373ae2f46488ac75befea871e2", "score": "0.6219878", "text": "func (o *Order) Cancel() {\n\topenQuantity := decimal.Zero\n\to.openQuantity = &openQuantity\n}", "title": "" }, { "docid": "427e1eef8849077cef44a4781cae1568", "score": "0.6151332", "text": "func (m Message) GetCashOrderQty(f *field.CashOrderQtyField) quickfix.MessageRejectError {\n\treturn m.Body.Get(f)\n}", "title": "" }, { "docid": "10202711711b208fb754191ed8c3adb1", "score": "0.580467", "text": "func (m Message) OrderQty2() (*field.OrderQty2Field, quickfix.MessageRejectError) {\n\tf := &field.OrderQty2Field{}\n\terr := m.Body.Get(f)\n\treturn f, err\n}", "title": "" }, { "docid": "10202711711b208fb754191ed8c3adb1", "score": "0.580467", "text": "func (m Message) OrderQty2() (*field.OrderQty2Field, quickfix.MessageRejectError) {\n\tf := &field.OrderQty2Field{}\n\terr := m.Body.Get(f)\n\treturn f, err\n}", "title": "" }, { "docid": "1a509f34e117c628836d6ef11a73129b", "score": "0.56047654", "text": "func (m Message) MinQty() (*field.MinQtyField, quickfix.MessageRejectError) {\n\tf := &field.MinQtyField{}\n\terr := m.Body.Get(f)\n\treturn f, err\n}", "title": "" }, { "docid": "790e3e0b9b5a867210fd2c14ca9a6150", "score": "0.5578897", "text": "func UpdateQty(c *gin.Context) {\n\tlineid, _ := strconv.Atoi(c.Param(\"lineid\"))\n\tcartid := c.PostForm(\"cart\")\n\tnewQty, _ := strconv.Atoi(c.PostForm(\"qty\"))\n\tvar cartLine CartLine\n\n\terr := Dbmap.SelectOne(&cartLine, \"select * from cartlines where ID = :line and Cart = :cart\", map[string]interface{}{\n\t\t\"cart\": cartid,\n\t\t\"line\": lineid,\n\t})\n\n\tif err != nil { //If the line cannot be found, return an error straight away\n\t\tc.String(http.StatusServiceUnavailable, \"\")\n\t} else { //else proceed with the update\n\t\tif newQty == 0 { //If the quantity is being set to 0 then delete the line\n\t\t\t_, err := Dbmap.Delete(&cartLine)\n\t\t\tif err != nil {\n\t\t\t\tc.String(http.StatusServiceUnavailable, \"\")\n\t\t\t} else {\n\t\t\t\tc.String(http.StatusOK, \"\")\n\t\t\t}\n\t\t} else { //else adjust the quantity and update the database\n\t\t\tcartLine.Qty = newQty\n\t\t\t_, err := Dbmap.Update(&cartLine)\n\t\t\tif err != nil {\n\t\t\t\tc.String(http.StatusServiceUnavailable, \"\")\n\t\t\t} else {\n\t\t\t\tc.String(http.StatusOK, \"\")\n\t\t\t}\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "e1ec013905ba6c915424373fef464dcf", "score": "0.5434149", "text": "func (o *CachedOrder) FilledQty() float64 {\n\to.lock.Lock()\n\tdefer o.lock.Unlock()\n\treturn o.filledQty()\n}", "title": "" }, { "docid": "b3e0cc496c4ceb1ea645d90960b0af14", "score": "0.5366184", "text": "func (a *OrdersApiService) CancelOrder(ctx context.Context, id string) ApiCancelOrderRequest {\n\treturn ApiCancelOrderRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tid: id,\n\t}\n}", "title": "" }, { "docid": "c416c2e264fb2c7d089ffefead0b3b53", "score": "0.53452516", "text": "func (m NoRelatedSym) HasOrderQty() bool {\n\treturn m.Has(tag.OrderQty)\n}", "title": "" }, { "docid": "f2d1e183f0c8b6759309d051da9f3ad9", "score": "0.53262335", "text": "func (m Message) GetOrderQty2(f *field.OrderQty2Field) quickfix.MessageRejectError {\n\treturn m.Body.Get(f)\n}", "title": "" }, { "docid": "f2d1e183f0c8b6759309d051da9f3ad9", "score": "0.53262335", "text": "func (m Message) GetOrderQty2(f *field.OrderQty2Field) quickfix.MessageRejectError {\n\treturn m.Body.Get(f)\n}", "title": "" }, { "docid": "9dea2b7700fee6110d952c2de1772187", "score": "0.5312735", "text": "func (m NoRelatedSym) SetOrderQty2(value decimal.Decimal, scale int32) {\n\tm.Set(field.NewOrderQty2(value, scale))\n}", "title": "" }, { "docid": "e403d1ccce19fd042e602b4b73ad0b71", "score": "0.5262359", "text": "func (m NoRelatedSym) GetOrderQty2() (v decimal.Decimal, err quickfix.MessageRejectError) {\n\tvar f field.OrderQty2Field\n\tif err = m.Get(&f); err == nil {\n\t\tv = f.Value()\n\t}\n\treturn\n}", "title": "" }, { "docid": "7e3e73bf41dbbe6cf0198287e0f3f402", "score": "0.52528", "text": "func (client *Client) LimitOrderCancel(owner string, orderid uint32) (*OperResp, error) {\n\tvar trx []types.Operation\n\n\ttx := &types.LimitOrderCancelOperation{\n\t\tOwner: owner,\n\t\tOrderID: orderid,\n\t}\n\n\ttrx = append(trx, tx)\n\tresp, err := client.SendTrx(owner, trx)\n\treturn &OperResp{NameOper: \"LimitOrderCancel\", Bresp: resp}, err\n}", "title": "" }, { "docid": "ebfd843cd9429077ec11f7bf1005c229", "score": "0.5249179", "text": "func (c *Splitter) SetQuantity(quantity int) {c.quantity = imin(quantity, c.capacity)}", "title": "" }, { "docid": "6e4fd150fe5bd0b342941b8fb7e7ad45", "score": "0.52105176", "text": "func (_EtherDelta *EtherDeltaTransactor) CancelOrder(opts *bind.TransactOpts, tokenGet common.Address, amountGet *big.Int, tokenGive common.Address, amountGive *big.Int, expires *big.Int, nonce *big.Int, v uint8, r [32]byte, s [32]byte) (*types.Transaction, error) {\n\treturn _EtherDelta.contract.Transact(opts, \"cancelOrder\", tokenGet, amountGet, tokenGive, amountGive, expires, nonce, v, r, s)\n}", "title": "" }, { "docid": "169c701b38df67cf679369257fd26690", "score": "0.5208582", "text": "func (s basicService) CancelOrder(ctx context.Context, userID string, orderID string) error {\n\treturn nil\n}", "title": "" }, { "docid": "6c5de5e6d52b8de39fd12b0f5d96ead3", "score": "0.51829845", "text": "func (m Message) GetMinQty(f *field.MinQtyField) quickfix.MessageRejectError {\n\treturn m.Body.Get(f)\n}", "title": "" }, { "docid": "d8e3d52ebb2a38cd7790ee15d80f8401", "score": "0.51776826", "text": "func (b *Kucoin) CancelOrder(orderOid, side, symbol string) error {\n\tif len(symbol) < 1 || len(side) < 1 || len(orderOid) < 1 {\n\t\treturn fmt.Errorf(\"The not all required parameters are presented\")\n\t}\n\tpayload := map[string]string{}\n\tpayload[\"orderOid\"] = orderOid\n\tpayload[\"type\"] = side\n\n\tr, err := b.client.do(\"POST\", fmt.Sprintf(\"%s/cancel-order\", strings.ToUpper(symbol)), payload, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar response interface{}\n\tif err = json.Unmarshal(r, &response); err != nil {\n\t\treturn err\n\t}\n\treturn handleErr(response)\n}", "title": "" }, { "docid": "116946e49d8943a5dea8781d6a8f1281", "score": "0.5152004", "text": "func (m *OrderLineItemMutation) ResetQuantity() {\n\tm.quantity = nil\n\tm.addquantity = nil\n}", "title": "" }, { "docid": "ceb92a757d25799e436a338d00307ec7", "score": "0.51351297", "text": "func (this *BaseOrder) Cancel(tx *sqlx.Tx) error {\n\treturn errors.New(\"*BaseOrder does not implement opay.IOrder (missing Cancel method).\")\n}", "title": "" }, { "docid": "6ec4980af11cda887d8fcfb8b70584e4", "score": "0.5133271", "text": "func TestCancelSpotOrder(t *testing.T) {\n\tTestSetRealOrderDefaults(t)\n\tt.Parallel()\n\trequest := okgroup.CancelSpotOrderRequest{\n\t\tInstrumentID: spotCurrency,\n\t\tOrderID: 1234,\n\t}\n\n\t_, err := o.CancelSpotOrder(context.Background(), request)\n\ttestStandardErrorHandling(t, err)\n}", "title": "" }, { "docid": "730dd63a9d40d83ad49e1f11d8cc2754", "score": "0.5132579", "text": "func (t *SimpleChaincode) updateQuantity(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\n\tvar poid string // Entities\n\tif len(args) != 3 {\n\t\treturn shim.Error(\"Incorrect number of arguments. Expecting 3\")\n\t}\n\tpoid = args[1]\n\t// Query the purchase order from the state in ledger\n\tbytes, err := stub.GetState(poid)\n\tif err != nil {\n\t\treturn shim.Error(\"Unable to get the purchase order\")\n\t}\n\tvar po Purchase_Order\n\terr = json.Unmarshal(bytes, &po)\n\tif err != nil {\n\t\treturn shim.Error(\"Error while unmarshalling JSON object\")\n\t}\n\ttemp,err := strconv.Atoi(args[2])\n\tif err != nil {\n\t\treturn shim.Error(\"The entered value is not an integer\")\n\t}\n\tif temp < 0 {\n\t\treturn shim.Error(\"The entered value has to be positive\")\n\t}\n\tpo.Quantity = temp\n\tresp := t.save_order(stub, po)\n\tif resp != true {\n\t\tfmt.Println(\"UPDATE_PO: Error saving changes: %s\", resp);\n\t\treturn shim.Error(\"Error saving changes\")\n\t}\n\treturn shim.Success([]byte(\"Successfully updated quantity of order\"+args[1]+\" to \"+args[2]))\n}", "title": "" }, { "docid": "1650710aca3cdf884a8ebaa8aa02781a", "score": "0.51227176", "text": "func (c *Client) CancelOrder(venue, stock string, order int64) (*OrderResultAlt, error) {\n\t_, copy, err := c.Call(\"DELETE\", fmt.Sprintf(\"/venues/%s/stocks/%s/orders/%d\", venue, stock, order), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\torderResult := OrderResultAlt{}\n\n\tdecoder := json.NewDecoder(copy)\n\terr = decoder.Decode(&orderResult)\n\n\treturn &orderResult, err\n}", "title": "" }, { "docid": "fa18af3b61ee969304e1afff000f975f", "score": "0.51003075", "text": "func (o *CartItem) SetRemainingQuantity(v int32) {\n\to.RemainingQuantity = &v\n}", "title": "" }, { "docid": "e4c2b87a4f5ce3edbcdbd3d8c7731679", "score": "0.5077506", "text": "func (_EtherDelta *EtherDeltaTransactorSession) CancelOrder(tokenGet common.Address, amountGet *big.Int, tokenGive common.Address, amountGive *big.Int, expires *big.Int, nonce *big.Int, v uint8, r [32]byte, s [32]byte) (*types.Transaction, error) {\n\treturn _EtherDelta.Contract.CancelOrder(&_EtherDelta.TransactOpts, tokenGet, amountGet, tokenGive, amountGive, expires, nonce, v, r, s)\n}", "title": "" }, { "docid": "a9ffe2ae24ba0d389bb36a2743707cd4", "score": "0.5076701", "text": "func (p *OkexRestAPI) CancelOrder(order OrderInfo) *TradeResult {\n\treturn nil\n}", "title": "" }, { "docid": "3a74781479146435f1481e974102e7fb", "score": "0.5068746", "text": "func (cs *CartService) UpdateItemQty(ctx context.Context, session *web.Session, itemID string, deliveryCode string, qty int) error {\n\tif qty < 1 {\n\t\t// item needs to be removed, let DeleteItem handle caching/events\n\t\treturn cs.DeleteItem(ctx, session, itemID, deliveryCode)\n\t}\n\n\tcart, behaviour, err := cs.cartReceiverService.GetCart(ctx, session)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// cart cache must be updated - with the current value of cart\n\tvar defers cartDomain.DeferEvents\n\tdefer func() {\n\t\tcs.updateCartInCacheIfCacheIsEnabled(ctx, session, cart)\n\t\tcs.dispatchAllEvents(ctx, defers)\n\t}()\n\n\tif deliveryCode == \"\" {\n\t\tdeliveryCode = cs.defaultDeliveryCode\n\t}\n\n\titem, err := cart.GetByItemID(itemID)\n\tif err != nil {\n\t\tcs.logger.WithContext(ctx).WithField(flamingo.LogKeySubCategory, \"UpdateItemQty\").Error(err)\n\n\t\treturn err\n\t}\n\n\tqtyBefore := item.Qty\n\n\tproduct, err := cs.productService.Get(ctx, item.MarketplaceCode)\n\tif err != nil {\n\t\tcs.logger.WithContext(ctx).WithField(flamingo.LogKeySubCategory, \"UpdateItemQty\").Error(err)\n\n\t\treturn err\n\t}\n\n\tproduct, err = cs.getSpecificProductType(ctx, product, item.VariantMarketPlaceCode, item.BundleConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = cs.checkProductQtyRestrictions(ctx, session, product, cart, qty-qtyBefore, deliveryCode, itemID)\n\tif err != nil {\n\t\tcs.logger.WithContext(ctx).WithField(flamingo.LogKeySubCategory, \"UpdateItemQty\").Info(err)\n\n\t\treturn err\n\t}\n\n\titemUpdate := cartDomain.ItemUpdateCommand{\n\t\tQty: &qty,\n\t\tItemID: itemID,\n\t\tAdditionalData: nil,\n\t}\n\n\tcart, defers, err = behaviour.UpdateItem(ctx, cart, itemUpdate)\n\tif err != nil {\n\t\tcs.handleCartNotFound(session, err)\n\t\tcs.logger.WithContext(ctx).WithField(flamingo.LogKeySubCategory, \"UpdateItemQty\").Error(err)\n\n\t\treturn err\n\t}\n\n\t// append deferred events of behaviour with changed qty event\n\tupdateEvent := &events.ChangedQtyInCartEvent{\n\t\tCart: cart,\n\t\tCartID: cart.ID,\n\t\tMarketplaceCode: item.MarketplaceCode,\n\t\tVariantMarketplaceCode: item.VariantMarketPlaceCode,\n\t\tProductName: product.TeaserData().ShortTitle,\n\t\tQtyBefore: qtyBefore,\n\t\tQtyAfter: qty,\n\t}\n\tdefers = append(defers, updateEvent)\n\n\treturn nil\n}", "title": "" }, { "docid": "d22a104e3a0853a27d5e636629a65fc0", "score": "0.505314", "text": "func TestCancelMarginOrder(t *testing.T) {\n\tTestSetRealOrderDefaults(t)\n\tt.Parallel()\n\trequest := okgroup.CancelSpotOrderRequest{\n\t\tInstrumentID: spotCurrency,\n\t\tOrderID: 1234,\n\t}\n\n\t_, err := o.CancelMarginOrder(context.Background(), request)\n\ttestStandardErrorHandling(t, err)\n}", "title": "" }, { "docid": "4c2cae0c57c127f3d5e35a7a0cb479de", "score": "0.504841", "text": "func (_EtherDelta *EtherDeltaSession) CancelOrder(tokenGet common.Address, amountGet *big.Int, tokenGive common.Address, amountGive *big.Int, expires *big.Int, nonce *big.Int, v uint8, r [32]byte, s [32]byte) (*types.Transaction, error) {\n\treturn _EtherDelta.Contract.CancelOrder(&_EtherDelta.TransactOpts, tokenGet, amountGet, tokenGive, amountGive, expires, nonce, v, r, s)\n}", "title": "" }, { "docid": "520c88a62e1a09419d51cbfc946362f4", "score": "0.50274163", "text": "func (m *OrderLineItemMutation) OldQuantity(ctx context.Context) (v int, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldQuantity is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldQuantity 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 OldQuantity: %w\", err)\n\t}\n\treturn oldValue.Quantity, nil\n}", "title": "" }, { "docid": "8a1e4c4bbbfe2e962296151f7e8f3e99", "score": "0.5024915", "text": "func (c *client) CancelOrder(ctx context.Context, instrumentName string, orderID string) error {\n\tif instrumentName == \"\" {\n\t\treturn errors.InvalidParameterError{Parameter: \"instrumentName\", Reason: \"cannot be empty\"}\n\t}\n\tif orderID == \"\" {\n\t\treturn errors.InvalidParameterError{Parameter: \"orderID\", Reason: \"cannot be empty\"}\n\t}\n\n\tvar (\n\t\tid = c.idGenerator.Generate()\n\t\ttimestamp = c.clock.Now().UnixMilli()\n\t\tparams = make(map[string]interface{})\n\t)\n\n\tparams[\"instrument_name\"] = instrumentName\n\tparams[\"order_id\"] = orderID\n\n\tsignature, err := c.signatureGenerator.GenerateSignature(auth.SignatureRequest{\n\t\tAPIKey: c.apiKey,\n\t\tSecretKey: c.secretKey,\n\t\tID: id,\n\t\tMethod: methodCancelOrder,\n\t\tTimestamp: timestamp,\n\t\tParams: params,\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to cancel signature: %w\", err)\n\t}\n\n\tbody := api.Request{\n\t\tID: id,\n\t\tMethod: methodCancelOrder,\n\t\tNonce: timestamp,\n\t\tParams: params,\n\t\tSignature: signature,\n\t\tAPIKey: c.apiKey,\n\t}\n\n\tvar cancelOrderResponse CancelOrderResponse\n\tstatusCode, err := c.requester.Post(ctx, body, methodCancelOrder, &cancelOrderResponse)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to execute post request: %w\", err)\n\t}\n\n\tif err := c.requester.CheckErrorResponse(statusCode, cancelOrderResponse.Code); err != nil {\n\t\treturn fmt.Errorf(\"error received in response: %w\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7c0f3a9a23bc9e7bdc3dac27738bcc25", "score": "0.50171125", "text": "func (o *Pool) SetQuantity(v int32) {\n\to.Quantity = &v\n}", "title": "" }, { "docid": "a517fe060d4305c48c3b898186e879ce", "score": "0.4993188", "text": "func ReplaceOrder(orderID string, req ReplaceOrderRequest) (*Order, error) {\n\treturn DefaultClient.ReplaceOrder(orderID, req)\n}", "title": "" }, { "docid": "334c4b31595d39ff1a3385e9d6de0839", "score": "0.49831006", "text": "func (po *Poloniex) CancelExchangeOrder(p pair.CurrencyPair, orderID int64) (int64, error) {\n\treturn 0, errors.New(\"not yet implemented\")\n}", "title": "" }, { "docid": "551eb4b1517c987a66807d49c6e0da98", "score": "0.49808717", "text": "func (ob *orderBook) CancelAskOrder(ask *models.Ask) {\n\t// stopLoss orders haven't even been added to the depth. So they shouldn't be removed.\n\tif ask.OrderType == models.StopLoss {\n\t\treturn\n\t}\n\t// Others have been added. So remove those.\n\tunfulfilled := ask.StockQuantity - ask.StockQuantityFulfilled\n\tob.depth.CloseOrder(isMarket(ask.OrderType), true, ask.Price, unfulfilled)\n}", "title": "" }, { "docid": "a396da9a6a8ac64d4a9a6207ee5425a6", "score": "0.4976001", "text": "func (m *OrderLineItemMutation) SetQuantity(i int) {\n\tm.quantity = &i\n\tm.addquantity = nil\n}", "title": "" }, { "docid": "ec62c1dc9686c40c66f1d67ad5647008", "score": "0.4957851", "text": "func (o *Order) OpenQuantity() decimal.Decimal {\n\tif o.openQuantity == nil {\n\t\treturn o.Quantity.Sub(o.ExecutedQuantity)\n\t}\n\n\treturn *o.openQuantity\n}", "title": "" }, { "docid": "9e91e5a4ea5dea5783f48f24ad99a573", "score": "0.4924402", "text": "func (api *API) CancelOrder(t *requests.CancelOrderSettings) (responses.CancelOrder, error) {\n\n\tvalues := api.createLinkCancelOrder(t)\n\n\tbody, err := api.sendRequest(values)\n\tsettings.Check(\"Trade API.CancelOrder() Sending request\", err)\n\n\tcancelOrder := responses.NewCancelOrder()\n\terr = json.Unmarshal(body, &cancelOrder)\n\tsettings.Check(\"Trade API.CancelOrder() Unmarshalling response body\", err)\n\n\treturn cancelOrder, err\n}", "title": "" }, { "docid": "17a2aad46c14e3d37d3dc25a3aeca6d5", "score": "0.4919099", "text": "func (h *HUOBI) FCancelOrder(ctx context.Context, baseCurrency currency.Code, orderID, clientOrderID string) (FCancelOrderData, error) {\n\tvar resp FCancelOrderData\n\treq := make(map[string]interface{})\n\tif baseCurrency.IsEmpty() {\n\t\treturn resp, fmt.Errorf(\"cannot cancel futures order %w\", currency.ErrCurrencyCodeEmpty)\n\t}\n\treq[\"symbol\"] = baseCurrency.String() // Upper and lower case are supported\n\tif orderID != \"\" {\n\t\treq[\"order_id\"] = orderID\n\t}\n\tif clientOrderID != \"\" {\n\t\treq[\"client_order_id\"] = clientOrderID\n\t}\n\treturn resp, h.FuturesAuthenticatedHTTPRequest(ctx, exchange.RestFutures, http.MethodPost, fCancelOrder, nil, req, &resp)\n}", "title": "" }, { "docid": "b1f9e729b95e9e7ded03ff7e1f5452a2", "score": "0.4916894", "text": "func (m Message) GetQtyType(f *field.QtyTypeField) quickfix.MessageRejectError {\n\treturn m.Body.Get(f)\n}", "title": "" }, { "docid": "2173c4b7d8f59cc19c386eddf6d18032", "score": "0.4916537", "text": "func (client *Client) CancelOrder(venue, stock string, orderID int64) (*Order, error) {\n\tvenue = strings.TrimSpace(venue)\n\tif venue == \"\" {\n\t\tpanic(fmt.Errorf(\"Invalid venue symbol: %v\", venue))\n\t}\n\n\tstock = strings.TrimSpace(stock)\n\tif stock == \"\" {\n\t\tpanic(fmt.Errorf(\"Invalid stock symbol: %v\", stock))\n\t}\n\n\tvar resp apiRespStockOrderStatus\n\tstatus, err := client.getAPIJson(\"DELETE\", \"/venues/\"+venue+\"/stocks/\"+stock+\"/orders/\"+strconv.FormatInt(orderID, 10), nil, &resp)\n\tswitch {\n\tcase err != nil:\n\t\treturn nil, err\n\tcase status == 401: // unauthorized\n\t\treturn nil, &ErrorUnauthorized{}\n\tcase status == 404: // stock not found\n\t\treturn nil, &ErrorStockNotFound{VenueSymbol: venue, StockSymbol: stock}\n\t}\n\n\tif !resp.OK {\n\t\treturn nil, errors.New(resp.Error)\n\t}\n\n\treturn &Order{\n\t\tDirection: resp.Direction,\n\t\tOriginalQuantity: resp.OriginalQuantity,\n\t\tQuantity: resp.Quantity,\n\t\tPrice: resp.Price,\n\t\tOrderType: resp.OrderType,\n\t\tOrderID: resp.OrderID,\n\t\tAccount: resp.Account,\n\t\tTimestamp: resp.Timestamp,\n\t\tFills: resp.Fills,\n\t\tTotalFilled: resp.TotalFilled,\n\t\tOpen: resp.Open,\n\t}, nil\n}", "title": "" }, { "docid": "07e7672ac22f91572544fb8adc624fde", "score": "0.48901397", "text": "func (y *Yobit) CancelExistingOrder(ctx context.Context, orderID int64) error {\n\treq := url.Values{}\n\treq.Add(\"order_id\", strconv.FormatInt(orderID, 10))\n\n\tresult := CancelOrder{}\n\n\terr := y.SendAuthenticatedHTTPRequest(ctx, exchange.RestSpotSupplementary, privateCancelOrder, req, &result)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif result.Error != \"\" {\n\t\treturn fmt.Errorf(\"%w %v\", request.ErrAuthRequestFailed, result.Error)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4bd7c2925a8807678f37f5fe6d7203d7", "score": "0.4874094", "text": "func (client LROsClient) PutAsyncNoRetrycanceledPreparer(ctx context.Context, product *Product) (*http.Request, error) {\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPut(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPath(\"/lro/putasync/noretry/canceled\"))\n\tif product != nil {\n\t\tpreparer = autorest.DecoratePreparer(preparer,\n\t\t\tautorest.WithJSON(product))\n\t}\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "ea64498071247338b74f788da18e8bdc", "score": "0.48722547", "text": "func (h *HitBTC) CancelOrder(orderID string) (response *OrderResponse, err error) {\n\tresponse = &OrderResponse{}\n\n\terr = h.Request(exchange.RequestParams{\n\t\tAuth: true,\n\t\tMethod: \"DELETE\",\n\t\tEndpoint: fmt.Sprintf(\"/order/%s\", orderID),\n\t}, &response)\n\n\treturn\n}", "title": "" }, { "docid": "cd7b17f4d52c7e01bc9fadd57bde0adf", "score": "0.48528135", "text": "func (c *client) CancelOrder(orderID string) error {\n\tu, err := url.Parse(fmt.Sprintf(\"%s/%s/orders/%s\", c.opts.BaseURL, apiVersion, orderID))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tresp, err := c.delete(u)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn verify(resp)\n}", "title": "" }, { "docid": "318ab3ccf66fcfd6f09d8627d6b8f0df", "score": "0.485242", "text": "func (s *RPCServer) CancelOrder(ctx context.Context, r *gctrpc.CancelOrderRequest) (*gctrpc.CancelOrderResponse, error) {\n\texch := GetExchangeByName(r.Exchange)\n\tif exch == nil {\n\t\treturn nil, errors.New(\"exchange is not loaded/doesn't exist\")\n\t}\n\n\terr := exch.CancelOrder(&order.Cancel{\n\t\tAccountID: r.AccountId,\n\t\tID: r.OrderId,\n\t\tSide: order.Side(r.Side),\n\t\tWalletAddress: r.WalletAddress,\n\t\tPair: currency.NewPairFromStrings(r.Pair.Base, r.Pair.Quote),\n\t})\n\n\treturn &gctrpc.CancelOrderResponse{}, err\n}", "title": "" }, { "docid": "a790f62dd305f4a48f7ef60741ba2eeb", "score": "0.48356304", "text": "func (liu *LineItemUpdate) SetQuantity(i int) *LineItemUpdate {\n\tliu.mutation.ResetQuantity()\n\tliu.mutation.SetQuantity(i)\n\treturn liu\n}", "title": "" }, { "docid": "edd4776b69cc2927a714d9c329c88f9a", "score": "0.48307255", "text": "func NewOrderCancel() *OrderCancel {\n\treturn &OrderCancel{\n\t\tHash: common.Hash{},\n\t\tOrderHash: common.Hash{},\n\t\tSignature: &Signature{},\n\t}\n}", "title": "" }, { "docid": "ee868c1cc4c768bb6df14c43271bda74", "score": "0.4822438", "text": "func (m *OrderLineItemMutation) Quantity() (r int, exists bool) {\n\tv := m.quantity\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "title": "" }, { "docid": "24ec536787ddc67168a2d3df06a46d53", "score": "0.48175684", "text": "func (c *Splitter) GetQuantity() (quantity int) {return c.quantity}", "title": "" }, { "docid": "082aa3c30d2c4c9b8c181a3c761341dd", "score": "0.4814611", "text": "func (m *LineItemMutation) ResetQuantity() {\n\tm.quantity = nil\n\tm.addquantity = nil\n}", "title": "" }, { "docid": "eb937e3349892095b6c0678c24aea929", "score": "0.4802189", "text": "func (b *Bittrex) cancelOrder(uuid string) ([]Balance, error) {\n\tvar balances []Balance\n\tvalues := url.Values{}\n\tvalues.Set(\"uuid\", uuid)\n\tpath := fmt.Sprintf(\"%s/%s\", bittrexAPIURL, bittrexAPICancel)\n\n\treturn balances, b.HTTPRequest(path, true, values, &balances)\n}", "title": "" }, { "docid": "3f701b7da8783dfae8b066f19d6ad688", "score": "0.4794594", "text": "func (e StockModificationRequestValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "a4695adefad1256b6d870d4035fcf327", "score": "0.47942805", "text": "func (m *Order_Item) GetQuantity() uint32 {\n\tif m != nil {\n\t\treturn m.Quantity\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "b906074c06b222f2a6e881aefa0ba6d0", "score": "0.4793729", "text": "func (c *Client) CancelOrder(clientOrderId string, pair exchanger.Pair, side string) (interface{}, error) {\n\tconst path = \"/api/1/trading/cancel_order\"\n\n\tp, ok := Pairs[pair]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"%s: Pair not traded on this market %s\", ExchangerName, pair)\n\t}\n\n\tcancelRequestClientOrderId := fmt.Sprintf(\"cancel-order-%d\", makeTimestamp())\n\n\tdata := &url.Values{\n\t\t\"clientOrderId\": []string{clientOrderId},\n\t\t\"cancelRequestClientOrderId\": []string{cancelRequestClientOrderId},\n\t\t\"symbol\": []string{p},\n\t\t\"side\": []string{side},\n\t}\n\n\tv := map[string]interface{}{}\n\terr := c.authPost(path, data, &v)\n\treturn v, err\n}", "title": "" }, { "docid": "134ce831b90696acbe1bc8d3f3064021", "score": "0.47915876", "text": "func (o *Holding) SetQuantity(v float64) {\n\to.Quantity = v\n}", "title": "" }, { "docid": "66e99e22fdb3dca758eacc98ea3d39cd", "score": "0.47900966", "text": "func (m *LineItemMutation) SetQuantity(i int) {\n\tm.quantity = &i\n\tm.addquantity = nil\n}", "title": "" }, { "docid": "3c003eb105a6de8ea9452a47efe5cc12", "score": "0.4790067", "text": "func CancelOrder(orderID string) error {\n\treturn DefaultClient.CancelOrder(orderID)\n}", "title": "" }, { "docid": "3c003eb105a6de8ea9452a47efe5cc12", "score": "0.4790067", "text": "func CancelOrder(orderID string) error {\n\treturn DefaultClient.CancelOrder(orderID)\n}", "title": "" }, { "docid": "6262c4f903781283f3655067886d12c4", "score": "0.47864506", "text": "func (o *UpdateProduct) GetQuantity() int32 {\n\tif o == nil || IsNil(o.Quantity) {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.Quantity\n}", "title": "" }, { "docid": "7d169ebaaa096e809975ff634cbc8be4", "score": "0.47864464", "text": "func (o *CartItem) GetRemainingQuantity() int32 {\n\tif o == nil || o.RemainingQuantity == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.RemainingQuantity\n}", "title": "" }, { "docid": "aa444ee3c61d0f10ea80d6f222027ad0", "score": "0.4770155", "text": "func (as *ApiService) CancelOrder(orderId string) (*ApiResponse, error) {\n\treq := NewRequest(http.MethodDelete, \"/api/v1/orders/\"+orderId, nil)\n\treturn as.Call(req)\n}", "title": "" }, { "docid": "9dd9466a4c4497c9566c053a70f066f8", "score": "0.476895", "text": "func (amazonPay *AmazonPay) CancelOrderReference(orderReferenceID string, reason string) error {\n\tvar params = Params{\n\t\t\"Action\": \"CancelOrderReference\",\n\t\t\"AmazonOrderReferenceId\": orderReferenceID,\n\t\t\"CancelationReason\": reason,\n\t}\n\n\treturn amazonPay.Post(params, nil)\n}", "title": "" }, { "docid": "a34df2d37ca49e9b6314177e66f50396", "score": "0.47648448", "text": "func (o *OrderCancelParams) WithTimeout(timeout time.Duration) *OrderCancelParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "title": "" }, { "docid": "70202bdb87a777d296d5ddcb5a90ae2f", "score": "0.47615215", "text": "func (o *UpdateProduct) SetQuantity(v int32) {\n\to.Quantity = &v\n}", "title": "" }, { "docid": "33559f3a859e93c1f9f3f3280841af11", "score": "0.4760301", "text": "func TestInventoryRepo_UpdateInventoryQtyRaceCondition(t *testing.T) {\n\trepo := InitInventoryRepo()\n\tid := setupInventoryRow(repo)\n\n\tlog.Printf(\"testing product id: %v\", id)\n\tlog.Printf(\"fetching inventory row of id %v ...\", id)\n\tinv, err := repo.FindProductInventory(id)\n\tif err != nil {\n\t\ttestFailed(t, err)\n\t}\n\n\tlog.Printf(\"success, qty of row id %v = %v\", id, inv.Quantity)\n\n\twg := sync.WaitGroup{}\n\n\tfor i := 0; i < 50; i++ {\n\t\twg.Add(1)\n\n\t\tgo func(loop int) {\n\t\t\trepo.UpdateInventoryQtyRaceCondition(id, 1)\n\t\t\twg.Done()\n\t\t}(i)\n\t}\n\n\twg.Wait()\n\n\tinv, err = repo.FindProductInventory(id)\n\tif err != nil {\n\t\ttestFailed(t, err)\n\t}\n\n\tlog.Printf(\"test finished, qty of row id %v = %v\", id, inv.Quantity)\n\n\tif inv.Quantity > 0 {\n\t\tt.Errorf(\"expected result is negative value\")\n\t}\n}", "title": "" }, { "docid": "2895d0333c3126c2114bdac625a526d8", "score": "0.47581258", "text": "func (m Message) QtyType() (*field.QtyTypeField, quickfix.MessageRejectError) {\n\tf := &field.QtyTypeField{}\n\terr := m.Body.Get(f)\n\treturn f, err\n}", "title": "" }, { "docid": "3da82540c5a8b6455efdd71a37923782", "score": "0.47548237", "text": "func (h *HUOBI) FCancelTriggerOrder(ctx context.Context, symbol, orderID string) (FCancelOrderData, error) {\n\tvar resp FCancelOrderData\n\treq := make(map[string]interface{})\n\treq[\"symbol\"] = symbol\n\treq[\"order_id\"] = orderID\n\treturn resp, h.FuturesAuthenticatedHTTPRequest(ctx, exchange.RestFutures, http.MethodPost, fCancelTriggerOrder, nil, req, &resp)\n}", "title": "" }, { "docid": "a5c6eebb68bbaa712a34342900b7d747", "score": "0.47541985", "text": "func (account *Account) CancelOrder(symbol string, orderID int64) error {\n\tctx, cancel := newContext()\n\tdefer cancel()\n\t_, err := account.NewCancelOrderService().Symbol(symbol).OrderID(orderID).Do(ctx)\n\tif err != nil {\n\t\treturn errors.Trace(err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ed008fe05c1d71b76df80773512fce26", "score": "0.47467685", "text": "func (b *BTSE) CancelOrder(ctx context.Context, o *order.Cancel) error {\n\tif err := o.Validate(o.StandardCancel()); err != nil {\n\t\treturn err\n\t}\n\n\tfPair, err := b.FormatExchangeCurrency(o.Pair, o.AssetType)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = b.CancelExistingOrder(ctx, o.OrderID, fPair.String(), o.ClientOrderID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d749ab0a5a5ed449ccdcf4e71af8bf06", "score": "0.4732353", "text": "func (m *LineItemMutation) OldQuantity(ctx context.Context) (v int, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldQuantity is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldQuantity 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 OldQuantity: %w\", err)\n\t}\n\treturn oldValue.Quantity, nil\n}", "title": "" }, { "docid": "af446053c77099e55af0729aecb08070", "score": "0.47301936", "text": "func (liuo *LineItemUpdateOne) SetQuantity(i int) *LineItemUpdateOne {\n\tliuo.mutation.ResetQuantity()\n\tliuo.mutation.SetQuantity(i)\n\treturn liuo\n}", "title": "" }, { "docid": "e67c0d16b784be21cd9b78dcb8d433d5", "score": "0.47260523", "text": "func Cancel(db *database.DB, env *env.Config) httperrors.Handler {\n\ttype pendingStockToDelete struct {\n\t\tCompany string `json:\"company\"`\n\t}\n\ttype result struct {\n\t\tMessage string `json:\"msg\"`\n\t}\n\treturn func(w http.ResponseWriter, r *http.Request) *httperrors.HTTPError {\n\t\tvar msg string\n\n\t\tcclose := utils.IsMarketOpen()\n\t\tif !cclose {\n\t\t\tmsg = \"Markets are closed\"\n\t\t} else {\n\t\t\tprops, _ := r.Context().Value(\"props\").(jwt.MapClaims)\n\t\t\tuid, _ := strconv.Atoi(props[\"user_id\"].(string))\n\t\t\tvar p pendingStockToDelete\n\t\t\terr := json.NewDecoder(r.Body).Decode(&p)\n\t\t\tif err != nil {\n\t\t\t\treturn &httperrors.HTTPError{r, err, strconst.InvalidJSON, http.StatusBadRequest}\n\t\t\t}\n\n\t\t\t_, err = db.DeletePending(uid, p.Company)\n\t\t\tif err != nil {\n\t\t\t\treturn &httperrors.HTTPError{r, err, \"Could not delete pending transaction\", http.StatusInternalServerError}\n\t\t\t}\n\t\t\tmsg = \"Specified pending order has been cancelled\"\n\t\t}\n\n\t\tjsonRes, err := json.Marshal(result{Message: msg})\n\t\tif err != nil {\n\t\t\treturn &httperrors.HTTPError{r, err, strconst.JSONEncodingFail, http.StatusInternalServerError}\n\t\t}\n\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\t\tw.WriteHeader(http.StatusOK)\n\t\tw.Write(jsonRes)\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "fa7762451d78538d769a4d4b25913c5a", "score": "0.472069", "text": "func (api *Client) CancelOrder(userId string, orderId string) (*OrderStatusResponse, error) {\n\tvar jsonData OrderStatusResponse\n\tparams := map[string]interface{}{\n\t\t\"user_id\": userId,\n\t\t\"order_id\": orderId,\n\t}\n\n\tresp, err := api.queryPrivate(\"orders/cancel\", params)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = json.Unmarshal(resp, &jsonData)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &jsonData, nil\n}", "title": "" }, { "docid": "67cd7a86714c9d31308ec6d60394c20d", "score": "0.47175688", "text": "func (c *Client) CancelOrder(orderID string) error {\n\tu, err := url.Parse(fmt.Sprintf(\"%s/v1/orders/%s\", base, orderID))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tresp, err := c.delete(u)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn verify(resp)\n}", "title": "" }, { "docid": "cfd2b61de8c4017eb2d3c9edb8baea34", "score": "0.47103298", "text": "func (c *client) ReplaceOrder(orderID string, req ReplaceOrderRequest) (*Order, error) {\n\tu, err := url.Parse(fmt.Sprintf(\"%s/%s/orders/%s\", c.opts.BaseURL, apiVersion, orderID))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp, err := c.patch(u, req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\torder := &Order{}\n\n\tif err = unmarshal(resp, order); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn order, nil\n}", "title": "" }, { "docid": "2c5e7c21770ac07849a858a7abd666b6", "score": "0.47094032", "text": "func (e SyncFutuStockRequestValidationError) Cause() error { return e.cause }", "title": "" }, { "docid": "8f8f4cfa62fac94a21e75f4ad66a3842", "score": "0.4708754", "text": "func (o *OrderCancelParams) 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.ClOrdID != nil {\n\n\t\t// form param clOrdID\n\t\tvar frClOrdID string\n\t\tif o.ClOrdID != nil {\n\t\t\tfrClOrdID = *o.ClOrdID\n\t\t}\n\t\tfClOrdID := frClOrdID\n\t\tif fClOrdID != \"\" {\n\t\t\tif err := r.SetFormParam(\"clOrdID\", fClOrdID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.OrderID != nil {\n\n\t\t// form param orderID\n\t\tvar frOrderID string\n\t\tif o.OrderID != nil {\n\t\t\tfrOrderID = *o.OrderID\n\t\t}\n\t\tfOrderID := frOrderID\n\t\tif fOrderID != \"\" {\n\t\t\tif err := r.SetFormParam(\"orderID\", fOrderID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Text != nil {\n\n\t\t// form param text\n\t\tvar frText string\n\t\tif o.Text != nil {\n\t\t\tfrText = *o.Text\n\t\t}\n\t\tfText := frText\n\t\tif fText != \"\" {\n\t\t\tif err := r.SetFormParam(\"text\", fText); 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": "4501caf65abfcc47ea723b8ea24b41c3", "score": "0.46997476", "text": "func (cs *CartService) generateRestrictedQtyAdjustments(ctx context.Context, session *web.Session) (QtyAdjustmentResults, error) {\n\tcart, _, err := cs.cartReceiverService.GetCart(ctx, session)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresult := make([]QtyAdjustmentResult, 0)\n\tfor _, delivery := range cart.Deliveries {\n\t\tfor _, item := range delivery.Cartitems {\n\t\t\tproduct, err := cs.productService.Get(ctx, item.MarketplaceCode)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tproduct, err = cs.getSpecificProductType(ctx, product, item.VariantMarketPlaceCode, item.BundleConfig)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\titemContext := ContextWithItemID(ctx, item.ID)\n\t\t\trestrictionResult := cs.restrictionService.RestrictQty(itemContext, session, product, cart, delivery.DeliveryInfo.Code)\n\n\t\t\tif restrictionResult.RemainingDifference >= 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tnewQty := item.Qty + restrictionResult.RemainingDifference\n\n\t\t\tresult = append(result, QtyAdjustmentResult{\n\t\t\t\titem,\n\t\t\t\tdelivery.DeliveryInfo.Code,\n\t\t\t\tnewQty < 1,\n\t\t\t\trestrictionResult,\n\t\t\t\tnewQty,\n\t\t\t\tfalse,\n\t\t\t})\n\t\t}\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "2051af1277ba4b0a0dfdcca27a219ca4", "score": "0.46997228", "text": "func (b *Binance) CancelExistingOrder(ctx context.Context, symbol currency.Pair, orderID int64, origClientOrderID string) (CancelOrderResponse, error) {\n\tvar resp CancelOrderResponse\n\n\tsymbolValue, err := b.FormatSymbol(symbol, asset.Spot)\n\tif err != nil {\n\t\treturn resp, err\n\t}\n\tparams := url.Values{}\n\tparams.Set(\"symbol\", symbolValue)\n\n\tif orderID != 0 {\n\t\tparams.Set(\"orderId\", strconv.FormatInt(orderID, 10))\n\t}\n\n\tif origClientOrderID != \"\" {\n\t\tparams.Set(\"origClientOrderId\", origClientOrderID)\n\t}\n\treturn resp, b.SendAuthHTTPRequest(ctx, exchange.RestSpotSupplementary, http.MethodDelete, orderEndpoint, params, spotOrderRate, &resp)\n}", "title": "" }, { "docid": "665b0f956ccedc99873f5ba0d2d53849", "score": "0.46946424", "text": "func (m *OutboundDealMutation) ResetQuantity() {\n\tm.quantity = nil\n\tm.addquantity = nil\n}", "title": "" }, { "docid": "db275d085d5b5514b663760c5367be52", "score": "0.46856454", "text": "func (q *QuantityPriceDefinition) GetQuantity() int {\n\treturn q.Quantity\n}", "title": "" }, { "docid": "19319440dca22cb0aec74f76359f1cf4", "score": "0.46802586", "text": "func (cs *CartService) CancelOrderWithoutRestore(ctx context.Context, session *web.Session, orderInfos placeorder.PlacedOrderInfos) error {\n\treturn cs.cancelOrder(ctx, session, orderInfos)\n}", "title": "" }, { "docid": "479bd970ca4c1c78fae0e69316e43bbc", "score": "0.4676756", "text": "func (cs *CartService) CancelOrder(ctx context.Context, session *web.Session, orderInfos placeorder.PlacedOrderInfos, cart cartDomain.Cart) (*cartDomain.Cart, error) {\n\terr := cs.cancelOrder(ctx, session, orderInfos)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trestoredCart, err := cs.RestoreCart(ctx, &cart)\n\tif err != nil {\n\t\tcs.logger.Error(fmt.Sprintf(\"couldn't restore cart err: %v\", err))\n\t\treturn nil, err\n\t}\n\n\treturn restoredCart, nil\n}", "title": "" }, { "docid": "9c9adc098169f7ceefa54f0e15066a8b", "score": "0.46632624", "text": "func (a *OrdersApiService) OrderCancelRefund(ctx context.Context, id string, refundId string) ApiOrderCancelRefundRequest {\n\treturn ApiOrderCancelRefundRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tid: id,\n\t\trefundId: refundId,\n\t}\n}", "title": "" }, { "docid": "6af47b87557c946a7f6a8731310e386c", "score": "0.46601015", "text": "func TestCancelETTOrder(t *testing.T) {\n\tTestSetRealOrderDefaults(t)\n\tt.Parallel()\n\t_, err := o.CancelETTOrder(context.Background(), \"888845120785408\")\n\ttestStandardErrorHandling(t, err)\n}", "title": "" }, { "docid": "8ec3c60260c32a89d348ce0bdf228ae8", "score": "0.46590343", "text": "func (i *ItBit) CancelOrder(order *exchange.OrderCancellation) error {\n\treturn i.CancelExistingOrder(order.WalletAddress, order.OrderID)\n}", "title": "" }, { "docid": "96ca72cc81d851bd2e5c41acebf6e094", "score": "0.46518677", "text": "func (m *OutboundDealMutation) OldQuantity(ctx context.Context) (v uint, err error) {\n\tif !m.op.Is(OpUpdateOne) {\n\t\treturn v, fmt.Errorf(\"OldQuantity is allowed only on UpdateOne operations\")\n\t}\n\tif m.id == nil || m.oldValue == nil {\n\t\treturn v, fmt.Errorf(\"OldQuantity 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 OldQuantity: %w\", err)\n\t}\n\treturn oldValue.Quantity, nil\n}", "title": "" }, { "docid": "6e2af0997f697c5baa15251fcdc13391", "score": "0.46495584", "text": "func NewOrderCancelParams() *OrderCancelParams {\n\tvar ()\n\treturn &OrderCancelParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "2a81284a2d9c757650a6135fa53063c0", "score": "0.4630147", "text": "func (m NoRelatedSym) SetRatioQty(value decimal.Decimal, scale int32) {\n\tm.Set(field.NewRatioQty(value, scale))\n}", "title": "" }, { "docid": "4db2516eb512f9a977cc39e0710140ad", "score": "0.46298316", "text": "func (s *singleLimit) Cancel() {\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\ts.quantity++\n}", "title": "" }, { "docid": "c850f90071476a5a82c476a38295567b", "score": "0.4629749", "text": "func (ex *Exchange) HandleCancelOrderRequest() {\n\tex.natsConn.Subscribe(\"order.cancelled\", func(subj, replySubject string, request requests.CancelOrder) {\n\t\tex.logger.WithFields(log.Fields{\n\t\t\t\"Symbol\": request.Symbol,\n\t\t\t\"OrderID\": request.OrderID,\n\t\t}).Infof(\"received an order cancellation request\")\n\n\t\tvar message string\n\t\tvar cancelled bool\n\n\t\torderbook, ok := ex.Symbols[request.Symbol]\n\n\t\tif !ok {\n\t\t\tmessage = fmt.Sprintf(\"no orderbook found for symbol %s\", request.Symbol)\n\t\t} else {\n\t\t\tcancelledOrder := orderbook.Cancel(request.OrderID)\n\t\t\tcancelled = true\n\n\t\t\tif cancelledOrder == nil {\n\t\t\t\tmessage = \"no order found\"\n\t\t\t\tcancelled = false\n\t\t\t}\n\t\t}\n\n\t\tex.logger.Info(orderbook.Report())\n\n\t\tex.natsConn.Publish(replySubject, &requests.CancelOrderResponse{\n\t\t\tRequest: request,\n\t\t\tCancelled: cancelled,\n\t\t\tMessage: message,\n\t\t})\n\t})\n\n\tfor {\n\t\tselect {\n\t\tcase <-ex.quit:\n\t\t\treturn\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "90253f3600c0bc7e5fe0e11392087ea6", "score": "0.46233588", "text": "func (m NoRelatedSym) GetRatioQty() (v decimal.Decimal, err quickfix.MessageRejectError) {\n\tvar f field.RatioQtyField\n\tif err = m.Get(&f); err == nil {\n\t\tv = f.Value()\n\t}\n\treturn\n}", "title": "" }, { "docid": "27be93da7e079e5f5a092d905ccad129", "score": "0.46172965", "text": "func AssertDevstateQuantityValidPostRequestRequired(obj DevstateQuantityValidPostRequest) error {\n\telements := map[string]interface{}{\n\t\t\"quantity\": obj.Quantity,\n\t}\n\tfor name, el := range elements {\n\t\tif isZero := IsZeroValue(el); isZero {\n\t\t\treturn &RequiredError{Field: name}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "72bfb4069a4034c018ce52443327e212", "score": "0.46102202", "text": "func (s *OrdersService) Cancel(parms map[string]string) (*Order, *Response, error) {\n\torder := new(Order)\n\tresp, err := do(s.client, Params{parms: parms, u: \"cancelorder\"}, order)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\treturn order, resp, err\n}", "title": "" } ]
e5a10f178519c97166f6d82ab296ba90
CompactDB reclaims space by pruning the database
[ { "docid": "6ce233aa4b51acd4b9e55ddcdfb31e0c", "score": "0.69229245", "text": "func CompactDB(dayPath, scanID string) {\n\t//compact the scan requests\n\tdbDir := filepath.Join(baseScanDBDirectory, dayPath, scanID, \"request\")\n\topts := badger.DefaultOptions(dbDir)\n\topts.Logger = myLogger\n\topts.NumVersionsToKeep = 0\n\tdb, err := badger.Open(opts)\n\tif err != nil {\n\t\tprintln(err.Error())\n\t\tlog.Fatal(err)\n\t\treturn\n\t}\n\tlsmx, vlogx := db.Size()\n\tfor db.RunValueLogGC(.8) == nil {\n\t\tlsmy, vlogy := db.Size()\n\t\tprintln(\"Compacted DB\", opts.Dir)\n\t\tfmt.Printf(\"Before LSM: %d, VLOG: %d, After LSM: %d, VLOG: %d\\n\", lsmx, vlogx, lsmy, vlogy)\n\t\tlsmx, vlogx = lsmy, vlogy\n\t}\n\tdb.Close()\n}", "title": "" } ]
[ { "docid": "488e3869893d3e2ba413228b55d5a92f", "score": "0.65092754", "text": "func (recorder *recorder) prune() {\n\tif recorder.db == nil {\n\t\treturn\n\t}\n\n\trecorder.doWithIsolatedTransaction(func(tx *sql.Tx) {\n\t\tif nil != recorder.qlog {\n\t\t\trecorder.qlog.prune(tx)\n\t\t}\n\n\t\tif nil != recorder.metrics {\n\t\t\trecorder.metrics.prune(tx)\n\t\t}\n\n\t\t// free memory\n\t\t_, err := tx.Exec(_shrinkPragma)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Could not shrink memory after recorder prune: %s\", err)\n\t\t}\n\t})\n}", "title": "" }, { "docid": "c6897839049db3ae7c5ae4c9481fdb61", "score": "0.6243191", "text": "func (db *LevelDB) GC() error {\n\treturn db.DB.CompactRange(util.Range{})\n}", "title": "" }, { "docid": "2eed6676afa9a4684d1048fc2210eb7f", "score": "0.62419456", "text": "func (b *DB) Compact(ctx context.Context) error {\n\tmax := timestamp{time.Now().Add(-storageTTL)}.UnixDay()\n\tpipe := b.client.Pipeline()\n\tdefer pipe.Close()\n\n\tkeys, cursor, err := b.client.Scan(atomic.LoadUint64(&b.cursor), \"[mt]:*\", 20).Result()\n\tif err != nil {\n\t\treturn err\n\t}\n\tatomic.StoreUint64(&b.cursor, cursor)\n\n\tfor _, key := range keys {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn ctx.Err()\n\t\tdefault:\n\t\t}\n\n\t\tif err := b.expire(key, pipe, max); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t_, err = pipe.Exec()\n\treturn err\n}", "title": "" }, { "docid": "bf19629346ca3b160dfee2c22b24467e", "score": "0.6217082", "text": "func (db *RamDB) GC() error {\n\treturn nil\n}", "title": "" }, { "docid": "4816e566fc2a1d2d3f06330701df5dab", "score": "0.6059852", "text": "func Clear() {\n if err := db.Update(func(tx *bolt.Tx) error{\n\t\tb1 := bucket([]byte(\"space\"), tx)\n\t\tb1.ForEach(func(k, v []byte) error {\n\t\t\tb1.Delete(k)\n\t\t\treturn nil\n\t\t})\n \n\t\tb2 := bucket([]byte(\"pre\"), tx)\n\t\tb2.ForEach(func(k, v []byte) error {\n\t\t\tb2.Delete(k)\n\t\t\treturn nil\n\t\t})\n\n\t\tb3 := bucket([]byte(\"files\"), tx)\n\t\tb3.ForEach(func(k, v []byte) error {\n\t\t\tb3.Delete(k)\n\t\t\treturn nil\n\t\t})\n\t\treturn nil\n }); err != nil {\n\t\tlog.Fatal(err)\n }\n}", "title": "" }, { "docid": "2ded8f012ef93bce92213440fa0f3e66", "score": "0.5887202", "text": "func speedtest1_shrink_memory(tls *libc.TLS) { /* speedtest1.c:458:6: */\n\tif g.bMemShrink != 0 {\n\t\tsqlite3.Xsqlite3_db_release_memory(tls, g.db)\n\t}\n}", "title": "" }, { "docid": "212f321abd821db53ad3aac79c340fbf", "score": "0.5863219", "text": "func (g *Git) Compact(ctx context.Context) error {\n\treturn g.Cmd(ctx, \"gitGC\", \"gc\", \"--aggressive\")\n}", "title": "" }, { "docid": "a454370205356b6b6163f655c760080d", "score": "0.58623713", "text": "func (s *SerieslyDB) Compact() error {\n\tu := s.URL().String() + \"/_compact\"\n\treq, err := http.NewRequest(\"POST\", u, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tres, err := s.s.client.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tres.Body.Close()\n\tif res.StatusCode != 200 {\n\t\treturn httputil.HTTPErrorf(res, \"error compacting: %S -- %B\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1c4f9f388f6aefbab74d59972b15d285", "score": "0.5858221", "text": "func (db *LevelDB) Compact(start []byte, limit []byte) error {\n\treturn db.db.CompactRange(util.Range{Start: start, Limit: limit})\n}", "title": "" }, { "docid": "271d69928b31338f90cca8bd2ca19762", "score": "0.5844034", "text": "func CompactDB(fh *FileHashes) error {\n\tbackup := fh.dbPath + \".\" + strconv.FormatInt(time.Now().Unix(), 16)\n\tlog.Infof(\"Compacting db file %s with backup in %s\\n\", fh.dbPath, backup)\n\tos.Rename(fh.dbPath, backup)\n\tif err := writeAllRecordsToDB(fh); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "763a7e1203b8abf9b6a45b36d456e7a8", "score": "0.57386374", "text": "func (s *Store) clean() {\n\tnow := time.Now().Unix()\n\t_, accessErr := s.db.Exec(fmt.Sprintf(\"DELETE FROM %s WHERE (revoked='1')\", s.accessTable))\n\t_, refreshErr := s.db.Exec(fmt.Sprintf(\"DELETE FROM %s WHERE revoked='1'\", s.refreshTable), now)\n\tif accessErr != nil {\n\t\ts.errorf(accessErr.Error())\n\t}\n\tif refreshErr != nil {\n\t\ts.errorf(refreshErr.Error())\n\t}\n}", "title": "" }, { "docid": "0ec4068f8e69c9fa11262dd20b7a7408", "score": "0.56139845", "text": "func (s *Store) CollectGarbage() (err error) {\n\tconst maxTrashSize = 100\n\tmaxRounds := 10 // arbitrary number, needs to be calculated\n\n\t// Run a few gc rounds.\n\tfor roundCount := 0; roundCount < maxRounds; roundCount++ {\n\t\tvar garbageCount int\n\t\t// New batch for a new cg round.\n\t\ttrash := new(leveldb.Batch)\n\t\t// Iterate through all index items and break when needed.\n\t\terr = s.gcIndex.Iterate(func(item shed2.Item) (stop bool, err error) {\n\t\t\t// Remove the chunk.\n\t\t\terr = s.retrievalIndex.DeleteInBatch(trash, item)\n\t\t\tif err != nil {\n\t\t\t\treturn false, err\n\t\t\t}\n\t\t\t// Remove the element in gc index.\n\t\t\terr = s.gcIndex.DeleteInBatch(trash, item)\n\t\t\tif err != nil {\n\t\t\t\treturn false, err\n\t\t\t}\n\t\t\t// Remove the relation in access index.\n\t\t\terr = s.accessIndex.DeleteInBatch(trash, item)\n\t\t\tif err != nil {\n\t\t\t\treturn false, err\n\t\t\t}\n\t\t\tgarbageCount++\n\t\t\tif garbageCount >= maxTrashSize {\n\t\t\t\treturn true, nil\n\t\t\t}\n\t\t\treturn false, nil\n\t\t}, nil)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif garbageCount == 0 {\n\t\t\treturn nil\n\t\t}\n\t\terr = s.db.WriteBatch(trash)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9b771f9dc94fc797aa603d4a50155365", "score": "0.558891", "text": "func (pCache *PCache) MakeClean(pgHdr *PgHdr){\n if (pgHdr.flag & PGHDR_DIRTY) != 0 {\n pCache.ManageDirtyList(pgHdr, PCACHE_DIRTYLIST_REMOVE)\n pgHdr.flag &= ^(PGHDR_DIRTY)\n pgHdr.flag |= PGHDR_CLEAN\n }\n}", "title": "" }, { "docid": "57af508694ddbc454aae84b9b068c972", "score": "0.5557952", "text": "func (u *unApprovedTransactions) CleanUnapprovedCache() error {\n\n\tu.Logger.Trace.Println(\"Clean Unapproved Transactions cache: Prepare\")\n\n\tutdb, err := u.DB.GetUnapprovedTransactionsObject()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn utdb.TruncateDB()\n\n}", "title": "" }, { "docid": "87a7b85e04887d63dca598443921f3db", "score": "0.55574924", "text": "func (p *NodbProvider) GC() {}", "title": "" }, { "docid": "8fb904a4bd425297c976633828fbf0d6", "score": "0.5549932", "text": "func (s *Store) Compact(context.Context) error {\n\treturn nil\n}", "title": "" }, { "docid": "d8855613524deee8321f86963d085845", "score": "0.55322826", "text": "func CleanDB(db *sqlx.DB) {\n\tdb.MustExec(\"DELETE FROM match\")\n\tdb.MustExec(\"DELETE FROM request\")\n\tdb.MustExec(\"DELETE FROM offer\")\n\tdb.MustExec(\"DELETE FROM category\")\n\tdb.MustExec(\"DELETE FROM userdata\")\n}", "title": "" }, { "docid": "008f108cd9c8a1022f9c67aa3042134b", "score": "0.5530829", "text": "func (r *ReadHeavyBufferedContentStore) performMaintenance() {\n\t// Lock the cache for writing\n\tr.Lock()\n\tdefer r.Unlock()\n\n\tdefer func() {\n\t\t// Make sure maintenance completes at the end of this\n\t\tr.maintenanceScheduled = false\n\t}()\n\n\t// If we've completed maintenance already, do nothing\n\tif !r.maintenanceScheduled {\n\t\treturn\n\t}\n\n\t// If we haven't yet reached the stretch size, there's no need\n\t// to do any maintenance\n\tif r.storedSize < r.stretchSize {\n\t\treturn\n\t}\n\n\t// Sort the vector of last access times (earliest first)\n\tvec := make(cacheRecordSortedByAge, len(r.cache))\n\tcont := 0\n\tfor key := range r.cache {\n\t\tvec[cont] = r.cache[key]\n\t}\n\tsort.Sort(vec)\n\n\t// Remove the items until we're below the stretch size\n\tfor _, item := range vec {\n\t\tdelete(r.cache, item.identifier)\n\t\tr.storedSize -= int64(len(item.content))\n\t\tif r.storedSize < r.stretchSize {\n\t\t\tbreak\n\t\t}\n\t}\n\t// Remove the vector of items we've examined\n\tvec = make(cacheRecordSortedByAge, 0)\n\n\t// Force a GC to clean up memory\n\truntime.GC()\n}", "title": "" }, { "docid": "3e9b482a992902d3f1689f1282e6db16", "score": "0.55019015", "text": "func cleaner(s *Storage) {\n\tfor {\n\t\ttime.Sleep(gcTimeout)\n\t\ts.db.Lock()\n\t\tcount := 0\n\n\t\tfor name, item := range s.db.data {\n\t\t\tif item.Updated.Before(time.Now().Add(-validTime)) {\n\t\t\t\tdelete(s.db.data, name)\n\t\t\t\tcount++\n\t\t\t}\n\t\t}\n\n\t\tif count > 0 {\n\t\t\tlog.Infof(\"gc removed %d buckets\", count)\n\t\t}\n\n\t\ts.db.Unlock()\n\t}\n}", "title": "" }, { "docid": "5cc3311e896c17f10371c7b07fae5b9e", "score": "0.54949635", "text": "func (f *Fibber) Clear() {\n\tf.mutex.Lock()\n\tdefer f.mutex.Unlock()\n\n\tf.DB.DropTable()\n\tf.DB.InitSchema()\n\n\tf.cache = make(map[uint64]uint64)\n f.cache[0] = 0\n f.cache[1] = 1\n\tf.maxN = 1\n\tf.maxFib = 1\n}", "title": "" }, { "docid": "d6f97114bd32439c571ac76d3172169d", "score": "0.54856026", "text": "func leakFast() {\n\trootDir := \"testbadgerdb\"\n\tfor {\n\t\tdb, err := openDB(rootDir)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tif err := db.View(func(txn *badger.Txn) error {\n\t\t\topts := badger.DefaultIteratorOptions\n\t\t\tit := txn.NewIterator(opts)\n\t\t\tdefer it.Close()\n\t\t\tprefix := []byte{4}\n\t\t\tfor it.Seek(prefix); it.ValidForPrefix(prefix); it.Next() {\n\t\t\t\titem := it.Item()\n\t\t\t\t_, err := item.Value()\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\treturn nil\n\t\t}); err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tif err := db.Close(); err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\truntime.GC()\n\t\tpprof.Lookup(\"goroutine\").WriteTo(os.Stdout, 1)\n\t}\n}", "title": "" }, { "docid": "e4c218920156f607ed4737d134eb9405", "score": "0.54602194", "text": "func (ldb *Null) GC() error {\n\treturn nil\n}", "title": "" }, { "docid": "e03d20092998cf3675f3f7ab043cc8e8", "score": "0.5433114", "text": "func ClearDB(db *sqlx.DB) error {\n\t// get all tables to delete\n\ttables := []string{\n\t\ttable.AppTable.Name(),\n\t\ttable.ArchivedAppTable.Name(),\n\t\tstring(table.HookTable),\n\t\tstring(table.ContentTable),\n\t\ttable.ConfigItemTable.Name(),\n\t\ttable.CommitsTable.Name(),\n\t\ttable.ReleaseTable.Name(),\n\t\ttable.ReleasedConfigItemTable.Name(),\n\t\ttable.StrategyTable.Name(),\n\t\ttable.EventTable.Name(),\n\t\ttable.AuditTable.Name(),\n\t\ttable.ResourceLockTable.Name(),\n\t}\n\n\tfor _, t := range tables {\n\t\tif _, err := db.Exec(\"truncate table \" + t); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif _, err := db.Exec(\"update \" + table.IDGeneratorTable.Name() +\n\t\t\" t1 set t1.max_id = 0 where resource != 'events'\"); err != nil {\n\t\treturn err\n\t}\n\tif _, err := db.Exec(\"update \" + table.IDGeneratorTable.Name() +\n\t\t\" t1 set t1.max_id = 500 where resource = 'events'\"); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0ada4f4b2efe56c46158acdb88af5801", "score": "0.5411328", "text": "func DatabaseRebuild(session *rdb.Session) {\n\trdb.DB(Conf.Database.Name).TableCreate(Conf.Tables.DocumentTable).Exec(session)\n\trdb.DB(Conf.Database.Name).TableCreate(Conf.Tables.IndexTable).Exec(session)\n\trdb.DB(Conf.Database.Name).Table(Conf.Tables.IndexTable).IndexCreate(\"word\").Exec(session)\n\trdb.DB(Conf.Database.Name).Table(Conf.Tables.DocumentTable).Delete(rdb.DeleteOpts{\n\t\tDurability: \"soft\",\n\t\tReturnChanges: false,\n\t}).Exec(session)\n\trdb.DB(Conf.Database.Name).Table(Conf.Tables.IndexTable).Delete(rdb.DeleteOpts{\n\t\tDurability: \"soft\",\n\t\tReturnChanges: false,\n\t}).Exec(session)\n}", "title": "" }, { "docid": "f3b67178ab038877d08355ab0802003a", "score": "0.54094833", "text": "func (mq *memQuota) reapDedup() {\n\tt := mq.oldDedup\n\tmq.oldDedup = mq.recentDedup\n\tmq.recentDedup = t\n\n\tmq.logger.Infof(\"Running repear to reclaim %d old deduplication entries\", len(t))\n\n\t// TODO: why isn't there a O(1) way to clear a map to the empty state?!\n\tfor k := range t {\n\t\tdelete(t, k)\n\t}\n}", "title": "" }, { "docid": "1047e982673a13f3bbb8b08e1f0861f9", "score": "0.5402311", "text": "func (recorder *recorder) flush() {\n\tif recorder.db == nil {\n\t\treturn\n\t}\n\n\tif recorder.con != nil {\n\t\trecorder.con.Close()\n\t\trecorder.con = nil\n\t}\n\n\trecorder.doWithIsolatedTransaction(func(tx *sql.Tx) {\n\t\tif nil != recorder.qlog {\n\t\t\trecorder.qlog.flush(tx)\n\t\t}\n\n\t\tif nil != recorder.metrics {\n\t\t\trecorder.metrics.flush(tx)\n\t\t}\n\n\t\t// empty buffer table\n\t\t_, err := tx.Exec(_flushQuery)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Could not delete from buffer: %s\", err)\n\t\t}\n\n\t\t// free memory\n\t\t_, err = tx.Exec(_shrinkPragma)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Could not shrink memory after recorder flush: %s\", err)\n\t\t}\n\t})\n}", "title": "" }, { "docid": "4d6126b30a046ef4a1ba5d087a6bb7ed", "score": "0.53907084", "text": "func Compact(dst, src *DB, txMaxSize int64) error {\n\t// commit regularly, or we'll run out of memory for large datasets if using one transaction.\n\tvar size int64\n\ttx, err := dst.Begin(true)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif tempErr := tx.Rollback(); tempErr != nil {\n\t\t\terr = tempErr\n\t\t}\n\t}()\n\n\tif err := walk(src, func(keys [][]byte, k, v []byte, seq uint64) error {\n\t\t// On each key/value, check if we have exceeded tx size.\n\t\tsz := int64(len(k) + len(v))\n\t\tif size+sz > txMaxSize && txMaxSize != 0 {\n\t\t\t// Commit previous transaction.\n\t\t\tif err := tx.Commit(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t// Start new transaction.\n\t\t\ttx, err = dst.Begin(true)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tsize = 0\n\t\t}\n\t\tsize += sz\n\n\t\t// Create bucket on the root transaction if this is the first level.\n\t\tnk := len(keys)\n\t\tif nk == 0 {\n\t\t\tbkt, err := tx.CreateBucket(k)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err := bkt.SetSequence(seq); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\n\t\t// Create buckets on subsequent levels, if necessary.\n\t\tb := tx.Bucket(keys[0])\n\t\tif nk > 1 {\n\t\t\tfor _, k := range keys[1:] {\n\t\t\t\tb = b.Bucket(k)\n\t\t\t}\n\t\t}\n\n\t\t// Fill the entire page for best compaction.\n\t\tb.FillPercent = 1.0\n\n\t\t// If there is no value then this is a bucket call.\n\t\tif v == nil {\n\t\t\tbkt, err := b.CreateBucket(k)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err := bkt.SetSequence(seq); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\n\t\t// Otherwise treat it as a key/value pair.\n\t\treturn b.Put(k, v)\n\t}); err != nil {\n\t\treturn err\n\t}\n\terr = tx.Commit()\n\n\treturn err\n}", "title": "" }, { "docid": "d6013c71174d6f01d94e16d9b4ae3317", "score": "0.5385739", "text": "func (v *Volume) Compact(preallocate int64, compactionBytePerSecond int64) error {\n\n\tif v.MemoryMapMaxSizeMb != 0 { //it makes no sense to compact in memory\n\t\treturn nil\n\t}\n\tglog.V(3).Infof(\"Compacting volume %d ...\", v.Id)\n\t//no need to lock for copy on write\n\t//v.accessLock.Lock()\n\t//defer v.accessLock.Unlock()\n\t//glog.V(3).Infof(\"Got Compaction lock...\")\n\tv.isCompacting = true\n\tdefer func() {\n\t\tv.isCompacting = false\n\t}()\n\n\tv.lastCompactIndexOffset = v.IndexFileSize()\n\tv.lastCompactRevision = v.SuperBlock.CompactionRevision\n\tglog.V(3).Infof(\"creating copies for volume %d ,last offset %d...\", v.Id, v.lastCompactIndexOffset)\n\tif err := v.DataBackend.Sync(); err != nil {\n\t\tglog.V(0).Infof(\"compact failed to sync volume %d\", v.Id)\n\t}\n\tif err := v.nm.Sync(); err != nil {\n\t\tglog.V(0).Infof(\"compact failed to sync volume idx %d\", v.Id)\n\t}\n\treturn v.copyDataAndGenerateIndexFile(v.FileName(\".cpd\"), v.FileName(\".cpx\"), preallocate, compactionBytePerSecond)\n}", "title": "" }, { "docid": "ab5e420a85e493dd70715318e3287745", "score": "0.53700167", "text": "func (db ElectionDatabase) ResetDatabase() error {\n _, err := db.Session.DB(config.MongoDbName).C(\"candidates\").RemoveAll(nil)\n if err != nil {\n return err\n }\n \n _, err = db.Session.DB(config.MongoDbName).C(\"voters\").RemoveAll(nil)\n if err != nil {\n return err\n }\n \n _, err = db.Session.DB(config.MongoDbName).C(\"votes\").RemoveAll(nil)\n if err != nil {\n return err\n }\n \n _, err = db.Session.DB(config.MongoDbName).C(\"posts\").RemoveAll(nil)\n if err != nil {\n return err\n }\n \n _, err = db.Session.DB(config.MongoDbName).C(\"ceo\").RemoveAll(nil)\n return err\n}", "title": "" }, { "docid": "8b40c03f39255891e133e9adedc1f0b5", "score": "0.53467774", "text": "func ClearDB() {\n\tfor true {\n\t\ttime.Sleep(time.Duration(Conf.BanIP.UnbanCheck * 1000) * time.Millisecond)\n\t\tlogging(\"\", \"- ClearDB - I am a scedueled go routine to delete old entries in the ban table\")\n\t\tbanTimes, err := db.Query(\"SELECT ip FROM ban WHERE count >= $1 AND bantime < $2;\", Conf.BanIP.MaxTry, time.Now().Unix())\n\t\tif err != nil {\n\t\t\tlogging(\"\", \"ClearDB - \" + err.Error())\n\t\t\tpanic(err)\n\t\t}\n\t\tUnbanIP(banTimes)\n\t\tbanTimes, err = db.Query(\"SELECT ip FROM ban WHERE count < $1 AND bantime < $2;\", Conf.BanIP.MaxTry, time.Now().Unix() - Conf.BanIP.LogTime)\n\t\tif err != nil {\n\t\t\tlogging(\"\", \"ClearDB - \" + err.Error())\n\t\t\tpanic(err)\n\t\t}\n\t\tUnbanIP(banTimes)\n\t}\n}", "title": "" }, { "docid": "78a41169dcd40feede3816e702abf192", "score": "0.53047144", "text": "func (cache *FileCache) vacuum() {\n\tif cache.Every < 1 {\n\t\treturn\n\t}\n\n\tcache.wait.Add(1)\n\tfor {\n\t\tselect {\n\t\tcase _ = <-cache.shutdown:\n\t\t\tcache.wait.Done()\n\t\t\treturn\n\t\tcase <-time.After(cache.dur):\n\t\t\tif cache.isCacheNull() {\n\t\t\t\tcache.wait.Done()\n\t\t\t\treturn\n\t\t\t}\n\t\t\tfor name, _ := range cache.items {\n\t\t\t\tif cache.itemExpired(name) {\n\t\t\t\t\tcache.deleteItem(name)\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor size := cache.Size(); size > cache.MaxItems; size = cache.Size() {\n\t\t\t\tcache.expireOldest(true)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "da5b22c41c214b5af17c93688f942297", "score": "0.52904415", "text": "func Flush() error {\r\n\treturn db.DropAll()\r\n}", "title": "" }, { "docid": "b7a92b83466be55fb5e99869e48615b5", "score": "0.52863175", "text": "func (st *SqliteStoreWinner) Clean() error {\n\terrWinner := st.cleanTable()\n\terrCreate := st.createTables()\n\tif errWinner != nil {\n\t\treturn errWinner\n\t}\n\tif errCreate != nil {\n\t\treturn errCreate\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fee929cfe92641ffbb68d47c6ff50d5f", "score": "0.5270491", "text": "func (b *revdbBatch) shrink() {\n\tskip := make([]bool, len(b.op))\n\tputOps := make(map[string][]int)\n\tchanged := false\n\tfor i, op := range b.op {\n\t\tsk := string(op.Key)\n\t\tskip[i] = false\n\t\tif op.Del {\n\t\t\tif rPuts := putOps[sk]; len(rPuts) > 0 {\n\t\t\t\tfor _, j := range rPuts {\n\t\t\t\t\tskip[j] = true\n\t\t\t\t}\n\t\t\t\tputOps[sk] = rPuts[:0]\n\t\t\t\tchanged = true\n\t\t\t}\n\t\t} else {\n\t\t\tputOps[sk] = append(putOps[sk], i)\n\t\t}\n\t}\n\tif changed {\n\t\tnewOps := make([]writeOp, 0, len(b.op))\n\t\tfor i, op := range b.op {\n\t\t\tif skip[i] {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tnewOps = append(newOps, op)\n\t\t}\n\t\tb.op = newOps\n\t}\n}", "title": "" }, { "docid": "1d646a98c2b7c2bd60efe7512ad92dee", "score": "0.5265751", "text": "func TestTx_DeallocateTree(t *testing.T) {\n\tdb := MustOpenDB(t)\n\tdefer MustCloseDB(t, db)\n\ttx := MustBegin(t, db, true)\n\tdefer tx.Rollback()\n\tvar err error\n\n\t// Create bitmap & add value.\n\tif err = tx.CreateBitmap(\"x\"); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tconst N = 315\n\tslots := make([]uint64, N)\n\tfor i := range slots {\n\t\tslots[i] = uint64(i) << 20\n\t}\n\tif _, err = tx.Add(\"x\", slots...); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif err = tx.Check(); err != nil {\n\t\tt.Fatalf(\"check: %v\", err)\n\t}\n\tif err = tx.DeleteBitmap(\"x\"); err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif ok, err := tx.Contains(\"x\", 0); err != nil {\n\t\tt.Fatal(err)\n\t} else if ok {\n\t\tt.Fatal(\"expected no value in recreated bitmap\")\n\t}\n\tif err = tx.Check(); err != nil {\n\t\tt.Fatalf(\"check: %v\", err)\n\t}\n}", "title": "" }, { "docid": "a5c6ef7a9077d2e361ec38da2b1e4b5b", "score": "0.52432245", "text": "func (pool *DBPool) resize() {\n\n\tif pool.resizeFlag || pool.MinSize <= pool.CurSize() &&\n\t\tpool.KeepSize <= pool.FreeSize() {\n\t\treturn\n\t}\n\n\tpool.resizeFlag = true\n\n\tgo pool._resize()\n}", "title": "" }, { "docid": "41eb522da0111675984c90a3a7afe2c3", "score": "0.523618", "text": "func (d *DB) Clear() error {\n return d.db.Update(func(tx *bbolt.Tx) error {\n return tx.DeleteBucket(tableURLs)\n })\n}", "title": "" }, { "docid": "83f298c50780bc4a8dded3eae5ea8869", "score": "0.5222695", "text": "func (mdb *MediaDB) compact() {\n\tnewlist := make([]MasterFile, 0, len(mdb.MasterFiles))\n\tfor _, mf := range mdb.MasterFiles {\n\t\tif mf.Valid {\n\t\t\tnewlist = append(newlist, mf)\n\t\t}\n\t}\n\tmdb.MasterFiles = newlist\n\treturn\n}", "title": "" }, { "docid": "73df7ece22f89f5ac6f9b65a36ad1f1e", "score": "0.5209752", "text": "func (c *tableCacheShard) removeDB(dbOpts *tableCacheOpts) {\n\tvar fileNums []base.FileNum\n\n\tc.mu.RLock()\n\t// Collect the fileNums which need to be cleaned.\n\tvar firstNode *tableCacheNode\n\tnode := c.mu.handHot\n\tfor node != firstNode {\n\t\tif firstNode == nil {\n\t\t\tfirstNode = node\n\t\t}\n\n\t\tif node.cacheID == dbOpts.cacheID {\n\t\t\tfileNums = append(fileNums, node.meta.FileNum)\n\t\t}\n\t\tnode = node.next()\n\t}\n\tc.mu.RUnlock()\n\n\t// Evict all the nodes associated with the DB.\n\t// This should synchronously close all the files\n\t// associated with the DB.\n\tfor _, fNum := range fileNums {\n\t\tc.evict(fNum, dbOpts, true)\n\t}\n}", "title": "" }, { "docid": "a3d46e653ab6f860a2261bb9e9578716", "score": "0.51984066", "text": "func (e *extendedSQL) cleanup() error {\n\ttx := e.sql.db.MustBegin()\n\t_, err := e.sql.db.Exec(\"TRUNCATE TABLE prefixes\")\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn tx.Commit()\n}", "title": "" }, { "docid": "ac5098a04c143a9ba5b34af58ab5ccb4", "score": "0.51951057", "text": "func CleanupAll(db *gorm.DB) error {\n\tlimiters := []Limiter{}\n\terr := db.Find(&limiters).Error\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, x := range limiters {\n\t\tx.db = db\n\t\terr = x.Cleanup()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "60e3a2c2536041916c25b83e2425d30a", "score": "0.5188541", "text": "func (c *MockConn) ClearDB() error { return c.FClearDB() }", "title": "" }, { "docid": "a207bea8f9a7efc7aa45847ad69d058a", "score": "0.5183206", "text": "func (cache *StructCache) trim() {\n\tfor cache.lruList.Len() >= cache.limit && cache.lruList.Len() > 0 {\n\t\tel := cache.lruList.Back()\n\t\tif el != nil {\n\t\t\tif entry, ok := el.Value.(*Entry); ok {\n\t\t\t\tdelete(cache.entries, entry.Key.ID())\n\t\t\t\tcache.lruList.Remove(el)\n\t\t\t\tstructcachemon.ItemNumber.WithLabelValues(entry.Key.Set).Dec()\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5a72fd663c33bae114c2215f581bdbc9", "score": "0.51823133", "text": "func (sql *sql) cleanup() error {\n\ttx := sql.db.MustBegin()\n\t_, err := sql.db.Exec(\"TRUNCATE TABLE prefixes\")\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn tx.Commit()\n}", "title": "" }, { "docid": "5701fc319ef9e1a948d7465ca9936d3e", "score": "0.5179096", "text": "func cleanUpCache() {\n\topCache.Flush()\n}", "title": "" }, { "docid": "9af063f4fdffb20b1e905516e0950bb2", "score": "0.51607335", "text": "func Clean() error {\n\treturn boltdb.Update(func(tx *bolt.Tx) error {\n\t\tif err := tx.DeleteBucket([]byte(\"tasks\")); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif _, err := tx.CreateBucketIfNotExists([]byte(\"tasks\")); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "228d3a42dfb4989147e8b054ecac9f53", "score": "0.5157099", "text": "func Nuke() {\n\tdb, err := db.Open()\n\tif err != nil {\n\t\tfmt.Print(err)\n\t}\n\tdefer db.Close()\n\t// remove all the foreign key constraints before dropping\n\tremoveForeignKeys(db)\n\t// drop it like it's hot\n\tdropAllTables(db)\n}", "title": "" }, { "docid": "c6ade921c3cac4ea44237a2b5745ce71", "score": "0.515471", "text": "func garbageCollection(db *badger.DB) {\n\tticker := time.NewTicker(gcInterval)\n\tdefer ticker.Stop()\n\tfor range ticker.C {\n\t\tlog.Debug().Msgf(\"BadgerDB: triggering garbage collection...\")\n\t\tfor err := db.RunValueLogGC(gcDiscardRatio); err == nil; err = db.RunValueLogGC(gcDiscardRatio) {\n\t\t\tlog.Debug().Msgf(\"BadgerDB: garbage collected!\")\n\t\t}\n\t\tlog.Debug().Msgf(\"BadgerDB: garbage collection done\")\n\t}\n}", "title": "" }, { "docid": "ac3cf39d4a213ba79a0ea0b92a54f7ef", "score": "0.51522326", "text": "func (q *Queue) clean() {\n\tq.db = make([]interface{}, q.sizeBlock)\n\tq.head = q.sizeBlock / 2\n\tq.tail = q.sizeBlock / 2\n\tq.sizeQueue = q.sizeBlock\n}", "title": "" }, { "docid": "d30e06818a298e6303330484ce4b1367", "score": "0.51504546", "text": "func (c *Cassandra) Cleanup() {\n\tif err := c.session.Query(\"DROP TABLE dbbench.dbbench_simple\").Exec(); err != nil {\n\t\tlog.Printf(\"failed to drop table: %v\\n\", err)\n\t}\n\tif err := c.session.Query(\"DROP KEYSPACE dbbench\").Exec(); err != nil {\n\t\tlog.Printf(\"failed to drop database: %v\\n\", err)\n\t}\n\tc.session.Close()\n}", "title": "" }, { "docid": "8c4a764e42f4128ea084e1aeeb2d02ca", "score": "0.5149489", "text": "func Close(db *sql.DB) {\n\tif _, err := db.Exec(\"PRAGMA wal_checkpoint(TRUNCATE)\"); err != nil {\n\t\tlog.Printf(\"error executing WAL checkpoint: %v\\n\", err)\n\t}\n\tif err := db.Close(); err != nil {\n\t\tlog.Printf(\"error closing database: %v\\n\", err)\n\t}\n}", "title": "" }, { "docid": "d60877156e803f2894e6c6a9d63a4d19", "score": "0.5147028", "text": "func (sp *ScyllaApplicationProvider) Clear() derrors.Error {\n\n\tsp.Lock()\n\tdefer sp.Unlock()\n\n\treturn sp.UnsafeClear([]string{ApplicationDescriptorTable, ApplicationInstanceTable, ParametrizedDescriptorTable, InstanceParamTable,\n\t\tAppEndpointsTable, AppZtNetworkTable})\n\n\terr := sp.Session.Query(\"TRUNCATE TABLE appztnetworkmembers\").Exec()\n\tif err != nil {\n\t\tlog.Error().Str(\"trace\", conversions.ToDerror(err).DebugReport()).Msg(\"failed to truncate the zt network members table\")\n\t\treturn derrors.AsError(err, \"cannot truncate AppZtNetworkMembers table\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f6bb01fc3b51ca402824094e0cdd964b", "score": "0.5141989", "text": "func (e *EncryptedRaftLogger) GC(index uint64, term uint64, keepOldSnapshots uint64) error {\n\t// Delete any older snapshots\n\tcurSnapshot := fmt.Sprintf(\"%016x-%016x%s\", term, index, \".snap\")\n\n\tsnapshots, err := ListSnapshots(e.snapDir())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Ignore any snapshots that are older than the current snapshot.\n\t// Delete the others. Rather than doing lexical comparisons, we look\n\t// at what exists before/after the current snapshot in the slice.\n\t// This means that if the current snapshot doesn't appear in the\n\t// directory for some strange reason, we won't delete anything, which\n\t// is the safe behavior.\n\tcurSnapshotIdx := -1\n\tvar (\n\t\tremoveErr error\n\t\toldestSnapshot string\n\t)\n\n\tfor i, snapFile := range snapshots {\n\t\tif curSnapshotIdx >= 0 && i > curSnapshotIdx {\n\t\t\tif uint64(i-curSnapshotIdx) > keepOldSnapshots {\n\t\t\t\terr := os.Remove(filepath.Join(e.snapDir(), snapFile))\n\t\t\t\tif err != nil && removeErr == nil {\n\t\t\t\t\tremoveErr = err\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t} else if snapFile == curSnapshot {\n\t\t\tcurSnapshotIdx = i\n\t\t}\n\t\toldestSnapshot = snapFile\n\t}\n\n\tif removeErr != nil {\n\t\treturn removeErr\n\t}\n\n\t// Remove any WAL files that only contain data from before the oldest\n\t// remaining snapshot.\n\n\tif oldestSnapshot == \"\" {\n\t\treturn nil\n\t}\n\n\t// Parse index out of oldest snapshot's filename\n\tvar snapTerm, snapIndex uint64\n\t_, err = fmt.Sscanf(oldestSnapshot, \"%016x-%016x.snap\", &snapTerm, &snapIndex)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"malformed snapshot filename %s\", oldestSnapshot)\n\t}\n\n\twals, err := ListWALs(e.walDir())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfound := false\n\tdeleteUntil := -1\n\n\tfor i, walName := range wals {\n\t\tvar walSeq, walIndex uint64\n\t\t_, err = fmt.Sscanf(walName, \"%016x-%016x.wal\", &walSeq, &walIndex)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"could not parse WAL name %s\", walName)\n\t\t}\n\n\t\tif walIndex >= snapIndex {\n\t\t\tdeleteUntil = i - 1\n\t\t\tfound = true\n\t\t\tbreak\n\t\t}\n\t}\n\n\t// If all WAL files started with indices below the oldest snapshot's\n\t// index, we can delete all but the newest WAL file.\n\tif !found && len(wals) != 0 {\n\t\tdeleteUntil = len(wals) - 1\n\t}\n\n\tfor i := 0; i < deleteUntil; i++ {\n\t\twalPath := filepath.Join(e.walDir(), wals[i])\n\t\tl, err := fileutil.TryLockFile(walPath, os.O_WRONLY, fileutil.PrivateFileMode)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"could not lock old WAL file %s for removal\", wals[i])\n\t\t}\n\t\terr = os.Remove(walPath)\n\t\tl.Close()\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"error removing old WAL file %s\", wals[i])\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f56aa7902665d2b7349c4dd30e6e17af", "score": "0.5132653", "text": "func sqlite3_quota_shutdown(tls *libc.TLS) int32 { /* test_quota.c:798:5: */\n\tvar pGroup uintptr\n\tif gQuota.FisInitialized == 0 {\n\t\treturn SQLITE_MISUSE\n\t}\n\tfor pGroup = gQuota.FpGroup; pGroup != 0; pGroup = (*quotaGroup)(unsafe.Pointer(pGroup)).FpNext {\n\t\tif quotaGroupOpenFileCount(tls, pGroup) > 0 {\n\t\t\treturn SQLITE_MISUSE\n\t\t}\n\t}\n\tfor gQuota.FpGroup != 0 {\n\t\tpGroup = gQuota.FpGroup\n\t\tgQuota.FpGroup = (*quotaGroup)(unsafe.Pointer(pGroup)).FpNext\n\t\t(*quotaGroup)(unsafe.Pointer(pGroup)).FiLimit = int64(0)\n\n\t\tquotaGroupDeref(tls, pGroup)\n\t}\n\tgQuota.FisInitialized = 0\n\tsqlite3.Xsqlite3_mutex_free(tls, gQuota.FpMutex)\n\tsqlite3.Xsqlite3_vfs_unregister(tls, (uintptr(unsafe.Pointer(&gQuota)) + 8 /* &.sThisVfs */))\n\tlibc.Xmemset(tls, uintptr(unsafe.Pointer(&gQuota)), 0, uint64(unsafe.Sizeof(gQuota)))\n\treturn SQLITE_OK\n}", "title": "" }, { "docid": "b0ddc155520af76c4692556865a88106", "score": "0.51320875", "text": "func TestBucket_Delete_FreelistOverflow(t *testing.T) {\n\tif testing.Short() {\n\t\tt.Skip(\"skipping test in short mode.\")\n\t}\n\n\tdb := btesting.MustCreateDB(t)\n\n\tk := make([]byte, 16)\n\t// The bigger the pages - the more values we need to write.\n\tfor i := uint64(0); i < 2*uint64(db.Info().PageSize); i++ {\n\t\tif err := db.Update(func(tx *bolt.Tx) error {\n\t\t\tb, err := tx.CreateBucketIfNotExists([]byte(\"0\"))\n\t\t\tif err != nil {\n\t\t\t\tt.Fatalf(\"bucket error: %s\", err)\n\t\t\t}\n\n\t\t\tfor j := uint64(0); j < 1000; j++ {\n\t\t\t\tbinary.BigEndian.PutUint64(k[:8], i)\n\t\t\t\tbinary.BigEndian.PutUint64(k[8:], j)\n\t\t\t\tif err := b.Put(k, nil); err != nil {\n\t\t\t\t\tt.Fatalf(\"put error: %s\", err)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn nil\n\t\t}); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t}\n\n\t// Delete all of them in one large transaction\n\tif err := db.Update(func(tx *bolt.Tx) error {\n\t\tb := tx.Bucket([]byte(\"0\"))\n\t\tc := b.Cursor()\n\t\tfor k, _ := c.First(); k != nil; k, _ = c.Next() {\n\t\t\tif err := c.Delete(); err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Check more than an overflow's worth of pages are freed.\n\tstats := db.Stats()\n\tfreePages := stats.FreePageN + stats.PendingPageN\n\tif freePages <= 0xFFFF {\n\t\tt.Fatalf(\"expected more than 0xFFFF free pages, got %v\", freePages)\n\t}\n\n\t// Free page count should be preserved on reopen.\n\tdb.MustClose()\n\tdb.MustReopen()\n\tif reopenFreePages := db.Stats().FreePageN; freePages != reopenFreePages {\n\t\tt.Fatalf(\"expected %d free pages, got %+v\", freePages, db.Stats())\n\t}\n}", "title": "" }, { "docid": "6ca909ee1745ddd9c664ede468d9c5c5", "score": "0.5131042", "text": "func (m *MySQL) cleanup(t time.Time) error {\n\tres, err := m.db.Exec(`DELETE FROM persist WHERE saved < ?`, t)\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"delete exec: %w\", err)\n\t}\n\n\trows, err := res.RowsAffected()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"rows affected: %w\", err)\n\t}\n\n\tif rows > 0 {\n\t\tklog.Infof(\"Deleted %d rows of stale data\", rows)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "20ed6f0de42a66adae79b7445d1fae6d", "score": "0.5126268", "text": "func (ldb LevelDB) ResetDB() {\n\t//cleanup db\n\tldb.mu.Lock()\n\tdefer ldb.mu.Unlock()\n\titer := ldb.ldb.NewIterator(nil, nil)\n\tdefer iter.Release()\n\tfor iter.Next() {\n\t\tldb.Delete(iter.Key())\n\t}\n}", "title": "" }, { "docid": "721d76c5102c10fbc7a97ac06a7087fd", "score": "0.5123235", "text": "func CleanupDatabase(dbname string, clusterService string) (err error) {\n\ti, err := instances.FindByDatabase(dbname)\n\tif err != nil {\n\t\tlog.Error(fmt.Sprintf(\"tasks.CleanupUnusedDatabases(%s) instances.FindByDatabase() ! %s\", i.Database, err))\n\t\treturn err\n\t}\n\n\tips, err := i.ClusterIPs()\n\tif err != nil {\n\t\tlog.Error(fmt.Sprintf(`tasks.Task#DecommissionDatabase(%s) i.ClusterIPs() ! %s`, i.Database, err))\n\t\treturn err\n\t}\n\tif len(ips) == 0 {\n\t\treturn fmt.Errorf(\"tasks.Task#DecommissionDatabase(%s) ! No service cluster nodes found in Consul\", i.Database)\n\t}\n\tp := pg.NewPG(`127.0.0.1`, pbPort, `rdpg`, `rdpg`, pgPass)\n\tdb, err := p.Connect()\n\tif err != nil {\n\t\tlog.Error(fmt.Sprintf(\"tasks.Task#DecommissionDatabase(%s) p.Connect(%s) ! %s\", dbname, p.URI, err))\n\t\treturn err\n\t}\n\tdefer db.Close()\n\n\tif globals.ServiceRole == \"service\" {\n\t\t// In here we must do everything necessary to physically delete and clean up\n\t\t// the database from all service cluster nodes.\n\t\tfor _, ip := range ips { // Schedule pgbouncer reconfigure on each cluster node.\n\t\t\tnewTask := Task{ClusterID: ClusterID, Node: ip, Role: \"all\", Action: \"Reconfigure\", Data: \"pgbouncer\", NodeType: \"any\"}\n\t\t\terr = newTask.Enqueue()\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(fmt.Sprintf(`tasks.Task#CleanupUnusedDatabases(%s) Reconfigure PGBouncer! %s`, i.Database, err))\n\t\t\t}\n\t\t}\n\t\tlog.Trace(fmt.Sprintf(`tasks.CleanupUnusedDatabases(%s) - Here is where we finally decommission on the service cluster...`, i.Database))\n\n\t\tsq := fmt.Sprintf(`DELETE FROM tasks.tasks WHERE action='BackupDatabase' AND data='%s'`, i.Database)\n\t\t_, err = db.Exec(sq)\n\t\tif err != nil {\n\t\t\tlog.Error(fmt.Sprintf(\"tasks.Task#CleanupUnusedDatabases(%s) ! %s\", i.Database, err))\n\t\t}\n\t\tsq = fmt.Sprintf(`UPDATE tasks.schedules SET enabled = false WHERE action='BackupDatabase' AND data='%s'`, i.Database)\n\t\t_, err = db.Exec(sq)\n\t\tif err != nil {\n\t\t\tlog.Error(fmt.Sprintf(\"tasks.Task#CleanupUnusedDatabases(%s) ! %s\", i.Database, err))\n\t\t}\n\n\t\tif clusterService == \"pgbdr\" {\n\t\t\tlog.Error(fmt.Sprintf(\"tasks.Task#CleanupUnusedDatabases(%s) ! Cannot cleanup BDR Servers\", i.Database))\n\t\t} else {\n\t\t\tp.DisableDatabase(i.Database)\n\t\t\tp.DropDatabase(i.Database)\n\n\t\t\tdbuser := \"\"\n\t\t\tsq = fmt.Sprintf(`SELECT dbuser FROM cfsb.instances WHERE dbname='%s' LIMIT 1`, i.Database)\n\t\t\terr = db.Get(&dbuser, sq)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(fmt.Sprintf(\"tasks.Task#CleanupUnusedDatabases(%s) ! %s\", i.Database, err))\n\t\t\t}\n\t\t\tp.DropUser(dbuser)\n\n\t\t\tsq = fmt.Sprintf(`UPDATE cfsb.instances SET decommissioned_at=CURRENT_TIMESTAMP WHERE dbname='%s'`, i.Database)\n\t\t\t_, err = db.Exec(sq)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(fmt.Sprintf(\"tasks.Task#CleanupUnusedDatabases(%s) ! %s\", i.Database, err))\n\t\t\t}\n\t\t}\n\n\t\t// Notify management cluster that the instance has been decommissioned\n\t\t// Find management cluster API address\n\n\t\tclient, err := consulapi.NewClient(consulapi.DefaultConfig())\n\t\tif err != nil {\n\t\t\tlog.Error(fmt.Sprintf(\"tasks.Task#CleanupUnusedDatabases(%s) consulapi.NewClient() ! %s\", i.Database, err))\n\t\t\treturn err\n\t\t}\n\n\t\tcatalog := client.Catalog()\n\t\tsvcs, _, err := catalog.Service(`rdpgmc`, \"\", nil)\n\t\tif err != nil {\n\t\t\tlog.Error(fmt.Sprintf(\"tasks.Task#CleanupUnusedDatabases(%s) consulapi.Client.Catalog() ! %s\", i.Database, err))\n\t\t\treturn err\n\t\t}\n\t\tif len(svcs) == 0 {\n\t\t\tlog.Error(fmt.Sprintf(\"tasks.Task#CleanupUnusedDatabases(%s) ! No services found, no known nodes?!\", i.Database))\n\t\t\treturn err\n\t\t}\n\t\t//mgtAPIIPAddress := svcs[0].Address\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6ac286492005496e6b74387f79d365e3", "score": "0.5119485", "text": "func TestTx_ReclaimAfterDelete(t *testing.T) {\n\tconst containerN = 5000\n\tconst batchSize = 500\n\n\tdb := MustOpenDB(t)\n\tdefer MustCloseDB(t, db)\n\n\tkeys := rand.New(rand.NewSource(0)).Perm(containerN)\n\tinserted := make(map[uint64]struct{})\n\n\tfor i := 0; i < len(keys); i += batchSize {\n\t\tfunc() {\n\t\t\ttx := MustBegin(t, db, true)\n\t\t\tdefer tx.Rollback()\n\n\t\t\tif err := tx.CreateBitmapIfNotExists(\"x\"); err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\n\t\t\t// Insert a bunch of containers.\n\t\t\tc := roaring.NewContainerArray(convenientPrepopulatedArray)\n\t\t\tfor j := 0; j < batchSize; j++ {\n\t\t\t\tkey := uint64(keys[i+j])\n\t\t\t\tif err := tx.PutContainer(\"x\", key, c); err != nil {\n\t\t\t\t\tt.Fatal(err)\n\t\t\t\t}\n\t\t\t\tinserted[key] = struct{}{}\n\t\t\t}\n\n\t\t\t// Insert some already inserted containers.\n\t\t\tvar deleted int\n\t\t\tfor k := range inserted {\n\t\t\t\tif err := tx.RemoveContainer(\"x\", uint64(k)); err != nil {\n\t\t\t\t\tt.Fatal(err)\n\t\t\t\t}\n\t\t\t\tdelete(inserted, k)\n\n\t\t\t\tif deleted++; deleted > 200 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif err := tx.Commit(); err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\t\t}()\n\t}\n\n\tfi, err := os.Stat(db.DataPath())\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\torigSize := fi.Size()\n\n\t// Delete all containers.\n\tfunc() {\n\t\ttx := MustBegin(t, db, true)\n\t\tdefer tx.Rollback()\n\n\t\tfor _, key := range keys {\n\t\t\tif err := tx.RemoveContainer(\"x\", uint64(key)); err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\t\t}\n\n\t\tif err := tx.Commit(); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t}()\n\n\t// Verify database has shrunk after checkpoint.\n\tif err := db.Checkpoint(); err != nil {\n\t\tt.Fatal(err)\n\t} else if fi, err := os.Stat(db.DataPath()); err != nil {\n\t\tt.Fatal(err)\n\t} else if fi.Size() >= origSize {\n\t\tt.Fatalf(\"size did not shrink: originally %d bytes, ended with %d bytes\", fi.Size(), origSize)\n\t}\n}", "title": "" }, { "docid": "2f06d5cf1b16ea76e7620091dc078059", "score": "0.51177", "text": "func (r *HdCacheProvider) rebalance() {\n\t//Cache size is a diminishing return thing:\n\t//The more of it a torrent has, the less of a difference additional cache makes.\n\t//Thus, instead of scaling the distribution lineraly with torrent size, we'll do it by square-root\n\tlog.Println(\"Rebalancing caches...\")\n\tvar scalingTotal float64\n\tsqrts := make(map[string]float64)\n\tfor i, cache := range r.caches {\n\t\tsqrts[i] = math.Sqrt(float64(cache.torrentLength))\n\t\tscalingTotal += sqrts[i]\n\t}\n\n\tscalingFactor := float64(r.capacity*1024*1024) / scalingTotal\n\tfor i, cache := range r.caches {\n\t\tnewCap := int64(math.Floor(scalingFactor * sqrts[i] / float64(cache.pieceSize)))\n\t\tif newCap == 0 {\n\t\t\tnewCap = 1 //Something's better than nothing!\n\t\t}\n\t\tlog.Printf(\"Setting cache '%x' to new capacity %v (%v MiB)\", cache.infohash, newCap, float32(newCap*cache.pieceSize)/float32(1024*1024))\n\t\tcache.setCapacity(uint32(newCap))\n\t}\n\n\tfor _, cache := range r.caches {\n\t\tcache.trim()\n\t}\n}", "title": "" }, { "docid": "17d142eb4fdc5e473be1e6641ad606cc", "score": "0.50886947", "text": "func (d *neoDao) ClearDB() error {\n\tcq1 := neoism.CypherQuery{\n\t\tStatement: `\n\t\t\tMATCH (n)\n\t\t\tOPTIONAL MATCH (n)-[r]-()\n\t\t\tDELETE n,r\n\t\t`,\n\t}\n\n\treturn d.db.Cypher(&cq1)\n}", "title": "" }, { "docid": "06a3c8f1555743262e7f58d92d61f8a4", "score": "0.50860626", "text": "func (p *CouchbaseProvider) GC() {}", "title": "" }, { "docid": "77c5fd7af3468a803e90e906bcd2ce52", "score": "0.50795186", "text": "func cleanDB() {\n\tlog.Print(\"Cleaning up DB connections\")\n\n\tfor i := 0; i < NUM_DB_CONN; i++ {\n\t\tdb := <-dbConnectionPool\n\t\tdb.Close()\n\t}\n}", "title": "" }, { "docid": "1df92fa73904bd01abcc969d9cab9932", "score": "0.50793976", "text": "func (db *DB) Flush() error {\n\tdefer func() {\n\t\tterminal.LogPad(fmt.Sprintf(\"%s %s\", colors.Yellow(\"WARN\"), \"Flush db. \"))\n\t\tos.Exit(0)\n\t}()\n\treturn os.Remove(utils.MustGetDb(dbName))\n}", "title": "" }, { "docid": "7250e71539d99633b86a3f70e11d9075", "score": "0.5069134", "text": "func (r *Database) ClearDatabase() error {\n\tr.mtx.Lock()\n\tdefer r.mtx.Unlock()\n\n\tinstance.presets = map[string]types.Preset{}\n\tinstance.jobs = map[string]types.Job{}\n\treturn nil\n}", "title": "" }, { "docid": "b7929b487804a4c67d4c0b1431874e41", "score": "0.5068637", "text": "func (px *Paxos) cleanUp(){\n seq := px.minSeq\n\n //free log entries\n for lkey,_ := range px.log{\n if lkey < seq{\n delete(px.log,lkey)\n }\n }\n\n //free tentative info\n for tkey,_ := range px.tentative{\n if tkey < seq{\n delete(px.tentative,tkey)\n }\n }\n\n //free proposer info\n for pkey,_ := range px.proposeinfo{\n if pkey < seq{\n delete(px.proposeinfo,pkey)\n }\n }\n\n //free acceptor info\n for akey,_ := range px.acceptinfo{\n if akey < seq{\n delete(px.acceptinfo,akey)\n }\n }\n\n runtime.GC()\n}", "title": "" }, { "docid": "67ecc78a1fdb63c06a3774db3e2f1d3e", "score": "0.5053859", "text": "func (sc *KMSChain) Clean() {\n sc.cm.Clean()\n}", "title": "" }, { "docid": "3be81be0e7df9d874ac096a22a876f04", "score": "0.50536966", "text": "func (f *Freezer) repair() error {\n\tvar (\n\t\thead = uint64(math.MaxUint64)\n\t\ttail = uint64(0)\n\t)\n\tfor _, table := range f.tables {\n\t\titems := atomic.LoadUint64(&table.items)\n\t\tif head > items {\n\t\t\thead = items\n\t\t}\n\t\thidden := atomic.LoadUint64(&table.itemHidden)\n\t\tif hidden > tail {\n\t\t\ttail = hidden\n\t\t}\n\t}\n\tfor _, table := range f.tables {\n\t\tif err := table.truncateHead(head); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := table.truncateTail(tail); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tatomic.StoreUint64(&f.frozen, head)\n\tatomic.StoreUint64(&f.tail, tail)\n\treturn nil\n}", "title": "" }, { "docid": "1a1460d6777bb2b5db93cced57dd87b3", "score": "0.5047313", "text": "func (ch *ClickHouse) FreezeTableOldWay(table Table) error {\n\tvar partitions []struct {\n\t\tPartitionID string `db:\"partition_id\"`\n\t}\n\tq := fmt.Sprintf(\"SELECT DISTINCT partition_id FROM `system`.`parts` WHERE database='%s' AND table='%s'\", table.Database, table.Name)\n\tif err := ch.conn.Select(&partitions, q); err != nil {\n\t\treturn fmt.Errorf(\"can't get partitions for '%s.%s': %v\", table.Database, table.Name, err)\n\t}\n\tlog.Printf(\"Freeze '%v.%v'\", table.Database, table.Name)\n\tfor _, item := range partitions {\n\t\tlog.Printf(\" partition '%v'\", item.PartitionID)\n\t\tquery := fmt.Sprintf(\n\t\t\t\"ALTER TABLE `%v`.`%v` FREEZE PARTITION ID '%v';\",\n\t\t\ttable.Database,\n\t\t\ttable.Name,\n\t\t\titem.PartitionID)\n\t\tif item.PartitionID == \"all\" {\n\t\t\tquery = fmt.Sprintf(\n\t\t\t\t\"ALTER TABLE `%v`.`%v` FREEZE PARTITION tuple();\",\n\t\t\t\ttable.Database,\n\t\t\t\ttable.Name)\n\t\t}\n\t\tif _, err := ch.conn.Exec(query); err != nil {\n\t\t\treturn fmt.Errorf(\"can't freeze partition '%s' on '%s.%s': %v\", item.PartitionID, table.Database, table.Name, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0f85ae5db3d9a35eda2883c39e1bcd6a", "score": "0.5039334", "text": "func (pCache *PCache) MakeCleanAll(){\n for pCache.pDirty != nil {\n p := pCache.pDirty\n pCache.MakeClean(p)\n }\n}", "title": "" }, { "docid": "2d96e53672e9521286f6693e581e9926", "score": "0.50338787", "text": "func Clean() {\n\tactiveStore.Clean()\n}", "title": "" }, { "docid": "6f9eb968dc484462e8e969e7d0028893", "score": "0.5026882", "text": "func chunkClean() {\n\tcret, cexp := ChunkDb.Expire()\n\tif cexp > 0 {\n\t\tlog.Infof(\n\t\t\t\"Chunk expiry complete. Retained=%d, Expired=%d\\n\",\n\t\t\tcret,\n\t\t\tcexp,\n\t\t)\n\t}\n\tfret, fdel := ChunkDb.Housekeep()\n\tif fdel > 0 {\n\t\tlog.Infof(\n\t\t\t\"Stranded chunk deletion: Retained=%d, Deleted=%d\",\n\t\t\tfret,\n\t\t\tfdel,\n\t\t)\n\t}\n}", "title": "" }, { "docid": "4733efd377bd725c628498da8b906c24", "score": "0.50220776", "text": "func BenchmarkMVCCDeleteRange1Version8Bytes_RocksDB(b *testing.B) {\n\trunMVCCDeleteRange(setupMVCCRocksDB, 8, b)\n}", "title": "" }, { "docid": "9a9c2aa9b6109b2de1600662efe972fd", "score": "0.5005726", "text": "func (db *DB) Close() error {\n\tif err := db.Flush(); err != nil {\n\t\treturn err\n\t}\n\tclose(db.shutdown)\n\tif db.DiskBacked {\n\t\treturn db.removeFlock()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "90c1a8daece76655e7b51c0326d4f872", "score": "0.50036055", "text": "func (d *DB) GarbageCollection(discardRatio float64) error {\n\tif discardRatio <= 0 || discardRatio >= 1 {\n\t\tdiscardRatio = 0.5\n\t}\n\n\terr := d.badger.RunValueLogGC(discardRatio)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn d.badger.Sync()\n}", "title": "" }, { "docid": "e14e1a25fb387eddabca749165b4ff62", "score": "0.49720433", "text": "func (c *Bucket) trim() {\n\tsz := atomic.LoadInt64(&c.stats.Size)\n\tcp := atomic.LoadInt64(&c.stats.Capacity)\n\n\tfor sz > cp {\n\t\telt := c.list.Back()\n\t\tif elt == nil {\n\t\t\tbreak\n\t\t}\n\n\t\tv := c.list.Remove(elt).(*cacheValue)\n\t\telem := c.entry[v.key]\n\t\tdelete(c.entry, v.key)\n\n\t\teltSize := elem.size() + v.size()\n\t\tsz -= eltSize\n\t\tatomic.AddInt64(&c.stats.Size, -eltSize)\n\t\tatomic.AddInt64(&c.stats.TrimEntries, 1)\n\t\tatomic.AddInt64(&c.stats.TrimBytes, eltSize)\n\t}\n}", "title": "" }, { "docid": "e99b063a72ad1ba1ff9a7d02a7b1bd50", "score": "0.49706623", "text": "func (pCache *PCache) Destroy(){\n // if( pCache.nPage ) pcache1TruncateUnsafe(pCache, 0);\n // free(pCache.apHash);\n // free(pBulk)\n // free(pCache);\n}", "title": "" }, { "docid": "17336ea1f81510c01bbafc1ea61e4082", "score": "0.49629182", "text": "func BadgerDbGc() {\n\tdb := oyster_utils.GetBadgerDb()\n\tif db == nil {\n\t\treturn\n\t}\n\n\t// TODO: Make sure this will work with the new DB changes. Do we need to call this for every db?\n\n\t// It is recommended that this method be called during periods of low activity in your system, or periodically\n\tfor {\n\t\t// One call would only result in removal of at max one log file. As an optimization,\n\t\t// you could also immediately re-run it whenever it returns nil error.\n\t\t// According BadgerDB GoDoc, it is recommended to be 0.5.\n\t\terr := db.RunValueLogGC(0.5)\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2759de2f6f67f25f9c1fc89e16938737", "score": "0.49575102", "text": "func VacuumClean(cocoon *db.Cocoon, _ []byte) (interface{}, error) {\n\tentities, err := cocoon.QueryLatestTasks()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, fullTask := range entities {\n\t\tswitch fullTask.TaskEntity.Task.Status {\n\t\tcase db.TaskNew:\n\t\t\terr = vacuumNewTask(cocoon, fullTask)\n\t\tcase db.TaskInProgress:\n\t\t\terr = vacuumInProgressTask(cocoon, fullTask)\n\t\t}\n\t}\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn \"OK\", nil\n}", "title": "" }, { "docid": "a559785b8517115fef74ceb0baa732cd", "score": "0.49510488", "text": "func (t *TableCache) Purge(dbModel model.DatabaseModel) {\n\tt.mutex.Lock()\n\tdefer t.mutex.Unlock()\n\tt.dbModel = dbModel\n\ttableTypes := t.dbModel.Types()\n\tfor name := range t.dbModel.Schema.Tables {\n\t\tt.cache[name] = newRowCache(name, t.dbModel, tableTypes[name])\n\t}\n}", "title": "" }, { "docid": "5fd4f762b9a495e7c024486f577b6509", "score": "0.49465334", "text": "func leakSlow() {\n\trootDir := \"testbadgerdb\"\n\tfor {\n\t\tdb, err := openDB(rootDir)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tif err := db.View(func(txn *badger.Txn) error {\n\t\t\topts := badger.DefaultIteratorOptions\n\t\t\tit := txn.NewIterator(opts)\n\t\t\tdefer it.Close()\n\t\t\tfor it.Rewind(); it.Valid(); it.Next() {\n\t\t\t\titem := it.Item()\n\t\t\t\t_, err := item.Value()\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\treturn nil\n\t\t}); err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tif err := db.Close(); err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c804a1cd8c40c0769e17330380f4484a", "score": "0.49237722", "text": "func TestCollectGarbage(t *testing.T) {\n\tskipIfOldMongo(t)\n\n\tdbpath, err := ioutil.TempDir(\"\", \"lreplica_s3storage_test_dbpath_\")\n\tensure.Nil(t, err)\n\t// Don't defer cleanup of dbpath because we want dbpath to be around for debugging if test fails\n\tfmt.Println(\"Using temporary database path\", dbpath)\n\n\ts3 := s3storage.NewMockS3(t)\n\tdefer s3.Stop()\n\ts, err := s3storage.NewStorageWithMockS3(s3)\n\tensure.Nil(t, err)\n\n\treplicaID := \"faux-replicaID\"\n\tmaxEntryID := 256\n\n\tmongo := mgotest.NewStartedServer(t, \"--storageEngine=rocksdb\", \"--dbpath=\"+dbpath)\n\tdefer mongo.Stop()\n\tcollection := mongo.Session().DB(\"tdb\").C(\"tc\")\n\n\tr := lreplica.NewMockLocalReplica(mongo, 1)\n\tmanager, err := strata.NewSnapshotManager(r, s)\n\tensure.Nil(t, err)\n\n\t// There should not be any files yet\n\tgcStats, err := manager.CollectGarbage(replicaID)\n\tensure.Nil(t, err)\n\tensure.True(t, gcStats.NumNeeded == 0)\n\tensure.True(t, gcStats.NumGarbage == 0)\n\n\tfor i := 0; i <= maxEntryID; i += 3 {\n\t\tif err := collection.Insert(bson.M{\"_id\": i, \"answer\": i}); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t}\n\t// Snapshot 0\n\t_, err = manager.CreateSnapshot(replicaID)\n\tensure.Nil(t, err)\n\terr = manager.SaveMetadataForReplica(replicaID)\n\tensure.Nil(t, err)\n\terr = manager.RefreshMetadata()\n\tensure.Nil(t, err)\n\tgcStats0, err := manager.CollectGarbage(replicaID)\n\tensure.Nil(t, err)\n\tensure.True(t, gcStats0.NumNeeded > 0)\n\tensure.True(t, gcStats0.NumNeeded == gcStats0.NumFMNeeded)\n\tensure.True(t, gcStats0.NumStatsNeeded == 1)\n\tensure.True(t, gcStats0.NumGarbage == 0)\n\tensure.True(t, gcStats0.NumFMGarbage == 0)\n\tensure.True(t, gcStats0.NumStatsGarbage == 0)\n\tensure.True(t, gcStats0.SizeNeeded > 0)\n\tensure.True(t, gcStats0.SizeGarbage == 0)\n\n\t// Snapshot 1 is a copy of snapshot 0\n\t_, err = manager.CreateSnapshot(replicaID)\n\tensure.Nil(t, err)\n\terr = manager.SaveMetadataForReplica(replicaID)\n\tensure.Nil(t, err)\n\terr = manager.RefreshMetadata()\n\tensure.Nil(t, err)\n\tgcStats1, err := manager.CollectGarbage(replicaID)\n\tensure.Nil(t, err)\n\tensure.True(t, gcStats0.NumNeeded == gcStats1.NumNeeded)\n\tensure.True(t, gcStats0.NumFMNeeded == gcStats1.NumFMNeeded)\n\tensure.True(t, gcStats1.NumStatsNeeded == 2)\n\tensure.True(t, gcStats1.NumGarbage == 0)\n\tensure.True(t, gcStats1.NumFMGarbage == 0)\n\tensure.True(t, gcStats1.NumStatsGarbage == 0)\n\n\t// Delete snapshot 1. This shouldn't cause any files to become garbage\n\t// because snapshot 0 is still around.\n\tmetadata, err := manager.GetSnapshotMetadata(replicaID, \"1\")\n\tensure.Nil(t, err)\n\terr = manager.DeleteSnapshot(*metadata)\n\tensure.Nil(t, err)\n\terr = manager.SaveMetadataForReplica(replicaID)\n\tensure.Nil(t, err)\n\terr = manager.RefreshMetadata()\n\tensure.Nil(t, err)\n\tgcStats, err = manager.CollectGarbage(replicaID)\n\tensure.Nil(t, err)\n\tensure.True(t, gcStats0.NumNeeded == gcStats.NumNeeded)\n\tensure.True(t, gcStats.NumStatsNeeded == 1)\n\tensure.True(t, gcStats.NumGarbage == 0)\n\tensure.True(t, gcStats.NumFMGarbage == 0)\n\tensure.True(t, gcStats.NumStatsGarbage == 1)\n\n\t// Snapshot 2\n\tfor i := 1; i <= maxEntryID; i += 3 {\n\t\tif err := collection.Insert(bson.M{\"_id\": i, \"answer\": i}); err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t}\n\t_, err = manager.CreateSnapshot(replicaID)\n\tensure.Nil(t, err)\n\terr = manager.SaveMetadataForReplica(replicaID)\n\tensure.Nil(t, err)\n\terr = manager.RefreshMetadata()\n\tensure.Nil(t, err)\n\n\t// There should be new files but no garbage\n\tgcStats2, err := manager.CollectGarbage(replicaID)\n\tensure.Nil(t, err)\n\tensure.True(t, gcStats2.NumNeeded > gcStats0.NumNeeded)\n\tensure.True(t, gcStats2.NumNeeded == gcStats2.NumFMNeeded)\n\tensure.True(t, gcStats2.NumStatsNeeded == 2)\n\tensure.True(t, gcStats2.NumGarbage == 0)\n\tensure.True(t, gcStats2.NumFMGarbage == 0)\n\tensure.True(t, gcStats2.NumStatsGarbage == 0)\n\n\t// Delete snapshot 2. This should cause a known number of files to become garbage.\n\tmetadata, err = manager.GetSnapshotMetadata(replicaID, \"1\")\n\tensure.Nil(t, err)\n\terr = manager.DeleteSnapshot(*metadata)\n\tensure.Nil(t, err)\n\terr = manager.SaveMetadataForReplica(replicaID)\n\tensure.Nil(t, err)\n\terr = manager.RefreshMetadata()\n\tensure.Nil(t, err)\n\tgcStats, err = manager.CollectGarbage(replicaID)\n\tensure.Nil(t, err)\n\tensure.True(t, gcStats.NumNeeded == gcStats0.NumNeeded)\n\tensure.True(t, gcStats.NumFMNeeded == gcStats.NumNeeded)\n\tensure.True(t, gcStats.NumStatsNeeded == 1)\n\tensure.True(t, gcStats.NumGarbage == gcStats2.NumNeeded-gcStats0.NumNeeded)\n\tensure.True(t, gcStats.NumGarbage == gcStats.NumFMGarbage)\n\tensure.True(t, gcStats.NumStatsGarbage == 1)\n\tensure.True(t, gcStats.NumErrsDeleting == 0)\n\n\t// Delete snapshot 0\n\tmetadata, err = manager.GetSnapshotMetadata(replicaID, \"0\")\n\tensure.Nil(t, err)\n\terr = manager.DeleteSnapshot(*metadata)\n\tensure.Nil(t, err)\n\terr = manager.SaveMetadataForReplica(replicaID)\n\tensure.Nil(t, err)\n\terr = manager.RefreshMetadata()\n\tensure.Nil(t, err)\n\tgcStats, err = manager.CollectGarbage(replicaID)\n\tensure.Nil(t, err)\n\tensure.True(t, gcStats.NumNeeded == 0)\n\tensure.True(t, gcStats.NumFMNeeded == 0)\n\tensure.True(t, gcStats.NumStatsNeeded == 0)\n\tensure.True(t, gcStats.NumGarbage == gcStats0.NumNeeded)\n\tensure.True(t, gcStats.NumFMGarbage == gcStats.NumGarbage)\n\tensure.True(t, gcStats.NumStatsGarbage == 1)\n\tensure.True(t, gcStats.NumErrsDeleting == 0)\n\n\t// Garbage collect again. There shouldn't be any files.\n\tgcStats, err = manager.CollectGarbage(replicaID)\n\tensure.Nil(t, err)\n\tensure.True(t, gcStats.NumNeeded == 0)\n\tensure.True(t, gcStats.NumGarbage == 0)\n\tensure.True(t, gcStats.NumFMNeeded == 0)\n\tensure.True(t, gcStats.NumStatsNeeded == 0)\n\n\t// Stop mongo before we delete its dbpath\n\tmongo.Stop()\n\terr = os.RemoveAll(dbpath)\n\tensure.Nil(t, err)\n}", "title": "" }, { "docid": "b5d29a07ddf2fcc499693c5c702b0a88", "score": "0.49232343", "text": "func (a *adaptor) Compact(ctx context.Context, s dogma.ProjectionCompactScope) error {\n\treturn a.handler.Compact(ctx, a.db, s)\n}", "title": "" }, { "docid": "3054f0fa60b9f5028ec548eb03b3e528", "score": "0.49210182", "text": "func (s *Storage) cleanTicker(spec collections.Spec) {\n\tticker := time.NewTicker(s.gcInterval)\n\tdefer ticker.Stop()\n\tfor {\n\t\tselect {\n\t\tcase <-s.gcDone:\n\t\t\treturn\n\t\tcase t := <-ticker.C:\n\t\t\tsql := fmt.Sprintf(\"DELETE FROM %s WHERE %s <= $1 AND %s != 0\",\n\t\t\t\tSanitize(spec.Name),\n\t\t\t\tSanitize(spec.FieldsMap[\"expiration\"].Name),\n\t\t\t\tSanitize(spec.FieldsMap[\"expiration\"].Name))\n\t\t\t_ = s.RawExec(sql, t.Unix())\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8afd7c1577fb04ca083c505b144faf9f", "score": "0.49208447", "text": "func (oFsm *LockStateFsm) PrepareForGarbageCollection(ctx context.Context, aDeviceID string) {\n\tlogger.Debugw(ctx, \"prepare for garbage collection\", log.Fields{\"device-id\": aDeviceID})\n\toFsm.pDeviceHandler = nil\n\toFsm.pOnuDeviceEntry = nil\n\toFsm.pOmciCC = nil\n}", "title": "" }, { "docid": "7b65042e053626150035752ec1e1f88f", "score": "0.49200183", "text": "func (r *RedisClient) FlushDB() error {\n\tс := r.pool.Get()\n\tdefer с.Close()\n\t_, err := с.Do(\"FLUSHDB\")\n\treturn err\n}", "title": "" }, { "docid": "0df2a2bf6bab38ef2de73b013e514bed", "score": "0.49178436", "text": "func leakSlowest() {\n\trootDir := \"testbadgerdb\"\n\tdb, err := openDB(rootDir)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer db.Close()\n\tfor {\n\t\tif err := db.View(func(txn *badger.Txn) error {\n\t\t\topts := badger.DefaultIteratorOptions\n\t\t\tit := txn.NewIterator(opts)\n\t\t\tdefer it.Close()\n\t\t\tprefix := []byte{4}\n\t\t\tfor it.Seek(prefix); it.ValidForPrefix(prefix); it.Next() {\n\t\t\t\titem := it.Item()\n\t\t\t\t_, err := item.Value()\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\treturn nil\n\t\t}); err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5885a1b89df9d6f729fa8c02d7043dc5", "score": "0.49153054", "text": "func (c *Chapter) Clean() error {\n\tif err := os.RemoveAll(c.Path); err != nil {\n\t\treturn err\n\t}\n\tc.Cached = false\n\tdb.Save(c)\n\treturn nil\n}", "title": "" }, { "docid": "251812d18de2b1d557d0d30542e7db45", "score": "0.48994103", "text": "func RemoveDataBase() {\n\tos.Remove(\"./med.db\")\n}", "title": "" }, { "docid": "81c6ba01cff30e5f89722d137e900635", "score": "0.48952714", "text": "func CleanTestDB(db *gorm.DB) {\n\t_ = db.Close()\n}", "title": "" }, { "docid": "1d5795156affdf35fec20763e1e24f6b", "score": "0.48921928", "text": "func (rdb *RelationalDB) Clear() {\n\trdb.db.Exec(\"DELETE from pageInfo WHERE pageID >= 0\")\n\trdb.db.Exec(\"DELETE from words WHERE wordID >= 0\")\n}", "title": "" }, { "docid": "841555b1f43367861c4b9f7995342693", "score": "0.48917618", "text": "func Cleanup()", "title": "" }, { "docid": "fd93cf5777fd4bc6e30f6ded7869b5a5", "score": "0.48909417", "text": "func (db *memoryDB) Close() {\n\tdb.mu.Lock()\n\tdefer db.mu.Unlock()\n\n\tdb.products = nil\n}", "title": "" }, { "docid": "269600afcd56031e4068478e33a6e483", "score": "0.48889804", "text": "func (mc *modelCache) clean() {\n\tmc.Lock()\n\tdefer mc.Unlock()\n\n\tmc.orders = make([]string, 0)\n\tmc.cache = make(map[string]*modelInfo)\n\tmc.cacheByFullName = make(map[string]*modelInfo)\n\tmc.done = false\n}", "title": "" }, { "docid": "da3c23a8db7c5b28bdd404f0708ff089", "score": "0.48766628", "text": "func GarbageCollector(ctx context.Context, completedTaskExpiration string) error {\n\tdbp, err := zesty.NewDBProvider(utask.DBName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tthresholdStr := completedTaskExpiration\n\tif thresholdStr == \"\" {\n\t\tthresholdStr = thresholdStrDefault // default fallback\n\t}\n\tthreshold, err := time.ParseDuration(thresholdStr)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsleepDuration := sleepDurationDefault\n\tif threshold < sleepDurationDefault {\n\t\tsleepDuration = threshold\n\t}\n\n\t// delete old completed/cancelled/wontfix tasks\n\tgo func() {\n\t\t// Run it immediately and wait for new tick\n\t\tif err := deleteOldTasks(dbp, threshold); err != nil {\n\t\t\tlog.Printf(\"GarbageCollector: failed to trash old tasks: %s\", err)\n\t\t}\n\n\t\tfor running := true; running; {\n\t\t\ttime.Sleep(sleepDuration)\n\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\trunning = false\n\t\t\tdefault:\n\t\t\t\tif err := deleteOldTasks(dbp, threshold); err != nil {\n\t\t\t\t\tlog.Printf(\"GarbageCollector: failed to trash old tasks: %s\", err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\n\t// delete un-referenced batches\n\tgo func() {\n\t\t// Run it immediately and wait for new tick\n\t\tif err := deleteOrphanBatches(dbp); err != nil {\n\t\t\tlog.Printf(\"GarbageCollector: failed to trash old batches: %s\", err)\n\t\t}\n\n\t\tfor running := true; running; {\n\t\t\ttime.Sleep(sleepDuration)\n\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\trunning = false\n\t\t\tdefault:\n\t\t\t\tif err := deleteOrphanBatches(dbp); err != nil {\n\t\t\t\t\tlog.Printf(\"GarbageCollector: failed to trash old batches: %s\", err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn nil\n}", "title": "" }, { "docid": "a3720d4bbe4b788badb764a772821866", "score": "0.48758516", "text": "func (db *DbTest) Clear() {\n}", "title": "" }, { "docid": "35e409c4fb53bc4e3a280fdcb0fbbfb7", "score": "0.48736072", "text": "func GarbageCollection() error {\r\n\terr := db.RunValueLogGC(0.5)\r\n\tif errors.Is(err, badger.ErrNoRewrite) {\r\n\t\treturn nil\r\n\t}\r\n\treturn err\r\n}", "title": "" }, { "docid": "f11575ec91775916f44613594b941fb6", "score": "0.4868686", "text": "func (db *memoryDB) Close() {\n\tdb.mu.Lock()\n\tdefer db.mu.Unlock()\n\n\tdb.users = nil\n}", "title": "" }, { "docid": "dbd0343b147e9f424ed94f71f6d57e63", "score": "0.486623", "text": "func diskCleanup(appName string) {\n\tappDir := filepath.Join(path, fmt.Sprintf(\"storage/%s\", appName))\n\tstoreCleanupChan := make(chan error)\n\tgo func() {\n\t\tstoreCleanupChan <- storageCleanup(appDir)\n\t}()\n\tcontainerCleanup(appName)\n\t<-storeCleanupChan\n}", "title": "" }, { "docid": "0ab4bf36b8e5c5daf9dcbbe2feb816cc", "score": "0.486407", "text": "func testFlockWithDownloadKilled(t *testing.T) (*sql.DB, func()) {\n\tlocalFile, err := getLocalFile(false)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Remove existing local file, to ensure that the first goroutine will download the CRDB binary.\n\tif err := removeExistingLocalFile(localFile); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// First NewDBForTest process to download the CRDB binary to the local file,\n\t// but killed in the middle.\n\t_, stop := testserver.NewDBForTest(t, testserver.StopDownloadInMiddleOpt())\n\tstop()\n\t// Start the second NewDBForTest process.\n\t// It will remove the local file and redownload.\n\treturn testserver.NewDBForTest(t)\n\n}", "title": "" } ]
ed699d019cc95aa3a477c42b06aaf2fd
playGauge continuously changes the displayed percent value on the gauge by the step once every delay. Exits when the context expires.
[ { "docid": "b07f1e319a34d962d03ba50387d514e7", "score": "0.7433673", "text": "func playGauge(ctx context.Context, g *gauge.Gauge, val *uint, delay time.Duration, pt playType) {\n\tticker := time.NewTicker(delay)\n\tdefer ticker.Stop()\n\tfor {\n\t\tselect {\n\t\tcase <-ticker.C:\n\t\t\tswitch pt {\n\t\t\tcase playTypePercent:\n\t\t\t\tif err := g.Percent(int(*val)); err != nil {\n\t\t\t\t\tpanic(err)\n\t\t\t\t}\n\t\t\tcase playTypeAbsolute:\n\t\t\t\tif err := g.Absolute(int(*val), 100); err != nil {\n\t\t\t\t\tpanic(err)\n\t\t\t\t}\n\t\t\t}\n\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" } ]
[ { "docid": "7c6acd99ca20276d2aacc9f044b032f8", "score": "0.525075", "text": "func (c *Client) Gauge(stat string, value int, rate float64) error {\n\treturn c.send(stat, rate, strconv.Itoa(value)+\"|g\")\n}", "title": "" }, { "docid": "311c5cc99048e7983275a9843ca4ed0d", "score": "0.5241413", "text": "func (c *Client) Gauge(stat string, value int, rate float64) error {\n\treturn c.send(stat, rate, \"%d|g\", value)\n}", "title": "" }, { "docid": "dadcfabae781a8da4bbaea86c8f87d89", "score": "0.5142268", "text": "func Gauge(name string, value float64) {\n\tpayload := createPayload(name, value) + \"|g\"\n\tsend(payload)\n}", "title": "" }, { "docid": "87d6d9c7f28cccef71987220f8b549bd", "score": "0.51346594", "text": "func (c *Client) Gauge(bucket string, value int) {\n\tif c.muted {\n\t\treturn\n\t}\n\n\tc.mu.Lock()\n\tl := len(c.buf)\n\t// To set a gauge to a negative value we must first set it to 0.\n\t// https://github.com/etsy/statsd/blob/master/docs/metric_types.md#gauges\n\tif value < 0 {\n\t\tc.appendBucket(bucket)\n\t\tc.gauge(0)\n\t}\n\tc.appendBucket(bucket)\n\tc.gauge(value)\n\tc.flushIfBufferFull(l)\n\tc.mu.Unlock()\n}", "title": "" }, { "docid": "b77709b39969d0d92065676d8ed73faa", "score": "0.5126623", "text": "func Gauge(stat string, value int64) {\n\tGaugeWithSampling(stat, value, config.SampleRate)\n}", "title": "" }, { "docid": "3d785edeaf02aae20d6417e6ea34398f", "score": "0.512179", "text": "func (m *Monitor) Gauge(name string, value float64, tags []string, rate float64) error {\n\treturn nil\n}", "title": "" }, { "docid": "f9c816d992dcf380e37a7e14fa283b62", "score": "0.51161087", "text": "func (s *Client) Gauge(stat string, value int64, rate float32) error {\n\tdap := fmt.Sprintf(\"%d|g\", value)\n\treturn s.submit(stat, dap, rate)\n}", "title": "" }, { "docid": "ca559ca062caae5d54b1881ed8da06e0", "score": "0.51090914", "text": "func (c *Client) Gauge(key string, value float64) error {\n\tmsg := []byte(c.namespace)\n\tmsg = append(msg, key...)\n\tmsg = append(msg, ':')\n\tmsg = strconv.AppendFloat(msg, value, 'f', -1, 64)\n\tmsg = append(msg, \"|g\"...)\n\tif c.buffered {\n\t\tc.incoming <- msg\n\t\treturn nil\n\t}\n\treturn c.send(msg)\n}", "title": "" }, { "docid": "4d30236a8f5af2adff31cf089729be19", "score": "0.51013255", "text": "func Gauge(bucket string, value interface{}) { sender.Gauge(bucket, value) }", "title": "" }, { "docid": "07fec3271efa8e186a4d5ac7d5cabf14", "score": "0.50448155", "text": "func (g *Gauge) Increment() {\n\tif g.Percent >= 100 {\n\t\treturn\n\t}\n\n\tif g.Percent+g.Incrementer > 100 {\n\t\tg.Percent = 100\n\t} else {\n\t\tg.Percent += g.Incrementer\n\t}\n\n\tansi.CursorUp(g.Height + 2)\n\tg.Render()\n}", "title": "" }, { "docid": "ac37ddbf859ab987a8c7445215a84900", "score": "0.5000512", "text": "func (c *NullClient) Gauge(name string, value float64) {\n}", "title": "" }, { "docid": "80068c404862644d2efdde4b50666b9d", "score": "0.49402457", "text": "func (c *Client) Gauge(name string, value float64, tags []string, rate float64) error {\n\tstat := fmt.Sprintf(\"%f|g\", value)\n\treturn c.send(name, stat, tags, rate)\n}", "title": "" }, { "docid": "ef48dd9d64f0456d09bab01974588a2e", "score": "0.49396592", "text": "func Gauge(stat string, value int64) {\n\tGetStatter().Gauge(stat, value, rate)\n}", "title": "" }, { "docid": "ea936b1204e96e990aa137da9456ae83", "score": "0.49271327", "text": "func (w *Window) gifShot() *image.Paletted {\n\tshotCh := make(chan *image.Paletted)\n\t// We need to take the shot when the screen is not being redrawn\n\t// We know the screen has everything drawn on it when it is published\n\tw.prePublish = func(rgba *image.RGBA) {\n\t\t// Copy the buffer\n\t\tbds := rgba.Bounds()\n\t\tcopy := image.NewPaletted(bds, palette.Plan9)\n\t\tdraw.Draw(copy, bds, rgba, zeroPoint, draw.Src)\n\t\tshotCh <- copy\n\t}\n\tout := <-shotCh\n\tw.ClearScreenFilter()\n\treturn out\n}", "title": "" }, { "docid": "8fd6b1fb3cb1ba92c65cc5d6cb2cd459", "score": "0.48918468", "text": "func (g *Gauge) Decrement() {\n\tif g.Percent <= 0 {\n\t\treturn\n\t}\n\n\tif g.Percent-g.Incrementer < 0 {\n\t\tg.Percent = 0\n\t} else {\n\t\tg.Percent -= 5\n\t}\n\n\tansi.CursorUp(g.Height + 2)\n\tg.Render()\n}", "title": "" }, { "docid": "f85009e6f65cad6cd9f201c7a21c2852", "score": "0.487931", "text": "func (s *Stats) Gauge(stat string, value float64) {\n\ts.jobChan <- func() {\n\t\ts.flatStats[stat] = value\n\t\tif nil != s.json {\n\t\t\ts.json.SetP(value, stat)\n\t\t}\n\t\tif nil != s.riemannClient {\n\t\t\ts.riemannClient.SendEvent(RiemannEvent{\n\t\t\t\tService: s.pathPrefix + stat,\n\t\t\t\tMetric: value,\n\t\t\t\tTags: []string{\"stat\"},\n\t\t\t\tTTL: float32(s.config.PushInterval*2) / 1000,\n\t\t\t})\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b3d0c573dcaccb18180209a8bcb00a59", "score": "0.48401725", "text": "func (m *MockSink) FlushGauge(name string, value uint64) {\n\tm.gLock.Lock()\n\tdefer m.gLock.Unlock()\n\tm.Gauges[name] = value\n}", "title": "" }, { "docid": "3ae231eb40a42e6a22afbb03c6593bd5", "score": "0.48371693", "text": "func (g *Game) Step() {\n\tg.Paused = true\n\tg.NextGen()\n}", "title": "" }, { "docid": "5f80e293640e8511d885d20a007c93ad", "score": "0.48267692", "text": "func (eng *Engine) tick() {\n\t// Proton wants millisecond monotonic time\n\tnow := int64(elapsed() / time.Millisecond)\n\tnext := eng.Transport().Tick(now)\n\tif next != 0 {\n\t\teng.timer.Reset(time.Duration((next - now) * int64(time.Millisecond)))\n\t}\n}", "title": "" }, { "docid": "42c7dea0fa81b9c2ca38fb8a81f47238", "score": "0.48218858", "text": "func (c *CloudWatchReporter) report() {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\tnow := time.Now()\n\t// going from active to inactive, so record incremental active time\n\tif c.activeState {\n\t\tc.activeTime += now.Sub(maxTime(c.lastReportingTime, c.lastActiveStateChange))\n\t}\n\t// record incremental paused time\n\tif c.pausedState {\n\t\tc.pausedTime += now.Sub(maxTime(c.lastReportingTime, c.lastPausedStateChange))\n\t}\n\tvar activePercent float64\n\ttotalTime := now.Sub(c.lastReportingTime)\n\t// don't divide by 0\n\tif c.pausedTime == totalTime {\n\t\tactivePercent = 100.0\n\t} else {\n\t\tactivePercent = 100.0 * float64(c.activeTime) / float64(totalTime-c.pausedTime)\n\t}\n\tc.lastReportingTime = now\n\tc.activeTime = time.Duration(0)\n\tc.pausedTime = time.Duration(0)\n\t// fire and forget the metric\n\tgo c.putMetricData(activePercent)\n}", "title": "" }, { "docid": "471eda6ee866a874433692bf8d2b1c0e", "score": "0.48083112", "text": "func (g Guitar) Play() {\n\tfmt.Printf(\"Tzzzzouuuuiiiing with %d strings\\n\", g.Strings)\n}", "title": "" }, { "docid": "e268cc3378fcdefdea89f18fdfd1e279", "score": "0.47902635", "text": "func recordGCDuration(duration time.Duration) {\n\tstorage.PromGCDurationMilliseconds.Observe(float64(duration.Nanoseconds()) / float64(time.Millisecond))\n}", "title": "" }, { "docid": "d107b34ff557f1604c12cf58a1c6c532", "score": "0.47706586", "text": "func (g *gauge) flush(w io.Writer, prefix string) {\n\tfmt.Fprintf(w, \"%s %.2f %d\\n\", prefix+g.Name(), g.Get(), time.Now().Unix())\n}", "title": "" }, { "docid": "5e150ad0cc1410fab1babb8b64f877ad", "score": "0.47493592", "text": "func Example_drawContinuously() {\n\t// Need proper initialization on real code.\n\tvar (\n\t\tdevice tile.Device\n\t\t// Important to set timeout to context when requiring ack.\n\t\ttimeout time.Duration\n\t\t// Interval between frames.\n\t\tinterval time.Duration\n\t\t// Function to return the next frame.\n\t\tnextFrame func() tile.ColorBoard\n\t)\n\n\tconn, err := device.Dial()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer conn.Close()\n\n\tfor range time.Tick(interval) {\n\t\t// Use lambda to make sure defer works as expected.\n\t\tfunc() {\n\t\t\tctx, cancel := context.WithTimeout(context.Background(), timeout)\n\t\t\tdefer cancel()\n\t\t\tif err := device.SetColors(\n\t\t\t\tctx,\n\t\t\t\tconn,\n\t\t\t\tnextFrame(),\n\t\t\t\t0, // fade in duration\n\t\t\t\ttrue, // ack\n\t\t\t); err != nil {\n\t\t\t\tlog.Fatal(err)\n\t\t\t}\n\t\t}()\n\t}\n}", "title": "" }, { "docid": "08a2a5248316612afffb9a25450c8df3", "score": "0.47429115", "text": "func (n *Step) Play() {\n\t*n = Step(true)\n}", "title": "" }, { "docid": "a46c6e9f084394d9b33b33c95d80b03d", "score": "0.47059095", "text": "func (p *Pilot) Tick(ctx context.Context) {\n\tselect {\n\tcase rtConf := <-p.rtConfChan:\n\t\tp.rtConf = rtConf\n\t\tbreak\n\tcase <-ctx.Done():\n\t\treturn\n\t}\n\n\tconf := p.getRepresentation()\n\tpilotMetrics := p.metricsRegistry.Data()\n\n\tp.routinesPool.GoCtx(func(ctxRt context.Context) {\n\t\tp.sendData(ctxRt, conf, pilotMetrics)\n\t})\n\n\tticker := time.NewTicker(pilotTimer)\n\tfor {\n\t\tselect {\n\t\tcase tick := <-ticker.C:\n\t\t\tlog.WithoutContext().Debugf(\"Send to pilot: %s\", tick)\n\n\t\t\tconf := p.getRepresentation()\n\t\t\tpilotMetrics := p.metricsRegistry.Data()\n\n\t\t\tp.routinesPool.GoCtx(func(ctxRt context.Context) {\n\t\t\t\tp.sendData(ctxRt, conf, pilotMetrics)\n\t\t\t})\n\t\tcase rtConf := <-p.rtConfChan:\n\t\t\tp.rtConf = rtConf\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "170905dbcb0cd5455569a72481038d07", "score": "0.4692905", "text": "func (*liveClock) Tick(d time.Duration) <-chan time.Time { return time.Tick(d) }", "title": "" }, { "docid": "d4076e7fe224234d06c3fc39ed3d15d2", "score": "0.4673165", "text": "func (d *DevNull) Timer(key string, value time.Duration, rate float32) {}", "title": "" }, { "docid": "56f6a7aa25338c469b600fecb1003151", "score": "0.46426916", "text": "func (p *PumpImp) Run(sec int) {\n\tp.On()\n\tdelaySec(time.Duration(sec))\n\tp.Off()\n}", "title": "" }, { "docid": "cf10325e8090a66b6565c5499e4508e3", "score": "0.46366262", "text": "func (c *Client) Gauge(name string, value int64) error {\n\tif value < 0 {\n\t\treturn errors.New(\"Gauge value must be >= 0\")\n\t}\n\tstat := fmt.Sprintf(\"%d|g\", value)\n\treturn c.send(name, stat)\n}", "title": "" }, { "docid": "b12dc8c60cbdc8432abb0e2a9df97577", "score": "0.46303877", "text": "func (ma *meterArbiter) tick() {\n for {\n select {\n case <-ma.ticker.C:\n ma.tickMeters()\n }\n }\n}", "title": "" }, { "docid": "558a39398267f553a3a32150642569e2", "score": "0.46278414", "text": "func (c *CloudWatchReporter) ReportActivePercent(ctx context.Context, interval time.Duration) {\n\tticker := time.NewTicker(interval)\n\tdefer ticker.Stop()\n\tfor ctx.Err() == nil {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\tbreak\n\t\tcase <-ticker.C:\n\t\t\tc.report()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7ce7075926429eb79fe70e571bd08b2c", "score": "0.4626024", "text": "func (NilGauge) Update(v int64) {}", "title": "" }, { "docid": "752d4fb0684988c8da39277ac1861481", "score": "0.4625589", "text": "func (_m *Gauge) SetToCurrentTime() {\n\t_m.Called()\n}", "title": "" }, { "docid": "8eeb902861ef67752d9eb492858ef2c9", "score": "0.46230248", "text": "func (m *Metrics) Gauge(name string, value interface{}) (err error) {\n\treturn m.Backend.Report(\"gauge\", name, value)\n}", "title": "" }, { "docid": "bb1a63be4e9a1a3a046a5de0bff1809f", "score": "0.46169025", "text": "func (s *Statsd) Gauge(key string, value int64) error {\n\tif s != nil && s.statsd != nil {\n\t\terr := s.statsd.Gauge(key, value, sampleRate)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d6f913513ddd7f01ff9635c2e56d09fd", "score": "0.46027917", "text": "func (e Expvar) Gauge(name string, help ...string) StatGauge { return expvar.NewFloat(name) }", "title": "" }, { "docid": "fc899c3e6187bbcb3e3575a230460253", "score": "0.46003598", "text": "func (board *Board) Tick() {\n\tif board.current_gen == 0 {\n\t\tboard.initialPattern()\n\t} else {\n\t\tboard.update()\n\t}\n\n\tboard.current_gen++\n}", "title": "" }, { "docid": "7502a6af86c82d55608fa4ca45bf2317", "score": "0.4591428", "text": "func (s *BufferedStatsd) Gauge(name string, value float64, rate float32, tags ...string) {\n\tname += formatTags(tags)\n\t_ = s.client.Gauge(name, int64(value), rate)\n}", "title": "" }, { "docid": "2a2a497cc3129167e61be77690051a45", "score": "0.4588977", "text": "func (d *Device) Pause() {\n\td.val = d.hub.PauseTimer()\n}", "title": "" }, { "docid": "74104fbcb09b0ef4ccf994afcfb81372", "score": "0.45851654", "text": "func main() {\n //Field is created with a set width and height\n l := NewLife(40, 15)\n //Game will execute for 299 steps. Can be changed.\n for i := 0; i < 300; i++ {\n l.Step()\n //Clears the field on new step\n fmt.Print(\"\\x0c\", l)\n time.Sleep(time.Second / 30)\n }\n}", "title": "" }, { "docid": "d5166ee4c32f35019b5a8f4e8200a1e8", "score": "0.45784935", "text": "func (s *Sensor) Loop() {\n\tfor {\n\t\ts.render()\n\t\ttime.Sleep(250 * time.Millisecond)\n\t}\n}", "title": "" }, { "docid": "bc50f4a0752111c07fe156c16d7582f9", "score": "0.457145", "text": "func (c *Client) DecrementGauge(stat string, value int, rate float64) error {\n\treturn c.send(stat, rate, \"-%d|g\", value)\n}", "title": "" }, { "docid": "3a5b2b79eadb5c05de1d56b87d1473a7", "score": "0.45684364", "text": "func (c *Client) ChangeGauge(bucket string, delta int) {\n\tif c.muted {\n\t\treturn\n\t}\n\tif delta == 0 {\n\t\treturn\n\t}\n\n\tc.mu.Lock()\n\tl := len(c.buf)\n\tc.appendBucket(bucket)\n\tif delta > 0 {\n\t\tc.appendByte('+')\n\t}\n\tc.gauge(delta)\n\tc.flushIfBufferFull(l)\n\tc.mu.Unlock()\n}", "title": "" }, { "docid": "12b399fc036a21156f6f4a9c7be00119", "score": "0.4564998", "text": "func Gauge(name string, val float64) error {\n\treturn Client.Gauge(name, val, nil, 1)\n}", "title": "" }, { "docid": "09ff39a539f47878b3d10569b5e9baff", "score": "0.45618358", "text": "func gather(c *plank.Controller) {\n\ttick := time.Tick(30 * time.Second)\n\tsig := make(chan os.Signal, 1)\n\tsignal.Notify(sig, os.Interrupt, syscall.SIGTERM)\n\n\tfor {\n\t\tselect {\n\t\tcase <-tick:\n\t\t\tstart := time.Now()\n\t\t\tc.SyncMetrics()\n\t\t\tlogrus.WithField(\"metrics-duration\", fmt.Sprintf(\"%v\", time.Since(start))).Debug(\"Metrics synced\")\n\t\tcase <-sig:\n\t\t\tlogrus.Debug(\"Plank gatherer is shutting down...\")\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4fd373c2d73dd01b2e0e19cd142d9114", "score": "0.45616978", "text": "func (g *Game) Tick() {\n}", "title": "" }, { "docid": "74ee1dee1377d3e07bd152da63614422", "score": "0.45608205", "text": "func RunClock() {\n\tfor run {\n\t\ttime.Sleep(100 * time.Millisecond * 60)\n\t\tmodels.RunningClock.Progress()\n\t}\n}", "title": "" }, { "docid": "35ae4a691c070a16cd4cbe04e5c02d9f", "score": "0.4559566", "text": "func (t *Timer) Tick() {\n\tnow := t.clock.Now()\n\tt.mu.Lock()\n\tdefer t.mu.Unlock()\n\tif t.paused {\n\t\treturn\n\t}\n\ts, exp := t.setting.At(now)\n\tt.setting = s\n\tif exp > 0 {\n\t\tif newS, ok := t.listener.NotifyTimer(exp, t.setting); ok {\n\t\t\tt.setting = newS\n\t\t}\n\t}\n\tt.resetKickerLocked(now)\n}", "title": "" }, { "docid": "f5b01201391a01dcf31d5f8abae30b6f", "score": "0.4557821", "text": "func (m *Metric) Gauge(value float64) error {\n\treturn m.client.Report(m.name, value, Gauge, *m.client.rate, m.tags...)\n}", "title": "" }, { "docid": "6ee41922ecc39f2f5113b65ae87a9ddf", "score": "0.45554855", "text": "func (c *collector) run() {\n\tc.outputStats()\n\n\t// Gauges are a 'snapshot' rather than a histogram. Pausing for some interval\n\t// aims to get a 'recent' snapshot out before statsd flushes metrics.\n\ttick := time.NewTicker(c.pauseDur)\n\tdefer tick.Stop()\n\tfor {\n\t\tselect {\n\t\tcase <-tick.C:\n\t\t\tc.outputStats()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f9a8fc90426b033d1af56efb1e44b9f1", "score": "0.454214", "text": "func (g *Gauge) Update(value int64) {\n\tg.gauge.Set(float64(value))\n}", "title": "" }, { "docid": "af378ceff119ece1fafb8766bd6c88f4", "score": "0.4538395", "text": "func (c *Client) DecrementGauge(stat string, value int, rate float64) error {\n\treturn c.send(stat, rate, \"-\"+strconv.Itoa(value)+\"|g\")\n}", "title": "" }, { "docid": "d0bfbc009b9bc6899d58227f5cfcdf2a", "score": "0.45336622", "text": "func (ga *Game) Drive() {\n\tga.currentFrame++\n\tga.currentRunLoop()\n}", "title": "" }, { "docid": "4c8e21e0fe5654f63b2ef5849a5f6887", "score": "0.45239076", "text": "func (_m *Gauge) Inc() {\n\t_m.Called()\n}", "title": "" }, { "docid": "4c8e21e0fe5654f63b2ef5849a5f6887", "score": "0.45239076", "text": "func (_m *Gauge) Inc() {\n\t_m.Called()\n}", "title": "" }, { "docid": "f74a056039fd15db41aaf5236f56a74f", "score": "0.45226446", "text": "func (g *AggregatedGauge) Value(val float64) {\n\tg.valueNow(val, time.Now())\n}", "title": "" }, { "docid": "e1d091d5e3aee5289e8e982eae49af05", "score": "0.45210826", "text": "func watch(rotate chan struct{}, interval int) {\n\tfor {\n\t\tnow := time.Now().UTC()\n\t\tswitch now.Minute() % interval {\n\t\tcase 0:\n\t\t\trotate <- struct{}{}\n\t\t\ttime.Sleep(time.Minute)\n\t\tdefault:\n\t\t\ttime.Sleep(time.Second)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "38af1c64e533ec6a28ceea75e473f683", "score": "0.4517959", "text": "func playgob(playctrlchan chan string) {\n\tvar state = \"stopped\"\n\tvar file *os.File\n\tvar path = \"static/clips/\"\n\tvar decoder *gob.Decoder\n\tdefer func() {\n\t\tfile.Close()\n\t}()\n\tvar err error\n\tticker := time.NewTicker(time.Millisecond * 25)\n\n\t//\tvar cnt = 0\n\tfor {\n\t\tselect {\n\t\tcase filename := <-namechan:\n\t\t\tif state == \"playing\" {\n\t\t\t\tfmt.Println(\"Canceled Play\")\n\t\t\t\tfile.Close()\n\t\t\t\tstate = \"stopped\"\n\t\t\t}\n\t\t\tfile, err = os.Open(path + filename)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"Could not open file: %s\", err.Error())\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tdecoder = gob.NewDecoder(file)\n\n\t\t\tfmt.Println(\"Changed state to playing for file: \" + filename)\n\t\t\tstate = \"playing\"\n\t\tcase ctrl := <-playctrlchan:\n\t\t\tif ctrl == \"stop\" {\n\t\t\t\tif state == \"playing\" {\n\t\t\t\t\tfmt.Println(\"Canceled Play\")\n\t\t\t\t\tfile.Close()\n\t\t\t\t\tstate = \"stopped\"\n\n\t\t\t\t}\n\t\t\t}\n\t\tcase <-ticker.C:\n\t\t\tif state == \"playing\" {\n\t\t\t\tgoblet := new(media.RTCSample)\n\n\t\t\t\terr = decoder.Decode(goblet)\n\t\t\t\tif err != nil {\n\t\t\t\t\tif err.Error() == \"EOF\" {\n\t\t\t\t\t\tfile.Seek(0, 0)\n\t\t\t\t\t\tfmt.Println(\"Looping\")\n\t\t\t\t\t\tdecoder = gob.NewDecoder(file)\n\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfmt.Printf(\"Decode GOB Error: %s\", err.Error())\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tvp8Track.Samples <- *goblet\n\t\t\t}\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "3880c00fb79fe7317b94ab9c87fb8bc8", "score": "0.4517909", "text": "func (recv *ProgressBar) Pulse() {\n\tC.gtk_progress_bar_pulse((*C.GtkProgressBar)(recv.native))\n\n\treturn\n}", "title": "" }, { "docid": "136a1c1bb56c0c0909c97e7e411b1314", "score": "0.45116755", "text": "func (chip_8 *chip_8_VM) soundTimerTick() {\n\tif chip_8.SoundTimer > 0 {\n\t\tif chip_8.SoundTimer == 1 {\n\t\t\tchip_8.audioChan <- struct{}{}\n\t\t}\n\t\tchip_8.SoundTimer--\n\t}\n}", "title": "" }, { "docid": "d967ce600c21514376c37f18f3cb6598", "score": "0.44970384", "text": "func (cp *CP) WatchDog(timeout time.Duration) {\n\tfor ; true; <-time.Tick(timeout) {\n\t\tcp.mu.Lock()\n\t\tupdate := cp.txnId != 0 && cp.clock.Since(cp.meterUpdated) > timeout\n\t\tcp.mu.Unlock()\n\n\t\tif update {\n\t\t\tInstance().TriggerMeterValuesRequest(cp.ID(), cp.Connector())\n\t\t}\n\t}\n}", "title": "" }, { "docid": "652adc86b46314fda0ed4e2ddc489e32", "score": "0.44918185", "text": "func (eg ElectricGuitar) Play() string {\n\treturn eg.guitar.Play() + \" Amplified\"\n}", "title": "" }, { "docid": "29736146ad33179fb1fc33b7cf1eb001", "score": "0.44898933", "text": "func FGauge(stat string, value float64) {\n\tFGaugeWithSampling(stat, value, config.SampleRate)\n}", "title": "" }, { "docid": "8389dc476c59396d02195d84d61087bf", "score": "0.4472831", "text": "func gameLoop() {\n\tlast := time.Now()\n\n\ttick := time.Tick(frameRate)\n\tfor !global.gWin.Closed() {\n\n\t\tif global.gWin.Pressed(pixelgl.KeyQ) {\n\t\t\tbreak\n\t\t}\n\t\tif global.gWin.Pressed(pixelgl.KeySpace) {\n\t\t\ttileX, tileY := CastleRoomMap.GetTileIndex(gHero.GetFacedTileCoords())\n\t\t\ttrigger := CastleRoomMap.GetTrigger(tileX, tileY)\n\t\t\tif trigger.OnUse != nil {\n\t\t\t\ttrigger.OnUse(gHero.mEntity)\n\t\t\t}\n\t\t}\n\n\t\tglobal.gWin.Clear(global.gClearColor)\n\n\t\tselect {\n\t\tcase <-tick:\n\t\t\tdt := time.Since(last).Seconds()\n\t\t\tlast = time.Now()\n\n\t\t\tCastleRoomMap.DrawAfter(1, func(canvas *pixelgl.Canvas) {\n\t\t\t\tgHero.mEntity.TeleportAndDraw(*CastleRoomMap, canvas)\n\t\t\t})\n\n\t\t\tgHero.mController.Update(dt)\n\t\t}\n\n\t\tglobal.gWin.Update()\n\t}\n}", "title": "" }, { "docid": "b5a127d69f6a1959203426bed2274a59", "score": "0.44655332", "text": "func (m *Metrics) GaugeDecrement(name string) {\n\tm.gauges[name].Dec()\n}", "title": "" }, { "docid": "7ef827f0fb21a0dec130577375249a0f", "score": "0.44651958", "text": "func Gauge(name string, value int64) {\n\tif err := getConnection(); err != nil {\n\t\treturn\n\t}\n\n\tsuffix := \":\" + strconv.FormatInt(value, 10) + \"|g\"\n\n\tconn.Write([]byte(name + suffix))\n\n\t// Send a host suffixed stat too.\n\tif AlsoAppendHost {\n\t\tconn.Write([]byte(name + \".\" + host + suffix))\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "d66901e239037e814f697457f4e54a72", "score": "0.4455813", "text": "func (b *Blink) Control() {\n\tfor {\n\t\tfor d := 500; d < 2000; d += 100 {\n\t\t\tb.Delay = d\n\t\t\tdelay.Milliseconds(2 * d)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e61542b103690908491152177be5574c", "score": "0.44552818", "text": "func (NilGaugeFloat64) Update(v float64) {}", "title": "" }, { "docid": "8b4d8d5099ca0bdcb9a7bec374f23d6f", "score": "0.44402727", "text": "func (c *Client) GaugeWithSampling(stat string, value int64, sampleRate float32) error {\n\tif err := checkSampleRate(sampleRate); err != nil {\n\t\treturn err\n\t}\n\n\tif !shouldFire(sampleRate) {\n\t\treturn nil // ignore this call\n\t}\n\n\tif value < 0 {\n\t\tc.send(stat, 0, \"g\", 1)\n\t}\n\n\treturn c.send(stat, value, \"g\", sampleRate)\n}", "title": "" }, { "docid": "10e023f4edf4f6ec260aa8e86c26e292", "score": "0.44387662", "text": "func generator(r *RandomCodeGenerator) {\n\ttimer := time.NewTimer(0)\n\n\tfor {\n\t\tr.mu.Lock()\n\n\t\t// set values and start timer\n\t\tr.current = randString(r.Length)\n\t\ttimer.Reset(r.duration)\n\t\tr.expires = time.Now().Add(r.duration)\n\n\t\tr.mu.Unlock()\n\n\t\t// wait duration\n\t\t<-timer.C\n\t}\n}", "title": "" }, { "docid": "6f832927b9220daceee5ac4d80fd74db", "score": "0.44352454", "text": "func (i *Statsd) Gauge(name string, value int) {\n\ti.client.Gauge(i.handlePrefix(name), int64(value))\n\t//usageSent.Gauge()\n}", "title": "" }, { "docid": "df31ebbd0bd0482e9752b7f53346996f", "score": "0.44338033", "text": "func GaugeDelta(stat string, value int64) {\n\tGetStatter().GaugeDelta(stat, value, rate)\n}", "title": "" }, { "docid": "82aff1ea3649b364f409e5401c695988", "score": "0.44154975", "text": "func (mf *MetricFactory) GaugeDec(name string) {\n\tif _, ok := mf.registeredGauges[name]; !ok {\n\t\treturn\n\t}\n\tmf.registeredGauges[name].Decrement()\n}", "title": "" }, { "docid": "ecd518760eb3ede9a43e11ef6899a41c", "score": "0.4413725", "text": "func (i *Data) watch() {\n\tfor {\n\t\ttime.Sleep(i.halfTimeout)\n\t\ti.generateValues()\n\t}\n}", "title": "" }, { "docid": "5fe14ca074cedebb7bbeb8db1cf90c27", "score": "0.44113424", "text": "func (g *Gauge) Update(v int64) {\n\tatomic.StoreInt64(&g.value, v)\n}", "title": "" }, { "docid": "5fe14ca074cedebb7bbeb8db1cf90c27", "score": "0.44113424", "text": "func (g *Gauge) Update(v int64) {\n\tatomic.StoreInt64(&g.value, v)\n}", "title": "" }, { "docid": "faa7904b7fec4c5d2e9a92ec6825a8a0", "score": "0.44077134", "text": "func (t *Timer) Unit(u time.Duration) {\n\tt.u = u\n}", "title": "" }, { "docid": "756cb1d9ac2f1d2bf7a810236447870c", "score": "0.440076", "text": "func (c *Clock) Advance(d time.Duration) {\n\tc.now = c.now.Add(d)\n}", "title": "" }, { "docid": "a31ae287f19cb63d70624a88cd60f78e", "score": "0.43956044", "text": "func (s *Statsd) Gauge(name string, value float64, rate float32, tags ...string) {\n\tname += formatTags(tags)\n\t_ = s.client.Gauge(name, int64(value), rate)\n}", "title": "" }, { "docid": "c6803ccf9852e456a8eb850e27b0e145", "score": "0.43944824", "text": "func (c *Client) Timing(bucket string, value int, rate float32) {\n\tif c.muted {\n\t\treturn\n\t}\n\tif isRandAbove(rate) {\n\t\treturn\n\t}\n\n\tc.mu.Lock()\n\tl := len(c.buf)\n\tc.appendBucket(bucket)\n\tc.appendInt(value)\n\tc.appendType(\"ms\")\n\tc.appendRate(rate)\n\tc.closeMetric()\n\tc.flushIfBufferFull(l)\n\tc.mu.Unlock()\n}", "title": "" }, { "docid": "51579439066d3193fe5bf4b75d45380b", "score": "0.43915218", "text": "func (c *commander) gaugeWorker() bool {\n\tfmt.Print(\"Gauging worker frequency... \")\n\ttmr := time.Now()\n\t_, err := exec.Command(\"bash\", \"-c\", c.comp + \" -n 0 -c m=\" + strconv.Itoa(c.gauge) + \" \" + c.prog).Output()\n\tdiff := float64(time.Now().Sub(tmr).Seconds())\n\tc.opcap = int(float64(c.fac[c.gauge]) / diff)\n\tfmt.Print(string(27) + \"[1A:\\r\\033[2K\")\n\tif err != nil && (err.Error() == \"exit status 30\" || err.Error() == \"exit status 20\") {\n\t\terr = nil\n\t}\n\treturn c.hand(err, \"Error occurred while gauging worker frequency\", \"Gauged \\t\" + strconv.Itoa(c.opcap))\n}", "title": "" }, { "docid": "07b84c87c1300a2064f54f5a564c4e73", "score": "0.43847713", "text": "func (g *GPU) Step(cycles uint) {\n\tif g.bus == nil {\n\t\tpanic(\"Please initialize gpu with Init, before running.\")\n\t}\n\tg.updateMode()\n\n\tg.clock += cycles\n\n\tif !g.lcdEnabled() {\n\t\treturn\n\t}\n\tif g.clock >= CyclePerLine {\n\t\tif g.ly == constants.ScreenHeight {\n\t\t\tg.buildSprites()\n\t\t\tg.irq.SetIRQ(irq.VerticalBlankFlag)\n\t\t\tif g.vBlankInterruptEnabled() {\n\t\t\t\tg.irq.SetIRQ(irq.LCDSFlag)\n\t\t\t}\n\t\t} else if g.ly >= constants.ScreenHeight+LCDVBlankHeight {\n\t\t\tg.ly = 0\n\t\t\tg.buildBGTile()\n\t\t} else if g.ly < constants.ScreenHeight {\n\t\t\tg.buildBGTile()\n\t\t\tif g.windowEnabled() {\n\t\t\t\tg.buildWindowTile()\n\t\t\t}\n\t\t}\n\n\t\tif g.ly == uint(g.lyc) {\n\t\t\tg.stat |= 0x04\n\t\t\tif g.coincidenceInterruptEnabled() {\n\t\t\t\tg.irq.SetIRQ(irq.LCDSFlag)\n\t\t\t}\n\t\t} else {\n\t\t\tg.stat &= 0xFB\n\t\t}\n\t\tg.ly++\n\t\tg.clock -= CyclePerLine\n\t}\n}", "title": "" }, { "docid": "785b8de79fff4e0ba80df4f5dce4af3c", "score": "0.43810648", "text": "func (p *Probe) loop() {\n\tdefer close(p.stopped)\n\n\tif p.prober.spread && p.initialDelay > 0 {\n\t\tt := p.prober.newTicker(p.initialDelay)\n\t\tselect {\n\t\tcase <-t.Chan():\n\t\t\tp.run()\n\t\tcase <-p.ctx.Done():\n\t\t\tt.Stop()\n\t\t\treturn\n\t\t}\n\t\tt.Stop()\n\t} else {\n\t\tp.run()\n\t}\n\n\tif p.prober.once {\n\t\treturn\n\t}\n\n\tp.tick = p.prober.newTicker(p.interval)\n\tdefer p.tick.Stop()\n\tfor {\n\t\tselect {\n\t\tcase <-p.tick.Chan():\n\t\t\tp.run()\n\t\tcase <-p.ctx.Done():\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "785b8de79fff4e0ba80df4f5dce4af3c", "score": "0.43810648", "text": "func (p *Probe) loop() {\n\tdefer close(p.stopped)\n\n\tif p.prober.spread && p.initialDelay > 0 {\n\t\tt := p.prober.newTicker(p.initialDelay)\n\t\tselect {\n\t\tcase <-t.Chan():\n\t\t\tp.run()\n\t\tcase <-p.ctx.Done():\n\t\t\tt.Stop()\n\t\t\treturn\n\t\t}\n\t\tt.Stop()\n\t} else {\n\t\tp.run()\n\t}\n\n\tif p.prober.once {\n\t\treturn\n\t}\n\n\tp.tick = p.prober.newTicker(p.interval)\n\tdefer p.tick.Stop()\n\tfor {\n\t\tselect {\n\t\tcase <-p.tick.Chan():\n\t\t\tp.run()\n\t\tcase <-p.ctx.Done():\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3e6beea6dc3f657e258df51e6d474690", "score": "0.43809134", "text": "func (t *Clock) Tick() {\n\tt.c <- Tick(1)\n}", "title": "" }, { "docid": "36006ae0c94ff5cdf221ebe5a5d6a28d", "score": "0.4375295", "text": "func (_m *Backend) Gauge(ctx context.Context, name string, value float64, tags []string, rate float64) error {\n\tret := _m.Called(ctx, name, value, tags, rate)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(context.Context, string, float64, []string, float64) error); ok {\n\t\tr0 = rf(ctx, name, value, tags, rate)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "d2423898d001e263647903c60890b99b", "score": "0.43746963", "text": "func (*liveClock) After(d time.Duration) <-chan time.Time { return time.After(d) }", "title": "" }, { "docid": "589708e26c9502c8a8179efafab6e79c", "score": "0.43739069", "text": "func (t *Ring) Tick() {\n}", "title": "" }, { "docid": "fa741f53de9be5ca7f21cd997f49a34e", "score": "0.4367052", "text": "func (_m *Gauge) Dec() {\n\t_m.Called()\n}", "title": "" }, { "docid": "fa741f53de9be5ca7f21cd997f49a34e", "score": "0.4367052", "text": "func (_m *Gauge) Dec() {\n\t_m.Called()\n}", "title": "" }, { "docid": "e8951106fb1d61030de86c2214c7b0a4", "score": "0.43667606", "text": "func UpdateGauge(key []string, value int64) {\n\td := metric{\n\t\tType: \"gauge\",\n\t\tKey: key,\n\t\tValue: float64(value),\n\t}\n\n\temm.metricsChan <- d\n}", "title": "" }, { "docid": "7c947e6ff174f925ac75c1f5398c74d6", "score": "0.43609118", "text": "func (s *Statsd) Gauge(name string, v float64, tags [][2]string) {\n\t_ = s.client.Gauge(name, int64(v), 1.0, toTags(tags)...)\n}", "title": "" }, { "docid": "4a77d88d9f47b83b605aefa860b46360", "score": "0.43534443", "text": "func (*liveClock) Sleep(d time.Duration) { time.Sleep(d) }", "title": "" }, { "docid": "53e43f3ef7ff4a0da220391d520d79d6", "score": "0.43505782", "text": "func (r *Reporter) Gauge(metricName string, value float64, tags metrics.Tags) error {\n\tr.logger.Logf(log.TraceLevel, \"Gauge metric: %s\", tags)\n\treturn nil\n}", "title": "" }, { "docid": "3939f21d47792b22e2fa57ace160baca", "score": "0.4350528", "text": "func (c *Client) IncrementGauge(stat string, value int, rate float64) error {\n\treturn c.send(stat, rate, \"+\"+strconv.Itoa(value)+\"|g\")\n\t// return c.send(stat, rate, \"+%d|g\", value)\n}", "title": "" }, { "docid": "9e5e0e6830de1aa64c5b8feb87ef42d6", "score": "0.43464002", "text": "func (f *FakeClock) Step(d time.Duration) {\n\tf.lock.Lock()\n\tdefer f.lock.Unlock()\n\tf.setTimeLocked(f.time.Add(d))\n}", "title": "" }, { "docid": "dcc1de3493f7e9bd5c4a727be921c90b", "score": "0.43427727", "text": "func (g *GameBoy) Tick() (res TickResult) {\n\tg.ticks++\n\n\t// Poll events 1000 times per second.\n\tif g.ticks%4000 == 0 {\n\t\tsdl.Do(func() {\n\t\t\tfor event := sdl.PollEvent(); event != nil; event = sdl.PollEvent() {\n\t\t\t\teventType := event.GetType()\n\t\t\t\tswitch eventType {\n\n\t\t\t\t// Button presses and UI keys\n\t\t\t\tcase sdl.KEYDOWN, sdl.KEYUP:\n\t\t\t\t\tkeyEvent := event.(*sdl.KeyboardEvent)\n\t\t\t\t\tkeyCode := keyEvent.Keysym.Sym\n\n\t\t\t\t\tif action := g.Controls[keyCode]; action != nil {\n\t\t\t\t\t\taction(eventType)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlog.Infof(\"unknown key code %v\", keyCode)\n\t\t\t\t\t}\n\n\t\t\t\t// Window-closing event\n\t\t\t\tcase sdl.QUIT:\n\t\t\t\t\tres.Quit = true\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n\n\t// CPU ticks occur every 4 machine ticks.\n\tif g.ticks%4 == 0 {\n\t\tg.CPU.Tick()\n\t}\n\n\t// DMA ticks occur every 4 machine ticks.\n\tif g.ticks%4 == 0 {\n\t\tg.DMA.Tick()\n\t}\n\n\t// PPU ticks occur every machine tick.\n\tg.PPU.Tick()\n\n\t// Timer tick occur every machine tick.\n\tg.Timer.Tick()\n\n\t// APU ticks occur only when we need to generate the next sample.\n\t// Note that the Gameboy machine frequency is not an exact multiple of the\n\t// sound output frequency, so this is in fact an approximation. So long as\n\t// no one can hear the difference, let's call it good enough.\n\tif g.ticks%apu.SoundOutRate == 0 {\n\t\tres.Left, res.Right = g.APU.Tick()\n\t\tres.Play = true\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "cb1274d72524a5899702dff2a604f121", "score": "0.43328115", "text": "func (o *heartBeat) beat(app *tview.Application, i uint32) {\n\tgo func() {\n\t\tupdateText(app, o.tv, fmt.Sprintf(\" %s %d\", wH, i))\n\t\ttime.Sleep(300 * time.Millisecond)\n\t\tupdateText(app, o.tv, fmt.Sprintf(\" %s %d\", bH, i))\n\t}()\n}", "title": "" }, { "docid": "e67a2d7bde3a504d5f0440297d3ec74e", "score": "0.43316415", "text": "func (g *Gauge) Update(v float64) {\n\tatomic.StoreUint64(&g.value, math.Float64bits(v))\n}", "title": "" } ]
75ff18a37e23f54a126c95b85eb415ce
get serverAddress from config
[ { "docid": "2ecd783a171150e7664471e8fc32fdd8", "score": "0.73767203", "text": "func getServerAddress() string {\n\tvar conf ConfigInfo\n\tif _, err := os.Stat(dir + SELF_CONF_FILE); os.IsNotExist(err) {\n\t\treturn `127.0.0.1:7000`\n\t}\n\t_, err := toml.DecodeFile(dir+SELF_CONF_FILE, &conf)\n\tif err != nil {\n\t\treturn `127.0.0.1:7000`\n\t}\n\treturn conf.ServerAddress\n}", "title": "" } ]
[ { "docid": "6f7a6cf12a7d19f9867934ae235a2a54", "score": "0.7320376", "text": "func (rsc *RServerConfig) GetAddress() string {\n\td := rsc.GetConfigData()\n\tif d == nil {\n\t\t//panic(\"config data was nil\")\n\t\treturn \":7777\"\n\t}\n\treturn \":\" + d.Port\n}", "title": "" }, { "docid": "1d56597deae83be3d0fa6004c687ac0b", "score": "0.711843", "text": "func GetAddr() string {\n\treturn configManager.GetString(\"host\") + \":\" + configManager.GetString(\"port\")\n}", "title": "" }, { "docid": "27829e5e2b9b2d713de45d271e9f3e87", "score": "0.71156925", "text": "func (t *OpenconfigSystem_System_Aaa_ServerGroups_ServerGroup_Servers_Server_Config) GetAddress() string {\n\tif t == nil || t.Address == nil {\n\t\treturn \"\"\n\t}\n\treturn *t.Address\n}", "title": "" }, { "docid": "27829e5e2b9b2d713de45d271e9f3e87", "score": "0.71156925", "text": "func (t *OpenconfigSystem_System_Aaa_ServerGroups_ServerGroup_Servers_Server_Config) GetAddress() string {\n\tif t == nil || t.Address == nil {\n\t\treturn \"\"\n\t}\n\treturn *t.Address\n}", "title": "" }, { "docid": "2e34ed466c9e73c7897cf6e46f737602", "score": "0.70539415", "text": "func (t *OpenconfigSystem_System_Ntp_Servers_Server_Config) GetAddress() string {\n\tif t == nil || t.Address == nil {\n\t\treturn \"\"\n\t}\n\treturn *t.Address\n}", "title": "" }, { "docid": "2e34ed466c9e73c7897cf6e46f737602", "score": "0.7053876", "text": "func (t *OpenconfigSystem_System_Ntp_Servers_Server_Config) GetAddress() string {\n\tif t == nil || t.Address == nil {\n\t\treturn \"\"\n\t}\n\treturn *t.Address\n}", "title": "" }, { "docid": "ad8817e8ef0cf3568fe38ef8facb56c8", "score": "0.7029891", "text": "func (c *ServerConfig) Address() string {\n\treturn fmt.Sprintf(\"%s:%d\", c.Host, c.Port)\n}", "title": "" }, { "docid": "1784036f11957873993158754fa01bf5", "score": "0.697178", "text": "func (t *OpenconfigSystem_System_Dns_Servers_Server_Config) GetAddress() string {\n\tif t == nil || t.Address == nil {\n\t\treturn \"\"\n\t}\n\treturn *t.Address\n}", "title": "" }, { "docid": "1784036f11957873993158754fa01bf5", "score": "0.69712216", "text": "func (t *OpenconfigSystem_System_Dns_Servers_Server_Config) GetAddress() string {\n\tif t == nil || t.Address == nil {\n\t\treturn \"\"\n\t}\n\treturn *t.Address\n}", "title": "" }, { "docid": "8d42d3e7c7ccc1d67442221142bd3408", "score": "0.69440395", "text": "func (authClient *AuthRPCClient) ServerAddr() string {\n\treturn authClient.config.serverAddr\n}", "title": "" }, { "docid": "304dfa9f84abfd90ed888e53665fc7af", "score": "0.6920209", "text": "func (c Config) GetAddress() string {\n\tif c.Address != \"\" {\n\t\treturn c.Address\n\t}\n\tif c.Hostname != \"\" {\n\t\treturn fmt.Sprintf(\"%s:%s\", c.Hostname, c.PortOrDefault())\n\t}\n\treturn DefaultAddress\n}", "title": "" }, { "docid": "77040dd96ca9e5072d9da0544ff2b165", "score": "0.6895137", "text": "func (c *Config) Addr() string {\n\treturn net.JoinHostPort(c.Server.Host, fmt.Sprint(c.Server.Port))\n}", "title": "" }, { "docid": "c5ab484669c8ee92526ff3d1499712be", "score": "0.68719864", "text": "func (s *Server) GetAddr() string {\n\treturn s.cfg.AdvertiseClientUrls\n}", "title": "" }, { "docid": "d236c29ea88e4b9f376c1178cd6a4a71", "score": "0.6652658", "text": "func HTTPServerAddr() string {\n\treturn globalConfig.HTTPServerAddr\n}", "title": "" }, { "docid": "2dcc7233c7b32b0f384b676a8e55f023", "score": "0.6649955", "text": "func (b Backend) GetServerAddress() string {\n\treturn b.address\n}", "title": "" }, { "docid": "312ad0035bbdc6c36d245f88afa4f4e9", "score": "0.6589998", "text": "func ServerConfigForAddress(t *testing.T, addr string) *bootstrap.ServerConfig {\n\tt.Helper()\n\n\tjsonCfg := fmt.Sprintf(`{\n\t\t\"server_uri\": \"%s\",\n\t\t\"channel_creds\": [{\"type\": \"insecure\"}],\n\t\t\"server_features\": [\"xds_v3\"]\n\t}`, addr)\n\tsc, err := bootstrap.ServerConfigFromJSON([]byte(jsonCfg))\n\tif err != nil {\n\t\tt.Fatalf(\"Failed to create server config from JSON %s: %v\", jsonCfg, err)\n\t}\n\treturn sc\n}", "title": "" }, { "docid": "3193c1da0172164fbef712215187894e", "score": "0.6575042", "text": "func (s *session) serverAddress(server string) (string, error) {\n\tif addr, ok := s.ServerAddr[server]; ok {\n\t\treturn addr, nil\n\t}\n\tport, err := testutil.PickPort()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\ts.setServerAddress(server, \"localhost:\"+port)\n\treturn s.serverAddress(server)\n}", "title": "" }, { "docid": "01522335977b3a687d7b2bb05ab1c3ac", "score": "0.65737826", "text": "func (n *NodeUrl) GetServerAddr(ctx context.Context, in *pb.ServerRequest) (*pb.ServerRequestReply, error) {\n\tresponse := pb.ServerRequestReply{Addr: n.IP.String() + n.ContentPort}\n\treturn &response, nil\n}", "title": "" }, { "docid": "53f993bacbb52e01dbac7cc58c7edd81", "score": "0.65699327", "text": "func (c *Config) Addr() string {\n\treturn fmt.Sprintf(\"%s:%d\", c.BindHost, c.Port)\n}", "title": "" }, { "docid": "af906a0d457ff619fcf4ff092746d1d8", "score": "0.65437084", "text": "func (o GetServicesServiceNasConfigMountPointOutput) ServerAddr() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetServicesServiceNasConfigMountPoint) string { return v.ServerAddr }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "46bef5c1236a6c678c0275a3b0919320", "score": "0.6535173", "text": "func (o ServiceNasConfigMountPointOutput) ServerAddr() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ServiceNasConfigMountPoint) string { return v.ServerAddr }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "97c2f8bc9223842c0746fbddef35f9e7", "score": "0.6532037", "text": "func (t *GrpcManager) GetGrpcServerAddress() string {\n\treturn t.GetConfig().GetAddress()\n}", "title": "" }, { "docid": "d88f7c335ff583aaa4ddf37c0db7b474", "score": "0.65150154", "text": "func (ac appConfig) Address() string {\n\treturn fmt.Sprintf(\":%s\", ac.port)\n}", "title": "" }, { "docid": "db193ac6e3b5fe14ebaaca048e256480", "score": "0.6514781", "text": "func (c Config) ListenAddress() string {\n\treturn fmt.Sprintf(\"%s:%d\", c.Host, c.Port)\n}", "title": "" }, { "docid": "91744f9c33ec1cbda7af3248c3527cf3", "score": "0.6485398", "text": "func (t *OpenconfigSystem_System_Ntp_Servers_Server) GetAddress() string {\n\tif t == nil || t.Address == nil {\n\t\treturn \"\"\n\t}\n\treturn *t.Address\n}", "title": "" }, { "docid": "91744f9c33ec1cbda7af3248c3527cf3", "score": "0.64840114", "text": "func (t *OpenconfigSystem_System_Ntp_Servers_Server) GetAddress() string {\n\tif t == nil || t.Address == nil {\n\t\treturn \"\"\n\t}\n\treturn *t.Address\n}", "title": "" }, { "docid": "7cc3fb90de57b5e2aca320fffe387869", "score": "0.6433691", "text": "func (c *Config) BindAddr() string {\n\treturn getAddr(c.BindIP, c.BindPort)\n}", "title": "" }, { "docid": "151bce782318c42d618c726e8a1d3a02", "score": "0.64264613", "text": "func GetAddr(cr *api.PerconaServerMongoDB, pod, replset string) string {\n\treturn strings.Join([]string{pod, cr.Name + \"-\" + replset, cr.Namespace, cr.Spec.ClusterServiceDNSSuffix}, \".\") +\n\t\t\":\" + strconv.Itoa(int(api.DefaultMongodPort))\n}", "title": "" }, { "docid": "031cbefc324e545d44674e8dc6536449", "score": "0.6417751", "text": "func (c *SMTPConfig) Addr() string {\n\treturn net.JoinHostPort(c.host, strconv.Itoa(c.port))\n}", "title": "" }, { "docid": "b7cbb93b030ad1f3db25c7ac35388b68", "score": "0.6395417", "text": "func (c *Config) Address() string {\n\treturn net.JoinHostPort(\n\t\tconfig.GetString(\"host\"),\n\t\tstrconv.FormatInt(int64(config.GetInt(\"port\")), 10),\n\t)\n}", "title": "" }, { "docid": "1e21795649ec3012b685993b4ba23f6f", "score": "0.63636667", "text": "func (c *SMTPConfig) Addr() string {\n\tif c.Port > 0 {\n\t\treturn fmt.Sprintf(\"%s:%d\", c.Host, c.Port)\n\t}\n\treturn c.Host\n}", "title": "" }, { "docid": "9d3b52cd71131dbd950711f164dff0c2", "score": "0.6360625", "text": "func (t *OpenconfigSystem_System_Aaa_ServerGroups_ServerGroup_Servers_Server) GetAddress() string {\n\tif t == nil || t.Address == nil {\n\t\treturn \"\"\n\t}\n\treturn *t.Address\n}", "title": "" }, { "docid": "9d3b52cd71131dbd950711f164dff0c2", "score": "0.636", "text": "func (t *OpenconfigSystem_System_Aaa_ServerGroups_ServerGroup_Servers_Server) GetAddress() string {\n\tif t == nil || t.Address == nil {\n\t\treturn \"\"\n\t}\n\treturn *t.Address\n}", "title": "" }, { "docid": "8893ac36d700319ff2c1285b1225a742", "score": "0.63598627", "text": "func (lockRPC *LockRPCClient) ServerAddr() string {\n\turl := lockRPC.ServiceURL()\n\treturn url.Host\n}", "title": "" }, { "docid": "500bcb59f4b54156812cbd3a49a784ee", "score": "0.6358865", "text": "func (s *Service) GetAddress() string {\n\n\tswitch s.Name {\n\tcase GetContainerName(\"postgres\"):\n\t\treturn fmt.Sprintf(`postgres://%v:%v@%s:%v/postgres`, \"postgres\", \"postgres\", GetContainerName(\"postgres\"), s.Port)\n\tdefault:\n\t\treturn fmt.Sprintf(\"http://localhost:%v\", s.Port)\n\t}\n}", "title": "" }, { "docid": "008221f27b8f54402588517a53fc7780", "score": "0.6358627", "text": "func GetAddress(ctx *pulumi.Context) string {\n\treturn config.Get(ctx, \"consul:address\")\n}", "title": "" }, { "docid": "d28a55a0cba2be0f2b1ed6847ec7890c", "score": "0.6298839", "text": "func (s *ServerInfo) HTTPAddr() string {\n\treturn s.sopt.serverConf.HTTPListenAddr\n}", "title": "" }, { "docid": "0937b76e1a6d7b8e5feb0d2fab56ca02", "score": "0.62955266", "text": "func (c dnsConfig) addressOnly() string {\n\taddr, _, _ := net.SplitHostPort(c.ListenAddress)\n\treturn addr\n}", "title": "" }, { "docid": "0761f4c26f3ee5f5e50f8446423b209e", "score": "0.6294031", "text": "func (config DBConfig) Addr() string {\n\treturn config.Host + \":\" + strconv.Itoa(int(config.Port))\n}", "title": "" }, { "docid": "57f6041a71d238b3e54266f27468aeaa", "score": "0.6293131", "text": "func (r RedisOpts) GetAddr() string {\n\treturn fmt.Sprintf(\"%s:%d\", r.Host, r.Port)\n}", "title": "" }, { "docid": "3a3e225bd95bd28d2f5e8279a139ef10", "score": "0.62538326", "text": "func (t *OpenconfigSystem_System_Dns_Servers_Server) GetAddress() string {\n\tif t == nil || t.Address == nil {\n\t\treturn \"\"\n\t}\n\treturn *t.Address\n}", "title": "" }, { "docid": "3a3e225bd95bd28d2f5e8279a139ef10", "score": "0.6253685", "text": "func (t *OpenconfigSystem_System_Dns_Servers_Server) GetAddress() string {\n\tif t == nil || t.Address == nil {\n\t\treturn \"\"\n\t}\n\treturn *t.Address\n}", "title": "" }, { "docid": "8e156f354d64f8447821a57f9fdbb08e", "score": "0.62512404", "text": "func (s *Server) ServerConfig() *http.Server {\n\treturn s.srv.Config\n}", "title": "" }, { "docid": "78803c5af197b4fa79257755eb6c5f96", "score": "0.62256306", "text": "func (s *Server) address() string {\n\treturn fmt.Sprintf(\"%s:%s\", s.Hostname, s.HTTPPort)\n}", "title": "" }, { "docid": "fdee2acb51bd63673de0d448f6c15798", "score": "0.6221327", "text": "func (memDis *MemDiscovery) GetConfigServer() ([]string, error) {\n\tif memDis.IsInit == false {\n\t\terr := errors.New(packageInitError)\n\t\topenlogging.GetLogger().Error(packageInitError)\n\t\treturn nil, err\n\t}\n\n\tif len(memDis.ConfigServerAddresses) == 0 {\n\t\terr := errors.New(emptyConfigServerMembers)\n\t\topenlogging.GetLogger().Error(emptyConfigServerMembers)\n\t\treturn nil, err\n\t}\n\n\tif autoDiscoverable {\n\t\terr := memDis.RefreshMembers()\n\t\tif err != nil {\n\t\t\topenlogging.GetLogger().Error(\"refresh member is failed: \" + err.Error())\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\ttmpConfigAddrs := memDis.ConfigServerAddresses\n\t\tfor key := range tmpConfigAddrs {\n\t\t\tif !strings.Contains(memDis.ConfigServerAddresses[key], \"https\") && memDis.EnableSSL {\n\t\t\t\tmemDis.ConfigServerAddresses[key] = `https://` + memDis.ConfigServerAddresses[key]\n\n\t\t\t} else if !strings.Contains(memDis.ConfigServerAddresses[key], \"http\") {\n\t\t\t\tmemDis.ConfigServerAddresses[key] = `http://` + memDis.ConfigServerAddresses[key]\n\t\t\t}\n\t\t}\n\t}\n\n\terr := memDis.Shuffle()\n\tif err != nil {\n\t\topenlogging.GetLogger().Error(\"member shuffle is failed: \" + err.Error())\n\t\treturn nil, err\n\t}\n\n\tmemDis.RLock()\n\tdefer memDis.RUnlock()\n\topenlogging.GetLogger().Debugf(\"member server return %s\", memDis.ConfigServerAddresses[0])\n\treturn memDis.ConfigServerAddresses, nil\n}", "title": "" }, { "docid": "3678d08d60877cef6d2b0d8f3d75198e", "score": "0.62123096", "text": "func (s server) Address() string {\n\treturn s.server.Addr\n}", "title": "" }, { "docid": "48755405403f514eae0cf4b31f542db4", "score": "0.61978483", "text": "func (c *rabbitMQConfig) getAddress() string {\n\treturn fmt.Sprintf(\"amqp://%s:%s@%s:%s/\", c.User, c.Password, c.Host, c.Port)\n}", "title": "" }, { "docid": "1eaa1b4120bd8276c87f36aceaf98a55", "score": "0.61679673", "text": "func (s Server) Address() string {\n\treturn s.listener.Addr().String()\n}", "title": "" }, { "docid": "bf452f5ea1bce9707e909fa650773ca5", "score": "0.6154281", "text": "func RemoteProxyAddress() string {\n\tconfigMutex.RLock()\n\tdefer configMutex.RUnlock()\n\treturn config.RemoteProxyAddress\n}", "title": "" }, { "docid": "abd3b4080c6eeab7fc6fefb3ff7bdda4", "score": "0.6149022", "text": "func (x *Settings_ConsulConfiguration) GetAddress() string {\n\tif x != nil {\n\t\treturn x.Address\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "5b39dfbc3c5a9fedf0b59d833553ea8b", "score": "0.613184", "text": "func (c *Config) Address() string {\n\treturn c.Addr\n}", "title": "" }, { "docid": "f5553ab958470359ffa7508b4a1a91c3", "score": "0.6103167", "text": "func (s *smtpServer) Address() string {\n\treturn s.host + \":\" + s.port\n}", "title": "" }, { "docid": "f5553ab958470359ffa7508b4a1a91c3", "score": "0.6103167", "text": "func (s *smtpServer) Address() string {\n\treturn s.host + \":\" + s.port\n}", "title": "" }, { "docid": "f5553ab958470359ffa7508b4a1a91c3", "score": "0.6103167", "text": "func (s *smtpServer) Address() string {\n\treturn s.host + \":\" + s.port\n}", "title": "" }, { "docid": "951f680ae9956be4c7c022bd971bda65", "score": "0.60974854", "text": "func (c *DpConfig) GetAddr() string {\n\tif len(c.Addr) == 0 {\n\t\treturn configDefaultAddr\n\t}\n\treturn c.Addr\n}", "title": "" }, { "docid": "167b0e7d1f597411bd03f182db4fd3bd", "score": "0.60936797", "text": "func (t *System_Aaa_ServerGroup_Server) GetAddress() string {\n\tif t == nil || t.Address == nil {\n\t\treturn \"\"\n\t}\n\treturn *t.Address\n}", "title": "" }, { "docid": "b82115db1333fd517e01a6537d1b42cf", "score": "0.60928833", "text": "func (t *System_Ntp_Server) GetAddress() string {\n\tif t == nil || t.Address == nil {\n\t\treturn \"\"\n\t}\n\treturn *t.Address\n}", "title": "" }, { "docid": "2b5422d07505c9438251136cac2a4988", "score": "0.60881793", "text": "func (s *Server) getAddressPort() string {\n\tport := os.Getenv(\"PORT\")\n\n\tif port == \"\" {\n\t\tport = DefaultAddressPort\n\t}\n\n\treturn \":\" + port\n}", "title": "" }, { "docid": "d4c28caf4b59e0e40c5b4eb218050083", "score": "0.608812", "text": "func (server *Server) Address() string {\n\treturn server.address\n}", "title": "" }, { "docid": "d4c28caf4b59e0e40c5b4eb218050083", "score": "0.608812", "text": "func (server *Server) Address() string {\n\treturn server.address\n}", "title": "" }, { "docid": "7795c79c962f1af526826a3d7a7ebc4d", "score": "0.6084077", "text": "func GetAddr() string { //Get ip\n\tmaster := ClientConfig.Server.Ip;\n\tconn, err := net.Dial(\"udp\", master+\":80\")\n if err != nil {\n errPrintln( err.Error())\n return \"Error\"\n }\n defer conn.Close()\n return strings.Split(conn.LocalAddr().String(), \":\")[0]\n}", "title": "" }, { "docid": "94fe84b3da124faca3c57cb78c38f8f1", "score": "0.6055532", "text": "func (c *nilConnection) GetAddr() string { return \"127.0.0.1:6051\" }", "title": "" }, { "docid": "759f4d3098d5d64550948a78c579ff45", "score": "0.60472715", "text": "func (o *DhcpServerDataData) GetServerAddr() string {\n\tif o == nil || o.ServerAddr == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.ServerAddr\n}", "title": "" }, { "docid": "15527153816981ca03a2a196e46d0d2b", "score": "0.60403794", "text": "func (gs GitalyServer) Address() string {\n\treturn gs.address\n}", "title": "" }, { "docid": "fecd06658344430e0f6123ba0c9b8553", "score": "0.60339594", "text": "func (s *Server) RPCAddr() string {\n\treturn s.conf.RPCAddr()\n}", "title": "" }, { "docid": "73bed7968e03bbefdcf1687ebbdc946e", "score": "0.6027101", "text": "func (s *Server) Addr() string {\n\treturn fmt.Sprintf(\":%d\", s.cfg.GetPort())\n}", "title": "" }, { "docid": "a79990b6c5130729fee54b6c0c2f3583", "score": "0.6011686", "text": "func GetTunnelServerAddr(clientset kubernetes.Interface) (string, error) {\n\tsvc, err := clientset.CoreV1().Services(constants.YurttunnelServerServiceNs).\n\t\tGet(constants.YurttunnelServerServiceName, metav1.GetOptions{})\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t_, ips, err := certmanager.GetYurttunelServerDNSandIP(clientset)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif len(ips) <= 1 {\n\t\treturn \"\", errors.New(\"there is no available ip\")\n\t}\n\n\tvar tcpPort int32\n\tfor _, port := range svc.Spec.Ports {\n\t\tif port.Name == constants.YurttunnelServerAgentPortName {\n\t\t\tif svc.Spec.Type == corev1.ServiceTypeNodePort {\n\t\t\t\ttcpPort = port.NodePort\n\t\t\t} else {\n\t\t\t\ttcpPort = port.Port\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif tcpPort == 0 {\n\t\treturn \"\", errors.New(\"fail to get the port number\")\n\t}\n\n\tvar ip net.IP\n\tfor _, tmpIP := range ips {\n\t\t// we use the first non-loopback IP address.\n\t\tif tmpIP.String() != \"127.0.0.1\" {\n\t\t\tip = tmpIP\n\t\t}\n\t}\n\n\treturn fmt.Sprintf(\"%s:%d\", ip.String(), tcpPort), nil\n}", "title": "" }, { "docid": "f5d57a4231780d904eebe1f891f4b68d", "score": "0.6008207", "text": "func (hc HealthzConfig) GetBindAddr(defaults ...string) string {\n\tif len(hc.BindAddr) > 0 {\n\t\treturn hc.BindAddr\n\t}\n\tif hc.Port > 0 {\n\t\treturn fmt.Sprintf(\":%d\", hc.Port)\n\t}\n\tif len(defaults) > 0 {\n\t\treturn defaults[0]\n\t}\n\treturn DefaultHealthzBindAddr\n}", "title": "" }, { "docid": "06b7a837fbf11c87670116bf090ea405", "score": "0.59959507", "text": "func ServerAddr(addr string) ServerOption {\n\treturn func(options *ServerOptions) {\n\t\tif addr == \"\" {\n\t\t\taddr = DefaultServerOptions.Addr\n\t\t}\n\t\toptions.Addr = addr\n\t}\n}", "title": "" }, { "docid": "e2a7b97d656c22a6128d115612f08d4c", "score": "0.5991306", "text": "func getListenAddress(addr string) string {\n\tslice := strings.SplitN(addr, \"//\", 2)\n\treturn slice[len(slice)-1]\n}", "title": "" }, { "docid": "ffd6409a2bdf7a7e5eb16316eabb49b1", "score": "0.598762", "text": "func (t *System_Ntp) GetServer(Address string) *System_Ntp_Server {\n\n\tif t == nil {\n\t\treturn nil\n\t}\n\n\tkey := Address\n\n\tif lm, ok := t.Server[key]; ok {\n\t\treturn lm\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1193b1c3e3cddc1aeec0c3fd73e4f3d4", "score": "0.59875536", "text": "func (o *Server) GetListenAddr() string {\n\to.RLock()\n\tdefer o.RUnlock()\n\treturn o.ring.LocalNode().Address(2)\n}", "title": "" }, { "docid": "1aabb1111e9d7263cdff0933ecf43ea3", "score": "0.59866005", "text": "func (a *Agent) GetDNSServer(name string) string {\n\tsplitedName := strings.Split(name, \".\")\n\tsplitedLength := len(splitedName)\n\tfor i := 0; i < splitedLength-1; i++ {\n\t\ttmpName := strings.Join(splitedName[i:splitedLength], \".\")\n\t\tc, existed := a.CustomeDNSConfigCache.Get(tmpName)\n\t\tif existed {\n\t\t\tglog.Infof(\"Match prefix `%s` from CustomeDNSConfig: %s Query DNS: %s\", c.Prefix, name, c.DNSServer)\n\t\t\treturn appendDefaultPort(c.DNSServer, \"53\")\n\t\t}\n\t}\n\t// Default result\n\treturn a.DefaultDNSServer\n}", "title": "" }, { "docid": "54e28c097d53b6df5458cb48975c940a", "score": "0.598521", "text": "func (m *WebServerCore) GetIPAddress() string {\n\n\tif m.j.Config.GetProxyStatus() {\n\t\t// If we are the local host (not proxy), then provide localhost as the IP address, otherwise use set\n\t\treturn m.settings.IPAddress\n\t}\n\treturn \"localhost\"\n}", "title": "" }, { "docid": "848ee1e96abb9166be6cf8e8d7be7d24", "score": "0.59719366", "text": "func (c *Config) fullAddress() string {\n\treturn fmt.Sprintf(\"%s://%s\", c.scheme(), c.host())\n}", "title": "" }, { "docid": "53b9f4aa2a57f54d5b3f528747e575ca", "score": "0.5970387", "text": "func getAPIServerURL(adminconf []byte) (string, error) {\n\tconfig, err := clientcmd.Load(adminconf)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// TODO may be we check the default-cluster is exist\n\treturn config.Clusters[\"kubernetes\"].Server, nil\n}", "title": "" }, { "docid": "a08ae4e82293f514ad91809692cb743b", "score": "0.5965548", "text": "func (server *Server) Address() string {\n\tif server == nil {\n\t\treturn \"\"\n\t}\n\n\treturn server.addr\n}", "title": "" }, { "docid": "62ce140392ddfab202f331ebfe7adb2e", "score": "0.5960209", "text": "func (t *System_Dns_Server) GetAddress() string {\n\tif t == nil || t.Address == nil {\n\t\treturn \"\"\n\t}\n\treturn *t.Address\n}", "title": "" }, { "docid": "0fe1bf862642766582a7bad35a15f929", "score": "0.5952086", "text": "func inetServerAddr(conn *pgx.Conn) string {\n\trows, err := conn.Query(`SELECT inet_server_addr();`)\n\tExpect(err).NotTo(HaveOccurred())\n\n\tdefer rows.Close()\n\n\tvar addr sql.NullString\n\n\tExpect(rows.Next()).To(BeTrue())\n\tExpect(rows.Scan(&addr)).To(Succeed())\n\n\t// Remove any network suffix from the IP (e.g., 172.17.0.3/32)\n\treturn strings.SplitN(addr.String, \"/\", 2)[0]\n}", "title": "" }, { "docid": "5d2710b19f69bb6c5f1b5eb90fae45af", "score": "0.5943292", "text": "func (s *server) Address(port string) string {\n\treturn s.host + \":\" + port\n}", "title": "" }, { "docid": "604e83243015a6571ec81a1073aa827f", "score": "0.59205765", "text": "func serverConfig() (http.ServerConfig, error) {\n\tconfig := http.ServerConfig{}\n\tvar err error\n\tconfig.Port, err = os.GetIntFromEnvVar(\"RECEIVER_PORT\", 8080)\n\tif err != nil {\n\t\treturn config, err\n\t}\n\tconfig.TLSEnabled, err = os.GetBoolFromEnvVar(\"TLS_ENABLED\", false)\n\tif err != nil {\n\t\treturn config, err\n\t}\n\tif config.TLSEnabled {\n\t\tconfig.TLSCertPath, err = os.GetRequiredEnvVar(\"TLS_CERT_PATH\")\n\t\tif err != nil {\n\t\t\treturn config, err\n\t\t}\n\t\tconfig.TLSKeyPath, err = os.GetRequiredEnvVar(\"TLS_KEY_PATH\")\n\t\tif err != nil {\n\t\t\treturn config, err\n\t\t}\n\t}\n\treturn config, nil\n}", "title": "" }, { "docid": "912ef64e5fcc55574dafb819a62f3a3e", "score": "0.59156317", "text": "func (o *GSLBServer) GetIPAddress() string {\n\treturn o.IPAddress\n}", "title": "" }, { "docid": "e72b0578438b6ec7673bc7fb985c4a21", "score": "0.5909373", "text": "func GetHTTPServerAddress() string {\n\thttpHost := os.Getenv(\"MERCURIO_HTTP_HOST\")\n\tif httpHost == \"\" {\n\t\thttpHost = \"127.0.0.1\"\n\t}\n\n\thttpPort := os.Getenv(\"MERCURIO_HTTP_PORT\")\n\tif httpPort == \"\" {\n\t\thttpPort = \"8000\"\n\t}\n\n\treturn httpHost + \":\" + httpPort\n}", "title": "" }, { "docid": "6255873e30c64824f35827d0f4211459", "score": "0.5905981", "text": "func GetServerAddress(serverName string) (string, bool) {\n\t// Split the serverName into two parts: the Host and the Port (may be empty)\n\tparts := strings.Split(serverName, \":\")\n\thost := parts[0]\n\n\t// Check if address is already in cache, otherwise try to fill the cache\n\tif use_map_synced {\n\t\tif values, ok := addrCacheSynced.Load(host); ok == true {\n\t\t\treturn appendPort(getAddr(values.([]string)), parts), true\n\t\t}\n\n\t\tif addrs, err := net.LookupHost(host); err == nil {\n\t\t\t// Remove IPv6 addresses\n\t\t\taddrs4 := make([]string, 0)\n\t\t\tfor _, addr := range addrs {\n\t\t\t\tif strings.Count(addr, \":\") == 0 {\n\t\t\t\t\taddrs4 = append(addrs4, addr)\n\t\t\t\t}\n\t\t\t}\n\t\t\taddrCacheSynced.Store(host, addrs4)\n\t\t\treturn appendPort(getAddr(addrs4), parts), true\n\t\t}\n\t} else {\n\t\tcacheLock.Lock()\n\t\tdefer cacheLock.Unlock()\n\n\t\tif values, err := addrCache[host]; err == true {\n\t\t\treturn appendPort(getAddr(values), parts), true\n\t\t}\n\n\t\tif addrs, err := net.LookupHost(host); err == nil {\n\t\t\t// Remove IPv6 addresses\n\t\t\taddrs4 := make([]string, 0)\n\t\t\tfor _, addr := range addrs {\n\t\t\t\tif strings.Count(addr, \":\") == 0 {\n\t\t\t\t\taddrs4 = append(addrs4, addr)\n\t\t\t\t}\n\t\t\t}\n\t\t\taddrCache[host] = addrs4\n\t\t\treturn appendPort(getAddr(addrs4), parts), true\n\t\t}\n\t}\n\n\tlog.Errorf(\"Could not resolve the Server Name: %s\", host)\n\treturn \"\", false\n}", "title": "" }, { "docid": "75636cad9e5211a44063da568cf15c4f", "score": "0.5896539", "text": "func (c *Config) ServerURL() string {\n\tparts := []string{\n\t\t\"http\",\n\t\t\"://\",\n\t\t\"\",\n\t\tc.Server.Host,\n\t\t\"\",\n\t}\n\tif c.Server.UseSSL == \"1\" || c.Server.UseSSL == \"true\" {\n\t\tparts[0] = \"https\"\n\t}\n\tif c.Server.Username != \"0\" && c.Server.Username != \"\" &&\n\t\tc.Server.Password != \"0\" && c.Server.Password != \"\" {\n\t\tparts[2] = c.Server.Username + \":\" + c.Server.Password + \"@\"\n\t}\n\tif c.Server.Port != \"\" && c.Server.Port != \"0\" {\n\t\tparts[4] = \":\" + c.Server.Port\n\t}\n\n\treturn strings.Join(parts, \"\")\n}", "title": "" }, { "docid": "35c81ce187b5c3263568d2975816343f", "score": "0.5894297", "text": "func (srv *Server) Address() net.Addr {\n\treturn (*srv.listener).Addr();\n}", "title": "" }, { "docid": "a74bbe60c4890e4f2637038ee534d166", "score": "0.58932346", "text": "func GetAddress(ctx *pulumi.Context) string {\n\treturn config.Get(ctx, \"vault:address\")\n}", "title": "" }, { "docid": "20ad5bdfb7cf29079dab20e7596d629c", "score": "0.5891692", "text": "func (c *Client) ServerConfig(ipAddr net.IP) (*tls.Config, error) {\n\tserverCertPEM, serverKeyPEM, err := newServerCert(c.rootCert, c.rootKey, ipAddr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcert, err := tls.X509KeyPair(serverCertPEM, serverKeyPEM)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpool := x509.NewCertPool()\n\tpool.AddCert(c.rootCert)\n\treturn &tls.Config{\n\t\tClientAuth: tls.RequireAndVerifyClientCert,\n\t\tClientCAs: pool,\n\t\tCertificates: []tls.Certificate{cert},\n\t}, nil\n}", "title": "" }, { "docid": "dd981d72fc6cd2e554e9aa0317b6a591", "score": "0.5879787", "text": "func (s *RPCServer) GetAddr() string {\n\treturn s.lis.Addr().String()\n}", "title": "" }, { "docid": "a01679cbe9eb9de37a6777c5aec6e5f7", "score": "0.5876423", "text": "func (c *Config) BrokerAddr() string {\n\treturn fmt.Sprintf(\"%s:%d\", c.BindAddress, c.Broker.Port)\n}", "title": "" }, { "docid": "26f89feeb54e5b54ac5759a716228a23", "score": "0.5865955", "text": "func (t *OpenconfigSystem_System_Ntp_Servers) GetServer(Address string) *OpenconfigSystem_System_Ntp_Servers_Server {\n\n\tif t == nil {\n\t\treturn nil\n\t}\n\n\tkey := Address\n\n\tif lm, ok := t.Server[key]; ok {\n\t\treturn lm\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e07045540b6bba2682c8aced61bf975a", "score": "0.5865007", "text": "func (n *NodeUrl) GetContentServerAddress(address string) (string, error) {\n\tconn, err := grpc.Dial(address, grpc.WithInsecure())\n\tif err != nil {\n\t\tlog.Fatalf(\"Did not connect to server : %v\\n\", err)\n\t\tfmt.Println(err)\n\t}\n\n\ts := pb.NewP2PServiceClient(conn)\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Did not connect to server : %v\\n\", err)\n\t\tfmt.Println(err)\n\t}\n\n\tdownloadAddress, err := s.GetServerAddr(context.Background(), &pb.ServerRequest{Address: address})\n\tfmt.Printf(\"download address %v\\n\", address)\n\tif err != nil { //Add random pick for which node to download from\n\n\t\t//add relevant node to clients\n\t\tfmt.Println(err)\n\t\treturn \"nil\", err\n\t}\n\turl := downloadAddress.Addr\n\treturn url, nil\n}", "title": "" }, { "docid": "790f4d384dbc6ee1e6217af44d8e2c5e", "score": "0.5864914", "text": "func (a *application) ServerConfig() *serverConfig {\n\ta.init()\n\treturn a.svrCfg\n}", "title": "" }, { "docid": "26f89feeb54e5b54ac5759a716228a23", "score": "0.58621716", "text": "func (t *OpenconfigSystem_System_Ntp_Servers) GetServer(Address string) *OpenconfigSystem_System_Ntp_Servers_Server {\n\n\tif t == nil {\n\t\treturn nil\n\t}\n\n\tkey := Address\n\n\tif lm, ok := t.Server[key]; ok {\n\t\treturn lm\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a22cdd4e44856ed91a79d9f88f81c915", "score": "0.58435106", "text": "func (a *Agent) serverConfig() (*nomad.Config, error) {\n\treturn convertServerConfig(a.config, a.logOutput)\n}", "title": "" }, { "docid": "5b47005443d34438fdc6b09d5130f80e", "score": "0.5843022", "text": "func (ap *addrProvider) ServerAddr(id raft.ServerID) (raft.ServerAddress, error) {\n\treturn raft.ServerAddress(id), nil\n\n}", "title": "" }, { "docid": "850d4febd84051ee5795efc9856c6eca", "score": "0.58369166", "text": "func (server *WebServer) Addr() (result string) {\n\tresult = fmt.Sprintf(\"%v:%v\", server.host, server.port)\n\treturn\n}", "title": "" }, { "docid": "9225ef0403cb9f65d65e14a2c53e03db", "score": "0.58368975", "text": "func (server *Server) Addr() string {\n\treturn server.listener.Addr().String()\n}", "title": "" }, { "docid": "997c3d9afe53f8eef1fb2292290d3280", "score": "0.58275765", "text": "func (t *System_Dns) GetServer(Address string) *System_Dns_Server {\n\n\tif t == nil {\n\t\treturn nil\n\t}\n\n\tkey := Address\n\n\tif lm, ok := t.Server[key]; ok {\n\t\treturn lm\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c35bea4d6431ea1cbaefbea927ba8dcc", "score": "0.5817176", "text": "func (t *OpenconfigSystem_System_Aaa_ServerGroups_ServerGroup_Servers) GetServer(Address string) *OpenconfigSystem_System_Aaa_ServerGroups_ServerGroup_Servers_Server {\n\n\tif t == nil {\n\t\treturn nil\n\t}\n\n\tkey := Address\n\n\tif lm, ok := t.Server[key]; ok {\n\t\treturn lm\n\t}\n\treturn nil\n}", "title": "" } ]
5af828dfb5f940870e317969dd38a1bd
SetModelVersionNumber sets the ModelVersionNumber field's value.
[ { "docid": "e97fda51200ac523694de09542c511d6", "score": "0.83960843", "text": "func (s *UpdateModelVersionStatusInput) SetModelVersionNumber(v string) *UpdateModelVersionStatusInput {\n\ts.ModelVersionNumber = &v\n\treturn s\n}", "title": "" } ]
[ { "docid": "5703eb2aa2ce668f0f51f1e979d0e7f8", "score": "0.85069036", "text": "func (s *GetModelVersionInput) SetModelVersionNumber(v string) *GetModelVersionInput {\n\ts.ModelVersionNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "025e6ad5224350a82f629c601bdaef93", "score": "0.8504845", "text": "func (s *GetModelVersionOutput) SetModelVersionNumber(v string) *GetModelVersionOutput {\n\ts.ModelVersionNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "364e66311751747a18cd9c25c61ad0dd", "score": "0.8451315", "text": "func (s *DeleteModelVersionInput) SetModelVersionNumber(v string) *DeleteModelVersionInput {\n\ts.ModelVersionNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "99929632067dc130a3e1844a1db27b86", "score": "0.8418483", "text": "func (s *ModelVersionDetail) SetModelVersionNumber(v string) *ModelVersionDetail {\n\ts.ModelVersionNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "70f719dd3d8bb1120fe7742a8132c0f2", "score": "0.8396118", "text": "func (s *UpdateModelVersionOutput) SetModelVersionNumber(v string) *UpdateModelVersionOutput {\n\ts.ModelVersionNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "2ed7b3305fb625e42ee9e7e9f40e9280", "score": "0.8388342", "text": "func (s *ModelVersion) SetModelVersionNumber(v string) *ModelVersion {\n\ts.ModelVersionNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "283741d2b2479ebbc927ce8895464ffd", "score": "0.8377686", "text": "func (s *CreateModelVersionOutput) SetModelVersionNumber(v string) *CreateModelVersionOutput {\n\ts.ModelVersionNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "9d5eced855a9d0db975f0333bd3f6aa0", "score": "0.8199534", "text": "func (s *DescribeModelVersionsInput) SetModelVersionNumber(v string) *DescribeModelVersionsInput {\n\ts.ModelVersionNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "3bc143ee68de1adedcb9c601a1b9eced", "score": "0.73993504", "text": "func (s *ModelScores) SetModelVersion(v *ModelVersion) *ModelScores {\n\ts.ModelVersion = v\n\treturn s\n}", "title": "" }, { "docid": "6f3d0ea72ed1791e40b601838d7d5be2", "score": "0.73251146", "text": "func (m *WorkflowVersion) SetVersionNumber(value *int32)() {\n err := m.GetBackingStore().Set(\"versionNumber\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "1751164bb780f217c1f02fc651917142", "score": "0.73062915", "text": "func (o *HyperflexNodeAllOf) SetModelNumber(v string) {\n\to.ModelNumber = &v\n}", "title": "" }, { "docid": "f2635475eefeef04e84911528529eca7", "score": "0.729241", "text": "func (o *GlobalGetFlowVersionParams) SetVersionNumber(versionNumber int32) {\n\to.VersionNumber = versionNumber\n}", "title": "" }, { "docid": "27a5bcbab3453207580514dc0510a3c2", "score": "0.7256014", "text": "func (s *DeleteDashboardInput) SetVersionNumber(v int64) *DeleteDashboardInput {\n\ts.VersionNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "96752d7dc06f9050d1cd455dcc332952", "score": "0.72275937", "text": "func (s *DescribeDashboardInput) SetVersionNumber(v int64) *DescribeDashboardInput {\n\ts.VersionNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "d4768cb1a6950c3da44a974729794380", "score": "0.72059965", "text": "func (s *DeleteTemplateInput) SetVersionNumber(v int64) *DeleteTemplateInput {\n\ts.VersionNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "0a17dfae3522b4c2f4bfbbb314a668df", "score": "0.7202913", "text": "func (s *DescribeTemplateInput) SetVersionNumber(v int64) *DescribeTemplateInput {\n\ts.VersionNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "e8f151c35630fd8b58b14d5e4df7309c", "score": "0.7181213", "text": "func (s *TemplateVersionSummary) SetVersionNumber(v int64) *TemplateVersionSummary {\n\ts.VersionNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "bc15bc0ed6b2844acc4c677ed4812d1e", "score": "0.7143205", "text": "func (s *DeleteThemeInput) SetVersionNumber(v int64) *DeleteThemeInput {\n\ts.VersionNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "645cd0d67e0600920418cd2a92646e56", "score": "0.71324277", "text": "func (s *TemplateVersion) SetVersionNumber(v int64) *TemplateVersion {\n\ts.VersionNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "c98022300a1aaf69f23fcfb8f2de2b48", "score": "0.71274096", "text": "func (s *DeleteModelInput) SetModelVersion(v string) *DeleteModelInput {\n\ts.ModelVersion = &v\n\treturn s\n}", "title": "" }, { "docid": "f03dd28f234a12af4bc34b89f973d9a9", "score": "0.71200913", "text": "func (s *DashboardVersionSummary) SetVersionNumber(v int64) *DashboardVersionSummary {\n\ts.VersionNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "98530493a06dc10da149cc268eda2c60", "score": "0.71142334", "text": "func (s *DescribeThemeInput) SetVersionNumber(v int64) *DescribeThemeInput {\n\ts.VersionNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "923a0f40d807f120806c869851cb1217", "score": "0.71002746", "text": "func (s *StopModelInput) SetModelVersion(v string) *StopModelInput {\n\ts.ModelVersion = &v\n\treturn s\n}", "title": "" }, { "docid": "140ea7df69348902a36c6a4c7f257203", "score": "0.7096251", "text": "func (s *JobExecution) SetVersionNumber(v int64) *JobExecution {\n\ts.VersionNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "fb33c51471d2c4a59d4013df456d81ad", "score": "0.7095176", "text": "func (s *ModelMetadata) SetModelVersion(v string) *ModelMetadata {\n\ts.ModelVersion = &v\n\treturn s\n}", "title": "" }, { "docid": "260dd18ccf388dd898e16258d2178b0c", "score": "0.7095151", "text": "func (s *StartModelInput) SetModelVersion(v string) *StartModelInput {\n\ts.ModelVersion = &v\n\treturn s\n}", "title": "" }, { "docid": "38e99c8fe6fd9a75af0a25b2f1ca5685", "score": "0.70899534", "text": "func (s *UpdateDashboardPublishedVersionInput) SetVersionNumber(v int64) *UpdateDashboardPublishedVersionInput {\n\ts.VersionNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "60bacafba199fd805480cccd85303e1d", "score": "0.7087335", "text": "func (s *InferSNOMEDCTOutput) SetModelVersion(v string) *InferSNOMEDCTOutput {\n\ts.ModelVersion = &v\n\treturn s\n}", "title": "" }, { "docid": "e6838e5c812598388d3487951867181a", "score": "0.7082846", "text": "func (s *DashboardVersion) SetVersionNumber(v int64) *DashboardVersion {\n\ts.VersionNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "4f1f676a20137be097185ee8b0ee228f", "score": "0.70685697", "text": "func (s *ThemeVersionSummary) SetVersionNumber(v int64) *ThemeVersionSummary {\n\ts.VersionNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "d44b432a5981ac1a20fcf3c4120acdcf", "score": "0.70570123", "text": "func (s *StartModelPackagingJobInput) SetModelVersion(v string) *StartModelPackagingJobInput {\n\ts.ModelVersion = &v\n\treturn s\n}", "title": "" }, { "docid": "b727dd3d4cd507e43f68b45174a870b0", "score": "0.7051399", "text": "func (s *DetectAnomaliesInput) SetModelVersion(v string) *DetectAnomaliesInput {\n\ts.ModelVersion = &v\n\treturn s\n}", "title": "" }, { "docid": "0825263b7f3099678b3c1911b21e1869", "score": "0.70494086", "text": "func (s *ModelPackagingDescription) SetModelVersion(v string) *ModelPackagingDescription {\n\ts.ModelVersion = &v\n\treturn s\n}", "title": "" }, { "docid": "13cb89498917181d2da2ff8d765b064a", "score": "0.7038785", "text": "func (s *DescribeModelInput) SetModelVersion(v string) *DescribeModelInput {\n\ts.ModelVersion = &v\n\treturn s\n}", "title": "" }, { "docid": "ad8decd85e4176955caf4758a39a2cb5", "score": "0.70040643", "text": "func (s *ThemeVersion) SetVersionNumber(v int64) *ThemeVersion {\n\ts.VersionNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "76f98f19fb0be398388af7f01bc743f3", "score": "0.6961788", "text": "func (s *ComprehendMedicalAsyncJobProperties) SetModelVersion(v string) *ComprehendMedicalAsyncJobProperties {\n\ts.ModelVersion = &v\n\treturn s\n}", "title": "" }, { "docid": "09d300705557485e27521994597bf5b2", "score": "0.69449747", "text": "func (s *ModelDescription) SetModelVersion(v string) *ModelDescription {\n\ts.ModelVersion = &v\n\treturn s\n}", "title": "" }, { "docid": "1b3c7f3dcbff304478f3dabb9cec409f", "score": "0.6941694", "text": "func (s *ModelPackagingJobMetadata) SetModelVersion(v string) *ModelPackagingJobMetadata {\n\ts.ModelVersion = &v\n\treturn s\n}", "title": "" }, { "docid": "5929859bc7fdf1b3a6726923b4841d44", "score": "0.69026923", "text": "func (s *InferRxNormOutput) SetModelVersion(v string) *InferRxNormOutput {\n\ts.ModelVersion = &v\n\treturn s\n}", "title": "" }, { "docid": "4b3b6a5fa827bd91e42e27a385858ebc", "score": "0.6888276", "text": "func (s *EvaluatedModelVersion) SetModelVersion(v string) *EvaluatedModelVersion {\n\ts.ModelVersion = &v\n\treturn s\n}", "title": "" }, { "docid": "431119ec17a11b1ff80ac263fe5ae74a", "score": "0.68564695", "text": "func (h *ModelGeneric) SetVersion(version int64) {\n\th.Version = version\n}", "title": "" }, { "docid": "2ae1874e16558ecfc595581ff14c9961", "score": "0.6853972", "text": "func (s *DetectEntitiesV2Output) SetModelVersion(v string) *DetectEntitiesV2Output {\n\ts.ModelVersion = &v\n\treturn s\n}", "title": "" }, { "docid": "14eca7e82e907e7b93a1d3ffaaefee67", "score": "0.6832766", "text": "func (s *InferICD10CMOutput) SetModelVersion(v string) *InferICD10CMOutput {\n\ts.ModelVersion = &v\n\treturn s\n}", "title": "" }, { "docid": "477b3db5b70d7ac2f9b27015f062e355", "score": "0.6812895", "text": "func (s *DetectEntitiesOutput) SetModelVersion(v string) *DetectEntitiesOutput {\n\ts.ModelVersion = &v\n\treturn s\n}", "title": "" }, { "docid": "ffca3cc08488a00213b26c1721227925", "score": "0.6751233", "text": "func (s *DetectPHIOutput) SetModelVersion(v string) *DetectPHIOutput {\n\ts.ModelVersion = &v\n\treturn s\n}", "title": "" }, { "docid": "1106f4b0fb01d09deb54ff152a7abd75", "score": "0.66245854", "text": "func (client *modelPredictionClient) SetVersion(version int) {\n\tclient.spec.VersionChoice = &serving.ModelSpec_Version{\n\t\tVersion: &gogotype.Int64Value{\n\t\t\tValue: int64(version),\n\t\t},\n\t}\n}", "title": "" }, { "docid": "572ec2f50a11e1385f133509b2f29f11", "score": "0.6570182", "text": "func (s *TemplateAlias) SetTemplateVersionNumber(v int64) *TemplateAlias {\n\ts.TemplateVersionNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "7edd6e7cbecdb0c14873ad15a4d75d29", "score": "0.64107686", "text": "func (s *UpdateTemplateAliasInput) SetTemplateVersionNumber(v int64) *UpdateTemplateAliasInput {\n\ts.TemplateVersionNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "becb0a577a2db1706d9fdda2b207b76d", "score": "0.6380973", "text": "func (o *CatalogSyncRequest) SetVersion(v int32) {\n\to.Version = &v\n}", "title": "" }, { "docid": "97312f054e2dfb79e8b40f7e21490e65", "score": "0.6376563", "text": "func (s *CreateTemplateAliasInput) SetTemplateVersionNumber(v int64) *CreateTemplateAliasInput {\n\ts.TemplateVersionNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "c06e1947e4ac3a02442c167a1ad32b87", "score": "0.63567007", "text": "func (m *gerritEvent) SetVersion(val string) {\n\tm.versionField = val\n}", "title": "" }, { "docid": "47bf73dcaab880ce568e8654eaef1901", "score": "0.63455015", "text": "func (obj *Node) SetVersion(version int) {\n\tobj.setVersion(version)\n}", "title": "" }, { "docid": "eb39d1accba1b9d6a7517523c01742d0", "score": "0.62392193", "text": "func (s *DescribeBillingGroupOutput) SetVersion(v int64) *DescribeBillingGroupOutput {\n\ts.Version = &v\n\treturn s\n}", "title": "" }, { "docid": "fdf6adcfcf8a11285b52ed8197dee85b", "score": "0.6216836", "text": "func (s *UpdateBillingGroupOutput) SetVersion(v int64) *UpdateBillingGroupOutput {\n\ts.Version = &v\n\treturn s\n}", "title": "" }, { "docid": "c815239de7afc7a7d568333c766f01d1", "score": "0.62041926", "text": "func (m *Model) SetNumber(ref sudoku.CellRef, num int) {\n\tcommand := m.newNumberCommand(ref, num)\n\tif command == nil {\n\t\treturn\n\t}\n\tm.executeBaseCommand(command)\n}", "title": "" }, { "docid": "1e4d252ffa1f5186a2d03817a07b9e18", "score": "0.6198124", "text": "func (o *WatchlistScreeningSearchTerms) SetVersion(v int32) {\n\to.Version = v\n}", "title": "" }, { "docid": "a43d94b7461edf317f4a918b286b49ce", "score": "0.6155582", "text": "func (o *DeleteInvoiceParams) SetVersion(version *int64) {\n\to.Version = version\n}", "title": "" }, { "docid": "30254c68077c2b201355675214082cb9", "score": "0.6150486", "text": "func (s *ThemeAlias) SetThemeVersionNumber(v int64) *ThemeAlias {\n\ts.ThemeVersionNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "6bcf2b5c19859228a16535b6e084b008", "score": "0.6120059", "text": "func SetVersion(v int){\n\tversion = version_prefix+strconv.Itoa(v)\n}", "title": "" }, { "docid": "b26725075d07985c23b3772b14bcade9", "score": "0.6105834", "text": "func (s *DescribeSecurityProfileOutput) SetVersion(v int64) *DescribeSecurityProfileOutput {\n\ts.Version = &v\n\treturn s\n}", "title": "" }, { "docid": "49a8c39f7c46c7ff04b4a6e08a661733", "score": "0.61033857", "text": "func (o *ImportPackage) SetVersion(v string) {\n\to.Version = v\n}", "title": "" }, { "docid": "42b851644bc6bc4ab548592f0fea54de", "score": "0.6087753", "text": "func (s *Service) SetVersion(major int, minor int, patch int) {\n\ts.Version = fmt.Sprintf(\"%d.%d.%d\", major, minor, patch)\n}", "title": "" }, { "docid": "f9c3f59dd8d4d5a69596c982ac319a25", "score": "0.6081062", "text": "func (obj *AbstractEntity) SetVersion(version int) {\n\tobj.setVersion(version)\n}", "title": "" }, { "docid": "573c49edff007bafa59d0bd254ca068f", "score": "0.6071197", "text": "func (s *UpdateSecurityProfileOutput) SetVersion(v int64) *UpdateSecurityProfileOutput {\n\ts.Version = &v\n\treturn s\n}", "title": "" }, { "docid": "ab6587536ae478ad498e4382e1a02a61", "score": "0.60665154", "text": "func (o *NiatelemetryNiaInventory) SetVersion(v string) {\n\to.Version = &v\n}", "title": "" }, { "docid": "a8a4d1c182005645a1c83b49d4f176b9", "score": "0.6052138", "text": "func (obj *Graph) SetVersion(version int) {\n\tobj.setVersion(version)\n}", "title": "" }, { "docid": "516fc650f8042e9dfa0bb7ba3fe55d95", "score": "0.6049647", "text": "func (obj *Edge) SetVersion(version int) {\n\tobj.setVersion(version)\n}", "title": "" }, { "docid": "6eb4e843241dcaade28a89341c2ad00b", "score": "0.6043123", "text": "func (o *Service) SetVersion(v string) {\n\to.Version = &v\n}", "title": "" }, { "docid": "b8609dda91dfea37d4a954b99743fa08", "score": "0.6022664", "text": "func (o *SignalStateUpdateRequest) SetVersion(v int64) {\n\to.Version = &v\n}", "title": "" }, { "docid": "71ad9184ce6a250ba3e62bedac574388", "score": "0.6010544", "text": "func (o *OsDistribution) SetVersion(v HclOperatingSystemRelationship) {\n\to.Version = &v\n}", "title": "" }, { "docid": "3de8e679b5126fb8aad45326481b05fb", "score": "0.60065216", "text": "func (s *UpdateDynamicThingGroupOutput) SetVersion(v int64) *UpdateDynamicThingGroupOutput {\n\ts.Version = &v\n\treturn s\n}", "title": "" }, { "docid": "8efa9395feff47033131e5d5b74543e6", "score": "0.6004161", "text": "func (o *SearchAssetsParams) SetVersion(version *string) {\n\to.Version = version\n}", "title": "" }, { "docid": "b8c9f44807b6af49207759e63f9c7557", "score": "0.59994394", "text": "func (s *DescribeFleetMetricOutput) SetVersion(v int64) *DescribeFleetMetricOutput {\n\ts.Version = &v\n\treturn s\n}", "title": "" }, { "docid": "001ae8b4d5ccf66b0e01eea0ed1ecc26", "score": "0.5998992", "text": "func (s *DescribeThingGroupOutput) SetVersion(v int64) *DescribeThingGroupOutput {\n\ts.Version = &v\n\treturn s\n}", "title": "" }, { "docid": "97dbf87181a07c17920d2a455b932efc", "score": "0.5994186", "text": "func (s *UpdateThingGroupOutput) SetVersion(v int64) *UpdateThingGroupOutput {\n\ts.Version = &v\n\treturn s\n}", "title": "" }, { "docid": "f04438e5b6f908b96d4f0d87cc80c001", "score": "0.59818256", "text": "func (o *SearchedVersion) SetVersion(v string) {\n\to.Version = v\n}", "title": "" }, { "docid": "a0343de19ef3d850c79bbb49132ee0e3", "score": "0.59791416", "text": "func (o *PostAssignmentParams) SetVersion(version string) {\n\to.Version = version\n}", "title": "" }, { "docid": "4bce312da9c4e6e14bebe741b9f1d625", "score": "0.5959413", "text": "func (o *GetWorkflowServiceParams) SetVersion(version string) {\n\to.Version = version\n}", "title": "" }, { "docid": "de48c22d68cff9e616094bb97e653fc1", "score": "0.59573776", "text": "func SetVersion(ver string) {\n\tversion = ver\n}", "title": "" }, { "docid": "d18f51aa75bed1752a09d9ead0f04a06", "score": "0.5955048", "text": "func (o *HyperflexSoftwareDistributionVersionAllOf) SetVersion(v string) {\n\to.Version = &v\n}", "title": "" }, { "docid": "c65181fbf3961bc2c8d833844dc63852", "score": "0.59549224", "text": "func ModelVersion() string {\n\treturn \"v0.1.9\"\n}", "title": "" }, { "docid": "0708890b2b14c2f68d1b0f0243fd8bbc", "score": "0.59493345", "text": "func (s *UpdateConnectivityInfoOutput) SetVersion(v string) *UpdateConnectivityInfoOutput {\n\ts.Version = &v\n\treturn s\n}", "title": "" }, { "docid": "6df5cd356537cbc22a2edfb79dfd440b", "score": "0.59485775", "text": "func SetVersion(ver string) {\n\tVersion = ver\n}", "title": "" }, { "docid": "83d3149b6743889fa76fc3ec2b5cb305", "score": "0.5940375", "text": "func (o *ForecastCatalogAllOf) SetVersion(v string) {\n\to.Version = &v\n}", "title": "" }, { "docid": "00b00dd5f683d8a40b05c06be8379a02", "score": "0.5933873", "text": "func (m *genericTx) SetVersion(val *uint32) {\n\tm.versionField = val\n}", "title": "" }, { "docid": "32109f98329ecdec88c73b6ee860dae1", "score": "0.5927166", "text": "func (o *HyperflexNodeAllOf) SetVersion(v string) {\n\to.Version = &v\n}", "title": "" }, { "docid": "a04222559d0fa652793a06f0ca7305fa", "score": "0.59258217", "text": "func (o *MetaDefinition) SetVersion(v string) {\n\to.Version = &v\n}", "title": "" }, { "docid": "f94f4be8899682f299823f8696c4f8f9", "score": "0.5915248", "text": "func (s *UpdateThemeAliasInput) SetThemeVersionNumber(v int64) *UpdateThemeAliasInput {\n\ts.ThemeVersionNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "ecd4280d420fd238233fa359b8e3a442", "score": "0.5906453", "text": "func (p *Ip) SetVersion(attr IpVersion) {\n\tp.version = &attr\n}", "title": "" }, { "docid": "a2c95949403281fa0d936ec2bf27250e", "score": "0.59014386", "text": "func (client *Client) SetVersion(version string) {\n\tclient.version = version\n}", "title": "" }, { "docid": "79519e9c04be954aa742872a9b68b21f", "score": "0.5894662", "text": "func (o *HyperflexClusterBackupPolicyInventoryAllOf) SetVersion(v int64) {\n\to.Version = &v\n}", "title": "" }, { "docid": "ef3e4b79d701772e3bf4a00ad2282dc8", "score": "0.58944523", "text": "func (s *AgentInfo) SetVersion(v string) *AgentInfo {\n\ts.Version = &v\n\treturn s\n}", "title": "" }, { "docid": "4b146f329b4cab215cbccc776263fd77", "score": "0.5891508", "text": "func (x *DataAuditResult) SetVersion(v *refs.Version) {\n\tif x != nil {\n\t\tx.Version = v\n\t}\n}", "title": "" }, { "docid": "6f81f4efa69dfaa617ad5989853f897e", "score": "0.5887304", "text": "func (kpc_obj *KPC) SetVersion(version string) {\n\tkpc_obj.Version = version\n}", "title": "" }, { "docid": "1f6840fc36861b23f10a148cee764faa", "score": "0.58815813", "text": "func (o *InlineResponse20035Notebooks) SetVersion(v string) {\n\to.Version = &v\n}", "title": "" }, { "docid": "fdb921c212552692b74257cc270991eb", "score": "0.5879732", "text": "func (s *UpdateModelVersionInput) SetMajorVersionNumber(v string) *UpdateModelVersionInput {\n\ts.MajorVersionNumber = &v\n\treturn s\n}", "title": "" }, { "docid": "10b8a24199bff2336b613f9731b4f314", "score": "0.5877744", "text": "func (s *FileCacheNFSConfiguration) SetVersion(v string) *FileCacheNFSConfiguration {\n\ts.Version = &v\n\treturn s\n}", "title": "" }, { "docid": "18f2c9128f0c67dc2a4fad72013506b5", "score": "0.58753014", "text": "func (s *DescribeThingOutput) SetVersion(v int64) *DescribeThingOutput {\n\ts.Version = &v\n\treturn s\n}", "title": "" }, { "docid": "466e31a8ed83d37eb0d36611029537b9", "score": "0.5874699", "text": "func (o *HyperflexWitnessConfiguration) SetVersion(v string) {\n\to.Version = &v\n}", "title": "" }, { "docid": "2d0ca668f70a362e6aa773b5cd9de219", "score": "0.5869716", "text": "func (s *CreateThemeAliasInput) SetThemeVersionNumber(v int64) *CreateThemeAliasInput {\n\ts.ThemeVersionNumber = &v\n\treturn s\n}", "title": "" } ]
e8ac15b33cef6256a6c7528c1576a685
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VegetaList.
[ { "docid": "3f1ca7ed1cb068b4044c528b8b9267d8", "score": "0.86292714", "text": "func (in *VegetaList) DeepCopy() *VegetaList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VegetaList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" } ]
[ { "docid": "264e892db7f803b493e0a30420ef174c", "score": "0.7664129", "text": "func (in *Vegeta) DeepCopy() *Vegeta {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Vegeta)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "acb9bc8773a61c8dbec592468fda0476", "score": "0.589625", "text": "func (in *VegetaStatus) DeepCopy() *VegetaStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VegetaStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "08719a214a104219b9a13b8f4f8471e4", "score": "0.57712233", "text": "func (in *AzureVirtualMachineList) DeepCopy() *AzureVirtualMachineList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AzureVirtualMachineList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "0eeb58cb086fa661938c2121a2f3ce94", "score": "0.55155426", "text": "func (in *VegetaSpec) DeepCopy() *VegetaSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VegetaSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "5331d31166e10be06ce90381b8ca6e43", "score": "0.5456321", "text": "func (in *VegetaList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5df752183effc53c533839e6fe4f60b1", "score": "0.5425427", "text": "func (in *ElasticsearchList) DeepCopy() *ElasticsearchList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ElasticsearchList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "42cea5de113ab0a4e67ec93031cb84b7", "score": "0.5386063", "text": "func (in *PeanutStageList) DeepCopy() *PeanutStageList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PeanutStageList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "f22be110ae96d594c3d679835f7d664a", "score": "0.5359288", "text": "func (in *KlovercloudFacadeList) DeepCopy() *KlovercloudFacadeList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KlovercloudFacadeList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "16c453be970d7aec009be4e4028659e1", "score": "0.5340567", "text": "func (in *ViewerList) DeepCopy() *ViewerList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ViewerList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "666e16734d8b1edfb587b5ab1238040c", "score": "0.53110456", "text": "func (in *KeevakindList) DeepCopy() *KeevakindList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KeevakindList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "7deae1ad0057c1577ed179e7c9353292", "score": "0.52873576", "text": "func (in *VpSavepointList) DeepCopy() *VpSavepointList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VpSavepointList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "70b76a4bb0e247cf0dcbd3040d0b7f88", "score": "0.5259495", "text": "func (in *VolumeList) DeepCopy() *VolumeList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VolumeList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "ac4941b7871915f729fedd259093ad39", "score": "0.512516", "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": "" }, { "docid": "8329d9d7203829154c38756af387aa2e", "score": "0.5117196", "text": "func (in *VegetaList) DeepCopyInto(out *VegetaList) {\n\t*out = *in\n\tout.TypeMeta = in.TypeMeta\n\tin.ListMeta.DeepCopyInto(&out.ListMeta)\n\tif in.Items != nil {\n\t\tin, out := &in.Items, &out.Items\n\t\t*out = make([]Vegeta, 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": "6a023103c36d85f255bcc257c512c5e1", "score": "0.5114619", "text": "func (in *GuestbookList) DeepCopy() *GuestbookList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GuestbookList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "19c789dfa89fb7eab42b9fe68ccf574e", "score": "0.5086393", "text": "func (in *PetList) DeepCopy() *PetList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PetList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "a188669f2da60fdaf50913849f21ebcc", "score": "0.5085482", "text": "func (in *PeeringList) DeepCopy() *PeeringList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PeeringList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "4462c0d5e468810a6900a7fc47975fa0", "score": "0.50849384", "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": "4462c0d5e468810a6900a7fc47975fa0", "score": "0.50849384", "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": "7bb72976a5bc16f688ae55a762d5bf83", "score": "0.5070042", "text": "func (in *DialogflowAgentList) DeepCopy() *DialogflowAgentList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DialogflowAgentList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "1886d693a49c5f1b784b5f552a3ea85a", "score": "0.5062974", "text": "func (in *TenantList) DeepCopy() *TenantList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(TenantList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "8c15364e59b1d413e2d4b9d918200684", "score": "0.5061493", "text": "func (in *VpcPeeringList) DeepCopy() *VpcPeeringList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VpcPeeringList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "e5dd1a12def911d3c7def5621a7a8744", "score": "0.50576454", "text": "func (in *FactoryList) DeepCopy() *FactoryList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FactoryList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "cf9fa1ecf5d9d7fabe51c4d16d8ddfc6", "score": "0.50562996", "text": "func (in *AzureVMScaleSetList) DeepCopy() *AzureVMScaleSetList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AzureVMScaleSetList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "48814ec5a7d1d114479829cf14b73f32", "score": "0.502756", "text": "func (in *VaultServerList) DeepCopy() *VaultServerList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VaultServerList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "ddc50349792e543d0ed83a5acfe98965", "score": "0.5011466", "text": "func (in *AndroidFarmList) DeepCopy() *AndroidFarmList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AndroidFarmList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "8e412010727f83213278ced41d2a615c", "score": "0.50096095", "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": "e707b0e17be9a1e99d4b5561e527ceed", "score": "0.49918377", "text": "func ListaVinhos(a *Adega) ([]Vinho, error) {\n\n\tvar vinhos []Vinho\n\ta.Lock()\n\tfor _, value := range a.A {\n\t\tvinhos = append(vinhos, value)\n\t}\n\ta.Unlock()\n\n\tif len(vinhos) == 0 {\n\t\t//Sem vinhos\n\t\treturn nil, errors.New(\"Nenhum vinho\")\n\t}\n\n\treturn vinhos, nil\n}", "title": "" }, { "docid": "284f63fcd86666822a456a9ae2c0e6b6", "score": "0.49789417", "text": "func (in *KeyVaultList) DeepCopy() *KeyVaultList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KeyVaultList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "7035b8364f0403ad59354a7d8a0645e7", "score": "0.49762636", "text": "func (in *SidecarList) DeepCopy() *SidecarList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SidecarList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "26e4a32c305e626658a3f83f5ff114fd", "score": "0.49615583", "text": "func (in *AntreaAgentInfoList) DeepCopy() *AntreaAgentInfoList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AntreaAgentInfoList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "090afb72e0b7d229485342a85eb13b6e", "score": "0.49373415", "text": "func (in *EtcdPeerList) DeepCopy() *EtcdPeerList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EtcdPeerList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "8a206b6f413167eb0f8cccd7b46f8ca4", "score": "0.49361625", "text": "func (in *ValheimVerticalScalerList) DeepCopy() *ValheimVerticalScalerList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ValheimVerticalScalerList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "38b832f611d4a0582026eb358a9fdf49", "score": "0.49288017", "text": "func (in *ApigeeNATAddressList) DeepCopy() *ApigeeNATAddressList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ApigeeNATAddressList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "c811812c4b29b0441110736d65eb5ee9", "score": "0.49253795", "text": "func (in *VolumeTransactionList) DeepCopy() *VolumeTransactionList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VolumeTransactionList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "cec5506b7fd406973e29606d5d85259c", "score": "0.49233115", "text": "func (in *VpNamespaceList) DeepCopy() *VpNamespaceList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VpNamespaceList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "104cf2aa5fe7a79e2805a908ffc5961b", "score": "0.49122348", "text": "func (in *NestedEtcdList) DeepCopy() *NestedEtcdList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NestedEtcdList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "087fd0b30904c679e2f367cce12c5b7d", "score": "0.49012476", "text": "func (in *CASVolumeList) DeepCopy() *CASVolumeList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CASVolumeList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "cf9e1777491a6c08bfc2b9c6b3c465ed", "score": "0.4874317", "text": "func (in *VpDeploymentList) DeepCopy() *VpDeploymentList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VpDeploymentList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "a01020d800906faf6e524719e603c89b", "score": "0.48718527", "text": "func (in *ServiceList) DeepCopy() *ServiceList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ServiceList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "8562866631de40699459e69fc9df1ae9", "score": "0.48533362", "text": "func (in *AttesterList) DeepCopy() *AttesterList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AttesterList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "7dcf3cd01e98c48d7027b2d7d853eec9", "score": "0.4816023", "text": "func (in *AzureLoadBalancerList) DeepCopy() *AzureLoadBalancerList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AzureLoadBalancerList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "547f9e808fca081841d6c4a8878c5b6d", "score": "0.48126632", "text": "func (in *AmbassadorListenerList) DeepCopy() *AmbassadorListenerList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AmbassadorListenerList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "068a78a66d65a26e120b86e602f90d94", "score": "0.4804107", "text": "func (in *AzurePublicIPAddressList) DeepCopy() *AzurePublicIPAddressList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AzurePublicIPAddressList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "c63dc406d086ea370f35c8fa2f7c0ee8", "score": "0.4800432", "text": "func (in *Vegeta) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "42f05422044129bec2d430a5bc194a97", "score": "0.47901273", "text": "func (in *TierList) DeepCopy() *TierList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(TierList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "7d40e2187f4452611aa38596b9cf84b3", "score": "0.47875878", "text": "func (in *AddressPlanList) DeepCopy() *AddressPlanList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AddressPlanList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "7d40e2187f4452611aa38596b9cf84b3", "score": "0.47875878", "text": "func (in *AddressPlanList) DeepCopy() *AddressPlanList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AddressPlanList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "471a0c849ec3b8f8e1c1c8dfcfe48c2d", "score": "0.47841188", "text": "func (in *KnativeServingList) DeepCopy() *KnativeServingList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KnativeServingList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "c2bdafb076b7f648297c48aae8664242", "score": "0.47826728", "text": "func (in *PostgreSQLVNetRuleList) DeepCopy() *PostgreSQLVNetRuleList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PostgreSQLVNetRuleList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "3a2bb6e27bbf5a543aa4ad04fe010320", "score": "0.47820726", "text": "func (in *NuxeoList) DeepCopy() *NuxeoList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NuxeoList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "84b5f75a02192612858b0b5a5be84eff", "score": "0.47651905", "text": "func (in *MySQLVNetRuleList) DeepCopy() *MySQLVNetRuleList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(MySQLVNetRuleList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "7825e2760cb4f40702351e5d0596460c", "score": "0.47491887", "text": "func (in *PrestoTableList) DeepCopy() *PrestoTableList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PrestoTableList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "b0531e00e3812da7bf62b1e21e9e874e", "score": "0.47451097", "text": "func (in *AzureSQLVNetRuleList) DeepCopy() *AzureSQLVNetRuleList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AzureSQLVNetRuleList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "5a0d1e0b2e01fce1d33877979456852c", "score": "0.47345364", "text": "func (in *RpaasInstanceList) DeepCopy() *RpaasInstanceList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RpaasInstanceList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "0702727448898e98a777a5aa9a68e8ee", "score": "0.4725382", "text": "func (in *InstanceList) DeepCopy() *InstanceList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(InstanceList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "0702727448898e98a777a5aa9a68e8ee", "score": "0.4725382", "text": "func (in *InstanceList) DeepCopy() *InstanceList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(InstanceList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "0702727448898e98a777a5aa9a68e8ee", "score": "0.4725382", "text": "func (in *InstanceList) DeepCopy() *InstanceList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(InstanceList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "0702727448898e98a777a5aa9a68e8ee", "score": "0.4725382", "text": "func (in *InstanceList) DeepCopy() *InstanceList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(InstanceList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "c4297c8acda1dac9847ea21053b76588", "score": "0.4718563", "text": "func (in *BaleList) DeepCopy() *BaleList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BaleList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "4a2a4c7825df09fe91c07708c290d759", "score": "0.4712054", "text": "func (in *AlicloudMachineList) DeepCopy() *AlicloudMachineList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AlicloudMachineList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "3a2b65b368376f684975201fd4d8772d", "score": "0.4711285", "text": "func (in *AntreaControllerInfoList) DeepCopy() *AntreaControllerInfoList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AntreaControllerInfoList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "326d2b66240321d89082b578107d7128", "score": "0.47075808", "text": "func (in *AdamList) DeepCopy() *AdamList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AdamList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "4bbc53402eecb4668d69d1967b3d591d", "score": "0.46922585", "text": "func (in *ApplicationRevisionList) DeepCopy() *ApplicationRevisionList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ApplicationRevisionList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "aaa27b0fe9b4981840a28a72b92ba08e", "score": "0.46885854", "text": "func (in *ZoneList) DeepCopy() *ZoneList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ZoneList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "9bac0339fdd5069335f90a327048f112", "score": "0.46868205", "text": "func (in *CustomGrafanaDashboardList) DeepCopy() *CustomGrafanaDashboardList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CustomGrafanaDashboardList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "6e0f1071d7d628ca49f1f28c5d673a44", "score": "0.46864074", "text": "func (in *SensuAgentList) DeepCopy() *SensuAgentList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SensuAgentList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "ed20d378fb6982812cd4cec4d82b07ad", "score": "0.46821672", "text": "func (in *VirtualMachineTemplateVersionList) DeepCopy() *VirtualMachineTemplateVersionList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VirtualMachineTemplateVersionList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "8be7e5a64af5060c86e5fff8da922451", "score": "0.46778575", "text": "func (in *BrucoList) DeepCopy() *BrucoList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BrucoList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "b2fc15ec4d28b27be27bd0eda7be2951", "score": "0.46725324", "text": "func (in *ClusteragentList) DeepCopy() *ClusteragentList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ClusteragentList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "0d9b45efedfe82c3c61a32690e0557bd", "score": "0.46664676", "text": "func (in *SiteWhereScriptVersionList) DeepCopy() *SiteWhereScriptVersionList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SiteWhereScriptVersionList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "38285e3ba69e81732c9b914f51684a66", "score": "0.4666196", "text": "func (in *VfInfo) DeepCopy() *VfInfo {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VfInfo)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "091d3a3898663ba7cf63f5903464ded9", "score": "0.46617284", "text": "func (in *TimezoneList) DeepCopy() *TimezoneList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(TimezoneList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "7f0d96dbc4c0dc6afc744ad1fe8d0018", "score": "0.4659909", "text": "func (in *RouteTableList) DeepCopy() *RouteTableList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RouteTableList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "7d3a61777109f8668170b1351fc2beae", "score": "0.4642817", "text": "func (in *InfraVizList) DeepCopy() *InfraVizList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(InfraVizList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "97a9a93d2f914fce9012fa6a45aa21cf", "score": "0.4633455", "text": "func (in *TKEClusterList) DeepCopy() *TKEClusterList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(TKEClusterList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "8c38003a3ea0bf5ab18a22e1b31e4768", "score": "0.46305048", "text": "func (in *AzureClusterList) DeepCopy() *AzureClusterList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AzureClusterList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "007614dc13b8eacda4b1307ce3cc7c0a", "score": "0.46181628", "text": "func (in *FlowTestList) DeepCopy() *FlowTestList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FlowTestList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "94348bcae072aaa1d1eda9099d0d5a0c", "score": "0.45958987", "text": "func (in *ApimServiceList) DeepCopy() *ApimServiceList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ApimServiceList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "9e4c28ef9662bb41788d1b6e1bfd9dd7", "score": "0.45951435", "text": "func (in *EventTypeList) DeepCopy() *EventTypeList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EventTypeList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "9e4c28ef9662bb41788d1b6e1bfd9dd7", "score": "0.45951435", "text": "func (in *EventTypeList) DeepCopy() *EventTypeList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EventTypeList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "7082c533f694e0d0f4bfe1f6257bfb32", "score": "0.45907217", "text": "func (in *PeanutPipelineList) DeepCopy() *PeanutPipelineList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PeanutPipelineList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "b2b6f246a82c436251221be2cd13be86", "score": "0.4587222", "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": "445f649d0a77cf2bb5fed9224a7c7af7", "score": "0.45823428", "text": "func (in *EventList) DeepCopy() *EventList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EventList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "23de1db2c345f8019c6f26bb30a22070", "score": "0.45722643", "text": "func (in *DialogflowFulfillmentList) DeepCopy() *DialogflowFulfillmentList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DialogflowFulfillmentList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "a316f0457120557cb3fd48639f1ac2e6", "score": "0.45681086", "text": "func (in *VSphereSourceList) DeepCopy() *VSphereSourceList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VSphereSourceList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "0ed6fc0d751efad16f13cd6cf1d6b368", "score": "0.45600882", "text": "func (in *Guestbook1List) DeepCopy() *Guestbook1List {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Guestbook1List)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "eb2971edaf4a2e861178d919980e9047", "score": "0.45599398", "text": "func (in *OfferingList) DeepCopy() *OfferingList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(OfferingList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "c0270d74a1e18e60b34b1138920b205d", "score": "0.45590895", "text": "func (in *VirtualMachineBackupList) DeepCopy() *VirtualMachineBackupList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VirtualMachineBackupList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "3b685778bb24f5dd71b1d17e2e0d4da4", "score": "0.4554972", "text": "func (in *EdgePodList) DeepCopy() *EdgePodList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(EdgePodList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "c6834c759e7e19f76669c4be2b9a31a2", "score": "0.45542407", "text": "func (in *ClickHouseClusterList) DeepCopy() *ClickHouseClusterList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ClickHouseClusterList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "97ca332789b1d38ca2e05019256c5362", "score": "0.45521718", "text": "func (in *AssetList) DeepCopy() *AssetList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AssetList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "1e63aa3b3b5c2786093ef17926344218", "score": "0.45496002", "text": "func (in *TimezonesList) DeepCopy() *TimezonesList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(TimezonesList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "d218071fe1ef60bd229c274e83dc0cde", "score": "0.4546784", "text": "func (in *FilterList) DeepCopy() *FilterList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FilterList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "0649bbea9e83fa4b772f7576a945eb55", "score": "0.45365927", "text": "func (in *ApigeeInstanceList) DeepCopy() *ApigeeInstanceList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ApigeeInstanceList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "d5102c2b86528f7adf7cea0ef26d68e5", "score": "0.4520673", "text": "func (in *AmbassadorHostList) DeepCopy() *AmbassadorHostList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AmbassadorHostList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "bb851baf4ad36e8a5245644f2c1353b9", "score": "0.45181084", "text": "func (in *FloatingIPAssociateList) DeepCopy() *FloatingIPAssociateList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FloatingIPAssociateList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "c84e589a2ad60352ff56a068e75a48d3", "score": "0.4517943", "text": "func (in *AzureMachineList) DeepCopy() *AzureMachineList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AzureMachineList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "b8a082c01c15bd113685b85e6c686c2e", "score": "0.45159093", "text": "func (in *FunctionList) DeepCopy() *FunctionList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FunctionList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "b8a082c01c15bd113685b85e6c686c2e", "score": "0.45159093", "text": "func (in *FunctionList) DeepCopy() *FunctionList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FunctionList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" } ]
3a91281569670e269889e540fa478600
loop serializes the events that hit the Writer. That includes user requests, like Write, Sync, and Stop; and the time.Ticker that controls timebased segment rotation. We need this single point of synchronization only because of the timebased segment rotation, which is asynchronous. Without that, we could control everything pretty elegantly from the Write method via a simple mutex.
[ { "docid": "bf3cf23c324b5eb879b8ea8fea4404b0", "score": "0.6347821", "text": "func (w *Writer) loop(d time.Duration) {\n\trotate := time.NewTicker(d)\n\tdefer rotate.Stop()\n\tfor {\n\t\tselect {\n\t\tcase f := <-w.action:\n\t\t\tf()\n\n\t\tcase <-rotate.C:\n\t\t\t// Note we invoke closeRotate every d, even if it's been only a\n\t\t\t// short while since the last flush to disk. This could be optimized\n\t\t\t// by only starting the timer once bytes are written and resetting\n\t\t\t// it with every segment rotation, at the cost of some garbage\n\t\t\t// generation. Profiling data is necessary.\n\t\t\tw.closeRotate()\n\n\t\tcase c := <-w.stop:\n\t\t\tw.closeOnly()\n\t\t\tw.stop = nil\n\t\t\tclose(c)\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" } ]
[ { "docid": "dadd513cd87def042a64179d3ed180ea", "score": "0.600147", "text": "func (c *client) writer() {\n\tfor {\n\t\tselect {\n\t\tcase event := <-c.toWriter:\n\t\t\tif event == CLOSE {\n\t\t\t\tc.ctrl.leavingClients <- c\n\t\t\t\treturn\n\t\t\t}\n\t\t\tsw, err := c.ws.NextWriter(websocket.BinaryMessage)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"Error getting next writer: %v\", err)\n\t\t\t\tc.ctrl.leavingClients <- c\n\t\t\t\treturn\n\t\t\t}\n\t\t\terr = png.Encode(sw, c.ctrl.img)\n\t\t\tsw.Close()\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"Error encoding image: %v\", err)\n\t\t\t}\n\t\t\tc.toController <- DONE\n\t\t}\n\t}\n}", "title": "" }, { "docid": "58e81ff6ffbca2215762fb9e9e11c9e5", "score": "0.59512585", "text": "func (w *writer) loop() {\n\tdefer func() {\n\t\tw.handle.Close()\n\n\t\tclose(w.responseChan)\n\t\tclose(w.closedChan)\n\t}()\n\n\tfor atomic.LoadInt32(&w.running) == 1 {\n\t\tvar msg types.Message\n\t\tvar open bool\n\t\tselect {\n\t\tcase msg, open = <-w.messages:\n\t\t\tif !open {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tw.stats.Incr(\"writer.message.received\", 1)\n\t\tcase <-w.closeChan:\n\t\t\treturn\n\t\t}\n\t\tvar err error\n\t\tif len(msg.Parts) == 1 {\n\t\t\t_, err = fmt.Fprintf(w.handle, \"%s\\n\", msg.Parts[0])\n\t\t} else {\n\t\t\t_, err = fmt.Fprintf(w.handle, \"%s\\n\\n\", bytes.Join(msg.Parts, []byte(\"\\n\")))\n\t\t}\n\t\tselect {\n\t\tcase w.responseChan <- types.NewSimpleResponse(err):\n\t\t\tw.stats.Incr(\"writer.message.sent\", 1)\n\t\tcase <-w.closeChan:\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c4f5c1af36c4aad7088d10192951b483", "score": "0.58301795", "text": "func (m *Main) Writer() {\n\tfor tr := range m.complete {\n\t\tif err := m.enc.EncodeAll(tr); err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tm.wg.Done()\n\t}\n}", "title": "" }, { "docid": "03b595ef35bb9873833fd1cbbe06215c", "score": "0.5823888", "text": "func startEventWriter(ew EventWriter, events <-chan Event, wg *sync.WaitGroup) {\n\tfor event := range events {\n\t\terr := writeEvent(ew, event)\n\t\tif err == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\t// At this point the EventWriter is bad and we won't write to it anymore.\n\t\tew.HandleError(err)\n\n\t\t// todo: improve this, don't send to the channel anymore if the writer is\n\t\t// bad.\n\t\tdrain(events)\n\t\tbreak\n\t}\n\n\twg.Done()\n}", "title": "" }, { "docid": "16b0255980b1a7a4a9a7cacc88e7fa24", "score": "0.5810126", "text": "func writer(i int) {\n\t// Only allow one Goroutine to read/write to the slice at a time.\n\trwMutex.Lock()\n\t{\n\t\t// Capture the current read count.\n\t\t// Keep this safe though we can due without this call.\n\t\t// We want to make sure that no other Goroutines are reading. The value of rc should always\n\t\t// be 0 when this code run.\n\t\trc := atomic.LoadInt64(&readCount)\n\n\t\t// Perform some work since we have a full lock.\n\t\tfmt.Printf(\"****> : Performing Write : RCount[%d]\\n\", rc)\n\t\tdata = append(data, fmt.Sprintf(\"String: %d\", i))\n\t}\n\trwMutex.Unlock()\n}", "title": "" }, { "docid": "a68c1c8d01255df1859108b06b6d76c0", "score": "0.58099896", "text": "func (s *BufferedWriteSyncer) flushLoop() {\n\tdefer close(s.done)\n\n\tfor {\n\t\tselect {\n\t\tcase <-s.ticker.C:\n\t\t\t// we just simply ignore error here\n\t\t\t// because the underlying bufio writer stores any errors\n\t\t\t// and we return any error from Sync() as part of the close\n\t\t\t_ = s.Sync()\n\t\tcase <-s.stop:\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ac58f0c84e8d7ea6a1e37184c2218f20", "score": "0.57799906", "text": "func writeHandler(consolidateTimers map[string]int64) {\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\twriteHandler(consolidateTimers)\n\t\t}\n\t}()\n\tif consolidateTimers == nil {\n\t\tconsolidateTimers = make(map[string]int64)\n\t}\n\tif verbose {\n\t\tprintln(\"start writeHandler\")\n\t}\n\tfor {\n\t\tselect {\n\t\tcase <-writeRstChannel:\n\t\t\tif verbose {\n\t\t\t\tfmt.Println(\"writeHandler closing\")\n\t\t\t}\n\t\t\twriteRstChannel <- nil\n\t\tcase nw := <-writeChannel:\n\t\t\t//fmt.Println(\"received\", nw)\n\t\t\tif nw.file != nil {\n\t\t\t\tif nw.c != nil {\n\t\t\t\t\tname := fmt.Sprintf(\"%v\", nw.file.Name())\n\t\t\t\t\ttm, skip := consolidateTimers[name]\n\t\t\t\t\tif skip {\n\t\t\t\t\t\tskip = time.Now().Unix()-tm < int64(options.IntervalCompacting)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconsolidateTimers[name] = time.Now().Unix() - 1\n\t\t\t\t\t}\n\t\t\t\t\tif !skip {\n\t\t\t\t\t\t// consolidation\n\t\t\t\t\t\tif e := nw.file.Truncate(0); e == nil {\n\t\t\t\t\t\t\tif _, e = nw.file.Seek(0, 0); e == nil {\n\t\t\t\t\t\t\t\tfor i, v := range nw.c.bucketItems() {\n\t\t\t\t\t\t\t\t\tif fmt.Sprintf(\"%v\", v.Object) != \"\" {\n\t\t\t\t\t\t\t\t\t\tif data, err := json.Marshal(FileData{\n\t\t\t\t\t\t\t\t\t\t\tKey: i,\n\t\t\t\t\t\t\t\t\t\t\tValue: fmt.Sprintf(\"%v\", v.Object),\n\t\t\t\t\t\t\t\t\t\t}); err == nil {\n\t\t\t\t\t\t\t\t\t\t\t_, _ = nw.file.WriteString(string(data) + \"\\n\")\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\tcontinue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Update\n\t\t\t\tif data, err := json.Marshal(FileData{\n\t\t\t\t\tKey: nw.data[0],\n\t\t\t\t\tValue: nw.data[1],\n\t\t\t\t}); err == nil {\n\t\t\t\t\t_, _ = nw.file.WriteString(string(data) + \"\\n\")\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "98a52756aa290583d8ab89cd1114efc2", "score": "0.57671636", "text": "func (w *ServiceWriter) Run() {\n\tw.exitWG.Add(1)\n\tdefer w.exitWG.Done()\n\n\t// for now, simply flush every x seconds\n\tflushTicker := time.NewTicker(w.conf.FlushPeriod)\n\tdefer flushTicker.Stop()\n\n\tupdateInfoTicker := time.NewTicker(w.conf.UpdateInfoPeriod)\n\tdefer updateInfoTicker.Stop()\n\n\tlog.Debug(\"starting service writer\")\n\n\t// Monitor sender for events\n\tgo func() {\n\t\tfor event := range w.payloadSender.Monitor() {\n\t\t\tif event == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tswitch event := event.(type) {\n\t\t\tcase SenderSuccessEvent:\n\t\t\t\tlog.Infof(\"flushed service payload to the API, time:%s, size:%d bytes\", event.SendStats.SendTime,\n\t\t\t\t\tlen(event.Payload.Bytes))\n\t\t\t\tw.statsClient.Gauge(\"datadog.trace_agent.service_writer.flush_duration\",\n\t\t\t\t\tevent.SendStats.SendTime.Seconds(), nil, 1)\n\t\t\t\tatomic.AddInt64(&w.stats.Payloads, 1)\n\t\t\tcase SenderFailureEvent:\n\t\t\t\tlog.Errorf(\"failed to flush service payload, time:%s, size:%d bytes, error: %s\",\n\t\t\t\t\tevent.SendStats.SendTime, len(event.Payload.Bytes), event.Error)\n\t\t\t\tatomic.AddInt64(&w.stats.Errors, 1)\n\t\t\tcase SenderRetryEvent:\n\t\t\t\tlog.Errorf(\"retrying flush service payload, retryNum: %d, delay:%s, error: %s\",\n\t\t\t\t\tevent.RetryNum, event.RetryDelay, event.Error)\n\t\t\t\tatomic.AddInt64(&w.stats.Retries, 1)\n\t\t\tdefault:\n\t\t\t\tlog.Debugf(\"don't know how to handle event with type %T\", event)\n\t\t\t}\n\t\t}\n\t}()\n\n\t// Main loop\n\tfor {\n\t\tselect {\n\t\tcase sm := <-w.InServices:\n\t\t\tw.handleServiceMetadata(sm)\n\t\tcase <-flushTicker.C:\n\t\t\tw.flush()\n\t\tcase <-updateInfoTicker.C:\n\t\t\tgo w.updateInfo()\n\t\tcase <-w.exit:\n\t\t\tlog.Info(\"exiting service writer, flushing all modified services\")\n\t\t\tw.flush()\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d36ff61c4a80d1d6a6b96038d254f33e", "score": "0.5732187", "text": "func (this *Player) writeLoop() {\n\t// Loop until data is ready to be sent.\n\tjson := json.NewEncoder(this.connection)\n\tfor {\n\t\tselect {\n\t\t// Data is ready to be sent on channel.\n\t\tcase cmd, ok := <-this.commandQueue:\n\t\t\t// An error occured while retrieving the queued message.\n\t\t\tif !ok {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// We got ourself a nice command!\n\t\t\tif _, err := fmt.Fprintf(this.connection, \"%s\\r\", cmd.Type); err != nil {\n\t\t\t\tlog.Warning(\"Failed to send next packet type to player %s: %s\", this.uuid, err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// Try to send the message, and handle failure.\n\t\t\tif _, err := fmt.Fprintf(this.connection, \"%s\\n\", json.Encode(cmd.Command)); err != nil {\n\t\t\t\tlog.Warning(\"Failed to send packet to player %s: %s\", this.uuid, err)\n\t\t\t\treturn\n\t\t\t}\n\t\t// This player was asked to exit the loop.\n\t\tcase <-this.exit:\n\t\t\treturn\n\t\tcase <-time.After(1 * time.Second):\n\t\t}\n\t}\n}", "title": "" }, { "docid": "dca022fdc61863522f94363b4b5eac6c", "score": "0.5704108", "text": "func writeEvents() {\n\tvar wg sync.WaitGroup\n\twg.Add(len(eventWriters))\n\n\t// Create event sub channels for each EventWriter and start each EventWriter.\n\tvar eventSubChannels = make([]chan Event, len(eventWriters))\n\tfor i, ew := range eventWriters {\n\t\teventSubChannels[i] = make(chan Event, defaultEventChannelSize)\n\t\tgo startEventWriter(ew, eventSubChannels[i], &wg)\n\t}\n\n\t// Fan out the events to all the sub channels.\n\tfor event := range eventChannel {\n\t\tfor _, eventSubChannel := range eventSubChannels {\n\t\t\teventSubChannel <- event\n\t\t}\n\t}\n\n\t// Close each sub channel.\n\tfor _, eventSubChannel := range eventSubChannels {\n\t\tclose(eventSubChannel)\n\t}\n\n\twg.Wait()\n\teventChannelClosed <- struct{}{}\n}", "title": "" }, { "docid": "44408f7aefae70e6388a06ac7a18e0ae", "score": "0.5651441", "text": "func (agg *AggregateLoop) startWriteLooper(mws *multiWriter) {\n\tif agg.shutitdown {\n\t\tagg.log.Warning(\"Got shutdown signal, not starting writers\")\n\t\treturn\n\t}\n\n\tshut := agg.Shutdown.Listen()\n\n\t_dur := mws.flush\n\t_ttl := mws.ttl\n\t_ttlS := uint32(_ttl.Seconds())\n\t_durS := uint32(_dur.Seconds())\n\n\t// start up the writers listeners\n\tfor _, w := range mws.ws {\n\t\tw.Start()\n\t}\n\n\tstatsdName := fmt.Sprintf(\"aggregator.%s.writesloops\", _dur.String())\n\tpost := func(w *writers.WriterLoop, items repr.StatReprSlice) {\n\t\tdefer stats.StatsdSlowNanoTimeFunc(\"aggregator.postwrite-time-ns\", time.Now())\n\n\t\t//_mu.Lock()\n\t\t//defer _mu.Unlock()\n\n\t\tif w.Full() {\n\t\t\tagg.log.Critical(\n\t\t\t\t\"Saddly the write queue is full, if we continue adding to it, the entire world dies, we have to bail this write tick (metric queue: %d, indexer queue: %d)\",\n\t\t\t\tw.MetricQLen,\n\t\t\t\tw.IndexerQLen,\n\t\t\t)\n\t\t\treturn\n\t\t}\n\n\t\tfor _, stat := range items {\n\t\t\t//fmt.Println(\"FLUSH POST: \", stat.Name.Key, \"time: \", stat.Time, \"count:\", stat.Count)\n\t\t\tstat.Name.Resolution = _durS\n\t\t\tstat.Name.Ttl = _ttlS // need to add in the TTL\n\t\t\tw.WriterChan() <- stat\n\t\t}\n\t\t//agg.log.Critical(\"CHAN WRITE: LEN: %d Items: %d\", len(writer.WriterChan()), m_items)\n\t\t//agg.Aggregators.Clear(duration) // clear now before any \"new\" things get added\n\t\t// need to clear out the Agg\n\t\tstats.StatsdClientSlow.Incr(statsdName, 1)\n\t\treturn\n\t}\n\n\tagg.log.Notice(\"Starting Aggregater Loop for %s\", _dur.String())\n\tvar ticker *time.Ticker\n\t// either flush at a random \"duration interval\" or flush at time % duration interval\n\tif agg.flush_random_ticker {\n\t\tagg.log.Notice(\"Aggregater Loop for %s at random start .. starting: %d\", _dur.String(), time.Now().Unix())\n\t\tticker = time.NewTicker(_dur)\n\t} else {\n\t\tagg.log.Notice(\"Aggregater Loop for %s starting at time %% %s .. starting %d\", _dur.String(), _dur.String(), time.Now().Unix())\n\t\tticker = agg.delayRoundedTicker(_dur)\n\t}\n\tfor {\n\t\tselect {\n\t\tcase dd := <-ticker.C:\n\t\t\titems := agg.Aggregators.Get(_dur).GetListAndClear()\n\t\t\tiLen := len(items)\n\t\t\tagg.log.Debug(\n\t\t\t\t\"Flushing %d stats in bin %s to writer at: %d\",\n\t\t\t\tiLen,\n\t\t\t\t_dur.String(),\n\t\t\t\tdd.Unix(),\n\t\t\t)\n\t\t\tif iLen == 0 {\n\t\t\t\tagg.log.Debug(\n\t\t\t\t\t\"No stats to send to writer in bin %s at: %d\",\n\t\t\t\t\t_dur.String(),\n\t\t\t\t\tdd.Unix(),\n\t\t\t\t)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor _, w := range mws.ws {\n\t\t\t\t// to ensure time order of inputs, this cannot be a go routine, so we have to block here\n\t\t\t\tpost(w, items)\n\t\t\t}\n\n\t\tcase <-shut.Ch:\n\t\t\tticker.Stop()\n\t\t\tshut.Close()\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c4c0364f4e9ced1823321da78ddac828", "score": "0.56373507", "text": "func (w *StatsWriter) Run() {\n\tw.exitWG.Add(1)\n\tdefer w.exitWG.Done()\n\n\tlog.Debug(\"starting stats writer\")\n\n\tupdateInfoTicker := time.NewTicker(w.conf.UpdateInfoPeriod)\n\tdefer updateInfoTicker.Stop()\n\n\t// Monitor sender for events\n\tgo func() {\n\t\tfor event := range w.payloadSender.Monitor() {\n\t\t\tif event == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tswitch event := event.(type) {\n\t\t\tcase SenderSuccessEvent:\n\t\t\t\tlog.Infof(\"flushed stat payload to the API, time:%s, size:%d bytes\", event.SendStats.SendTime,\n\t\t\t\t\tlen(event.Payload.Bytes))\n\t\t\t\tw.statsClient.Gauge(\"datadog.trace_agent.stats_writer.flush_duration\",\n\t\t\t\t\tevent.SendStats.SendTime.Seconds(), nil, 1)\n\t\t\t\tatomic.AddInt64(&w.stats.Payloads, 1)\n\t\t\tcase SenderFailureEvent:\n\t\t\t\tlog.Errorf(\"failed to flush stat payload, time:%s, size:%d bytes, error: %s\",\n\t\t\t\t\tevent.SendStats.SendTime, len(event.Payload.Bytes), event.Error)\n\t\t\t\tatomic.AddInt64(&w.stats.Errors, 1)\n\t\t\tcase SenderRetryEvent:\n\t\t\t\tlog.Errorf(\"retrying flush stat payload, retryNum: %d, delay:%s, error: %s\",\n\t\t\t\t\tevent.RetryNum, event.RetryDelay, event.Error)\n\t\t\t\tatomic.AddInt64(&w.stats.Retries, 1)\n\t\t\tdefault:\n\t\t\t\tlog.Debugf(\"don't know how to handle event with type %T\", event)\n\t\t\t}\n\t\t}\n\t}()\n\n\tfor {\n\t\tselect {\n\t\tcase stats := <-w.InStats:\n\t\t\tw.handleStats(stats)\n\t\tcase <-updateInfoTicker.C:\n\t\t\tgo w.updateInfo()\n\t\tcase <-w.exit:\n\t\t\tlog.Info(\"exiting stats writer\")\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a28a726eae19440687cdb6e48b5aeb07", "score": "0.55506986", "text": "func (w *asyncLogWriter) run() {\n\tfor buf := range w.ch {\n\t\tif _, err := w.w.Write(buf); err != nil {\n\t\t\tw.handleInnerWriteError(err)\n\t\t\tbreak\n\t\t}\n\t}\n\n\tclose(w.exitCh)\n}", "title": "" }, { "docid": "6399684e42c15c4fd30366f73a06e644", "score": "0.5546639", "text": "func (w *Writer) Serve() {\n\n\t// NewChanListener is preferred here as it passes message.Message to the\n\t// Write, where NewStreamListener works with bytes.Buffer only.\n\t// Later this could be change if perf issue noticed\n\n\tw.writeQueue = make(chan message.Message, 1000)\n\tw.subscriptionID = w.subscriber.Subscribe(topics.Kadcast, eventbus.NewChanListener(w.writeQueue))\n\n\tgo func() {\n\t\tfor msg := range w.writeQueue {\n\t\t\tif err := w.Write(msg); err != nil {\n\t\t\t\tlog.WithError(err).Trace(\"kadcast writer problem\")\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "5b0e34e811164b4e2a5563368211000f", "score": "0.55398774", "text": "func (connP *Connector) writeloop() {\n\tfor env := range connP.sch {\n\t\tcmds, err := json.Marshal(env.Pkt)\n\t\tif err != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"Error in Marshalling: %s\\n\", err)\n\t\t\tbreak\n\t\t}\n\t\tif _, err := connP.conn.WriteToUDP(cmds, &env.Addr); err != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"Error in writing: %s\\n\", err)\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5611b1de6752252b52758c61b27bb4c6", "score": "0.5539329", "text": "func (s *BufferedWriteSyncer) Sync() error {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\n\tvar err error\n\tif s.initialized {\n\t\terr = s.writer.Flush()\n\t}\n\n\treturn multierr.Append(err, s.WS.Sync())\n}", "title": "" }, { "docid": "a0ac2d66df87c25019136ff7f91e5c94", "score": "0.55201894", "text": "func (writer *SyncWriter) Sync(ctx context.Context) (synced int, err error) {\n\twriter.updateCounter(1, \"syncs\")\n\tresourceList, err := writer.listEvents()\n\tif err != nil {\n\t\treturn\n\t}\n\tfor _, resource := range resourceList {\n\t\terr = writer.syncEvent(ctx, resource)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tsynced++\n\t}\n\n\tif synced == 0 {\n\t\twriter.updateCounter(1, \"empty_syncs\")\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "cf7b89e04dba47f2f5eed5bda644517f", "score": "0.5501617", "text": "func (c *connection) writer() {\n\tlog.Print(\"connection writer gorouting starting.\")\n\tticker := time.NewTicker(pingPeriod)\n\tdefer func() {\n\t\tlog.Print(\"connection writer gorouting stopping.\")\n\t\tticker.Stop()\n\t\tclose(c.Outbound)\n\t\tc.ws.Close()\n\t}()\n\tfor {\n\t\tselect {\n\t\tcase message, ok := <-c.Outbound:\n\t\t\tif !ok {\n\t\t\t\tc.write(websocket.CloseMessage, []byte{})\n\t\t\t\tlog.Println(\"[connection.writePump] !ok.\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif err := c.write(websocket.TextMessage, []byte(message)); err != nil {\n\t\t\t\tlog.Println(\"[connection.writePump] err: '\", err, \"'.\")\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-ticker.C:\n\t\t\tif err := c.write(websocket.PingMessage, []byte{}); err != nil {\n\t\t\t\tlog.Println(\"[connection.writePump] ticker err: '\", err, \"'.\")\n\t\t\t\tlog.Println(\"ping\")\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "08547ae2a2fba88c8651f0c3d6af5f4e", "score": "0.54832345", "text": "func (c *Conn) writer() {\n\tlog.Print(\"Conn writer gorouting starting.\")\n\tpingTicker := time.NewTicker(pingPeriod)\n\tdefer func() {\n\t\tc.callHandler(Msg{Type: \"disconnect\"})\n\t\tlog.Print(\"Conn writer gorouting stopping.\")\n\t\tpingTicker.Stop()\n\t\tclose(c.Outbound)\n\t\tc.ws.Close()\n\t}()\n\tfor {\n\t\tselect {\n\t\tcase message, ok := <-c.Outbound:\n\t\t\tif !ok {\n\t\t\t\tc.write(websocket.CloseMessage, []byte{})\n\t\t\t\tlog.Println(\"[Conn.writePump] !ok.\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif err := c.write(websocket.TextMessage, []byte(message)); err != nil {\n\t\t\t\tlog.Println(\"[Conn.writePump] err: '\", err, \"'.\")\n\t\t\t\treturn\n\t\t\t}\n\t\t// When pingTicker ticks, send a PingMessage to client.\n\t\tcase <-pingTicker.C:\n\t\t\tif err := c.write(websocket.PingMessage, []byte(\"{\\\"type\\\":\\\"ping\\\"}\")); err != nil {\n\t\t\t\tlog.Println(\"[Conn.writePump] pingTicker err: '\", err, \"'.\")\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5b3af433c44515bdfae33666ca8a6d42", "score": "0.54534507", "text": "func (w *Writer) Sync() error {\n\tw.flush(false, w.Level, 0)\n\treturn nil\n}", "title": "" }, { "docid": "38d487238ba9b4990f1a4a2cb8f67ad8", "score": "0.5453447", "text": "func (w *Writer) Sync() error {\n\tc := make(chan error)\n\tw.action <- func() {\n\t\tc <- w.curr.Sync()\n\t\tw.syncs.Inc()\n\t}\n\treturn <-c\n}", "title": "" }, { "docid": "6d96b2b63a7e2022773106fa97eaf603", "score": "0.54509777", "text": "func writerWorker(){\n\n\tfor i:=0;;i++{\n\t\torder_value:=<-Order_channel\n\t\tsession, err := mgo.Dial(mongodb_server)\n if err != nil {\n \tfmt.Println(\"Orders API - Unable to connect to MongoDB during write operation\")\n panic(err)\n }\n defer session.Close()\n session.SetMode(mgo.Monotonic, true)\n c := session.DB(mongodb_database).C(mongodb_collection)\n\t\tc.Insert(order_value)\n\n\t}\n}", "title": "" }, { "docid": "27dc1385411c4fcd1fe934c6170c90de", "score": "0.5428913", "text": "func (cl *Client) writeLoop() {\n\tfor message := range cl.WriteChannel {\n\t\terr := cl.conn.WriteMessage(websocket.TextMessage, message.ToClient())\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Write error for userid %d, ip %s: %s\", cl.Id, cl.conn.RemoteAddr().String(), err)\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "896d83479f9b0602ac145607a79ab86d", "score": "0.54209626", "text": "func (session *Session) writeLoop() {\n\tdefer func() {\n\t\tif err := recover(); err != nil {\n\t\t\tlog.Errorf(`core.net.session.writeLoop\nError = %v\nStack = \n%s`,\n\t\t\t\terr,\n\t\t\t\tdebug.Stack(1, \" \"),\n\t\t\t)\n\t\t}\n\t}()\n\tdefer func() {\n\t\tclose(session.wStopChan)\n\t\tsession.Close()\n\t}()\nL:\n\tfor {\n\t\tselect {\n\t\tcase response := <-session.sendChan:\n\t\t\tif err := session.writeResponse(response); err != nil {\n\t\t\t\tbreak L\n\t\t\t}\n\t\tcase data := <-session.sendRawChan:\n\t\t\tif err := session.conn.WriteRaw(data); err != nil {\n\t\t\t\tbreak L\n\t\t\t}\n\t\tcase data := <-session.sendPacketChan:\n\t\t\tif err := session.conn.Write(data); err != nil {\n\t\t\t\tbreak L\n\t\t\t}\n\t\tcase <-session.closeChan:\n\t\t\tbreak L\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b8ed4def14797bd2d58ab68106f9c88b", "score": "0.53867835", "text": "func (pb *ProgressBar) writer() {\n\tfor {\n\t\tif atomic.LoadInt32(&pb.isFinish) != 0 {\n\t\t\tbreak\n\t\t}\n\t\tpb.Update()\n\t\ttime.Sleep(pb.RefreshRate)\n\t}\n}", "title": "" }, { "docid": "088567c02a7d1049fd71cb8f027f03d9", "score": "0.53671265", "text": "func (wh *WebsocketHandle) EventWriteLoop(hi hubio.CloudHubIO, info *emodel.HubInfo, stop chan ExitCode) {\n\twh.EventHandler.eventWriteLoop(hi, info, stop)\n}", "title": "" }, { "docid": "fe0359e716b7491871ad6a411ca13e97", "score": "0.5333509", "text": "func (conn *WsServer) writeLoop() {\n\tvar (\n\t\tdata []byte\n\t\terr error\n\t)\n\n\tfor {\n\t\tselect {\n\t\tcase data = <-conn.outChan:\n\n\t\t\t// write message\n\t\t\tif err = conn.WsConn.WriteMessage(websocket.TextMessage, data); err != nil {\n\t\t\t\tlog.Printf(\"客户端断开连接! 客户机信息:\", conn.WsConn.RemoteAddr())\n\t\t\t\tgoto ERR\n\t\t\t}\n\n\t\tcase <-conn.closeChan:\n\t\t\tlog.Print(\" 客户端断开连接! 客户机信息:\")\n\t\t\tgoto ERR\n\t\t}\n\t}\n\nERR:\n\tconn.Close()\n}", "title": "" }, { "docid": "4ac8d992a90c8f202d1895a8825a724a", "score": "0.53007233", "text": "func startEventWriter(shmName string, size int, stopCh chan struct{}, fakeErrors int) uint64 {\n\tsm, err := shm.CreateSharedMem(shmName, size)\n\tif err != nil {\n\t\tlog.Errorf(\"failed to create shared memory: %s, err: %v\", shmName, err)\n\t\treturn 0\n\t}\n\tdefer sm.Close()\n\n\tipc := sm.GetIPCInstance()\n\tipcW := shm.NewIPCWriter(ipc)\n\tvar totalEventsSent uint64\n\tfor {\n\t\tselect {\n\t\tcase <-stopCh:\n\t\t\treturn totalEventsSent\n\t\tcase <-time.After(10 * time.Millisecond):\n\n\t\t\thEvt := &halproto.Event{\n\t\t\t\tType: int32(eventtypes.SERVICE_RUNNING),\n\t\t\t\tComponent: \"reader-test\",\n\t\t\t\tMessage: fmt.Sprintf(\"test msg - %d\", totalEventsSent),\n\t\t\t}\n\t\t\tif fakeErrors > 0 {\n\t\t\t\thEvt.ObjectKey = &google_protobuf1.Any{}\n\t\t\t\tfakeErrors--\n\t\t\t}\n\n\t\t\tmsgSize := hEvt.Size()\n\t\t\tbuf := ipcW.GetBuffer(msgSize) // get buffer\n\t\t\tif buf == nil {\n\t\t\t\tlog.Errorf(\"failed to get buffer from shared memory\")\n\t\t\t\treturn totalEventsSent\n\t\t\t}\n\n\t\t\t_, err := writeEvent(buf, hEvt) // write event to the obtained buffer\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"failed to write event to shared memory\")\n\t\t\t\treturn totalEventsSent\n\t\t\t}\n\t\t\tipcW.PutBuffer(buf, msgSize)\n\t\t\ttotalEventsSent++\n\t\t\ttime.Sleep(10 * time.Millisecond)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "69670cbb91a7b78fb3b1c3826cb073e1", "score": "0.52724385", "text": "func writer() {\n\tlog.Debug(\"Started writing\")\n\tdefer wg.Done()\n\n\tvar opuslen int16\n\t// var jsonlen int32\n\n\t// 16KB output buffer\n\twbuf := bufio.NewWriterSize(OutFD, 16384)\n\tdefer wbuf.Flush()\n\tfor {\n\t\topus, ok := <-OutputChan\n\t\tif !ok {\n\t\t\t// if chan closed, exit\n\t\t\tlog.Debug(\"Finished writing\")\n\t\t\treturn\n\t\t}\n\n\t\t// write header\n\t\topuslen = int16(len(opus))\n\t\terr = binary.Write(wbuf, binary.LittleEndian, &opuslen)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"error writing output: \", err)\n\t\t\treturn\n\t\t}\n\n\t\t// write opus data to stdout\n\t\terr = binary.Write(wbuf, binary.LittleEndian, &opus)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"error writing output: \", err)\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "59ae0f9f1ccb6aac70f052952a0946ca", "score": "0.5250314", "text": "func (lw *Writer) Sync() error {\n\tlw.mu.Lock()\n\tdefer lw.mu.Unlock()\n\tlw.flushLines(true)\n\treturn nil\n}", "title": "" }, { "docid": "71ac8648c18d14d01877c3850024dbac", "score": "0.5248727", "text": "func (bw *bufioEntryWriter) Sync() error {\n\t// Flush just flushes data to io.Writer\n\tif err := bw.w.Flush(); err != nil {\n\t\treturn err\n\t}\n\t// sync syscall\n\treturn bw.f.Sync()\n}", "title": "" }, { "docid": "d2aa48dcf03187c8f56d2862f439dcbc", "score": "0.52479565", "text": "func (writer *baseFileWriter) daemon() {\n\t// tick every seconds\n\t// time base logrotate\n\tt := time.Tick(1 * time.Second)\n\t// tick every second\n\t// auto flush writer buffer\n\tf := time.Tick(1 * time.Second)\n\nDaemonLoop:\n\tfor {\n\t\tselect {\n\t\tcase <-f:\n\t\t\tif writer.Closed() {\n\t\t\t\tbreak DaemonLoop\n\t\t\t}\n\n\t\t\twriter.blog.flush()\n\t\tcase <-t:\n\t\t\tif writer.Closed() {\n\t\t\t\tbreak DaemonLoop\n\t\t\t}\n\n\t\t\tif writer.timeRotated {\n\t\t\t\t// if fileName not equal to currentFileName, it needs a time base logrotate\n\t\t\t\tif fileName := fmt.Sprintf(\"%s.%s\", writer.fileName, timeCache.Date()); writer.currentFileName != fileName {\n\t\t\t\t\twriter.resetFile()\n\t\t\t\t\twriter.currentFileName = fileName\n\n\t\t\t\t\t// when it needs to expire logs\n\t\t\t\t\tif writer.retentions > 0 {\n\t\t\t\t\t\t// format the expired log file name\n\t\t\t\t\t\tdate := timeCache.Now().Add(time.Duration(-24*(writer.retentions+1)) * time.Hour).Format(DateFormat)\n\t\t\t\t\t\texpiredFileName := fmt.Sprintf(\"%s.%s\", writer.fileName, date)\n\t\t\t\t\t\t// check if expired log exists\n\t\t\t\t\t\tif _, err := os.Stat(expiredFileName); nil == err {\n\t\t\t\t\t\t\tos.Remove(expiredFileName)\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// analyse lines && size written\n\t\t// do lines && size base logrotate\n\t\tcase size := <-writer.logSizeChan:\n\t\t\tif writer.Closed() {\n\t\t\t\tbreak DaemonLoop\n\t\t\t}\n\n\t\t\tif !writer.sizeRotated && !writer.lineRotated {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// TODO have any better solution?\n\t\t\t// use func to ensure writer.lock will be released\n\t\t\twriter.lock.Lock()\n\t\t\twriter.currentSize += int64(size)\n\t\t\twriter.currentLines++\n\t\t\twriter.lock.Unlock()\n\n\t\t\tif (writer.sizeRotated && writer.currentSize >= writer.rotateSize) || (writer.lineRotated && writer.currentLines >= writer.rotateLines) {\n\t\t\t\t// need lines && size base logrotate\n\t\t\t\tvar oldName, newName string\n\t\t\t\toldName = fmt.Sprintf(\"%s.%d\", writer.currentFileName, writer.retentions)\n\t\t\t\t// check if expired log exists\n\t\t\t\tif _, err := os.Stat(oldName); os.IsNotExist(err) {\n\t\t\t\t\tos.Remove(oldName)\n\t\t\t\t}\n\t\t\t\tif writer.retentions > 0 {\n\n\t\t\t\t\tfor i := writer.retentions - 1; i > 0; i-- {\n\t\t\t\t\t\toldName = fmt.Sprintf(\"%s.%d\", writer.currentFileName, i)\n\t\t\t\t\t\tnewName = fmt.Sprintf(\"%s.%d\", writer.currentFileName, i+1)\n\t\t\t\t\t\tos.Rename(oldName, newName)\n\t\t\t\t\t}\n\t\t\t\t\tos.Rename(writer.currentFileName, oldName)\n\n\t\t\t\t\twriter.resetFile()\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f9098bf4a7190ac9da8186d5f04dda27", "score": "0.5241456", "text": "func (client *WebsocketClient) writePump() {\n\tticker := time.NewTicker(pingPeriod)\n\n\t// at the end of writePump, close the connection and stop the ticker\n\tdefer func() {\n\t\tticker.Stop()\n\t\tclient.conn.Close()\n\t}()\n\n\tfor {\n\t\tselect {\n\t\tcase event, ok := <-client.events:\n\t\t\tif !ok {\n\t\t\t\t// if not ok, the hub closed the channel, so close the connection\n\t\t\t\tclient.conn.WriteMessage(websocket.CloseMessage, []byte{})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// only send events if client is authenticated\n\t\t\tif client.Authenticated() {\n\t\t\t\tdata, err := json.Marshal(event)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Println(\"Failed to serialize event for websocket\")\n\t\t\t\t}\n\t\t\t\tclient.send <- data\n\t\t\t}\n\t\tcase message, ok := <-client.send:\n\t\t\t// we want to send something, so first set the deadline\n\t\t\tclient.updateWriteDeadline()\n\n\t\t\t// check if reading from channel worked\n\t\t\tif !ok {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// write the message\n\t\t\tw, err := client.conn.NextWriter(websocket.TextMessage)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tw.Write(message)\n\n\t\t\t// maybe we have more messages waiting, so send them too\n\t\t\tn := len(client.send)\n\t\t\tfor i := 0; i < n; i++ {\n\t\t\t\tw.Write(newline)\n\t\t\t\tw.Write(<-client.send)\n\t\t\t}\n\n\t\t\t// close the writer and handle errors\n\t\t\tif err := w.Close(); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-ticker.C:\n\t\t\t// it's time for a ping\n\t\t\tclient.updateWriteDeadline()\n\t\t\tif err := client.conn.WriteMessage(websocket.PingMessage, nil); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "0beb2bd56ba56d83567f243686186193", "score": "0.5208758", "text": "func (c *eventClient) writePump() {\n\tticker := time.NewTicker(pingPeriod)\n\tdefer func() {\n\t\tticker.Stop()\n\t\tc.conn.Close()\n\t}()\n\tfor {\n\t\tselect {\n\t\tcase message, ok := <-c.send:\n\t\t\tc.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif !ok {\n\t\t\t\t// The hub closed the channel.\n\t\t\t\tc.conn.WriteMessage(websocket.CloseMessage, []byte{})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tw, err := c.conn.NextWriter(websocket.TextMessage)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tw.Write(message)\n\n\t\t\tif err := w.Close(); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-ticker.C:\n\t\t\tc.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif err := c.conn.WriteMessage(websocket.PingMessage, nil); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "dfb15a31427c2ffe00e5b870310e949e", "score": "0.51900995", "text": "func (writer *SyncWriter) Run(ctx context.Context, wg *sync.WaitGroup) error {\n\tdefer wg.Done()\n\n\tfor {\n\t\tif err := writer.run(ctx); err != nil {\n\t\t\tlog.Error(\"SyncWriter was interrupted: %s\", err)\n\t\t}\n\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn ctx.Err()\n\t\tcase <-time.After(writer.backoff):\n\t\t}\n\t}\n}", "title": "" }, { "docid": "baf5543e590450f4aea9f9a01992c0c5", "score": "0.5184456", "text": "func (n *node) recvWriteLoop(ws *websocket.Conn) {\n\tch := make(chan []byte, queueSize)\n\tn.fan.Add(ch)\n\tdefer func() {\n\t\tn.fan.Remove(ch)\n\t\tws.Close()\n\t}()\n\tfor msg := range ch {\n\t\terr := ws.SetWriteDeadline(time.Now().Add(writeTimeout))\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\terr = ws.WriteMessage(websocket.TextMessage, msg)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2a98be3359647143eb59c3a59d0132fb", "score": "0.5182312", "text": "func (c *Connection) startWriter() {\n\tticker := time.NewTicker(pingPeriod)\n\tdefer func() {\n\t\tticker.Stop()\n\t\tc.NotifyClose()\n\t\tc.wsConn.Close()\n\t}()\n\n\tfor {\n\t\tselect {\n\t\tcase message, ok := <-c.send:\n\t\t\tif !ok {\n\t\t\t\tc.write(websocket.CloseMessage, []byte{})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif err := c.write(websocket.TextMessage, message); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-ticker.C:\n\t\t\tif err := c.write(websocket.PingMessage, []byte{}); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a2914345aaec065473d0d7cf08a4d8b0", "score": "0.51804644", "text": "func (d *diskQueueWriter) sync() error {\n\tif d.bufferWriter != nil {\n\t\td.bufferWriter.Flush()\n\t}\n\tif d.writeFile != nil {\n\t\terr := d.writeFile.Sync()\n\t\tif err != nil {\n\t\t\td.writeFile.Close()\n\t\t\td.writeFile = nil\n\t\t\treturn err\n\t\t}\n\t}\n\td.diskReadEnd = d.diskWriteEnd\n\n\terr := d.persistMetaData()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\td.needSync = false\n\treturn nil\n}", "title": "" }, { "docid": "be5fcf167dcfd2d0afbd8bf0b07113c5", "score": "0.5161478", "text": "func (f *fmtBackend) run() {\n\tbuf := make([]*fmtReq, 0, fmtBackendQueueLen)\n\n\t//\n\t// logging loop\n\t//\n\t// 1. if we're not buffering, emit immediately\n\t// 2. if we're buffering\n\t// - run out of space or asked to flush, flush buffer then emit message\n\t//\n\n\tfor req := range f.q {\n\t\tif buf == nil {\n\t\t\t// past initial buffering => emit\n\t\t\tf.emit(req)\n\t\t} else {\n\t\t\t// flush request or buffer full => flush, stop buffering, emit\n\t\t\tif req.flush || len(buf) == cap(buf) {\n\t\t\t\tfor _, r := range buf {\n\t\t\t\t\tf.emit(r)\n\t\t\t\t}\n\t\t\t\tf.emit(req)\n\t\t\t\tbuf = nil\n\t\t\t} else {\n\t\t\t\tbuf = append(buf, req)\n\t\t\t}\n\t\t}\n\t\tif req.sync != nil {\n\t\t\treq.sync <- struct{}{}\n\t\t}\n\t\tif req.level == levelStop {\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0af9381d2f7783dae1ab2e0a2a24535e", "score": "0.5158742", "text": "func (s *Socket) Write() {\n\tticker := time.NewTicker(30 * time.Second)\n\tdefer func() {\n\t\tticker.Stop()\n\t\ts.Connection.Close()\n\t}()\n\n\tfor {\n\t\tselect {\n\t\tcase data := <-s.Send:\n\t\t\tlog.Println(\"Sending[\"+s.WorkerID+\"]\", data)\n\t\t\tif err := s.Connection.WriteMessage(websocket.TextMessage, []byte(data)); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-ticker.C:\n\t\t\tif err := s.Connection.WriteMessage(websocket.PingMessage, []byte{}); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "102c49d3bc7014010d7413186b091fed", "score": "0.51581043", "text": "func (i *Indexer) write() {\n\tvar (\n\t\terr error\n\t)\n\tfor {\n\t\tif !((<-i.signal) == indexReady) {\n\t\t\tbreak\n\t\t}\n\t\tif err = i.merge(); err != nil {\n\t\t\tbreak\n\t\t}\n\t\tif err = i.Flush(); err != nil {\n\t\t\tbreak\n\t\t}\n\t}\n\ti.merge()\n\ti.Flush()\n\tif err = i.f.Sync(); err != nil {\n\t\tlog.Errorf(\"index: %s Sync() error(%v)\", i.File, err)\n\t}\n\tif err = i.f.Close(); err != nil {\n\t\tlog.Errorf(\"index: %s Close() error(%v)\", i.File, err)\n\t}\n\treturn\n}", "title": "" }, { "docid": "cea26b3f07613d624cbc766fa34c6537", "score": "0.51214355", "text": "func (writer *Writer) route() {\n\tglog.Info(\"Writer ready to go into worker!\")\n\tfor {\n\t\tselect {\n\t\tcase <-writer.stop:\n\t\t\tglog.Info(\"Writer Got exit signal, ready to exit\")\n\t\t\treturn\n\t\tcase syncData := <-writer.queue:\n\t\t\t// notify 10 item once, decrease the log amount\n\t\t\t// TODO: use groutine to print queue length, every 10 seconds or 1minss\n\t\t\tcurrentQueueLen := len(writer.queue)\n\t\t\tif currentQueueLen != 0 && currentQueueLen%10 == 0 {\n\t\t\t\tglog.Infof(\"Data in writer's queue: %d\", currentQueueLen)\n\t\t\t}\n\n\t\t\t// FIXME: 如果某个handler的channel stuck了, 则这里会stuck\n\t\t\tif handler, ok := writer.handlers[syncData.Kind]; ok {\n\t\t\t\thandler.Handle(syncData)\n\t\t\t} else {\n\t\t\t\tglog.Errorf(\"Got unknown DataType: %s\", syncData.Kind)\n\t\t\t}\n\t\tcase syncData := <-writer.alarmQueue:\n\t\t\twriter.alertor.DoAlarm(syncData)\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "60d3147d41684e4b5b2e164f259c829e", "score": "0.5121161", "text": "func (c *Client) writePump() {\n\tticker := time.NewTicker(pingPeriod)\n\tdefer func() {\n\t\tticker.Stop()\n\t\tc.hub.unregister <- c\n\t\tcloseWs(c, types.InternalError)\n\t}()\n\tfor {\n\t\tselect {\n\t\tcase message, ok := <-c.send:\n\t\t\tc.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif !ok {\n\t\t\t\t// The hub closed the channel.\n\t\t\t\tcloseWs(c, types.InvalidConn)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tw, err := c.conn.NextWriter(websocket.TextMessage)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tw.Write(message)\n\t\t\tw.Write(sepChar)\n\n\t\t\t// Add queued chat messages to the current websocket message.\n\t\t\tn := len(c.send)\n\t\t\tfor i := 0; i < n; i++ {\n\t\t\t\tw.Write(sepChar)\n\t\t\t\tw.Write(<-c.send)\n\t\t\t\tw.Write(sepChar)\n\t\t\t}\n\n\t\t\tif err := w.Close(); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\tcase message, ok := <-c.control:\n\t\t\tc.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif !ok {\n\t\t\t\t// The hub closed the channel.\n\t\t\t\tcloseWs(c, types.InvalidConn)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tw, err := c.conn.NextWriter(websocket.TextMessage)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tw.Write(message)\n\n\t\t\ttime.Sleep(1 * time.Millisecond)\n\n\t\t\tif err := w.Close(); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\n\t\tcase <-ticker.C:\n\t\t\tc.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif err := c.conn.WriteMessage(websocket.PingMessage, nil); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a8f200479414d46b3e8352ffc591b398", "score": "0.511878", "text": "func (ee *Emitter) EmitSync(sender interface{}, args Args) {\n\tfor _, eventPtr := range ee.handler.events {\n\t\teventPtr.shot(sender, args)\n\t}\n}", "title": "" }, { "docid": "85f9b138f37f859503226b4c3f1ae5dd", "score": "0.51107574", "text": "func (c *WSClient) listenWrite(ctx context.Context, readyCh chan bool) {\n\tlevel.Info(c.coordinator.logger).Log(\"msg\", \"starting write loop for client\", \"fqdn\", c.fqdn)\n\treadyCh <- true\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\tcase <-time.After(3 * time.Second):\n\t\t\t// send websocket ping every 3s\n\t\t\tlevel.Debug(c.coordinator.logger).Log(\"msg\", \"ping\", \"fqdn\", c.fqdn)\n\t\t\terr := util.PINGER.Send(c.ws, \"ping\")\n\t\t\tif err != nil {\n\t\t\t\tlevel.Error(c.coordinator.logger).Log(\"msg\", \"ping err\", \"fqdn\", c.fqdn, \"err\", err.Error())\n\t\t\t\tdefer c.Done()\n\t\t\t\treturn\n\t\t\t}\n\n\t\tcase msg := <-c.ch:\n\t\t\t// send message to the server\n\t\t\tlevel.Info(c.coordinator.logger).Log(\"msg\", \"sending JSON msg to client\", \"fqdn\", c.fqdn, \"type\", msg.Type)\n\t\t\terr := websocket.JSON.Send(c.ws, msg)\n\t\t\tif err == io.EOF {\n\t\t\t\tc.coordinator.logger.Log(\"msg\", \"websocket got EOF\", \"fqdn\", c.fqdn)\n\n\t\t\t\tdefer c.Done()\n\t\t\t\treturn\n\t\t\t} else if err != nil {\n\t\t\t\tlevel.Error(c.coordinator.logger).Log(\"msg\", \"error sending JSON msg to client\", \"fqdn\", c.fqdn, \"err\", err.Error())\n\t\t\t} else {\n\t\t\t\tlevel.Info(c.coordinator.logger).Log(\"msg\", \"successfully sent JSON msg to client\", \"fqdn\", c.fqdn, \"type\", msg.Type)\n\t\t\t}\n\n\t\tcase <-c.doneCh:\n\t\t\t// receive done request\n\t\t\tlevel.Info(c.coordinator.logger).Log(\"msg\", \"closing listenWrite loop\", \"fqdn\", c.fqdn)\n\t\t\tc.coordinator.Del(c)\n\t\t\tdefer c.Done() // for listenRead method\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e9478bf3333ab06da368fb1d4e90486a", "score": "0.5108449", "text": "func (n *Node) syncWorker() {\n\tfor {\n\t\tque := make([]devices.ID, 0)\n\t\tid := <-n.sendUpdate\n\t\tque = append(que, id)\n\n\t\tmax := time.NewTimer(10 * time.Millisecond)\n\touter:\n\t\tfor {\n\t\t\tdelay := time.NewTimer(time.Millisecond * 1)\n\t\t\tselect {\n\t\t\tcase id := <-n.sendUpdate:\n\t\t\t\tif !delay.Stop() {\n\t\t\t\t\t<-delay.C\n\t\t\t\t}\n\t\t\t\tque = append(que, id)\n\t\t\tcase <-delay.C:\n\t\t\t\tbreak outer\n\t\t\tcase <-max.C:\n\t\t\t\tif !delay.Stop() {\n\t\t\t\t\t<-delay.C\n\t\t\t\t}\n\t\t\t\tbreak outer\n\t\t\t}\n\t\t}\n\n\t\t// send message to server\n\t\tdevs := make(devices.DeviceMap)\n\t\tfor _, id := range que {\n\t\t\td := n.GetDevice(id.ID)\n\t\t\tdevs[d.ID] = d.Copy()\n\t\t}\n\t\terr := n.WriteMessage(\"update-devices\", devs)\n\t\tif err != nil {\n\t\t\tlogrus.Error(err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1b0335f8b566b7e592f91ccc7b8f0f24", "score": "0.5097925", "text": "func (s *Subscriber) SocketWriter() {\n\tdefer func() {\n\t\tif s.conn != nil {\n\t\t\ts.conn.Close()\n\t\t}\n\t}()\n\tfor {\n\t\tselect {\n\t\tcase message, ok := <-s.send:\n\t\t\t{\n\t\t\t\ts.conn.SetWriteDeadline(time.Now().Add(WriteTimeout))\n\t\t\t\tif !ok {\n\t\t\t\t\ts.conn.WriteMessage(websocket.CloseMessage, []byte{})\n\t\t\t\t\t//Closed in the defer\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tw, err := s.conn.NextWriter(websocket.TextMessage)\n\t\t\t\tif err != nil {\n\t\t\t\t\t//Closed in the defer\n\t\t\t\t\tlog.Printf(\"Error reading from connection: %s\", err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tw.Write(message)\n\t\t\t\tn := len(s.send)\n\t\t\t\tfor i := 0; i < n; i++ {\n\t\t\t\t\tw.Write(<-s.send)\n\t\t\t\t}\n\t\t\t\tif err := w.Close(); err != nil {\n\t\t\t\t\t//Closed in the defer\n\t\t\t\t\tlog.Printf(\"Error writing connection: %s\", err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "814f8948943dc52b529f42bc97c8cdba", "score": "0.50876886", "text": "func (s *Logging) Sync() error {\n\ts.mutex.RLock()\n\tw := s.writer\n\ts.mutex.RUnlock()\n\n\treturn w.Sync()\n}", "title": "" }, { "docid": "740d4af8ac02c38822d7b705a2ddc70d", "score": "0.50874305", "text": "func (wal *writeAheadLog) threadedSyncLoop(threadsStopped chan struct{}, syncLoopStopped chan struct{}) {\n\t// Provide a place for the testing to disable the sync loop.\n\tif wal.cm.dependencies.Disrupt(\"threadedSyncLoopStart\") {\n\t\tclose(syncLoopStopped)\n\t\treturn\n\t}\n\n\tsyncInterval := 500 * time.Millisecond\n\tfor {\n\t\tselect {\n\t\tcase <-threadsStopped:\n\t\t\tclose(syncLoopStopped)\n\t\t\treturn\n\t\tcase <-time.After(syncInterval):\n\t\t\t// Commit all of the changes in the WAL to disk, and then apply the\n\t\t\t// changes.\n\t\t\twal.mu.Lock()\n\t\t\twal.commit()\n\t\t\twal.mu.Unlock()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a84b56184422d4fd61c4ecc235647260", "score": "0.5085457", "text": "func (c *Client) writeSocketEvents() {\n\n\tdefer func() {\n\t\tfmt.Printf(\"Close writer\\n\")\n\t\tc.conn.Close()\n\t}()\n\n\tdefer func() {\n\t\tr := recover()\n\t\tif r != nil {\n\t\t\tfmt.Printf(\"Recovered %s\\n\", r)\n\t\t\ttime.Sleep(1000 * time.Millisecond)\n\t\t}\n\t}()\n\n\tfor {\n\t\tselect {\n\t\tcase msg, ok := <-c.send:\n\t\t\tif !ok {\n\t\t\t\t// The hub closed the channel.\n\t\t\t\tfmt.Printf(\"Hub closed the channel\\n\")\n\t\t\t\tc.conn.WriteMessage(websocket.CloseMessage, []byte{})\n\t\t\t\treturn\n\t\t\t}\n\t\t\tc.conn.WriteJSON(*msg)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "948c02d4a7dc0c39d54a2492254438d0", "score": "0.5069695", "text": "func (c *Client) write() {\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tfmt.Println(\"write stop\", string(debug.Stack()), r)\n\t\t}\n\t}()\n\tdefer func() {\n\t\tclientManager.Disconnect <- c\n\t\t// c.Socket.Close()\n\t}()\n\n\tfor {\n\t\tselect {\n\t\tcase message, ok := <-c.Send:\n\t\t\tif !ok {\n\t\t\t\tfmt.Println(\"发送数据错误:\", c.UserID)\n\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif message.Message == \"stop\" {\n\t\t\t\tfmt.Println(\"stop message:\", message)\n\t\t\t}\n\t\t\tc.Socket.WriteJSON(message)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3c5fbcaf4ba74982b5960572a6b2c7f9", "score": "0.5068527", "text": "func (c *connection) writer() {\n\tfor message := range c.send {\n\t\terr := websocket.Message.Send(c.ws, string(message))\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\t}\n\tc.ws.Close()\n}", "title": "" }, { "docid": "974e27521f922880e6694d70ae94d0d4", "score": "0.5036309", "text": "func (agg *AggregateLoop) startWriteByPassLooper(mws *multiWriter) {\n\tif agg.shutitdown {\n\t\tagg.log.Warning(\"Got shutdown signal, not starting writers\")\n\t\treturn\n\t}\n\n\tshut := agg.Shutdown.Listen()\n\n\t//_dur := mws.flush\n\t_ttl := uint32(mws.ttl.Seconds())\n\n\t// start up the writers listeners\n\tfor _, w := range mws.ws {\n\t\tw.Start()\n\t}\n\tagg.log.Notice(\"Starting BYPASS Aggregater Loop (direct to writer)\")\n\n\tfor {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase dd, more := <-agg.DirectToWriter:\n\t\t\t\tif !more {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tif dd == nil {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tfor _, w := range mws.ws {\n\t\t\t\t\tdd.Name.Ttl = _ttl\n\t\t\t\t\tw.WriterChan() <- dd\n\t\t\t\t}\n\n\t\t\tcase <-shut.Ch:\n\t\t\t\tshut.Close()\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f33736a6ddd9f55b05093224ade5a6c8", "score": "0.500464", "text": "func (wsc *wsConnection) writeRoutine() {\n\tpingTicker := time.NewTicker(wsc.pingPeriod)\n\tdefer func() {\n\t\tpingTicker.Stop()\n\t\tif err := wsc.baseConn.Close(); err != nil {\n\t\t\twsc.Logger.Error(\"Error closing connection\", \"err\", err)\n\t\t}\n\t}()\n\n\t// https://github.com/gorilla/websocket/issues/97\n\tpongs := make(chan string, 1)\n\twsc.baseConn.SetPingHandler(func(m string) error {\n\t\tselect {\n\t\tcase pongs <- m:\n\t\tdefault:\n\t\t}\n\t\treturn nil\n\t})\n\n\tfor {\n\t\tselect {\n\t\tcase m := <-pongs:\n\t\t\terr := wsc.writeMessageWithDeadline(websocket.PongMessage, []byte(m))\n\t\t\tif err != nil {\n\t\t\t\twsc.Logger.Info(\"Failed to write pong (client may disconnect)\", \"err\", err)\n\t\t\t}\n\t\tcase <-pingTicker.C:\n\t\t\terr := wsc.writeMessageWithDeadline(websocket.PingMessage, []byte{})\n\t\t\tif err != nil {\n\t\t\t\twsc.Logger.Error(\"Failed to write ping\", \"err\", err)\n\t\t\t\twsc.Stop()\n\t\t\t\treturn\n\t\t\t}\n\t\tcase msg := <-wsc.writeChan:\n\t\t\tjsonBytes, err := json.MarshalIndent(msg, \"\", \" \")\n\t\t\tif err != nil {\n\t\t\t\twsc.Logger.Error(\"Failed to marshal RPCResponse to JSON\", \"err\", err)\n\t\t\t} else {\n\t\t\t\tif err = wsc.writeMessageWithDeadline(websocket.TextMessage, jsonBytes); err != nil {\n\t\t\t\t\twsc.Logger.Error(\"Failed to write response\", \"err\", err)\n\t\t\t\t\twsc.Stop()\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\tcase <-wsc.Quit():\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "06917fb5be7526b60d764b8bf74f9edf", "score": "0.4995665", "text": "func (c *Client) listenWrite() {\n\tlog.Println(\"Listening write to client\")\n\tfor {\n\t\tselect {\n\n\t\t// send message to the client\n\t\tcase msg := <-c.ch:\n\t\t\tlog.Println(\"Send:\", msg)\n\t\t\tc.ws.WriteJSON(msg)\n\n\t\t// receive done request\n\t\tcase <-c.doneCh:\n\t\t\tc.doneCh <- true // for listenRead method\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5397bef27ae7bac7fd610907f4a20df8", "score": "0.49929002", "text": "func (w *Writer) Sync() error {\n\tlogger := log.Get()\n\tlogger = kitlog.With(logger, \"func\", \"writer.Write(HCL)\")\n\n\tbody := w.File.Body()\n\n\tsrc, err := json.Marshal(w.Config)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"unable to marshal JSON config\")\n\t}\n\n\tt, err := cjson.ImpliedType(src)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"unable to get cty.Type from config\")\n\t}\n\tv, err := cjson.Unmarshal(src, t)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"unable to get cty.Value from cty.Type and JSON config\")\n\t}\n\n\t// blockType can be \"resource\", \"variable\" or \"output\"\n\tfor blockType, blockValue := range v.AsValueMap() {\n\t\t// resourceType is the type of the resource (e.g: `aws_security_groups`)\n\t\tfor resourceType, resources := range blockValue.AsValueMap() {\n\t\t\tfor name, resource := range resources.AsValueMap() {\n\t\t\t\tblock := hclwrite.NewBlock(blockType, []string{resourceType, name})\n\t\t\t\tbbody := block.Body()\n\t\t\t\tfor attr, value := range resource.AsValueMap() {\n\t\t\t\t\t// in JSON representation, we can have a list of object\n\t\t\t\t\t// e.g with ingress:[{ingress1}, {ingress2}, ... {ingressN}]\n\t\t\t\t\t// we need to add a dedicated block for each object instead of having\n\t\t\t\t\t// one block for the whole list\n\t\t\t\t\tif value.Type().IsTupleType() {\n\t\t\t\t\t\twriteTuple(body, bbody, attr, value)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbbody.SetAttributeValue(attr, value)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbody.AppendBlock(block)\n\t\t\t\tbody.AppendNewline()\n\t\t\t}\n\t\t}\n\t}\n\n\t// we don't use the file.WriteTo method because we need to use\n\t// our own Format method before writing to the writer\n\tformattedBytes := Format(w.File.Bytes())\n\tformattedBytes = hclwrite.Format(formattedBytes)\n\tw.writer.Write(formattedBytes)\n\n\treturn nil\n}", "title": "" }, { "docid": "5cf5f07cc17e9c31f5f8d5aefc803ead", "score": "0.49875444", "text": "func (c *livedataClient) writePump() {\n\tticker := time.NewTicker(pingPeriod)\n\tdefer func() {\n\t\tticker.Stop()\n\t\tc.conn.Close()\n\t}()\n\tfor {\n\t\tselect {\n\t\tcase info, ok := <-c.send:\n\t\t\tc.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif !ok {\n\t\t\t\t// The hub closed the channel.\n\t\t\t\tc.conn.WriteMessage(websocket.CloseMessage, []byte{})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tw, err := c.conn.NextWriter(websocket.TextMessage)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tinfoB, err := json.Marshal(info)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"Could not marshal info:\", err)\n\t\t\t\tpayload := websocket.FormatCloseMessage(websocket.CloseInternalServerErr, err.Error())\n\t\t\t\tc.conn.WriteMessage(websocket.CloseMessage, payload)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tw.Write(infoB)\n\n\t\t\t// Add queued chat messages to the current websocket message.\n\t\t\tn := len(c.send)\n\t\t\tfor i := 0; i < n; i++ {\n\t\t\t\tinfo = <-c.send\n\t\t\t\tinfoB, err = json.Marshal(info)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Println(\"Could not marshal info:\", err)\n\t\t\t\t\tpayload := websocket.FormatCloseMessage(websocket.CloseInternalServerErr, err.Error())\n\t\t\t\t\tc.conn.WriteMessage(websocket.CloseMessage, payload)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tw.Write(infoB)\n\t\t\t}\n\n\t\t\tif err := w.Close(); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-ticker.C:\n\t\t\tc.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif err := c.conn.WriteMessage(websocket.PingMessage, nil); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "89d48d1517b2c5371aa79b52d286fa02", "score": "0.49868488", "text": "func (c *Client) listenWrite() {\n\tlog.Println(\"Listening write to client\")\n\tfor {\n\t\tselect {\n\n\t\t// send location to the client\n\t\tcase msg := <-c.ch:\n\t\t\tlog.Println(\"Send:\", msg)\n\t\t\twebsocket.JSON.Send(c.ws, msg)\n\n\t\t// receive done request\n\t\tcase <-c.doneCh:\n\t\t\tc.server.Del(c)\n\t\t\tc.doneCh <- true // for listenRead method\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a7cd3a35c3f169681bd8eb47d9d5d208", "score": "0.49725652", "text": "func (c *Client) listenWrite() {\n\tfor {\n\t\tselect {\n\n\t\t// send message to the client\n\t\tcase msg := <-c.ch:\n\t\t\tlog.Println(\"Send:\", msg)\n\t\t\twebsocket.JSON.Send(c.Conn, msg)\n\n\t\t// receive done request\n\t\tcase <-c.doneCh:\n\t\t\tc.server.Del(c)\n\t\t\tc.doneCh <- true // for listenRead method\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "07f6432455c43f74353d8deeb5692ae8", "score": "0.49678496", "text": "func (agg *QueueWriteAggregator) writer() {\n\t// List of messagse to be aggregated\n\tmessagesToBeAggregated := make([]writeRequest, 0, DEFAULT_MAX_BATCH_AGGREGATION)\n\tmessageProviders := make([]model.MessageProvider, 0, DEFAULT_MAX_BATCH_AGGREGATION)\n\ttotalMessages := 0\n\tvar request writeRequest\n\t//deadline := time.NewTimer(DEFAULT_AGGREGATION_WINDOW)\n\tvar notifier *utils.ShutdownNotifier\n\trunning := true\n\tfor running {\n\t\t// Blocking wait for the first message\n\t\tselect {\n\t\tcase notifier = <-agg.shutdownQueue:\n\t\t\trunning = false\n\t\tcase request = <-agg.sendQueue:\n\t\t\t// We have a new request\n\t\t\tmessagesToBeAggregated = append(messagesToBeAggregated, request)\n\t\t\tmessageProviders = append(messageProviders, &request)\n\t\t\ttotalMessages += len(request.messages)\n\t\t\tgathering := true\n\t\t\t// Wait for additional requests to arrive.\n\t\t\ttime.Sleep(DEFAULT_AGGREGATION_WINDOW)\n\t\t\t//deadline.Reset(DEFAULT_AGGREGATION_WINDOW)\n\t\t\t//runtime.Gosched()\n\t\t\t// Now pull as many requests as possible. When there are none left or we have reached our limit, send them.\n\t\t\tfor gathering {\n\t\t\t\tselect {\n\t\t\t\tcase request = <-agg.sendQueue:\n\t\t\t\t\t// We have additional requests, queue them.\n\t\t\t\t\tmessagesToBeAggregated = append(messagesToBeAggregated, request)\n\t\t\t\t\tmessageProviders = append(messageProviders, &request)\n\t\t\t\t\ttotalMessages += len(request.messages)\n\t\t\t\t\tif totalMessages >= DEFAULT_TRIGGER_TOTAL_AGGREGATED_MESSAGES || len(messagesToBeAggregated) >= DEFAULT_MAX_BATCH_AGGREGATION {\n\t\t\t\t\t\tgathering = false\n\t\t\t\t\t}\n\t\t\t\t\t// case <-deadline.C:\n\t\t\t\t\t// \t// We've waited as long as we can - time to send what we have accumulated.\n\t\t\t\t\t// \tgathering = false\n\t\t\t\tdefault:\n\t\t\t\t\tgathering = false\n\t\t\t\t}\n\t\t\t}\n\t\t\tagg.sendMessages(messagesToBeAggregated, messageProviders, totalMessages)\n\t\t\tmessagesToBeAggregated = messagesToBeAggregated[:0]\n\t\t\tmessageProviders = messageProviders[:0]\n\t\t\ttotalMessages = 0\n\t\t}\n\t}\n\tnotifier.ShutdownDone()\n}", "title": "" }, { "docid": "54449f4283f64e83d691521ddcccca9e", "score": "0.49668682", "text": "func (s *Spool) Writer() {\n\t// we always try to serve realtime traffic as much as we can\n\t// because that's an inputstream at a fixed rate, it won't slow down\n\t// but if no realtime traffic is coming in, then we can use spare capacity\n\t// to read from the Bulk input, which is used to offload a known (potentially large) set of data\n\t// that could easily exhaust the capacity of our disk queue. But it doesn't require RT processing,\n\t// so just handle this to the extent we can\n\t// note that this still allows for channel ops to come in on InRT and to be starved, resulting\n\t// in some realtime traffic to be dropped, but that shouldn't be too much of an issue. experience will tell..\n\tfor {\n\t\tselect {\n\t\tcase <-s.shutdownWriter:\n\t\t\treturn\n\t\tcase buf := <-s.InRT: // wish we could somehow prioritize this higher\n\t\t\ts.numIncomingRT.Inc(1)\n\t\t\t//pre = time.Now()\n\t\t\tlog.Debugf(\"spool %v satisfying spool RT\", s.key)\n\t\t\tlog.Tracef(\"spool %s %s Writer -> queue.Put\", s.key, buf)\n\t\t\ts.durationBuffer.Time(func() { s.queueBuffer <- buf })\n\t\t\ts.numBuffered.Inc(1)\n\t\t\t//post = time.Now()\n\t\t\t//fmt.Println(\"queueBuffer duration RT:\", post.Sub(pre).Nanoseconds())\n\t\tcase buf := <-s.InBulk:\n\t\t\ts.numIncomingBulk.Inc(1)\n\t\t\t//pre = time.Now()\n\t\t\tlog.Debugf(\"spool %v satisfying spool BULK\", s.key)\n\t\t\tlog.Tracef(\"spool %s %s Writer -> queue.Put\", s.key, buf)\n\t\t\ts.durationBuffer.Time(func() { s.queueBuffer <- buf })\n\t\t\ts.numBuffered.Inc(1)\n\t\t\t//post = time.Now()\n\t\t\t//fmt.Println(\"queueBuffer duration BULK:\", post.Sub(pre).Nanoseconds())\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6df1decd3372365e86f9006a6c4747cc", "score": "0.4962558", "text": "func (w *LogWriter) rotate() {\n\tfor {\n\t\tvar (\n\t\t\tt int64\n\t\t\tname string\n\t\t)\n\t\tnow := time.Now()\n\t\tswitch w.rotation {\n\t\tcase \"hourly\":\n\t\t\tt = time.Unix(time.Now().Unix()+3600, 0).Round(time.Hour).Unix() - now.Unix() + 1\n\t\t\tname = fmt.Sprintf(\"%s.%s\", w.output, time.Now().Format(\"2006010215\"))\n\t\tcase \"daily\":\n\t\t\ty, m, d := now.AddDate(0, 0, 1).Date()\n\t\t\tt = time.Date(y, m, d, 0, 0, 1, 0, time.Local).Unix() - now.Unix() + 1\n\t\t\tname = fmt.Sprintf(\"%s.%s\", w.output, time.Now().Format(\"20060102\"))\n\t\tdefault:\n\t\t\treturn\n\t\t}\n\t\t// sleep\n\t\ttime.Sleep(time.Duration(t) * time.Second)\n\n\t\t// wake up and mv the log file\n\t\tos.Rename(w.output, name)\n\t\twriter, err := os.Create(w.output)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"create new log file error: %s\", err.Error())\n\t\t\tcontinue\n\t\t}\n\t\tw.writer = writer\n\t}\n}", "title": "" }, { "docid": "6c5db811ef8c557c025850e2b9310c04", "score": "0.49523827", "text": "func (t *Transmitter) watch() {\n\tfor trans := range t.transmission {\n\t\tt.transmit(trans)\n\t}\n}", "title": "" }, { "docid": "3aeccece0623a97f07407887ffef85dc", "score": "0.49472672", "text": "func (client *Client) Write() {\n\tfor str := range client.outgoing {\n\t\t_, err := client.writer.WriteString(str)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\tbreak\n\t\t}\n\t\terr = client.writer.Flush()\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\tbreak\n\t\t}\n\t}\n\tlog.Println(\"Closed client's write thread\")\n}", "title": "" }, { "docid": "4e963fa629acac7cb04a045f7c80298b", "score": "0.49406978", "text": "func (c *Connection) writePump() {\n\tticker := time.NewTicker(pingPeriod)\n\tdefer func() {\n\t\tticker.Stop()\n\t\t_ = c.ws.Close()\n\t}()\n\n\tfor {\n\t\tselect {\n\t\tcase event, ok := <-c.send:\n\t\t\tif !ok {\n\t\t\t\t_ = c.write(websocket.CloseMessage, []byte{})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tb, err := json.Marshal(event)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif err := c.write(websocket.TextMessage, b); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\n\t\tcase <-ticker.C:\n\t\t\tif err := c.write(websocket.PingMessage, []byte{}); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f28c2509e1df4fe3065bc735c4cdd5b3", "score": "0.4939909", "text": "func (h *wsHub) run() {\n\tfor {\n\t\tselect {\n\t\tcase s := <-h.register:\n\t\t\th.subscribers[s] = true\n\t\t\tif h.lastBroadcast.Color != \"\" {\n\t\t\t\ts.write(h.lastBroadcast)\n\t\t\t}\n\t\t\tbreak\n\n\t\tcase c := <-h.unregister:\n\t\t\t_, ok := h.subscribers[c]\n\t\t\tif ok {\n\t\t\t\tdelete(h.subscribers, c)\n\t\t\t\tclose(c.send)\n\t\t\t}\n\t\t\tbreak\n\n\t\tcase s := <-h.broadcast:\n\t\t\th.send(s)\n\t\t\th.lastBroadcast = s\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f4c2fb71c4f2e7f31eaff74dee07feb8", "score": "0.49393132", "text": "func (b *Buffer) write(v interface{}) {\n\tfor b.writeBarrier() {\n\t\tb.wcond.Wait()\n\t}\n\n\twpos := b.wcursor.Pos()\n\tb.data[wpos] = v\n\tb.wcursor.Inc()\n\n\tb.rcond.Broadcast()\n}", "title": "" }, { "docid": "2c94aee2b6fb8cd87ab1207f2376aa1d", "score": "0.49386948", "text": "func (c *Client) writePump() {\n\n\tticker := time.NewTicker(pingPeriod)\n\n\tlog.WithField(\"pingPeriod\", pingPeriod).Info(\"starting write pump\")\n\n\tdefer func() {\n\t\tticker.Stop()\n\t\tc.Close()\n\t}()\n\n\tfor {\n\t\tselect {\n\t\tcase message, ok := <-c.send:\n\n\t\t\tc.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\n\t\t\tif !ok {\n\t\t\t\t// The hub closed the channel.\n\t\t\t\tlog.Info(\"hub closed channel\")\n\t\t\t\tc.conn.WriteMessage(websocket.CloseMessage, []byte{})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tw, err := c.conn.NextWriter(websocket.TextMessage)\n\n\t\t\tif err != nil {\n\t\t\t\tif websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway) {\n\t\t\t\t\tlog.Error(errors.Wrap(err, \"error getting next writer\"))\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tlog.WithField(\"msg\", string(message)).Trace(\"writing\")\n\n\t\t\tif _, err := w.Write(message); err != nil {\n\t\t\t\tlog.Error(errors.Wrap(err, \"error writing\"))\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Add queued messages to the current websocket message.\n\t\t\tn := len(c.send)\n\t\t\tfor i := 0; i < n; i++ {\n\t\t\t\tw.Write(newline)\n\t\t\t\tw.Write(<-c.send)\n\t\t\t}\n\n\t\t\tif err := w.Close(); err != nil {\n\t\t\t\tlog.Error(errors.Wrap(err, \"error closing websocket writer\"))\n\t\t\t\treturn\n\t\t\t}\n\n\t\tcase <-ticker.C:\n\t\t\tc.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif err := c.conn.WriteMessage(websocket.PingMessage, nil); err != nil {\n\t\t\t\tif !strings.Contains(err.Error(), \"use of closed network connection\") {\n\t\t\t\t\tlog.Error(errors.Wrap(err, \"error sending ping\"))\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "59475981817b10b3b688676e03064141", "score": "0.49328643", "text": "func (s *WebsocketServer) writePump() {\n\tfor {\n\t\tselect {\n\t\tcase <-s.done:\n\t\t\t// When the read detects a websocket closure, it will close the done\n\t\t\t// channel so we can exit.\n\t\t\treturn\n\t\tcase msg := <-s.write:\n\t\t\ts.conn.SetWriteDeadline(time.Now().Add(s.writeTimeout))\n\t\t\terr := s.conn.WriteMessage(websocket.BinaryMessage, msg)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-s.interrupt:\n\t\t\t// Cleanly close the connection by sending a close message and then\n\t\t\t// waiting (with timeout) for the server to close the connection.\n\t\t\t//\n\t\t\t// TODO - This does not currently shutdown cleanly, as the caller does\n\t\t\t// not wait for this to complete.\n\t\t\terr := s.conn.WriteMessage(websocket.CloseMessage,\n\t\t\t\twebsocket.FormatCloseMessage(websocket.CloseNormalClosure, \"\"),\n\t\t\t)\n\t\t\tif err != nil {\n\t\t\t\t// log.Println(\"[wsrpc] error:\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tselect {\n\t\t\tcase <-s.done:\n\t\t\tcase <-time.After(time.Second):\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a41dc2d170b316820134a16e024471a6", "score": "0.49077976", "text": "func (Broadcaster *EventBroadcaster) Run() {\n\tfor {\n\t\tselect {\n\t\tcase c := <-Broadcaster.chRegister:\n\t\t\tBroadcaster.clients[c] = true\n\t\t\tc.send <- []byte(Broadcaster.content)\n\t\t\tbreak\n\n\t\tcase c := <-Broadcaster.chUnregister:\n\t\t\t_, ok := Broadcaster.clients[c]\n\t\t\tif ok {\n\t\t\t\tdelete(Broadcaster.clients, c)\n\t\t\t\tclose(c.send)\n\t\t\t}\n\t\t\tbreak\n\n\t\tcase m := <-Broadcaster.chBroadcast:\n\t\t\tBroadcaster.content = m\n\t\t\tBroadcaster.broadcastMessage()\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9e1f02e4f5e1abf12105d7438e1be651", "score": "0.49026898", "text": "func WriteJSON(r Registry, d time.Duration, w io.Writer) {\n\tfor _ = range time.Tick(d) {\n\t\tWriteJSONOnce(r, w)\n\t}\n}", "title": "" }, { "docid": "fdb8d59ba3c67b0899e1f17cab235e94", "score": "0.48969257", "text": "func (c *WSClient) listenWrite() {\n\tfor {\n\t\tselect {\n\n\t\t// send message to the client\n\t\tcase msg := <-c.ch:\n\t\t\twebsocket.JSON.Send(c.ws, msg)\n\n\t\t// receive done request\n\t\tcase <-c.doneCh:\n\t\t\tc.server.Del(c)\n\t\t\tc.doneCh <- true // for listenRead method\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "628b772ee0dde4a27dacf035c2961d33", "score": "0.4896924", "text": "func TestConcurrentQueryWrite(t *testing.T) {\n\tt.Parallel()\n\ttmpFile, err := ioutil.TempFile(\"\", \"censor_log\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif err = tmpFile.Close(); err != nil {\n\t\tt.Fatal(err)\n\t}\n\twriter, err := NewFileQueryWriter(tmpFile.Name())\n\tdefer func() {\n\t\twriter.Free()\n\t\terr = os.Remove(tmpFile.Name())\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t}()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\t// change only ticker period, leave query channel as is\n\tinitTestWriter(writer)\n\n\tgo writer.Start()\n\n\ttestQueries := []string{\n\t\t\"SELECT Student_ID FROM STUDENT;\",\n\t\t\"SELECT * FROM STUDENT;\",\n\t\t\"SELECT * FROM X;\",\n\t\t\"SELECT * FROM X;\",\n\t}\n\n\tgoroutineCount := 10\n\twriteLoopCount := 10\n\t// notify all goroutines to start writing at same time\n\tcondition := sync.NewCond(&sync.Mutex{})\n\t// wait until all finished\n\twaitGroup := &sync.WaitGroup{}\n\t// wait when goroutines ready to start\n\trun := make(chan struct{}, goroutineCount)\n\tfor i := 0; i < goroutineCount; i++ {\n\t\twaitGroup.Add(1)\n\t\t// start X background goroutines\n\t\tgo func(data []string) {\n\t\t\tcondition.L.Lock()\n\t\t\t// notify that ready to wait\n\t\t\trun <- struct{}{}\n\t\t\tcondition.Wait()\n\n\t\t\tfor i := 0; i < writeLoopCount; i++ {\n\t\t\t\tfor _, query := range data {\n\t\t\t\t\twriter.WriteQuery(query)\n\t\t\t\t}\n\t\t\t}\n\t\t\tcondition.L.Unlock()\n\t\t\twaitGroup.Done()\n\t\t}(testQueries)\n\t}\n\n\t// wait when all goroutines ready to start before sending broadcast signal\n\tfor i := 0; i < goroutineCount; i++ {\n\t\tselect {\n\t\tcase <-run:\n\t\t\tbreak\n\t\tcase <-time.NewTimer(time.Millisecond * 500).C:\n\t\t\tt.Fatal(\"Time out of waiting goroutine start\")\n\t\t}\n\t}\n\tcondition.L.Lock()\n\tcondition.Broadcast()\n\tcondition.L.Unlock()\n\n\t// wait when all goroutines finished or timeout\n\twaitFinished := make(chan struct{})\n\tgo func() {\n\t\twaitGroup.Wait()\n\t\twaitFinished <- struct{}{}\n\t}()\n\tselect {\n\tcase <-waitFinished:\n\t\tbreak\n\tcase <-time.NewTimer(time.Second * 5).C:\n\t\tt.Fatal(\"Timeout of waiting background goroutines\")\n\t}\n\n\tif writer.skippedQueryCount > 0 {\n\t\tt.Fatal(\"Detected unexpected skipping queries\")\n\t}\n\twaitQueryProcessing(3, writer, t)\n\t// wait when background goroutine dump all queries to the file\n\ttime.Sleep(sleepTime)\n\n\tresult, err := ioutil.ReadFile(tmpFile.Name())\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tlines := strings.Split(string(result), \"\\n\")\n\t// we don't sum goroutine count because should be written only unique queries\n\texpectedCount := len(testQueries) // +1 empty line\n\tif len(lines) != expectedCount {\n\t\tt.Log(lines)\n\t\tt.Fatalf(\"Incorrect amount of queries, %v != %v\\n\", len(lines), expectedCount)\n\t}\n\tif lines[len(lines)-1] != \"\" {\n\t\tt.Fatal(\"Incorrect last line\")\n\t}\n}", "title": "" }, { "docid": "a69eb2c4c319ab8ae97952077b7e1257", "score": "0.4896224", "text": "func (c *Client) writePump() {\n\tticker := time.NewTicker(pingPeriod)\n\tdefer func() {\n\t\tticker.Stop()\n\t\tc.conn.Close()\n\t}()\n\t\n\t// c.hub.broadcast <- broadcastStruct{\"0\", []byte(\"new coming\")}\n\n\tfor {\n\t\tselect {\n\t\tcase message, ok := <-c.send:\n\t\t\tc.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif !ok {\n\t\t\t\t// The hub closed the channel.\n\t\t\t\tc.conn.WriteMessage(websocket.CloseMessage, []byte{})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tw, err := c.conn.NextWriter(websocket.TextMessage)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tw.Write(message)\n\n\t\t\t// Add queued chat messages to the current websocket message.\n\t\t\tn := len(c.send)\n\t\t\tfor i := 0; i < n; i++ {\n\t\t\t\tw.Write(newline)\n\t\t\t\tw.Write(<-c.send)\n\t\t\t}\n\n\t\t\tif err := w.Close(); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-ticker.C:\n\t\t\tc.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif err := c.conn.WriteMessage(websocket.PingMessage, nil); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9fc8c3b5ea6043770d0976924775b45c", "score": "0.488077", "text": "func (c *Client) writePump() {\n\tticker := time.NewTicker(PingPeriod)\n\tdefer func() {\n\t\tfmt.Println(\"done write pump\")\n\t\tticker.Stop()\n\t\tc.done()\n\t}()\n\n\tfmt.Println(\"starting write pump\")\n\n\tfor {\n\t\tselect {\n\n\t\tcase <-c.killSignal:\n\t\t\treturn\n\n\t\tcase message, ok := <-c.send:\n\t\t\terr := c.conn.SetWriteDeadline()\n\n\t\t\tif !ok || err != nil {\n\t\t\t\tfmt.Println(\"send channel closed\", ok, err)\n\t\t\t\tc.conn.WriteMessage(empty)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tw, err := c.conn.NextWriter()\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"next writer error:\", err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tw.Write(message)\n\n\t\t\tif err := w.Close(); err != nil {\n\t\t\t\tfmt.Println(\"error closing writer??\", err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\tcase <-ticker.C:\n\t\t\tc.conn.SendPing()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "986af42953a81b4da6a91e073c3a6156", "score": "0.4878506", "text": "func (ext *Extent) putObjLoop() {\n\tdefer ext.stopWg.Done()\n\n\tsizePerWrite := ext.cfg.SizePerWrite\n\n\tt := time.NewTimer(ext.flushDelay)\n\tvar flushChan <-chan time.Time\n\n\tvar seg, nextSeg uint16 = 0, 1 // TODO tmp solution, when start from disk, it'll be replaced\n\tvar written int64 = 0 // Dirty written in cache.\n\tvar offset int64 = 0 // Segment offset.\n\tunflushedCnt := 0\n\tunflushedPut := make([]*putResult, 0, sizePerWrite/grainSize)\n\tunflushedIndex := make([]uint64, 0, sizePerWrite/grainSize)\n\tfor {\n\t\tvar pr *putResult\n\n\t\tselect {\n\t\tcase pr = <-ext.putChan:\n\t\tdefault:\n\t\t\tselect {\n\t\t\tcase pr = <-ext.putChan:\n\t\t\tcase <-ext.stopChan:\n\t\t\t\treturn\n\t\t\tcase <-flushChan:\n\t\t\t\tfj, err2 := ext.flushPut(seg, offset, written)\n\t\t\t\text.updateIndex(unflushedCnt, unflushedPut, unflushedIndex, err2)\n\t\t\t\tunflushedCnt = 0\n\t\t\t\tunflushedPut = unflushedPut[:0]\n\t\t\t\tunflushedIndex = unflushedIndex[:0]\n\n\t\t\t\toffset += written // TODO if err2 is not nil, what's the next?\n\t\t\t\twritten = 0\n\n\t\t\t\tif fj != nil {\n\t\t\t\t\txio.ReleaseFlushJob(fj)\n\t\t\t\t}\n\t\t\t\tflushChan = nil\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tif flushChan == nil {\n\t\t\tflushChan = getFlushChan(t, ext.flushDelay)\n\t\t}\n\n\t\tif pr.done == nil {\n\t\t\treleasePutResult(pr)\n\t\t\tcontinue\n\t\t}\n\n\t\tif seg >= uint16(segmentCnt-defaultReservedSeg) { // TODO tmp solution.\n\t\t\tpr.err = xrpc.ErrExtentFull\n\t\t\tclose(pr.done)\n\t\t\tcontinue // TODO deal with it better?\n\t\t}\n\n\t\twseg, off, size := ext.cache.write(nextSeg, pr.oid, pr.objData.Bytes())\n\n\t\tif wseg == sealedFlag {\n\n\t\t\tfj, err2 := ext.flushPut(seg, offset, written) // Flush any.\n\t\t\text.updateIndex(unflushedCnt, unflushedPut, unflushedIndex, err2)\n\n\t\t\tunflushedCnt = 0\n\t\t\tunflushedPut = unflushedPut[:0]\n\t\t\tunflushedIndex = unflushedIndex[:0]\n\n\t\t\tpr.err = xrpc.ErrExtentFull\n\t\t\tclose(pr.done)\n\n\t\t\toffset = 0\n\t\t\twritten = 0\n\n\t\t\tif fj != nil {\n\t\t\t\txio.ReleaseFlushJob(fj)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\t// Written to cache succeed.\n\t\tif wseg != seg { // Means seg is full, written to next seg, flush the last seg first.\n\t\t\tfj, err2 := ext.flushPut(seg, offset, written)\n\t\t\text.updateIndex(unflushedCnt, unflushedPut, unflushedIndex, err2)\n\t\t\tunflushedCnt = 0\n\t\t\tunflushedPut = unflushedPut[:0]\n\t\t\tunflushedIndex = unflushedIndex[:0]\n\n\t\t\toffset = 0\n\t\t\twritten = 0\n\t\t\tseg = wseg\n\t\t\tnextSeg = wseg + 1 // TODO should be chosen by extent logic.\n\t\t\tif nextSeg >= uint16(segmentCnt-defaultReservedSeg) { // TODO tmp solution.\n\t\t\t\tnextSeg = sealedFlag\n\t\t\t}\n\t\t\tif fj != nil {\n\t\t\t\txio.ReleaseFlushJob(fj)\n\t\t\t}\n\t\t}\n\n\t\tdigest := binary.LittleEndian.Uint32(pr.oid[8:12])\n\t\taddr := (uint32(wseg)*uint32(ext.cfg.SegmentSize) + uint32(off)) / grainSize\n\t\tindex := uint64(addr)<<32 | uint64(digest)\n\t\tunflushedCnt++\n\t\tunflushedPut = append(unflushedPut, pr)\n\t\tunflushedIndex = append(unflushedIndex, index)\n\t\twritten += size\n\n\t\tif written >= sizePerWrite {\n\t\t\tfj, err2 := ext.flushPut(seg, offset, written)\n\t\t\text.updateIndex(unflushedCnt, unflushedPut, unflushedIndex, err2)\n\t\t\tunflushedCnt = 0\n\t\t\tunflushedPut = unflushedPut[:0]\n\t\t\tunflushedIndex = unflushedIndex[:0]\n\n\t\t\toffset += written\n\t\t\twritten = 0\n\n\t\t\tif fj != nil {\n\t\t\t\txio.ReleaseFlushJob(fj)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d90b9a78c5cc30ae6e152f646a69461f", "score": "0.48769426", "text": "func (self *HttpHandlerDefault) WriteLoop(out chan *HttpResponse) {\n\tfor {\n\t\t//coming from higher layer to us\n\t\tm := <-out\n\t\tif m == nil {\n\t\t\t//fmt.Printf(\"HTTP socket read nil in write loop, assuming shutdown...%p\\n\",self)\n\t\t\tself.OutSocket.Close()\n\t\t\treturn //end of goroutine b/c of shutdown\n\t\t}\n\n\t\terr := self.WriteMessage(m)\n\t\tif err != nil {\n\t\t\t//e := err.(gozmq.ZmqErrno)\n\t\t\tif err == gozmq.ETERM {\n\t\t\t\t//fmt.Printf(\"HTTP socket ignoring ETERM in write loop, assuming shutdown of %p...\\n\",self)\n\t\t\t\tself.OutSocket.Close()\n\t\t\t\treturn\n\t\t\t}\n\t\t\tpanic(err)\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "c8fd57ba9f58242477781c612509f23a", "score": "0.48664433", "text": "func WriteJSON(r Registry, d time.Duration, w io.Writer) {\n\tfor range time.Tick(d) {\n\t\tWriteJSONOnce(r, w)\n\t}\n}", "title": "" }, { "docid": "e13b3e4d030ea1a21a0fbc8d648ca3b0", "score": "0.4861988", "text": "func (writer *TelemetryWriter) dbWriter() {\n\tfor {\n\t\tmsg := <-writer.telemetryCh\n\t\terr := writer.dbmap.Insert(&msg)\n\t\tif err != nil {\n\t\t\twriter.logger.Printf(\"Could not write to DB: %v\\n\", err)\n\t\t}\n\t\twriter.mutex.Lock()\n\t\twriter.msgCount++\n\t\tif writer.msgCount > 100 {\n\t\t\twriter.doUploadNow <- 1\n\t\t\twriter.msgCount = 0\n\t\t}\n\t\twriter.mutex.Unlock()\n\t}\n}", "title": "" }, { "docid": "53238a444148e821db082dd3bc6fe3d2", "score": "0.48586777", "text": "func (c *Client) writePump() {\n\tticker := time.NewTicker(pingPeriod)\n\tdefer func() {\n\t\tticker.Stop()\n\t\tc.conn.Close()\n\t}()\n\tfor {\n\t\tselect {\n\t\tcase message, ok := <-c.send:\n\t\t\tc.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif !ok {\n\t\t\t\t// The hub closed the channel.\n\t\t\t\tc.conn.WriteMessage(websocket.CloseMessage, []byte{})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tw, err := c.conn.NextWriter(websocket.TextMessage)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// 使用“&”分割获取房间号\n\t\t\t// 聊天内容不得包含&字符\n\t\t\t// msg[0]为房间号 msg[1]为打印内容\n\t\t\t// msg := strings.Split(string(message), \"&\")\n\t\t\t// if msg[0] == string(c.hub.roomID[c]) {\n\t\t\t// \tw.Write([]byte(msg[1]))\n\t\t\t// }\n\t\t\tw.Write(message)\n\t\t\t// Add queued chat messages to the current websocket message.\n\t\t\t// n := len(c.send)\n\t\t\t// for i := 0; i < n; i++ {\n\t\t\t// \tif msg[0] == string(c.hub.roomID[c]) {\n\t\t\t// \t\tw.Write(newline)\n\t\t\t// \t\tw.Write(<-c.send)\n\t\t\t// \t}\n\t\t\t// }\n\t\t\tif err := w.Close(); err != nil {\n\t\t\t\tlog.Printf(\"error: %v\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-ticker.C:\n\t\t\tc.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif err := c.conn.WriteMessage(websocket.PingMessage, nil); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "40d775ad6ac289797ea9e4671b222985", "score": "0.48530775", "text": "func (c *Clock) Watch(dst io.Writer) {\n\ts := bufio.NewScanner(c.Conn)\n\n\tfor s.Scan() {\n\t\tfmt.Fprintf(dst, \"%s: %s\\n\", c.Name, s.Text())\n\t}\n\n\tfmt.Fprintln(dst, \"Done!\")\n\n\tif err := s.Err(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "ca5e3d1916d7832e7bbc0a904cbcba9c", "score": "0.48505136", "text": "func (queryWriter *QueryWriter) Start() {\n\tfor {\n\t\tselect {\n\t\tcase query := <-queryWriter.signalWriteQuery:\n\t\t\tqueryWriter.captureQuery(query)\n\t\t\tbreak\n\t\tcase <-queryWriter.serializationTicker.C:\n\t\t\terr := queryWriter.dumpBufferedQueries()\n\t\t\tif err != nil {\n\t\t\t\tqueryWriter.logger.WithError(err).WithField(logging.FieldKeyEventCode, logging.EventCodeErrorCensorIOError).Errorln(\"Can't dump buffered queries\")\n\t\t\t}\n\t\t\tbreak\n\t\tcase <-queryWriter.signalShutdown:\n\t\t\tqueryWriter.serializationTicker.Stop()\n\t\t\tif err := queryWriter.DumpQueries(); err != nil {\n\t\t\t\tqueryWriter.logger.WithError(err).WithField(logging.FieldKeyEventCode, logging.EventCodeErrorCensorIOError).Errorln(\"Error occurred on DumpQueries\")\n\t\t\t}\n\t\t\terr := queryWriter.logStorage.Close()\n\t\t\tif err != nil {\n\t\t\t\tqueryWriter.logger.WithError(err).WithField(logging.FieldKeyEventCode, logging.EventCodeErrorCensorIOError).Errorln(\"Error occurred on shutdown QueryWriter instance\")\n\t\t\t}\n\t\t\tqueryWriter.reset()\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0ce90ca6d6ba76fde6773f48322546e4", "score": "0.48500803", "text": "func (writer *asyncWriter) Flush() {\n\twriter.flushToFile()\n\t// TODO Unhandled errors\n\twriter.file.Sync()\n}", "title": "" }, { "docid": "cf537d66189da888ca11dafa4e5c9689", "score": "0.48441666", "text": "func (w *Writer) Sync() error {\n\n\tlstate := w.state.Lock()\n\tdefer w.state.Unlock()\n\n\tlog.Get().Log(\"func\", \"state.Sync(State)\", \"msg\", \"writting state to state file\")\n\tfile := statemgr.NewStateFile()\n\tfile.State = lstate\n\n\terr := statefile.Write(file, w.writer)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3e9b7f7e6adaaeca9f1fa51ce19adfd2", "score": "0.48401156", "text": "func (de *DummyEvents) Run(ctx context.Context, wrFn transport.WriteFn, done chan bool) {\n\n\tfor {\n\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\tgoto done\n\t\tcase <-time.After(time.Second * time.Duration(de.c.Interval)):\n\t\t\tif de.c.Ceilometer {\n\t\t\t\twrFn([]byte(eventMessages[0]))\n\t\t\t}\n\t\t\tif de.c.Collectd {\n\t\t\t\tfor _, evt := range eventMessages[1:] {\n\t\t\t\t\twrFn([]byte(evt))\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t}\n\ndone:\n}", "title": "" }, { "docid": "cddda8872c4a499a38b9abd7e501ebaf", "score": "0.48236263", "text": "func (c *Client) writePump() {\n\tticker := time.NewTicker(pingPeriod)\n\tdefer func() {\n\t\tticker.Stop()\n\t\tc.Conn.Close()\n\t}()\n\tfor {\n\t\tselect {\n\t\tcase ok := <-c.End:\n\t\t\tlog.Println(\"close write pump\")\n\t\t\tif ok {\n\t\t\t\tif c.IsUser {\n\t\t\t\t\tlog.Println(c.User.ID)\n\t\t\t\t}\n\t\t\t\tc.Conn.WriteMessage(websocket.CloseMessage, websocket.FormatCloseMessage(websocket.CloseNormalClosure, \"\"))\n\t\t\t\ttime.Sleep(1 * time.Second)\n\t\t\t\tc.Conn.Close()\n\t\t\t\treturn\n\t\t\t}\n\t\tcase message, ok := <-c.Send:\n\t\t\tc.Conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif !ok {\n\t\t\t\t// The hub closed the channel.\n\t\t\t\tc.Conn.WriteMessage(websocket.CloseMessage, []byte{})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tw, err := c.Conn.NextWriter(websocket.TextMessage)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tw.Write(message)\n\n\t\t\t// Add queued chat messages to the current websocket broadcast.\n\t\t\tn := len(c.Send)\n\t\t\tfor i := 0; i < n; i++ {\n\t\t\t\tw.Write(newline)\n\t\t\t\tw.Write(<-c.Send)\n\t\t\t}\n\n\t\t\tif err := w.Close(); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-ticker.C:\n\t\t\tc.Conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif err := c.Conn.WriteMessage(websocket.PingMessage, nil); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "bfbe4fa5e534fc4bea5a879b65e95b04", "score": "0.48161545", "text": "func (tb pageTraceBuf) writeSync(pid int32) pageTraceBuf {\n\tif tb.len+1 > len(tb.buf.events) {\n\t\t// N.B. flush will writeSync again.\n\t\treturn tb.flush(pid, tb.timeBase)\n\t}\n\te := ((uint64(tb.timeBase) >> pageTraceTimeLostBits) << 3) | uint64(pageTraceSyncEvent)\n\ttb.buf.events[tb.len] = e\n\ttb.len++\n\treturn tb\n}", "title": "" }, { "docid": "0b3497e30d97e648c3bc1aa5f364937a", "score": "0.48152468", "text": "func (i *Instance) sync(w InstanceOutputWriter) {\n\tw.Write(OutputSync{\n\t\tInstanceTime: *i.time,\n\t})\n}", "title": "" }, { "docid": "4c3a9e9b66a85f30734ef96cffb3bce0", "score": "0.48143265", "text": "func (c *Client) writePump() {\n\tticker := time.NewTicker(pingPeriod)\n\tdefer func() {\n\t\tticker.Stop()\n\t}()\n\n\tfor {\n\t\tselect {\n\t\tcase message, ok := <-c.send:\n\t\t\tc.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif !ok {\n\t\t\t\t// The client has been closed.\n\t\t\t\tc.conn.WriteMessage(websocket.CloseMessage, []byte{})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif err := c.conn.WriteMessage(websocket.TextMessage, message); err != nil {\n\t\t\t\tlog.Printf(\"error: %v\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-ticker.C:\n\t\t\tc.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif err := c.conn.WriteMessage(websocket.PingMessage, nil); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e3504f91e2631cf4f04a98624e80d910", "score": "0.48132974", "text": "func (rw *RedisWriter) Run() {\n\trw.close.Wg.Add(1)\n\tdefer rw.close.Wg.Done()\n\n\texit := make(chan bool)\n\trw.close.Mu.Lock()\n\t*rw.close.Exit = append(*rw.close.Exit, exit)\n\trw.close.Mu.Unlock()\n\n\twriteToRedis := func(msg *DeliverableTrackedMessage) error {\n\t\tdata, err := PackWriterMessage(msg)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"Unable to serialize message for Redis\")\n\t\t}\n\n\t\tif err := rw.conn.Send(\"PUBLISH\", msg.Channel, data); err != nil {\n\t\t\treturn errors.Wrap(err, \"Unable to publish message to Redis\")\n\t\t}\n\n\t\tif err := rw.conn.Flush(); err != nil {\n\t\t\treturn errors.Wrap(err, \"Unable to flush published message to Redis\")\n\t\t}\n\n\t\treturn nil\n\t}\n\n\treDeliver := func(msg *DeliverableTrackedMessage) {\n\t\ttime.Sleep(time.Millisecond * 300)\n\t\tmsg.DeliveryAttempt++\n\t\trw.Publish(msg)\n\t}\n\n\tdispose := func() {\n\t\trw.conn.Close()\n\t}\n\n\tfor {\n\t\tselect {\n\t\tcase <-exit:\n\t\t\trw.log.InfoMsg(\"disposing writer\")\n\t\t\tdispose()\n\t\t\trw.log.InfoMsg(\"disposed writer\")\n\t\t\treturn\n\t\tcase msg := <-rw.messages:\n\t\t\tif err := writeToRedis(msg); err != nil && msg.DeliveryAttempt < 3 {\n\t\t\t\tgo reDeliver(msg)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "52ac415885d3ee0c77108066b0fadf26", "score": "0.48076367", "text": "func writeStream(config *HTTPWriterConfig, workerID int) {\n\tlog.Printf(\"HTTP writer #%d started\\n\", workerID)\n\n\tvar data bytes.Buffer\n\tw := gzip.NewWriter(&data)\n\tvar count int\n\n\tfor m := range config.IncomingQueue {\n\t\tcount = packDataPoints(w, m)\n\n\t\tif config.Verbose {\n\t\t\tlog.Printf(\"[worker #%d] sending batch (%d data points)\\n\",\n\t\t\t\tworkerID,\n\t\t\t\tcount)\n\t\t}\n\n\t\tstart := time.Now()\n\t\tresponse, err := apiPost(config, \"/ingest\", &data)\n\t\tw.Reset(&data)\n\n\t\tif err != nil {\n\t\t\t// TODO need failure / retry logic.\n\t\t\tlog.Printf(\"[worker #%d] gateway]: %s\",\n\t\t\t\tworkerID, err)\n\t\t\tcount = 0\n\t\t\tcontinue\n\t\t}\n\n\t\t// If it's a non-200, log.\n\t\tif response.Code != 200 {\n\t\t\tlog.Printf(\"[worker #%d] %s [gateway] %s\",\n\t\t\t\tworkerID, time.Since(start), response.String)\n\t\t} else {\n\t\t\t// If it's a 200 but verbosity is true,\n\t\t\t// log.\n\t\t\tif config.Verbose {\n\t\t\t\tlog.Printf(\"[worker #%d] %s [gateway] %s\",\n\t\t\t\t\tworkerID, time.Since(start), response.String)\n\t\t\t}\n\t\t}\n\n\t\tcount = 0\n\t}\n}", "title": "" }, { "docid": "ff7caf0f994f5759a96df437fce947bf", "score": "0.48072207", "text": "func (w *Writer) Write(tsb model.TimeSeriesBatch) error {\n\tt0 := time.Now()\n\tdefer func() {\n\t\tw.batchWriteDuration.Observe(time.Since(t0).Seconds())\n\t}()\n\twg := &sync.WaitGroup{}\n\terrch := make(chan error, 1) // room for just the first error a worker encounters\n\twg.Add(len(tsb))\n\tfor _, ts := range tsb {\n\t\twp := &writerPayload{\n\t\t\twg: wg,\n\t\t\tts: ts,\n\t\t\terrch: errch,\n\t\t}\n\t\tw.ch <- wp\n\t}\n\twg.Wait()\n\tselect {\n\tcase err := <-errch:\n\t\treturn err\n\tdefault:\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "cf4936bd36a5346fc09ef0657394dd80", "score": "0.47969002", "text": "func (c *client) writePump() error {\n\tticker := time.NewTicker(pingPeriod)\n\tdefer func() {\n\t\tc.Stop()\n\t\tticker.Stop()\n\t}()\n\tfor {\n\t\tselect {\n\t\tcase message, ok := <-c.dataCh:\n\t\t\tif !ok {\n\t\t\t\t// The hub closed the channel.\n\t\t\t\tif err := c.writeMsg(websocket.CloseMessage, nil); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tfound := false\n\t\t\tfor _, datatype := range c.events {\n\t\t\t\tif instance, ok := datatype.IsMyInstance(nil, message); ok {\n\t\t\t\t\tdataPacket := datatype.WriteProcess(instance)\n\t\t\t\t\terr := c.writeMsg(websocket.TextMessage, dataPacket)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\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\tlog.Warnf(\"Sending data type not determined: %v\", message)\n\t\t\t}\n\t\tcase <-ticker.C:\n\t\t\tif err := c.writeMsg(websocket.PingMessage, nil); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\tcase <-c.stopCh:\n\t\t\treturn nil\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0fedb1286a70d72b667db8b30b647e9d", "score": "0.47914848", "text": "func (b *Browser) writePump() {\n\tticker := time.NewTicker(pingPeriod)\n\tdefer func() {\n\t\tticker.Stop()\n\t\tb.conn.Close()\n\t}()\n\tfor {\n\t\tselect {\n\t\tcase message, ok := <-b.send:\n\t\t\tb.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif !ok {\n\t\t\t\t// The hub closed the channel.\n\t\t\t\tb.conn.WriteMessage(websocket.CloseMessage, []byte{})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tw, err := b.conn.NextWriter(websocket.TextMessage)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tw.Write(message)\n\n\t\t\t// Add queued chat messages to the current websocket message.\n\t\t\tn := len(b.send)\n\t\t\tfor i := 0; i < n; i++ {\n\t\t\t\tw.Write(newline)\n\t\t\t\tw.Write(<-b.send)\n\t\t\t}\n\n\t\t\tif err := w.Close(); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-ticker.C:\n\t\t\tb.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif err := b.conn.WriteMessage(websocket.PingMessage, []byte{}); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a6541236779442a4da55033b06a35c99", "score": "0.47819635", "text": "func (w *asyncLogWriter) drain() {\n\tfor {\n\t\tselect {\n\t\tcase <-w.ch:\n\t\tdefault:\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3e4f2e03d39d63998565575acb011c76", "score": "0.4779211", "text": "func writer() {\n\tlogFileHandler, err := os.Create(*logFile)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// close logFileHandler on writer exit\n\tdefer func() {\n\t\tif err := logFileHandler.Close(); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}()\n\n\tlog.Println(\"Flush buffer content to log file...\")\n\n\tfor {\n\t\tif len(content) == 0 {\n\t\t\t// finish writer\n\t\t\tbreak\n\t\t}\n\n\t\tmsg := <- content\n\n\t\tif len(*key) > 0 {\n\t\t\tmsg.Encrypt()\n\t\t}\n\t\tfmt.Fprintf(logFileHandler, \"%s [%s]: %s\", msg.Client, msg.Time.Format(time.RFC3339), msg.Value)\n\t}\n}", "title": "" }, { "docid": "ae3f003a704e0935d26085380f65dfcb", "score": "0.47678417", "text": "func (t *Tee) sync() {\n\tt.cond.L.Lock()\n\tdefer t.cond.L.Unlock()\n\n\tif len(t.outs) == 0 {\n\t\tlog.Printf(\"tee: no out chans; waiting for one\")\n\t\tt.cond.Wait()\n\t}\n}", "title": "" }, { "docid": "8bde581500726f74467684ce51565e58", "score": "0.47676384", "text": "func (w *Watcher) Run() {\n\tfor {\n\t\tselect {\n\t\tcase <-w.stopCh:\n\t\t\txDSLogger.Info(\"xDS-adaptor's Watcher thread stopped\")\n\t\t\treturn\n\t\tcase event, ok := <-w.watcher.Events:\n\t\t\tif !ok {\n\t\t\t\txDSLogger.Error(\"Error watching events\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tw.watcherMux.Lock()\n\t\t\txDSLogger.Trace(\"Watcher captured event\", \"event\", event)\n\t\t\tif (event.Op&fsnotify.Remove == fsnotify.Remove) || (event.Op&fsnotify.Write == fsnotify.Write) {\n\t\t\t\txDSLogger.Debug(\"Watcher folder got updated\", \"eventName\", event.Name)\n\t\t\t\t// strings.Contains(event.Name, \"..\") this is for mounted certificates\n\t\t\t\t//strings.Contains(event.Name, ClientCertChainFile) for CSR generated\n\t\t\t\tif !strings.Contains(event.Name, \"..\") && !strings.Contains(event.Name, ClientCertChainFile) {\n\t\t\t\t\txDSLogger.Debug(\"File not considered for update\", \"fileName\", event.Name)\n\t\t\t\t} else {\n\t\t\t\t\tuploadFilePath, _ := getDirFileName(event.Name)\n\t\t\t\t\txDSLogger.Trace(\"Uploading files from directory\", \"dirName\", uploadFilePath)\n\t\t\t\t\tif w.dirNames[uploadFilePath][\"certFile\"] != \"\" {\n\t\t\t\t\t\tcertFile := uploadFilePath + \"/\" + w.dirNames[uploadFilePath][\"certFile\"]\n\t\t\t\t\t\tkeyFile := uploadFilePath + \"/\" + w.dirNames[uploadFilePath][\"keyFile\"]\n\t\t\t\t\t\txDSLogger.Trace(\"Uploading certFile to ADC\", \"certFile\", certFile)\n\t\t\t\t\t\txDSLogger.Trace(\"Uploading keyfile to ADC\", \"keyFile\", keyFile)\n\t\t\t\t\t\tif fileExists(certFile) {\n\t\t\t\t\t\t\tcertData, keyData, err := getCertKeyData(certFile, keyFile)\n\t\t\t\t\t\t\tif err == nil {\n\t\t\t\t\t\t\t\tnsCertFileName := nsconfigengine.GetNSCompatibleNameHash(string([]byte(certData)), 55)\n\t\t\t\t\t\t\t\tnsKeyFileName := nsconfigengine.GetNSCompatibleNameHash(string([]byte(keyData)), 55)\n\t\t\t\t\t\t\t\t/* if CertKey and KeyFile did not change then do not update */\n\t\t\t\t\t\t\t\tif nsconfigengine.IsCertKeyPresent(w.nsConfig.client, nsCertFileName, nsKeyFileName) == false {\n\t\t\t\t\t\t\t\t\txDSLogger.Debug(\"Uploading and updating bindings on ADC for cert/key\", \"certFile\", certFile, \"nsCertName\", nsCertFileName, \"nsKeyName\", nsKeyFileName)\n\t\t\t\t\t\t\t\t\tnsconfigengine.UploadCertData(w.nsConfig.client, certData, nsCertFileName, keyData, nsKeyFileName)\n\t\t\t\t\t\t\t\t\trootFileName, err := nsconfigengine.UpdateBindings(w.nsConfig.client, w.dirNames[uploadFilePath][\"nsCertFileName\"], w.dirNames[uploadFilePath][\"nsCertFileName\"], nsCertFileName, nsKeyFileName, multiClusterIngress)\n\t\t\t\t\t\t\t\t\tif err == nil {\n\t\t\t\t\t\t\t\t\t\tw.dirNames[uploadFilePath][\"nsCertFileName\"] = nsCertFileName\n\t\t\t\t\t\t\t\t\t\tw.dirNames[uploadFilePath][\"nsKeyFileName\"] = nsKeyFileName\n\t\t\t\t\t\t\t\t\t\tw.dirNames[uploadFilePath][\"nsRootCertFile\"] = rootFileName\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\tif w.dirNames[uploadFilePath][\"rootCertFile\"] != \"\" {\n\t\t\t\t\t\tcertFile := uploadFilePath + \"/\" + w.dirNames[uploadFilePath][\"rootCertFile\"]\n\t\t\t\t\t\tif fileExists(certFile) {\n\t\t\t\t\t\t\tcertData, _, err := getCertKeyData(certFile, \"\")\n\t\t\t\t\t\t\tif err == nil {\n\t\t\t\t\t\t\t\tnsRootFileName := nsconfigengine.GetNSCompatibleNameHash(string([]byte(certData)), 55)\n\t\t\t\t\t\t\t\txDSLogger.Debug(\"Uploading and updating bindings of rootCert\", \"certFile\", certFile, \"nsRootFileName\", nsRootFileName)\n\t\t\t\t\t\t\t\tvar keyData []byte\n\t\t\t\t\t\t\t\tnsconfigengine.UploadCertData(w.nsConfig.client, certData, nsRootFileName, keyData, \"\")\n\t\t\t\t\t\t\t\tnsconfigengine.AddCertKey(w.nsConfig.client, nsRootFileName, \"\", false)\n\t\t\t\t\t\t\t\tnsconfigengine.UpdateRootCABindings(w.nsConfig.client, w.dirNames[uploadFilePath][\"nsRootFileName\"], nsRootFileName)\n\t\t\t\t\t\t\t\tnsconfigengine.DeleteCertKey(w.nsConfig.client, w.dirNames[uploadFilePath][\"nsRootFileName\"])\n\t\t\t\t\t\t\t\tw.dirNames[uploadFilePath][\"nsRootFileName\"] = nsRootFileName\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\tw.watcherMux.Unlock()\n\t\tcase err, ok := <-w.watcher.Errors:\n\t\t\tif !ok {\n\t\t\t\treturn\n\t\t\t}\n\t\t\txDSLogger.Error(\"Watcher error\", \"error\", err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c62538336012397f06706ae32a3a5df5", "score": "0.4766385", "text": "func (c *Client) writePump() {\n\tticker := time.NewTicker(pingPeriod)\n\tdefer func() {\n\t\tticker.Stop()\n\t\tc.conn.Close()\n\t\tc.closed = true\n\t}()\n\tfor {\n\t\tselect {\n\t\tcase message, ok := <-c.send:\n\t\t\tc.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif !ok {\n\t\t\t\t// The hub closed the channel.\n\t\t\t\tc.conn.WriteMessage(websocket.CloseMessage, []byte{})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\terr := c.conn.WriteJSON(message)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-ticker.C:\n\t\t\tc.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif err := c.conn.WriteMessage(websocket.PingMessage, nil); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "696c0975ea0f4cc3536232aad107779e", "score": "0.4754965", "text": "func (c *Client) writePump() {\n\tticker := time.NewTicker(pingPeriod)\n\tdefer func() {\n\t\tticker.Stop()\n\t\tc.conn.Close()\n\t}()\n\tfor {\n\t\tselect {\n\t\tcase message, ok := <-c.send:\n\t\t\tc.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif !ok {\n\t\t\t\t// The hub closed the channel.\n\t\t\t\tc.conn.WriteMessage(websocket.CloseMessage, []byte{})\n\t\t\t\treturn\n\t\t\t}\n\t\t\tw, err := c.conn.NextWriter(websocket.BinaryMessage)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tw.Write(message)\n\n\t\t\t// Add queued chat messages to the current websocket message.\n\t\t\tn := len(c.send)\n\t\t\tfor i := 0; i < n; i++ {\n\t\t\t\tw.Write(newline)\n\t\t\t\tw.Write(<-c.send)\n\t\t\t}\n\n\t\t\tif err := w.Close(); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-ticker.C:\n\t\t\tc.conn.SetWriteDeadline(time.Now().Add(writeWait))\n\t\t\tif err := c.conn.WriteMessage(websocket.PingMessage, nil); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" } ]
73d2d7ae1c6270a5419553e84887eafa
DetectBlink uses PVL FaceDetector to detect blink on a Face.
[ { "docid": "68850b4a8cb1ae1cf71189d45a45c36f", "score": "0.8644324", "text": "func (f *FaceDetector) DetectBlink(img gocv.Mat, face Face) {\n\tC.FaceDetector_DetectBlink((C.FaceDetector)(f.p), C.Mat(img.Ptr()), C.Face(face.Ptr()))\n\treturn\n}", "title": "" } ]
[ { "docid": "8aae630c595bf86c22a429c80995473b", "score": "0.7085329", "text": "func (f *FaceDetector) GetBlinkThreshold() int {\n\treturn int(C.FaceDetector_GetBlinkThreshold((C.FaceDetector)(f.p)))\n}", "title": "" }, { "docid": "099e447d4c17cef47edace7ae0ed16ed", "score": "0.7031672", "text": "func (f *FaceDetector) SetBlinkThreshold(thresh int) {\n\tC.FaceDetector_SetBlinkThreshold((C.FaceDetector)(f.p), C.int(thresh))\n}", "title": "" }, { "docid": "bcf338707d5b10f6513340131b05a4e2", "score": "0.5927226", "text": "func (d *DvLIRClient) Blink(blink int, pause int) (response int, err error) {\n\tif !d.isValid() {\n\t\treturn 0, &NotValidError{}\n\t}\n\tif blink < 1 || blink > 10000 {\n\t\terr = errors.New(\"Value of blink is outside of 1..10000\")\n\t\treturn 0, err\n\t}\n\tif pause < 1 || pause > 1000 {\n\t\terr = errors.New(\"Value of pause is outside of 1..1000\")\n\t\treturn 0, err\n\t}\n\n\tpauseE := url.QueryEscape(strconv.Itoa(pause))\n\tblinkE := url.QueryEscape(strconv.Itoa(blink))\n\n\tpath := \"/blink.cmd?sid=\" + d.sessionID + \"&ledPause=\" + pauseE + \"&ledBlink=\" + blinkE\n\tresp, err := d.get(path, \"\", \"\")\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"Error during Blink request\")\n\t}\n\tres, err := strconv.Atoi(resp.String())\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"Error during conversion of response code from string to integer\")\n\t}\n\n\tif len(resp.String()) > 3 {\n\t\tcheck := resp.String()[0:9]\n\t\tif check == \"<!DOCTYPE\" {\n\t\t\terr = errors.New(\"Login page was returned\")\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\treturn res, err\n}", "title": "" }, { "docid": "81e72b99044a2e146588571e8dc00261", "score": "0.57293457", "text": "func (strip Strip) Blink(color color.Color, duration, times int) error {\n\tfor index := 0; index < 8; index++ {\n\t\tif err := SetBlinkOnLed(strip, color, index, duration, times); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2fcab4cad29cdd8def49b23bfc28f484", "score": "0.5669346", "text": "func Blink(text string) string {\n\treturn AttrBlinkOn + text + AttrBlinkOff\n}", "title": "" }, { "docid": "77f081a71db0dcad9359955f268bb9d0", "score": "0.5560096", "text": "func FaceDetectionDetect(url string) (bool, error) {\n\n\ttmp, err := get(url)\n\tif len(FaceDecodeDetect(tmp).Face) == 0 {\n\t\treturn false, err\n\t}\n\n\treturn true, nil\n}", "title": "" }, { "docid": "3807ecf44ca48fd0e0f833b774204546", "score": "0.54564184", "text": "func (s Style) Blink(v bool) Style {\n\ts.set(blinkKey, v)\n\treturn s\n}", "title": "" }, { "docid": "6b2f68015090a9d05ccf698fc2c0b99a", "score": "0.5430406", "text": "func NewBlinkEffect() *BlinkEffect {\n\tblink := BlinkEffect{}\n\n\tblink.colorPrimary = parameters.NewParameter(\"colorPrimary\", parameters.Color, \"Primary color\")\n\tblink.colorSecondary = parameters.NewParameter(\"colorSecondary\", parameters.Color, \"Secondary color\")\n\tblink.speed = parameters.NewParameter(\"speed\", parameters.Percent, \"Speed\")\n\tblink.ratio = parameters.NewParameter(\"ratio\", parameters.Percent, \"Ratio\")\n\n\treturn &blink\n}", "title": "" }, { "docid": "bfc4b1a61df32a818645984394f87cf4", "score": "0.53655404", "text": "func NewBlinkt() *Blinkt {\n\tch := make(chan struct{})\n\tgo func() {\n\t\tbrightness := 0.5\n\t\tbl := blinkt.NewBlinkt(brightness)\n\t\tbl.Setup()\n\t\tr, g, b := 150, 0, 0\n\touterloop:\n\t\tfor {\n\t\t\tfor _, pixel := range append(seq(0, 7), seq(6, 1)...) {\n\t\t\t\tbl.Clear()\n\t\t\t\tbl.SetPixel(pixel, r, g, b)\n\t\t\t\tbl.Show()\n\t\t\t\tselect {\n\t\t\t\tcase <-time.After(100 * time.Millisecond):\n\t\t\t\tcase <-ch:\n\t\t\t\t\tbreak outerloop\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tbl.Clear()\n\t\tbl.Show()\n\t\tclose(ch)\n\t}()\n\treturn &Blinkt{ch}\n}", "title": "" }, { "docid": "3a4dd31a39ba44cc72deb344332caad7", "score": "0.53507507", "text": "func (bl *Blink) Blink(num int, blinkMs time.Duration) {\n\tblink(bl.dev, num, blinkMs, 0, 0, 0, 255, 255, 255)\n}", "title": "" }, { "docid": "7054c33eebd1424c1daff46cdaff01cd", "score": "0.5346864", "text": "func (d *Dao) Blink(c context.Context, mid int64, ip string) (has int, err error) {\n\tparams := url.Values{}\n\tparams.Set(\"uid\", strconv.FormatInt(mid, 10))\n\tvar res struct {\n\t\tCode int `json:\"code\"`\n\t\tData Blink `json:\"data\"`\n\t}\n\terr = d.client.Get(c, d.blinkUpInfoURL, ip, params, &res)\n\tif err != nil {\n\t\tlog.Error(\"d.client.Get(%s) error(%v)\", d.blinkUpInfoURL+\"?\"+params.Encode(), err)\n\t\treturn\n\t}\n\tif res.Code != 0 {\n\t\tlog.Error(\"Blink url(%s) error(%v)\", d.blinkUpInfoURL+\"?\"+params.Encode(), err)\n\t\terr = ecode.Int(res.Code)\n\t\treturn\n\t}\n\thas = res.Data.Has\n\treturn\n}", "title": "" }, { "docid": "89a743a0b3003c2e17278e7953eeaf18", "score": "0.5326738", "text": "func NewBlink(pin machine.Pin, delay int) *Blink {\n\tblink := &Blink{Pin: pin, Delay: delay}\n\tblink.Pin.Configure(machine.PinConfig{Mode: machine.PinOutput})\n\treturn blink\n}", "title": "" }, { "docid": "d44bd05088bca33bd9b8fba408a90e35", "score": "0.53049874", "text": "func (mw *MessageWindow) SetBlink(enableBlink bool) {\n\tmw.enableBlink = enableBlink\n}", "title": "" }, { "docid": "f2514cc945ee65765156de8e492c4484", "score": "0.52903104", "text": "func SafeBlink(text string) string {\n\treturn AttrBlinkOn + text + SafeReset\n}", "title": "" }, { "docid": "57d795ba47e8a006498a7ce1853c58ff", "score": "0.51826346", "text": "func FaceDetectFromWebCam() {\n\tif len(os.Args) < 3 {\n\t\tfmt.Println(\"How to run:\\n\\tFaceDetectFromWebCam [camera ID] [classifier XML file]\")\n\t\treturn\n\t}\n\n\t// parse args\n\tdeviceID, _ := strconv.Atoi(os.Args[1])\n\txmlFile := os.Args[2]\n\n\t// open webcam\n\twebcam, err := gocv.VideoCaptureDevice(int(deviceID))\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\tdefer webcam.Close()\n\n\t// open display window\n\twindow := gocv.NewWindow(\"Face Detect\")\n\tdefer window.Close()\n\n\t// prepare image matrix\n\timg := gocv.NewMat()\n\tdefer img.Close()\n\n\t// color for the rect when faces detected\n\tblue := color.RGBA{0, 0, 255, 0}\n\n\t// load classifier to recognize faces\n\tclassifier := gocv.NewCascadeClassifier()\n\tdefer classifier.Close()\n\n\tif !classifier.Load(xmlFile) {\n\t\tfmt.Printf(\"Error reading cascade file: %v\\n\", xmlFile)\n\t\treturn\n\t}\n\n\tfmt.Printf(\"start reading camera device: %v\\n\", deviceID)\n\tfor {\n\t\tif ok := webcam.Read(&img); !ok {\n\t\t\tfmt.Printf(\"cannot read device %d\\n\", deviceID)\n\t\t\treturn\n\t\t}\n\t\tif img.Empty() {\n\t\t\tcontinue\n\t\t}\n\n\t\t// detect faces\n\t\trects := classifier.DetectMultiScale(img)\n\t\tfmt.Printf(\"found %d faces\\n\", len(rects))\n\n\t\t// draw a rectangle around each face on the original image,\n\t\t// along with text identifying as \"Human\"\n\t\tfor _, r := range rects {\n\t\t\tgocv.Rectangle(&img, r, blue, 3)\n\n\t\t\tsize := gocv.GetTextSize(\"Human\", gocv.FontHersheyPlain, 1.2, 2)\n\t\t\tpt := image.Pt(r.Min.X+(r.Min.X/2)-(size.X/2), r.Min.Y-2)\n\t\t\tgocv.PutText(&img, \"Human\", pt, gocv.FontHersheyPlain, 1.2, blue, 2)\n\t\t}\n\n\t\t// show the image in the window, and wait 1 millisecond\n\t\twindow.IMShow(img)\n\t\tif window.WaitKey(1) >= 0 {\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d4399cd85b38e966e87e8046d3b28d1b", "score": "0.5101415", "text": "func (b BeegoV1x) Detect(input *pb.Input) (*pb.BoolOutput, error) {\n\treturn &pb.BoolOutput{\n\t\tError: nil,\n\t\tValue: true,\n\t}, nil\n}", "title": "" }, { "docid": "8765def17f6b0c68f31f210836cbcc2f", "score": "0.50751185", "text": "func faceTracking(drone *tello.Driver) {\n\tif !flightData.Flying {\n\t\tlog.Warn(\"Face tracking is not possible if drone is not flying\")\n\t\t// TODO should return here\n\t}\n\tdrone.Hover()\n\ttracking = !tracking\n\tdetectedSize = 0\n\tif tracking {\n\t\tlog.Info(\"START Face Tracking\")\n\t} else {\n\t\tlog.Info(\"STOP Face Tracking\")\n\t}\n}", "title": "" }, { "docid": "a2b24e64ba7ef37b8ac298c95a6720a3", "score": "0.50634766", "text": "func SlowBlink(format string, a ...interface{}) string {\n\treturn generateFormat(SSlowBlink, format, a...)\n}", "title": "" }, { "docid": "efabc6fe0cbaa15548e4cc8672a1aea2", "score": "0.5034751", "text": "func TextFieldBlink() {\n\tfor {\n\t\tif TextFieldBlinker == nil {\n\t\t\treturn // shutdown..\n\t\t}\n\t\t<-TextFieldBlinker.C\n\t\tif BlinkingTextField == nil {\n\t\t\tcontinue\n\t\t}\n\t\tif BlinkingTextField.IsDestroyed() || BlinkingTextField.IsDeleted() {\n\t\t\tBlinkingTextField = nil\n\t\t\tcontinue\n\t\t}\n\t\ttf := BlinkingTextField\n\t\tif tf.Viewport == nil || !tf.HasFocus() || !tf.FocusActive || tf.VpBBox == image.ZR {\n\t\t\tBlinkingTextField = nil\n\t\t\tcontinue\n\t\t}\n\t\twin := tf.ParentWindow()\n\t\tif win == nil || win.IsResizing() || win.IsClosed() || !win.IsWindowInFocus() {\n\t\t\tcontinue\n\t\t}\n\t\tif win.IsUpdating() {\n\t\t\tcontinue\n\t\t}\n\t\ttf.BlinkOn = !tf.BlinkOn\n\t\ttf.RenderCursor(tf.BlinkOn)\n\t}\n}", "title": "" }, { "docid": "9d411b2c2659b56a9c3a58cdd91fc76d", "score": "0.49815622", "text": "func detectFaces(net *gocv.Net, img *gocv.Mat) []image.Rectangle {\n\t// convert img Mat to 672x384 blob that the face detector can analyze\n\tblob := gocv.BlobFromImage(*img, 1.0, image.Pt(672, 384), gocv.NewScalar(0, 0, 0, 0), false, false)\n\tdefer blob.Close()\n\n\t// run a forward pass through the network\n\tnet.SetInput(blob, \"\")\n\tresults := net.Forward(\"\")\n\tdefer results.Close()\n\n\t// iterate through all detections and append results to faces buffer\n\tvar faces []image.Rectangle\n\tfor i := 0; i < results.Total(); i += 7 {\n\t\tconfidence := results.GetFloatAt(0, i+2)\n\t\tif float64(confidence) > faceConfidence {\n\t\t\tleft := int(results.GetFloatAt(0, i+3) * float32(img.Cols()))\n\t\t\ttop := int(results.GetFloatAt(0, i+4) * float32(img.Rows()))\n\t\t\tright := int(results.GetFloatAt(0, i+5) * float32(img.Cols()))\n\t\t\tbottom := int(results.GetFloatAt(0, i+6) * float32(img.Rows()))\n\t\t\tfaces = append(faces, image.Rect(left, top, right, bottom))\n\t\t}\n\t}\n\n\treturn faces\n}", "title": "" }, { "docid": "faf3d378df42926de5a83cdc9f6a4ed1", "score": "0.49787292", "text": "func Blink(color string) {\n\n\t// Set pin according to desired color\n\tpin := rpio.Pin(colorMapping[color])\n\n\t// Set pin to output mode\n\tpin.Output()\n\n\t// Toggle once for 100 milliseconds\n\tpin.High()\n\ttime.Sleep(time.Millisecond * 200)\n\tpin.Low()\n}", "title": "" }, { "docid": "d8f63c0f2978085feebca84034099b4c", "score": "0.49017277", "text": "func followFace(drone *tello.Driver, rect image.Rectangle, refDistance float64) {\n\tif rectToFollow.Empty() {\n\t\tlog.Debug(\"[Following face] - Tracking enabled but no face detected. The drone keeps hovering\\n\")\n\t\tdrone.Hover()\n\t\treturn\n\t}\n\tfollowFaceX(drone, rect)\n\tfollowFaceY(drone, rect)\n\tfollowFaceZ(drone, rect, refDistance)\n}", "title": "" }, { "docid": "caab1f0057c2cccdb55943c35a0c0ecf", "score": "0.4867595", "text": "func (c *Canvas) drawDetection(data []uint8, dets [][]int) {\n\tfor i := 0; i < len(dets); i++ {\n\t\tif dets[i][3] > 50 {\n\t\t\tc.ctx.Call(\"beginPath\")\n\t\t\tc.ctx.Set(\"lineWidth\", 2)\n\t\t\tc.ctx.Set(\"strokeStyle\", \"rgba(255, 0, 0, 0.5)\")\n\n\t\t\trow, col, scale := dets[i][1], dets[i][0], dets[i][2]\n\t\t\tcol = col + int(float64(col)*0.1)\n\t\t\tscale = int(float64(scale) * 0.8)\n\n\t\t\tif c.showFrame {\n\t\t\t\tc.ctx.Call(\"rect\", row-scale/2, col-scale/2, scale, scale)\n\t\t\t}\n\t\t\t// Substract the image under the detected face region.\n\t\t\timgData := make([]byte, scale*scale*4)\n\t\t\tsubimg := c.ctx.Call(\"getImageData\", row-scale/2, col-scale/2, scale, scale).Get(\"data\")\n\t\t\tuint8Arr := js.Global().Get(\"Uint8Array\").New(subimg)\n\t\t\tjs.CopyBytesToGo(imgData, uint8Arr)\n\n\t\t\tbuffer := c.pixelate(imgData, dets[i], c.useNoise)\n\t\t\tuint8Arr = js.Global().Get(\"Uint8Array\").New(scale * scale * 4)\n\t\t\tjs.CopyBytesToJS(uint8Arr, buffer)\n\n\t\t\tuint8Clamped := js.Global().Get(\"Uint8ClampedArray\").New(uint8Arr)\n\t\t\trawData := js.Global().Get(\"ImageData\").New(uint8Clamped, scale)\n\n\t\t\t// Replace the underlying face region byte array with the quantized values.\n\t\t\tc.ctx.Call(\"putImageData\", rawData, row-scale/2, col-scale/2)\n\t\t\tc.ctx.Call(\"stroke\")\n\n\t\t\tif c.showPupil {\n\t\t\t\tleftPupil := det.DetectLeftPupil(dets[i])\n\t\t\t\tif leftPupil != nil {\n\t\t\t\t\tcol, row, scale := leftPupil.Col, leftPupil.Row, leftPupil.Scale/8\n\t\t\t\t\tc.ctx.Call(\"moveTo\", col+int(scale), row)\n\t\t\t\t\tc.ctx.Call(\"arc\", col, row, scale, 0, 2*math.Pi, true)\n\t\t\t\t}\n\n\t\t\t\trightPupil := det.DetectRightPupil(dets[i])\n\t\t\t\tif rightPupil != nil {\n\t\t\t\t\tcol, row, scale := rightPupil.Col, rightPupil.Row, rightPupil.Scale/8\n\t\t\t\t\tc.ctx.Call(\"moveTo\", col+int(scale), row)\n\t\t\t\t\tc.ctx.Call(\"arc\", col, row, scale, 0, 2*math.Pi, true)\n\t\t\t\t}\n\t\t\t\tc.ctx.Call(\"stroke\")\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f2afd4d476701bd6872a92c316d95d82", "score": "0.48236012", "text": "func SetBlink() {\n\tDefaultTty.SetBlink()\n}", "title": "" }, { "docid": "5a0dd99f7e220dfc0cad05977150aa86", "score": "0.48029664", "text": "func FaceDetectFromImage() {\n\tif len(os.Args) < 4 {\n\t\tfmt.Println(\"Please sent these argument to us.\")\n\t\tfmt.Println(\"How to run:\\n\\t FaceDetectFromImage [path/to/file/image1.jpg] [path/to/file/image2.jpg] [classifier XML file]\")\n\t\treturn\n\t}\n\t// parse args\n\timageFile1 := os.Args[1]\n\timageFile2 := os.Args[2]\n\txmlFile := os.Args[3]\n\n\t// prepare image matrix\n\timg1 := gocv.IMRead(imageFile1, gocv.IMReadAnyColor)\n\timg2 := gocv.IMRead(imageFile2, gocv.IMReadAnyColor)\n\tif img1.Empty() {\n\t\tlog.Panic(\"Can not read Image file : \", imageFile1)\n\t\treturn\n\t}\n\tif img2.Empty() {\n\t\tlog.Panic(\"Can not read Image file : \", imageFile2)\n\t\treturn\n\t}\n\tdefer img1.Close()\n\tdefer img2.Close()\n\n\t// load classifier to recognize faces\n\tclassifier := gocv.NewCascadeClassifier()\n\tdefer classifier.Close()\n\n\tif !classifier.Load(xmlFile) {\n\t\tfmt.Printf(\"Error reading cascade file: %v\\n\", xmlFile)\n\t\treturn\n\t}\n\n\t// color for the rect when faces detected\n\t// blue := color.RGBA{0, 0, 255, 0}\n\n\t// detect faces\n\trects1 := classifier.DetectMultiScale(img1)\n\tfmt.Printf(\"found %d faces\\n\", len(rects1))\n\trects2 := classifier.DetectMultiScale(img2)\n\tfmt.Printf(\"found %d faces\\n\", len(rects2))\n\n\t// open display window\n\twindow1 := gocv.NewWindow(\"Face Detect 1\")\n\tdefer window1.Close()\n\n\t// open display window\n\twindow2 := gocv.NewWindow(\"Face Detect 2\")\n\tdefer window2.Close()\n\n\t// draw a rectangle around each face on the original image,\n\t// along with text identifying as \"Human\"\n\tvar faceCrop1 gocv.Mat\n\tvar faceCrop2 gocv.Mat\n\timages := make([]gocv.Mat, 2)\n\tfor _, r := range rects1 {\n\t\t// gocv.Rectangle(&img1, r, blue, 3)\n\t\tfaceCrop1 = img1.Region(r)\n\t\t// size := gocv.GetTextSize(\"Human\", gocv.FontHersheyPlain, 1.2, 2)\n\t\t// pt := image.Pt(r.Min.X+(r.Min.X/2)-(size.X/2), r.Min.Y-2)\n\t\t// gocv.PutText(&img1, \"Human\", pt, gocv.FontHersheyPlain, 1.2, blue, 2)\n\t}\n\n\tfor _, r2 := range rects2 {\n\t\t// gocv.Rectangle(&img2, r2, blue, 3)\n\t\tfaceCrop2 = img2.Region(r2)\n\t\t// size := gocv.GetTextSize(\"Human\", gocv.FontHersheyPlain, 1.2, 2)\n\t\t// pt := image.Pt(r2.Min.X+(r2.Min.X/2)-(size.X/2), r2.Min.Y-2)\n\t\t// gocv.PutText(&img2, \"Human\", pt, gocv.FontHersheyPlain, 1.2, blue, 2)\n\t}\n\n\timages[0] = faceCrop1\n\timages[1] = faceCrop2\n\tFaceCompare(images)\n\t// for {\n\t// \t// show the image in the window, and wait 1 millisecond\n\t// \twindow1.IMShow(faceCrop1)\n\t// \twindow2.IMShow(faceCrop2)\n\t// \tif window1.WaitKey(1) >= 0 || window2.WaitKey(1) >= 0 {\n\t// \t\tbreak\n\t// \t}\n\n\t// }\n\n}", "title": "" }, { "docid": "97d461a020eef8a27bae83b7d5f9c0fa", "score": "0.47107428", "text": "func NewFaceDetection() (*FaceDetection, error) {\n\tvar err error\n\tfd := &FaceDetection{}\n\n\t// to read cascade files we need to build proper path\n\t_, b, _, _ := runtime.Caller(0)\n\tthisPackagePath := filepath.Dir(b)\n\n\tfd.faceCascade, err = ioutil.ReadFile(filepath.Join(thisPackagePath, \"..\", \"cascade\", \"facefinder\"))\n\tif err != nil {\n\t\tlogrus.Errorf(\"error reading the cascade file: %v\", err)\n\t\treturn nil, err\n\t}\n\tp := pigo.NewPigo()\n\n\t// Unpack the binary file. This will return the number of cascade trees,\n\t// the tree depth, the threshold and the prediction from tree's leaf nodes.\n\tfd.faceClassifier, err = p.Unpack(fd.faceCascade)\n\tif err != nil {\n\t\tlogrus.Errorf(\"Error unpacking the cascade file: %s\", err)\n\t\treturn nil, err\n\t}\n\n\tfd.puplocCascade, err = ioutil.ReadFile(filepath.Join(thisPackagePath, \"..\", \"cascade\", \"puploc\"))\n\tif err != nil {\n\t\tlogrus.Errorf(\"Error reading the puploc cascade file: %s\", err)\n\t\treturn nil, err\n\t}\n\tfd.puplocClassifier, err = fd.puplocClassifier.UnpackCascade(fd.puplocCascade)\n\tif err != nil {\n\t\tlogrus.Errorf(\"Error unpacking the puploc cascade file: %s\", err)\n\t\treturn nil, err\n\t}\n\n\tfd.flpCascades, err = fd.puplocClassifier.ReadCascadeDir(filepath.Join(thisPackagePath, \"..\", \"cascade\", \"lps\"))\n\tif err != nil {\n\t\tlogrus.Errorf(\"Error unpacking the facial landmark detection cascades: %s\", err)\n\t\treturn nil, err\n\t}\n\n\treturn fd, nil\n}", "title": "" }, { "docid": "c6734560ce3f8007ffdfd6ddf4d600a8", "score": "0.47050127", "text": "func FaceDetect(reader io.Reader) (ret []byte, err error) {\n\tctx := context.Background()\n\t//\tclient, err := vision.NewImageAnnotatorClient(ctx, option.WithCredentialsFile(jsonPath))\n\tclient, err := vision.NewImageAnnotatorClient(ctx)\n\tif err != nil {\n\t\tlog.Printf(\"Failed to create client: %v\", err)\n\t\treturn ret, err\n\t}\n\tdefer client.Close()\n\timage, err := vision.NewImageFromReader(reader)\n\tif err != nil {\n\t\tlog.Printf(\"Failed to create image: %v\", err)\n\t\treturn ret, err\n\t}\n\n\tfaces, err := client.DetectFaces(ctx, image, nil, 10)\n\tif err != nil {\n\t\tlog.Printf(\"Failed to detect labels: %v\", err)\n\t\treturn ret, err\n\t}\n\n\treturn []byte(fmt.Sprintf(\"GCP Faces: %d\", len(faces))), nil\n}", "title": "" }, { "docid": "fc31b18fed1b9c0ebeace2014cfad469", "score": "0.46509275", "text": "func main() {\n\tb := blink.NewBlink(blinkPin, initialDelay)\n\tgo b.Run()\n\tb.Control()\n}", "title": "" }, { "docid": "6b1c7a19aa9687780a0440e7ac6ff1a9", "score": "0.46396503", "text": "func (h *LedImp) Blink(duration time.Duration) *time.Timer {\n\n\ttimer := time.NewTimer(duration)\n\n\tgo func() {\n\t\texpectedState := h.state\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-timer.C:\n\t\t\t\tif expectedState {\n\t\t\t\t\terr := h.TurnOn()\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Errorf(\"Error appear when turn on led: %s\", err.Error())\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\terr := h.TurnOff()\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Errorf(\"Error appear when turn off led: %s\", err.Error())\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\tdefault:\n\t\t\t\terr := h.Toogle()\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Errorf(\"Error appear when toogle led: %s\", err.Error())\n\t\t\t\t}\n\t\t\t\ttime.Sleep(1 * time.Second)\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn timer\n}", "title": "" }, { "docid": "65667e65c43a81736615a795e8348334", "score": "0.4616336", "text": "func (fp *FaceProcessor) DetectFaces(file string) (faces []image.Rectangle, bounds image.Rectangle) {\n\timg := gocv.IMRead(file, gocv.IMReadColor)\n\tdefer img.Close()\n\n\tbds := image.Rectangle{Min: image.Point{}, Max: image.Point{X: img.Cols(), Y: img.Rows()}}\n\t//gocv.CvtColor(img, img, gocv.ColorRGBToGray)\n\t//\tgocv.Resize(img, img, image.Point{}, 0.6, 0.6, gocv.InterpolationArea)\n\n\t// detect faces\n\ttmpfaces := fp.faceclassifier.DetectMultiScaleWithParams(\n\t\timg, 1.07, 5, 0, image.Point{X: 10, Y: 10}, image.Point{X: 500, Y: 500},\n\t)\n\n\tfcs := make([]image.Rectangle, 0)\n\n\tif len(tmpfaces) > 0 {\n\t\t// draw a rectangle around each face on the original image\n\t\tfor _, f := range tmpfaces {\n\t\t\t// detect eyes\n\t\t\tfaceImage := img.Region(f)\n\n\t\t\teyes := fp.eyeclassifier.DetectMultiScaleWithParams(\n\t\t\t\tfaceImage, 1.01, 1, 0, image.Point{X: 0, Y: 0}, image.Point{X: 100, Y: 100},\n\t\t\t)\n\n\t\t\tif len(eyes) > 0 {\n\t\t\t\tfcs = append(fcs, f)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tglasses := fp.glassclassifier.DetectMultiScaleWithParams(\n\t\t\t\tfaceImage, 1.01, 1, 0, image.Point{X: 0, Y: 0}, image.Point{X: 100, Y: 100},\n\t\t\t)\n\n\t\t\tif len(glasses) > 0 {\n\t\t\t\tfcs = append(fcs, f)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\treturn fcs, bds\n\t}\n\n\treturn nil, bds\n}", "title": "" }, { "docid": "877b7dd47116d10a277253807b1cbf0c", "score": "0.4589276", "text": "func (h *LiquidCrystalDriver) NoBlink() error {\n\th.displayctrl &= ^LCD_BLINKON\n\treturn h.command(LCD_DISPLAYCONTROL | h.displayctrl)\n}", "title": "" }, { "docid": "8f5be13d4589eeed43824f66dcc341dd", "score": "0.45826688", "text": "func BlinkSlow() Formatter {\n\treturn Formatter{spBlinkSlow}\n}", "title": "" }, { "docid": "f125e3d52a3836ba1e7b99ccb79bf350", "score": "0.45553553", "text": "func SetBlink(bus *i2c.I2C, blink LEDBlink) (error) {\n\t_, err := bus.WriteBytes([]byte{ AddressBlinkCommand | AddressBlinkDisplayOn | byte(blink) })\n\treturn err\n}", "title": "" }, { "docid": "7b00be3e11db41a48d31c5670d62f03d", "score": "0.4543495", "text": "func OnFaceDown(cb FaceIdEventCallback) io.Closer {\n\treturn emitter.On(evt_FaceDown, cb)\n}", "title": "" }, { "docid": "38411444850e371cca52a8aba0d51f05", "score": "0.45391095", "text": "func (*Devm_LpuBoards_LpuBoard_CpudefendDevm_BrasHostCars_BrasHostCar_AttackDetect) Descriptor() ([]byte, []int) {\n\treturn file_huaweiV8R12_devm_proto_rawDescGZIP(), []int{0, 6, 0, 3, 1, 0, 2}\n}", "title": "" }, { "docid": "3785337ced93f94296f5d9e019084f33", "score": "0.4520513", "text": "func (s *FaceDetection) Detect(image io.Reader) (facedetection.FaceDetection, error) {\n\tvar detectedFaces facedetection.FaceDetection\n\n\timageParams, err := s.buildImageParams(image)\n\tif err != nil {\n\t\treturn detectedFaces, err\n\t}\n\n\tfoundFaces := s.findFaces(imageParams)\n\tif len(foundFaces) == 0 {\n\t\treturn detectedFaces, facedetection.ErrNoFacesFound\n\t}\n\n\tfor _, faceCoords := range foundFaces {\n\t\trow, col, scale := faceCoords[1], faceCoords[0], faceCoords[2]\n\t\tface := facedetection.Face{\n\t\t\tBounds: facedetection.FaceBounds{\n\t\t\t\tX: row - scale/2,\n\t\t\t\tY: col - scale/2,\n\t\t\t\tHeight: scale,\n\t\t\t\tWidth: scale,\n\t\t\t},\n\t\t}\n\n\t\trightEye := s.detectRightPupil(faceCoords, imageParams)\n\t\tif rightEye != nil {\n\t\t\tface.RightEye = facedetection.Eye{X: rightEye.Col, Y: rightEye.Row, Scale: int(rightEye.Scale / 8)}\n\t\t}\n\n\t\tleftEye := s.detectLeftPupil(faceCoords, imageParams)\n\t\tif leftEye != nil {\n\t\t\tface.LeftEye = facedetection.Eye{X: leftEye.Col, Y: leftEye.Row, Scale: int(leftEye.Scale / 8)}\n\t\t}\n\n\t\tif rightEye != nil && leftEye != nil {\n\t\t\tmouthPoints := s.detectMouthPoints(leftEye, rightEye, imageParams)\n\t\t\tp1, p2 := mouthPoints[0], mouthPoints[1]\n\n\t\t\twidth := p2[0] - p1[0]\n\t\t\theight := p2[1] - p1[1]\n\t\t\tif height <= 0 {\n\t\t\t\theight = 1\n\t\t\t}\n\n\t\t\tface.Mouth = facedetection.Mouth{\n\t\t\t\tX: p1[0],\n\t\t\t\tY: p1[1] + (p1[1]-p2[1])/2,\n\t\t\t\tHeight: height,\n\t\t\t\tWidth: width,\n\t\t\t}\n\n\t\t\tdetectedFaces.Faces = append(detectedFaces.Faces, face)\n\t\t}\n\t}\n\n\tif len(detectedFaces.Faces) == 0 {\n\t\treturn detectedFaces, facedetection.ErrNoFacesFound\n\t}\n\n\treturn detectedFaces, nil\n}", "title": "" }, { "docid": "58aff3f7ae1a08c1770d22c6691431a4", "score": "0.45177066", "text": "func Detect(im *rimg64.Multi, margin feat.Margin, rate int, scorer slide.Scorer, shape PadRect, detopts DetFilter, suppropts SupprFilter) ([]Det, error) {\n\tdets, err := Score(im, margin, rate, scorer, shape, detopts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tSort(dets)\n\tdets = Suppress(dets, suppropts.MaxNum, suppropts.Overlap)\n\treturn dets, nil\n}", "title": "" }, { "docid": "768442642265703b797c72036f1d9826", "score": "0.44858763", "text": "func (*Devm_MpuBoards_MpuBoard_CpudefendDevm_BrasHostCars_BrasHostCar_AttackDetect) Descriptor() ([]byte, []int) {\n\treturn file_huaweiV8R12_devm_proto_rawDescGZIP(), []int{0, 5, 0, 3, 1, 0, 2}\n}", "title": "" }, { "docid": "b84d1b5240a1674f036f5075000a0386", "score": "0.44855338", "text": "func (p *pingPongDetector) Detect(ctx context.Context) {\n\tif p.hasFailed() && !p.notified {\n\t\tp.onFailure(ctx, p.addr)\n\t\tp.notified = true\n\t\treturn\n\t}\n\n\tresp, err := p.client.DoBestEffort(ctx, p.addr, p.probeMessage)\n\tif err != nil {\n\t\tp.handleFailure(ctx, p.addr, err)\n\t\treturn\n\t}\n\n\tif resp == nil {\n\t\tp.handleFailure(ctx, p.addr, errors.New(\"received a nil probe response\"))\n\t\treturn\n\t}\n\n\tif resp.GetProbeResponse().GetStatus() == remoting.NodeStatus_BOOTSTRAPPING {\n\t\tp.bootstrapResponseCount++\n\t\tif p.bootstrapResponseCount > bootstrapCountThreshold {\n\t\t\tp.handleFailure(ctx, p.addr, errors.New(\"bootstrap count threshold exceeded\"))\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "02b1e769c50f8f067ac73fb0e2724ed9", "score": "0.44553873", "text": "func (h *CannyEdgeDetector) Detect(img GpuMat, dst *GpuMat) {\n\tC.CannyEdgeDetector_Detect(C.CannyEdgeDetector(h.p), img.p, dst.p, nil)\n\treturn\n}", "title": "" }, { "docid": "3bf5a2771678de1e47fe1620dcec75d2", "score": "0.44204473", "text": "func (b *Blink) Run() {\n\tfor {\n\t\tb.Pin.High()\n\t\tdelay.Milliseconds(b.Delay)\n\t\tb.Pin.Low()\n\t\tdelay.Milliseconds(b.Delay)\n\t}\n}", "title": "" }, { "docid": "626af1e97178ab39a287adad3594e0aa", "score": "0.43789208", "text": "func (a *Client) TriggerDiskBlink(params *TriggerDiskBlinkParams, opts ...ClientOption) (*TriggerDiskBlinkOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewTriggerDiskBlinkParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"TriggerDiskBlink\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/trigger-disk-blink\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &TriggerDiskBlinkReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t}\n\tfor _, opt := range opts {\n\t\topt(op)\n\t}\n\n\tresult, err := a.transport.Submit(op)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*TriggerDiskBlinkOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for TriggerDiskBlink: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "569f911c76feb3d8a117f1c3a232313e", "score": "0.4378767", "text": "func DisableBackfaceCulling() {\n\tC.rlDisableBackfaceCulling()\n}", "title": "" }, { "docid": "26081a9d045b83aee1e4370b11df6760", "score": "0.43488237", "text": "func (b *BloomFilter) Detect(value string) (bool, float64) {\n\th0, h1 := b.hash(value)\n\thx := h0 % b.size\n\tfor k := uint64(0); k < b.keys; k++ {\n\t\tif (b.parts[hx/64] & (1 << (hx % 64))) == 0 {\n\t\t\treturn false, 0.0\n\t\t}\n\t\thx = (hx + h1) % b.size\n\t}\n\treturn true, 1.0 - b.EstimatedErrorRate()\n}", "title": "" }, { "docid": "cf17bd327e5c59e8a0c3b5a3f438929a", "score": "0.43467882", "text": "func EnableBackfaceCulling() {\n\tC.rlEnableBackfaceCulling()\n}", "title": "" }, { "docid": "d127be679222f7a3071e401bc3760e19", "score": "0.43442982", "text": "func openBlink1(dev **C.struct_usbDevice_t) bool {\n\n\trc := C.usbhidOpenDevice(dev,\n\t\tIDENT_VENDOR_NUM, IDENT_VENDOR_STRING,\n\t\tIDENT_PRODUCT_NUM, IDENT_PRODUCT_STRING,\n\t\t1) // NOTE: '0' means \"not using report IDs\"\n\n\tif rc != 0 {\n\t\tlog.Print(\"error in open: couldn't open blink1. Error: \", errorMsgBlink1(rc))\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "5a6978a2d1173344cb5cd5135ce245d0", "score": "0.43408808", "text": "func NewFaceDetector() FaceDetector {\n\treturn FaceDetector{p: unsafe.Pointer(C.FaceDetector_New())}\n}", "title": "" }, { "docid": "188e776ba6b17ae90e8fb452b98b2d8b", "score": "0.43172133", "text": "func (rec *Recognizer) Recognize(imgData []byte, width, height int, maxFaces int) (faces []Face, err error) {\n\tcImgData := (*C.uint8_t)(&imgData[0])\n\tcMaxFaces := C.int(maxFaces)\n\tcWidth := C.int(width)\n\tcHeight := C.int(height)\n\tret := C.facerec_recognize(rec.ptr, cImgData, cWidth, cHeight, cMaxFaces)\n\tdefer C.free(unsafe.Pointer(ret))\n\n\tif ret.err_str != nil {\n\t\tdefer C.free(unsafe.Pointer(ret.err_str))\n\t\terr = makeError(C.GoString(ret.err_str), int(ret.err_code))\n\t\treturn\n\t}\n\n\t// No faces.\n\tnumFaces := int(ret.num_faces)\n\tif numFaces == 0 {\n\t\treturn\n\t}\n\n\t// Copy faces data to Go structure.\n\tdefer C.free(unsafe.Pointer(ret.rectangles))\n\tdefer C.free(unsafe.Pointer(ret.descriptors))\n\n\trDataLen := numFaces * rectLen\n\trDataPtr := unsafe.Pointer(ret.rectangles)\n\trData := (*[1 << 30]C.long)(rDataPtr)[:rDataLen:rDataLen]\n\n\tdDataLen := numFaces * descrLen\n\tdDataPtr := unsafe.Pointer(ret.descriptors)\n\tdData := (*[1 << 30]float32)(dDataPtr)[:dDataLen:dDataLen]\n\n\tfor i := 0; i < numFaces; i++ {\n\t\tface := Face{}\n\t\tx0 := int(rData[i*rectLen])\n\t\ty0 := int(rData[i*rectLen+1])\n\t\tx1 := int(rData[i*rectLen+2])\n\t\ty1 := int(rData[i*rectLen+3])\n\t\tface.Rectangle = image.Rect(x0, y0, x1, y1)\n\t\tcopy(face.Descriptor[:], dData[i*descrLen:(i+1)*descrLen])\n\t\tfaces = append(faces, face)\n\t}\n\treturn\n}", "title": "" }, { "docid": "00ba7bc4e5d69ee4260bfb36d33530e7", "score": "0.43146724", "text": "func DisableFlapDetection() *livestatus.Command {\n\treturn livestatus.NewCommand(\n\t\t\"DISABLE_FLAP_DETECTION\",\n\t)\n}", "title": "" }, { "docid": "2c3506a3570b87b7c0ff7b25ad71442e", "score": "0.43146613", "text": "func DetectBrowse(w http.ResponseWriter, req *http.Request) {\n\ttext := req.FormValue(\"text\")\n\tpredictLangs := cld2.DetectThree(text)\n\t/*\n\t\t\tDETECT: {Estimates:[{Language:English Percent:98 NormScore:1427}] TextBytes:95 Reliable:true}\n\t\tlog.Printf(\"DETECT: %+v\", predictLangs)\n\t*/\n\ttpl.ExecuteTemplate(w, \"index.html\", predictLangs)\n}", "title": "" }, { "docid": "64f82d50bec5fcafe6ab032db75b0316", "score": "0.42688993", "text": "func (d *Dependency) Detect(df DetectorFunc) {\n\td.detector = df\n}", "title": "" }, { "docid": "dc0970bbdbfab2de5fd24d8403aa1069", "score": "0.42637655", "text": "func (e *BlinkEffect) Update(hw *hardware.Hardware, parts []string, nanoseconds int64) {\n\tcolorPrimary := e.colorPrimary.Get().(color.NRGBA)\n\tcolorSecondary := e.colorSecondary.Get().(color.NRGBA)\n\tspeed := e.speed.Get().(int)\n\tratio := e.ratio.Get().(int)\n\n\t// length of one on-off cycle\n\tinterval := mapPercent(int64(5000000000), 100000000, speed)\n\tintervalOn := mapPercent(0, interval, ratio)\n\n\t// get time since last start of on-off cycle\n\te.nsSinceLastStart = (e.nsSinceLastStart + nanoseconds) % interval\n\n\t// turn on or off\n\tvar r, g, b byte = 0, 0, 0\n\tif e.nsSinceLastStart < intervalOn {\n\t\tr = colorPrimary.R\n\t\tg = colorPrimary.G\n\t\tb = colorPrimary.B\n\t} else {\n\t\tr = colorSecondary.R\n\t\tg = colorSecondary.G\n\t\tb = colorSecondary.B\n\t}\n\n\tfor _, part := range parts {\n\t\thw.Led.SetColorAllPart(part, r, g, b)\n\t}\n}", "title": "" }, { "docid": "853efd2314d2f487d2dec38ed27e9cf2", "score": "0.4254245", "text": "func (ps *BrightnessPage) DidHide() {\n}", "title": "" }, { "docid": "18757d01c9c90de06176e7af2a6d0b72", "score": "0.42450857", "text": "func BlinkRapid() Formatter {\n\treturn Formatter{spBlinkRapid}\n}", "title": "" }, { "docid": "6733b55e23512c0ad6ae162dec2f2787", "score": "0.4230381", "text": "func (fd *faceDetector) detectFaces(source string) ([]pigo.Detection, error) {\n\tsrc, err := pigo.GetImage(source)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpixels := pigo.RgbToGrayscale(src)\n\tcols, rows := src.Bounds().Max.X, src.Bounds().Max.Y\n\n\tdc = gg.NewContext(cols, rows)\n\tdc.DrawImage(src, 0, 0)\n\n\timgParams = &pigo.ImageParams{\n\t\tPixels: pixels,\n\t\tRows: rows,\n\t\tCols: cols,\n\t\tDim: cols,\n\t}\n\n\tcParams := pigo.CascadeParams{\n\t\tMinSize: fd.minSize,\n\t\tMaxSize: fd.maxSize,\n\t\tShiftFactor: fd.shiftFactor,\n\t\tScaleFactor: fd.scaleFactor,\n\t\tImageParams: *imgParams,\n\t}\n\n\tfaceCascade, err := ioutil.ReadFile(fd.faceCascade)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tp := pigo.NewPigo()\n\t// Unpack the binary file. This will return the number of cascade trees,\n\t// the tree depth, the threshold and the prediction from tree's leaf nodes.\n\tclassifier, err := p.Unpack(faceCascade)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpl := pigo.NewPuplocCascade()\n\teyesCascade, err := ioutil.ReadFile(fd.eyesCascade)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tplc, err = pl.UnpackCascade(eyesCascade)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tflpcs, err = pl.ReadCascadeDir(fd.flplocDir)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Run the classifier over the obtained leaf nodes and return the detection results.\n\t// The result contains quadruplets representing the row, column, scale and detection score.\n\tfaces := classifier.RunCascade(cParams, fd.angle)\n\n\t// Calculate the intersection over union (IoU) of two clusters.\n\tfaces = classifier.ClusterDetections(faces, fd.iouThreshold)\n\n\treturn faces, nil\n}", "title": "" }, { "docid": "e84225248f032626353447e1f16eb1fd", "score": "0.42298105", "text": "func (o StreamProcessorFaceSearchSettingsOutput) FaceMatchThreshold() pulumi.Float64PtrOutput {\n\treturn o.ApplyT(func(v StreamProcessorFaceSearchSettings) *float64 { return v.FaceMatchThreshold }).(pulumi.Float64PtrOutput)\n}", "title": "" }, { "docid": "a52c2a266d767414c2aeac8244e78ddd", "score": "0.422178", "text": "func (o StreamProcessorFaceSearchSettingsPtrOutput) FaceMatchThreshold() pulumi.Float64PtrOutput {\n\treturn o.ApplyT(func(v *StreamProcessorFaceSearchSettings) *float64 {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.FaceMatchThreshold\n\t}).(pulumi.Float64PtrOutput)\n}", "title": "" }, { "docid": "555b47728121850291e8ab367b2607fe", "score": "0.42211744", "text": "func (h *HoughLinesDetector) Detect(img GpuMat, dst *GpuMat) {\n\tC.HoughLinesDetector_Detect(C.HoughLinesDetector(h.p), img.p, dst.p, nil)\n\treturn\n}", "title": "" }, { "docid": "10763e1aac881fe3e8576f198a7365ef", "score": "0.42047283", "text": "func (v *Display) Beep() {\n\tC.gdk_display_beep(v.native())\n}", "title": "" }, { "docid": "97196ab82d8221489d48ca3d6b7aa7b1", "score": "0.42002192", "text": "func DisableSvcFlapDetection(\n\thost_name string,\n\tservice_description string,\n) *livestatus.Command {\n\treturn livestatus.NewCommand(\n\t\t\"DISABLE_SVC_FLAP_DETECTION\",\n\t\tstringifyArg(\"host_name\", \"string\", host_name),\n\t\tstringifyArg(\"service_description\", \"string\", service_description),\n\t)\n}", "title": "" }, { "docid": "9d90d7dc6eff16483026e84763dae1a1", "score": "0.41846472", "text": "func EnableFlapDetection() *livestatus.Command {\n\treturn livestatus.NewCommand(\n\t\t\"ENABLE_FLAP_DETECTION\",\n\t)\n}", "title": "" }, { "docid": "c9a582fd06dac633fff570d21cf36a4c", "score": "0.4183504", "text": "func Pitchbend(channel int32, value int32) int32 {\n\tcchannel, _ := (C.int)(channel), cgoAllocsUnknown\n\tcvalue, _ := (C.int)(value), cgoAllocsUnknown\n\t__ret := C.libpd_pitchbend(cchannel, cvalue)\n\t__v := (int32)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "1e6464b8f570872389834f5e27e58963", "score": "0.4176572", "text": "func (gpio *GPIO) StartEdgeDetectCallbacks(edge Edge, callback func(Value)) {\n\tgo func() {\n\t\truntime.LockOSThread()\n\t\tfor {\n\t\t\tvalue, err := gpio.WaitForEdge(edge)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tcallback(value)\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "d5a1a1a77d4c7dcc0225064ba2936d9b", "score": "0.41749832", "text": "func DetectImage(im image.Image, phi feat.Image, pad feat.Pad, scorer slide.Scorer, shape PadRect, detopts DetFilter, suppropts SupprFilter) ([]Det, error) {\n\tf, err := feat.ApplyPad(phi, im, pad)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn Detect(f, pad.Margin, phi.Rate(), scorer, shape, detopts, suppropts)\n}", "title": "" }, { "docid": "71da0eeb34a3f249d8bde846ea0a14e9", "score": "0.41727665", "text": "func backingOff(count int, wait int) int {\n\tif count%wait == 0 {\n\t\treturn wait * 2\n\t} else {\n\t\treturn wait\n\t}\n}", "title": "" }, { "docid": "1a85d008efa3f7c058c24198d202ddd6", "score": "0.416682", "text": "func DetectFaces(filePath string) ([]*pb.FaceAnnotation, error) {\n\tctx := context.Background()\n\tclient, err := vision.NewImageAnnotatorClient(ctx)\n\thelpers.ErrorHandler(err, \"Failed to create client\")\n\n\tfile, err := os.Open(filePath)\n\thelpers.ErrorHandler(err, \"Failed to read file\")\n\tdefer file.Close()\n\n\timage, err := vision.NewImageFromReader(file)\n\thelpers.ErrorHandler(err, \"Failed load image\")\n\n\tfaces, err := client.DetectFaces(ctx, image, nil, 10)\n\thelpers.ErrorHandler(err, \"Failed to detect faces on image\")\n\n\treturn faces, err\n}", "title": "" }, { "docid": "cc162c3bc9de7d4833401e9681c3ee8c", "score": "0.41661346", "text": "func (c *Crawler) analyze(p *Proxy) (available bool) {\n\thttpClient := NewProxyClient(p)\n\tif httpClient == nil {\n\t\treturn false\n\t}\n\t// 多次检测,只要一次成功则认为成功\n\tfor i := 0; i < detectConfig.MaxTimes; i++ {\n\t\tins := axios.NewInstance(&axios.InstanceConfig{\n\t\t\tTimeout: detectConfig.Timeout,\n\t\t\tClient: httpClient,\n\t\t})\n\t\tstartedAt := time.Now()\n\t\tresp, err := ins.Get(detectConfig.URL)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tif resp.Status >= http.StatusOK && resp.Status < http.StatusBadRequest {\n\t\t\td := time.Since(startedAt)\n\t\t\tatomic.StoreInt32(&p.Speed, int32(len(speedDevides)))\n\t\t\t// 将当前proxy划分对应的分段\n\t\t\tfor index, item := range speedDevides {\n\t\t\t\tif d < item {\n\t\t\t\t\tatomic.StoreInt32(&p.Speed, int32(index))\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tavailable = true\n\t\t\tbreak\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "6c91031a69522c4c1e1469f91b288428", "score": "0.4161585", "text": "func followFaceX(drone *tello.Driver, rect image.Rectangle) {\n\tright := float32(rect.Max.X)\n\tleft := float32(rect.Min.X)\n\tif right < frameX/2 && right > 0 {\n\t\t// Ex 1\n\t\tlog.Infof(\"[Following face] [X] Moving CounterClockwise (right=%v)\", right)\n\t\tdrone.CounterClockwise(followSpeed)\n\t} else if left > frameX/2 && left < frameX {\n\t\t// Ex 2\n\t\tlog.Infof(\"[Following face] [X] Moving Clockwise (left=%v)\", left)\n\t\tdrone.Clockwise(followSpeed)\n\t} else {\n\t\t// Ex 3\n\t\tlog.Debugf(\"[Following face] [X] Stop Clockwise - [left=%v, right=%v]\", left, right)\n\t\tdrone.Clockwise(0)\n\t}\n}", "title": "" }, { "docid": "9a6249d8cd80c1ede988969d11be25f4", "score": "0.41596648", "text": "func Blink(host string, port string, red string, green string) error {\n\tclient := http.Client{\n\t\tTimeout: 5 * time.Second,\n\t}\n\n\tflag.Parse()\n\n\tif host == \"\" {\n\t\treturn errors.New(\"head: host is empty\")\n\t}\n\n\tif port == \"\" {\n\t\treturn errors.New(\"head: host is empty\")\n\t}\n\n\tespURL := url.URL{\n\t\tScheme: \"http\",\n\t\tHost: host + \":\" + port,\n\t\tPath: \"/diode\",\n\t}\n\n\t// Construct request.\n\tq := url.Values{}\n\tq.Add(\"green\", green)\n\tq.Add(\"red\", red)\n\n\treq, err := http.NewRequest(\"GET\", espURL.String(), nil)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"head: create request\")\n\t}\n\treq.URL.RawQuery = q.Encode()\n\n\t// Make request.\n\tres, err := client.Do(req)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"head: make request\")\n\t}\n\n\t// Get response.\n\tbodyContent, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"head: read response body\")\n\t}\n\n\tlog.Printf(\"head: got response, status: %s, body: %s\\n\", res.Status, string(bodyContent))\n\treturn nil\n}", "title": "" }, { "docid": "8f0eca40449a83b053347cc2631580c7", "score": "0.41573042", "text": "func (lp *Loadpoint) stopVehicleDetection() {\n\tlp.vehicleDetect = time.Time{}\n\tif lp.vehicleDetectTicker != nil {\n\t\tlp.vehicleDetectTicker.Stop()\n\t}\n\tlp.publish(vehicleDetectionActive, false)\n}", "title": "" }, { "docid": "268e725c64c026ce332c3e8379aacb93", "score": "0.41475827", "text": "func (c *Client) FaceDetectTrack(\n\tvideo interface{},\n\tprogressNotifier func(status string, progress float32),\n) (processResult cognitive.VideoProcessingResult1, err error) {\n\treturn cognitive.VideoFaceDetectTrack(\n\t\tc.ApiKey,\n\t\tvideo,\n\t\tprogressNotifier,\n\t)\n}", "title": "" }, { "docid": "92d195fcc9cd4d85e06a11a97063f40c", "score": "0.41452336", "text": "func Detect(img draw.Image, fileName string, outputDir string) int {\n\tvar facesCount int\n\n\tcf, err := Asset(\"static/facefinder.bin\")\n\tif err != nil {\n\t\tlog.Fatalf(\"Error reading the cascade file: %v\", err)\n\t}\n\n\tpg := pigo.NewPigo()\n\t// Unpack the binary file. This will return the number of cascade trees,\n\t// the tree depth, the threshold and the prediction from tree's leaf nodes.\n\tclassifier, err := pg.Unpack(cf)\n\tif err != nil {\n\t\tlog.Fatalf(\"Error reading the cascade file: %s\", err)\n\t}\n\n\tsrc := pigo.ImgToNRGBA(img)\n\tpixels := pigo.RgbToGrayscale(src)\n\tcols, rows := src.Bounds().Max.X, src.Bounds().Max.Y\n\tcParams := pigo.CascadeParams{\n\t\tMinSize: 20,\n\t\tMaxSize: 1000,\n\t\tShiftFactor: 0.1,\n\t\tScaleFactor: 1.1,\n\t\tImageParams: pigo.ImageParams{\n\t\t\tPixels: pixels,\n\t\t\tRows: rows,\n\t\t\tCols: cols,\n\t\t\tDim: cols,\n\t\t},\n\t}\n\n\t// Run the classifier over the obtained leaf nodes and return the detection results.\n\t// The result contains quadruplets representing the row, column, scale and detection score.\n\tangle := 0.0\n\tdets := classifier.RunCascade(cParams, angle)\n\n\t// Calculate the intersection over union (IoU) of two clusters.\n\tiouThreshold := 0.2\n\tfaces := classifier.ClusterDetections(dets, iouThreshold)\n\n\t// Generate cropped images\n\tvar qThresh float32 = 50.0\n\tfor i, face := range faces {\n\t\tif face.Q <= qThresh {\n\t\t\tcontinue\n\t\t}\n\n\t\tcropped, err := cropImage(img, image.Rect(face.Col-face.Scale/2, face.Row-face.Scale/2, face.Col-face.Scale/2+face.Scale, face.Row-face.Scale/2+face.Scale))\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Error cropping image: %s\", err)\n\t\t}\n\n\t\twriteImage(cropped, path.Join(outputDir, fileName+\"_face_\"+padFileNameWithZero(uint32(i))+\".png\"))\n\n\t\tfacesCount++\n\t}\n\treturn facesCount\n}", "title": "" }, { "docid": "c69efb99d1352e4bfcd6fc816a55b065", "score": "0.41364533", "text": "func (b bb8) Flash() {\n\tb.driver.SetRGB(255, 0, 0)\n\ttime.AfterFunc(time.Second, func() {\n\t\tb.driver.SetRGB(0, 255, 0)\n\t})\n}", "title": "" }, { "docid": "723a0ad8b2080b6d3e6e044dc1c168b6", "score": "0.4133338", "text": "func (rec *FaceRec) Recognize(imgData []byte) (faces []Face, err error) {\n\treturn rec.recognize(imgData, 0)\n}", "title": "" }, { "docid": "4135581bcdd8cce0bc64ca868f90ce99", "score": "0.41235802", "text": "func (fd *faceDetector) detectFaces(source string) ([]pigo.Detection, error) {\n\tsrc, err := pigo.GetImage(source)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpixels := pigo.RgbToGrayscale(src)\n\tcols, rows := src.Bounds().Max.X, src.Bounds().Max.Y\n\n\tdc = gg.NewContext(cols, rows)\n\tdc.DrawImage(src, 0, 0)\n\n\tcParams := pigo.CascadeParams{\n\t\tMinSize: fd.minSize,\n\t\tMaxSize: fd.maxSize,\n\t\tShiftFactor: fd.shiftFactor,\n\t\tScaleFactor: fd.scaleFactor,\n\t\tImageParams: pigo.ImageParams{\n\t\t\tPixels: pixels,\n\t\t\tRows: rows,\n\t\t\tCols: cols,\n\t\t\tDim: cols,\n\t\t},\n\t}\n\n\tcascadeFile, err := ioutil.ReadFile(fd.cascadeFile)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpigo := pigo.NewPigo()\n\t// Unpack the binary file. This will return the number of cascade trees,\n\t// the tree depth, the threshold and the prediction from tree's leaf nodes.\n\tclassifier, err := pigo.Unpack(cascadeFile)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Run the classifier over the obtained leaf nodes and return the detection results.\n\t// The result contains quadruplets representing the row, column, scale and detection score.\n\tfaces := classifier.RunCascade(cParams, *angle)\n\n\t// Calculate the intersection over union (IoU) of two clusters.\n\tfaces = classifier.ClusterDetections(faces, fd.iouThreshold)\n\n\treturn faces, nil\n}", "title": "" }, { "docid": "ced60f0b7ee2c242e308e94d79622eb2", "score": "0.41206738", "text": "func (c *Crawler) detectProxyList(list []*Proxy) (availableList []*Proxy, unavailableList []*Proxy) {\n\tavailableList = make([]*Proxy, 0)\n\tunavailableList = make([]*Proxy, 0)\n\tw := sync.WaitGroup{}\n\t// 控制最多检测proxy的数量\n\tchans := make(chan bool, 5)\n\tfor _, item := range list {\n\t\tw.Add(1)\n\t\tgo func(p *Proxy) {\n\t\t\tchans <- true\n\t\t\tavaliable := c.analyze(p)\n\t\t\tatomic.StoreInt64(&p.DetectedAt, time.Now().Unix())\n\t\t\tif avaliable {\n\t\t\t\tavailableList = append(availableList, p)\n\t\t\t} else {\n\t\t\t\tunavailableList = append(unavailableList, p)\n\t\t\t}\n\t\t\t<-chans\n\t\t\tw.Done()\n\t\t}(item)\n\t}\n\tw.Wait()\n\treturn\n}", "title": "" }, { "docid": "4cddd896e162f30369d891c21a63542c", "score": "0.4115", "text": "func FrontLightOn() {\n\tfrontLightDriver.On()\n}", "title": "" }, { "docid": "d084814814c2bb16c4ba4689d4a3400f", "score": "0.41118467", "text": "func FaceImageChunkToClad(faceData [faceImagePixelsPerChunk]uint16, pixelCount uint16, chunkIndex uint8, chunkCount uint8, durationMs uint32, interruptRunning bool) *gw_clad.MessageExternalToRobot {\n\treturn gw_clad.NewMessageExternalToRobotWithDisplayFaceImageRGBChunk(&gw_clad.DisplayFaceImageRGBChunk{\n\t\tFaceData: faceData,\n\t\tNumPixels: pixelCount,\n\t\tChunkIndex: chunkIndex,\n\t\tNumChunks: chunkCount,\n\t\tDurationMs: durationMs,\n\t\tInterruptRunning: interruptRunning,\n\t})\n}", "title": "" }, { "docid": "ca2a82204358e09d13a8a5048e1b2918", "score": "0.41078368", "text": "func HandleFloodPing(url *string, packets int) (float64, *scrap.TypePingScrap) {\n\tchnl := make(chan *string)\n\n\t// launch a goroutine to handle ping operations\n\tgo utils.CLIFloodPing(url, packets, chnl)\n\tresp := <-chnl\n\treturn scrap.CLIFLoodPingScrap(resp)\n}", "title": "" }, { "docid": "d4e037683f954da82391cbadd9f387cf", "score": "0.41051862", "text": "func startGoCVMotionDetect(ffmpegOut io.Reader) {\n\twindow := gocv.NewWindow(\"Motion Window\")\n\tdefer window.Close() //nolint\n\n\timg := gocv.NewMat()\n\tdefer img.Close() //nolint\n\n\timgDelta := gocv.NewMat()\n\tdefer imgDelta.Close() //nolint\n\n\timgThresh := gocv.NewMat()\n\tdefer imgThresh.Close() //nolint\n\n\tmog2 := gocv.NewBackgroundSubtractorMOG2()\n\tdefer mog2.Close() //nolint\n\n\tfor {\n\t\tbuf := make([]byte, frameSize)\n\t\tif _, err := io.ReadFull(ffmpegOut, buf); err != nil {\n\t\t\tfmt.Println(err)\n\t\t\tcontinue\n\t\t}\n\t\timg, _ := gocv.NewMatFromBytes(frameY, frameX, gocv.MatTypeCV8UC3, buf)\n\t\tif img.Empty() {\n\t\t\tcontinue\n\t\t}\n\n\t\tstatus := \"Ready\"\n\t\tstatusColor := color.RGBA{0, 255, 0, 0}\n\n\t\t// first phase of cleaning up image, obtain foreground only\n\t\tmog2.Apply(img, &imgDelta)\n\n\t\t// remaining cleanup of the image to use for finding contours.\n\t\t// first use threshold\n\t\tgocv.Threshold(imgDelta, &imgThresh, 25, 255, gocv.ThresholdBinary)\n\n\t\t// then dilate\n\t\tkernel := gocv.GetStructuringElement(gocv.MorphRect, image.Pt(3, 3))\n\t\tdefer kernel.Close() //nolint\n\t\tgocv.Dilate(imgThresh, &imgThresh, kernel)\n\n\t\t// now find contours\n\t\tcontours := gocv.FindContours(imgThresh, gocv.RetrievalExternal, gocv.ChainApproxSimple)\n\n\t\tfor i := 0; i < contours.Size(); i++ {\n\t\t\tarea := gocv.ContourArea(contours.At(i))\n\t\t\tif area < minimumArea {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tstatus = \"Motion detected\"\n\t\t\tstatusColor = color.RGBA{255, 0, 0, 0}\n\t\t\tgocv.DrawContours(&img, contours, i, statusColor, 2)\n\n\t\t\trect := gocv.BoundingRect(contours.At(i))\n\t\t\tgocv.Rectangle(&img, rect, color.RGBA{0, 0, 255, 0}, 2)\n\t\t}\n\n\t\tgocv.PutText(&img, status, image.Pt(10, 20), gocv.FontHersheyPlain, 1.2, statusColor, 2)\n\n\t\twindow.IMShow(img)\n\t\tif window.WaitKey(1) == 27 {\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "437d6cfba5885b9f4305ca24684f15ef", "score": "0.410295", "text": "func (ps *BrightnessPage) WillHide() {\n}", "title": "" }, { "docid": "f8a0542f215eaeaac8e831b2cbd66a23", "score": "0.40982026", "text": "func (c *Canvas) drawDetection(data []uint8, dets [][]int) error {\n\tc.processor.MaxPoints = c.trianglePoints\n\tc.processor.Grayscale = c.isGrayScaled\n\tc.processor.StrokeWidth = c.strokeWidth\n\tc.processor.PointsThreshold = c.pointsThreshold\n\tc.processor.Wireframe = c.wireframe\n\n\tc.triangle = &triangle.Image{*c.processor}\n\n\tvar imgScale float64\n\n\tfor _, det := range dets {\n\t\tdet := det\n\t\tc.g.Go(func() error {\n\t\t\tif det[3] > 50 {\n\t\t\t\tc.ctx.Call(\"beginPath\")\n\t\t\t\tc.ctx.Set(\"lineWidth\", 2)\n\t\t\t\tc.ctx.Set(\"strokeStyle\", \"rgba(255, 0, 0, 0.5)\")\n\n\t\t\t\trow, col, scale := det[1], det[0], int(float64(det[2])*0.72)\n\n\t\t\t\tleftPupil := pigo.DetectLeftPupil(det)\n\t\t\t\trightPupil := pigo.DetectRightPupil(det)\n\n\t\t\t\tif leftPupil != nil && rightPupil != nil {\n\t\t\t\t\tpoints := pigo.DetectMouthPoints(leftPupil, rightPupil)\n\t\t\t\t\tp1, p2 := points[0], points[1]\n\n\t\t\t\t\t// Calculate the lean angle between the two mouth points.\n\t\t\t\t\tangle := 1 - (math.Atan2(float64(p2[0]-p1[0]), float64(p2[1]-p1[1])) * 180 / math.Pi / 90)\n\t\t\t\t\tif scale < minScale || math.Abs(angle) > 0.05 {\n\t\t\t\t\t\tc.snapshotBtn.Get(\"style\").Set(\"backgroundColor\", \"#ff0000\")\n\t\t\t\t\t} else {\n\t\t\t\t\t\tc.snapshotBtn.Get(\"style\").Set(\"backgroundColor\", \"#0da307\")\n\t\t\t\t\t}\n\n\t\t\t\t\tif scale < maskWidth || scale < maskHeight {\n\t\t\t\t\t\tif maskHeight > maskWidth {\n\t\t\t\t\t\t\timgScale = float64(scale) / float64(maskHeight)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\timgScale = float64(scale) / float64(maskWidth)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\timgScale *= 0.9\n\n\t\t\t\t\tmaskWidth, maskHeight := float64(maskWidth)*imgScale, float64(maskHeight)*imgScale*0.9\n\t\t\t\t\ttx := row - int(maskWidth/2)\n\t\t\t\t\tty := p1[1] + (p1[1]-p2[1])/2 - int(maskHeight*0.5)\n\n\t\t\t\t\trow += int(float64(row) * 0.02)\n\t\t\t\t\tcol += int(float64(scale) * 0.4)\n\n\t\t\t\t\t// Substract the image under the detected face region.\n\t\t\t\t\timgData := make([]byte, scale*scale*4)\n\t\t\t\t\tsubimg := c.ctx.Call(\"getImageData\", row-scale/2, col-scale/2, scale, scale).Get(\"data\")\n\t\t\t\t\tuint8Arr := js.Global().Get(\"Uint8Array\").New(subimg)\n\t\t\t\t\tjs.CopyBytesToGo(imgData, uint8Arr)\n\n\t\t\t\t\t// Triangulate the facemask part.\n\t\t\t\t\tc.mu.Lock()\n\t\t\t\t\trect := image.Rect(0, 0, scale, scale)\n\t\t\t\t\ttriangle, err := c.triangulate(imgData, rect)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\tc.mu.Unlock()\n\n\t\t\t\t\tuint8Arr = js.Global().Get(\"Uint8Array\").New(scale * scale * 4)\n\t\t\t\t\tjs.CopyBytesToJS(uint8Arr, triangle)\n\n\t\t\t\t\tuint8Clamped := js.Global().Get(\"Uint8ClampedArray\").New(uint8Arr)\n\t\t\t\t\trawData := js.Global().Get(\"ImageData\").New(uint8Clamped, scale)\n\n\t\t\t\t\t// Clear out the canvas on each frame.\n\t\t\t\t\tc.ctx2.Call(\"clearRect\", 0, 0, c.windowSize.width, c.windowSize.height)\n\n\t\t\t\t\tc.ctx2.Call(\"save\")\n\t\t\t\t\tc.ctx2.Call(\"translate\", js.ValueOf(tx).Int(), js.ValueOf(ty).Int())\n\t\t\t\t\tc.ctx2.Call(\"rotate\", js.ValueOf(angle).Float())\n\t\t\t\t\tc.ctx2.Call(\"translate\", js.ValueOf(-tx).Int(), js.ValueOf(-ty).Int())\n\n\t\t\t\t\t// Replace the underlying face region with the triangulated image.\n\t\t\t\t\tc.ctx2.Call(\"putImageData\", rawData, row-scale/2, col-scale/2)\n\n\t\t\t\t\t// We are using globalCompositeOperation `destination-atop` drawing method to\n\t\t\t\t\t// substract the overlayed facemask from the detected face region.\n\t\t\t\t\tc.ctx2.Set(\"globalCompositeOperation\", \"destination-in\")\n\n\t\t\t\t\tc.ctx2.Call(\"drawImage\", mask,\n\t\t\t\t\t\tjs.ValueOf(tx).Int(), js.ValueOf(ty).Int(),\n\t\t\t\t\t\tjs.ValueOf(maskWidth).Int(), js.ValueOf(maskHeight).Int(),\n\t\t\t\t\t)\n\t\t\t\t\tc.ctx2.Call(\"restore\")\n\n\t\t\t\t\tc.ctx.Call(\"save\")\n\t\t\t\t\tc.ctx.Call(\"translate\", js.ValueOf(tx).Int(), js.ValueOf(ty).Int())\n\t\t\t\t\tc.ctx.Call(\"rotate\", js.ValueOf(angle).Float())\n\t\t\t\t\tc.ctx.Call(\"translate\", js.ValueOf(-tx).Int(), js.ValueOf(-ty).Int())\n\n\t\t\t\t\t// Draw the mask canvas into the main canvas.\n\t\t\t\t\tc.ctx.Call(\"drawImage\", c.maskCanvas, 0, 0)\n\t\t\t\t\tc.ctx.Call(\"restore\")\n\t\t\t\t}\n\n\t\t\t\tif c.showFrame {\n\t\t\t\t\tc.ctx.Call(\"rect\", row-scale/2, col-scale/2, scale, scale)\n\t\t\t\t\tc.ctx.Call(\"stroke\")\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t}\n\tif err := c.g.Wait(); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9469b28727eff45cde44cbdd710f25d9", "score": "0.4092583", "text": "func drawDetections(ctx *gg.Context, x, y, r float64, c color.RGBA, markDet bool) {\n\tctx.DrawArc(x, y, r*0.15, 0, 2*math.Pi)\n\tctx.SetFillStyle(gg.NewSolidPattern(c))\n\tctx.Fill()\n\n\tif markDet {\n\t\tctx.DrawRectangle(x-(r*1.5), y-(r*1.5), r*3, r*3)\n\t\tctx.SetLineWidth(2.0)\n\t\tctx.SetStrokeStyle(gg.NewSolidPattern(color.RGBA{R: 255, G: 255, B: 0, A: 255}))\n\t\tctx.Stroke()\n\t}\n}", "title": "" }, { "docid": "a27ccce83779645e22447ceeaa9a4b72", "score": "0.4075609", "text": "func TrackDown(image, version string) {\n\ttrack(downEvent, version, image)\n}", "title": "" }, { "docid": "8b9a753c2f62c9b6758839cc5ce9d861", "score": "0.40731347", "text": "func (*Document_Page_Token_DetectedBreak) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_documentai_v1beta2_document_proto_rawDescGZIP(), []int{0, 3, 5, 0}\n}", "title": "" }, { "docid": "1612f2310fab92644a1de0d578a077e4", "score": "0.40725452", "text": "func AsBlinkSlow(a ...interface{}) string {\n\treturn BlinkSlow().Sprint(a...)\n}", "title": "" }, { "docid": "2e500911c3a3fa6e5319026a2f522306", "score": "0.40604654", "text": "func (e *HTMLFont) Face(v string) *HTMLFont {\n\te.a[\"face\"] = v\n\treturn e\n}", "title": "" }, { "docid": "bc48524fe4ad6e4b7e15f4960139f43b", "score": "0.4055034", "text": "func FrontLightOff() {\n\tfrontLightDriver.Off()\n}", "title": "" }, { "docid": "2ef8003ed03ce6d3c7a7609177317b3f", "score": "0.40520868", "text": "func newFaceDetector(cf string, minSize, maxSize int, shf, scf, iou float64) *faceDetector {\n\treturn &faceDetector{\n\t\tcascadeFile: cf,\n\t\tminSize: minSize,\n\t\tmaxSize: maxSize,\n\t\tshiftFactor: shf,\n\t\tscaleFactor: scf,\n\t\tiouThreshold: iou,\n\t}\n}", "title": "" }, { "docid": "501d1f74e8ce8f1b0c48ff0293c9e230", "score": "0.40442407", "text": "func (fd *faceDetector) drawFaces(faces []pigo.Detection) error {\n\tvar (\n\t\tqThresh = float32(5.0)\n\t\tperturb = 63\n\t\tpuploc *pigo.Puploc\n\t\timgScale float64\n\t)\n\n\tfor _, face := range faces {\n\t\tif face.Q > qThresh {\n\t\t\t// left eye\n\t\t\tpuploc = &pigo.Puploc{\n\t\t\t\tRow: face.Row - int(0.075*float32(face.Scale)),\n\t\t\t\tCol: face.Col - int(0.175*float32(face.Scale)),\n\t\t\t\tScale: float32(face.Scale) * 0.25,\n\t\t\t\tPerturbs: perturb,\n\t\t\t}\n\t\t\tleftEye := plc.RunDetector(*puploc, *imgParams, fd.angle, false)\n\n\t\t\t// right eye\n\t\t\tpuploc = &pigo.Puploc{\n\t\t\t\tRow: face.Row - int(0.075*float32(face.Scale)),\n\t\t\t\tCol: face.Col + int(0.185*float32(face.Scale)),\n\t\t\t\tScale: float32(face.Scale) * 0.25,\n\t\t\t\tPerturbs: perturb,\n\t\t\t}\n\t\t\trightEye := plc.RunDetector(*puploc, *imgParams, fd.angle, false)\n\n\t\t\tflp1 := flpcs[\"lp84\"][0].GetLandmarkPoint(leftEye, rightEye, *imgParams, perturb, false)\n\t\t\tflp2 := flpcs[\"lp84\"][0].GetLandmarkPoint(leftEye, rightEye, *imgParams, perturb, true)\n\n\t\t\tmask, err := os.OpenFile(\"assets/facemask.png\", os.O_RDONLY, 0755)\n\t\t\tdefer mask.Close()\n\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tmaskImg, err := png.Decode(mask)\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatal(err)\n\t\t\t}\n\n\t\t\t// Calculate the lean angle between the two mouth points.\n\t\t\tangle := 1 - (math.Atan2(float64(flp2.Col-flp1.Col), float64(flp2.Row-flp1.Row)) * 180 / math.Pi / 90)\n\t\t\tdx, dy := maskImg.Bounds().Dx(), maskImg.Bounds().Dy()\n\n\t\t\tif face.Scale < dx || face.Scale < dy {\n\t\t\t\tif dx > dy {\n\t\t\t\t\timgScale = float64(face.Scale) / float64(dx)\n\t\t\t\t} else {\n\t\t\t\t\timgScale = float64(face.Scale) / float64(dy)\n\t\t\t\t}\n\t\t\t}\n\t\t\twidth, height := float64(dx)*imgScale*0.75, float64(dy)*imgScale*0.75\n\t\t\ttx := face.Col - int(width/2)\n\t\t\tty := flp1.Row + (flp1.Row-flp2.Row)/2 - int(height*0.4)\n\n\t\t\tresized := imaging.Resize(maskImg, int(width), int(height), imaging.Lanczos)\n\t\t\taligned := imaging.Rotate(resized, angle, color.Transparent)\n\t\t\tdc.DrawImage(aligned, tx, ty)\n\t\t}\n\t}\n\n\timg := dc.Image()\n\toutput, err := os.OpenFile(fd.destination, os.O_CREATE|os.O_RDWR, 0755)\n\tdefer output.Close()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\text := filepath.Ext(output.Name())\n\n\tswitch ext {\n\tcase \".jpg\", \".jpeg\":\n\t\tif err := jpeg.Encode(output, img, &jpeg.Options{Quality: 100}); err != nil {\n\t\t\treturn err\n\t\t}\n\tcase \".png\":\n\t\tif err := png.Encode(output, img); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5b5c3f3421613ebe07998112fcc2a4b4", "score": "0.40432903", "text": "func DisableHostFlapDetection(\n\thost_name string,\n) *livestatus.Command {\n\treturn livestatus.NewCommand(\n\t\t\"DISABLE_HOST_FLAP_DETECTION\",\n\t\tstringifyArg(\"host_name\", \"string\", host_name),\n\t)\n}", "title": "" }, { "docid": "ea7e317638d127c0d3eb0e3029e6c936", "score": "0.4042377", "text": "func (f *FaceDetector) DetectMouth(img gocv.Mat, face Face) {\n\tC.FaceDetector_DetectMouth((C.FaceDetector)(f.p), C.Mat(img.Ptr()), C.Face(face.Ptr()))\n\treturn\n}", "title": "" }, { "docid": "42337b98986a61c2b12075ea346f8e74", "score": "0.40402928", "text": "func NewBreakFaster(bot *linebot.Client, svc *WebhookService) (BreakFastBot, error) {\n\treturn &BreakFaster{\n\t\tbot: bot,\n\t\tsvc: svc,\n\t}, nil\n}", "title": "" }, { "docid": "ea2d67391e70724605f42f1186131be1", "score": "0.40402246", "text": "func (rs *routeServer) verifyFace(face0 *os.File, faceBuffer *bytes.Buffer) (*face.VerifyResult, error) {\n\n\t// A global context for use in all samples\n\tfaceContext := context.Background()\n\n\tface0Closer := ioutil.NopCloser(face0)\n\tface1Closer := ioutil.NopCloser(faceBuffer)\n\n\treturnFaceIDVerify, returnFaceLandmarksVerify, returnRecognitionModelVerify := true, false, true\n\n\t// Detect face(s) from source image 1, returns a ListDetectedFace struct\n\t// We specify detection model 2 because we are not retrieving attributes.\n\tdetectedVerifyFaces0, err := rs.faceClient.DetectWithStream(faceContext, face0Closer, &returnFaceIDVerify, &returnFaceLandmarksVerify, nil, face.Recognition03, &returnRecognitionModelVerify, face.Detection02)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(*detectedVerifyFaces0.Value) <= 0 {\n\t\treturn nil, fmt.Errorf(\"no face in image\")\n\t}\n\n\tdVFaceIds0 := *detectedVerifyFaces0.Value\n\timageSource0Id := dVFaceIds0[0].FaceID\n\n\t// Detect faces from each target image url in list. DetectWithURL returns a VerifyResult with Value of list[DetectedFaces]\n\t// Empty slice list for the target face IDs (UUIDs)\n\tvar detectedVerifyFacesIds [2]uuid.UUID\n\t// We specify detection model 2 because we are not retrieving attributes.\n\tdetectedVerifyFaces, err := rs.faceClient.DetectWithStream(faceContext, face1Closer, &returnFaceIDVerify, &returnFaceLandmarksVerify, nil, face.Recognition03, &returnRecognitionModelVerify, face.Detection02)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(*detectedVerifyFaces.Value) <= 0 {\n\t\treturn nil, fmt.Errorf(\"no face in image\")\n\t}\n\n\tdVFaces := *detectedVerifyFaces.Value\n\t// Add the returned face's face ID\n\tdetectedVerifyFacesIds[0] = *dVFaces[0].FaceID\n\n\t// Verification example for faces of the same person. The higher the confidence, the more identical the faces in the images are.\n\t// Since target faces are the same person, in this example, we can use the 1st ID in the detectedVerifyFacesIds list to compare.\n\tverifyRequestBody1 := face.VerifyFaceToFaceRequest{FaceID1: imageSource0Id, FaceID2: &detectedVerifyFacesIds[0]}\n\tverifyResultSame, err := rs.faceClient.VerifyFaceToFace(faceContext, verifyRequestBody1)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &verifyResultSame, nil\n}", "title": "" }, { "docid": "78d828792a164b4e3e94be1e6c944d48", "score": "0.40391824", "text": "func (c *Carver) ComputeSeams(p *Processor, img *image.NRGBA) (*image.NRGBA, error) {\n\tvar srcImg *image.NRGBA\n\tp.GuiDebug = image.NewNRGBA(img.Bounds())\n\n\twidth, height := img.Bounds().Dx(), img.Bounds().Dy()\n\tsobel = c.SobelDetector(img, float64(p.SobelThreshold))\n\n\tdets := []pigo.Detection{}\n\n\tif p.PigoFaceDetector != nil && p.FaceDetect && detAttempts < maxFaceDetAttempts {\n\t\tvar ratio float64\n\n\t\tif width < height {\n\t\t\tratio = float64(width) / float64(height)\n\t\t} else {\n\t\t\tratio = float64(height) / float64(width)\n\t\t}\n\t\tminSize := float64(utils.Min(width, height)) * ratio / 3\n\n\t\t// Transform the image to pixel array.\n\t\tpixels := c.rgbToGrayscale(img)\n\n\t\tcParams := pigo.CascadeParams{\n\t\t\tMinSize: int(minSize),\n\t\t\tMaxSize: utils.Min(width, height),\n\t\t\tShiftFactor: 0.1,\n\t\t\tScaleFactor: 1.1,\n\n\t\t\tImageParams: pigo.ImageParams{\n\t\t\t\tPixels: pixels,\n\t\t\t\tRows: height,\n\t\t\t\tCols: width,\n\t\t\t\tDim: width,\n\t\t\t},\n\t\t}\n\t\tif p.vRes {\n\t\t\tp.FaceAngle = 0.2\n\t\t}\n\t\t// Run the classifier over the obtained leaf nodes and return the detection results.\n\t\t// The result contains quadruplets representing the row, column, scale and detection score.\n\t\tdets = p.PigoFaceDetector.RunCascade(cParams, p.FaceAngle)\n\n\t\t// Calculate the intersection over union (IoU) of two clusters.\n\t\tdets = p.PigoFaceDetector.ClusterDetections(dets, 0.1)\n\n\t\tif len(dets) == 0 {\n\t\t\t// Retry detecting faces for a certain amount of time.\n\t\t\tif detAttempts < maxFaceDetAttempts {\n\t\t\t\tdetAttempts++\n\t\t\t}\n\t\t} else {\n\t\t\tdetAttempts = 0\n\t\t\tisFaceDetected = true\n\t\t}\n\t}\n\n\t// Traverse the pixel data of the binary file used for protecting the regions\n\t// which we do not want to be altered by the seam carver,\n\t// obtain the white patches and apply it to the sobel image.\n\tif len(p.MaskPath) > 0 && p.Mask != nil {\n\t\tfor i := 0; i < width*height; i++ {\n\t\t\tx := i % width\n\t\t\ty := (i - x) / width\n\n\t\t\tr, g, b, _ := p.Mask.At(x, y).RGBA()\n\t\t\tif r>>8 == 0xff && g>>8 == 0xff && b>>8 == 0xff {\n\t\t\t\tif isFaceDetected {\n\t\t\t\t\t// Reduce the brightness of the mask with a small factor if human faces are detected.\n\t\t\t\t\t// This way we can avoid the seam carver to remove\n\t\t\t\t\t// the pixels inside the detected human faces.\n\t\t\t\t\tsobel.Set(x, y, color.RGBA{R: 225, G: 225, B: 225, A: 255})\n\t\t\t\t} else {\n\t\t\t\t\tsobel.Set(x, y, color.White)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Traverse the pixel data of the binary file used to remove the image regions\n\t// we do not want to be retained in the final image, obtain the white patches,\n\t// but this time inverse the colors to black and merge it back to the sobel image.\n\tif len(p.RMaskPath) > 0 && p.RMask != nil {\n\t\tfor i := 0; i < width*height; i++ {\n\t\t\tx := i % width\n\t\t\ty := (i - x) / width\n\n\t\t\tr, g, b, _ := p.RMask.At(x, y).RGBA()\n\t\t\t// Replace the white pixels with black.\n\t\t\tif r>>8 == 0xff && g>>8 == 0xff && b>>8 == 0xff {\n\t\t\t\tif isFaceDetected {\n\t\t\t\t\t// Reduce the brightness of the mask with a small factor if human faces are detected.\n\t\t\t\t\t// This way we can avoid the seam carver to remove\n\t\t\t\t\t// the pixels inside the detected human faces.\n\t\t\t\t\tsobel.Set(x, y, color.RGBA{R: 25, G: 25, B: 25, A: 255})\n\t\t\t\t} else {\n\t\t\t\t\tsobel.Set(x, y, color.Black)\n\t\t\t\t}\n\t\t\t\tp.GuiDebug.Set(x, y, color.Black)\n\t\t\t} else {\n\t\t\t\tp.GuiDebug.Set(x, y, color.Transparent)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Iterate over the detected faces and fill out the rectangles with white.\n\t// We need to trick the sobel detector to consider them as important image parts.\n\tfor _, face := range dets {\n\t\tif (p.NewHeight != 0 && p.NewHeight < face.Scale) ||\n\t\t\t(p.NewWidth != 0 && p.NewWidth < face.Scale) {\n\t\t\treturn nil, fmt.Errorf(\"%s %s\",\n\t\t\t\t\"cannot resize the image to the specified dimension without face deformation.\\n\",\n\t\t\t\t\"\\tRemove the face detection option in case you still wish to resize the image.\")\n\t\t}\n\t\tif face.Q > 5.0 {\n\t\t\tscale := int(float64(face.Scale) / 1.7)\n\t\t\trect := image.Rect(\n\t\t\t\tface.Col-scale,\n\t\t\t\tface.Row-scale,\n\t\t\t\tface.Col+scale,\n\t\t\t\tface.Row+scale,\n\t\t\t)\n\t\t\tdraw.Draw(sobel, rect, &image.Uniform{color.White}, image.Point{}, draw.Src)\n\t\t\tdraw.Draw(p.GuiDebug, rect, &image.Uniform{color.White}, image.Point{}, draw.Src)\n\t\t}\n\t}\n\n\t// Increase the energy value for each of the selected seam from the seams table\n\t// in order to avoid picking the same seam over and over again.\n\t// We expand the energy level of the selected seams to have a better redistribution.\n\tif len(energySeams) > 0 {\n\t\tfor i := 0; i < len(energySeams); i++ {\n\t\t\tfor _, seam := range energySeams[i] {\n\t\t\t\tsobel.Set(seam.X, seam.Y, &image.Uniform{color.White})\n\t\t\t}\n\t\t}\n\t}\n\n\tif p.BlurRadius > 0 {\n\t\tsrcImg = c.StackBlur(sobel, uint32(p.BlurRadius))\n\t} else {\n\t\tsrcImg = sobel\n\t}\n\n\tfor x := 0; x < c.Width; x++ {\n\t\tfor y := 0; y < c.Height; y++ {\n\t\t\tr, _, _, a := srcImg.At(x, y).RGBA()\n\t\t\tc.set(x, y, float64(r)/float64(a))\n\t\t}\n\t}\n\n\tvar left, middle, right float64\n\n\t// Traverse the image from top to bottom and compute the minimum energy level.\n\t// For each pixel in a row we compute the energy of the current pixel\n\t// plus the energy of one of the three possible pixels above it.\n\tfor y := 1; y < c.Height; y++ {\n\t\tfor x := 1; x < c.Width-1; x++ {\n\t\t\tleft = c.get(x-1, y-1)\n\t\t\tmiddle = c.get(x, y-1)\n\t\t\tright = c.get(x+1, y-1)\n\t\t\tmin := math.Min(math.Min(left, middle), right)\n\t\t\t// Set the minimum energy level.\n\t\t\tc.set(x, y, c.get(x, y)+min)\n\t\t}\n\t\t// Special cases: pixels are far left or far right\n\t\tleft := c.get(0, y) + math.Min(c.get(0, y-1), c.get(1, y-1))\n\t\tc.set(0, y, left)\n\t\tright := c.get(0, y) + math.Min(c.get(c.Width-1, y-1), c.get(c.Width-2, y-1))\n\t\tc.set(c.Width-1, y, right)\n\t}\n\treturn srcImg, nil\n}", "title": "" }, { "docid": "9f0c375ad4c09df7ec995f1805c8b49b", "score": "0.40375912", "text": "func (h *HoughSegmentDetector) Detect(img GpuMat, dst *GpuMat) {\n\tC.HoughSegmentDetector_Detect(C.HoughSegmentDetector(h.p), img.p, dst.p, nil)\n\treturn\n}", "title": "" }, { "docid": "b39423deff12c7cfde483ea2dc84431d", "score": "0.40273553", "text": "func (font BitmapFont) Face(width, height int) (face Face, ok bool) {\n\tfor _, bmp := range font {\n\t\tif bmp.Size.X == width && bmp.Size.Y == height {\n\t\t\treturn bmp, true\n\t\t}\n\t}\n\treturn nil, false\n}", "title": "" }, { "docid": "43a84239bddde4f3de5b658bd8287c02", "score": "0.4017654", "text": "func (b *Backoffer) Backoff(cfg *tikv.BackoffConfig, err error) error {\n\te := b.b.Backoff(cfg, err)\n\treturn derr.ToTiDBErr(e)\n}", "title": "" }, { "docid": "e375395091f2e05d983444ff9f472d22", "score": "0.40142944", "text": "func SetNoBlink() {\n\tDefaultTty.SetNoBlink()\n}", "title": "" }, { "docid": "9f1bc1f8218c47261ef938dd164900ad", "score": "0.40131152", "text": "func EnableHostFlapDetection(\n\thost_name string,\n) *livestatus.Command {\n\treturn livestatus.NewCommand(\n\t\t\"ENABLE_HOST_FLAP_DETECTION\",\n\t\tstringifyArg(\"host_name\", \"string\", host_name),\n\t)\n}", "title": "" } ]
e019406b875394afe14e413422424764
KeepaliveInterval returns from NetworkInstance_Protocol_Bgp_PeerGroup_TimersAny the path struct for its child "keepaliveinterval".
[ { "docid": "07b525db5ed70214094c2a8e43224c96", "score": "0.7969292", "text": "func (n *NetworkInstance_Protocol_Bgp_PeerGroup_TimersAny) KeepaliveInterval() *NetworkInstance_Protocol_Bgp_PeerGroup_Timers_KeepaliveIntervalAny {\n\treturn &NetworkInstance_Protocol_Bgp_PeerGroup_Timers_KeepaliveIntervalAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"keepalive-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" } ]
[ { "docid": "0c5d3540967105740f79702cf8340590", "score": "0.7935379", "text": "func (n *NetworkInstance_Protocol_Bgp_PeerGroup_Timers) KeepaliveInterval() *NetworkInstance_Protocol_Bgp_PeerGroup_Timers_KeepaliveInterval {\n\treturn &NetworkInstance_Protocol_Bgp_PeerGroup_Timers_KeepaliveInterval{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"keepalive-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "0c5d3540967105740f79702cf8340590", "score": "0.793465", "text": "func (n *NetworkInstance_Protocol_Bgp_PeerGroup_Timers) KeepaliveInterval() *NetworkInstance_Protocol_Bgp_PeerGroup_Timers_KeepaliveInterval {\n\treturn &NetworkInstance_Protocol_Bgp_PeerGroup_Timers_KeepaliveInterval{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"keepalive-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "5bdb951aff0f26747857669d04330e02", "score": "0.78435165", "text": "func (n *Bgp_PeerGroup_TimersAny) KeepaliveInterval() *Bgp_PeerGroup_Timers_KeepaliveIntervalAny {\n\treturn &Bgp_PeerGroup_Timers_KeepaliveIntervalAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"keepalive-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "d98af9d9dd1414189440d21b379f5a8f", "score": "0.78248185", "text": "func (n *Bgp_PeerGroup_Timers) KeepaliveInterval() *Bgp_PeerGroup_Timers_KeepaliveInterval {\n\treturn &Bgp_PeerGroup_Timers_KeepaliveInterval{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"keepalive-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "d98af9d9dd1414189440d21b379f5a8f", "score": "0.782412", "text": "func (n *Bgp_PeerGroup_Timers) KeepaliveInterval() *Bgp_PeerGroup_Timers_KeepaliveInterval {\n\treturn &Bgp_PeerGroup_Timers_KeepaliveInterval{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"keepalive-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "f1d7721877e51af6a3611e8581f995f2", "score": "0.77065533", "text": "func (n *NetworkInstance_Protocol_Bgp_Neighbor_TimersAny) KeepaliveInterval() *NetworkInstance_Protocol_Bgp_Neighbor_Timers_KeepaliveIntervalAny {\n\treturn &NetworkInstance_Protocol_Bgp_Neighbor_Timers_KeepaliveIntervalAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"keepalive-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "6e35b587e08f9ca3fdcacee5c3a2ae86", "score": "0.761122", "text": "func (n *NetworkInstance_Protocol_Bgp_Neighbor_Timers) KeepaliveInterval() *NetworkInstance_Protocol_Bgp_Neighbor_Timers_KeepaliveInterval {\n\treturn &NetworkInstance_Protocol_Bgp_Neighbor_Timers_KeepaliveInterval{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"keepalive-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "6e35b587e08f9ca3fdcacee5c3a2ae86", "score": "0.7610447", "text": "func (n *NetworkInstance_Protocol_Bgp_Neighbor_Timers) KeepaliveInterval() *NetworkInstance_Protocol_Bgp_Neighbor_Timers_KeepaliveInterval {\n\treturn &NetworkInstance_Protocol_Bgp_Neighbor_Timers_KeepaliveInterval{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"keepalive-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "5d2f8b831153486689bd543bb874d4bd", "score": "0.760679", "text": "func (n *Bgp_Neighbor_TimersAny) KeepaliveInterval() *Bgp_Neighbor_Timers_KeepaliveIntervalAny {\n\treturn &Bgp_Neighbor_Timers_KeepaliveIntervalAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"keepalive-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "def3b94b927372cf4cc0b708a9a537d1", "score": "0.7529072", "text": "func (n *Bgp_Neighbor_Timers) KeepaliveInterval() *Bgp_Neighbor_Timers_KeepaliveInterval {\n\treturn &Bgp_Neighbor_Timers_KeepaliveInterval{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"keepalive-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "def3b94b927372cf4cc0b708a9a537d1", "score": "0.75289077", "text": "func (n *Bgp_Neighbor_Timers) KeepaliveInterval() *Bgp_Neighbor_Timers_KeepaliveInterval {\n\treturn &Bgp_Neighbor_Timers_KeepaliveInterval{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"keepalive-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "c1600d1215a9fbf79e0ec88a272d8030", "score": "0.7372943", "text": "func (o RouterBgpOutput) KeepaliveInterval() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v RouterBgp) *int { return v.KeepaliveInterval }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "9c0769271cc1016d2ee05692d480fc00", "score": "0.7260551", "text": "func (o RouterBgpResponseOutput) KeepaliveInterval() pulumi.IntOutput {\n\treturn o.ApplyT(func(v RouterBgpResponse) int { return v.KeepaliveInterval }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "42ac7d940e47971588363144463fad8f", "score": "0.7249097", "text": "func (o RouterBgpPtrOutput) KeepaliveInterval() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *RouterBgp) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.KeepaliveInterval\n\t}).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "5c6a5949d05c04f9db0fb24179f752c5", "score": "0.64450866", "text": "func (o ProfileTcpOutput) KeepaliveInterval() pulumi.IntOutput {\n\treturn o.ApplyT(func(v *ProfileTcp) pulumi.IntOutput { return v.KeepaliveInterval }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "2cb4fb7777feed231d2013f1c99cecf9", "score": "0.6067482", "text": "func (base BaseForwarder) KeepAliveInterval() int {\n\treturn base.keepAliveInterval\n}", "title": "" }, { "docid": "8eb92b02867caeff17547ea9b254f026", "score": "0.576329", "text": "func (base *BaseForwarder) SetKeepAliveInterval(value int) {\n\tbase.keepAliveInterval = value\n}", "title": "" }, { "docid": "2ccd96b15e50810ab76c17d1a774b1be", "score": "0.53550124", "text": "func (m *Message) GetInterval(key string) (*Interval, bool) {\n\tfor _, attr := range m.Attributes {\n\t\tif attr.StringKey(m) == key {\n\t\t\tif attr.Tval == nil {\n\t\t\t\treturn nil, false\n\t\t\t}\n\n\t\t\treturn attr.Tval, true\n\t\t}\n\t}\n\n\treturn nil, false\n}", "title": "" }, { "docid": "bbd68f22862ef2fdb98f7818afe5b473", "score": "0.5299774", "text": "func (n *Interface_RoutedVlan_Ipv6_RouterAdvertisementAny) Interval() *Interface_RoutedVlan_Ipv6_RouterAdvertisement_IntervalAny {\n\treturn &Interface_RoutedVlan_Ipv6_RouterAdvertisement_IntervalAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "c7a6ff7b9691b490dd3bd727846b9187", "score": "0.52781457", "text": "func (n *Interface_Subinterface_Ipv6_RouterAdvertisementAny) Interval() *Interface_Subinterface_Ipv6_RouterAdvertisement_IntervalAny {\n\treturn &Interface_Subinterface_Ipv6_RouterAdvertisement_IntervalAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "32dbabfe8fe808a1d9242519e7799065", "score": "0.5184402", "text": "func (n *NetworkInstance_Protocol_Isis_Interface_Level_TimersAny) HelloInterval() *NetworkInstance_Protocol_Isis_Interface_Level_Timers_HelloIntervalAny {\n\treturn &NetworkInstance_Protocol_Isis_Interface_Level_Timers_HelloIntervalAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"hello-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "ba29e476924a540502ae7e8070a1e503", "score": "0.517239", "text": "func (x *FeaturestoreMonitoringConfig_SnapshotAnalysis) GetMonitoringInterval() *durationpb.Duration {\n\tif x != nil {\n\t\treturn x.MonitoringInterval\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bd3f8cdcfdf0b4347db4108c5e7ec701", "score": "0.5158675", "text": "func (n *Interface_RoutedVlan_Ipv6_RouterAdvertisement) Interval() *Interface_RoutedVlan_Ipv6_RouterAdvertisement_Interval {\n\treturn &Interface_RoutedVlan_Ipv6_RouterAdvertisement_Interval{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "bd3f8cdcfdf0b4347db4108c5e7ec701", "score": "0.5157912", "text": "func (n *Interface_RoutedVlan_Ipv6_RouterAdvertisement) Interval() *Interface_RoutedVlan_Ipv6_RouterAdvertisement_Interval {\n\treturn &Interface_RoutedVlan_Ipv6_RouterAdvertisement_Interval{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "9695a8e7d7876a78d927a019b6f52342", "score": "0.5147825", "text": "func (w *WebsocketClient) SetKeepAliveInterval(time time.Duration) {\n\tw.keepAliveInterval = time\n}", "title": "" }, { "docid": "4dcdf3e3c5f88a2ff1ed395c73f47479", "score": "0.51384664", "text": "func (n *Interface_Subinterface_Ipv6_RouterAdvertisement) Interval() *Interface_Subinterface_Ipv6_RouterAdvertisement_Interval {\n\treturn &Interface_Subinterface_Ipv6_RouterAdvertisement_Interval{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "4dcdf3e3c5f88a2ff1ed395c73f47479", "score": "0.5137373", "text": "func (n *Interface_Subinterface_Ipv6_RouterAdvertisement) Interval() *Interface_Subinterface_Ipv6_RouterAdvertisement_Interval {\n\treturn &Interface_Subinterface_Ipv6_RouterAdvertisement_Interval{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "5eaa22e3a00456927e8a419bff77e2b0", "score": "0.5103529", "text": "func (evel *Evel) GetHeartbeatInterval() time.Duration {\n\tevel.mutex.RLock()\n\tdefer evel.mutex.RUnlock()\n\treturn evel.heartbeatInterval\n}", "title": "" }, { "docid": "232952c7a19337cb6eec9bfa935ff83a", "score": "0.5056858", "text": "func (n *Interface_RoutedVlan_Ipv4_Address_VrrpGroupAny) AdvertisementInterval() *Interface_RoutedVlan_Ipv4_Address_VrrpGroup_AdvertisementIntervalAny {\n\treturn &Interface_RoutedVlan_Ipv4_Address_VrrpGroup_AdvertisementIntervalAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"advertisement-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "cdddc876715846d2eb2e5b74a6b6563d", "score": "0.5055751", "text": "func (n *Interface_RoutedVlan_Ipv6_Address_VrrpGroupAny) AdvertisementInterval() *Interface_RoutedVlan_Ipv6_Address_VrrpGroup_AdvertisementIntervalAny {\n\treturn &Interface_RoutedVlan_Ipv6_Address_VrrpGroup_AdvertisementIntervalAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"advertisement-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "85d7d7b1a883911467233476f294fc79", "score": "0.50401497", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Interface_TimersAny) HelloInterval() *NetworkInstance_Protocol_Ospfv2_Area_Interface_Timers_HelloIntervalAny {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Interface_Timers_HelloIntervalAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"hello-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "85d524644bd33a075f31601d4eb14252", "score": "0.5022563", "text": "func (n *NetworkInstance_Protocol_Isis_Interface_Level_Timers) HelloInterval() *NetworkInstance_Protocol_Isis_Interface_Level_Timers_HelloInterval {\n\treturn &NetworkInstance_Protocol_Isis_Interface_Level_Timers_HelloInterval{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"hello-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "85d524644bd33a075f31601d4eb14252", "score": "0.50208247", "text": "func (n *NetworkInstance_Protocol_Isis_Interface_Level_Timers) HelloInterval() *NetworkInstance_Protocol_Isis_Interface_Level_Timers_HelloInterval {\n\treturn &NetworkInstance_Protocol_Isis_Interface_Level_Timers_HelloInterval{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"hello-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "6dbedc742587eb87471fe35fdf1478fc", "score": "0.4978075", "text": "func (n *NetworkInstance_Protocol_Isis_Global_TimersAny) LspLifetimeInterval() *NetworkInstance_Protocol_Isis_Global_Timers_LspLifetimeIntervalAny {\n\treturn &NetworkInstance_Protocol_Isis_Global_Timers_LspLifetimeIntervalAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"lsp-lifetime-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "8f2168b63ebe3cdb00d549f5c25f5b7a", "score": "0.49678817", "text": "func (n *Interface_Subinterface_Ipv4_Address_VrrpGroupAny) AdvertisementInterval() *Interface_Subinterface_Ipv4_Address_VrrpGroup_AdvertisementIntervalAny {\n\treturn &Interface_Subinterface_Ipv4_Address_VrrpGroup_AdvertisementIntervalAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"advertisement-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "9c9161c7074fa49a0efdd3fc8bcffcc6", "score": "0.49674484", "text": "func (amt *AbstractMessageTask) GetInterval() int64 {\n\tvar latency int64 = GetLatency(amt.from.GetRegion(), amt.to.GetRegion())\n\t// Add 10 milliseconds here, why? maybe some handle time\n\t//TODO\n\treturn latency + 10\n}", "title": "" }, { "docid": "bc328eb5136e4f3eb5c5664e7a7da29e", "score": "0.49606314", "text": "func (n *Interface_Subinterface_Ipv6_Address_VrrpGroupAny) AdvertisementInterval() *Interface_Subinterface_Ipv6_Address_VrrpGroup_AdvertisementIntervalAny {\n\treturn &Interface_Subinterface_Ipv6_Address_VrrpGroup_AdvertisementIntervalAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"advertisement-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "44dab8620941890fb6d5ce638606e4b5", "score": "0.49535692", "text": "func KeepAlive(sec time.Duration) func(*Config) {\n\treturn func(conf *Config) {\n\t\tconf.KeepAlive.Seconds = int(sec)\n\t}\n}", "title": "" }, { "docid": "276939e0de25927c8649d72d22586015", "score": "0.49310723", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Interface_Timers) HelloInterval() *NetworkInstance_Protocol_Ospfv2_Area_Interface_Timers_HelloInterval {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Interface_Timers_HelloInterval{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"hello-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "276939e0de25927c8649d72d22586015", "score": "0.49310723", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Interface_Timers) HelloInterval() *NetworkInstance_Protocol_Ospfv2_Area_Interface_Timers_HelloInterval {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Interface_Timers_HelloInterval{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"hello-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "559715a103edc8ac324a739ce3a911b6", "score": "0.49260417", "text": "func (o ClusterRkeConfigServicesEtcdBackupConfigOutput) IntervalHours() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v ClusterRkeConfigServicesEtcdBackupConfig) *int { return v.IntervalHours }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "a80a1ad8b02e9465e12725db1813716e", "score": "0.49226084", "text": "func (ip *IpModule) GetInterval() time.Duration {\n\treturn ip.Interval\n}", "title": "" }, { "docid": "18fca8134efa8b99ad5515df96548576", "score": "0.49036717", "text": "func (n *Component_Transceiver_PostFecBerAny) Interval() *Component_Transceiver_PostFecBer_IntervalAny {\n\treturn &Component_Transceiver_PostFecBer_IntervalAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "61be110253f39152db663abeeaf19c87", "score": "0.4899772", "text": "func (n *NetworkInstance_Mpls_SignalingProtocols_Ldp_TargetedAny) HelloInterval() *NetworkInstance_Mpls_SignalingProtocols_Ldp_Targeted_HelloIntervalAny {\n\treturn &NetworkInstance_Mpls_SignalingProtocols_Ldp_Targeted_HelloIntervalAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"hello-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "7899a2d9f3b317ff21d09b41518d98e8", "score": "0.4879867", "text": "func (o *CdnPrefixReadDetailed) GetKeepaliveRequests() int32 {\n\tif o == nil || o.KeepaliveRequests == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.KeepaliveRequests\n}", "title": "" }, { "docid": "7284c9b293cf8e8351da1464f196dd05", "score": "0.4874115", "text": "func WithHeartbeatInterval(d time.Duration) Option {\n\treturn func(_ *cluster.Options) {\n\t\tenv.Heartbeat = d\n\t}\n}", "title": "" }, { "docid": "ecc446c24e4c8c3f1c6f290466826b1a", "score": "0.48673913", "text": "func (r *Request) KeepAliveTimeout() time.Duration {\n\treturn r.keepAliveTimeout\n}", "title": "" }, { "docid": "d97a42f78d54cf6407074074bc253a78", "score": "0.48642594", "text": "func (c *Connector) PingInterval() time.Duration {\n\tc.mu.RLock()\n\tdefer c.mu.RUnlock()\n\treturn c.pingInterval\n}", "title": "" }, { "docid": "f5aef8d0ff01698e8101ff4102674a6f", "score": "0.4860274", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Interface_TimersAny) DeadInterval() *NetworkInstance_Protocol_Ospfv2_Area_Interface_Timers_DeadIntervalAny {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Interface_Timers_DeadIntervalAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"dead-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "57ea2eb02cf3a8a2cfb55ac4183b3877", "score": "0.48539934", "text": "func (o LookupClusterAlertGroupResultOutput) GroupIntervalSeconds() pulumi.IntOutput {\n\treturn o.ApplyT(func(v LookupClusterAlertGroupResult) int { return v.GroupIntervalSeconds }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "f4986aeef8e1b7a6219266d3732e9b67", "score": "0.48518965", "text": "func (n *Interface_RoutedVlan_Ipv6_Address_VrrpGroup) AdvertisementInterval() *Interface_RoutedVlan_Ipv6_Address_VrrpGroup_AdvertisementInterval {\n\treturn &Interface_RoutedVlan_Ipv6_Address_VrrpGroup_AdvertisementInterval{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"advertisement-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "2c73149679c400b678dbb74058a48e23", "score": "0.48506916", "text": "func (n *NetworkInstance_Mpls_SignalingProtocols_Ldp_Targeted_AddressFamily_TargetAny) HelloInterval() *NetworkInstance_Mpls_SignalingProtocols_Ldp_Targeted_AddressFamily_Target_HelloIntervalAny {\n\treturn &NetworkInstance_Mpls_SignalingProtocols_Ldp_Targeted_AddressFamily_Target_HelloIntervalAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"hello-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "f4986aeef8e1b7a6219266d3732e9b67", "score": "0.48498178", "text": "func (n *Interface_RoutedVlan_Ipv6_Address_VrrpGroup) AdvertisementInterval() *Interface_RoutedVlan_Ipv6_Address_VrrpGroup_AdvertisementInterval {\n\treturn &Interface_RoutedVlan_Ipv6_Address_VrrpGroup_AdvertisementInterval{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"advertisement-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "fb766e28099ffb598207aa52effbac66", "score": "0.48320636", "text": "func (n *Interface_RoutedVlan_Ipv4_Address_VrrpGroup) AdvertisementInterval() *Interface_RoutedVlan_Ipv4_Address_VrrpGroup_AdvertisementInterval {\n\treturn &Interface_RoutedVlan_Ipv4_Address_VrrpGroup_AdvertisementInterval{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"advertisement-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "96b3344f222a64937ca218e350e07fdb", "score": "0.483121", "text": "func (o EtcdBackupBackupConfigOutput) IntervalHours() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v EtcdBackupBackupConfig) *int { return v.IntervalHours }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "fb766e28099ffb598207aa52effbac66", "score": "0.48289508", "text": "func (n *Interface_RoutedVlan_Ipv4_Address_VrrpGroup) AdvertisementInterval() *Interface_RoutedVlan_Ipv4_Address_VrrpGroup_AdvertisementInterval {\n\treturn &Interface_RoutedVlan_Ipv4_Address_VrrpGroup_AdvertisementInterval{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"advertisement-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "e87364d9c7efbf0e5e655ee4f959562b", "score": "0.48168495", "text": "func HeartbeatInterval(d time.Duration) Option {\n\treturn func(o *Options) {\n\t\to.HeartbeatInterval = d\n\t}\n}", "title": "" }, { "docid": "1fe2c1adfe43155936807c5f66ed1052", "score": "0.47984156", "text": "func (o ClusterRkeConfigServicesEtcdBackupConfigPtrOutput) IntervalHours() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *ClusterRkeConfigServicesEtcdBackupConfig) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.IntervalHours\n\t}).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "a10da33aeb98208c6003c4c98b4844c0", "score": "0.4794894", "text": "func (n *Interface_Subinterface_Ipv6_Address_VrrpGroup) AdvertisementInterval() *Interface_Subinterface_Ipv6_Address_VrrpGroup_AdvertisementInterval {\n\treturn &Interface_Subinterface_Ipv6_Address_VrrpGroup_AdvertisementInterval{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"advertisement-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "a10da33aeb98208c6003c4c98b4844c0", "score": "0.47933158", "text": "func (n *Interface_Subinterface_Ipv6_Address_VrrpGroup) AdvertisementInterval() *Interface_Subinterface_Ipv6_Address_VrrpGroup_AdvertisementInterval {\n\treturn &Interface_Subinterface_Ipv6_Address_VrrpGroup_AdvertisementInterval{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"advertisement-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "377e4952b10aa43b5aa038299cae60b0", "score": "0.47886723", "text": "func (r *Redis) GetInterval() time.Duration {\n\treturn r.interval // this is racey, but I am lazy...\n}", "title": "" }, { "docid": "a902851661b08ed30789790626976d34", "score": "0.47824693", "text": "func (n *Interface_Subinterface_Ipv4_Address_VrrpGroup) AdvertisementInterval() *Interface_Subinterface_Ipv4_Address_VrrpGroup_AdvertisementInterval {\n\treturn &Interface_Subinterface_Ipv4_Address_VrrpGroup_AdvertisementInterval{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"advertisement-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "a902851661b08ed30789790626976d34", "score": "0.47784513", "text": "func (n *Interface_Subinterface_Ipv4_Address_VrrpGroup) AdvertisementInterval() *Interface_Subinterface_Ipv4_Address_VrrpGroup_AdvertisementInterval {\n\treturn &Interface_Subinterface_Ipv4_Address_VrrpGroup_AdvertisementInterval{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"advertisement-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "35ef6817b6a052e2ae58e71f40eea115", "score": "0.4776549", "text": "func (n *Component_Transceiver_PreFecBerAny) Interval() *Component_Transceiver_PreFecBer_IntervalAny {\n\treturn &Component_Transceiver_PreFecBer_IntervalAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "b49fce00cb3d3e5bc4ec8c3b83bf7e32", "score": "0.4773335", "text": "func (n *NetworkInstance_Mpls_SignalingProtocols_Ldp_Targeted) HelloInterval() *NetworkInstance_Mpls_SignalingProtocols_Ldp_Targeted_HelloInterval {\n\treturn &NetworkInstance_Mpls_SignalingProtocols_Ldp_Targeted_HelloInterval{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"hello-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "b49fce00cb3d3e5bc4ec8c3b83bf7e32", "score": "0.47731754", "text": "func (n *NetworkInstance_Mpls_SignalingProtocols_Ldp_Targeted) HelloInterval() *NetworkInstance_Mpls_SignalingProtocols_Ldp_Targeted_HelloInterval {\n\treturn &NetworkInstance_Mpls_SignalingProtocols_Ldp_Targeted_HelloInterval{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"hello-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "cfae08a22b0f9f2c9c391eba4178bfe6", "score": "0.47659218", "text": "func (n *NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Global_CountersAny) PathTimeouts() *NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Global_Counters_PathTimeoutsAny {\n\treturn &NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Global_Counters_PathTimeoutsAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"path-timeouts\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "33255848d1ff78c75b9a3bfa613227ba", "score": "0.47550386", "text": "func (self *TraitSocket) GetKeepalive() (return__ bool) {\n\tvar __cgo__return__ C.gboolean\n\t__cgo__return__ = C.g_socket_get_keepalive(self.CPointer)\n\treturn__ = __cgo__return__ == C.gboolean(1)\n\treturn\n}", "title": "" }, { "docid": "7877b8cd9e61076f6dd8cada8adae6db", "score": "0.4753057", "text": "func (r *ClusterInstance) MonitoringInterval() pulumi.IntOutput {\n\treturn (pulumi.IntOutput)(r.s.State[\"monitoringInterval\"])\n}", "title": "" }, { "docid": "18c47f70e5b713d68723b6d307bd4d73", "score": "0.47495684", "text": "func (_KeeperConsumer *KeeperConsumerSession) Interval() (*big.Int, error) {\n\treturn _KeeperConsumer.Contract.Interval(&_KeeperConsumer.CallOpts)\n}", "title": "" }, { "docid": "e5dfdd137eaa389996f98eb2db66510e", "score": "0.47478652", "text": "func (n *NetworkInstance_Mpls_SignalingProtocols_Ldp_InterfaceAttributesAny) HelloInterval() *NetworkInstance_Mpls_SignalingProtocols_Ldp_InterfaceAttributes_HelloIntervalAny {\n\treturn &NetworkInstance_Mpls_SignalingProtocols_Ldp_InterfaceAttributes_HelloIntervalAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"hello-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "eed907b9e587a1f9010c2cc3c8aad987", "score": "0.47477663", "text": "func (n *NetworkInstance_Protocol_Pim_InterfaceAny) HelloInterval() *NetworkInstance_Protocol_Pim_Interface_HelloIntervalAny {\n\treturn &NetworkInstance_Protocol_Pim_Interface_HelloIntervalAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"hello-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "c43f3ce7384b0f7b6e923b3da572eb69", "score": "0.47472203", "text": "func (n *NetworkInstance_Mpls_SignalingProtocols_Ldp_Targeted_AddressFamily_Target) HelloInterval() *NetworkInstance_Mpls_SignalingProtocols_Ldp_Targeted_AddressFamily_Target_HelloInterval {\n\treturn &NetworkInstance_Mpls_SignalingProtocols_Ldp_Targeted_AddressFamily_Target_HelloInterval{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"hello-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "c43f3ce7384b0f7b6e923b3da572eb69", "score": "0.47463676", "text": "func (n *NetworkInstance_Mpls_SignalingProtocols_Ldp_Targeted_AddressFamily_Target) HelloInterval() *NetworkInstance_Mpls_SignalingProtocols_Ldp_Targeted_AddressFamily_Target_HelloInterval {\n\treturn &NetworkInstance_Mpls_SignalingProtocols_Ldp_Targeted_AddressFamily_Target_HelloInterval{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"hello-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "d5182b504a7d05937d4acee36b466036", "score": "0.47437215", "text": "func (o TransformOutputCustomPresetCodecJpgImagePtrOutput) KeyFrameInterval() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *TransformOutputCustomPresetCodecJpgImage) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.KeyFrameInterval\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "eb631d509531ca65a0e374b62f33cfab", "score": "0.4729328", "text": "func (o TransformOutputCustomPresetCodecPngImagePtrOutput) KeyFrameInterval() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *TransformOutputCustomPresetCodecPngImage) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.KeyFrameInterval\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "e6a20f85e795e43d37cba6d4a2bb7edc", "score": "0.47186702", "text": "func (_RootChain *RootChainCallerSession) ChildBlockInterval() (*big.Int, error) {\n\treturn _RootChain.Contract.ChildBlockInterval(&_RootChain.CallOpts)\n}", "title": "" }, { "docid": "4ea1e08957cf2bf80477060a84b22512", "score": "0.47152987", "text": "func (n *Component_Transceiver_PostFecBer) Interval() *Component_Transceiver_PostFecBer_Interval {\n\treturn &Component_Transceiver_PostFecBer_Interval{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "4ea1e08957cf2bf80477060a84b22512", "score": "0.4715207", "text": "func (n *Component_Transceiver_PostFecBer) Interval() *Component_Transceiver_PostFecBer_Interval {\n\treturn &Component_Transceiver_PostFecBer_Interval{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "43e768004fd40b3c56a9e694b323994e", "score": "0.47120088", "text": "func (_KeeperConsumer *KeeperConsumerCallerSession) Interval() (*big.Int, error) {\n\treturn _KeeperConsumer.Contract.Interval(&_KeeperConsumer.CallOpts)\n}", "title": "" }, { "docid": "c0d2542a70cf451a16e31a02c0100430", "score": "0.47026497", "text": "func (n *NetworkInstance_Protocol_Ospfv2_Area_Interface_TimersAny) RetransmissionInterval() *NetworkInstance_Protocol_Ospfv2_Area_Interface_Timers_RetransmissionIntervalAny {\n\treturn &NetworkInstance_Protocol_Ospfv2_Area_Interface_Timers_RetransmissionIntervalAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"retransmission-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "820c1663a0ffb6575fc19537a48bf778", "score": "0.4687704", "text": "func (s *KCPConn) SetKeepAlive(interval int) {\n atomic.StoreInt32(&s.keepAliveInterval, int32(interval))\n}", "title": "" }, { "docid": "555553a9a3b0285d2674cf1f8f36555b", "score": "0.46707094", "text": "func (n *NetworkInstance_Protocol_Bgp_PeerGroupAny) Timers() *NetworkInstance_Protocol_Bgp_PeerGroup_TimersAny {\n\treturn &NetworkInstance_Protocol_Bgp_PeerGroup_TimersAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"timers\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "1c9bd00aa32f1d52d175e3866535fd9e", "score": "0.4666961", "text": "func (o EtcdBackupBackupConfigPtrOutput) IntervalHours() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *EtcdBackupBackupConfig) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.IntervalHours\n\t}).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "71157d41b56b90469cf5ba316b9b4bd7", "score": "0.46617186", "text": "func (_RootChain *RootChainSession) ChildBlockInterval() (*big.Int, error) {\n\treturn _RootChain.Contract.ChildBlockInterval(&_RootChain.CallOpts)\n}", "title": "" }, { "docid": "cf4c87b6a452174e9f4b0a2eebeb248d", "score": "0.46610957", "text": "func (n *System_Cpu_WaitAny) Interval() *System_Cpu_Wait_IntervalAny {\n\treturn &System_Cpu_Wait_IntervalAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "da7c1d33b0bff99fadef05810eab186e", "score": "0.46601906", "text": "func (n *NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Global_Counters) PathTimeouts() *NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Global_Counters_PathTimeouts {\n\treturn &NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Global_Counters_PathTimeouts{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"path-timeouts\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "68649cd0308d2c78bf3a44edb8d90fca", "score": "0.46597013", "text": "func (o *PaymentConsentPeriodicAmount) GetIntervalOk() (*PaymentConsentPeriodicInterval, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Interval, true\n}", "title": "" }, { "docid": "da7c1d33b0bff99fadef05810eab186e", "score": "0.46585906", "text": "func (n *NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Global_Counters) PathTimeouts() *NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Global_Counters_PathTimeouts {\n\treturn &NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Global_Counters_PathTimeouts{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"path-timeouts\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "d65da1bc1e16fbc0f22102c6c8a08af9", "score": "0.4657822", "text": "func (n *NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Global_HellosAny) HelloInterval() *NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Global_Hellos_HelloIntervalAny {\n\treturn &NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Global_Hellos_HelloIntervalAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"hello-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "af2cc783895b85e4a716cf454e3e6386", "score": "0.46447703", "text": "func (n *System_Cpu_IdleAny) Interval() *System_Cpu_Idle_IntervalAny {\n\treturn &System_Cpu_Idle_IntervalAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "66a4a52e38284b04fcc906c16f18ff65", "score": "0.46432343", "text": "func (n *NetworkInstance_Protocol_Isis_Global_TimersAny) LspRefreshInterval() *NetworkInstance_Protocol_Isis_Global_Timers_LspRefreshIntervalAny {\n\treturn &NetworkInstance_Protocol_Isis_Global_Timers_LspRefreshIntervalAny{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"lsp-refresh-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "ca5f0cc8a7aac2155f3629e6f3beeda0", "score": "0.46361643", "text": "func (o LiveEventEncodingPtrOutput) KeyFrameInterval() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *LiveEventEncoding) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.KeyFrameInterval\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "a67d13e7085f0d6859c975927a8dc283", "score": "0.4618256", "text": "func (o *CreateSubscriptionBody) GetInterval() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Interval\n}", "title": "" }, { "docid": "9682351935aaf28592984894014f8bad", "score": "0.46172324", "text": "func (n *NetworkInstance_Mpls_SignalingProtocols_Ldp_InterfaceAttributes) HelloInterval() *NetworkInstance_Mpls_SignalingProtocols_Ldp_InterfaceAttributes_HelloInterval {\n\treturn &NetworkInstance_Mpls_SignalingProtocols_Ldp_InterfaceAttributes_HelloInterval{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"hello-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "9682351935aaf28592984894014f8bad", "score": "0.46160814", "text": "func (n *NetworkInstance_Mpls_SignalingProtocols_Ldp_InterfaceAttributes) HelloInterval() *NetworkInstance_Mpls_SignalingProtocols_Ldp_InterfaceAttributes_HelloInterval {\n\treturn &NetworkInstance_Mpls_SignalingProtocols_Ldp_InterfaceAttributes_HelloInterval{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"hello-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "e5d46eaa6834197081f99ccf6263bcb9", "score": "0.46143556", "text": "func (o ClusterRkeConfigNetworkAciNetworkProviderOutput) ServiceMonitorInterval() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ClusterRkeConfigNetworkAciNetworkProvider) *string { return v.ServiceMonitorInterval }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "8276d41b0829c08a7ec7369966973573", "score": "0.46100834", "text": "func (n *NetworkInstance_Protocol_Pim_Interface) HelloInterval() *NetworkInstance_Protocol_Pim_Interface_HelloInterval {\n\treturn &NetworkInstance_Protocol_Pim_Interface_HelloInterval{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"hello-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "8276d41b0829c08a7ec7369966973573", "score": "0.46097186", "text": "func (n *NetworkInstance_Protocol_Pim_Interface) HelloInterval() *NetworkInstance_Protocol_Pim_Interface_HelloInterval {\n\treturn &NetworkInstance_Protocol_Pim_Interface_HelloInterval{\n\t\tNodePath: ygot.NewNodePath(\n\t\t\t[]string{\"state\", \"hello-interval\"},\n\t\t\tmap[string]interface{}{},\n\t\t\tn,\n\t\t),\n\t}\n}", "title": "" }, { "docid": "56a045135c5aa92eeccb115951404e08", "score": "0.45960453", "text": "func (s *HealthCheckConfiguration) SetInterval(v int64) *HealthCheckConfiguration {\n\ts.Interval = &v\n\treturn s\n}", "title": "" } ]
ccd4c7849c180c23ed1f56f36f261fdc
Print prints the output
[ { "docid": "94fcb75b62b88e96793b8e2dd407deeb", "score": "0.6350258", "text": "func (rl *readline) Print(out string) {\n\t_, _ = os.Stdout.WriteString(out + \"\\n\")\n}", "title": "" } ]
[ { "docid": "8ec5a54f85b1d41eeb2c315dd9570341", "score": "0.71195", "text": "func (ir *InterpretResults) Print() {\n\tfor _, result := range ir.Results {\n\t\tfmt.Println(result)\n\t}\n\n\t// If there were results, skip a line at the end for readability\n\tif len(ir.Results) > 0 {\n\t\tfmt.Println(\"\")\n\t}\n}", "title": "" }, { "docid": "f25e47cadeb3ab45824bafa5b9c0ba12", "score": "0.7103154", "text": "func (cmd *CLI) Print(a ...interface{}) {\n\tfmt.Fprint(cmd.StdOut(), a...)\n}", "title": "" }, { "docid": "880bd808d1a6615fdd82b8bd5eeae719", "score": "0.7050738", "text": "func (ps PlanSlice) Print() {\n\tfor _, p := range ps {\n\t\tconsole.Println(p.NameVersion(), human.ByteSize(p.Size))\n\t}\n\tconsole.Flush()\n}", "title": "" }, { "docid": "24ecefb71c1f7b15908056eb5f0f153a", "score": "0.70092857", "text": "func (results *Results) Print() {\n\tif verbose {\n\t\tfor _, result := range results.List {\n\t\t\tresult.Print()\n\t\t}\n\t}\n\n\tvar state string\n\tif results.Passed {\n\t\tstate = \"OK\"\n\t} else {\n\t\tstate = \"FAIL\"\n\t}\n\n\tif !verbose {\n\t\tfmt.Println(state)\n\t} else {\n\t\tfmt.Printf(\"--- %s %v\", state, results.Duration)\n\t}\n}", "title": "" }, { "docid": "32d02ecef2645a0e706c7c98c559e08f", "score": "0.7006744", "text": "func (p4 *impl) Print(args ...string) (string, error) {\n\tcmd := []string{\"print\"}\n\tcmd = append(cmd, args...)\n\treturn p4.ExecCmd(cmd...)\n}", "title": "" }, { "docid": "4567c9796b9a19ea83fbf372f33f8e9d", "score": "0.6964474", "text": "func (o *Output) Print() {\n\tlogMsg := strings.Builder{}\n\tfor _, msg := range o.Output {\n\t\tlogMsg.WriteString(msg.Prettify(true))\n\t}\n\tlog.Printf(\"\\nParsing errors: %d\\n%sNumber Of Errors: %d\\n%sOutput:\\n%s\", len(o.ParseError.Message), o.ParseError.Prettify(true), len(o.Error.Message), o.Error.Prettify(true), logMsg.String())\n}", "title": "" }, { "docid": "ffb7d820bfecd2abbe21422d87b7b8fc", "score": "0.6908094", "text": "func (er *ExecutionResult) Print() {\n\tfor _, m := range er.Message {\n\t\tfmt.Println(m)\n\t}\n}", "title": "" }, { "docid": "c6cdc404e825adddb19c53b69bde6822", "score": "0.6893802", "text": "func (ptr *KeyholeInfo) Print() string {\n\tif ptr == nil {\n\t\treturn \"\"\n\t}\n\tstrs := []string{fmt.Sprintf(`{ keyhole: { version: \"%v\", args: \"%v\" } }`, ptr.Version, ptr.Params)}\n\tstrs = append(strs, ptr.Logs...)\n\treturn strings.Join(strs, \"\\n\")\n}", "title": "" }, { "docid": "948f0489b5785889dd1902b4e96cc36a", "score": "0.68430316", "text": "func (mt *merkleTreeImp) Print() string {\n\tbuffer := bytes.Buffer{}\n\tbuffer.WriteString(\"\\n------------\\n\")\n\tif mt.root == nil {\n\t\tbuffer.WriteString(\"Merkle Tree: Empty tree.\\n\")\n\t} else {\n\n\t\tbuffer.WriteString(fmt.Sprintf(\"Merkle tree: root hash <%s>\\n\", hex.EncodeToString(mt.GetRootHash())[:6]))\n\t\tbuffer.WriteString(mt.root.print(mt.treeData, mt.userData))\n\t}\n\tbuffer.WriteString(\"------------\\n\")\n\treturn buffer.String()\n}", "title": "" }, { "docid": "ad5f0b4331dbc43d7cc7a3059d45db72", "score": "0.6842465", "text": "func Print(s string)", "title": "" }, { "docid": "18316d3ca6b2fa5ce637dcf419b6a223", "score": "0.68283105", "text": "func Print() {\n\tfmt.Printf(\"Version: %s\\n\", Version)\n\tfmt.Printf(\"Commit: %s\\n\", Commit)\n\tfmt.Printf(\"Build Date: %s\\n\", Date)\n}", "title": "" }, { "docid": "67928fe23cccb60e915a42c6063eaa7c", "score": "0.68180585", "text": "func (l *littr) PrintOutput() {\n\tfmt.Println(\"\\n\\033[38;2;0;0;0m\\033[37;1;4m\\033[38;2;0;0;0m\\033[48;2;240;240;240m PROGRAM OUTPUT \\033[0m\\033[48;2;240;240;240m\\033[38;2;0;0;0m\")\n\tfor _, line := range l.outLines[:len(l.outLines)-2] {\n\t\tif len(line) < 4 || line[:4] != \"##/#\" {\n\t\t\tfmt.Println(\" \" + line)\n\t\t}\n\t}\n\tfmt.Print(\"\\u001b[0m\")\n}", "title": "" }, { "docid": "de382bc9a76c3a948a81f5cd3055b32f", "score": "0.6808327", "text": "func (cp ChanPrinter) Print(v ...interface{}) {\n\tcp <- fmt.Sprint(v...)\n}", "title": "" }, { "docid": "6d44358926776b4e3b6ed46c09df9ab5", "score": "0.67995244", "text": "func (G *Graph) Print() {\r\n\ts := \"\\n\"\r\n\r\n\tfor i := 0; i < len(G.nodes); i++ {\r\n\t\ts += G.nodes[i].String() + \" -> \"\r\n\r\n\t\tnear := G.edges[*G.nodes[i]]\r\n\r\n\t\tfor j := 0; j < len(near); j++ {\r\n\t\t\ts += near[j].String() + \" \"\r\n\t\t}\r\n\r\n\t\ts += \"\\n\"\r\n\t}\r\n\r\n\tfmt.Println(s)\r\n}", "title": "" }, { "docid": "c3b418abe4461a059e4b387584ae0343", "score": "0.6796187", "text": "func (s *Sample) Print() {\n\tfmt.Println(\"Sample :\")\n\tfmt.Println(\"\\tpts : \", s.pts)\n\tfmt.Println(\"\\tdts : \", s.dts)\n\tfmt.Println(\"\\tduration : \", s.duration)\n\tfmt.Println(\"\\tkeyFrame : \", s.keyFrame)\n\tfmt.Println(\"\\tdata : \", s.data)\n\tfmt.Println(\"\\tsize : \", s.size)\n\tfmt.Println(\"\\tencrypted : \", (s.encrypt != nil))\n}", "title": "" }, { "docid": "9c1f42d1cd0911e567cc421c56419277", "score": "0.6786705", "text": "func (this *MiniCon) Print(args ...interface{}) {\n\tline := fmt.Sprint(args...)\n\tthis.pending.addString(line)\n}", "title": "" }, { "docid": "58ff2ff11bd0b81523eaafe8610ac968", "score": "0.6771202", "text": "func (tokens TokenBundle) Print() {\n\tfmt.Println(\"Auth token\", tokens.Auth.Data)\n\tfmt.Println(\"Timestamp \", tokens.Auth.Timestamp)\n\tfmt.Println(\"Master:\")\n\tfmt.Println(strings.Replace(tokens.Master, \"-\", \"\\n\", -1))\n}", "title": "" }, { "docid": "e731f7c4135b15463fb3ca635e39aa3f", "score": "0.6757306", "text": "func Print(v ...interface{}) {\n\tstd.Output(std.callDepth, fmt.Sprint(v...), std.level)\n}", "title": "" }, { "docid": "0940b76551c25169a453c38ec9bc086f", "score": "0.6753422", "text": "func (self *StraightLineTrack) Print(prefix string) string {\n\tresult := fmt.Sprintf(\"%s/%s\\n\", prefix, self.Name)\n\tfor _, val := range self.Childs() {\n\t\tresult += val.Print(fmt.Sprintf(\"%s/%s\", prefix, self.Name))\n\t}\n\treturn result\n}", "title": "" }, { "docid": "e5e8dae46009231639ac89c8a24cf101", "score": "0.67428243", "text": "func print(w io.Writer, output string) {\n\tfmt.Fprint(w, output)\n}", "title": "" }, { "docid": "118003edf9a6c45bac53ff71e247967d", "score": "0.6729437", "text": "func (state *State) Print(msg ...interface{}) {\n\tfmt.Fprint(state.Output, msg...)\n}", "title": "" }, { "docid": "58b774267b1132fe17c9754f70e9a03c", "score": "0.67272514", "text": "func (qt *Quadtree) Print() {\n\tmaxCoord := Dim(1) << (qt.Level - 1)\n\tfor y := -maxCoord; y < maxCoord; y++ {\n\t\tfmt.Printf(\"%3d: \", y)\n\t\tfor x := -maxCoord; x < maxCoord; x++ {\n\t\t\tfmt.Print(qt.Cell(x, y), \" \")\n\t\t}\n\t\tfmt.Print(\"\\n\")\n\t}\n}", "title": "" }, { "docid": "d7c1b9289b0183769af9c2e44eba0d19", "score": "0.672711", "text": "func Print() {\n\tfmt.Printf(\"hierarchy, version %v (branch: %v, revision: %v), build date: %v, go version: %v\\n\", Version, Branch, GitSHA1, BuildDate, runtime.Version())\n}", "title": "" }, { "docid": "5feb829443df7f828a5d7ecaa2ad58c8", "score": "0.67164034", "text": "func Print(vs ...interface{}) {\n\tstd.Print(vs...)\n}", "title": "" }, { "docid": "55c36f19d88b72c05e307ab52699ce0b", "score": "0.66884464", "text": "func Print(v ...interface{}) {\n Std.Output(LevelInfo, CallDepth, sout(v...))\n}", "title": "" }, { "docid": "8f5a0f21ae0e6e87f22d1ed52680fc8f", "score": "0.6685929", "text": "func (p *Printer) Print(a ...interface{}) (n int, err error) {\n\treturn p.Fprint(os.Stdout, a...)\n}", "title": "" }, { "docid": "c31c9dae2b077a8116c79a225d1d11be", "score": "0.6675244", "text": "func Print(a ...interface{}) {\n\tfmt.Printf(\"(///ᴗㆁ✿) < %s\", fmt.Sprint(a...))\n}", "title": "" }, { "docid": "95cae78d56d21d68837f3a0ab9c6e09d", "score": "0.6675101", "text": "func PrintOutput(f *Formatter, output *perfops.RunOutput) {\n\tif f.printID {\n\t\tf.Printf(\"Test ID: %v\\n\", output.ID)\n\t}\n\tspinner := f.s.Step()\n\tif !output.IsFinished() {\n\t\tf.Printf(\"%s\", spinner)\n\t\tif len(output.Items) > 1 {\n\t\t\tfinished := 0\n\t\t\tfor _, item := range output.Items {\n\t\t\t\tif item.Result.IsFinished() {\n\t\t\t\t\tfinished++\n\t\t\t\t}\n\t\t\t}\n\t\t\tf.Printf(\" %d/%d\", finished, len(output.Items))\n\t\t}\n\t\tf.Printf(\"\\n\")\n\t}\n\tfor _, item := range output.Items {\n\t\tr := item.Result\n\t\tn := r.Node\n\t\tif item.Result.Message == \"\" {\n\t\t\to := r.Output\n\t\t\tif o == \"-2\" {\n\t\t\t\to = \"The command timed-out. It either took too long to execute or we could not connect to your target at all.\"\n\t\t\t}\n\t\t\tf.Printf(\"Node%d, AS%d, %s, %s\\n%s\\n\", n.ID, n.AsNumber, n.City, n.Country.Name, o)\n\t\t} else if r.Message != \"NO DATA\" {\n\t\t\tf.Printf(\"Node%d, AS%d, %s, %s\\n%s\\n\", n.ID, n.AsNumber, n.City, n.Country.Name, r.Message)\n\t\t}\n\t\tif !item.Result.IsFinished() {\n\t\t\tf.Printf(\"%s\\n\", spinner)\n\t\t}\n\t}\n\tf.Flush(!output.IsFinished())\n}", "title": "" }, { "docid": "92bbd80c7ec9c5e5ea6417a268e744aa", "score": "0.66679406", "text": "func Print() {\n\tfmt.Println(\"Release Version:\", PDReleaseVersion)\n\tfmt.Println(\"Edition:\", PDEdition)\n\tfmt.Println(\"Git Commit Hash:\", PDGitHash)\n\tfmt.Println(\"Git Branch:\", PDGitBranch)\n\tfmt.Println(\"UTC Build Time: \", PDBuildTS)\n}", "title": "" }, { "docid": "b614a4ae5a4ec8e69c9cb2a2e9bd81c8", "score": "0.6665601", "text": "func (data *Invasion) Print(s string) {\n log.Printf(\"[iter %5d] %s\", data.Iteration, s)\n}", "title": "" }, { "docid": "8f00ae0e6b228bbc250955a9fe5dc640", "score": "0.6664403", "text": "func (c *DescribeCommand) print(out io.Writer, nr *fastly.NewRelicOTLP) error {\n\tlines := text.Lines{\n\t\t\"Format Version\": nr.FormatVersion,\n\t\t\"Format\": nr.Format,\n\t\t\"Name\": nr.Name,\n\t\t\"Placement\": nr.Placement,\n\t\t\"Region\": nr.Region,\n\t\t\"Response Condition\": nr.ResponseCondition,\n\t\t\"Service Version\": nr.ServiceVersion,\n\t\t\"Token\": nr.Token,\n\t\t\"URL\": nr.URL,\n\t}\n\tif nr.CreatedAt != nil {\n\t\tlines[\"Created at\"] = nr.CreatedAt\n\t}\n\tif nr.UpdatedAt != nil {\n\t\tlines[\"Updated at\"] = nr.UpdatedAt\n\t}\n\tif nr.DeletedAt != nil {\n\t\tlines[\"Deleted at\"] = nr.DeletedAt\n\t}\n\n\tif !c.Globals.Verbose() {\n\t\tlines[\"Service ID\"] = nr.ServiceID\n\t}\n\ttext.PrintLines(out, lines)\n\n\treturn nil\n}", "title": "" }, { "docid": "4f059195dcf1243e7b5233b7b1dfa0ab", "score": "0.6646273", "text": "func Print() {\n\tfmt.Printf(\"Fabric peer server version %s\\n\", metadata.Version)\n}", "title": "" }, { "docid": "5e84be9357cf203adf7ce81abd57f7ba", "score": "0.6637485", "text": "func (s Set) Print() string {\n\tstrs := make([]string, 0)\n\tfor k := range s.m {\n\t\tstrs = append(strs, k)\n\t}\n\tsort.Strings(strs)\n\tvar sb strings.Builder\n\tsb.WriteString(\"{ \")\n\tfor _, str := range strs {\n\t\tsb.WriteString(str)\n\t\tsb.WriteRune(' ')\n\t}\n\tsb.WriteString(\"}\")\n\treturn sb.String()\n}", "title": "" }, { "docid": "e1b8832a50db9da94a246f240d4ccbcc", "score": "0.6633002", "text": "func (out *JsonOutput) Print() {\n\tout.ResponseWriter.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\tout.ResponseWriter.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tjson.NewEncoder(out.ResponseWriter).Encode(out.APIOutput)\n}", "title": "" }, { "docid": "782f7027f4acdae82080067bd365ab56", "score": "0.6631503", "text": "func (intf *Interface) Print(w io.Writer) {\n\t_, _ = fmt.Fprintf(w, \"interface %s\\n\", intf.Name)\n\tfor _, m := range intf.Methods {\n\t\tm.Print(w)\n\t}\n}", "title": "" }, { "docid": "f9ea069085fd9ffe327e2202693844c1", "score": "0.6629761", "text": "func Print(s string) {\n\tfmt.Print(s)\n}", "title": "" }, { "docid": "8cb60736888859d98c668275ff580c1b", "score": "0.66093284", "text": "func (t *BinaryTree) Print() {\n\tn := t.root\n\tn.print(\"\")\n}", "title": "" }, { "docid": "3ead68c71d3e36f865fc49a07294e883", "score": "0.65972716", "text": "func (this *AllOne) print() {\n\tptr := this.tail\n\tfmt.Printf(\" tail: \")\n\tfor ptr != nil {\n\t\tfmt.Printf(\"-> %d %#v\", ptr.value, ptr.set)\n\t\tptr = ptr.next\n\t}\n\tptr = this.head\n\tfmt.Printf(\"\\n\")\n\tfmt.Printf(\" head: \")\n\tfor ptr != nil {\n\t\tfmt.Printf(\"%d %#v -> \", ptr.value, ptr.set)\n\t\tptr = ptr.prev\n\t}\n\tfmt.Printf(\"\\n\\n\")\n}", "title": "" }, { "docid": "e92b627e4f09208a378f6d379d03f09e", "score": "0.6590434", "text": "func (wa *WaitingArea) print() {\n\tvar sb strings.Builder\n\tfor _, row := range wa.seats {\n\t\tfor _, s := range row {\n\t\t\tsb.WriteString(string(s.status))\n\t\t}\n\t\tsb.WriteString(\"\\n\")\n\t}\n\tfmt.Println(sb.String())\n}", "title": "" }, { "docid": "26bc660312ce27fe888c9fb958407811", "score": "0.6574604", "text": "func (G Graph) Print() {\n\tvar buffer bytes.Buffer\n\tfor node, neighbors := range G {\n\t\tbuffer.WriteString(fmt.Sprintf(\"Node %d: %v\\n\", node, neighbors))\n\t}\n\tfmt.Println(buffer.String())\n}", "title": "" }, { "docid": "d31588832ec5f40e770b223bebc4a56e", "score": "0.6544513", "text": "func (tree *Tree) Print() {\n\tfmt.Println()\n\n\tfor _, leaves := range tree.leaves {\n\t\tfor _, leaf := range leaves {\n\t\t\tswitch leaf {\n\t\t\tcase \"★\":\n\t\t\t\tyellowColor.Print(leaf)\n\t\t\tdefault:\n\t\t\t\trandomColor().Print(leaf)\n\t\t\t}\n\t\t}\n\n\t\tfmt.Println()\n\t}\n\n\tfmt.Println()\n\n\tyellowColor.Print(tree.company)\n\tredColor.Print(\" loves\")\n\tyellowColor.Print(\" you,\")\n\tredColor.Print(\" Merry Christmas!\")\n\n\tfmt.Println()\n\tfmt.Println()\n}", "title": "" }, { "docid": "47fcd71694db16f4ea89b7d12f20a058", "score": "0.65296596", "text": "func (self *CircularTrack) Print(prefix string) string {\n\tresult := fmt.Sprintf(\"%s/%s\\n\", prefix, self.Name)\n\tfor _, val := range self.Childs() {\n\t\tresult += val.Print(fmt.Sprintf(\"%s/%s\", prefix, self.Name))\n\t}\n\treturn result\n}", "title": "" }, { "docid": "5bce0c7232467407e288af1fcb7a9fb3", "score": "0.6526939", "text": "func (n *Node) Print(out *os.File) {\n\tn.printLevel(out, 0)\n}", "title": "" }, { "docid": "67361730b55a2e7369de90c39f78a7a2", "score": "0.6521757", "text": "func (wh *WholeNet) PrintOutput() {\n\t(*wh).Layers[len((*wh).Layers)-1].PrintOutput()\n}", "title": "" }, { "docid": "38acbefd7f0def336678af5891482c46", "score": "0.65212744", "text": "func Print(word string) {\n\tfmt.Print(word)\n}", "title": "" }, { "docid": "419431069f012c8b61bfbf607e113fca", "score": "0.65202266", "text": "func Print(args ...interface{}) {\n\tglobal.Print(args...)\n}", "title": "" }, { "docid": "0bc20acd7b0bee52309ce9ce996a6d32", "score": "0.65110904", "text": "func (np *Printer) Print(prog ast.Node) (string, error) {\n\tnp.indentLevel = 0\n\treturn np.yololPrinter.Print(prog)\n}", "title": "" }, { "docid": "053cc5105feb49cdfb18fe17a85b256b", "score": "0.649686", "text": "func (p person) print() {\n\tfmt.Printf(\"%+v \\n\", p)\n}", "title": "" }, { "docid": "601cee2c3e95d761839ff08c72705646", "score": "0.6485572", "text": "func (rd *ratedisp) print(pfx string) {\n\telapsed := time.Since(rd.start).Seconds()\n\n\trd.b.Logf(\"%s: %s%d messages in %fs (%.0f msgs/s), %d bytes (%.3fMb/s)\",\n\t\trd.name, pfx, rd.cnt, elapsed, float64(rd.cnt)/elapsed,\n\t\trd.size, (float64(rd.size)/elapsed)/(1024*1024))\n}", "title": "" }, { "docid": "b00c3cc38bff4b96007d7d5f1e057f3a", "score": "0.6485463", "text": "func (masterfile *MasterFile) Print(spacing int) {\n\tlog.Debug(\"%*sMagic : %s\", spacing, \"\", masterfile.Magic)\n\tlog.Debug(\"%*sMD5 : %s\", spacing, \"\", masterfile.Md5)\n\tlog.Debug(\"%*sGeneration : %d\", spacing, \"\", masterfile.Generation)\n}", "title": "" }, { "docid": "95cc73721e2a06796311e26ff60d3c54", "score": "0.64819014", "text": "func Print(args ...interface{}) (n int, err error) {\n\treturn Fprint(style.Stdout, args...)\n}", "title": "" }, { "docid": "1ef1aca69a893f9c62a54d7a88d072b2", "score": "0.6479693", "text": "func (n *Node) Print() string {\n\treturn fmt.Sprintf(\"%+v\\n\", *n)\n}", "title": "" }, { "docid": "b9b52fb402ce0933ff4f9598fcb18f75", "score": "0.6479663", "text": "func (a *Array) Print() {\n\tvar format string\n\tfor i := uint(0); i < a.Len(); i++ {\n\t\tformat += fmt.Sprintf(\"|%+v\", a.data[i])\n\t}\n\tfmt.Println(format)\n}", "title": "" }, { "docid": "5f6a556a6bd1f02301f1797a18a38cbc", "score": "0.64791393", "text": "func (b *Blockchain) Print() {\n\tspew.Dump(b.Blocks)\n}", "title": "" }, { "docid": "426ba48373c12699aa6ce112244fcee5", "score": "0.647487", "text": "func (builder *SentenceBuilder) Print() {\n\tbuilder.Reset()\n\t//nolint:forbidigo\n\tfmt.Print(builder)\n}", "title": "" }, { "docid": "7c7424324d79bc1f7fb34c87dccf35c4", "score": "0.6471889", "text": "func (p *Printer) Print(args ...interface{}) (n int, err error) {\n\treturn Fprint(p, args...)\n}", "title": "" }, { "docid": "789dfe9edc8edd5813d2cec9afbb0452", "score": "0.6455484", "text": "func (v Vertex) Print() {\n fmt.Printf(\"Vertice: %d\\n Feromona Ini: %f\\n Feromona Act: %f\\n\", v.index, v.pheromone_init, v.pheromone)\n}", "title": "" }, { "docid": "798f30439f524b60ad97af7769065659", "score": "0.6451078", "text": "func (p *Printer) Print() error {\n\tif p.buf == os.Stdout {\n\t\treturn p.print(p.t.RootNode(), \"\", true, 0)\n\t}\n\n\ttemp := p.buf\n\tp.buf = os.Stdout\n\n\terr := p.print(p.t.RootNode(), \"\", true, 0)\n\n\tp.buf = temp\n\n\treturn err\n}", "title": "" }, { "docid": "d3eb00b7716a8578080bbb5af7385584", "score": "0.6450886", "text": "func printResults() {\n\tclearScreen()\n\n\tfmt.Println(\" Positions:\")\n\tfmt.Println(\"--------------------------\")\n\tfor _, exg := range exchanges {\n\t\tfmt.Printf(\"%-13s %10.2f\\n\", exg, exg.Position())\n\t}\n\tfmt.Println(\"--------------------------\")\n\tfmt.Printf(\"\\nRun P&L: $%.2f\\n\", pl)\n}", "title": "" }, { "docid": "a0d54c84f76aeaf7376339bf1ea0c711", "score": "0.64432055", "text": "func (n *Node) print() string {\n\n\th := n.height()\n\tprintMap = make(map[int][]int, h)\n\tfor i := 1; i <= h; i++ {\n\t\tn.printByLevel(i)\n\t}\n\tfor key := h; key > 0; key-- {\n\t\tfor j := h; j > key; j-- {\n\t\t\tfor _, k := range printMap[j] {\n\t\t\t\tif arrayutils.InInt(printMap[key], k) {\n\t\t\t\t\tprintMap[key] = arrayutils.RemoveByValue[int](printMap[key], k)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\ts := fmt.Sprintf(\"Tree: %+v\", printMap)\n\tprintMap = nil\n\n\treturn s\n}", "title": "" }, { "docid": "830c56d73751aceee5e1a1fcc77a0a42", "score": "0.6441237", "text": "func main() {\n\tprint(\"test ok! (print)\\n\")\n\tfmt.Println(\"test ok! (fmt)\")\n}", "title": "" }, { "docid": "4dc3d25818a16a860b57a4205c1bdad9", "score": "0.64367217", "text": "func Print(format string, args ...interface{}) {\n\tif len(args) == 0 {\n\t\tfmt.Fprintln(OutputWriter, format)\n\t\treturn\n\t}\n\tfmt.Fprintf(OutputWriter, format+\"\\n\", args...)\n}", "title": "" }, { "docid": "d712929b02e87df38fd0c75cb0b4a4f8", "score": "0.6432817", "text": "func (p person) print() {\n\tfmt.Printf(\"%+v\", p)\n}", "title": "" }, { "docid": "d0c356def3aebb8ae654bd6fd46418ff", "score": "0.64286786", "text": "func (t *Track) Print() {\n\tfmt.Println(\"Track :\")\n\tfmt.Println(\"\\tindex : \", t.index)\n\tfmt.Println(\"\\tisAudio : \", t.isAudio)\n\tfmt.Println(\"\\tcreationTime : \", t.creationTime)\n\tfmt.Println(\"\\tmodificationTime : \", t.modificationTime)\n\tfmt.Println(\"\\tduration : \", t.duration)\n\tfmt.Println(\"\\ttimescale : \", t.timescale)\n\tfmt.Println(\"\\tgolbalTimescale : \", t.globalTimescale)\n\tfmt.Println(\"\\twidth : \", t.width)\n\tfmt.Println(\"\\theight : \", t.height)\n\tfmt.Println(\"\\tsampleRate : \", t.sampleRate)\n\tfmt.Println(\"\\tbitsPerSample : \", t.bitsPerSample)\n\tfmt.Println(\"\\tcolorTableId : \", t.colorTableId)\n\tfmt.Println(\"\\tbandwidth: \", t.bandwidth)\n\tfmt.Println(\"\\tcodec: \", t.codec)\n\tfmt.Println(\"\\tencrypted : \", (t.encryptInfos != nil))\n\tfmt.Println(\"\\tsamples count : \", len(t.samples))\n\tfmt.Println(\"\\tsegment type : \", t.segmentType)\n\tfmt.Println(\"\\tinit offset : \", t.initOffset)\n}", "title": "" }, { "docid": "2f0a57dbab4c8c0c5c591073b35b4ac9", "score": "0.6428302", "text": "func (array *Array) Print() {\n\tfmt.Println(array.Join(\" \"))\n}", "title": "" }, { "docid": "25485cf2432ac12cf9ea83065720dec6", "score": "0.64278483", "text": "func (hr *HashRing) Print() string {\n\tkeys := hr.getSortedKeys()\n\ts := \"\"\n\tfor _, key := range keys {\n\t\tnode := hr.ring[key]\n\t\ts += fmt.Sprintf(\"%s<Degree: %v>\\n\", node.Print(), strconv.Itoa(key))\n\t}\n\treturn s\n}", "title": "" }, { "docid": "c1209ab2fa14f520386fb6eec850f65d", "score": "0.64252275", "text": "func (p *Printer) Print(v ...interface{}) FullPrinter {\n state, fc := p.initState()\n defer p.reset(state)\n p.formatter.Print(fc, v...)\n p.fc.Writer.Write(state.Buffer)\n return p\n}", "title": "" }, { "docid": "2dd4f33f7c70a43400a50f74a1525b4b", "score": "0.6415184", "text": "func (p *Index) Print() {\n\tfmt.Println(strings.Repeat(\"#\", p.Level), p)\n\tfor _, c := range p.Children {\n\t\tc.Print()\n\t}\n}", "title": "" }, { "docid": "c3a88afafcb90e755f0b2421a4beb19a", "score": "0.6414636", "text": "func Print(v ...interface{}) {\n\tcheckInit()\n\ts := fmt.Sprint(v...)\n\tstd.Report(s)\n\tlog.Print(s)\n}", "title": "" }, { "docid": "4bafd77ad84d6e698a2e37b3ef69cd76", "score": "0.6411256", "text": "func (t *Tree) Print() {\n\tdfs(t.Root)\n}", "title": "" }, { "docid": "74fc5c8c702125abced68ac57ed4a77b", "score": "0.64047396", "text": "func (r Reporter) Print(ip net.IP, msg string) {\n\tr.output <- fmt.Sprintf(\"%-24s %-8s %s\", ip, r.protocol, msg)\n}", "title": "" }, { "docid": "88504f21753b5137b4340655535c9d8c", "score": "0.64004827", "text": "func TestPrint(t *testing.T) {\n\tconst src = `\nprint(\"hello\")\ndef f(): print(\"hello\", \"world\", sep=\", \")\nf()\n`\n\tbuf := new(bytes.Buffer)\n\tprint := func(thread *starlark.Thread, msg string) {\n\t\tcaller := thread.CallFrame(1)\n\t\tfmt.Fprintf(buf, \"%s: %s: %s\\n\", caller.Pos, caller.Name, msg)\n\t}\n\tthread := &starlark.Thread{Print: print}\n\tif _, err := starlark.ExecFile(thread, \"foo.star\", src, nil); err != nil {\n\t\tt.Fatal(err)\n\t}\n\twant := \"foo.star:2:6: <toplevel>: hello\\n\" +\n\t\t\"foo.star:3:15: f: hello, world\\n\"\n\tif got := buf.String(); got != want {\n\t\tt.Errorf(\"output was %s, want %s\", got, want)\n\t}\n}", "title": "" }, { "docid": "302af44b4a9b196e2470d461e5cfd8f1", "score": "0.6397128", "text": "func (node Node) Print() {\n\tfmt.Println(node.Value)\n}", "title": "" }, { "docid": "887b0e23fd42cac7a79555e35a652ecd", "score": "0.6395995", "text": "func (io *Io) Print(a interface{}) {\n\tfmt.Fprint(io.writer, a)\n}", "title": "" }, { "docid": "a71d57982e8268a83503cda38816f385", "score": "0.6391425", "text": "func (p *SimplePrinter) Print(nodes []*Node) error {\n\terr := p.printAllDetails(nodes)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = p.printOverview(nodes)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e8438d0faf4194f7d85ec99a1e56449d", "score": "0.6381525", "text": "func Print(values ...any) {\n\tmux.Lock()\n\tdefer mux.Unlock()\n\n\tfor _, v := range values {\n\t\tWrite(os.Stdout, v)\n\t\tos.Stdout.Write(newLine)\n\t}\n}", "title": "" }, { "docid": "21010985d1bb0a843afc155fa298a411", "score": "0.6379052", "text": "func (g *Graph) Print() {\n\tfor i := 0; i < len(g.nodes); i++ {\n\t\tfmt.Println()\n\t\tfmt.Printf(\"%v -> \", g.nodes[i].data)\n\t\tedges := g.nodes[i].edges\n\t\tfor j := 0; j < len(edges); j++ {\n\t\t\tfmt.Printf(\"%v \", edges[j].data)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "fc277e58de0645ad23604e8766d79d72", "score": "0.63690233", "text": "func Printer() {\n\tfmt.Println(\"Printing . . \")\n\n}", "title": "" }, { "docid": "a50fa2b042f64bbe0658022471837ec5", "score": "0.6363153", "text": "func (g *Graph) Print() {\n\tfor _, v := range g.vertices {\n\t\tfmt.Printf(\"\\nVertex %v:\", v.key)\n\t\tfor _, y := range v.adjacent {\n\t\t\tfmt.Printf(\" %v\", y.key)\n\t\t}\n\t}\n\tfmt.Println()\n}", "title": "" }, { "docid": "8abb93f928d7a7b1f81a84b64b656bb5", "score": "0.6362882", "text": "func Print(v ...interface{}) { std.lprint(INFO, v...) }", "title": "" }, { "docid": "1a1e424daea75d77af9d791add76b7e2", "score": "0.63593787", "text": "func print(str string) { fmt.Println(str) }", "title": "" }, { "docid": "1a1e424daea75d77af9d791add76b7e2", "score": "0.63593787", "text": "func print(str string) { fmt.Println(str) }", "title": "" }, { "docid": "afe0a32b6d7d1fceecbf45a1a0efa0ad", "score": "0.6358053", "text": "func (b *printer) Print(args ...interface{}) {\n\t_, _ = Fprint(&b.buf, args...)\n}", "title": "" }, { "docid": "fa23feaf2715394474c374e1b10f3286", "score": "0.63558525", "text": "func (w *workTally) Print() {\n\ttable := tablewriter.NewWriter(os.Stdout)\n\ttable.SetHeader([]string{\"Issue ID\", \"Summary\", \"Time Spent\"})\n\ttable.SetFooter([]string{\"\", \"Total\", w.total.String()})\n\ttable.SetBorder(false)\n\tfor _, key := range w.sortedKeys() {\n\t\tentry := w.durationMap[key]\n\t\ttable.Append([]string{\n\t\t\tkey,\n\t\t\ttruncateString(entry.summary, 64),\n\t\t\tentry.duration.String(),\n\t\t})\n\t}\n\tfmt.Println(\"\")\n\ttable.Render()\n}", "title": "" }, { "docid": "b30d5a7c57de1e89cb880a053b017ead", "score": "0.63555217", "text": "func (this *Graph) Print() {\n\tfmt.Printf(\"The Graph have %d nodes and %d edges\\n\", this.n, this.e)\n\tfor i := 0; i < this.n; i++ {\n\t\tfor j := 0; j < this.n; j++ {\n\t\t\tfmt.Print(this.edge[i*this.n+j], \" \")\n\t\t}\n\t\tfmt.Println(\"\")\n\t}\n}", "title": "" }, { "docid": "7852a891e2aa65974ba5346a893f26eb", "score": "0.6353105", "text": "func (e Edge) Print() {\n fmt.Printf(\"%d --(%f)-- %d\\n\", e.v1_index, e.weight, e.v2_index)\n}", "title": "" }, { "docid": "3c5d86be6cdb550398ae8beca2c1b526", "score": "0.63491374", "text": "func Print(s stat.Stat) {\n\tw := tabwriter.NewWriter(os.Stdout, 0, 0, 1, ' ', tabwriter.AlignRight|tabwriter.Debug)\n\tfmt.Fprintln(w, \"Total\\tTests\\tPass\\tFail\\tSkip\\t\")\n\tfmt.Fprintf(w, \"%v\\t%v\\t%v\\t%v\\t%v\\t\\n\", resultTotal(s), s.Tests, s.Pass, s.Fail, s.Skip)\n\tw.Flush()\n\n\tfmt.Printf(\"Elapsed: %v\\n\", s.Elapsed)\n\tfmt.Printf(\"Packages without Tests (%v/%v):\\n%v \\n\", s.Packages, len(s.EmptyPackages), s.EmptyPackages)\n}", "title": "" }, { "docid": "7d7a04b4c37944237a04f1278f43f8bf", "score": "0.63441986", "text": "func (r repo) print(verbose bool) {\n\tif verbose {\n\t\tfmt.Printf(\"%s (%s)\\n\\t%s\\n\\t%s\\n\", r.Name, r.Desc, r.HTTP, r.SSH)\n\t\treturn\n\t}\n\tfmt.Println(r.SSH)\n}", "title": "" }, { "docid": "bfedaa822be39d874a4e5f989c208844", "score": "0.63386256", "text": "func (t *Task) Print() {\n\tfmt.Printf(\"%+v\\n\", *t)\n}", "title": "" }, { "docid": "5b71a286ad1788affd5ba24fff930a19", "score": "0.6338543", "text": "func (r *UserRepoImpl) Print() string {\n\treturn \"userrepo\" + fmt.Sprintf(\"%v\", r.TContext.Runtime())\n}", "title": "" }, { "docid": "e050c5a5ea4dcdbf636fbf403acefec8", "score": "0.6337416", "text": "func (s *Selector) Print() string {\n\tvar reqs []string\n\tfor ii := range s.Requirements {\n\t\treqs = append(reqs, s.Requirements[ii].Print())\n\t}\n\treturn strings.Join(reqs, \",\")\n}", "title": "" }, { "docid": "c315a2617b79961febf87df0234b1c96", "score": "0.6336937", "text": "func (l *Logger) Print(args ...interface{}) error {\n\treturn l.Output2(1, l.DefaultVariant(), \"\", args...)\n}", "title": "" }, { "docid": "9d6c48c19846fe2c12e8847dcc2ff82d", "score": "0.63357735", "text": "func (p *Package) Print() {\n\tconst padding = 3\n\tw := tabwriter.NewWriter(os.Stdout, 0, 0, padding, ' ', tabwriter.AlignRight)\n\tprintln()\n\tfmt.Fprintln(w, \"NAME:\", \"\\t\", p.Name)\n\tfmt.Fprintln(w, \"PATH:\", \"\\t\", p.Path)\n\tfmt.Fprintln(w, \"SYNOPSIS:\", \"\\t\", p.Synopsis)\n\tfmt.Fprintln(w, \"STARS:\", \"\\t\", p.Stars)\n\tfmt.Fprintln(w, \"SCORE:\", \"\\t\", p.Score)\n\tw.Flush()\n}", "title": "" }, { "docid": "d93e36fc3fab80e9465af24b5c4447b1", "score": "0.63333637", "text": "func (s Status) Print() string {\n\tsflag := fmt.Sprintf(\"Status: 0x%x\\n\", s.Header)\n\tsflags := sarflags.Values(\"status\")\n\tfor f := range sflags {\n\t\tn := sarflags.GetStr(s.Header, sflags[f])\n\t\tsflag += fmt.Sprintf(\" %s:%s\\n\", sflags[f], n)\n\t}\n\tsflag += fmt.Sprintf(\" session:%d\\n\", s.Session)\n\tif sarflags.GetStr(s.Header, \"reqtstamp\") == \"yes\" {\n\t\tsflag += fmt.Sprintf(\" timestamp:%s\\n\", s.Tstamp.Print())\n\t}\n\tsflag += fmt.Sprintf(\" progress:%d\", s.Progress)\n\tsflag += fmt.Sprintf(\" inresponseto:%d\\n\", s.Inrespto)\n\tfor i := range s.Holes {\n\t\tsflag += fmt.Sprintf(\" Hole[%d]: Start:%d End:%d\\n\", i, s.Holes[i].Start, s.Holes[i].End)\n\t}\n\treturn sflag\n}", "title": "" }, { "docid": "fd7709b04b845f76dd1edb77ea129f2f", "score": "0.6332006", "text": "func Print(dockerCli *command.DockerCli, ctx context.Context, tasks []swarm.Task, resolver *idresolver.IDResolver, noTrunc bool) error {\n\tsort.Stable(tasksBySlot(tasks))\n\n\twriter := tabwriter.NewWriter(dockerCli.Out(), 0, 4, 2, ' ', 0)\n\n\t// Ignore flushing errors\n\tdefer writer.Flush()\n\tfmt.Fprintln(writer, strings.Join([]string{\"ID\", \"NAME\", \"IMAGE\", \"NODE\", \"DESIRED STATE\", \"CURRENT STATE\", \"ERROR\", \"PORTS\"}, \"\\t\"))\n\n\tif err := print(writer, ctx, tasks, resolver, noTrunc); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8e91f49502fe606fe8480457f0a35592", "score": "0.63260156", "text": "func Print(args lisp.Object) {\n\tlisp.Call(\"princ\", lisp.MapConcat(lisp.Prin1ToString, args, \"\"))\n}", "title": "" }, { "docid": "2f50265f4ad474996f60640476c16aab", "score": "0.6325951", "text": "func (c4 *Connect4) Print() {\n\tfor r, Row := range c4.Layout {\n\t\tif r == 0 {\n\t\t\tfor i := 0; i < 7; i++ {\n\t\t\t\tfmt.Print(\" \" + strconv.Itoa(i+1))\n\t\t\t}\n\t\t\tfmt.Println()\n\t\t}\n\t\tprinting.PrintBlue(\"|\")\n\t\tfor _, Col := range Row {\n\t\t\tif Col == 0 {\n\t\t\t\tfmt.Print(\"O\")\n\t\t\t} else if Col == 1 {\n\t\t\t\tprinting.PrintRed(\"O\")\n\t\t\t} else {\n\t\t\t\tprinting.PrintYellow(\"O\")\n\t\t\t}\n\t\t\tprinting.PrintBlue(\"|\")\n\t\t}\n\t\tprinting.PrintBlue(\"\\n\")\n\t}\n}", "title": "" }, { "docid": "9fd2ab49c78ab63c55415a3f35577b07", "score": "0.63233465", "text": "func (logger *Logger) Print(args ...interface{}) {\n\tlogger.std.Log(args...)\n}", "title": "" }, { "docid": "e804de928070e07c073db3c7fc5946b7", "score": "0.63168806", "text": "func Print(args ...interface{}) {\n\tNewDefaultEntry().Print(args...)\n}", "title": "" }, { "docid": "cfcbdeadf8fbec194d05a06bdb983d16", "score": "0.6316672", "text": "func (t *Tree) Print(w io.Writer, f IterateFunc, itemSiz int) {\n\n\tfmt.Fprintf(w, \"treeNode-+-Left \\t / Left High\\n\")\n\tfmt.Fprintf(w, \" | \\t = Equal\\n\")\n\tfmt.Fprintf(w, \" +-Right\\t \\\\ Right High\\n\\n\")\n\n\tmaxHeight := t.Height()\n\n\tif f != nil && t.root != nil {\n\t\td := &printData{0, itemSiz, make([]byte, maxHeight), 0, f, w}\n\t\td.printer(t.root)\n\t}\n}", "title": "" } ]
4efe0098774bd82e6046f554e64d44fb
GetMethod returns the proper semantic when the field is empty
[ { "docid": "620f89f1518af03a76976ab75e1d098b", "score": "0.5409512", "text": "func (i *Input) GetMethod() string {\n\tif i.Method == nil {\n\t\treturn \"GET\"\n\t}\n\treturn *i.Method\n}", "title": "" } ]
[ { "docid": "abab779a4ac6bec6a6b6626e7a79094e", "score": "0.612265", "text": "func (e MethodValidationError) Field() string { return e.field }", "title": "" }, { "docid": "e55b3f6ecf5588d1e5b44dd640bfe192", "score": "0.598456", "text": "func (e MethodMatchValidationError) Field() string { return e.field }", "title": "" }, { "docid": "943915eae0a5ecd1f82c6527b282b938", "score": "0.57201725", "text": "func (cmd *unparsableCmd) Method() string {\n\treturn cmd.method\n}", "title": "" }, { "docid": "3d0f1c328ba7fc6b000df88b9623f4b3", "score": "0.5585877", "text": "func (self *DefaultRequest) GetMethod() string {\n\tself.once.Do(self.prepare)\n\treturn self.Method\n}", "title": "" }, { "docid": "34174a82b33907875ba78ac4c3d752d6", "score": "0.55720884", "text": "func (*GetRequest) Method() Method { return Get }", "title": "" }, { "docid": "2a5ede33c3e3d1e980e562e5a8ec0ad2", "score": "0.55664814", "text": "func getMethod(t MethodType) string {\n\tswitch t {\n\tcase GET:\n\t\treturn \"GET\"\n\tcase POST:\n\t\treturn \"POST\"\n\tcase PUT:\n\t\treturn \"PUT\"\n\tcase DELETE:\n\t\treturn \"DELETE\"\n\tdefault:\n\t\treturn \"\"\n\t}\n}", "title": "" }, { "docid": "aceddd75f93fb9039ff460de30449a06", "score": "0.55493397", "text": "func (*NoopRequest) Method() Method { return Noop }", "title": "" }, { "docid": "c55bd93b01a0afb48ce58af89a63d16c", "score": "0.55172914", "text": "func (t Method) IsEmpty() bool {\n\treturn t.DisplayName == \"\" &&\n\t\tt.Description == \"\" &&\n\t\tt.Annotations.IsEmpty() &&\n\t\tt.QueryParameters.IsEmpty() &&\n\t\tt.Headers.IsEmpty() &&\n\t\tt.QueryString.IsEmpty() &&\n\t\tt.Responses.IsEmpty() &&\n\t\tt.Bodies.IsEmpty() &&\n\t\tt.Protocols.IsEmpty() &&\n\t\tt.Is.IsEmpty() &&\n\t\tt.SecuredBy.IsEmpty()\n}", "title": "" }, { "docid": "d2594a40c94acab62fcb410ba15012df", "score": "0.55093163", "text": "func (e MethodMatch_ParameterMatchSpecifierValidationError) Field() string { return e.field }", "title": "" }, { "docid": "03236e5b5765133e935ef2f12a0e9125", "score": "0.5501467", "text": "func (e CategoryMethodV1RequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "582b5a608a1c6ec061e3b93f4a5919f8", "score": "0.5489214", "text": "func (s first_struct) method() int{\n\treturn 1\n}", "title": "" }, { "docid": "301d4fb3f3aa36104dfa7026fe057242", "score": "0.5446217", "text": "func (m pFieldGet) Underlying() *models.Method {\n\treturn m.Method\n}", "title": "" }, { "docid": "754b3a8b6cef5e2cf8cc7c0b29e70cec", "score": "0.5421071", "text": "func (wh Webhook) MethodOrDefault() string {\n\tif wh.Method != \"\" {\n\t\treturn wh.Method\n\t}\n\treturn r2.MethodGet\n}", "title": "" }, { "docid": "21d3d855c92d830996052970c4c12736", "score": "0.54125434", "text": "func (st SomeStruct) SomeValMethod(methodInput0 string, r io.Reader) string {\n\treturn \"\"\n}", "title": "" }, { "docid": "9a95fc7fa61504e20e6669a8cc6dd40c", "score": "0.5412139", "text": "func (wh Webhook) MethodOrDefault() string {\n\tif wh.Method != \"\" {\n\t\treturn wh.Method\n\t}\n\treturn \"GET\"\n}", "title": "" }, { "docid": "c7f5a7abf157c343b3bfbb3e0cea2945", "score": "0.540859", "text": "func AllowedMethod(field string) bool {\n\t// optional field always set with default (typically POST)\n\tif field == \"\" {\n\t\treturn true\n\t}\n\tif (field != \"GET\") && (field != \"POST\") {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "be5e5a67ec99e66431e992f7fc8c0995", "score": "0.5377881", "text": "func nilField(key string) Field { return Reflect(key, nil) }", "title": "" }, { "docid": "f0d8a89cf902078f451e0a9a53b8a7d9", "score": "0.53649664", "text": "func (s *serverRequest) Method() (string, error) {\n\treturn s.call.Method, s.err\n}", "title": "" }, { "docid": "d165e61b1ef6d52032fb85ea16c20650", "score": "0.5363692", "text": "func (m *ContainerCreate_Runtime) Field(fieldpath []string) (string, bool) {\n\tif len(fieldpath) == 0 {\n\t\treturn \"\", false\n\t}\n\n\tswitch fieldpath[0] {\n\tcase \"name\":\n\t\treturn string(m.Name), len(m.Name) > 0\n\tcase \"options\":\n\t\tdecoded, err := github_com_containerd_typeurl.UnmarshalAny(m.Options)\n\t\tif err != nil {\n\t\t\treturn \"\", false\n\t\t}\n\n\t\tadaptor, ok := decoded.(interface {\n\t\t\tField([]string) (string, bool)\n\t\t})\n\t\tif !ok {\n\t\t\treturn \"\", false\n\t\t}\n\t\treturn adaptor.Field(fieldpath[1:])\n\t}\n\treturn \"\", false\n}", "title": "" }, { "docid": "f2d4cc618fa8420a95bf47c4506e161d", "score": "0.5356798", "text": "func (s *SyntheticsRequest) GetMethod() string {\n\tif s == nil || s.Method == nil {\n\t\treturn \"\"\n\t}\n\treturn *s.Method\n}", "title": "" }, { "docid": "95d9d782f6ab93afa5b1676afacb8574", "score": "0.53556246", "text": "func (e CategoryMethodV1ResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "bbd61a5c03360592ff703d25f229552d", "score": "0.534308", "text": "func zapMethod(s string) zapcore.Field { return zap.String(\"method\", s) }", "title": "" }, { "docid": "72b5ec6cad66fdecc8c4565dff9693d0", "score": "0.5311548", "text": "func (h *Hospital) GetMethod() string {\n\treturn http.MethodPost\n}", "title": "" }, { "docid": "88b78484a7b21cc4ca3009bcbc1ef802", "score": "0.5310286", "text": "func (req *ReqStub) Method() string {\n\treturn req.MethodString\n}", "title": "" }, { "docid": "0512bbcc5abcfe67696a8dbcbc89b127", "score": "0.5306718", "text": "func (l *Validate) Method() string {\n\treturn http.MethodGet\n}", "title": "" }, { "docid": "1f21773b4f8b85638fa820a9788edbf5", "score": "0.5302319", "text": "func (e EmptyValidationError) Field() string { return e.field }", "title": "" }, { "docid": "1f21773b4f8b85638fa820a9788edbf5", "score": "0.5302319", "text": "func (e EmptyValidationError) Field() string { return e.field }", "title": "" }, { "docid": "1f21773b4f8b85638fa820a9788edbf5", "score": "0.5302319", "text": "func (e EmptyValidationError) Field() string { return e.field }", "title": "" }, { "docid": "ace32daadfd594fbf1dc5d34ee56c92e", "score": "0.5299081", "text": "func (m FetchFulfillRequest) MethodName() string { return \"Fetch.fulfillRequest\" }", "title": "" }, { "docid": "6db8e939a987430d9aa775bcbdf397eb", "score": "0.5298216", "text": "func (body GETReadTagRequest) Method() string {\n\treturn \"GET\"\n}", "title": "" }, { "docid": "baf83a63a40502fec7403b79a1c91af8", "score": "0.52884716", "text": "func (m pFieldsGet) Underlying() *models.Method {\n\treturn m.Method\n}", "title": "" }, { "docid": "fa87f06489a2c6c97292debb881a58d1", "score": "0.52613974", "text": "func (t *RPCGetDescriptor) MaybeGet() *ggt.MethodDescriptor { return t.methodMaybeGet }", "title": "" }, { "docid": "813889e42cd0621374bb22407be631af", "score": "0.5252035", "text": "func checkFieldMethodsExist() {\n\tfor _, model := range Registry.registryByName {\n\t\tfor _, field := range model.fields.registryByName {\n\t\t\tif field.onChange != \"\" {\n\t\t\t\tmodel.methods.MustGet(field.onChange)\n\t\t\t}\n\t\t\tif field.onChangeWarning != \"\" {\n\t\t\t\tmodel.methods.MustGet(field.onChangeWarning)\n\t\t\t}\n\t\t\tif field.onChangeFilters != \"\" {\n\t\t\t\tmodel.methods.MustGet(field.onChangeFilters)\n\t\t\t}\n\t\t\tif field.constraint != \"\" {\n\t\t\t\tmodel.methods.MustGet(field.constraint)\n\t\t\t}\n\t\t\tif field.compute != \"\" && field.stored {\n\t\t\t\tmodel.methods.MustGet(field.compute)\n\t\t\t\tif len(field.depends) == 0 {\n\t\t\t\t\tlog.Warn(\"Computed fields should have a 'Depends' parameter set\", \"model\", model.name, \"field\", field.name)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif field.inverse != \"\" {\n\t\t\t\tif _, ok := model.methods.Get(field.compute); !ok {\n\t\t\t\t\tlog.Panic(\"Inverse method must only be set on computed fields\", \"model\", model.name, \"field\", field.name, \"method\", field.inverse)\n\t\t\t\t}\n\t\t\t\tmodel.methods.MustGet(field.inverse)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2c7f684fd4542005f5bc3baac1c455df", "score": "0.5240193", "text": "func (m *ContainerCreate) Field(fieldpath []string) (string, bool) {\n\tif len(fieldpath) == 0 {\n\t\treturn \"\", false\n\t}\n\n\tswitch fieldpath[0] {\n\tcase \"id\":\n\t\treturn string(m.ID), len(m.ID) > 0\n\tcase \"image\":\n\t\treturn string(m.Image), len(m.Image) > 0\n\tcase \"runtime\":\n\t\t// NOTE(stevvooe): This is probably not correct in many cases.\n\t\t// We assume that the target message also implements the Field\n\t\t// method, which isn't likely true in a lot of cases.\n\t\t//\n\t\t// If you have a broken build and have found this comment,\n\t\t// you may be closer to a solution.\n\t\tif m.Runtime == nil {\n\t\t\treturn \"\", false\n\t\t}\n\n\t\treturn m.Runtime.Field(fieldpath[1:])\n\t}\n\treturn \"\", false\n}", "title": "" }, { "docid": "179f55708b1d85187fb49fce59dfb99b", "score": "0.52355665", "text": "func (h *handler) Method() string {\n\treturn http.MethodGet\n}", "title": "" }, { "docid": "ff6c87fbd16f6a9dfe1291566ae97f5a", "score": "0.52237356", "text": "func (r *RestCodecRequest) Method() (string, error) {\n\treturn r.method, nil\n}", "title": "" }, { "docid": "5faba9c06cc91ef2f022f0b1d1aae5ba", "score": "0.52074647", "text": "func (h *ParsedSourceDocHandler) Method(parent reflect.Type, method reflect.Method) string {\n\tdoct := h.findDoc(parent)\n\tif doct == nil {\n\t\treturn \"\"\n\t}\n\n\tspecs := doct.Decl.Specs\n\tif len(specs) < 1 {\n\t\treturn \"\"\n\t}\n\ttspec, ok := specs[0].(*ast.TypeSpec)\n\tif !ok {\n\t\treturn \"\"\n\t}\n\n\tifspec, ok := tspec.Type.(*ast.InterfaceType)\n\tif !ok {\n\t\treturn \"\"\n\t}\n\n\tfor _, dm := range ifspec.Methods.List {\n\t\tif len(dm.Names) > 0 && dm.Names[0].Name == method.Name {\n\t\t\treturn strings.TrimSpace(dm.Doc.Text())\n\t\t}\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "8c6d81f10e63076b2b69232e1730d6d9", "score": "0.52044797", "text": "func (e ProductServiceGetRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "0cfb98b65a8afbbd39fb015aefed6fda", "score": "0.5200482", "text": "func (req CallRequest) Method() string {\n\treturn req.method\n}", "title": "" }, { "docid": "6266eea5076598c89befa0ce9e27bad5", "score": "0.5198521", "text": "func (s *SyntheticsRequest) GetMethodOk() (string, bool) {\n\tif s == nil || s.Method == nil {\n\t\treturn \"\", false\n\t}\n\treturn *s.Method, true\n}", "title": "" }, { "docid": "cc0404f566c3f9c817cd3b9071ede238", "score": "0.51900697", "text": "func (o *WafEventRequest) GetMethod() string {\n\tif o == nil || o.Method == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Method\n}", "title": "" }, { "docid": "69ba7e1f6f75f00ffde40bc489b5b776", "score": "0.5180097", "text": "func (s *state) evalField(data reflect.Value, fieldName string, args []node, final reflect.Value,\nisFirst, canBeMethod bool) reflect.Value {\n\ttopState, topData := s, data // Remember initial state for diagnostics.\n\t// Is it a function?\n\tif function, ok := findFunction(fieldName, s.tmpl, s.set); ok {\n\t\treturn s.evalCall(data, function, fieldName, false, args, final)\n\t}\n\t// Look for methods and fields at this level, and then in the parent.\n\tfor s != nil {\n\t\tvar isNil bool\n\t\tdata, isNil = indirect(data)\n\t\tif canBeMethod {\n\t\t\t// Need to get to a value of type *T to guarantee we see all\n\t\t\t// methods of T and *T.\n\t\t\tptr := data.Addr()\n\t\t\tif method, ok := methodByName(ptr.Type(), fieldName); ok {\n\t\t\t\treturn s.evalCall(ptr, method.Func, fieldName, true, args, final)\n\t\t\t}\n\t\t}\n\t\t// It's not a method; is it a field of a struct?\n\t\tif data.Kind() == reflect.Struct {\n\t\t\tfield := data.FieldByName(fieldName)\n\t\t\tif field.IsValid() {\n\t\t\t\tif len(args) > 1 || final.IsValid() {\n\t\t\t\t\ts.errorf(\"%s is not a method but has arguments\", fieldName)\n\t\t\t\t}\n\t\t\t\tif isExported(fieldName) { // valid and exported\n\t\t\t\t\treturn field\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif !isFirst {\n\t\t\t// We check for nil pointers only if there's no possibility of resolution\n\t\t\t// in the parent.\n\t\t\tif isNil {\n\t\t\t\ts.errorf(\"nil pointer evaluating %s.%s\", topData.Type(), fieldName)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\ts, data = s.parent.state, s.parent.data\n\t}\n\ttopState.errorf(\"can't handle evaluation of field %s in type %s\", fieldName, topData.Type())\n\tpanic(\"not reached\")\n}", "title": "" }, { "docid": "a931d744084d0f5626064b8886d893b5", "score": "0.5173336", "text": "func (f *Builder) Method(method string) *Builder {\n\tif method != \"\" {\n\t\tf.method = strings.ToUpper(strings.TrimSpace(method))\n\t}\n\treturn f\n}", "title": "" }, { "docid": "0447932ab28ccb1c31fb9bdd5ed84efa", "score": "0.51722765", "text": "func (c *BindingCalculator) Method(method *concepts.Method) string {\n\tname := method.Name()\n\tswitch {\n\tcase name.Equals(nomenclator.Add):\n\t\treturn http.MethodPost\n\tcase name.Equals(nomenclator.Delete):\n\t\treturn http.MethodDelete\n\tcase name.Equals(nomenclator.Get):\n\t\treturn http.MethodGet\n\tcase name.Equals(nomenclator.List):\n\t\treturn http.MethodGet\n\tcase name.Equals(nomenclator.Post):\n\t\treturn http.MethodPost\n\tcase name.Equals(nomenclator.Update):\n\t\treturn http.MethodPatch\n\tdefault:\n\t\treturn http.MethodPost\n\t}\n}", "title": "" }, { "docid": "058ff46ca07e650d8cc978f5b4491e56", "score": "0.51684713", "text": "func (m PageGetInstallabilityErrors) MethodName() string { return \"Page.getInstallabilityErrors\" }", "title": "" }, { "docid": "2a4dec1a6ea257612d73f338483c37f9", "score": "0.5150627", "text": "func checkMethType(method *Method, label string) error {\n\tmethType := method.methodType\n\tvar msg string\n\tswitch {\n\tcase methType.NumIn() != 1:\n\t\tmsg = fmt.Sprintf(\"%s should have no arguments\", label)\n\tcase methType.NumOut() == 0:\n\t\tmsg = fmt.Sprintf(\"%s should return a value\", label)\n\tcase methType.NumOut() > 1:\n\t\tmsg = fmt.Sprintf(\"Too many return values for %s\", label)\n\tcase !methType.Out(0).Implements(reflect.TypeOf((*RecordData)(nil)).Elem()):\n\t\tmsg = fmt.Sprintf(\"%s returned value must implement models.RecordData\", label)\n\t}\n\tif msg != \"\" {\n\t\treturn errors.New(msg)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "834498d949f8b200f25fadab6bf3a32a", "score": "0.51472604", "text": "func (e *Endpoint) Method() string {\n\treturn Method\n}", "title": "" }, { "docid": "834498d949f8b200f25fadab6bf3a32a", "score": "0.51472604", "text": "func (e *Endpoint) Method() string {\n\treturn Method\n}", "title": "" }, { "docid": "2179b8f3f0e5a93cf2f039f1bcde8601", "score": "0.5146861", "text": "func getOmitEmpty(f *reflect.StructField) bool {\n\tvar omitempty bool\n\ttag := f.Tag.Get(\"json\")\n\tif tag != \"\" {\n\t\tomitempty = strings.Contains(tag, \"omitempty\")\n\t}\n\n\treturn omitempty\n}", "title": "" }, { "docid": "3cab486273cc05b9e8f3a291e59b0aa4", "score": "0.513967", "text": "func (r *MockedHTTPRequest) Method() string {\n\tif r.MockedMethod != nil {\n\t\treturn r.MockedMethod()\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "0fd6d01af7bd57516287f5222b96a673", "score": "0.5138414", "text": "func (w NewsRemoteData) GetMethod() string {\n\treturn \"GET\"\n}", "title": "" }, { "docid": "51b0032468ee7f2e0c31727d415237b6", "score": "0.51266456", "text": "func (c *Cmd) Method() string {\n\treturn c.M\n}", "title": "" }, { "docid": "e43c5d329b18a634276945a728d219cb", "score": "0.51216197", "text": "func (u Update) Method() string {\n\tif u.Message != nil {\n\t\tif u.Message.ReplyToMessage != nil {\n\t\t\treturn Reply\n\t\t} else if u.Message.Photo != nil {\n\t\t\treturn Photo\n\t\t}\n\t\treturn Message\n\t} else if u.CallbackQuery != nil {\n\t\treturn CallbackQuery\n\t} else if u.ShippingQuery != nil {\n\n\t\treturn ShippingQuery\n\t\t//c.Text == ?\n\t} else if u.PreCheckoutQuery != nil {\n\t\treturn PreCheckoutQuery\n\t} else if u.InlineQuery != nil {\n\t\treturn InlineQuery\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "5e5f6b2537132664b24cb653f1667f9f", "score": "0.5121177", "text": "func (e ProductServiceGetSingleRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "dd848692ea86a2a1e272311da69b55c4", "score": "0.51157045", "text": "func (m *TaskCreate) Field(fieldpath []string) (string, bool) {\n\tif len(fieldpath) == 0 {\n\t\treturn \"\", false\n\t}\n\n\tswitch fieldpath[0] {\n\t// unhandled: rootfs\n\t// unhandled: pid\n\tcase \"container_id\":\n\t\treturn string(m.ContainerID), len(m.ContainerID) > 0\n\tcase \"bundle\":\n\t\treturn string(m.Bundle), len(m.Bundle) > 0\n\tcase \"io\":\n\t\t// NOTE(stevvooe): This is probably not correct in many cases.\n\t\t// We assume that the target message also implements the Field\n\t\t// method, which isn't likely true in a lot of cases.\n\t\t//\n\t\t// If you have a broken build and have found this comment,\n\t\t// you may be closer to a solution.\n\t\tif m.IO == nil {\n\t\t\treturn \"\", false\n\t\t}\n\n\t\treturn m.IO.Field(fieldpath[1:])\n\tcase \"checkpoint\":\n\t\treturn string(m.Checkpoint), len(m.Checkpoint) > 0\n\t}\n\treturn \"\", false\n}", "title": "" }, { "docid": "dd848692ea86a2a1e272311da69b55c4", "score": "0.51157045", "text": "func (m *TaskCreate) Field(fieldpath []string) (string, bool) {\n\tif len(fieldpath) == 0 {\n\t\treturn \"\", false\n\t}\n\n\tswitch fieldpath[0] {\n\t// unhandled: rootfs\n\t// unhandled: pid\n\tcase \"container_id\":\n\t\treturn string(m.ContainerID), len(m.ContainerID) > 0\n\tcase \"bundle\":\n\t\treturn string(m.Bundle), len(m.Bundle) > 0\n\tcase \"io\":\n\t\t// NOTE(stevvooe): This is probably not correct in many cases.\n\t\t// We assume that the target message also implements the Field\n\t\t// method, which isn't likely true in a lot of cases.\n\t\t//\n\t\t// If you have a broken build and have found this comment,\n\t\t// you may be closer to a solution.\n\t\tif m.IO == nil {\n\t\t\treturn \"\", false\n\t\t}\n\n\t\treturn m.IO.Field(fieldpath[1:])\n\tcase \"checkpoint\":\n\t\treturn string(m.Checkpoint), len(m.Checkpoint) > 0\n\t}\n\treturn \"\", false\n}", "title": "" }, { "docid": "c5451abc6ef556a9afc9d57df7410a6d", "score": "0.5105719", "text": "func (e ProductServiceGetResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "05718a57f1e0f45c8d56d59abc85f28e", "score": "0.51056165", "text": "func (h *httpHandler) Method() string {\n\treturn http.MethodGet\n}", "title": "" }, { "docid": "0c9e25bc0b4fc621cbae1acbcc36c631", "score": "0.5098179", "text": "func (h Method) String() string {\n\treturn string(h)\n}", "title": "" }, { "docid": "e90f1b51bc5ad21c8d9d2ea25ea21608", "score": "0.50965405", "text": "func (obj *Var) IsField() bool {}", "title": "" }, { "docid": "0bcf484a9f28a52c129c8c3e9f884316", "score": "0.5095623", "text": "func (e CreatPbName__RequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "1f5bd5820cd43f03a04e94af21e844ac", "score": "0.50941294", "text": "func (c MethodsCollection) FieldGet() pFieldGet {\n\treturn pFieldGet{\n\t\tMethod: c.MustGet(\"FieldGet\"),\n\t}\n}", "title": "" }, { "docid": "0048b7749fb23af7dba952bd182191ab", "score": "0.50909466", "text": "func (body GETReadBrandRequest) Method() string {\n\treturn \"GET\"\n}", "title": "" }, { "docid": "0d80614fb60c71afc3df8de8ad423710", "score": "0.5090445", "text": "func (c *ClassInstance) Get(name token.Token) (interface{}, error) {\n\tif v, prs := c.fields[name.Lexeme]; prs {\n\t\treturn v, nil\n\t}\n\n\tm, err := c.Class.FindMethod(name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnewMethod := m.Bind(c)\n\tif newMethod.Definition.IsProperty() {\n\t\treturn newMethod.Call(nil)\n\t}\n\treturn m.Bind(c), nil\n}", "title": "" }, { "docid": "96953f35ee37c5677cf4f6b16a2d4f07", "score": "0.5086816", "text": "func (s *FakeState) Method() auth.Method {\n\treturn s.Authenticator().Methods[0]\n}", "title": "" }, { "docid": "96953f35ee37c5677cf4f6b16a2d4f07", "score": "0.5086816", "text": "func (s *FakeState) Method() auth.Method {\n\treturn s.Authenticator().Methods[0]\n}", "title": "" }, { "docid": "e2bc86c61c13b8e12f23f7e03b8cf258", "score": "0.5085193", "text": "func (o ServiceVclHealthcheckOutput) Method() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ServiceVclHealthcheck) *string { return v.Method }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "d6fbc3c51f0d616cd172d3103be6363b", "score": "0.5082821", "text": "func (h *HTTPHandler) Method() string {\n\treturn h.method\n}", "title": "" }, { "docid": "decb73985d21540ebe35aafe8e83e468", "score": "0.5078051", "text": "func (t *T) Method0() string {\n\treturn \"M0\"\n}", "title": "" }, { "docid": "5b4f7ff31b212c9d0c08be56399faee1", "score": "0.50682074", "text": "func (e SimulateMetadataParamsValidationError) Field() string { return e.field }", "title": "" }, { "docid": "9dce0c0a45ddf9b93864cafd355f1ebb", "score": "0.505792", "text": "func getFieldSqlType(c *parseContext, field reflect.StructField) (string, bool) {\n\tlookup, ok := field.Tag.Lookup(tagSqlField)\n\tif ok {\n\t\tif lookup == tagIgnore {\n\t\t\treturn \"\", false\n\t\t}\n\t\ttag, _ := parseTag(lookup)\n\t\tlogger.Infof(\"get sqlType: %v of field: %v\", tag, field.Name)\n\t\treturn tag, true\n\t}\n\tfuncName := buildFuncByFieldName(field.Name)\n\tt := *c.fieldOfStruct\n\tmethod, found := t.MethodByName(funcName)\n\tif !found {\n\t\tlogger.Warnf(\"on type: %v not found tag: %v of field and not found method: %v\", (*c.fieldOfStruct).Name(), tagSqlField, funcName)\n\t\treturn \"\", false\n\t} else if method.Type.NumOut() != 1 {\n\t\tlogger.Errorf(\"method: %v's out number is not 1\", funcName)\n\t\treturn \"\", false\n\t} else if method.Type.Out(0).Kind() != reflect.String {\n\t\tlogger.Errorf(\"method: %v's out kind is not string\", funcName)\n\t\treturn \"\", false\n\t}\n\t//else if method.Type.NumIn() > 1 {\n\t//\tbuilder := strings.Builder{}\n\t//\tdelimiter := \"\"\n\t//\tfor i := 0; i < method.Type.NumIn(); i++ {\n\t//\t\tbuilder.WriteString(delimiter)\n\t//\t\tbuilder.WriteString(fmt.Sprintf(\"%v\", method.Type.In(i).String()))\n\t//\t\tdelimiter = \", \"\n\t//\t}\n\t//\tlogger.Errorf(\"method: %v's input args num is not zero, actual: %v args: %v\", funcName, method.Type.NumIn(), builder.String())\n\t//\t//return \"\", false\n\t//}\n\tlogger.Warnf(\"found method: %v\", method)\n\n\tin := make([]reflect.Value, 0)\n\tfor i := 0; i < method.Type.NumIn(); i++ {\n\t\tmt := method.Type.In(i)\n\t\tvalue := reflect.New(mt)\n\t\tin = append(in, value.Elem())\n\t}\n\n\tcall := method.Func.Call(in)\n\tif len(call) != 1 {\n\t\tlogger.Errorf(\"\")\n\t\treturn \"\", false\n\t}\n\tvalue := call[0].String()\n\tlogger.Infof(\"get sqlType: %v by func: %v\", value, funcName)\n\n\t// get type by func\n\treturn value, true\n}", "title": "" }, { "docid": "afd8744b7d971656b206d19a5d0787e2", "score": "0.50565475", "text": "func (e RetrieveAttributeDatasRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "02b7f97c74c871a3d896b64f2616bdc8", "score": "0.50528294", "text": "func (e GetRepositoryReqValidationError) Field() string { return e.field }", "title": "" }, { "docid": "c7b4475c25036bb95e07ecf0ec54b4da", "score": "0.50525755", "text": "func (q *Query) Method() string {\n\treturn q.Request.Method\n}", "title": "" }, { "docid": "0b8805aaae87ba1dc7e97dc8e1620dac", "score": "0.5051745", "text": "func (m *Measurement) Method() string {\n return m.data.Method\n}", "title": "" }, { "docid": "a9d645ed665aa141a4684b9b23e9240d", "score": "0.50501966", "text": "func (request *CreateTopicRequest) GetMethod() string {\n\treturn util.POST\n}", "title": "" }, { "docid": "6def6befec009e0b6b2717f58d4a7ec2", "score": "0.50488687", "text": "func (m pFieldsViewGet) Underlying() *models.Method {\n\treturn m.Method\n}", "title": "" }, { "docid": "748a9947621412459cf9db2fcfc134e4", "score": "0.5047059", "text": "func (r Request) Method() string {\n\treturn r.Req.Method\n}", "title": "" }, { "docid": "709a208fb6b9188eefd7aae0522a4a10", "score": "0.5041784", "text": "func (r *Request) Method() string {\n\treturn string(r.method)\n}", "title": "" }, { "docid": "f24935d000703b68f10f3f66f66a2972", "score": "0.50373966", "text": "func (e RetrieveAttributeSchemasRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "c16dcfc1006f55ab79c778502e55b740", "score": "0.503556", "text": "func (e ProductServiceGetSingleResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "4f871db3211f0ff2f465c2c25bd1bebd", "score": "0.50342363", "text": "func (r *Request) GetMethod() string {\n\treturn r.method\n}", "title": "" }, { "docid": "51248dee2022213621af424fa38f4d49", "score": "0.50311613", "text": "func (a Analyzer) getField(t reflect.Type, path []string) (reflect.StructField, bool) {\n\tswitch t.Kind() {\n\tcase reflect.Ptr:\n\t\treturn a.getField(t.Elem(), path)\n\tcase reflect.Slice:\n\t\treturn a.getField(t.Elem(), path[1:])\n\tdefault:\n\t\t{\n\t\t\tif field, ok := t.FieldByName(path[0]); ok && a.hasNestedFields(field.Type) && len(path) > 1 {\n\t\t\t\treturn a.getField(field.Type, path[1:])\n\t\t\t} else {\n\t\t\t\treturn field, ok\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d1f13f16b47d1509286c3a5e4c0fb328", "score": "0.5023627", "text": "func (err *internalStructFieldWrongType) BadRequest() {\n // Nothing here.\n}", "title": "" }, { "docid": "2f866f5699d7b0f5edf44b415e8a3689", "score": "0.5022677", "text": "func (r *Request) Method() string {\n\treturn r.method\n}", "title": "" }, { "docid": "52d05d6f2e834d26e6d6979f4b58bcab", "score": "0.50170326", "text": "func (e CreateTargetOfEvaluationRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "529b13404e857ff3208284c6a103024c", "score": "0.5013588", "text": "func (e GetPbName__RequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "5f4e4d396508d4a0aa177b81f29a1a33", "score": "0.5010444", "text": "func (s *ServiceExpr) Method(n string) *MethodExpr {\n\tfor _, m := range s.Methods {\n\t\tif m.Name == n {\n\t\t\treturn m\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "750aaee5651188166c797bbed8555c6f", "score": "0.50023293", "text": "func (e GetContractsRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "c643bd0afe439bd5dc8e7ec0d3e2a6c4", "score": "0.50014746", "text": "func (e GetRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "4d270e1d389175308c4b84faf0e945fb", "score": "0.5000392", "text": "func (e RetrieveAttributeDatasResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "352715d0a3ee3ec074689622bc2bde62", "score": "0.49999115", "text": "func (o ServiceComputeLoggingHttpOutput) Method() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ServiceComputeLoggingHttp) *string { return v.Method }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "4a850d3303f78c9873f37f43ab8c73fa", "score": "0.4997505", "text": "func (request *SubscribeRequest) GetMethod() string {\n\treturn util.POST\n}", "title": "" }, { "docid": "8ddc4f9064c40f1aa84a7324a3588bb4", "score": "0.49926776", "text": "func (w *WebCAS) Method() string {\n\treturn http.MethodGet\n}", "title": "" }, { "docid": "385d08ff0972bd6cd1d424bc48ec3886", "score": "0.49919334", "text": "func (e CreatPbName__ResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "eaa70d15fe787c2fb6dda7b0ffacd7ee", "score": "0.49898005", "text": "func (o *WafEventRequest) GetMethodOk() (*string, bool) {\n\tif o == nil || o.Method == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Method, true\n}", "title": "" }, { "docid": "0cb362eebac7b881d330896905d44377", "score": "0.49884242", "text": "func (e ReadLifecycleRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "87c288b46085810badfa8d0552240a7a", "score": "0.49853948", "text": "func (rd *rdParser) method(name string) (*Method, error) {\n\trd.logf(\"method(%q)\", name)\n\trd.indent()\n\tdefer rd.dedent()\n\tm := &Method{Name: name}\n\tvar err error\n\n\t// Parse formals\n\trd.logf(\"formals\")\n\trd.indent()\n\tfor {\n\t\ti := rd.next()\n\t\tif i.typ == ')' {\n\t\t\tbreak\n\t\t}\n\t\tf := &Formal{}\n\t\tif i.typ != OBJECTID {\n\t\t\trd.error(\"syntax error\")\n\t\t\treturn nil, fmt.Errorf(\"Parsing formals of %s, expected OBJECTID; got %s\", m.Name, typDebug(i))\n\t\t}\n\t\tf.Name = i.val\n\t\ti = rd.next()\n\t\tif i.typ != ':' {\n\t\t\trd.error(\"syntax error\")\n\t\t\treturn nil, fmt.Errorf(\"Parsing formals of %s, expected colon; got %s\", m.Name, typDebug(i))\n\t\t}\n\t\ti = rd.next()\n\t\tif i.typ != TYPEID {\n\t\t\trd.error(\"syntax error\")\n\t\t\treturn nil, fmt.Errorf(\"Parsing formals of %s, expected type name after colon; got %s\", m.Name, typDebug(i))\n\t\t}\n\t\tf.Type = i.val\n\t\tf.Line = rd.line()\n\t\tm.Formals = append(m.Formals, f)\n\t\trd.logf(\"%s: %s\", f.Name, f.Type)\n\n\t\ti = rd.next()\n\t\tif i.typ == ')' {\n\t\t\tbreak\n\t\t}\n\t\tif i.typ != ',' {\n\t\t\trd.error(\"syntax error\")\n\t\t\treturn nil, fmt.Errorf(\"Parsing formals of %s, comma or close paren after formal; got %s\", m.Name, typDebug(i))\n\t\t}\n\t}\n\trd.dedent()\n\trd.logf(\"/formals\")\n\ti := rd.next()\n\tif i.typ != ':' {\n\t\trd.error(\"syntax error\")\n\t\treturn nil, fmt.Errorf(\"Method definitions expecting colon; got %s\", typDebug(i))\n\t}\n\ti = rd.next()\n\tif i.typ != TYPEID {\n\t\trd.error(\"syntax error\")\n\t\treturn nil, fmt.Errorf(\"Method definition expecting type after colon; got %s\", typDebug(i))\n\t}\n\tm.Type = i.val\n\n\ti = rd.next()\n\tif i.typ != '{' {\n\t\trd.error(\"syntax error\")\n\t\treturn nil, fmt.Errorf(\"Method definition expecting opening brace; got %s\", typDebug(i))\n\t}\n\n\tm.Expr, err = rd.expr()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ti = rd.next()\n\tif i.typ != '}' {\n\t\trd.error(\"syntax error\")\n\t\treturn nil, fmt.Errorf(\"Method definition expecting closing brace; got %s\", typDebug(i))\n\t}\n\n\ti = rd.next()\n\tif i.typ != ';' {\n\t\trd.error(\"syntax error\")\n\t\treturn nil, fmt.Errorf(\"Method definitions end with semicolon; got %s\", typDebug(i))\n\t}\n\tm.Line = rd.line()\n\treturn m, nil\n}", "title": "" }, { "docid": "82c86fa2cda0420cedd967ee78c1a966", "score": "0.4973676", "text": "func (e ReadLifecycleResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "0ff7535f5096b25571529246309006b0", "score": "0.49711385", "text": "func (o TriggerHttpRequestOutput) Method() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *TriggerHttpRequest) pulumi.StringPtrOutput { return v.Method }).(pulumi.StringPtrOutput)\n}", "title": "" } ]
cd9e6e9764ea7d508151a01575d3f468
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FederationDomain.
[ { "docid": "0806329286614efb4433bbc98f25a63a", "score": "0.9000195", "text": "func (in *FederationDomain) DeepCopy() *FederationDomain {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FederationDomain)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" } ]
[ { "docid": "de91bf432eca1300f765e4e7894a8d51", "score": "0.73272556", "text": "func (in *FederationDomainList) DeepCopy() *FederationDomainList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FederationDomainList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "a0942a53e84e8048a5f86deb1a98a0ae", "score": "0.7151845", "text": "func (in *FederationDomainSpec) DeepCopy() *FederationDomainSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FederationDomainSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "a72b881103f184ecda3e05210d7e8275", "score": "0.6798491", "text": "func (in *FederationDomainSecrets) DeepCopy() *FederationDomainSecrets {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FederationDomainSecrets)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "d2ab2a03f3ba722f6b61270040f714b3", "score": "0.5993998", "text": "func (in *FederationDomainTLSSpec) DeepCopy() *FederationDomainTLSSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FederationDomainTLSSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "a8cd5e87c807746891ac2a15f92ba0b2", "score": "0.59025323", "text": "func (in *FederationDomainStatus) DeepCopy() *FederationDomainStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FederationDomainStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "cc85012e766ead51be2092b764955e82", "score": "0.5768678", "text": "func (in *DroneFederatedDeployment) DeepCopy() *DroneFederatedDeployment {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DroneFederatedDeployment)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "33c10174b4ed5103ea515f903231f278", "score": "0.5596499", "text": "func (s *Schema) Federation() *Object {\n\tq := s.Query()\n\tif _, ok := q.Methods[\"__federation\"]; !ok {\n\t\tq.FieldFunc(\"__federation\", func() federation { return federation{} })\n\t}\n\treturn s.Object(\"Federation\", federation{})\n}", "title": "" }, { "docid": "e8e8487088866f13aea8ae7ba04fa335", "score": "0.5488647", "text": "func (in *SpaceDomain) DeepCopy() *SpaceDomain {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SpaceDomain)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "77aca9e58f9ac8bf92ca819bea732c64", "score": "0.5449541", "text": "func (in *DroneFederatedDeploymentList) DeepCopy() *DroneFederatedDeploymentList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DroneFederatedDeploymentList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "e8d1eca56a6c3cc955e9d884b4fba7ac", "score": "0.54238355", "text": "func (in *DnsDomain) DeepCopy() *DnsDomain {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DnsDomain)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "55dc822391fcf49885dac02c4986dbce", "score": "0.5404386", "text": "func NewDomainF(format string, a ...interface{}) E {\n\treturn newInfrastructure(fmt.Sprintf(format, a...), 1)\n}", "title": "" }, { "docid": "6b9be05e4a57467546470fd2dc14ced2", "score": "0.5065874", "text": "func (_options *CreateEnterpriseOptions) SetDomain(domain string) *CreateEnterpriseOptions {\n\t_options.Domain = core.StringPtr(domain)\n\treturn _options\n}", "title": "" }, { "docid": "ae84ebc1f280d918c0bff18c244120e3", "score": "0.5019118", "text": "func (_options *UpdateEnterpriseOptions) SetDomain(domain string) *UpdateEnterpriseOptions {\n\t_options.Domain = core.StringPtr(domain)\n\treturn _options\n}", "title": "" }, { "docid": "9e753abd2f784fa15bdd9bc0c707ccee", "score": "0.4997899", "text": "func (in SpaceDomains) DeepCopy() SpaceDomains {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SpaceDomains)\n\tin.DeepCopyInto(out)\n\treturn *out\n}", "title": "" }, { "docid": "39fbe0366a69f2eee5501cf37343568a", "score": "0.49304634", "text": "func (in *DroneFederatedDeploymentSpec) DeepCopy() *DroneFederatedDeploymentSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DroneFederatedDeploymentSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "92eada8bc60afb151113314e505fece2", "score": "0.4920965", "text": "func NewDomain(value string) *Domain {\n\tthis := Domain{}\n\tthis.Value = value\n\treturn &this\n}", "title": "" }, { "docid": "905a5fe1206e30d996c3519d7919af8a", "score": "0.4831682", "text": "func (in *DnsDomainList) DeepCopy() *DnsDomainList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DnsDomainList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "1eeafa7418422fb14dea2d74b53a4ccf", "score": "0.4793368", "text": "func (o *DeliveryCreateSiteDeliveryDomainResponse) GetDomain() SchemadeliveryDeliveryDomain {\n\tif o == nil || o.Domain == nil {\n\t\tvar ret SchemadeliveryDeliveryDomain\n\t\treturn ret\n\t}\n\treturn *o.Domain\n}", "title": "" }, { "docid": "5a8fa1d9f5ba1d3eba36ca4c8685074f", "score": "0.4775023", "text": "func (s *Handler) SetDomain(d string) error {\n\tdomain := models.DomainModel{primitive.NewObjectID(), primitive.NilObjectID, d}\n\ts.Domain = domain\n\treturn nil\n}", "title": "" }, { "docid": "434e0c1656ff76346ad21b282470b8d4", "score": "0.4765859", "text": "func (g *LiveDNS) GetDomain(fqdn string) (domain Domain, err error) {\n\t_, err = g.client.Get(\"domains/\"+fqdn, nil, &domain)\n\treturn\n}", "title": "" }, { "docid": "b8fb62a6c0c1da25028fe73a76292045", "score": "0.47613925", "text": "func (s *FSxWindowsFileServerAuthorizationConfig) SetDomain(v string) *FSxWindowsFileServerAuthorizationConfig {\n\ts.Domain = &v\n\treturn s\n}", "title": "" }, { "docid": "a79430dce237d5ef15197b7b089e1722", "score": "0.47553182", "text": "func (cookie *Cookie) Domain(domain string) *Cookie {\n\tcookie.domain = &domain\n\treturn cookie\n}", "title": "" }, { "docid": "5bf3c7c201f11b8e888f3af410d12777", "score": "0.4745221", "text": "func (g *Gandi) GetDomain(fqdn string) (domain Domain, err error) {\n\t_, err = g.askGandi(mGET, \"domains/\"+fqdn, nil, &domain)\n\treturn\n}", "title": "" }, { "docid": "a7223e93806ae772e00935c3093b9b1c", "score": "0.47272274", "text": "func CopyFederationData(from Federable, to Federable) {\n\tif !from.IsFederated() {\n\t\tto.SetUnfederated()\n\t\treturn\n\t}\n\n\tif reply, ok := from.FederationReplyTo(); ok {\n\t\tto.SetFederationReplyTo(reply)\n\t}\n\n\tif req, ok := from.FederationRequestID(); ok {\n\t\tto.SetFederationRequestID(req)\n\t}\n\n\tif targets, ok := from.FederationTargets(); ok {\n\t\tto.SetFederationTargets(targets)\n\t}\n\n\tfor _, hop := range from.NetworkHops() {\n\t\tto.RecordNetworkHop(hop[0], hop[1], hop[2])\n\t}\n}", "title": "" }, { "docid": "0ad502a40d1f6dcaad20acedaeb94c15", "score": "0.47195792", "text": "func (s *PollForDecisionTaskInput) SetDomain(v string) *PollForDecisionTaskInput {\n\ts.Domain = &v\n\treturn s\n}", "title": "" }, { "docid": "5450269fcca236ddc8ed6a6a2959e314", "score": "0.47113058", "text": "func NewDomain(dom string) *Domain {\n\treturn &Domain{dom}\n}", "title": "" }, { "docid": "5c24779e979bf995091358bca27d1bd0", "score": "0.47018567", "text": "func (config *DNSConfig) DomainContainingFQDN(fqdn string) *DomainConfig {\n\tfqdn = strings.TrimSuffix(fqdn, \".\")\n\tlongestLength := 0\n\tvar d *DomainConfig\n\tfor _, dom := range config.Domains {\n\t\tif (dom.Name == fqdn || strings.HasSuffix(fqdn, \".\"+dom.Name)) && len(dom.Name) > longestLength {\n\t\t\tlongestLength = len(dom.Name)\n\t\t\td = dom\n\t\t}\n\t}\n\treturn d\n}", "title": "" }, { "docid": "82254865dbb2b02e27274ab857483a45", "score": "0.46897355", "text": "func New(apikey string, sharingid string, debug bool, dryRun bool) *Domain {\n\tclient := client.New(apikey, sharingid, debug, dryRun)\n\tclient.SetEndpoint(\"domain/\")\n\treturn &Domain{client: *client}\n}", "title": "" }, { "docid": "6b71e3d2b9847215a9c2a2f00afe2a42", "score": "0.4688357", "text": "func (in *DomainName) DeepCopy() *DomainName {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DomainName)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "94da4c8761c9c36f47f672bb31acf7d6", "score": "0.46779162", "text": "func (d *InfoOutput) FacterDomain() string {\n\tval := d.reply[\"facter_domain\"]\n\n\treturn val.(string)\n\n}", "title": "" }, { "docid": "9e50b8c03948747627d0793a440bb227", "score": "0.46666825", "text": "func NewDomain(\n\tc *Configuration,\n\tfolder string,\n\tconfigFile *os.File) (*Domain, error) {\n\tvar err error\n\n\t// Read the configuration file into the domain data structure.\n\tvar d Domain\n\tdefer configFile.Close()\n\tjsonParser := json.NewDecoder(configFile)\n\tjsonParser.Decode(&d)\n\n\t// Add some additional parameters.\n\td.Config = c\n\td.Host = filepath.Base(folder)\n\td.folder = folder\n\td.templates, err = d.parseHTML()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\td.owidStore = c.owid\n\treturn &d, nil\n}", "title": "" }, { "docid": "5e77ae2a65a02b2fe6607302d5ec0e02", "score": "0.46572646", "text": "func (a *app) NewDomain(name string, delegate Delegate) Domain {\n\tDebug(\"Creating domain %s\", name)\n\td := &domain{\n\t\tapp: a,\n\t\tDelegate: delegate,\n\t\tname: name,\n\t\tjoined: false,\n\t\tsubscriptions: make(map[uint]*boundEndpoint),\n\t\tregistrations: make(map[uint]*boundEndpoint),\n\t}\n\n\t// TODO: trigger onJoin if the superdomain has joined\n\n\ta.domains = append(a.domains, d)\n\treturn d\n}", "title": "" }, { "docid": "a9b9a5038ea7c9ce5dac8c481c0c5f0d", "score": "0.46450052", "text": "func (o *IamLdapBasePropertiesAllOf) SetDomain(v string) {\n\to.Domain = &v\n}", "title": "" }, { "docid": "43358f556a0a5704202b611a43b376ee", "score": "0.46381727", "text": "func (o LookupDatasetGroupResultOutput) Domain() DatasetGroupDomainPtrOutput {\n\treturn o.ApplyT(func(v LookupDatasetGroupResult) *DatasetGroupDomain { return v.Domain }).(DatasetGroupDomainPtrOutput)\n}", "title": "" }, { "docid": "8f5d308f2aa70317de44bb03bef7e1ee", "score": "0.4633613", "text": "func NewDomain(domain string) *Domain {\n\td := Domain{\n\t\tdomain: []byte(domain),\n\t\tchecks: make(map[string]interface{}),\n\t}\n\treturn &d\n}", "title": "" }, { "docid": "12473068fdd4378a0cbe30e2872d25a2", "score": "0.4633153", "text": "func (o GetResolverFirewallRulesFirewallRuleOutput) FirewallDomainListId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetResolverFirewallRulesFirewallRule) string { return v.FirewallDomainListId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "ff9e3c0c86c6ac4d5d5297a915f55a41", "score": "0.4632465", "text": "func (c *Cookie) SetDomain(domain string) {\n\tc.domain = domain\n}", "title": "" }, { "docid": "2c00cef2e50a55882188941ad1e3fd14", "score": "0.46285388", "text": "func (s *RecommendationJobContainerConfig) SetDomain(v string) *RecommendationJobContainerConfig {\n\ts.Domain = &v\n\treturn s\n}", "title": "" }, { "docid": "eb2671fc33b56341dc5f4bd594a9a6a9", "score": "0.46228322", "text": "func (s *ShortURLService) SetDomain(shortURL *models.ShortURL, domainAuthority string) error {\n\tvar domain models.Domain\n\n\ts.DB.Where(models.Domain{Authority: domainAuthority}).FirstOrCreate(&domain)\n\n\tshortURL.DomainID = domain.ID\n\n\treturn nil\n}", "title": "" }, { "docid": "b2811697e4af948792fece606e4b9e87", "score": "0.4622016", "text": "func SetFQDN(domain string) string {\n\tif !strings.HasSuffix(domain, \".\") {\n\t\tdomain += \".\"\n\t}\n\n\treturn domain\n}", "title": "" }, { "docid": "b992a3ec97f46c5f1ab590c24c03e531", "score": "0.4602682", "text": "func (s *API) TransferDomain(req *TransferDomainRequest, opts ...scw.RequestOption) (*Domain, error) {\n\tvar err error\n\n\tif req.OrganizationID == \"\" {\n\t\tdefaultOrganizationID, _ := s.client.GetDefaultOrganizationID()\n\t\treq.OrganizationID = defaultOrganizationID\n\t}\n\n\tscwReq := &scw.ScalewayRequest{\n\t\tMethod: \"POST\",\n\t\tPath: \"/domain/v2alpha2/domains/transfer\",\n\t\tHeaders: http.Header{},\n\t}\n\n\terr = scwReq.SetBody(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar resp Domain\n\n\terr = s.client.Do(scwReq, &resp, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resp, nil\n}", "title": "" }, { "docid": "30db5ff977555f05f55bba3c45775d21", "score": "0.4597841", "text": "func (c *Cookie) Domain(domain string) *Cookie { c.domain = domain; return c }", "title": "" }, { "docid": "71f50140748366f699054cf551178c6a", "score": "0.45723167", "text": "func (s *FirewallRule) SetFirewallDomainListId(v string) *FirewallRule {\n\ts.FirewallDomainListId = &v\n\treturn s\n}", "title": "" }, { "docid": "dff32ad3d5689ebfb08e78f6057aab20", "score": "0.45672768", "text": "func (o *DeliveryCreateSiteDeliveryDomainResponse) SetDomain(v SchemadeliveryDeliveryDomain) {\n\to.Domain = &v\n}", "title": "" }, { "docid": "87763ad88c56e9ea5f8c92c3162c18e0", "score": "0.4560548", "text": "func (in *ExternalDNSDomain) DeepCopy() *ExternalDNSDomain {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ExternalDNSDomain)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "387f8ac1b751b235aab16c6d62f4c345", "score": "0.45577213", "text": "func (s *CookieSpecification) SetDomain(v string) *CookieSpecification {\n\ts.Domain = &v\n\treturn s\n}", "title": "" }, { "docid": "400ecf1bf8df47f79c71df5d95f22ba5", "score": "0.45526925", "text": "func (in *DroneFederatedDeploymentPlacement) DeepCopy() *DroneFederatedDeploymentPlacement {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DroneFederatedDeploymentPlacement)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "2197fb1f168621bdf44b44ccd5823d36", "score": "0.45445114", "text": "func (o *NotificationConfig) SetDomain(v string) {\n\to.Domain = &v\n}", "title": "" }, { "docid": "a934dc92515a425eb58b446fa1b13457", "score": "0.4529766", "text": "func (s *ModelMetadataSummary) SetDomain(v string) *ModelMetadataSummary {\n\ts.Domain = &v\n\treturn s\n}", "title": "" }, { "docid": "8a3cefe62086389d6b78c5a445b877a9", "score": "0.45296454", "text": "func (s *DescribeModelPackageOutput) SetDomain(v string) *DescribeModelPackageOutput {\n\ts.Domain = &v\n\treturn s\n}", "title": "" }, { "docid": "6f0e1ee13e1899e98d3ed172b7345bbc", "score": "0.4528398", "text": "func (ce *ConcreteExecution) GetDomainID() string {\n\treturn ce.DomainID\n}", "title": "" }, { "docid": "6d09a093d6225b2d03decac7a9c78e59", "score": "0.4517987", "text": "func (s *CreateFirewallRuleInput) SetFirewallDomainListId(v string) *CreateFirewallRuleInput {\n\ts.FirewallDomainListId = &v\n\treturn s\n}", "title": "" }, { "docid": "d7ecce5513eaf36c05c62b5236f12968", "score": "0.45171854", "text": "func (s *ValidateService) Df(df string) *ValidateService {\n\ts.df = df\n\treturn s\n}", "title": "" }, { "docid": "246d5854c8ccd4d6202cdec4e29a45c1", "score": "0.45132226", "text": "func (in *DroneFederatedDeploymentOverrides) DeepCopy() *DroneFederatedDeploymentOverrides {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DroneFederatedDeploymentOverrides)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "401ba4e370eb1b5c2c52a8a3e66bb221", "score": "0.44869968", "text": "func (s *UpdateFirewallRuleInput) SetFirewallDomainListId(v string) *UpdateFirewallRuleInput {\n\ts.FirewallDomainListId = &v\n\treturn s\n}", "title": "" }, { "docid": "37518b784e6889e763376a465cd537c7", "score": "0.44858673", "text": "func (s *DeleteFirewallRuleInput) SetFirewallDomainListId(v string) *DeleteFirewallRuleInput {\n\ts.FirewallDomainListId = &v\n\treturn s\n}", "title": "" }, { "docid": "44f5ca6b61c1e7601566aee955709b34", "score": "0.4477634", "text": "func (in *SearchDomain) DeepCopy() *SearchDomain {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SearchDomain)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "5ff4c3d10acb62e05a67c1146e83d0ee", "score": "0.44770092", "text": "func (s *ProvisionedServer) FQDN(domain string) string {\n\treturn FQDN(domain, s.Server.Hostname, s.AdvertiseIP)\n}", "title": "" }, { "docid": "c9a6f0984f65e33d2f9e0214c8da31bf", "score": "0.44647032", "text": "func NewInternalDomainFederation()(*InternalDomainFederation) {\n m := &InternalDomainFederation{\n SamlOrWsFedProvider: *NewSamlOrWsFedProvider(),\n }\n odataTypeValue := \"#microsoft.graph.internalDomainFederation\"\n m.SetOdataType(&odataTypeValue)\n return m\n}", "title": "" }, { "docid": "05fcac7108b91f01313127901324c6f2", "score": "0.4462447", "text": "func (s *ModelPackage) SetDomain(v string) *ModelPackage {\n\ts.Domain = &v\n\treturn s\n}", "title": "" }, { "docid": "52cc4ef970189899ca0054b30ab0628f", "score": "0.4449399", "text": "func (s *CreateModelPackageInput) SetDomain(v string) *CreateModelPackageInput {\n\ts.Domain = &v\n\treturn s\n}", "title": "" }, { "docid": "2069408f858144bd2e2e78a8da4e3a94", "score": "0.4446128", "text": "func NewDomain(name ...string) *Domain {\n\td := new(Domain)\n\tif len(name) > 0 {\n\t\td.SetName(name[0])\n\t}\n\treturn d\n}", "title": "" }, { "docid": "521b7536d3f9e136d8391483f862c735", "score": "0.4445419", "text": "func (o NetworkOutput) DnsDomain() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Network) pulumi.StringOutput { return v.DnsDomain }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "6fddd2e6e147b08f9971f7ee0576b91f", "score": "0.44423372", "text": "func (o DnsRecordOutput) Domain() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *DnsRecord) pulumi.StringOutput { return v.Domain }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "a9ee1e56f18d28fbee67fd082bf198b2", "score": "0.44378224", "text": "func LookupDomain(d string) LookupOption {\n\treturn func(o *LookupOptions) {\n\t\to.Domain = d\n\t}\n}", "title": "" }, { "docid": "26c2a551e107f981faa92f3bc8aeed2e", "score": "0.44368517", "text": "func (s *ResolverRule) SetDomainName(v string) *ResolverRule {\n\ts.DomainName = &v\n\treturn s\n}", "title": "" }, { "docid": "26c2a551e107f981faa92f3bc8aeed2e", "score": "0.44368517", "text": "func (s *ResolverRule) SetDomainName(v string) *ResolverRule {\n\ts.DomainName = &v\n\treturn s\n}", "title": "" }, { "docid": "4cfe1b29a8ad6b937b9b27b206b70652", "score": "0.44347224", "text": "func NewDomain(ctx *pulumi.Context,\n\tname string, args *DomainArgs, opts ...pulumi.ResourceOption) (*Domain, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.DomainName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'DomainName'\")\n\t}\n\tif args.Sources == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'Sources'\")\n\t}\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource Domain\n\terr := ctx.RegisterResource(\"alicloud:dcdn/domain:Domain\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "491957d6ba28b00a040f23c44728fb5c", "score": "0.44315502", "text": "func NewDomain(domain string) Domain {\n\treturn Domain{\n\t\tDomainName: domain,\n\t\tServersChanged: \"\",\n\t\tSslGrade: \"\",\n\t\tPreviousSslGrade: \"\",\n\t\tLogo: \"\",\n\t\tTitle: \"\",\n\t\tIsDown: false,\n\t\tState: \"I\"}\n}", "title": "" }, { "docid": "5f93b97d84d3c906f5d6306db5b32688", "score": "0.44312188", "text": "func (l *Locale) SetDomain(dom string) {\n\tl.Lock()\n\tl.defaultDomain = dom\n\tl.Unlock()\n}", "title": "" }, { "docid": "1ea94efca7c048cb59e413b6cd202e29", "score": "0.44266307", "text": "func (o *ZoneZone) SetDomain(v string) {\n\to.Domain = &v\n}", "title": "" }, { "docid": "9cc8c7c4cf3027349e8975b307d0b677", "score": "0.44236305", "text": "func NewDomain(domain string) (Domain, error) {\n\tvar p *idna.Profile\n\tp = idna.New()\n\tidnDomain, e := p.ToASCII(domain)\n\tif e != nil {\n\t\treturn Domain{}, e\n\t}\n\n\teTLD, icann := publicsuffix.PublicSuffix(idnDomain)\n\tif icann == false {\n\t\treturn Domain{}, errors.New(\"Domain not valid ICANN\")\n\t}\n\n\tdt := Domain{}\n\n\tdt.ASCII, _ = publicsuffix.EffectiveTLDPlusOne(idnDomain)\n\tdt.TLDASCII = eTLD\n\n\tdt.Unicode, _ = p.ToUnicode(dt.ASCII)\n\tdt.TLDUnicode, _ = p.ToUnicode(eTLD)\n\n\treturn dt, nil\n}", "title": "" }, { "docid": "5d75038ff149e8b92c39f82e4b283dd3", "score": "0.44227067", "text": "func (o *LaunchpadClicks) SetDomain(v string) {\n\to.Domain = &v\n}", "title": "" }, { "docid": "8d771fab01ff9d70b8fdf8f970bf8518", "score": "0.44198456", "text": "func (o *VlanVlanDataData) SetDomainId(v string) {\n\to.DomainId = &v\n}", "title": "" }, { "docid": "e7861af6f18dd5874acf78339d67f1c6", "score": "0.44101638", "text": "func (o GetDomainsResultOutput) Domain() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v GetDomainsResult) *string { return v.Domain }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "ed91b14dcaf0dc8e4c10ca9981bafbd1", "score": "0.44086856", "text": "func (s *IdentificationHints) SetFqdn(v string) *IdentificationHints {\n\ts.Fqdn = &v\n\treturn s\n}", "title": "" }, { "docid": "ddb6817d0c5223a60a101e4c564d968f", "score": "0.4400715", "text": "func (v *MatchingListTaskListPartitionsRequest) GetDomain() (o string) {\n\tif v != nil && v.Domain != nil {\n\t\treturn *v.Domain\n\t}\n\treturn\n}", "title": "" }, { "docid": "6f878656156f5bc4fc540ba1a43d5a13", "score": "0.43923262", "text": "func (g *Gandi) DetachDomain(fqdn string) (err error) {\n\t_, err = g.askGandi(mDELETE, \"domains/\"+fqdn, nil, nil)\n\treturn\n}", "title": "" }, { "docid": "de604f2234663db5503854ae31194cf8", "score": "0.4390487", "text": "func WrapAsDomainF(err error, f string, a ...interface{}) E {\n\treturn wrapInfrastructure(err, fmt.Sprintf(f, a...), 1)\n}", "title": "" }, { "docid": "d73ed696b68c4451c55dcc8096bd876f", "score": "0.43814373", "text": "func (o *IamLdapBasePropertiesAllOf) GetDomain() string {\n\tif o == nil || o.Domain == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Domain\n}", "title": "" }, { "docid": "bd17294f8f29b341828239cfc64374d3", "score": "0.4377223", "text": "func (o AccountActiveDirectoryPtrOutput) Domain() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *AccountActiveDirectory) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Domain\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "d126a752f1025f469ccdbb23d8a30217", "score": "0.4376763", "text": "func (af AddressFamily) IsDomain() bool {\n\treturn af == AddressFamilyDomain\n}", "title": "" }, { "docid": "a37398ff8e6e951c91d63ef8ce4479e0", "score": "0.4363652", "text": "func (r *Search) Df(df string) *Search {\n\tr.values.Set(\"df\", df)\n\n\treturn r\n}", "title": "" }, { "docid": "932e25abb7bdc5fba4c2ee6819b6fa2b", "score": "0.43519965", "text": "func (s *DomainDetails) SetDomainName(v string) *DomainDetails {\n\ts.DomainName = &v\n\treturn s\n}", "title": "" }, { "docid": "0d6614836334b397e8ee58f530757d7d", "score": "0.43491176", "text": "func (s *CreateResolverRuleInput) SetDomainName(v string) *CreateResolverRuleInput {\n\ts.DomainName = &v\n\treturn s\n}", "title": "" }, { "docid": "0d6614836334b397e8ee58f530757d7d", "score": "0.43491176", "text": "func (s *CreateResolverRuleInput) SetDomainName(v string) *CreateResolverRuleInput {\n\ts.DomainName = &v\n\treturn s\n}", "title": "" }, { "docid": "164b65ddf398a1fc1334fbeff57ffa88", "score": "0.434355", "text": "func WithDomain(err error, domain Domain) error { return domains.WithDomain(err, domain) }", "title": "" }, { "docid": "164b65ddf398a1fc1334fbeff57ffa88", "score": "0.434355", "text": "func WithDomain(err error, domain Domain) error { return domains.WithDomain(err, domain) }", "title": "" }, { "docid": "d6ea04cb86087c3548b9ca6fa6eca79a", "score": "0.43407324", "text": "func (j JID) Domain() JID {\n\treturn JID{\n\t\tdomainlen: j.domainlen,\n\t\tdata: j.data[j.locallen : j.domainlen+j.locallen],\n\t}\n}", "title": "" }, { "docid": "9cf090ef450c24deadd6201ad2e6eeef", "score": "0.43391326", "text": "func (s *CreateAppInput) SetDomainId(v string) *CreateAppInput {\n\ts.DomainId = &v\n\treturn s\n}", "title": "" }, { "docid": "c46587bf8b156ea32ba2859579fbf3b0", "score": "0.43319556", "text": "func (s *CreateUserProfileInput) SetDomainId(v string) *CreateUserProfileInput {\n\ts.DomainId = &v\n\treturn s\n}", "title": "" }, { "docid": "30807dd6c7ae365ce426afe92b0b5018", "score": "0.43252692", "text": "func (in *DnsDomainSpec) DeepCopy() *DnsDomainSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DnsDomainSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "ff88b2f3f00ba210318b89c996b8a491", "score": "0.43211895", "text": "func (s *DescribeUserProfileOutput) SetDomainId(v string) *DescribeUserProfileOutput {\n\ts.DomainId = &v\n\treturn s\n}", "title": "" }, { "docid": "df3780b4ac59aeb0989a757da1914c31", "score": "0.4318256", "text": "func (o *VlanVlanDataData) GetDomainId() string {\n\tif o == nil || o.DomainId == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.DomainId\n}", "title": "" }, { "docid": "6a6189dd7438b4ba3018ce0c5255cab3", "score": "0.4306112", "text": "func (x SecureCredentialEntityOutline) GetDomain() string {\n\treturn x.Domain\n}", "title": "" }, { "docid": "c5c413365557d735255596be67b02f77", "score": "0.43050987", "text": "func (s *DescribeUserProfileInput) SetDomainId(v string) *DescribeUserProfileInput {\n\ts.DomainId = &v\n\treturn s\n}", "title": "" }, { "docid": "70b00315c4376e607dfe0f3621f5c08c", "score": "0.43035045", "text": "func (s *DeleteUserProfileInput) SetDomainId(v string) *DeleteUserProfileInput {\n\ts.DomainId = &v\n\treturn s\n}", "title": "" }, { "docid": "94b9cd1bab9fe087cf67beaae43b9671", "score": "0.43024966", "text": "func ToDomain(gymData *Gym) gyms.Domain {\n\treturn gyms.Domain{\n\t\tID: gymData.ID,\n\t\tName: gymData.Name,\n\t\tAddress: gymData.Address,\n\t\tCreatedAt: gymData.CreatedAt,\n\t\tUpdatedAt: gymData.UpdatedAt,\n\t\tDeletedAt: gymData.DeletedAt,\n\t}\n}", "title": "" }, { "docid": "e1e67286c4bbe6cf0053a0e29d8432dd", "score": "0.43018153", "text": "func (s *CreateSpaceInput) SetDomainId(v string) *CreateSpaceInput {\n\ts.DomainId = &v\n\treturn s\n}", "title": "" }, { "docid": "efefb5ea804cc23cbbbff77427e276b5", "score": "0.43016747", "text": "func (o *PostLTENetworkIDDNSRecordsDomainParams) SetDomain(domain string) {\n\to.Domain = domain\n}", "title": "" } ]
fc6df529966a9913dfbdf5b0e05cd64f
End a child by specifying its dimensions.
[ { "docid": "4edbea11cabb243cf62a64eb9d70daef", "score": "0.61384785", "text": "func (s *Stack) End(dims Dimens) StackChild {\n\ts.macro.Stop()\n\ts.begun = false\n\tif w := dims.Size.X; w > s.maxSZ.X {\n\t\ts.maxSZ.X = w\n\t}\n\tif h := dims.Size.Y; h > s.maxSZ.Y {\n\t\ts.maxSZ.Y = h\n\t}\n\tif s.baseline == 0 {\n\t\tif b := dims.Baseline; b != dims.Size.Y {\n\t\t\ts.baseline = b\n\t\t}\n\t}\n\treturn StackChild{s.macro, dims}\n}", "title": "" } ]
[ { "docid": "00bba01427ce0cffb7177f6fc27a4dc1", "score": "0.560888", "text": "func (v *Box) PackEnd(child IWidget, expand, fill bool, padding uint) {\n\tC.gtk_box_pack_end(v.native(), child.toWidget(), gbool(expand),\n\t\tgbool(fill), C.guint(padding))\n}", "title": "" }, { "docid": "7b466bc095aca4d3d17e041882f03d23", "score": "0.5447395", "text": "func EndToEndRow(gtx layout.Context, leftWidget, rightWidget func(C) D) layout.Dimensions {\n\treturn layout.Flex{Axis: layout.Horizontal}.Layout(gtx,\n\t\tlayout.Rigid(leftWidget),\n\t\tlayout.Flexed(1, func(gtx C) D {\n\t\t\treturn layout.E.Layout(gtx, rightWidget)\n\t\t}),\n\t)\n}", "title": "" }, { "docid": "69b86c345c9df81fe5015be5746564de", "score": "0.53851026", "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": "0dee0a7a2abd918ff2c70492fc98f96f", "score": "0.50892156", "text": "func (svg *SVG) End() {\n\tsvg.println(\"</svg>\")\n}", "title": "" }, { "docid": "8f5a4c515a20acde0e7211b523a9702d", "score": "0.49711853", "text": "func (b *Builder) End() *Builder {\n\tif b.buildingElement {\n\t\tb.outputElement(true)\n\t} else {\n\t\tif b.inline > 0 {\n\t\t\tfmt.Fprint(b.writer, \"</\", b.elements[len(b.elements)-1], \">\")\n\t\t} else {\n\t\t\tfmt.Fprint(b.writer, b.doIndent(), \"</\", b.elements[len(b.elements)-1], \">\\n\")\n\t\t}\n\t\tb.elements = b.elements[:len(b.elements)-1]\n\t}\n\treturn b\n}", "title": "" }, { "docid": "80ccdcd41444c5ff2589ba5851e10b51", "score": "0.49521434", "text": "func (v *CellAreaBox) PackEnd(renderer ICellRenderer, expand, align, fixed bool) {\n\tC.gtk_cell_area_box_pack_end(v.native(), renderer.toCellRenderer(), gbool(expand), gbool(align), gbool(fixed))\n}", "title": "" }, { "docid": "6d4ac0bac374fa25580a91e59dae73c0", "score": "0.4943603", "text": "func (svg *SVG) End() { svg.println(\"</svg>\") }", "title": "" }, { "docid": "ec864937da9d611665846f0c54b14f4c", "score": "0.48000026", "text": "func EndSize(i span.Span[int]) func(Generator) {\n\treturn func(g Generator) {\n\t\tif g2, ok := g.(Sizeable); ok {\n\t\t\tg2.SetEndSize(i)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "80209f181beafb832412218c53790116", "score": "0.46777928", "text": "func (w *Window) end() {\n\t// nothing, really\n}", "title": "" }, { "docid": "1080356e93d49c9e272d20512312c668", "score": "0.46525112", "text": "func (s *BasewktListener) ExitGeometry(ctx *GeometryContext) {}", "title": "" }, { "docid": "a836ff77ccc3713c415dbc2276fe734f", "score": "0.4631869", "text": "func (entry *Entry) End(duration time.Duration, finishedAt time.Time) {\n\tif duration.Seconds() > 0 {\n\t\tentry.FinishedAt = entry.StartedAt.Add(duration)\n\t\tentry.Duration = int(duration.Seconds())\n\t} else if !finishedAt.IsZero() {\n\t\tentry.FinishedAt = finishedAt\n\t\tduration := entry.FinishedAt.Sub(entry.StartedAt)\n\t\tentry.Duration = int(duration.Seconds())\n\t}\n}", "title": "" }, { "docid": "27af6182c1c8dd77476a0c1f54a5d4fb", "score": "0.46147588", "text": "func (node *ChordNode) Finalize() {\n\t//send message to all children to terminate\n\n\tfmt.Printf(\"Exiting...\\n\")\n}", "title": "" }, { "docid": "8e6da245c9bd6396032f9ae350c202db", "score": "0.4604155", "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": "78b6bc6683d4dac48ab8a3a5b34637d0", "score": "0.45558476", "text": "func (self *CanvasRenderer) Resize(width int, height int) {\n self.Object.Call(\"resize\", width, height)\n}", "title": "" }, { "docid": "b7e6af15c0ccc8c87f46725ac7eabea5", "score": "0.45214427", "text": "func (svg *SVG) Close(tag string) {\n\tsvg.printf(\"</%s>\\n\", tag)\n}", "title": "" }, { "docid": "182eb21e237c56288b65c163b54e13c7", "score": "0.45098796", "text": "func (l *CompositeRenderingListener) EndDelete(instance runtime.Object, err error) error {\n\t// reverse order for completions\n\tvar allErrors []error\n\tfor index := len(l.Listeners) - 1; index > -1; index-- {\n\t\tif listenerErr := l.Listeners[index].EndDelete(instance, err); listenerErr != nil {\n\t\t\tallErrors = append(allErrors, listenerErr)\n\t\t}\n\t}\n\treturn utilerrors.NewAggregate(allErrors)\n}", "title": "" }, { "docid": "0afe2f0da712c6e9af089220e6372236", "score": "0.45013437", "text": "func (d *Dots) End() int { return d.DotsEnd }", "title": "" }, { "docid": "95dd5ea2bb370d77dd1f069e07338983", "score": "0.44992498", "text": "func (e *Html) Child() {\n\tpanic(\"Do not append children to Html. call Html.Head() and Html.Body() instead.\")\n}", "title": "" }, { "docid": "42f8dd7a6c65849bfc715af9c5dfefaf", "score": "0.44816422", "text": "func (p *Panel) Close() {\n\tp.removeChildren()\n\tif p.Parent != nil {\n\t\tp.Parent.removeChild(p.Virt)\n\t\tp.Parent = nil\n\t}\n}", "title": "" }, { "docid": "26782b81407d3e2fb04598faf81a1deb", "score": "0.4480951", "text": "func (s *Baseasm8086Listener) ExitEnd(ctx *EndContext) {}", "title": "" }, { "docid": "fb761579e8ad400daf0e88e0640afac3", "score": "0.44734085", "text": "func (v *TreeViewColumn) PackEnd(cell *CellRenderer, expand bool) {\n\tC.gtk_tree_view_column_pack_end(v.native(), cell.native(), gbool(expand))\n}", "title": "" }, { "docid": "dda209f6f0504573281a7956de908585", "score": "0.4471639", "text": "func (s *Canvas) DocClose() { s.println(`</svg>`) }", "title": "" }, { "docid": "d0f2e2887597cb2271780d3c1c774c1d", "score": "0.4443507", "text": "func (n *Node) childSize(divisor math.Vec3) math.Vec3 {\n\treturn n.bounds.Size().Div(divisor)\n}", "title": "" }, { "docid": "ba4035d448ff0d540a5084b5f2bd9b05", "score": "0.44263834", "text": "func (page *overviewPage) endToEndRow(inset layout.Inset, leftLabel, rightLabel decredmaterial.Label) {\n\tgtx := page.gtx\n\tinset.Layout(gtx, func() {\n\t\tlayout.Flex{Axis: layout.Horizontal}.Layout(gtx,\n\t\t\tlayout.Rigid(func() {\n\t\t\t\tleftLabel.Layout(gtx)\n\t\t\t}),\n\t\t\tlayout.Flexed(1, func() {\n\t\t\t\tlayout.E.Layout(gtx, func() {\n\t\t\t\t\trightLabel.Layout(gtx)\n\t\t\t\t})\n\t\t\t}),\n\t\t)\n\t})\n}", "title": "" }, { "docid": "0e8ec21abe3c224930005b4afae5b85c", "score": "0.44035858", "text": "func (ss *SleepService) End(ctx context.Context, family *goparent.Family, child *goparent.Child) error {\n\t_, ok, err := ss.Status(ctx, family, child)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif ok {\n\t\t//this is broken until someone fixes it\n\t\t// sleep.End = time.Now()\n\t\treturn nil\n\t}\n\treturn goparent.ErrNoExistingSession\n\n}", "title": "" }, { "docid": "db5aa995b3ae28dc37c5b0f1253facc8", "score": "0.44020513", "text": "func (l *LoggingRenderingListener) EndDelete(instance runtime.Object, err error) error {\n\tif err != nil {\n\t\tlog.Errorf(\"errors occurred during deletion: %s\", err)\n\t}\n\tlog.Info(\"end deleting resources\")\n\treturn nil\n}", "title": "" }, { "docid": "3cfaee6ee9b4fc66aa31bf3635138247", "score": "0.43950182", "text": "func (s *BasetsqlListener) ExitWindow_frame_extent(ctx *Window_frame_extentContext) {}", "title": "" }, { "docid": "935b3f2f5802bb35e1ff53e6d2524041", "score": "0.43832818", "text": "func (s *Span) End() {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\tif s.ended() {\n\t\treturn\n\t}\n\tif s.Type == \"\" {\n\t\ts.Type = \"custom\"\n\t}\n\t// Store the span type and subtype on the Span struct so we can filter\n\t// out child spans of exit spans with non-matching type/subtype below.\n\ts.finalType = s.Type\n\ts.finalSubtype = s.Subtype\n\n\tif s.parent.IsExitSpan() {\n\t\t// Children of exit spans must not have service destination/target\n\t\t// context, as otherwise service destination metrics will be double\n\t\t// counted.\n\t\ts.Context.model.Destination = nil\n\t\ts.Context.model.Service = nil\n\n\t\tvar parentType, parentSubtype string\n\t\ts.parent.mu.RLock()\n\t\tif s.parent.ended() {\n\t\t\tparentType = s.parent.finalType\n\t\t\tparentSubtype = s.parent.finalSubtype\n\t\t} else {\n\t\t\tparentType = s.parent.Type\n\t\t\tparentSubtype = s.parent.Subtype\n\t\t}\n\t\ts.parent.mu.RUnlock()\n\n\t\tif s.Type != parentType || s.Subtype != parentSubtype {\n\t\t\ts.dropWhen(true)\n\t\t\tif s.tx != nil {\n\t\t\t\ts.tx.mu.Lock()\n\t\t\t\tdefer s.tx.mu.Unlock()\n\t\t\t\tif !s.tx.ended() {\n\t\t\t\t\ts.tx.TransactionData.mu.Lock()\n\t\t\t\t\tdefer s.tx.TransactionData.mu.Unlock()\n\t\t\t\t}\n\t\t\t}\n\t\t\ts.end()\n\t\t\treturn\n\t\t}\n\t}\n\tif s.exit && !s.Context.setDestinationServiceCalled {\n\t\t// The span was created as an exit span, but the user did not\n\t\t// manually set the destination.service.resource\n\t\ts.setExitSpanDestinationService()\n\t}\n\n\ts.updateSpanServiceTarget()\n\n\tif s.Duration < 0 {\n\t\ts.Duration = time.Since(s.timestamp)\n\t}\n\tif s.Outcome == \"\" {\n\t\ts.Outcome = s.Context.outcome()\n\t\tif s.Outcome == \"\" {\n\t\t\tif s.errorCaptured {\n\t\t\t\ts.Outcome = \"failure\"\n\t\t\t} else {\n\t\t\t\ts.Outcome = \"success\"\n\t\t\t}\n\t\t}\n\t}\n\tswitch {\n\tcase s.stackStackTraceMinDuration < 0:\n\t\t// If s.stackFramesMinDuration < 0, we never set stacktrace.\n\tcase s.stackStackTraceMinDuration == 0:\n\t\t// Always set stacktrace\n\t\ts.setStacktrace(1)\n\tdefault:\n\t\tif !s.dropped() && len(s.stacktrace) == 0 &&\n\t\t\ts.Duration >= s.stackStackTraceMinDuration {\n\t\t\ts.setStacktrace(1)\n\t\t}\n\t}\n\t// If this span has a parent span, lock it before proceeding to\n\t// prevent deadlocking when concurrently ending parent and child.\n\tif s.parent != nil {\n\t\ts.parent.mu.Lock()\n\t\tdefer s.parent.mu.Unlock()\n\t}\n\tif s.tx != nil {\n\t\ts.tx.mu.RLock()\n\t\tdefer s.tx.mu.RUnlock()\n\t\tif !s.tx.ended() {\n\t\t\ts.tx.TransactionData.mu.Lock()\n\t\t\tdefer s.tx.TransactionData.mu.Unlock()\n\t\t\ts.reportSelfTime()\n\t\t}\n\t}\n\n\tevictedSpan, cached := s.attemptCompress()\n\tif evictedSpan != nil {\n\t\tevictedSpan.end()\n\t}\n\tif cached {\n\t\t// s has been cached for potential compression, and will be enqueued\n\t\t// by a future call to attemptCompress on a sibling span, or when the\n\t\t// parent is ended.\n\t\treturn\n\t}\n\ts.end()\n}", "title": "" }, { "docid": "9254574c76d73212c5dcbf8b55939b1e", "score": "0.43744573", "text": "func (s *State) EndLayout() {\r\n\tused := s.Layout.Top().Used()\r\n\ts.Layout.Pop()\r\n\ts.Layout.Top().Next(used.Size())\r\n}", "title": "" }, { "docid": "6de0937fe2719885330fbd39381dbe01", "score": "0.43596014", "text": "func (dfw *defaultFrameWriter) EndWrite() (err error) {\n\n\tpayloadLength := len(dfw.Payload())\n\tif payloadLength == 0 {\n\t\tdfw.SetFlags(dfw.Flags().ToNonCodec())\n\t} else if dfw.Flags().IsCodec() {\n\t\tcodec := dfw.fbw.getCodec()\n\t\tif codec == nil {\n\t\t\terr = ErrNoCodec\n\t\t\treturn\n\t\t}\n\t\tvar encodedPayload []byte\n\t\tencodedPayload, err = codec.Encode(dfw.Payload())\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t\tif len(encodedPayload) > payloadLength {\n\t\t\tdfw.SetFlags(dfw.Flags().ToNonCodec())\n\t\t} else {\n\t\t\tdfw.wbuf = dfw.wbuf[:16]\n\t\t\tdfw.WriteBytes(encodedPayload)\n\t\t}\n\t}\n\n\terr = dfw.endWrite()\n\n\treturn\n}", "title": "" }, { "docid": "0097d43ddd67dde0a15f95982868bc25", "score": "0.43383428", "text": "func (e StartElement) End() EndElement {}", "title": "" }, { "docid": "c6c9890c9dc6937700e05cb3d2a492cb", "score": "0.43243346", "text": "func (s *Stack) Expand(gtx *Context, w Widget) StackChild {\n\tvar m op.MacroOp\n\tm.Record(gtx.Ops)\n\tcs := Constraints{\n\t\tWidth: Constraint{Min: s.maxSZ.X, Max: gtx.Constraints.Width.Max},\n\t\tHeight: Constraint{Min: s.maxSZ.Y, Max: gtx.Constraints.Height.Max},\n\t}\n\tdims := ctxLayout(gtx, cs, w)\n\tm.Stop()\n\ts.expand(dims)\n\treturn StackChild{m, dims}\n}", "title": "" }, { "docid": "0784bd0855d7f3233f666dda30fd0628", "score": "0.43129885", "text": "func (rlf *Farm) releaseChild(id roll_fields.ID) {\n\trlf.logger.WithField(\"ru\", id).Infoln(\"Releasing update\")\n\tclose(rlf.children[id].quit)\n\n\t// if our lock is active, attempt to gracefully release it\n\tif rlf.session != nil {\n\t\tunlocker := rlf.children[id].unlocker\n\t\terr := unlocker.Unlock()\n\t\tif err != nil {\n\t\t\trlf.logger.WithField(\"ru\", id).Warnln(\"Could not release update lock\")\n\t\t}\n\t}\n\tdelete(rlf.children, id)\n}", "title": "" }, { "docid": "962a37f9ec4db84c2abb77c6ec945707", "score": "0.4307138", "text": "func (e *Execution) End() {\n if e.markEnded() {\n close(e.ended)\n }\n}", "title": "" }, { "docid": "ae1a64f12b305cffce7a2f4237819906", "score": "0.42957544", "text": "func (v *boundedView) Resize(x, y, width, height int) {\n\tif v.parent == nil {\n\t\treturn\n\t}\n\tpx, py := v.parent.Size()\n\tpabsx, pabsy, _, _ := v.parent.GetAbsolute()\n\tif x >= 0 && x < px {\n\t\tv.relx = x\n\t\tv.absx = x + pabsx\n\t}\n\tif y >= 0 && y < py {\n\t\tv.rely = y\n\t\tv.absy = y + pabsy\n\t}\n\tif width < 0 || width > px-x {\n\t\twidth = px - x\n\t}\n\tif height < 0 || height > py-y {\n\t\theight = py - y\n\t}\n\n\tv.width = width\n\tv.height = height\n}", "title": "" }, { "docid": "5906de26f53ecfd90aeb29745eb9ff5d", "score": "0.42943835", "text": "func (s *State) EndFrame() {\r\n\ts.Engine.Apply(s.DrawList)\r\n\ts.Engine.EndFrame()\r\n\ts.FrameEnd = time.Now()\r\n\ts.LastFrameDuration = s.FrameEnd.Sub(s.FrameStart)\r\n}", "title": "" }, { "docid": "2928f2397aa49405e085ed309a9ffedb", "score": "0.4291078", "text": "func (v *View) End() bool {\n\tif v.mainCursor() {\n\t\tif v.height > v.Buf.NumLines {\n\t\t\tv.Topline = 0\n\t\t} else {\n\t\t\tv.Topline = v.Buf.NumLines - v.height\n\t\t}\n\n\t}\n\treturn false\n}", "title": "" }, { "docid": "070975ea7714b84633048f8eef1637bc", "score": "0.42910054", "text": "func (c *command) Finish() {\n\tif c.span == nil {\n\t\treturn\n\t}\n\tc.span.Finish()\n\twgAll.Done()\n\tc.span = nil\n}", "title": "" }, { "docid": "173c3bdf1853e204ff433fd982760411", "score": "0.4239622", "text": "func (v *HistoryWidget) FinishReply(parent forest.Node, replyFileName string, editor *exec.Cmd) {\n\tif err := editor.Wait(); err != nil {\n\t\tlog.Printf(\"Error waiting on editor command to finish: %v\", err)\n\t\tlog.Printf(\"There may be a partial message in %s\", replyFileName)\n\t\treturn\n\t}\n\treplyContent, err := ioutil.ReadFile(replyFileName)\n\tif err != nil {\n\t\tlog.Printf(\"Error reading reply from %s: %v\", replyFileName, err)\n\t\treturn\n\t}\n\tif err := v.FinishReplyString(parent, string(replyContent)); err != nil {\n\t\tlog.Printf(\"Error creating & sending reply: %v\", err)\n\t\treturn\n\t}\n\tif err := os.Remove(replyFileName); err != nil {\n\t\tlog.Printf(\"Error removing %s: %v\", replyFileName, err)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "a65b1a4c9f205b6e411698f0edca9758", "score": "0.4217706", "text": "func (s *BasewktListener) ExitPointGeometry(ctx *PointGeometryContext) {}", "title": "" }, { "docid": "f791a6c98493a2961f18cddf561a0bcd", "score": "0.42120907", "text": "func (s *BaselolcodeListener) ExitDiv(ctx *DivContext) {}", "title": "" }, { "docid": "744100402bfc03e442e80606488d89f8", "score": "0.4197005", "text": "func (n *nur) child(c *nur) {\n\tif n.isChild(c) {\n\t\treturn\n\t}\n\tn.out = append(n.out, c)\n\tc.parent(n)\n}", "title": "" }, { "docid": "65a2b63adce219f2241783c84865116a", "score": "0.41821313", "text": "func (r Region) End() {\n\tC.kdebug_signpost_end(\n\t\tC.uint32_t(r.Action),\n\t\tC.uintptr_t(r.Arg1),\n\t\tC.uintptr_t(r.Arg2),\n\t\tC.uintptr_t(r.Arg3),\n\t\tC.uintptr_t(r.Arg4),\n\t)\n}", "title": "" }, { "docid": "7663c93d2a4d56d3ee4d03acd1afbf7a", "score": "0.41685596", "text": "func End() {\n\tgRenderer.Destroy()\n\tgWindow.Destroy()\n\n\tsdl.CloseAudioDevice(device) // from audio.go\n\n\tsdl.Quit()\n}", "title": "" }, { "docid": "f0a0fa8aaf37ed6ead695c1f0d442e62", "score": "0.41621056", "text": "func (r *Region) Close() {\n\tif r.parent == nil {\n\t\treturn\n\t}\n\tr.parent.RemoveRegion(r)\n\t// any clean up ?\n}", "title": "" }, { "docid": "5e3f2024774c885f17f6431054367e9c", "score": "0.41599795", "text": "func (self *Bui) End(tag string) {\n\tvalidTag(tag)\n\n\tif !Void.Has(tag) {\n\t\tself.NonEscString(`</`)\n\t\tself.NonEscString(tag)\n\t\tself.NonEscString(`>`)\n\t}\n}", "title": "" }, { "docid": "119adf40f9e973d0180402773f8c6065", "score": "0.4145739", "text": "func (s *BaseGolangListener) ExitElement(ctx *ElementContext) {}", "title": "" }, { "docid": "db5a02711afa5918ad2c0837f9b2730a", "score": "0.4142923", "text": "func (l *LoggingRenderingListener) EndChart(chart string) error {\n\tlog.Info(\"end chart update\")\n\tlastIndex := len(l.loggerStack) - 1\n\tif lastIndex >= 0 {\n\t\tl.loggerStack = l.loggerStack[:lastIndex]\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7d7704a83b1f5e61279061854a1b5d78", "score": "0.41167995", "text": "func (ix *Index) End() {\n\tif ix.ptr != nil {\n\t\tC.lzma_index_end(ix.C(), nil)\n\t}\n\tix.ptr = nil\n}", "title": "" }, { "docid": "f95e8925e209ecec8b2efaca4cff7752", "score": "0.41128597", "text": "func (v *Box) ReorderChild(child IWidget, position int) {\n\tC.gtk_box_reorder_child(v.native(), child.toWidget(), C.gint(position))\n}", "title": "" }, { "docid": "6e21e36affbf888f8b386ca89423489c", "score": "0.41118506", "text": "func (e *LayoutImpl) GetChild(n int) Element { return e.Children[n] }", "title": "" }, { "docid": "819372a5b6c014648ea138de01812e1f", "score": "0.41106355", "text": "func (s *BaseBODLParserListener) ExitElement(ctx *ElementContext) {}", "title": "" }, { "docid": "89a632cb8946952c723afa1cf4ef0220", "score": "0.41082674", "text": "func (l *Line) MoveEnd() {\n\tl.Pos = len(l.Text)\n}", "title": "" }, { "docid": "45dfd1d9bba8e210f18ab3e1fc8c8e78", "score": "0.41074795", "text": "func (s *integrationCLIOutput) End() {\n\tif s.CLI == nil {\n\t\treturn\n\t}\n\n\ts.CLI.Output(\"\\n------------------------------------------------------------------------\\n\")\n}", "title": "" }, { "docid": "a6dec601108a7c4d7af414c8e88e514b", "score": "0.4099084", "text": "func (i *instance) Close() (err error) {\n\tchild := i.child\n\tif child == nil {\n\t\treturn nil\n\t}\n\tdefer func() {\n\t\ti.child = nil\n\t\terr1 := os.RemoveAll(i.appDir)\n\t\tif err == nil {\n\t\t\terr = err1\n\t\t}\n\t}()\n\n\tif p := child.Process; p != nil {\n\t\terrc := make(chan error, 1)\n\t\tgo func() {\n\t\t\terrc <- child.Wait()\n\t\t}()\n\n\t\t// Call the quit handler on the admin server.\n\t\tres, err := http.Get(i.adminURL + \"/quit\")\n\t\tif err != nil {\n\t\t\tp.Kill()\n\t\t\treturn fmt.Errorf(\"unable to call /quit handler: %v\", err)\n\t\t}\n\t\tres.Body.Close()\n\t\tselect {\n\t\tcase <-time.After(15 * time.Second):\n\t\t\tp.Kill()\n\t\t\treturn errors.New(\"timeout killing child process\")\n\t\tcase err = <-errc:\n\t\t\t// Do nothing.\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "4f2d01eb8cb32d983a57561adc6eb2c5", "score": "0.40929905", "text": "func (r QRow) End() int { return r.Start() + r.Len() }", "title": "" }, { "docid": "7313f9c73da14407ddff2e3cacb34131", "score": "0.4084921", "text": "func (svg *SVG) Gend() { svg.println(`</g>`) }", "title": "" }, { "docid": "18ef0605e6cd48db7e2c24deff621c3d", "score": "0.40771237", "text": "func (self *Bui) Child(val interface{}) {\n\tswitch val := val.(type) {\n\tcase nil:\n\n\tcase []interface{}:\n\t\tself.Children(val...)\n\n\tcase String:\n\t\tself.NonEscString(string(val))\n\n\tcase string:\n\t\tself.EscString(val)\n\n\tcase Bytes:\n\t\tself.NonEscBytes(val)\n\n\tcase []byte:\n\t\tself.EscBytes(val)\n\n\tcase func():\n\t\tif val != nil {\n\t\t\tval()\n\t\t}\n\n\tcase func(*Bui):\n\t\tif val != nil {\n\t\t\tval(self)\n\t\t}\n\n\tdefault:\n\t\tself.Unknown(val)\n\t}\n}", "title": "" }, { "docid": "a10937a8342247efcbbe3d534ef19e88", "score": "0.40669376", "text": "func (s *BasewktListener) ExitCircularStringGeometry(ctx *CircularStringGeometryContext) {}", "title": "" }, { "docid": "8b751049c9c81130ca14836d871e16c6", "score": "0.4062699", "text": "func (w *chunkedWriter) end() {\n\tw.lock.Lock()\n\tdefer w.lock.Unlock()\n\tif w.closed {\n\t\treturn\n\t}\n\tw.closed = true\n\tfmt.Fprint(w.w, \"0\\r\\n\\r\\n\")\n}", "title": "" }, { "docid": "96b0c76fb4eff1d3f98f4d514f494617", "score": "0.40619963", "text": "func SVGEnd() string {\n\tvar endstr string\n\tendstr = `</svg>`\n\treturn endstr\n}", "title": "" }, { "docid": "df60a1fb56a89fc63036754051da4e77", "score": "0.4057763", "text": "func (p Positions) End() *Position {\n\tif p, ok := p[KeyEnd]; ok {\n\t\treturn &p\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "df60a1fb56a89fc63036754051da4e77", "score": "0.4057763", "text": "func (p Positions) End() *Position {\n\tif p, ok := p[KeyEnd]; ok {\n\t\treturn &p\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a3da4b6acb8c59da32c518b4626821a9", "score": "0.405474", "text": "func (s *BasekarelListener) ExitDefinition(ctx *DefinitionContext) {}", "title": "" }, { "docid": "91d97156984b08306e5a4eb8f0abdba7", "score": "0.40539652", "text": "func (s *BasecreoleListener) ExitImage(ctx *ImageContext) {}", "title": "" }, { "docid": "31431590bd4cf0bc071e8aab12bf7dff", "score": "0.40523568", "text": "func (s *AdaptivePool) rightChild(index int) int {\n\treturn 2*index + 2\n}", "title": "" }, { "docid": "7bec6f7011298b49081cd4e2509da62d", "score": "0.4045569", "text": "func (s *BaseHiveParserListener) ExitWindow_frame_boundary(ctx *Window_frame_boundaryContext) {}", "title": "" }, { "docid": "13847aecae29d34e72c2995095a39146", "score": "0.40432715", "text": "func (b *CTooBox) Size() uint64 {\n\treturn containerSize(b.Children)\n}", "title": "" }, { "docid": "34f891b87be5ab3c73019995eb283d2b", "score": "0.4030854", "text": "func (t *Root) Close() error { return t.liner.Close() }", "title": "" }, { "docid": "a65370bb14d828ed56e2d11d3106875e", "score": "0.40303174", "text": "func (res *Res) End() {\n\tres.exit = true\n}", "title": "" }, { "docid": "935d2a4e1ee463803aa40deaaca1d724", "score": "0.40267885", "text": "func (t *BTree) Descend(iterator ItemIterator) {\n\tif t.root == nil {\n\t\treturn\n\t}\n\tt.root.iterate(descend, nil, nil, false, false, iterator)\n}", "title": "" }, { "docid": "f46b4b1e1a61a2a2892a7392054a95ec", "score": "0.40262198", "text": "func (self *CanvasBuffer) Resize(width int, height int) {\n self.Object.Call(\"resize\", width, height)\n}", "title": "" }, { "docid": "ac3324713300a36775c6bb96c2bf8c81", "score": "0.40193203", "text": "func (g *Group) Append(s Shape) {\n\tg.rwMutex.Lock()\n\tdefer g.rwMutex.Unlock()\n\n\tg.children = append(g.children, s)\n\n\tif len(g.children) == 1 {\n\t\tg.bounds = s.Bounds()\n\t} else {\n\t\tg.bounds = g.bounds.Union(s.Bounds())\n\t}\n\n\tg.x = float32((g.bounds.Min.X + g.bounds.Max.X) / 2)\n\tg.y = float32((g.bounds.Min.Y + g.bounds.Max.Y) / 2)\n}", "title": "" }, { "docid": "c81e777da8c8e902336355c7a3345302", "score": "0.40185732", "text": "func (s *BaseONCRPCv2Listener) ExitDefinition(ctx *DefinitionContext) {}", "title": "" }, { "docid": "4edea30e8935bb66981c88aa912ea2ca", "score": "0.4004451", "text": "func (w *Container) Destroy() {\n\tif w.SDLTexture != nil {\n\t\tw.SDLTexture.Destroy()\n\t}\n\n\tw.BaseElement.Destroy()\n}", "title": "" }, { "docid": "c1c7acfddd78fa2cb69b1fe788d0644b", "score": "0.40034878", "text": "func (v *View) RemoveChild(c TComponent) {\n\tv.component.RemoveChild(c)\n}", "title": "" }, { "docid": "23dbfcee0e883c72e6b387eebf3137d3", "score": "0.4002674", "text": "func (n *node) LastChild() Node {\n\tlastIndex := n.childNodes.Length() - 1\n\n\treturn n.childNodes.Item(lastIndex)\n}", "title": "" }, { "docid": "5464ac74651707b77c882f0b9bdce3b1", "score": "0.39978904", "text": "func (b *Builder) Close() {}", "title": "" }, { "docid": "7fe6feeb539353f7b6738e6c7ffbd7de", "score": "0.39930215", "text": "func End() {\n\tC.endwin()\n}", "title": "" }, { "docid": "121d10bdb241e50e0b93f4747d53694b", "score": "0.39862242", "text": "func (svg *SVG) DefEnd() { svg.println(`</defs>`) }", "title": "" }, { "docid": "ba3c1731aa9ddf4fbb83d7f03f871656", "score": "0.3981874", "text": "func (exp *Exporter) EndMetricsOp(ctx context.Context, numMetricPoints int, err error) {\n\tnumSent, numFailedToSend := toNumItems(numMetricPoints, err)\n\texp.recordMetrics(ctx, component.DataTypeMetrics, numSent, numFailedToSend)\n\tendSpan(ctx, err, numSent, numFailedToSend, obsmetrics.SentMetricPointsKey, obsmetrics.FailedToSendMetricPointsKey)\n}", "title": "" }, { "docid": "3decd2c63adc80e2ce311b3101ad02df", "score": "0.39797518", "text": "func (t *BTree) Descend(iterator ItemIteratorFn) {\n\tif t.root == nil {\n\t\treturn\n\t}\n\tt.root.iterate(descend, nil, nil, false, false, iterator)\n}", "title": "" }, { "docid": "1b596d25e3c71043f8ea8fffac7ffee8", "score": "0.39745855", "text": "func drawResize(c *Container, area image.Rectangle) error {\n\tif area.Dx() < 1 || area.Dy() < 1 {\n\t\treturn nil\n\t}\n\n\tcvs, err := canvas.New(area)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := draw.ResizeNeeded(cvs); err != nil {\n\t\treturn err\n\t}\n\treturn cvs.Apply(c.term)\n}", "title": "" }, { "docid": "6447c24b3db19cec1320b204c0ca8967", "score": "0.39712688", "text": "func (this *Child) Close() {\n\tthis.closeChildIo()\n\tthis.CloseParentIo()\n\tcancel := this.Cancel\n\tif nil != cancel {\n\t\tcancel()\n\t}\n}", "title": "" }, { "docid": "5c784dc352504190452f50d9bf2f78cd", "score": "0.3968994", "text": "func (r *Root) Close() error { return nil }", "title": "" }, { "docid": "5c784dc352504190452f50d9bf2f78cd", "score": "0.3968994", "text": "func (r *Root) Close() error { return nil }", "title": "" }, { "docid": "ec02944eb9e31244cb580c39fce89231", "score": "0.39639395", "text": "func (ab *BoxTracker) TerminateAt(endY float64) error {\n\tif len(ab.segs) == 0 {\n\t\treturn errors.New(\"There is no box to terminate\")\n\t}\n\tmostRecent := &ab.segs[len(ab.segs)-1]\n\tif mostRecent.End != -1 {\n\t\treturn errors.New(\"Cannot terminate an already-terminated box\")\n\t}\n\tmostRecent.End = endY\n\treturn nil\n}", "title": "" }, { "docid": "48ac19ddda064557da8b970a52d96a2a", "score": "0.39622957", "text": "func (ZwpPointerGesturePinchV1EndEvent) MessageName() string { return \"end\" }", "title": "" }, { "docid": "d9c785c5475fc5f175b83a22f3787ab2", "score": "0.39601308", "text": "func (s *BaseHiveParserListener) ExitSubQueryExpression(ctx *SubQueryExpressionContext) {}", "title": "" }, { "docid": "96a264daa74715ae6153e50ddcc2ca4a", "score": "0.39589804", "text": "func (self *CanvasRenderer) SetHeightA(member int) {\n self.Object.Set(\"height\", member)\n}", "title": "" }, { "docid": "5f523bb1480dca4dd7be2442e7ef3d63", "score": "0.39577103", "text": "func (q *Phred) End() int { return q.Offset + q.Len() }", "title": "" }, { "docid": "356aab90e86de415c770d20738a1bef9", "score": "0.39550474", "text": "func (o *Op) End() {\n\to.Runtime.End = time.Now()\n}", "title": "" }, { "docid": "8186a0c8d5701e82db15c28a89c5ce5e", "score": "0.39503404", "text": "func (v *Container) ChildNotify(child IWidget, childProperty string) {\n\tcstr := C.CString(childProperty)\n\tdefer C.free(unsafe.Pointer(cstr))\n\tC.gtk_container_child_notify(v.native(), child.toWidget(),\n\t\t(*C.gchar)(cstr))\n}", "title": "" }, { "docid": "fad2b6bacc26b2e2b78fb14536f8b02f", "score": "0.39501643", "text": "func (p *Parser) End() {\n\tif p.Off != len(p.R) {\n\t\tpanic(\"binparser: overlong packet\")\n\t}\n}", "title": "" }, { "docid": "1942e08b7552454234a1baad6ebedd4f", "score": "0.39494777", "text": "func (b *Buddy) Free(offset int) error {\n\tif offset < 0 || offset >= b.size {\n\t\treturn InValidParameterErr\n\t}\n\tnodeSize := 1\n\tindex := offset + b.size - 1\n\tfor ; b.longests[index] != 0; index = parent(index) {\n\t\tnodeSize *= 2\n\t\tif index == 0 {\n\t\t\treturn NotFoundErr\n\t\t}\n\t}\n\tb.longests[index] = nodeSize\n\t// update parent node's size\n\tfor index != 0 {\n\t\tindex = parent(index)\n\t\tnodeSize *= 2\n\n\t\tleftSize := b.longests[leftChild(index)]\n\t\trightSize := b.longests[rightChild(index)]\n\t\tif leftSize+rightSize == nodeSize {\n\t\t\tb.longests[index] = nodeSize\n\t\t} else {\n\t\t\tb.longests[index] = max(leftSize, rightSize)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a72ce7f3f74535ada2a051a39827c36e", "score": "0.39487806", "text": "func (r *frameRender) Destroy() {\n}", "title": "" }, { "docid": "5d62c15d7ba48ba29acb4d7cf62d2a21", "score": "0.3944747", "text": "func (l *CompositeRenderingListener) EndChart(chart string) error {\n\t// reverse order for completions\n\tvar allErrors []error\n\tfor index := len(l.Listeners) - 1; index > -1; index-- {\n\t\tif listenerErr := l.Listeners[index].EndChart(chart); listenerErr != nil {\n\t\t\tallErrors = append(allErrors, listenerErr)\n\t\t}\n\t}\n\treturn utilerrors.NewAggregate(allErrors)\n}", "title": "" }, { "docid": "ea78db4ec55623ebb9aebff302436b40", "score": "0.39382806", "text": "func (o *otelFakeSpanProcessor) OnEnd(s sdktrace.ReadOnlySpan) {\n\to.cb(s)\n}", "title": "" }, { "docid": "f5bf10b0f272ed50cc7de0d012b554e2", "score": "0.39361843", "text": "func (s *BaseBODLParserListener) ExitDefinition(ctx *DefinitionContext) {}", "title": "" }, { "docid": "68a28be9b5d6101b6e4c693b98912420", "score": "0.39340094", "text": "func (apmBaseWrapper) Finish() {}", "title": "" } ]
e8285966e394c076ed39f00201d602cd
Fields allows partial responses to be retrieved. See for more information.
[ { "docid": "0ec084c90f64b88d0a56208b8193cc62", "score": "0.0", "text": "func (c *ProjectsLocationsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsListCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" } ]
[ { "docid": "f2139fd7e9d5944410a050f0062210e3", "score": "0.6381827", "text": "func (e GetResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "f802983bbd6d9881dcfb5897c56a019e", "score": "0.6352826", "text": "func (m *Message) GetFieldsFromResponse() []Field {\n\tvar lstFields []Field\n\n\tfor _, tag := range m.AWBResponse {\n\t\tfields := tag.getFields()\n\t\tfor _, f := range fields {\n\t\t\tif f != (Field{}) {\n\t\t\t\tlstFields = append(lstFields, f)\n\t\t\t}\n\t\t}\n\t}\n\treturn lstFields\n}", "title": "" }, { "docid": "059b456284e85806c6b2c9ead9f15593", "score": "0.6276326", "text": "func (u UserShortInfo) Fields(fields ...string) ([]string, []interface{}) {\n\treturn ExtractFieldsFromMap(u.Maps(), fields...)\n}", "title": "" }, { "docid": "f5424819d10fba86c1e5b1e78cbcf506", "score": "0.622559", "text": "func (e RetrieveResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "f56d5d68e33407d9255e913b6903d9f0", "score": "0.61928684", "text": "func (e ResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "f56d5d68e33407d9255e913b6903d9f0", "score": "0.61928684", "text": "func (e ResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "f56d5d68e33407d9255e913b6903d9f0", "score": "0.61928684", "text": "func (e ResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "f56d5d68e33407d9255e913b6903d9f0", "score": "0.61928684", "text": "func (e ResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "02bacc0e1457508dc556dfc68d5e3398", "score": "0.6161598", "text": "func (e StreamingResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "36a5c5fee7d814648f7e5e4a1d25c800", "score": "0.6144886", "text": "func (e RetrieveManyResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "c4b10291f54a1523db379c8001436adc", "score": "0.61086756", "text": "func (m *SearchRequest) GetFields()([]string) {\n val, err := m.GetBackingStore().Get(\"fields\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]string)\n }\n return nil\n}", "title": "" }, { "docid": "91f7c8fed8f68bf7f6a8da58d3eeb4bb", "score": "0.60722286", "text": "func (e OpenResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "e424f613e0269ed392a197770f0d1b20", "score": "0.60537183", "text": "func (e HumanResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "ca12854a3a8d51aeab0d19687be79d5d", "score": "0.6048384", "text": "func (e QueryResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "9fd3fc2846d348e5ff0f2a2d31a9d927", "score": "0.6044624", "text": "func (e ApplicationResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "50405c781c95fc43d55971287c8a8668", "score": "0.6042201", "text": "func (e UserResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "003fca2ac61c7e309a8f9ef3472581c6", "score": "0.60257417", "text": "func (e RequestProxyResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "e369f0ec5ba5ce7bd5d191c5186119f3", "score": "0.600176", "text": "func (Patient) Fields() []ent.Field {\n return []ent.Field{\n field.String(\"firstname\").NotEmpty(),\n field.String(\"lastname\").NotEmpty(),\n field.String(\"cardid\").NotEmpty(),\n field.String(\"allergic\").NotEmpty(),\n field.Int(\"age\").Positive(),\n field.Time(\"brithday\").Default(time.Now().Local).Immutable(),\n }\n}", "title": "" }, { "docid": "5e00c38918f5ae716cea445dc7780559", "score": "0.59941846", "text": "func (AppointmentResults) Fields() []ent.Field {\n\treturn nil\n}", "title": "" }, { "docid": "70f2bf2574b12071a3dc8fa7b7925c95", "score": "0.5989665", "text": "func (e RequestProxyGetResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "3a67a0b67cbe1ceed1516c762cdb8af5", "score": "0.5980462", "text": "func (e GetItemResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "986f547fb4291e892ac186b02f77b02a", "score": "0.5976738", "text": "func (c *FeaturetilesGetCall) Fields(s ...googleapi.Field) *FeaturetilesGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "e4ac87b8c30533e97803abc1c0a761d2", "score": "0.59748346", "text": "func (u User) Fields(fields ...string) ([]string, []interface{}) {\n\treturn ExtractFieldsFromMap(u.Maps(), fields...)\n}", "title": "" }, { "docid": "8e4a541eee59719991c011dc5bf17d80", "score": "0.5969736", "text": "func (c *UserinfoGetCall) Fields(s ...googleapi.Field) *UserinfoGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "aa0fbcc59c0a952c7cf823f01f327a5d", "score": "0.5959869", "text": "func (e DescribePresentationV1ResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "b12f6668701af57da4a2369db1bc98f1", "score": "0.5950905", "text": "func (e GetTestResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "366bfb4eb17c3836399ec90ecc6024eb", "score": "0.59343815", "text": "func (c *GetCall) Fields(s ...googleapi.Field) *GetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "6fe775a9ee2d41a5d4f0b0d542967978", "score": "0.59323496", "text": "func (e GetUserItemsResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "6c9d7b6a223f68df843463c0f35d74e3", "score": "0.5931872", "text": "func (e HttpCallbackResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "95158865b4b50a9cc05a7a32b3f3b54e", "score": "0.5927752", "text": "func (e UnlockResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "0f033f060cdc8fc90f0815fc3465169c", "score": "0.5908386", "text": "func (c *ActionResultsGetCall) Fields(s ...googleapi.Field) *ActionResultsGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "cd23c649edff5f65e8d2eb7395bab912", "score": "0.5908269", "text": "func (c *AchievementsRevealCall) Fields(s ...googleapi.Field) *AchievementsRevealCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "8196ef0bb710e37be78c8bcba3affcf3", "score": "0.5905012", "text": "func (e LookupResourcesResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "fcee7df8a4f4eaeda42af2b16c172ce0", "score": "0.59044355", "text": "func (e PlateIndexResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "dd436ff239cceb67fec00e3c28dc6769", "score": "0.5900956", "text": "func (u UserOptions) Fields(fields ...string) ([]string, []interface{}) {\n\treturn ExtractFieldsFromMap(u.Maps(), fields...)\n}", "title": "" }, { "docid": "a9e49d7b2ea52639cdfbdf35b9d36214", "score": "0.5889684", "text": "func determineResponseFields(fields []*string) map[string]int {\n\tfieldsToKeep := map[string]int{\"class\": 0, \"properties\": 0, \"creationtimeunix\": 0, \"key\": 0, \"id\": 0}\n\n\tif len(fields) > 0 {\n\t\t// check if \"ALL\" option is provided\n\t\tfor _, field := range fields {\n\t\t\tfieldToKeep := strings.ToLower(*field)\n\t\t\tif fieldToKeep == \"all\" {\n\t\t\t\treturn fieldsToKeep\n\t\t\t}\n\t\t}\n\n\t\tfieldsToKeep = make(map[string]int)\n\t\t// iterate over the provided fields\n\t\tfor _, field := range fields {\n\t\t\tfieldToKeep := strings.ToLower(*field)\n\t\t\tfieldsToKeep[fieldToKeep] = 0\n\t\t}\n\t}\n\n\treturn fieldsToKeep\n}", "title": "" }, { "docid": "f05ad919df89b6ca99a21b22f313050f", "score": "0.58770514", "text": "func (o *SearchBody) GetFieldsOk() (*[]string, bool) {\n\tif o == nil || o.Fields == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Fields, true\n}", "title": "" }, { "docid": "2c3c0c626c544e2bd3d6db27765b804f", "score": "0.5871828", "text": "func (e HttpBodyValidationError) Field() string { return e.field }", "title": "" }, { "docid": "f2cd8f726fa778b4a30ff69ca5467246", "score": "0.58702576", "text": "func (e CreatePresentationV1ResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "a9622ca8d9a5720fc9ab7d2eae3184c1", "score": "0.5869415", "text": "func (c *HeartbeatCall) Fields(s ...googleapi.Field) *HeartbeatCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "15ed6bd3cbc3f6bb94a2484d058abdfd", "score": "0.5867813", "text": "func (e GetHouseResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "f0984cc1f5fab38e3e3eb03432a0adc1", "score": "0.5864225", "text": "func (e Response_ChainValidationError) Field() string { return e.field }", "title": "" }, { "docid": "3fccc6c5806bcef8f769d2e3090654fc", "score": "0.58636844", "text": "func (c *OperationsGetCall) Fields(s ...googleapi.Field) *OperationsGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "3fccc6c5806bcef8f769d2e3090654fc", "score": "0.58636844", "text": "func (c *OperationsGetCall) Fields(s ...googleapi.Field) *OperationsGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "3fccc6c5806bcef8f769d2e3090654fc", "score": "0.58636844", "text": "func (c *OperationsGetCall) Fields(s ...googleapi.Field) *OperationsGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "3fccc6c5806bcef8f769d2e3090654fc", "score": "0.58636844", "text": "func (c *OperationsGetCall) Fields(s ...googleapi.Field) *OperationsGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "3fccc6c5806bcef8f769d2e3090654fc", "score": "0.58636844", "text": "func (c *OperationsGetCall) Fields(s ...googleapi.Field) *OperationsGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "a0596418c647ef4cb40314039d35f515", "score": "0.5852313", "text": "func (e ReadRelationshipsResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "61efe5bc729c0bc673af698524971e33", "score": "0.58435214", "text": "func (c *DataMcfGetCall) Fields(s ...googleapi.Field) *DataMcfGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "258d89683dd1fc4f441359f1c4f54d8e", "score": "0.58434534", "text": "func (e LockResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "bd13068ac790585751790652bb1ca4f4", "score": "0.5843093", "text": "func (c *PeekCall) Fields(s ...googleapi.Field) *PeekCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "fde7c2b6388736fdd63d16e2e591175b", "score": "0.5837903", "text": "func (c *ManagementGoalsGetCall) Fields(s ...googleapi.Field) *ManagementGoalsGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "26f11cbf05b09711d24accc3e3e5b11b", "score": "0.5831026", "text": "func (e UpdateResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "230f87eed63a9b50a5efcbd4f2050d4e", "score": "0.58269006", "text": "func (e CryptoServicePayloadResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "8f5bc15d51ae105fb013f1317d073962", "score": "0.58265156", "text": "func (c *PeopleGetCall) Fields(s ...googleapi.Field) *PeopleGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "0c8215ca35040ab912f9a62f51331d59", "score": "0.58203334", "text": "func (c *TerraintilesGetCall) Fields(s ...googleapi.Field) *TerraintilesGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "ad3daf9dfb630622ec333291e17b287f", "score": "0.5813494", "text": "func (c *DataGaGetCall) Fields(s ...googleapi.Field) *DataGaGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "f4f1a28a11dcf65481f540624b7f869a", "score": "0.57996005", "text": "func (e ExternalIDPSearchResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "1634490d76dc5de59444a314af34bffd", "score": "0.57983226", "text": "func (e GetQuestionsResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "a0277b2b18c19f5627cfc32d3a90396b", "score": "0.5792238", "text": "func (e AppSKeyResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "f0ebafd8fe11c54a02a6966c33cdfa01", "score": "0.57920915", "text": "func (e UpdatePresentationV1ResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "884523c194b137b5e4267e9173328449", "score": "0.5791545", "text": "func (e RepairResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "124080d3b787a9f73867de819f015cc7", "score": "0.5787134", "text": "func (e GenerateProvenanceResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "19b235e12dc942f5aee1a31c02dfaade", "score": "0.5786723", "text": "func (c *RelyingpartyResetPasswordCall) Fields(s ...googleapi.Field) *RelyingpartyResetPasswordCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "30f842039f5cf3bdeda4d64436e538f3", "score": "0.5786546", "text": "func (e MetadataKind_RequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "a70eb3b2efc6baf91d646eca11a9330b", "score": "0.5781105", "text": "func (e DropMetaDataResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "f92985202a11de857b5e9a9dc0ba6115", "score": "0.5778532", "text": "func (e ListEquipmentMetadataResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "5f26f309cd5eea863856dce95868a1ae", "score": "0.57754964", "text": "func (e GetEquipmentResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "aa54a45a60f4621b8839565f7f9ebb79", "score": "0.57706165", "text": "func (c *ChallengeVerifyCall) Fields(s ...googleapi.Field) *ChallengeVerifyCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "188cd438ee1eca1b7010145fe7a6b78c", "score": "0.57702553", "text": "func (c *ManagementUnsampledReportsGetCall) Fields(s ...googleapi.Field) *ManagementUnsampledReportsGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "bdae83890002f873dad44a14018309bc", "score": "0.57695127", "text": "func (u UserUpdateEmail) Fields(fields ...string) ([]string, []interface{}) {\n\treturn ExtractFieldsFromMap(u.Maps(), fields...)\n}", "title": "" }, { "docid": "377bc172a6b7488186c3db264e6f93ca", "score": "0.57673585", "text": "func (c *RelyingpartySendVerificationCodeCall) Fields(s ...googleapi.Field) *RelyingpartySendVerificationCodeCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "aac826498152cc2e932014e7278bf857", "score": "0.5763639", "text": "func (c *CallsetsGetCall) Fields(s ...googleapi.Field) *CallsetsGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "71f3d345439cd8f9df041ba0f5a2f49a", "score": "0.576323", "text": "func (c *TurnBasedMatchesGetCall) Fields(s ...googleapi.Field) *TurnBasedMatchesGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "fbe3664861d3eae7593c39b3ce8845cd", "score": "0.5762174", "text": "func (c *PlayersGetCall) Fields(s ...googleapi.Field) *PlayersGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "89a39cc5661575fd0094f9dc454cd645", "score": "0.57599014", "text": "func (e MultiCreatePresentationsV1ResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "29a6195fe086e33b429b23d7a524f9e2", "score": "0.5758443", "text": "func (o CounterOptionsResponseOutput) Field() pulumi.StringOutput {\n\treturn o.ApplyT(func(v CounterOptionsResponse) string { return v.Field }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "84b49f83b93389485962ffb5bf972c1e", "score": "0.57568127", "text": "func (e ListPresentationsV1ResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "7ee381b97a3f32d164960138c699a485", "score": "0.5756319", "text": "func (HTTPOperation) GetVerboseResponseFieldNames() []string {\n\treturn []string{\"id\", \"date\", \"number available\", \"number total\", \"vaccine\", \"input type\", \"tags\", \"location\", \"organization\", \"created at\"}\n}", "title": "" }, { "docid": "33fb1c6b8aaae2ffcc881932f0efe3aa", "score": "0.5754754", "text": "func (c *RelyingpartyVerifyPasswordCall) Fields(s ...googleapi.Field) *RelyingpartyVerifyPasswordCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "b770f947f5ec19fa8636a3aa1eefa165", "score": "0.5751486", "text": "func (e ApiRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "e496b083d8b611c043fb6a10a1f1cf4e", "score": "0.5746302", "text": "func (c *SucceedCall) Fields(s ...googleapi.Field) *SucceedCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "28f257269def99dce2193363adf133b1", "score": "0.57454205", "text": "func (e CreateResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "28f257269def99dce2193363adf133b1", "score": "0.57454205", "text": "func (e CreateResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "28f257269def99dce2193363adf133b1", "score": "0.57454205", "text": "func (e CreateResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "7e745822ffd49fa7d2a8cb5a33486646", "score": "0.5745311", "text": "func (e UpsertMetadataResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "8ab6600d237a5c8117009137c937759c", "score": "0.57450753", "text": "func (e GetGateResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "97638888045dcdb04b96654254312ef6", "score": "0.57449484", "text": "func (c *ManagementWebpropertiesGetCall) Fields(s ...googleapi.Field) *ManagementWebpropertiesGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "8d100628dc5b9ae1c0849f329d0b97ca", "score": "0.5743171", "text": "func (e OrgDomainValidationResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "67f76e461f7975aeb8c5ebcba7aee3fd", "score": "0.5738827", "text": "func (c *RelyingpartyGetAccountInfoCall) Fields(s ...googleapi.Field) *RelyingpartyGetAccountInfoCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "3bb1067420ba8024a6fdd9aeb63ebd6a", "score": "0.5728262", "text": "func (e EquipmentTypesResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "633d4b33bdb2450a4153ad148ca10c83", "score": "0.57255316", "text": "func (c *DatasetsGetIamPolicyCall) Fields(s ...googleapi.Field) *DatasetsGetIamPolicyCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "268e2f0869038557e0272e0bdcc3defb", "score": "0.5723996", "text": "func (c *TurnBasedMatchesRematchCall) Fields(s ...googleapi.Field) *TurnBasedMatchesRematchCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "55cdcd7da535daa4772c508bbe81a928", "score": "0.57203746", "text": "func (fieldsResp *FieldsResp) Data() []FieldResp {\n\tcollection, _ := normalizeODataCollection(*fieldsResp)\n\tfields := []FieldResp{}\n\tfor _, item := range collection {\n\t\tfields = append(fields, FieldResp(item))\n\t}\n\treturn fields\n}", "title": "" }, { "docid": "cd373fb55de14d64c629d5e07e41e6d9", "score": "0.57198656", "text": "func (fs *FranchiseService) Fields() ([]string, error) {\n\tf, err := fs.client.getFields(fs.end)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"cannot get Franchise fields\")\n\t}\n\n\treturn f, nil\n}", "title": "" }, { "docid": "c643bd0afe439bd5dc8e7ec0d3e2a6c4", "score": "0.57187563", "text": "func (e GetRequestValidationError) Field() string { return e.field }", "title": "" }, { "docid": "81fb105cc61f5421381528df292e55d5", "score": "0.57185495", "text": "func (e NwkSKeysResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "17088211e657ad86194d9f90b82288f3", "score": "0.57177377", "text": "func (e CloseResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "0f307512730c6c00a0cada5636226bec", "score": "0.57146865", "text": "func (res *Result) Fields() []*mysql.Field {\n\treturn res.fields\n}", "title": "" }, { "docid": "0ccc772560b489e48e4be2a8ee00872a", "score": "0.5714424", "text": "func (c *PlayersHideCall) Fields(s ...googleapi.Field) *PlayersHideCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "27bd0e06cf94fbdba4745edfa907f827", "score": "0.57134825", "text": "func (e ApplicationSearchResponseValidationError) Field() string { return e.field }", "title": "" } ]
dfe5d828cd8ee820a42433f3fd8eddd8
current returns the full key name of the current context.
[ { "docid": "7bccfdc07e2511800b71303b127d6156", "score": "0.77410424", "text": "func (p *parser) current() string {\n\tif len(p.currentKey) == 0 {\n\t\treturn p.context.String()\n\t}\n\tif len(p.context) == 0 {\n\t\treturn p.currentKey\n\t}\n\treturn fmt.Sprintf(\"%s.%s\", p.context, p.currentKey)\n}", "title": "" } ]
[ { "docid": "6b778d98f00cfaaa7928c83e169d4679", "score": "0.76080704", "text": "func (xn *XMLNode) CurrentKey() string {\n\tkeys := strings.Split(xn.Path, \".\")\n\treturn keys[len(keys)-1]\n}", "title": "" }, { "docid": "0ea8bdb057e864e94c73fb884c840951", "score": "0.7212399", "text": "func (tm *TokenManager) CurrentKey() ksuid.KSUID {\n\treturn tm.keyID\n}", "title": "" }, { "docid": "cb6f2bbecbd78059eba79ea96584b545", "score": "0.7023973", "text": "func (c Context) Key() string {\n\treturn c.key\n}", "title": "" }, { "docid": "e7f2e17cf7f5737342969f11c6e632d6", "score": "0.66207933", "text": "func (c Context) FullyQualifiedKey() string {\n\treturn c.fullyQualifiedKey\n}", "title": "" }, { "docid": "ab8d58d0d12be0df8fec88d45f5382b7", "score": "0.6550285", "text": "func (t *TraceID) GetCurrent() string {\n\treturn t.currentID\n}", "title": "" }, { "docid": "0d3772e971879658e4f185857d49e054", "score": "0.6416807", "text": "func (f *Framework) Key() string {\n\treturn f.Namespace + \"/\" + f.Name\n}", "title": "" }, { "docid": "ff21351abab443b935e77ea2e0207ee4", "score": "0.6337702", "text": "func GetCurrentContext() (string, string) {\n\tconfig := GetRawConfig()\n\tns := config.Contexts[config.CurrentContext].Namespace\n\tif !(len(ns) > 0) {\n\t\tns = \"default\"\n\t}\n\treturn config.CurrentContext, ns\n}", "title": "" }, { "docid": "0c43dc905443dad4692a796b87a2699c", "score": "0.6267738", "text": "func (vc *Config) Key() string {\n\treturn vc.Keys[0]\n}", "title": "" }, { "docid": "3e2d46d1b5d92e469ddd65366849002f", "score": "0.6250847", "text": "func (m *Menu) Current() string {\n\treturn m.list[m.cursor]\n}", "title": "" }, { "docid": "507235405a8a7829be6fd9c19e3eddc3", "score": "0.6216344", "text": "func (cli *DockerCli) CurrentContext() string {\n\treturn cli.currentContext\n}", "title": "" }, { "docid": "7e0258798f42da090e4cd5fa00845a60", "score": "0.6200939", "text": "func CurrentState(commandName string) string {\n\tstate, ok := commandState[commandName]\n\tif !ok {\n\t\treturn NA\n\t}\n\treturn string(state)\n}", "title": "" }, { "docid": "7190cef6ecce16d01ded97e34708224e", "score": "0.61534894", "text": "func (m *KeyManager) GetCurrentKey() (keyID uint64, key *encryptionpb.DataKey, err error) {\n\t// TODO: Implement\n\treturn 0, nil, nil\n}", "title": "" }, { "docid": "682f770c444dce7fd6812a26173b281d", "score": "0.61442614", "text": "func (params *KnParams) CurrentNamespace() (string, error) {\n\tvar err error\n\tif params.fixedCurrentNamespace != \"\" {\n\t\treturn params.fixedCurrentNamespace, nil\n\t}\n\tif params.ClientConfig == nil {\n\t\tparams.ClientConfig, err = params.GetClientConfig()\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\tname, _, err := params.ClientConfig.Namespace()\n\treturn name, err\n}", "title": "" }, { "docid": "0ecfff02cff5a0ca6fb1f8a868ee9232", "score": "0.6119089", "text": "func (status Status) Key() string {\n\treturn Config.GetKeyPrefix() + string(status)\n}", "title": "" }, { "docid": "222a36afe10260c69a1fc88e17e294a7", "score": "0.6104519", "text": "func Context(ctx context.Context) string {\n\ts, _ := ctx.Value(ContextKey).(string)\n\treturn s\n}", "title": "" }, { "docid": "a6c6885484851559b260845275837162", "score": "0.6104082", "text": "func (f *FSM) CurrentState() string {\n\treturn f.current.name\n}", "title": "" }, { "docid": "259ae680f4104e1100d11c2649d8cf67", "score": "0.6094764", "text": "func (s State) CurrentState() string {\n\treturn string(s.currentState)\n}", "title": "" }, { "docid": "2b71cbdb4389dced368058cf734eab9c", "score": "0.60900855", "text": "func (w *Walker) CurrentCmd() string {\n\tif len(w.stack) > 0 && w.top <= len(w.stack) && w.top > 0 {\n\t\treturn w.stack[w.top-1]\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "f772eebb1923980475be9692fa9255a2", "score": "0.6065035", "text": "func (c ContextKey) String() string {\n\treturn string(c)\n}", "title": "" }, { "docid": "901518c499a9ff43b2f2ffe506ae5ac8", "score": "0.6063142", "text": "func (c *Counter) Key() string { return string(c.key) }", "title": "" }, { "docid": "b997011ec4c061a02b285cf4d1f5db0e", "score": "0.60501814", "text": "func (status VaultStatus) Key() string {\n\treturn status.Name\n}", "title": "" }, { "docid": "9030937667326008d010e5d9ed286672", "score": "0.6046345", "text": "func (e *Env) Key() string {\n\treturn KeyEnv\n}", "title": "" }, { "docid": "d6c944f648a838e2ad1f7f02f3d605fe", "score": "0.6040014", "text": "func (l *Live) ContextName() string {\n\treturn l.currentContextName\n}", "title": "" }, { "docid": "c0bef0b9a9974b78ece774fa0841552f", "score": "0.60244644", "text": "func (r *LaunchTemplate) KeyName() pulumi.StringOutput {\n\treturn (pulumi.StringOutput)(r.s.State[\"keyName\"])\n}", "title": "" }, { "docid": "064a218fba4a12f1c412ed8629510618", "score": "0.5992835", "text": "func (ctx Ctx) GetCurrentUsername() string {\n\tclaims := ctx.GetJwtClaims()\n\t//TODO: \"auth.identity\" should come from configuration\n\tif username, ok := claims[\"auth.identity\"].(string); ok {\n\t\treturn username\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "cc334846878c511c800bcf4947fe4ffd", "score": "0.5983926", "text": "func (s PathnameSetter) CurrentValue() string {\n\treturn fmt.Sprintf(\"%v\", *s.Value)\n}", "title": "" }, { "docid": "5429670b6b7b493f0145418be8c0465a", "score": "0.59758085", "text": "func (v EnvVariable) Key() string {\n\treturn (string)(v)\n}", "title": "" }, { "docid": "acbdfc8bbd07b529748efa808ee98c7e", "score": "0.5966265", "text": "func (c *TreeCursor) CurrentFieldName() string {\n\treturn C.GoString(C.ts_tree_cursor_current_field_name(c.c))\n}", "title": "" }, { "docid": "faae3d7293080c744fea5d5c0c2744e2", "score": "0.5965474", "text": "func (r *Instance) KeyName() pulumi.StringOutput {\n\treturn (pulumi.StringOutput)(r.s.State[\"keyName\"])\n}", "title": "" }, { "docid": "127a127c7a2e186ab473a3667f46d7bf", "score": "0.5962482", "text": "func (c *Context) CurrentIndex() uint64 {\n\treturn c.currentIndex\n}", "title": "" }, { "docid": "8caefee81339843385c311a79106e5ed", "score": "0.5956178", "text": "func (l *Lexer) Current() string {\n\treturn l.Input[l.start:l.pos]\n}", "title": "" }, { "docid": "9282dc820051ef456b0c2d7c107cf866", "score": "0.5930334", "text": "func GetKey(ctx *context.Context) string {\n\treturn ctx.Values().GetString(entryKeyContextKey)\n}", "title": "" }, { "docid": "4f86cbeb26789c5f94c9252559482af4", "score": "0.5924919", "text": "func (f *RotatedFile) CurrentFilename() string {\n\trn := f.c.MaxRotatedFileNum\n\tidx := f.curIdx\n\tsuffix := \"\"\n\tif rn <= 100 {\n\t\tsuffix = fmt.Sprintf(\".%02d\", idx)\n\t} else if rn <= 1000 {\n\t\tsuffix = fmt.Sprintf(\".%03d\", idx)\n\t} else if rn <= 10000 {\n\t\tsuffix = fmt.Sprintf(\".%04d\", idx)\n\t} else {\n\t\tsuffix = fmt.Sprintf(\".%05d\", idx)\n\t}\n\treturn f.filename + suffix\n}", "title": "" }, { "docid": "8d08f820b13585944f732c0e33c3ffb0", "score": "0.5920776", "text": "func (lxr *Lexer) Current() string {\n\treturn lxr.Input[lxr.Start:lxr.Pos]\n}", "title": "" }, { "docid": "7166d33222b3cea2759b64dfa1eb4ac9", "score": "0.5913523", "text": "func (m *Machine) Current() string {\n\tif m.current == \"\" {\n\t\treturn m.Initial\n\t}\n\treturn m.current\n}", "title": "" }, { "docid": "df66b56bc876c6e728e1ed43a5f6d0d7", "score": "0.58981043", "text": "func (k Key) Name() string {\n\treturn k.name\n}", "title": "" }, { "docid": "5ed8d2dec3f67245c5385fd22c07a3a7", "score": "0.5890917", "text": "func (ch *ContextHandler) GetCurrent() *Context {\n\tcur := ch.Current\n\tif cur == \"\" {\n\t\treturn nil\n\t}\n\treturn ch.Get(cur)\n}", "title": "" }, { "docid": "7e81f6b8b3fc9672ecbd58aec4174bc9", "score": "0.5880622", "text": "func (e Total) Key() string {\n\treturn e.Name\n}", "title": "" }, { "docid": "30c229a7d8b9cb2dd64aafbe0148c958", "score": "0.58698976", "text": "func getGlobalKey(accessToken string) string {\n\tvar buider strings.Builder\n\tbuider.WriteString(globalTag)\n\tbuider.WriteString(accessToken)\n\n\treturn buider.String()\n}", "title": "" }, { "docid": "eb63f64f6ca3446e944317b021553597", "score": "0.58474267", "text": "func (it *ListIter) Current() (key, val []byte) {\n\treturn it.curr.key, it.curr.val\n}", "title": "" }, { "docid": "57324284c3aeadc5348e443122fb4c09", "score": "0.58359754", "text": "func (wd *WorkDir) Key() string {\n\treturn KeyWorkDir\n}", "title": "" }, { "docid": "c05e0c1749b85592cfb8b448c1dbaa8e", "score": "0.58331317", "text": "func (k Key) String() string {\n\tswitch k {\n\tcase ClassesRoot:\n\t\treturn \"HKEY_CLASSES_ROOT\"\n\tcase CurrentUser:\n\t\treturn \"HKEY_CURRENT_USER\"\n\tcase LocalMachine:\n\t\treturn \"HKEY_LOCAL_MACHINE\"\n\tcase Users:\n\t\treturn \"HKEY_USERS\"\n\tcase Hive:\n\t\treturn \"\"\n\tdefault:\n\t\treturn \"Unknown\"\n\t}\n}", "title": "" }, { "docid": "b4110739a08d766cb1a3b0ace211072c", "score": "0.5828507", "text": "func (s *ScalingTarget) Key() string {\n\treturn fmt.Sprintf(\"%s->%s/%s\", s.Kind, s.Namespace, s.Name)\n}", "title": "" }, { "docid": "5a248935c2d62394e41a4568f704eb2a", "score": "0.5827001", "text": "func (l *loader) GetCurrentContext() (string, error) {\n\tconfig, err := l.LoadRawConfig()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn config.CurrentContext, nil\n}", "title": "" }, { "docid": "5a248935c2d62394e41a4568f704eb2a", "score": "0.5827001", "text": "func (l *loader) GetCurrentContext() (string, error) {\n\tconfig, err := l.LoadRawConfig()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn config.CurrentContext, nil\n}", "title": "" }, { "docid": "51cbfc6f36f0a7276236d66832febad3", "score": "0.58259475", "text": "func (k Key) Context() request.ContextKey {\n\treturn KeyMaps[k].Context\n}", "title": "" }, { "docid": "eebff112442c6b2d0bc1795b07a9cbcc", "score": "0.5825915", "text": "func (cipherMetric CipherMetrics) Key() string {\n\treturn \"global\"\n}", "title": "" }, { "docid": "643a1177157296426cd242d6c7402bc0", "score": "0.58174384", "text": "func Key(c *gin.Context) *model.Key {\n\tv, ok := c.Get(KeyContextKey)\n\n\tif !ok {\n\t\treturn nil\n\t}\n\n\tr, ok := v.(*model.Key)\n\n\tif !ok {\n\t\treturn nil\n\t}\n\n\treturn r\n}", "title": "" }, { "docid": "9315f8ed8d0889c9f3de50effa5b166d", "score": "0.5814719", "text": "func (b *Bucket) Key() string {\n\treturn b.conf.Viper.GetString(\"key\")\n}", "title": "" }, { "docid": "7d140fd7da12bde31ad6de837ee23285", "score": "0.58056915", "text": "func (s filePairStore) CurrentPath() string {\n\treturn s.fileStore.CurrentPath()\n}", "title": "" }, { "docid": "b13d7d7f3e53f5d452c9afc70f7ec882", "score": "0.579597", "text": "func CurrentDatabaseName(ctx context.Context, db *sql.DB) (result string, err error) {\n\terr = db.QueryRowContext(ctx, QueryMarkerSQL+\"SELECT pg_catalog.current_database()\").Scan(&result)\n\treturn\n}", "title": "" }, { "docid": "44e4160f3e30245973f133cf3b43954d", "score": "0.57911515", "text": "func (k *Keys) GetActiveKey() string {\n\treturn k.GetKey(k.useID)\n}", "title": "" }, { "docid": "36171fe58ac8515414b8a522b7adf1df", "score": "0.57753307", "text": "func (gi *GlobalIdentity) GetKey() string {\n\tvar str strings.Builder\n\tfor _, l := range gi.LabelArray {\n\t\tstr.Write(l.FormatForKVStore())\n\t}\n\treturn str.String()\n}", "title": "" }, { "docid": "3b7704a813459a528a56056210bff84f", "score": "0.5774423", "text": "func (fs *FSProfileStore) CurrentProfile() (string, error) {\n\tprofileName, err := profile.GetCurrentProfileName(fs.Dir)\n\tif err != nil {\n\t\treturn \"\", trace.Wrap(err)\n\t}\n\treturn profileName, nil\n}", "title": "" }, { "docid": "b6802a59bcc8d26232b8798137fb73f9", "score": "0.5763551", "text": "func (e Increment) Key() string {\n\treturn e.Name\n}", "title": "" }, { "docid": "4f0238e950c7aedb746b699d92c938c5", "score": "0.575468", "text": "func (k StringKey) Name() string {\n\treturn k.name\n}", "title": "" }, { "docid": "b44cc748694fdaee5843fd6366e2ad8b", "score": "0.5750135", "text": "func getCurrentContext(context DrConfig) DrContext {\n\tvar currentContext DrContext\n\tfor _, c := range context.Contexts {\n\t\tif c.Name == context.CurrentContext {\n\t\t\tcurrentContext = c\n\t\t\tbreak\n\t\t}\n\t}\n\treturn currentContext\n}", "title": "" }, { "docid": "11bec9090c920ff853c2c20b6c56a919", "score": "0.5740338", "text": "func (this AggregateFunctionCall) Key() string {\n\treturn fmt.Sprintf(\"%s-%t-%v\", this.FunctionCall.Name, this.FunctionCall.Operands[0].Star, this.FunctionCall.Operands[0].Expr)\n}", "title": "" }, { "docid": "05a5370f87e19ad99e38eb6dac5c9e96", "score": "0.57259995", "text": "func (f *File) Key() string {\n\text := filepath.Ext(f.path)\n\treturn strings.TrimSuffix(f.path, ext)\n}", "title": "" }, { "docid": "14a51d8ec50ed39c39e36386a0ed32dc", "score": "0.57214963", "text": "func (r *CloudProvider) CurrentNodeName(ctx context.Context, hostname string) (types.NodeName, error) {\n\treturn types.NodeName(hostname), nil\n}", "title": "" }, { "docid": "c5ef3a2aeffd5ef58c5439ac6b360738", "score": "0.5714493", "text": "func (api *roleAPI) getFullKey(tenant, name string) string {\n\tif tenant != \"\" {\n\t\treturn fmt.Sprint(globals.ConfigRootPrefix, \"/\", \"auth\", \"/\", \"roles\", \"/\", tenant, \"/\", name)\n\t}\n\treturn fmt.Sprint(globals.ConfigRootPrefix, \"/\", \"auth\", \"/\", \"roles\", \"/\", name)\n}", "title": "" }, { "docid": "61974ee647966ee49fd07d75570e8c48", "score": "0.5709161", "text": "func (key EncryptedVaultKeyFromController) Key() string {\n\treturn key.Name\n}", "title": "" }, { "docid": "844f79aa47c24ae8bebdda9d1a8b30d4", "score": "0.5703948", "text": "func GetCurrentUsername() string {\n\tusr, _ := user.Current()\n\tusername := usr.Username\n\tLog(fmt.Sprintf(\"username='%s'\", username), \"debug\")\n\treturn username\n}", "title": "" }, { "docid": "f76ee8dd9621efed54aafad8bd5cc445", "score": "0.5695104", "text": "func Get(ctx context.Context, key string) string {\n\tmd, ok := FromContext(ctx)\n\tif !ok {\n\t\treturn \"\"\n\t}\n\n\treturn md.Get(key)\n}", "title": "" }, { "docid": "0aab10698f340ce21231ee279ef3f5bb", "score": "0.56783974", "text": "func (e *Endpoint) Key() string {\n\treturn e.Id\n}", "title": "" }, { "docid": "1591b00db5d0d0ee70d59b942b9e7e38", "score": "0.56657106", "text": "func Current() string {\n\tdir, err := filepath.Abs(filepath.Dir(os.Args[0]))\n\tif err != nil {\n\t\treturn \"nil\"\n\t}\n\treturn dir + \"/\"\n}", "title": "" }, { "docid": "3dae496f3725207b4707e8f0ac9e841c", "score": "0.56655604", "text": "func (c *Cloud) CurrentNodeName(ctx context.Context, hostname string) (types.NodeName, error) {\n\treturn types.NodeName(hostname), nil\n}", "title": "" }, { "docid": "54904ef418c43f91d82efc5d570dc4e1", "score": "0.56548184", "text": "func (k *key) String() string { return k.Name }", "title": "" }, { "docid": "dd918d8a94688eee08a3ecbce2e7d8ba", "score": "0.5639848", "text": "func (api *authenticationpolicyAPI) getFullKey(tenant, name string) string {\n\tif tenant != \"\" {\n\t\treturn fmt.Sprint(globals.ConfigRootPrefix, \"/\", \"auth\", \"/\", \"authn-policy\", \"/\", tenant, \"/\", name)\n\t}\n\treturn fmt.Sprint(globals.ConfigRootPrefix, \"/\", \"auth\", \"/\", \"authn-policy\", \"/\", name)\n}", "title": "" }, { "docid": "b97a522165bc7b7f41c85f192aa8d28c", "score": "0.5635666", "text": "func (b *Backend) Key() string {\n\treturn b.Hostname\n}", "title": "" }, { "docid": "add0bd5c72327ea88d540f141328c65d", "score": "0.56352866", "text": "func (t *SingleVector) Key() string {\n\treturn t.Name.Key\n}", "title": "" }, { "docid": "149eec63dde20dade2943fc18e85d54c", "score": "0.5633621", "text": "func (v *Wrapper) KeyId(_ context.Context) (string, error) {\n\treturn v.currentKeyId.Load().(string), nil\n}", "title": "" }, { "docid": "652d9d2ea452860eeb54b66b59431d32", "score": "0.56327885", "text": "func (fe *FuncEntry) Key() string {\n\treturn fe.id\n}", "title": "" }, { "docid": "8ae1471ac27b3774362cf290be6a930a", "score": "0.56310546", "text": "func (t *Thread) Key() key.Key {\n\treturn t.root\n}", "title": "" }, { "docid": "c011284e05ae2adaaaf2619739b77852", "score": "0.5620536", "text": "func current_state(proc PDAProcessor) string{\n\treturn proc.Current_State\n}", "title": "" }, { "docid": "7b61cad01a506357a2e9129a6197a958", "score": "0.5613403", "text": "func (e *xmlExtractor) currentContext() xmlExtractorContext {\n\treturn e.context[len(e.context)-1]\n}", "title": "" }, { "docid": "99db2fe09d9bcaf834626ac755df927c", "score": "0.5612498", "text": "func (meta *Meta) Key() string {\n\treturn Key(meta.GroupVersionKind.Kind, meta.Name, meta.Namespace)\n}", "title": "" }, { "docid": "023b67fd3f8099d903aec047f09460e2", "score": "0.5602773", "text": "func (o KeysAzureOutput) KeyName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v KeysAzure) string { return v.KeyName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "e172e6ad145d5fd5e359a97410c5019d", "score": "0.5599869", "text": "func Name(c context.Context) string {\n\treturn FromContext(c).Name()\n}", "title": "" }, { "docid": "b88f26d1b644eaa92d929f8946aae00e", "score": "0.55976206", "text": "func (c *Context) CurrentTerm() uint64 {\n\treturn c.currentTerm\n}", "title": "" }, { "docid": "5643b2c572833095fbead0c46d5a75a7", "score": "0.55915207", "text": "func (a *APIDefinition) Context() string {\n\tif a.Name != \"\" {\n\t\treturn fmt.Sprintf(\"API %#v\", a.Name)\n\t}\n\treturn \"unnamed API\"\n}", "title": "" }, { "docid": "98236cda6dd2e1db8c33573681fbe6da", "score": "0.55855316", "text": "func Key() interface{} { return key }", "title": "" }, { "docid": "5c91ad6ea4a119047a7d90302f864960", "score": "0.5584448", "text": "func (c Config) Key(key string) string {\n\treturn c[key]\n}", "title": "" }, { "docid": "e2bb0875b5ba352cd39d3bfbea09ca82", "score": "0.558072", "text": "func (f *Pkger) Current() (here.Info, error) {\n\treturn f.Here, nil\n}", "title": "" }, { "docid": "d030d447cd6deeb7dc4493f887fc1715", "score": "0.55710614", "text": "func (api *userAPI) getFullKey(tenant, name string) string {\n\tif tenant != \"\" {\n\t\treturn fmt.Sprint(globals.ConfigRootPrefix, \"/\", \"auth\", \"/\", \"users\", \"/\", tenant, \"/\", name)\n\t}\n\treturn fmt.Sprint(globals.ConfigRootPrefix, \"/\", \"auth\", \"/\", \"users\", \"/\", name)\n}", "title": "" }, { "docid": "48fff9aaebc1fd7e4052a4aa6228af91", "score": "0.55670696", "text": "func key() string {\n\treturn \"HOME\"\n}", "title": "" }, { "docid": "713c8eb59abb3bbd2960e16fab326934", "score": "0.5564746", "text": "func (self *LevelIterator) Key() (string) {\n\treturn string(self.iterator.Key())\n}", "title": "" }, { "docid": "fd437f1f966408466a764267d90c3345", "score": "0.5560307", "text": "func getCurrentPath() string {\n\t_, filename, _, _ := runtime.Caller(1)\n\n\treturn path.Dir(filename)\n}", "title": "" }, { "docid": "8473e77b9893f6e24b6c1dff8de8f213", "score": "0.5556603", "text": "func (p *pather) Key() string {\n\treturn p.key\n}", "title": "" }, { "docid": "56054f70b2d1df540ce370e2eb8dc245", "score": "0.5555813", "text": "func (k *Kubectl) GetCurrentNamespace() (string, error) {\n\tcontexts, err := k.GetContexts()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tfor _, c := range contexts {\n\t\tif c.Current {\n\t\t\treturn c.Namespace, nil\n\t\t}\n\t}\n\n\t// namespace will be empty if namespace does not set in kubeconfig\n\treturn \"\", nil\n}", "title": "" }, { "docid": "7efcc6205a1c2adda390cfb26eba72e8", "score": "0.5551629", "text": "func CurrentVersion() string {\n\treturn GitCommit\n}", "title": "" }, { "docid": "8efaa7e5b5aea9237d74b48c5938d05f", "score": "0.5547423", "text": "func (p *Provider) CurrentSlotID() uint {\n\treturn 0\n}", "title": "" }, { "docid": "8ae7733d9360a1ffadb62f30a64c05cb", "score": "0.5545478", "text": "func key(key storage.Key) string {\n\treturn storageutil.JoinFields(key.Namespace(), key.ID())\n}", "title": "" }, { "docid": "9ff76e21cd1a0cd0514606ee92d1a741", "score": "0.5538884", "text": "func (s *Service) Key() types.NamespacedName {\n\treturn types.NamespacedName{Name: s.consoleobj.GetName(), Namespace: s.consoleobj.GetNamespace()}\n}", "title": "" }, { "docid": "ca72a83b8e36fd28b77d3e5eb3723e4c", "score": "0.55384016", "text": "func (status EdgeviewStatus) Key() string {\n\treturn \"global\"\n}", "title": "" }, { "docid": "27cc7008b08cbf9c8b4b93bae4c35c8f", "score": "0.55344474", "text": "func (e *Endpoint) KeyName() string {\n\treturn \"Id\"\n}", "title": "" }, { "docid": "46e84c354a9b7097c440c2a8bdc23dbb", "score": "0.5525987", "text": "func current(ctx *cli.Context) error {\n\tenv, err := util.GetEnv(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tenvName := env.Name\n\tif len(envName) == 0 {\n\t\tenvName = \"n/a\"\n\t}\n\n\tns, err := config.Get(config.Path(\"namespaces\", env.Name, \"current\"))\n\tif err != nil || len(ns) == 0 {\n\t\tns = \"n/a\"\n\t}\n\n\ttoken, err := token.Get(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tgitcreds, err := config.Get(config.Path(\"git\", \"credentials\"))\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(gitcreds) > 0 {\n\t\tgitcreds = \"[hidden]\"\n\t} else {\n\t\tgitcreds = \"n/a\"\n\t}\n\n\tid := \"n/a\"\n\n\t// Inspect the token\n\tacc, err := auth.Inspect(token.AccessToken)\n\tif err == nil {\n\t\tid = acc.Name\n\t\tif len(id) == 0 {\n\t\t\tid = acc.ID\n\t\t}\n\t}\n\n\tbaseURL, _ := config.Get(config.Path(\"git\", env.Name, \"baseurl\"))\n\tif len(baseURL) == 0 {\n\t\tbaseURL, _ = config.Get(config.Path(\"git\", \"baseurl\"))\n\t}\n\tif len(baseURL) == 0 {\n\t\tbaseURL = \"n/a\"\n\t}\n\n\tfmt.Println(\"user:\", id)\n\tfmt.Println(\"namespace:\", ns)\n\tfmt.Println(\"environment:\", envName)\n\tfmt.Println(\"git.credentials:\", gitcreds)\n\tfmt.Println(\"git.baseurl:\", baseURL)\n\treturn nil\n}", "title": "" }, { "docid": "300583acedc27ce65bd0b1b3369c10fb", "score": "0.5514648", "text": "func CurrentBranchName() (string, error) {\n\tcmd := execCommand(\"git\", \"branch\", \"--show-current\")\n\tout, err := cmd.Output()\n\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn strings.TrimSpace(string(out)), nil\n}", "title": "" }, { "docid": "42f6d43cad223062ac4b9abc3b368f0f", "score": "0.5512744", "text": "func (p *Pair) Key() string { return p.key }", "title": "" }, { "docid": "306b4353d669c28110d4f2c75f9a86ba", "score": "0.551221", "text": "func currentRequestState(c context.Context) *requestState {\n\trs, _ := c.Value(&requestStateContextKey).(*requestState)\n\treturn rs\n}", "title": "" } ]
27722adbedfe6dfff49a62b67e1fbf9f
/ VipGroupsApiService Update a vip group
[ { "docid": "725374cbe05e85bdf813184b88442972", "score": "0.77676415", "text": "func (a *VipGroupsApiService) UpdateVIPGroup(ctx context.Context, vipGroupId int64, vipGroup VipGroupUpdateReq) (VipGroupResp, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Patch\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t \tsuccessPayload VipGroupResp\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/vip-groups/{vip_group_id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"vip_group_id\"+\"}\", fmt.Sprintf(\"%v\", vipGroupId), -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\t// body params\n\tlocalVarPostBody = &vipGroup\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[\"Xms-Auth-Token\"] = key\n\t\t}\n\t}\n\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {\n\t\t\tvar key string\n\t\t\tif auth.Prefix != \"\" {\n\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t} else {\n\t\t\t\tkey = auth.Key\n\t\t\t}\n\t\t\tlocalVarQueryParams.Add(\"token\", key)\n\t\t}\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn successPayload, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn successPayload, localVarHttpResponse, err\n\t}\n\tdefer localVarHttpResponse.Body.Close()\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tbodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)\n\t\treturn successPayload, localVarHttpResponse, reportError(\"Status: %v, Body: %s\", localVarHttpResponse.Status, bodyBytes)\n\t}\n\n\tif err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {\n\t\treturn successPayload, localVarHttpResponse, err\n\t}\n\n\n\treturn successPayload, localVarHttpResponse, err\n}", "title": "" } ]
[ { "docid": "e38a71cfd1533d97c2df011adeb5bcc7", "score": "0.73425555", "text": "func UpdateGroup(w http.ResponseWriter, r *http.Request) {\n\tresponse := services.UpdateGroup(r)\n\n\trender.Status(r, response.Code)\n\trender.JSON(w, r, response)\n}", "title": "" }, { "docid": "42868be193ca8ca361d0ad03e775d3fe", "score": "0.72604316", "text": "func UpdateGroup(w http.ResponseWriter, r *http.Request) {\n\tgroupname, err := ValidatePath(w, r)\n\tif err != nil {\n\t\tThrowClientError(w, r, err)\n\t\treturn\n\t}\n\tvar gwm GroupWithMembers\n\tbody, err := ioutil.ReadAll(io.LimitReader(r.Body, 1048576))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tif err := r.Body.Close(); err != nil {\n\t\tpanic(err)\n\t}\n\tif err := json.Unmarshal(body, &gwm); err != nil {\n\t\tThrowBadEntity(w, r, err)\n\t\treturn\n\t}\n\tif gwm.GroupName != groupname {\n\t\tuiderr := errors.New(\"The name string in your JSON object does not match the group name provided in the URL\")\n\t\tThrowClientError(w, r, uiderr)\n\t\treturn\n\t}\n\tif g := DBFindGroup(groupname); g.GroupName != groupname {\n\t\tThrowNotFound(w, r)\n\t\treturn\n\t}\n\tgwm, err = DBUpdateGroup(gwm)\n\tif err != nil {\n\t\tThrowClientError(w, r, err)\n\t\treturn\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tw.WriteHeader(http.StatusOK)\n\tif err := json.NewEncoder(w).Encode(gwm); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "171543769d8eaf7a2481334719ea7d01", "score": "0.6968966", "text": "func (s *awsService) Update(ctx context.Context, group Elastigroup) error {\n\tinput := &aws.UpdateGroupInput{\n\t\tGroup: group.Obj().(*aws.Group),\n\t}\n\n\t_, err := s.svc.Update(ctx, input)\n\treturn err\n\n}", "title": "" }, { "docid": "171543769d8eaf7a2481334719ea7d01", "score": "0.6968966", "text": "func (s *awsService) Update(ctx context.Context, group Elastigroup) error {\n\tinput := &aws.UpdateGroupInput{\n\t\tGroup: group.Obj().(*aws.Group),\n\t}\n\n\t_, err := s.svc.Update(ctx, input)\n\treturn err\n\n}", "title": "" }, { "docid": "80e15337d2045cbc71e24782feccdccc", "score": "0.6938719", "text": "func (i *IpsGroups) Update(client sophos.ClientInterface, options ...sophos.Option) (err error) {\n\treturn put(client, \"/api/nodes/ips.groups\", i.Value, options...)\n}", "title": "" }, { "docid": "c8cfc304e088ae0441912f74c41f9b59", "score": "0.6860955", "text": "func (api *AdminApi) UpdateGroup(group_id string, options ...func(*url.Values)) (*GroupResult, error) {\n\topts := url.Values{}\n\tfor _, o := range options {\n\t\to(&opts)\n\t}\n\tpath := fmt.Sprintf(\"/admin/v1/groups/%s\", group_id)\n\t_, body, err := api.SignedCall(\"POST\", path, opts, duoapi.UseTimeout)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tret := &GroupResult{}\n\tif err = json.Unmarshal(body, ret); err != nil {\n\t\treturn nil, err\n\t}\n\treturn ret, nil\n}", "title": "" }, { "docid": "eb633e403388beebc933d04b8434a78f", "score": "0.681878", "text": "func (s *Service) UpdateGroup(group string, updateGroupBody UpdateGroupBody, resp ...*http.Response) (*Group, error) {\n\tpp := struct {\n\t\tGroup string\n\t}{\n\t\tGroup: group,\n\t}\n\tu, err := s.Client.BuildURLFromPathParams(nil, serviceCluster, `/identity/v3/groups/{{.Group}}`, pp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresponse, err := s.Client.Patch(services.RequestParams{URL: u, Body: updateGroupBody})\n\tif response != nil {\n\t\tdefer response.Body.Close()\n\n\t\t// populate input *http.Response if provided\n\t\tif len(resp) > 0 && resp[0] != nil {\n\t\t\t*resp[0] = *response\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar rb Group\n\terr = util.ParseResponse(&rb, response)\n\treturn &rb, err\n}", "title": "" }, { "docid": "2a58965e71537225a0ac25858f1a7357", "score": "0.68137944", "text": "func (s *API) UpdateGroup(req *UpdateGroupRequest, opts ...scw.RequestOption) (*Group, error) {\n\tvar err error\n\n\tif fmt.Sprint(req.GroupID) == \"\" {\n\t\treturn nil, errors.New(\"field GroupID cannot be empty in request\")\n\t}\n\n\tscwReq := &scw.ScalewayRequest{\n\t\tMethod: \"PATCH\",\n\t\tPath: \"/iam/v1alpha1/groups/\" + fmt.Sprint(req.GroupID) + \"\",\n\t\tHeaders: http.Header{},\n\t}\n\n\terr = scwReq.SetBody(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar resp Group\n\n\terr = s.client.Do(scwReq, &resp, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resp, nil\n}", "title": "" }, { "docid": "0c2fe91f2b7b4ac0efcb3bb739bbe11c", "score": "0.67750007", "text": "func (g *GroupsService) UpdateGroup(group Group) (*Group, *Response, error) {\n\tvar updateRequest struct {\n\t\tDescription string `json:\"description\"`\n\t}\n\tupdateRequest.Description = group.Description\n\treq, err := g.client.NewRequest(IDM, \"PUT\", \"authorize/identity/Group/\"+group.ID, &updateRequest, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\treq.Header.Set(\"api-version\", groupAPIVersion)\n\n\tvar updatedGroup Group\n\n\tresp, err := g.client.Do(req, &updatedGroup)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\treturn &group, resp, err\n\n}", "title": "" }, { "docid": "ca56b5f47ffa00bd1d99a352a753c91c", "score": "0.6740039", "text": "func (s *GroupService) Update(id interface{}, group *Group) (*Group, *Response, error) {\n\tpath := fmt.Sprintf(\"api/v2/groups/%v\", id)\n\n\treq, rerr := s.client.NewRequest(\"PATCH\", path, group)\n\tif rerr != nil {\n\t\treturn nil, nil, rerr\n\t}\n\n\tvar updatedGroup Group\n\tresp, err := s.client.Do(req, &updatedGroup)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn &updatedGroup, resp, nil\n}", "title": "" }, { "docid": "1a058b7ed0986af5a3b153a4d56f378f", "score": "0.66808164", "text": "func (ss *GroupsService) UpdateGroup(sp *Group) (*Group, error) {\n\tresp, err := ss.MakeRequest(\n\t\t\"PUT\",\n\t\tfmt.Sprintf(\"/api/groups/%d\", sp.ID),\n\t\tsp,\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar group Group\n\tif err := json.NewDecoder(resp.Body).Decode(&group); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &group, nil\n}", "title": "" }, { "docid": "7d26b74ed30bf2d05841f06ae1d7266a", "score": "0.6637232", "text": "func (gr *groupRouter) ModifyGroup(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\tgroupId := vars[\"groupId\"]\n\tvar group root.Group\n\tbody, err := ioutil.ReadAll(io.LimitReader(r.Body, 1048576))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tif err := r.Body.Close(); err != nil {\n\t\tpanic(err)\n\t}\n\tif err := json.Unmarshal(body, &group); err != nil {\n\t\tw = SetResponseHeaders(w, \"\", \"\")\n\t\tw.WriteHeader(422)\n\t\tif err := json.NewEncoder(w).Encode(err); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\tgroup.Uuid = groupId\n\tg := gr.groupService.GroupUpdate(group)\n\tif g.Uuid == \"Not Found\" {\n\t\tw = SetResponseHeaders(w, \"\", \"\")\n\t\tw.WriteHeader(404)\n\t\tif err := json.NewEncoder(w).Encode(jsonErr{Code: http.StatusNotFound, Text: \"Group Not Found\"}); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t} else {\n\t\tw = SetResponseHeaders(w, \"\", \"\")\n\t\tw.WriteHeader(http.StatusAccepted)\n\t\tif err := json.NewEncoder(w).Encode(g); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ba674704347e91d2246cb7150172299c", "score": "0.66232395", "text": "func (c *Client) ModifyGroup(request *ModifyGroupRequest) (response *ModifyGroupResponse, err error) {\n if request == nil {\n request = NewModifyGroupRequest()\n }\n response = NewModifyGroupResponse()\n err = c.Send(request, response)\n return\n}", "title": "" }, { "docid": "584bc6d9d23f0d48ac73dc128db1f839", "score": "0.66074306", "text": "func (service groupService) Update(groupID int64, newGroup models.InfoGroup) (models.Group, error) {\n\tstmt := `\n\t\tMATCH (g:Group)\n\t\tWHERE ID(g) = {groupID}\n\t\tSET g+= {p}, g.updated_at = TIMESTAMP()\n\t\tRETURN\n\t\t\tg{id:ID(g), .*} AS group\n\t\t`\n\tparams := neoism.Props{\n\t\t\"groupID\": groupID,\n\t\t\"p\": newGroup,\n\t}\n\tres := []struct {\n\t\tGroup models.Group `json:\"group\"`\n\t}{}\n\tcq := neoism.CypherQuery{\n\t\tStatement: stmt,\n\t\tParameters: params,\n\t\tResult: &res,\n\t}\n\terr := conn.Cypher(&cq)\n\tif err != nil {\n\t\treturn models.Group{}, err\n\t}\n\tif len(res) > 0 {\n\t\tif res[0].Group.ID >= 0 {\n\t\t\treturn res[0].Group, nil\n\t\t}\n\t}\n\treturn models.Group{}, nil\n}", "title": "" }, { "docid": "147c500b8f68f2d7c9513f436b079b6c", "score": "0.65913594", "text": "func (c *Client) UpdateGroup(r string, h *GroupStruct) error {\n\turl := fmt.Sprintf(\"/group/%s\", r)\n\n\terr := c.executePostJobAndReturnErrOnly(url, h)\n\n\treturn err\n}", "title": "" }, { "docid": "cae57890fd6b6a4ac4444bc56a427692", "score": "0.65843374", "text": "func (svc *GroupService) Update(group *notice.Group) error {\n\treturn svc.db.Model(group).Updates(*group).Error\n}", "title": "" }, { "docid": "0b6d51a98d00f61880e99ddaadd58b4c", "score": "0.6567744", "text": "func Update(ctx context.Context, db gorpmapper.SqlExecutorWithTx, g *sdk.Group) error {\n\tgrp := *g\n\tvar groupDB = group{\n\t\tGroup: grp,\n\t}\n\treturn sdk.WrapError(gorpmapping.UpdateAndSign(ctx, db, &groupDB), \"unable to update group %s\", g.Name)\n}", "title": "" }, { "docid": "6c74e4b2816e100a5b3c0092c4fba39c", "score": "0.6487083", "text": "func (h *BillingGroupHandler) Update(ctx context.Context, id string, req BillingGroupRequest) (*BillingGroup, error) {\n\tbts, err := h.client.doPutRequest(ctx, buildPath(\"billing-group\", id), req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar r BillingGroupResponse\n\terrR := checkAPIResponse(bts, &r)\n\n\treturn r.BillingGroup, errR\n}", "title": "" }, { "docid": "cdc29420f68f080ce5e30f317f4adb75", "score": "0.64625484", "text": "func (s *GroupsService) Update(ctx context.Context, id string, profile *GroupProfile) (*Group, *Response, error) {\n\tctx = context.WithValue(ctx, rateLimitCategoryCtxKey, rateLimitGroupsGetUpdateDeleteCategory)\n\tpath := fmt.Sprintf(\"groups/%s\", id)\n\n\tbody := map[string]interface{}{\"profile\": profile}\n\n\treq, err := s.client.NewRequest(\"PUT\", path, body)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tgroupOut := new(Group)\n\tresp, err := s.client.Do(ctx, req, groupOut)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn groupOut, resp, nil\n\n}", "title": "" }, { "docid": "8a3132e8c116c5b2f79607e3079051a8", "score": "0.6432094", "text": "func (t *ThingGroupSvc) UpdateGroup(ctx context.Context, in *pb.ThingGroup) (*pb.ThingGroup, error) {\n\tgroup := new(models.ThingGroup)\n\tif err := json.Unmarshal(in.GetItem(), &group); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := t.Db.UpdateGroup(group); err != nil {\n\t\treturn nil, grpc.Errorf(codes.Internal, err.Error())\n\t}\n\tbytes, err := json.Marshal(group)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &pb.ThingGroup{Item: bytes}, nil\n}", "title": "" }, { "docid": "e4eb848c3ca13275391a74e5d630654d", "score": "0.64316005", "text": "func (a *DefaultApiService) UpdatePolicyGroup(ctx _context.Context, id string, updatePolicyGroupData UpdatePolicyGroupData) (PolicyGroup, *_nethttp.Response, 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 PolicyGroup\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/policies/{id}\"\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{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = &updatePolicyGroupData\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 200 {\n\t\t\tvar v PolicyGroup\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 {\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, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\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, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\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, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v 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, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 412 {\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, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 500 {\n\t\t\tvar v 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, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 503 {\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, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "84928b26ca41ac49fcddb4e11e4c986c", "score": "0.63816965", "text": "func GroupUpdate(s string, d *ServiceData) error {\n\tvar err error\n\tb := []byte(s)\n\tvar rec GroupGrid\n\tif err = json.Unmarshal(b, &rec); err != nil { // first parse to determine the record ID we need to load\n\t\treturn err\n\t}\n\tif rec.Recid > 0 { // is this an update?\n\t\tpt, err := db.GetGroup(rec.Recid) // now load that record...\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err = json.Unmarshal(b, &pt); err != nil { // merge in the changes...\n\t\t\treturn err\n\t\t}\n\t\treturn db.UpdateGroup(&pt) // and save the result\n\t}\n\t// no, it is a new table entry that has not been saved...\n\tvar a db.EGroup\n\tif err := json.Unmarshal(b, &a); err != nil { // merge in the changes...\n\t\treturn err\n\t}\n\tutil.Console(\"a = %#v\\n\", a)\n\tutil.Console(\">>>> NEW Group IS BEING ADDED\\n\")\n\terr = db.InsertGroup(&a)\n\treturn err\n}", "title": "" }, { "docid": "68fcfb41762b3116aeb6fcc9f070c7f4", "score": "0.63816714", "text": "func (a *SANApiService) IgroupModify(ctx context.Context, uuid string, info Igroup) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Patch\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/protocols/san/igroups/{uuid}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"uuid\"+\"}\", fmt.Sprintf(\"%v\", uuid), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\", \"application/hal+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\", \"application/hal+json\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = &info\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHttpResponse, err\n\t}\n\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\t\n\t\tif localVarHttpResponse.StatusCode == 0 {\n\t\t\tvar v ErrorResponse\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 localVarHttpResponse, newErr\n\t\t\t\t}\n\t\t\t\tnewErr.model = v\n\t\t\t\treturn localVarHttpResponse, newErr\n\t\t}\n\t\t\n\t\treturn localVarHttpResponse, newErr\n\t}\n\n\treturn localVarHttpResponse, nil\n}", "title": "" }, { "docid": "4b97217e906aa69b54a90c7f1b37472a", "score": "0.6303853", "text": "func (GroupUsecase *GroupUsecaseImpl) UpdateGroup(id string, Group *model.Group) (*model.Group, error) {\n\terr := GroupUsecase.GrouptRepository.Update(id, Group)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn Group, nil\n}", "title": "" }, { "docid": "9e88a011d386627adb33f4312799761e", "score": "0.6279098", "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": "1bd5b4069ce50fc8c763a5104f79056d", "score": "0.62527925", "text": "func (e *EppEndpointsGroups) Update(client sophos.ClientInterface, options ...sophos.Option) (err error) {\n\treturn put(client, \"/api/nodes/epp.endpoints_groups\", e.Value, options...)\n}", "title": "" }, { "docid": "660a24cdb1b127abe65d0cd8b1528234", "score": "0.61874187", "text": "func (f *FireWallGroupServiceHandler) Update(ctx context.Context, fwGroupID string, fwGroupReq *FirewallGroupReq) error {\n\turi := fmt.Sprintf(\"/v2/firewalls/%s\", fwGroupID)\n\n\treq, err := f.client.NewRequest(ctx, http.MethodPut, uri, fwGroupReq)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn f.client.DoWithContext(ctx, req, nil)\n}", "title": "" }, { "docid": "83ddb646591dbe96180fbe1c8193290b", "score": "0.61860144", "text": "func (a *AccSsoAdminGroup) Update(client sophos.ClientInterface, options ...sophos.Option) (err error) {\n\treturn put(client, \"/api/nodes/acc.sso_admin_group\", a.Value, options...)\n}", "title": "" }, { "docid": "49ae4bc5cefc05d5f3bc18aa294ec365", "score": "0.6180632", "text": "func (a *VipGroupsApiService) RedeployVIPGroup(ctx context.Context, vipGroupId int64) (VipGroupResp, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Post\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t \tsuccessPayload VipGroupResp\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/vip-groups/{vip_group_id}:redeploy\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"vip_group_id\"+\"}\", fmt.Sprintf(\"%v\", vipGroupId), -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\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[\"Xms-Auth-Token\"] = key\n\t\t}\n\t}\n\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {\n\t\t\tvar key string\n\t\t\tif auth.Prefix != \"\" {\n\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t} else {\n\t\t\t\tkey = auth.Key\n\t\t\t}\n\t\t\tlocalVarQueryParams.Add(\"token\", key)\n\t\t}\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn successPayload, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn successPayload, localVarHttpResponse, err\n\t}\n\tdefer localVarHttpResponse.Body.Close()\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tbodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)\n\t\treturn successPayload, localVarHttpResponse, reportError(\"Status: %v, Body: %s\", localVarHttpResponse.Status, bodyBytes)\n\t}\n\n\tif err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {\n\t\treturn successPayload, localVarHttpResponse, err\n\t}\n\n\n\treturn successPayload, localVarHttpResponse, err\n}", "title": "" }, { "docid": "3d41ebae8992c9f65e8e74af77e433b3", "score": "0.61722064", "text": "func (p *PaloAlto) EditGroup(objecttype, action, object, group string, devicegroup ...string) error {\n\tvar xmlBody string\n\tvar xpath string\n\tvar reqError requestError\n\n\tquery := fmt.Sprintf(\"type=config&key=%s\", p.Key)\n\n\tif p.DeviceType == \"panos\" {\n\t\tif action == \"add\" {\n\t\t\txmlBody = fmt.Sprintf(\"<member>%s</member>\", object)\n\t\t\txpath = fmt.Sprintf(\"/config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys1']/address-group/entry[@name='%s']/static\", group)\n\t\t\tif objecttype == \"service\" {\n\t\t\t\txpath = fmt.Sprintf(\"/config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys1']/service-group/entry[@name='%s']/members\", group)\n\t\t\t}\n\n\t\t\tquery += fmt.Sprintf(\"&action=set&xpath=%s&element=%s\", xpath, xmlBody)\n\t\t}\n\n\t\tif action == \"remove\" {\n\t\t\txpath = fmt.Sprintf(\"/config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys1']/address-group/entry[@name='%s']/static/member[text()='%s']\", group, object)\n\t\t\tif objecttype == \"service\" {\n\t\t\t\txpath = fmt.Sprintf(\"/config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys1']/service-group/entry[@name='%s']/members/member[text()='%s']\", group, object)\n\t\t\t}\n\n\t\t\tquery += fmt.Sprintf(\"&action=delete&xpath=%s\", xpath)\n\t\t}\n\t}\n\n\tif p.DeviceType == \"panorama\" && p.Shared == true {\n\t\tif action == \"add\" {\n\t\t\txmlBody = fmt.Sprintf(\"<member>%s</member>\", object)\n\t\t\txpath = fmt.Sprintf(\"/config/shared/address-group/entry[@name='%s']/static\", group)\n\t\t\tif objecttype == \"service\" {\n\t\t\t\txpath = fmt.Sprintf(\"/config/shared/service-group/entry[@name='%s']/members\", group)\n\t\t\t}\n\n\t\t\tquery += fmt.Sprintf(\"&action=set&xpath=%s&element=%s\", xpath, xmlBody)\n\t\t}\n\n\t\tif action == \"remove\" {\n\t\t\txpath = fmt.Sprintf(\"/config/shared/address-group/entry[@name='%s']/static/member[text()='%s']\", group, object)\n\t\t\tif objecttype == \"service\" {\n\t\t\t\txpath = fmt.Sprintf(\"/config/shared/service-group/entry[@name='%s']/members/member[text()='%s']\", group, object)\n\t\t\t}\n\n\t\t\tquery += fmt.Sprintf(\"&action=delete&xpath=%s\", xpath)\n\t\t}\n\t}\n\n\tif p.DeviceType == \"panorama\" && p.Shared == false && len(devicegroup) > 0 {\n\t\tif action == \"add\" {\n\t\t\txmlBody = fmt.Sprintf(\"<member>%s</member>\", object)\n\t\t\txpath = fmt.Sprintf(\"/config/devices/entry[@name='localhost.localdomain']/device-group/entry[@name='%s']/address-group/entry[@name='%s']/static\", devicegroup[0], group)\n\t\t\tif objecttype == \"service\" {\n\t\t\t\txpath = fmt.Sprintf(\"/config/devices/entry[@name='localhost.localdomain']/device-group/entry[@name='%s']/service-group/entry[@name='%s']/members\", devicegroup[0], group)\n\t\t\t}\n\n\t\t\tquery += fmt.Sprintf(\"&action=set&xpath=%s&element=%s\", xpath, xmlBody)\n\t\t}\n\n\t\tif action == \"remove\" {\n\t\t\txpath = fmt.Sprintf(\"/config/devices/entry[@name='localhost.localdomain']/device-group/entry[@name='%s']/address-group/entry[@name='%s']/static/member[text()='%s']\", devicegroup[0], group, object)\n\t\t\tif objecttype == \"service\" {\n\t\t\t\txpath = fmt.Sprintf(\"/config/devices/entry[@name='localhost.localdomain']/device-group/entry[@name='%s']/service-group/entry[@name='%s']/members/member[text()='%s']\", devicegroup[0], group, object)\n\t\t\t}\n\n\t\t\tquery += fmt.Sprintf(\"&action=delete&xpath=%s\", xpath)\n\t\t}\n\t}\n\n\tif p.DeviceType == \"panorama\" && p.Shared == false && len(devicegroup) <= 0 {\n\t\treturn errors.New(\"you must specify a device-group when editing a shared group on a Panorama device\")\n\t}\n\n\t_, resp, errs := r.Post(p.URI).Query(query).End()\n\tif errs != nil {\n\t\treturn errs[0]\n\t}\n\n\tif err := xml.Unmarshal([]byte(resp), &reqError); err != nil {\n\t\treturn err\n\t}\n\n\tif reqError.Status != \"success\" {\n\t\treturn fmt.Errorf(\"error code %s: %s\", reqError.Code, errorCodes[reqError.Code])\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7bf33b9fda7d07ef39330421118bbc05", "score": "0.61339617", "text": "func (a *Client) UpdateVMPlacementGroup(params *UpdateVMPlacementGroupParams, opts ...ClientOption) (*UpdateVMPlacementGroupOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewUpdateVMPlacementGroupParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"UpdateVmPlacementGroup\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/update-vm-placement-group\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &UpdateVMPlacementGroupReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t}\n\tfor _, opt := range opts {\n\t\topt(op)\n\t}\n\n\tresult, err := a.transport.Submit(op)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*UpdateVMPlacementGroupOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for UpdateVmPlacementGroup: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "f4fe409b64cc8652dfab912333b73a0b", "score": "0.61226636", "text": "func EditGroup(cli bce.Client, groupId string, egr *EditGroupReq) (*Group, error) {\n\turl := PREFIX + \"/\" + groupId\n\tparams := map[string]string{\"withCore\": \"true\"}\n\n\tresult := &Group{}\n\treq := &PostHttpReq{Url: url, Result: result, Body: egr, Params: params}\n\terr := Put(cli, req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "0475282d1c5056c3586a4a95bddede65", "score": "0.6109693", "text": "func (c *DeviceGroupsService) Update(ac DeviceGroup) (*DeviceGroup, *Response, error) {\n\tac.ResourceType = \"DeviceGroup\"\n\tif err := c.validate.Struct(ac); err != nil {\n\t\treturn nil, nil, err\n\t}\n\treq, err := c.NewRequest(http.MethodPut, \"/DeviceGroup/\"+ac.ID, ac, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\treq.Header.Set(\"api-version\", deviceGroupAPIVersion)\n\n\tvar updated DeviceGroup\n\n\tresp, err := c.Do(req, &updated)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\treturn &updated, resp, nil\n}", "title": "" }, { "docid": "2ffc3e2a32a0a37a75c583e5fc3bd2b7", "score": "0.60906786", "text": "func (c *appGroups) Update(appGroup *v1.AppGroup) (result *v1.AppGroup, err error) {\n\tresult = &v1.AppGroup{}\n\terr = c.client.Put().\n\t\tNamespace(c.ns).\n\t\tResource(\"appgroups\").\n\t\tName(appGroup.Name).\n\t\tBody(appGroup).\n\t\tDo().\n\t\tInto(result)\n\treturn\n}", "title": "" }, { "docid": "11a5a943f881834d6e45cceb92965eb5", "score": "0.6076073", "text": "func Update(c *golangsdk.ServiceClient, id string, opts UpdateOpts) (err error) {\n\tb, err := build.RequestBody(opts, \"dc_endpoint_group\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\t_, err = c.Put(c.ServiceURL(\"dcaas\", \"dc-endpoint-groups\", id), b, nil, &golangsdk.RequestOpts{\n\t\tOkCodes: []int{200, 202},\n\t})\n\n\treturn\n}", "title": "" }, { "docid": "58b9f6e93090143ebac7296aeb3778d8", "score": "0.6058784", "text": "func Update(c *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult) {\n\tb, err := opts.ToSecGroupUpdateMap()\n\tif err != nil {\n\t\tr.Err = err\n\t\treturn\n\t}\n\n\tresp, err := c.Put(resourceURL(c, id), b, &r.Body, &gophercloud.RequestOpts{\n\t\tOkCodes: []int{200},\n\t})\n\t_, r.Header, r.Err = gophercloud.ParseResponse(resp, err)\n\treturn\n}", "title": "" }, { "docid": "4cfe0c6a0523d482b27b3362192b0c97", "score": "0.6032944", "text": "func (s *Server) UpdateUserGroup(ctx context.Context, UserGroupUpdateRequest *pbUser.UserGroupUpdateRequest) (*pbUser.Empty, error) {\n\n\tvar updatedUserGroupValues = make(map[string]interface{})\n\n\tif UserGroupUpdateRequest.GroupEmail != nil {\n\t\tupdatedUserGroupValues[\"group_email_address\"] = *UserGroupUpdateRequest.GroupEmail\n\t\tre := regexp.MustCompile(\"^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$\")\n\t\tif !re.MatchString(*UserGroupUpdateRequest.GroupEmail) {\n\t\t\treturn nil, errors.New(\"group email address must be a valid email\")\n\t\t}\n\t}\n\tif UserGroupUpdateRequest.DisplayName != nil {\n\t\tupdatedUserGroupValues[\"display_name\"] = *UserGroupUpdateRequest.DisplayName\n\t}\n\tif UserGroupUpdateRequest.Description != nil {\n\t\tupdatedUserGroupValues[\"description\"] = *UserGroupUpdateRequest.Description\n\t}\n\tif UserGroupUpdateRequest.ShortBio != nil {\n\t\tupdatedUserGroupValues[\"short_bio\"] = *UserGroupUpdateRequest.ShortBio\n\t}\n\tif UserGroupUpdateRequest.GroupType != nil {\n\t\tgroup := new(model.GroupType)\n\n\t\terr := s.db.NewSelect().\n\t\t\tModel(group).\n\t\t\tWhere(\"name = ?\", UserGroupUpdateRequest.GroupType).\n\t\t\tScan(ctx)\n\n\t\tif err != nil {\n\t\t\treturn nil, errors.New(\"supplied group type is not valid\")\n\t\t}\n\n\t\tupdatedUserGroupValues[\"type_id\"] = group.ID\n\t}\n\tif UserGroupUpdateRequest.OwnerId != nil {\n\t\tupdatedUserGroupValues[\"owner_id\"] = *UserGroupUpdateRequest.OwnerId\n\t}\n\tif UserGroupUpdateRequest.Avatar != nil {\n\t\tupdatedUserGroupValues[\"avatar\"] = *UserGroupUpdateRequest.Avatar\n\t}\n\tif UserGroupUpdateRequest.Banner != nil {\n\t\tupdatedUserGroupValues[\"banner\"] = *UserGroupUpdateRequest.Banner\n\t}\n\n\tif UserGroupUpdateRequest.Tags != nil {\n\t\ttags := make([]model.Tag, len(UserGroupUpdateRequest.Tags))\n\t\tnames := make([]string, len(UserGroupUpdateRequest.Tags))\n\t\ttagType := \"genre\" // defaults to genre tags for now\n\n\t\tfor i := range UserGroupUpdateRequest.Tags {\n\t\t\ttag := model.Tag{\n\t\t\t\tName: UserGroupUpdateRequest.Tags[i],\n\t\t\t\tType: tagType,\n\t\t\t}\n\t\t\ttag.ID = uuid.Must(uuid.NewRandom())\n\t\t\tnames[i] = tag.Name\n\t\t\ttags[i] = tag\n\t\t}\n\n\t\texisting := []model.Tag{}\n\n\t\t// find existing tags\n\t\terr := s.db.NewSelect().\n\t\t\tModel(&existing).\n\t\t\tWhere(\"type = ? AND name IN (?)\", tagType, bun.In(names)).\n\t\t\tScan(ctx)\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tvar result []uuid.UUID\n\t\tvar insert []model.Tag\n\n\t\tfor l := range tags {\n\t\t\tvar seen uuid.UUID\n\n\t\t\tfor e := range existing {\n\t\t\t\tif existing[e].Name == tags[l].Name {\n\t\t\t\t\tseen = existing[e].ID\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif seen == uuid.Nil {\n\t\t\t\tinsert = append(insert, tags[l])\n\t\t\t\tresult = append(result, tags[l].ID)\n\t\t\t} else {\n\t\t\t\tresult = append(result, seen)\n\t\t\t}\n\t\t}\n\n\t\tif len(insert) > 0 {\n\t\t\t_, err := s.db.\n\t\t\t\tNewInsert().\n\t\t\t\tModel(&insert).\n\t\t\t\tExec(ctx)\n\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\n\t\tupdatedUserGroupValues[\"tags\"] = result\n\t}\n\n\tif UserGroupUpdateRequest.Links != nil {\n\t\tlinks := make([]model.Link, len(UserGroupUpdateRequest.Links))\n\t\turis := make([]string, len(UserGroupUpdateRequest.Links))\n\n\t\tfor i := range UserGroupUpdateRequest.Links {\n\t\t\turi := UserGroupUpdateRequest.Links[i]\n\t\t\tplatform := s.getPlatform(uri)\n\n\t\t\tlink := model.Link{\n\t\t\t\tURI: uri,\n\t\t\t\tPlatform: platform,\n\t\t\t}\n\t\t\tlink.ID = uuid.Must(uuid.NewRandom())\n\t\t\turis[i] = link.URI\n\t\t\tlinks[i] = link\n\t\t}\n\n\t\texisting := []model.Link{}\n\n\t\t// find existing links\n\t\terr := s.db.NewSelect().\n\t\t\tModel(&existing).\n\t\t\tWhere(\"uri IN (?)\", bun.In(uris)).\n\t\t\tScan(ctx)\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tvar result []uuid.UUID\n\t\tvar insert []model.Link\n\n\t\tfor l := range links {\n\t\t\tvar seen uuid.UUID\n\n\t\t\tfor e := range existing {\n\t\t\t\tif existing[e].URI == links[l].URI {\n\t\t\t\t\tseen = existing[e].ID\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif seen == uuid.Nil {\n\t\t\t\tinsert = append(insert, links[l])\n\t\t\t\tresult = append(result, links[l].ID)\n\t\t\t} else {\n\t\t\t\tresult = append(result, seen)\n\t\t\t}\n\t\t}\n\n\t\tif len(insert) > 0 {\n\t\t\t_, err := s.db.\n\t\t\t\tNewInsert().\n\t\t\t\tModel(&insert).\n\t\t\t\tExec(ctx)\n\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\n\t\t// TODO prune orphan links?\n\n\t\tupdatedUserGroupValues[\"links\"] = result\n\t}\n\n\tupdatedUserGroupValues[\"updated_at\"] = time.Now().UTC()\n\n\trows, err := s.db.NewUpdate().Model(&updatedUserGroupValues).TableExpr(\"user_groups\").Where(\"id = ?\", UserGroupUpdateRequest.Id).Exec(ctx)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnumber, _ := rows.RowsAffected()\n\n\tif number == 0 {\n\t\treturn nil, errors.New(\"warning: no rows were updated\")\n\t}\n\n\treturn &pbUser.Empty{}, nil\n}", "title": "" }, { "docid": "814f1beff1750eaea0c3eb0cd01f930b", "score": "0.6023879", "text": "func (client ManagedInstanceGroupClient) updateManagedInstanceGroup(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) {\n\n\thttpRequest, err := request.HTTPRequest(http.MethodPut, \"/managedInstanceGroups/{managedInstanceGroupId}\", binaryReqBody, extraHeaders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response UpdateManagedInstanceGroupResponse\n\tvar httpResponse *http.Response\n\thttpResponse, err = client.Call(ctx, &httpRequest)\n\tdefer common.CloseBodyIfValid(httpResponse)\n\tresponse.RawResponse = httpResponse\n\tif err != nil {\n\t\tapiReferenceLink := \"https://docs.oracle.com/iaas/api/#/en/osmh/20220901/ManagedInstanceGroup/UpdateManagedInstanceGroup\"\n\t\terr = common.PostProcessServiceError(err, \"ManagedInstanceGroup\", \"UpdateManagedInstanceGroup\", apiReferenceLink)\n\t\treturn response, err\n\t}\n\n\terr = common.UnmarshalResponse(httpResponse, &response)\n\treturn response, err\n}", "title": "" }, { "docid": "68e065619121ff0c85a339ce42817acd", "score": "0.6023201", "text": "func (h *GroupHandler) Patch(r *http.Request, name string) (proto.Message, error) {\n\th.save = &spb.Group{}\n\tproto.Merge(h.save, h.item)\n\tmemberCounter := 0\n\tfor i, patch := range h.patch.Operations {\n\t\tpath := patch.Path\n\t\tif memberPathRE.MatchString(path) {\n\t\t\tpath = \"member\"\n\t\t}\n\t\tsrc := \"\"\n\t\tvar dst *string\n\t\tswitch path {\n\t\tcase \"displayName\":\n\t\t\tsrc = patchSource(patch.Value)\n\t\t\tdst = &h.save.DisplayName\n\t\t\tif patch.Op == \"remove\" || len(src) == 0 {\n\t\t\t\treturn nil, errutil.NewIndexError(codes.InvalidArgument, errutil.ErrorPath(\"scim\", \"groups\", name, path), i, fmt.Sprintf(\"value must not be empty\"))\n\t\t\t}\n\n\t\tcase \"members\":\n\t\t\tif patch.Op != \"add\" {\n\t\t\t\treturn nil, errutil.NewIndexError(codes.InvalidArgument, errutil.ErrorPath(\"scim\", \"groups\", name, path), i, fmt.Sprintf(\"op %q is not valid\", patch.Op))\n\t\t\t}\n\t\t\tmember, err := h.patchMember(patch.Object, name, memberCounter)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tmemberCounter++\n\t\t\tif err := h.store.WriteTx(storage.GroupMemberDatatype, getRealm(r), name, member.Value, storage.LatestRev, member, nil, h.tx); err != nil {\n\t\t\t\treturn nil, errutil.NewIndexError(codes.InvalidArgument, errutil.ErrorPath(\"scim\", \"groups\", name, path), i, err.Error())\n\t\t\t}\n\n\t\tcase \"member\":\n\t\t\tif patch.Op != \"remove\" {\n\t\t\t\treturn nil, errutil.NewIndexError(codes.InvalidArgument, errutil.ErrorPath(\"scim\", \"groups\", name, path), i, fmt.Sprintf(\"op %q is not valid\", patch.Op))\n\t\t\t}\n\t\t\tmatch := memberPathRE.FindStringSubmatch(patch.Path)\n\t\t\tif len(match) < 2 {\n\t\t\t\treturn nil, errutil.NewIndexError(codes.InvalidArgument, errutil.ErrorPath(\"scim\", \"groups\", name, path), i, fmt.Sprintf(\"invalid member path %q\", patch.Path))\n\t\t\t}\n\t\t\tmemberName := match[1]\n\t\t\tif err := h.store.DeleteTx(storage.GroupMemberDatatype, getRealm(r), name, memberName, storage.LatestRev, h.tx); err != nil {\n\t\t\t\tif storage.ErrNotFound(err) {\n\t\t\t\t\treturn nil, errutil.NewIndexError(codes.InvalidArgument, errutil.ErrorPath(\"scim\", \"groups\", name, path), i, fmt.Sprintf(\"%q is not a member of the group\", memberName))\n\t\t\t\t}\n\t\t\t\treturn nil, errutil.NewIndexError(codes.InvalidArgument, errutil.ErrorPath(\"scim\", \"groups\", name, path), i, err.Error())\n\t\t\t}\n\n\t\tdefault:\n\t\t\treturn nil, errutil.NewIndexError(codes.InvalidArgument, errutil.ErrorPath(\"scim\", \"groups\", name, path), i, fmt.Sprintf(\"invalid path %q\", patch.Path))\n\t\t}\n\t\tif dst == nil {\n\t\t\tcontinue\n\t\t}\n\t\tif patch.Op != \"remove\" && len(src) == 0 {\n\t\t\treturn nil, errutil.NewIndexError(codes.InvalidArgument, errutil.ErrorPath(\"scim\", \"groups\", name, path), i, fmt.Sprintf(\"cannot set an empty value\"))\n\t\t}\n\t\tswitch patch.Op {\n\t\tcase \"add\":\n\t\t\tfallthrough\n\t\tcase \"replace\":\n\t\t\t*dst = src\n\t\tcase \"remove\":\n\t\t\t*dst = \"\"\n\t\tdefault:\n\t\t\treturn nil, errutil.NewIndexError(codes.InvalidArgument, errutil.ErrorPath(\"scim\", \"groups\", name, path), i, fmt.Sprintf(\"invalid op %q\", patch.Op))\n\t\t}\n\t}\n\t// Output the new result: Get() will return contents from h.item with the latest edits from h.save.\n\t// Needs a deep copy since h.save as the item saved will not include members once Save() is called\n\t// but the item returned to the client will include members.\n\th.item = proto.Clone(h.save).(*spb.Group)\n\treturn h.Get(r, name)\n}", "title": "" }, { "docid": "9a3fc85ee8d0e4c57093c7f2afeac683", "score": "0.6019283", "text": "func (a *VipGroupsApiService) CreateVIPGroup(ctx context.Context, vipGroup VipGroupCreateReq) (VipGroupResp, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Post\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t \tsuccessPayload VipGroupResp\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/vip-groups/\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{ \"application/json\", }\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"application/json\",\n\t\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = &vipGroup\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[\"Xms-Auth-Token\"] = key\n\t\t}\n\t}\n\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {\n\t\t\tvar key string\n\t\t\tif auth.Prefix != \"\" {\n\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t} else {\n\t\t\t\tkey = auth.Key\n\t\t\t}\n\t\t\tlocalVarQueryParams.Add(\"token\", key)\n\t\t}\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn successPayload, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn successPayload, localVarHttpResponse, err\n\t}\n\tdefer localVarHttpResponse.Body.Close()\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tbodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)\n\t\treturn successPayload, localVarHttpResponse, reportError(\"Status: %v, Body: %s\", localVarHttpResponse.Status, bodyBytes)\n\t}\n\n\tif err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {\n\t\treturn successPayload, localVarHttpResponse, err\n\t}\n\n\n\treturn successPayload, localVarHttpResponse, err\n}", "title": "" }, { "docid": "70a744ef18bee7ac9d85003789f97864", "score": "0.6008603", "text": "func (a *CustomerGroupsApiService) UpdateCustomerGroup(ctx context.Context, body UpdateCustomerGroupRequest, groupId string) (UpdateCustomerGroupResponse, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Put\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue UpdateCustomerGroupResponse\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/v2/customers/groups/{group_id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"group_id\"+\"}\", fmt.Sprintf(\"%v\", groupId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = &body\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tif localVarHttpResponse.StatusCode < 300 {\n\t\t// If we succeed, return the data, otherwise pass on to decode error.\n\t\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"));\n\t\tif err == nil { \n\t\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t\t}\n\t}\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\t\tif localVarHttpResponse.StatusCode == 200 {\n\t\t\tvar v UpdateCustomerGroupResponse\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": "925363879ceae777bd04c49dfd02d5d8", "score": "0.60069686", "text": "func HandleUpdateGroup(msg *app.Message) (interface{}, error) {\n\tif gState.db == nil {\n\t\treturn nil, fmt.Errorf(\"no database\")\n\t}\n\n\tvar payload ReqPayloadUpdateGroup\n\tif err := msg.Into(&payload); err != nil {\n\t\treturn nil, fmt.Errorf(\"payload invalid: %s\", err)\n\t}\n\n\tif payload.GroupID <= 0 {\n\t\treturn nil, fmt.Errorf(\"group id must be non-zero positive integer\")\n\t}\n\n\t// Locate task\n\tgrp, err := gState.db.GetGroup(payload.GroupID)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"group not found: %s\", err)\n\t}\n\n\t// Save with new name\n\tgrp.Name = payload.Name\n\n\treturn grp, gState.db.SaveGroup(grp)\n}", "title": "" }, { "docid": "65451e2530eac93098dc153b95816a83", "score": "0.6006205", "text": "func (s *topoService) UpdateObjectGroup(params types.ContextParams, pathParams, queryParams ParamsGetter, data frtypes.MapStr) (interface{}, error) {\n\n\tcond := &metadata.UpdateGroupCondition{}\n\n\terr := data.MarshalJSONInto(cond)\n\tif nil != err {\n\t\treturn nil, err\n\t}\n\n\terr = s.core.GroupOperation().UpdateObjectGroup(params, cond)\n\tif nil != err {\n\t\treturn nil, err\n\t}\n\n\treturn nil, nil\n}", "title": "" }, { "docid": "1808bac8200d4f9e3c130cf3d5106eee", "score": "0.59974164", "text": "func (client VirtualNetworkClient) updateCrossConnectGroup(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {\n\thttpRequest, err := request.HTTPRequest(http.MethodPut, \"/crossConnectGroups/{crossConnectGroupId}\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response UpdateCrossConnectGroupResponse\n\tvar httpResponse *http.Response\n\thttpResponse, err = client.Call(ctx, &httpRequest)\n\tdefer common.CloseBodyIfValid(httpResponse)\n\tresponse.RawResponse = httpResponse\n\tif err != nil {\n\t\treturn response, err\n\t}\n\n\terr = common.UnmarshalResponse(httpResponse, &response)\n\treturn response, err\n}", "title": "" }, { "docid": "ecd622ea93233c13714f63af99ee2ea8", "score": "0.59717596", "text": "func (e *EppDefaultEndpointsGroup) Update(client sophos.ClientInterface, options ...sophos.Option) (err error) {\n\treturn put(client, \"/api/nodes/epp.default_endpoints_group\", e.Value, options...)\n}", "title": "" }, { "docid": "e0bc45827d01ae462de742a89514cacd", "score": "0.5970498", "text": "func (m *PrivilegedAccessGroupAssignmentScheduleRequest) SetGroup(value Groupable)() {\n err := m.GetBackingStore().Set(\"group\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "8a58ac1b9112ad1bc37a3ec3935cc613", "score": "0.5967964", "text": "func (a *AccSsoAuditorGroup) Update(client sophos.ClientInterface, options ...sophos.Option) (err error) {\n\treturn put(client, \"/api/nodes/acc.sso_auditor_group\", a.Value, options...)\n}", "title": "" }, { "docid": "b0425dc0f9ca9a846c2d1a707b4ffeae", "score": "0.5958026", "text": "func (a *Client) UpdateProcessGroup(params *UpdateProcessGroupParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateProcessGroupOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewUpdateProcessGroupParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"updateProcessGroup\",\n\t\tMethod: \"PUT\",\n\t\tPathPattern: \"/process-groups/{id}\",\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: &UpdateProcessGroupReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t}\n\tfor _, opt := range opts {\n\t\topt(op)\n\t}\n\n\tresult, err := a.transport.Submit(op)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*UpdateProcessGroupOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for updateProcessGroup: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "a44c33cb4f15bd753385a4ea3c8c30ed", "score": "0.59560996", "text": "func RespondGroup(c *gin.Context) {\n // confirm Group ID sent is valid\n // remember to import the `strconv` package\n if groupid, err := strconv.Atoi(c.Param(\"groupID\")); err == nil {\n for i := 0; i < len(groups); i++ {\n if groups[i].ID == groupid {\n groups[i].Response += 1\n }\n }\n\n // return a pointer to the updated jokes list\n c.JSON(http.StatusOK, &groups)\n } else {\n // Joke ID is invalid\n c.AbortWithStatus(http.StatusNotFound)\n }\n}", "title": "" }, { "docid": "47df9193ee27ca08b3c2832245780644", "score": "0.59262705", "text": "func (a *VipGroupsApiService) DeleteVIPGroup(ctx context.Context, vipGroupId int64) (VipGroupResp, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Delete\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t \tsuccessPayload VipGroupResp\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/vip-groups/{vip_group_id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"vip_group_id\"+\"}\", fmt.Sprintf(\"%v\", vipGroupId), -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\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[\"Xms-Auth-Token\"] = key\n\t\t}\n\t}\n\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {\n\t\t\tvar key string\n\t\t\tif auth.Prefix != \"\" {\n\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t} else {\n\t\t\t\tkey = auth.Key\n\t\t\t}\n\t\t\tlocalVarQueryParams.Add(\"token\", key)\n\t\t}\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn successPayload, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn successPayload, localVarHttpResponse, err\n\t}\n\tdefer localVarHttpResponse.Body.Close()\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tbodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)\n\t\treturn successPayload, localVarHttpResponse, reportError(\"Status: %v, Body: %s\", localVarHttpResponse.Status, bodyBytes)\n\t}\n\n\tif err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {\n\t\treturn successPayload, localVarHttpResponse, err\n\t}\n\n\n\treturn successPayload, localVarHttpResponse, err\n}", "title": "" }, { "docid": "19b23e46377c22cd1774061101b9a51a", "score": "0.591931", "text": "func (a *AuthUpdateBackendGroupMembersDebug) Update(client sophos.ClientInterface, options ...sophos.Option) (err error) {\n\treturn put(client, \"/api/nodes/auth.update_backend_group_members.debug\", a.Value, options...)\n}", "title": "" }, { "docid": "9a011d3dee8d25c63a0f2f2d3c3ea70f", "score": "0.59130245", "text": "func UpdateProductGroup(data CreateProductGroupBody, groupId, accountId, token string) (CreateProductGroupReturn, error) {\n\n\t// Set url\n\turl := \"https://api.tillhub.com/api/v0/product_groups/\" + accountId + \"/\" + groupId\n\n\t// Define client\n\tclient := &http.Client{}\n\n\t// Prepare body data\n\tconvert, err := json.Marshal(data)\n\tif err != nil {\n\t\treturn CreateProductGroupReturn{}, err\n\t}\n\n\t// Define request\n\trequest, err := http.NewRequest(\"PUT\", url, bytes.NewBuffer(convert))\n\tif err != nil {\n\t\treturn CreateProductGroupReturn{}, err\n\t}\n\n\t// Set header\n\trequest.Header.Set(\"Accept\", \"application/json, text/plain, */*\")\n\trequest.Header.Set(\"Content-Type\", \"application/json;charset=UTF-8\")\n\trequest.Header.Set(\"Authorization\", \"Bearer \"+token)\n\n\t// Define response & send request\n\tresponse, err := client.Do(request)\n\tif err != nil {\n\t\treturn CreateProductGroupReturn{}, err\n\t}\n\n\t// Close body after function ends\n\tdefer response.Body.Close()\n\n\t// Decode json response\n\tvar decode CreateProductGroupReturn\n\n\terr = json.NewDecoder(response.Body).Decode(&decode)\n\tif err != nil {\n\t\treturn CreateProductGroupReturn{}, err\n\t}\n\n\t// Return data\n\treturn decode, nil\n\n}", "title": "" }, { "docid": "a9f3ac0875f2c0f5e6635b62005256c6", "score": "0.5890453", "text": "func (c *awsSsmPatchGroups) Update(awsSsmPatchGroup *v1.AwsSsmPatchGroup) (result *v1.AwsSsmPatchGroup, err error) {\n\tresult = &v1.AwsSsmPatchGroup{}\n\terr = c.client.Put().\n\t\tNamespace(c.ns).\n\t\tResource(\"awsssmpatchgroups\").\n\t\tName(awsSsmPatchGroup.Name).\n\t\tBody(awsSsmPatchGroup).\n\t\tDo().\n\t\tInto(result)\n\treturn\n}", "title": "" }, { "docid": "2c74567024516c4c0808b0e8add66aeb", "score": "0.5883768", "text": "func (s *UserGroupService) UpdateUserGroup(ctx context.Context, group types.UserGroup) error {\n\treturn s.svc.UpdateResource(ctx, group)\n}", "title": "" }, { "docid": "9ab4c9feea60eed4f57468a0f709267c", "score": "0.58581585", "text": "func (m *MockMarathon) UpdateGroup(arg0 string, arg1 *go_marathon.Group, arg2 bool) (*go_marathon.DeploymentID, error) {\n\tret := m.ctrl.Call(m, \"UpdateGroup\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(*go_marathon.DeploymentID)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "9b133df35f8eead11191468d5608a7f1", "score": "0.58433145", "text": "func (m *MockGroupRepository) UpdateGroup(ctx context.Context, groupID uuid.UUID, name, description string, budget *int) (*model.Group, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"UpdateGroup\", ctx, groupID, name, description, budget)\n\tret0, _ := ret[0].(*model.Group)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "567f0f8236eeb445ef168835114037d2", "score": "0.5839119", "text": "func (o *AuthGroup) Update(exec boil.Executor, whitelist ...string) error {\n\tvar err error\n\tkey := makeCacheKey(whitelist, nil)\n\tauthGroupUpdateCacheMut.RLock()\n\tcache, cached := authGroupUpdateCache[key]\n\tauthGroupUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := strmangle.UpdateColumnSet(authGroupColumns, authGroupPrimaryKeyColumns, whitelist)\n\t\tif len(wl) == 0 {\n\t\t\treturn errors.New(\"models: unable to update auth_group, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE `auth_group` SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, wl),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, authGroupPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(authGroupType, authGroupMapping, append(wl, authGroupPrimaryKeyColumns...))\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 auth_group row\")\n\t}\n\n\tif !cached {\n\t\tauthGroupUpdateCacheMut.Lock()\n\t\tauthGroupUpdateCache[key] = cache\n\t\tauthGroupUpdateCacheMut.Unlock()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8a09da6014858c5df2bf464c512fb700", "score": "0.5837807", "text": "func Update(c *eclcloud.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult) {\n\tb, err := opts.ToTargetGroupUpdateMap()\n\tif err != nil {\n\t\tr.Err = err\n\n\t\treturn\n\t}\n\n\t_, r.Err = c.Patch(updateURL(c, id), b, &r.Body, &eclcloud.RequestOpts{\n\t\tOkCodes: []int{200},\n\t})\n\n\treturn\n}", "title": "" }, { "docid": "643e1d6220606384ae51138caf236287", "score": "0.5828831", "text": "func (client VirtualNetworkClient) updateNetworkSecurityGroup(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {\n\thttpRequest, err := request.HTTPRequest(http.MethodPut, \"/networkSecurityGroups/{networkSecurityGroupId}\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response UpdateNetworkSecurityGroupResponse\n\tvar httpResponse *http.Response\n\thttpResponse, err = client.Call(ctx, &httpRequest)\n\tdefer common.CloseBodyIfValid(httpResponse)\n\tresponse.RawResponse = httpResponse\n\tif err != nil {\n\t\treturn response, err\n\t}\n\n\terr = common.UnmarshalResponse(httpResponse, &response)\n\treturn response, err\n}", "title": "" }, { "docid": "10a5d302e99aaa7f84419d2b6cd56341", "score": "0.58273375", "text": "func Update(client *golangsdk.ServiceClient, instanceId, groupId string, opts CreateOptsBuilder) (r UpdateResult) {\n\treqBody, err := opts.ToCreateOptsMap()\n\tif err != nil {\n\t\tr.Err = err\n\t\treturn\n\t}\n\t_, r.Err = client.Put(resourceURL(client, instanceId, groupId), reqBody, &r.Body, &golangsdk.RequestOpts{\n\t\tOkCodes: []int{200},\n\t})\n\treturn\n}", "title": "" }, { "docid": "0f8ad198f6f8c52e478bd4bddab3fe7e", "score": "0.5818096", "text": "func (to *Session) UpdateCacheGroup(id int, cachegroup tc.CacheGroupNullable, opts RequestOptions) (tc.CacheGroupDetailResponse, toclientlib.ReqInf, error) {\n\troute := fmt.Sprintf(\"%s/%d\", apiCachegroups, id)\n\tvar cachegroupResp tc.CacheGroupDetailResponse\n\treqInf, err := to.put(route, opts, cachegroup, &cachegroupResp)\n\treturn cachegroupResp, reqInf, err\n}", "title": "" }, { "docid": "436476c0001bb2b2f46d9bc5902ead35", "score": "0.5807854", "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": "9761df01c9fa0ae356e228838fd5c94e", "score": "0.5789874", "text": "func (aug *AuthUserGroup) Update(ctx context.Context, db DB) error {\n\tswitch {\n\tcase !aug._exists: // doesn't exist\n\t\treturn logerror(&ErrUpdateFailed{ErrDoesNotExist})\n\tcase aug._deleted: // deleted\n\t\treturn logerror(&ErrUpdateFailed{ErrMarkedForDeletion})\n\t}\n\t// update with primary key\n\tconst sqlstr = `UPDATE auth_user_groups SET ` +\n\t\t`user_id = $1, group_id = $2 ` +\n\t\t`WHERE id = $3`\n\t// run\n\tlogf(sqlstr, aug.UserID, aug.GroupID, aug.ID)\n\tif _, err := db.ExecContext(ctx, sqlstr, aug.UserID, aug.GroupID, aug.ID); err != nil {\n\t\treturn logerror(err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4fd6f24506eda9b91b8713adc2d146ec", "score": "0.5788883", "text": "func (s *Service) UpGroup(c context.Context, gp *param.GroupParam) (err error) {\n\tvar (\n\t\ttx *gorm.DB\n\t\tl *model.WLog\n\t\tg *model.Group\n\t)\n\n\t// double write rid\n\ttMeta := &model.TagMeta{}\n\tif tMeta, err = s.tag(gp.Business, gp.Tid); err != nil {\n\t\tlog.Error(\"TagListCache not found bid(%d) tag_id(%d)\", gp.Business, gp.Tid)\n\t\treturn\n\t}\n\tgp.Rid = tMeta.RID\n\n\t// Check group and tag is exist\n\tif g, err = s.dao.GroupByOid(c, gp.Oid, gp.Business); err != nil {\n\t\tlog.Error(\"s.dao.GroupByOid(%d, %d) error(%v)\", gp.Oid, gp.Business, err)\n\t\treturn\n\t}\n\tif g == nil {\n\t\tlog.Error(\"Group(%d, %d) not exist\", gp.Oid, gp.Business)\n\t\terr = ecode.WkfGroupNotFound\n\t\treturn\n\t}\n\n\ttx = s.dao.ORM.Begin()\n\tif err = tx.Error; err != nil {\n\t\treturn\n\t}\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\ttx.Rollback()\n\t\t\tlog.Error(\"Service.UpGroup() panic(%v)\", r)\n\t\t}\n\t}()\n\n\tif err = s.dao.TxUpGroup(tx, gp.Oid, gp.Business, gp.Tid, gp.Note, gp.Rid); err != nil {\n\t\ttx.Rollback()\n\t\tlog.Error(\"s.TxUpGroup(%d, %d, %d, %s, %d) error(%v)\", gp.Oid, gp.Business, gp.Tid, gp.Note, gp.Rid, err)\n\t\treturn\n\t}\n\n\tif err = tx.Commit().Error; err != nil {\n\t\ttx.Rollback()\n\t\tlog.Error(\"tx.Commit() error(%v)\", err)\n\t\treturn\n\t}\n\n\ts.task(func() {\n\t\tl = &model.WLog{\n\t\t\tAdminID: gp.AdminID,\n\t\t\tAdmin: gp.AdminName,\n\t\t\tOid: g.Oid,\n\t\t\tBusiness: g.Business,\n\t\t\tTarget: g.ID,\n\t\t\tModule: model.WLogModuleGroup,\n\t\t\tRemark: fmt.Sprintf(`工单编号 %d “管理 Tag”更新为“%s”`, g.ID, tMeta.Name),\n\t\t\tNote: gp.Note,\n\t\t}\n\t\ts.writeAuditLog(l)\n\t})\n\treturn\n}", "title": "" }, { "docid": "1dc68a3ce9bff43d3a11e96a5d1b8ec7", "score": "0.5787504", "text": "func FaceUpdatePersonGroup(\n\tlocation ApiLocation,\n\tkey string,\n\tpersonGroupId string,\n\tname string,\n\tuserData string,\n) (err error) {\n\tapiUrl := \"https://\" + string(location) + \".api.cognitive.microsoft.com/face/v1.0/persongroups/\" + personGroupId\n\n\t// object\n\tobj := FaceUpdatePersonGroupRequest{\n\t\tName: name,\n\t\tUserData: userData,\n\t}\n\n\t_, err = httpPatch(apiUrl, key, nil, obj)\n\n\treturn err\n}", "title": "" }, { "docid": "9ba215749f93d1a9475fad277955e29f", "score": "0.5786822", "text": "func (c *Context) UpdateGroupID(name string, id string) error {\n\tcmd := exec.Command(\"groupmod\", \"-g\", id, name)\n\tif err := cmd.Run(); err != nil {\n\t\treturn err\n\t}\n\n\tfor _, it := range c.groups {\n\t\tif it.Name == name {\n\t\t\tit.Gid = id\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "22cc55917957ae4d80efe6b5e4d10a5d", "score": "0.57830316", "text": "func HandleUpdateGroupSuccessfully(t *testing.T) {\n\tth.Mux.HandleFunc(\"/groups/9fe1d3\", func(w http.ResponseWriter, r *http.Request) {\n\t\tth.TestMethod(t, r, \"PATCH\")\n\t\tth.TestHeader(t, r, \"X-Auth-Token\", client.TokenID)\n\t\tth.TestJSONRequest(t, r, UpdateRequest)\n\n\t\tw.WriteHeader(http.StatusOK)\n\t\tfmt.Fprintf(w, UpdateOutput)\n\t})\n}", "title": "" }, { "docid": "76d15c5668d1cddee0298ee9505d7a7e", "score": "0.57746804", "text": "func (r *GroupPolicyDefinitionFileRequest) Update(ctx context.Context, reqObj *GroupPolicyDefinitionFile) error {\n\treturn r.JSONRequest(ctx, \"PATCH\", \"\", reqObj, nil)\n}", "title": "" }, { "docid": "3ac06c2799660df0e25f919c368cc3d2", "score": "0.5751313", "text": "func (a *MulticastGroupAPI) Update(ctx context.Context, req *pb.UpdateMulticastGroupRequest) (*empty.Empty, error) {\n\tif req.MulticastGroup == nil {\n\t\treturn nil, status.Errorf(codes.InvalidArgument, \"multicast_group must not be nil\")\n\t}\n\n\tmgID, err := uuid.FromString(req.MulticastGroup.Id)\n\tif err != nil {\n\t\treturn nil, status.Errorf(codes.InvalidArgument, \"id: %s\", err)\n\t}\n\n\tif valid, err := multicast.NewValidator().ValidateMulticastGroupAccess(ctx, auth.Update, mgID); !valid || err != nil {\n\t\treturn nil, status.Errorf(codes.Unauthenticated, \"authentication failed: %s\", err)\n\t}\n\n\tmg, err := multicast.GetMulticastGroup(ctx, mgID, false, false, a.nsCli)\n\tif err != nil {\n\t\treturn nil, status.Errorf(codes.Unknown, \"%s\", err)\n\t}\n\n\tvar mcAddr lorawan.DevAddr\n\tif err = mcAddr.UnmarshalText([]byte(req.MulticastGroup.McAddr)); err != nil {\n\t\treturn nil, status.Errorf(codes.InvalidArgument, \"mc_app_s_key: %s\", err)\n\t}\n\n\tvar mcNwkSKey lorawan.AES128Key\n\tif err = mcNwkSKey.UnmarshalText([]byte(req.MulticastGroup.McNwkSKey)); err != nil {\n\t\treturn nil, status.Errorf(codes.InvalidArgument, \"mc_net_s_key: %s\", err)\n\t}\n\n\tmg.Name = req.MulticastGroup.Name\n\tmg.MulticastGroup = ns.MulticastGroup{\n\t\tId: mg.MulticastGroup.Id,\n\t\tMcAddr: mcAddr[:],\n\t\tMcNwkSKey: mcNwkSKey[:],\n\t\tGroupType: ns.MulticastGroupType(req.MulticastGroup.GroupType),\n\t\tDr: req.MulticastGroup.Dr,\n\t\tFrequency: req.MulticastGroup.Frequency,\n\t\tPingSlotPeriod: req.MulticastGroup.PingSlotPeriod,\n\t\tServiceProfileId: mg.MulticastGroup.ServiceProfileId,\n\t\tRoutingProfileId: mg.MulticastGroup.RoutingProfileId,\n\t\tFCnt: req.MulticastGroup.FCnt,\n\t}\n\n\tif err = mg.MCAppSKey.UnmarshalText([]byte(req.MulticastGroup.McAppSKey)); err != nil {\n\t\treturn nil, status.Errorf(codes.InvalidArgument, \"mc_app_s_key: %s\", err)\n\t}\n\n\tif err = multicast.UpdateMulticastGroup(ctx, &mg, a.nsCli); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &empty.Empty{}, nil\n}", "title": "" }, { "docid": "5551ab521c24fc17ab82ddad4a0e5793", "score": "0.57461864", "text": "func (s service) UpdateGroupMembership(ctx context.Context, groupName string, userIds *[]string) error {\n\treturn s.membershipService.UpdateGroupMembership(ctx, groupName, userIds)\n}", "title": "" }, { "docid": "db38c1cd545ef188c2d826926c086222", "score": "0.5738902", "text": "func (o *Group) 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\tgroupUpdateCacheMut.RLock()\n\tcache, cached := groupUpdateCache[key]\n\tgroupUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tgroupAllColumns,\n\t\t\tgroupPrimaryKeyColumns,\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 groups, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"auth\\\".\\\"groups\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, groupPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(groupType, groupMapping, append(wl, groupPrimaryKeyColumns...))\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 groups 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 groups\")\n\t}\n\n\tif !cached {\n\t\tgroupUpdateCacheMut.Lock()\n\t\tgroupUpdateCache[key] = cache\n\t\tgroupUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "title": "" }, { "docid": "be78777b970a467e50a5adc72c0357bf", "score": "0.57075757", "text": "func saveGroup(w http.ResponseWriter, r *http.Request, d *ServiceData) {\n\tfuncname := \"saveGroup\"\n\tutil.Console(\"Entered %s\\n\", funcname)\n\tutil.Console(\"record data = %s\\n\", d.data)\n\n\tvar foo GroupSave\n\tvar err error\n\tvar grp db.EGroup\n\tdata := []byte(d.data)\n\terr = json.Unmarshal(data, &foo)\n\n\tif err != nil {\n\t\te := fmt.Errorf(\"%s: Error with json.Unmarshal: %s\", funcname, err.Error())\n\t\tSvcGridErrorReturn(w, e)\n\t\treturn\n\t}\n\n\tif foo.Record.GID == 0 {\n\t\tgrp, err = db.GetGroupByName(foo.Record.GroupName)\n\t} else {\n\t\tgrp, err = db.GetGroup(foo.Record.GID)\n\t}\n\tif nil != err {\n\t\tif util.IsSQLNoResultsError(err) {\n\t\t\tgrp.GroupName = foo.Record.GroupName\n\t\t\tgrp.DtStart = time.Now()\n\t\t\tgrp.GroupDescription = foo.Record.GroupDescription\n\t\t\tif err = db.InsertGroup(&grp); err != nil {\n\t\t\t\te := fmt.Errorf(\"error inserting group %s: %s\", foo.Record.GroupName, err.Error())\n\t\t\t\tSvcGridErrorReturn(w, e)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t} else {\n\t\tchg := false\n\t\tif grp.GroupName != foo.Record.GroupName {\n\t\t\tchg = true\n\t\t\tgrp.GroupName = foo.Record.GroupName\n\t\t}\n\t\tif grp.GroupDescription != foo.Record.GroupDescription {\n\t\t\tchg = true\n\t\t\tgrp.GroupDescription = foo.Record.GroupDescription\n\t\t}\n\t\tif chg {\n\t\t\tif err = db.UpdateGroup(&grp); err != nil {\n\t\t\t\te := fmt.Errorf(\"error updating group %s: %s\", foo.Record.GroupName, err.Error())\n\t\t\t\tSvcGridErrorReturn(w, e)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\n\tSvcWriteSuccessResponseWithID(w, grp.GID)\n}", "title": "" }, { "docid": "9928dae436b5f31ef857a9921dbe0425", "score": "0.57065403", "text": "func (o *AuthGroup) UpdateP(exec boil.Executor, whitelist ...string) {\n\terr := o.Update(exec, whitelist...)\n\tif err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "84666e66e160478634257acdb3a3926a", "score": "0.5698734", "text": "func (pr *TrafficGroupResource) Edit(id string, item TrafficGroup) error {\n\tif err := pr.c.ModQuery(\"PUT\", BasePath+TrafficGroupEndpoint+\"/\"+id, item); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "30a6946f8afefda152cea8a13f1a23da", "score": "0.56778324", "text": "func validate_Groups_Update_0(ctx context.Context, r json.RawMessage) (err error) {\n\treturn validate_Object_Group(ctx, r, \"\")\n}", "title": "" }, { "docid": "d1cf51416ac5caf8075daeddd5332f01", "score": "0.56771183", "text": "func (s *Server) handleGroupUpdate(w http.ResponseWriter, r *http.Request) {\n\t// Parse group ID from the path.\n\tid, err := strconv.Atoi(mux.Vars(r)[\"id\"])\n\tif err != nil {\n\t\tError(w, r, api.Errorf(api.EINVALID, \"Invalid ID format\"))\n\t\treturn\n\t}\n\n\t// Parse fields into an update object.\n\tupd := api.GroupUpdate{}\n\tif err := json.NewDecoder(r.Body).Decode(&upd); err != nil {\n\t\tError(w, r, api.Errorf(api.EINVALID, \"Invalid JSON body\"))\n\t\treturn\n\t}\n\n\t// Update the group in the database.\n\t_, err = s.GroupService.UpdateGroup(r.Context(), id, upd)\n\tif err != nil {\n\t\tError(w, r, err)\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-type\", \"application/json\")\n\tw.Write([]byte(`{}`))\n}", "title": "" }, { "docid": "f107c55a10c0b3e891bd53931f962e84", "score": "0.56685585", "text": "func (l *LogfilesRemoteSmbWorkgroup) Update(client sophos.ClientInterface, options ...sophos.Option) (err error) {\n\treturn put(client, \"/api/nodes/logfiles.remote.smb_workgroup\", l.Value, options...)\n}", "title": "" }, { "docid": "255cd6db5209a634a898afd6d83df5c8", "score": "0.5666349", "text": "func (client VirtualNetworkClient) UpdateCrossConnectGroup(ctx context.Context, request UpdateCrossConnectGroupRequest) (response UpdateCrossConnectGroupResponse, err error) {\n\tvar ociResponse common.OCIResponse\n\tpolicy := common.NoRetryPolicy()\n\tif client.RetryPolicy() != nil {\n\t\tpolicy = *client.RetryPolicy()\n\t}\n\tif request.RetryPolicy() != nil {\n\t\tpolicy = *request.RetryPolicy()\n\t}\n\tociResponse, err = common.Retry(ctx, request, client.updateCrossConnectGroup, policy)\n\tif err != nil {\n\t\tif ociResponse != nil {\n\t\t\tif httpResponse := ociResponse.HTTPResponse(); httpResponse != nil {\n\t\t\t\topcRequestId := httpResponse.Header.Get(\"opc-request-id\")\n\t\t\t\tresponse = UpdateCrossConnectGroupResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId}\n\t\t\t} else {\n\t\t\t\tresponse = UpdateCrossConnectGroupResponse{}\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\tif convertedResponse, ok := ociResponse.(UpdateCrossConnectGroupResponse); ok {\n\t\tresponse = convertedResponse\n\t} else {\n\t\terr = fmt.Errorf(\"failed to convert OCIResponse into UpdateCrossConnectGroupResponse\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "e523491a7c9eceb063ba4d5edde05c3f", "score": "0.56579196", "text": "func (repo *Repository) UpdateUserGroup(id uuid.UUID, args repository.UpdateUserGroupArgs) error {\n\tif id == uuid.Nil {\n\t\treturn repository.ErrNilID\n\t}\n\n\tvar updated bool\n\terr := repo.db.Transaction(func(tx *gorm.DB) error {\n\t\tvar g model.UserGroup\n\t\tif err := tx.First(&g, &model.UserGroup{ID: id}).Error; err != nil {\n\t\t\treturn convertError(err)\n\t\t}\n\n\t\tchanges := map[string]interface{}{}\n\t\tif args.Name.Valid {\n\t\t\tchanges[\"name\"] = args.Name.V\n\t\t}\n\t\tif args.Description.Valid {\n\t\t\tchanges[\"description\"] = args.Description.V\n\t\t}\n\t\tif args.Type.Valid {\n\t\t\tchanges[\"type\"] = args.Type.V\n\t\t}\n\t\tif args.Icon.Valid {\n\t\t\tchanges[\"icon\"] = args.Icon.V\n\t\t}\n\n\t\tif len(changes) == 0 {\n\t\t\treturn nil\n\t\t}\n\n\t\tupdated = true\n\t\terr := tx.Model(&g).Updates(changes).Error\n\t\tif gormutil.IsMySQLDuplicatedRecordErr(err) {\n\t\t\treturn repository.ErrAlreadyExists\n\t\t}\n\t\treturn err\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif updated {\n\t\trepo.hub.Publish(hub.Message{\n\t\t\tName: event.UserGroupUpdated,\n\t\t\tFields: hub.Fields{\n\t\t\t\t\"group_id\": id,\n\t\t\t},\n\t\t})\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9efe722dc6295372401e57390b144acd", "score": "0.56375647", "text": "func (a *MulticastGroupAPI) Update(ctx context.Context, req *pb.UpdateMulticastGroupRequest) (*empty.Empty, error) {\n\tif req.MulticastGroup == nil {\n\t\treturn nil, grpc.Errorf(codes.InvalidArgument, \"multicast_group must not be nil\")\n\t}\n\n\tmgID, err := uuid.FromString(req.MulticastGroup.Id)\n\tif err != nil {\n\t\treturn nil, grpc.Errorf(codes.InvalidArgument, \"id: %s\", err)\n\t}\n\n\tif err = a.validator.Validate(ctx,\n\t\tauth.ValidateMulticastGroupAccess(auth.Update, mgID)); err != nil {\n\t\treturn nil, grpc.Errorf(codes.Unauthenticated, \"authentication failed: %s\", err)\n\t}\n\n\tmg, err := storage.GetMulticastGroup(ctx, storage.DB(), mgID, false, false)\n\tif err != nil {\n\t\treturn nil, helpers.ErrToRPCError(err)\n\t}\n\n\tvar mcAddr lorawan.DevAddr\n\tif err = mcAddr.UnmarshalText([]byte(req.MulticastGroup.McAddr)); err != nil {\n\t\treturn nil, grpc.Errorf(codes.InvalidArgument, \"mc_app_s_key: %s\", err)\n\t}\n\n\tvar mcNwkSKey lorawan.AES128Key\n\tif err = mcNwkSKey.UnmarshalText([]byte(req.MulticastGroup.McNwkSKey)); err != nil {\n\t\treturn nil, grpc.Errorf(codes.InvalidArgument, \"mc_net_s_key: %s\", err)\n\t}\n\n\tmg.Name = req.MulticastGroup.Name\n\tmg.MulticastGroup = ns.MulticastGroup{\n\t\tId: mg.MulticastGroup.Id,\n\t\tMcAddr: mcAddr[:],\n\t\tMcNwkSKey: mcNwkSKey[:],\n\t\tGroupType: ns.MulticastGroupType(req.MulticastGroup.GroupType),\n\t\tDr: req.MulticastGroup.Dr,\n\t\tFrequency: req.MulticastGroup.Frequency,\n\t\tPingSlotPeriod: req.MulticastGroup.PingSlotPeriod,\n\t\tServiceProfileId: mg.MulticastGroup.ServiceProfileId,\n\t\tRoutingProfileId: mg.MulticastGroup.RoutingProfileId,\n\t\tFCnt: req.MulticastGroup.FCnt,\n\t}\n\n\tif err = mg.MCAppSKey.UnmarshalText([]byte(req.MulticastGroup.McAppSKey)); err != nil {\n\t\treturn nil, grpc.Errorf(codes.InvalidArgument, \"mc_app_s_key: %s\", err)\n\t}\n\n\tif err = storage.Transaction(func(tx sqlx.Ext) error {\n\t\tif err := storage.UpdateMulticastGroup(ctx, tx, &mg); err != nil {\n\t\t\treturn helpers.ErrToRPCError(err)\n\t\t}\n\n\t\treturn nil\n\t}); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &empty.Empty{}, nil\n}", "title": "" }, { "docid": "be166761b86e8a3259d6b06df787b3ec", "score": "0.56373453", "text": "func (m *TunnelConfigurationIKEv2Custom) SetPfsGroup(value *PfsGroup)() {\n err := m.GetBackingStore().Set(\"pfsGroup\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "ff41e2c4e6aa0acf6d189eacaaeaca85", "score": "0.5625839", "text": "func API_Groups_Id(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\tid, _ := strconv.ParseInt(vars[\"id\"], 0, 64)\n\tg, err := models.GetGroup(id, ctx.Get(r, \"user_id\").(int64))\n\tif err != nil {\n\t\tJSONResponse(w, models.Response{Success: false, Message: \"Group not found\"}, http.StatusNotFound)\n\t\treturn\n\t}\n\tswitch {\n\tcase r.Method == \"GET\":\n\t\tJSONResponse(w, g, http.StatusOK)\n\tcase r.Method == \"DELETE\":\n\t\terr = models.DeleteGroup(&g)\n\t\tif err != nil {\n\t\t\tJSONResponse(w, models.Response{Success: false, Message: \"Error deleting group\"}, http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tJSONResponse(w, models.Response{Success: true, Message: \"Group deleted successfully!\"}, http.StatusOK)\n\tcase r.Method == \"PUT\":\n\t\t// Change this to get from URL and uid (don't bother with id in r.Body)\n\t\tg = models.Group{}\n\t\terr = json.NewDecoder(r.Body).Decode(&g)\n\t\tif g.Id != id {\n\t\t\tJSONResponse(w, models.Response{Success: false, Message: \"Error: /:id and group_id mismatch\"}, http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tg.ModifiedDate = time.Now()\n\t\tg.UserId = ctx.Get(r, \"user_id\").(int64)\n\t\terr = models.PutGroup(&g)\n\t\tif err != nil {\n\t\t\tJSONResponse(w, models.Response{Success: false, Message: err.Error()}, http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t\tJSONResponse(w, g, http.StatusOK)\n\t}\n}", "title": "" }, { "docid": "a575688dccf581befb6f5c4e94c741d8", "score": "0.56227356", "text": "func (ng *NodeGroup) UpdateNodeGroup(group *proto.NodeGroup, opt *cloudprovider.CommonOption) error {\n\treturn cloudprovider.ErrCloudNotImplemented\n}", "title": "" }, { "docid": "b35600ec2336c72ffa771f369490556e", "score": "0.55919707", "text": "func (a *Client) ReplaceProcessGroup(params *ReplaceProcessGroupParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ReplaceProcessGroupOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewReplaceProcessGroupParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"replaceProcessGroup\",\n\t\tMethod: \"PUT\",\n\t\tPathPattern: \"/process-groups/{id}/flow-contents\",\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: &ReplaceProcessGroupReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t}\n\tfor _, opt := range opts {\n\t\topt(op)\n\t}\n\n\tresult, err := a.transport.Submit(op)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*ReplaceProcessGroupOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for replaceProcessGroup: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "aec9a554e8a30849b68461bbc1e2e4a4", "score": "0.55715865", "text": "func (c *appGroups) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.AppGroup, err error) {\n\tresult = &v1.AppGroup{}\n\terr = c.client.Patch(pt).\n\t\tNamespace(c.ns).\n\t\tResource(\"appgroups\").\n\t\tSubResource(subresources...).\n\t\tName(name).\n\t\tBody(data).\n\t\tDo().\n\t\tInto(result)\n\treturn\n}", "title": "" }, { "docid": "500dee0dbdf5a40885c3ca4f961852bf", "score": "0.5568116", "text": "func (a *AuthUpdateBackendGroupMembersStatus) Update(client sophos.ClientInterface, options ...sophos.Option) (err error) {\n\treturn put(client, \"/api/nodes/auth.update_backend_group_members.status\", a.Value, options...)\n}", "title": "" }, { "docid": "8b5d1f2f6fd2d92d83371a6cb122e8b3", "score": "0.5562189", "text": "func (l *LinkAggregationGroups) Update(client sophos.ClientInterface, options ...sophos.Option) (err error) {\n\treturn put(client, \"/api/nodes/link_aggregation.groups\", l.Value, options...)\n}", "title": "" }, { "docid": "8271e18252c72685bfdc98b10a121cb6", "score": "0.55582404", "text": "func (s *GroupsService) UpdateWithGroup(ctx context.Context, id string, group *Group) (*Group, *Response, error) {\n\tprofile := group.Profile\n\n\treturn s.Update(ctx, id, &profile)\n}", "title": "" }, { "docid": "c1c705ef467e0133112886dc726d2cde", "score": "0.5555409", "text": "func (client LongTermRetentionBackupsClient) UpdateByResourceGroupResponder(resp *http.Response) (result LongTermRetentionBackupOperationResult, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "8be3c604558425a211efe8c8c021f5d2", "score": "0.5551899", "text": "func (s *ComponentsService) UpdateGroup(id int, c *ComponentGroup) (*ComponentGroup, *Response, error) {\n\tu := fmt.Sprintf(\"api/v1/components/groups/%d\", id)\n\tv := new(componentGroupAPIResponse)\n\n\tresp, err := s.client.Call(\"PUT\", u, c, v)\n\treturn v.Data, resp, err\n}", "title": "" }, { "docid": "0b357f6850b6a03274f91c814c13e758", "score": "0.55429345", "text": "func (p *LogProject) UpdateMachineGroup(m *MachineGroup) (err error) {\n\tbody, err := json.Marshal(m)\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\tr, err := request(p, \"PUT\", \"/machinegroups/\"+m.Name, 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": "82228b5d7fb2f7d837c7a1bd6887d87f", "score": "0.55268496", "text": "func (c *Client) Update() goa.Endpoint {\n\treturn func(ctx context.Context, v interface{}) (interface{}, error) {\n\t\tinv := goagrpc.NewInvoker(\n\t\t\tBuildUpdateFunc(c.grpccli, c.opts...),\n\t\t\tEncodeUpdateRequest,\n\t\t\tDecodeUpdateResponse)\n\t\tres, err := inv.Invoke(ctx, v)\n\t\tif err != nil {\n\t\t\tresp := goagrpc.DecodeError(err)\n\t\t\tswitch message := resp.(type) {\n\t\t\tcase *goapb.ErrorResponse:\n\t\t\t\treturn nil, goagrpc.NewServiceError(message)\n\t\t\tdefault:\n\t\t\t\treturn nil, goa.Fault(err.Error())\n\t\t\t}\n\t\t}\n\t\treturn res, nil\n\t}\n}", "title": "" }, { "docid": "8d09af623ba2073a2d0b489b803ed5ae", "score": "0.55258834", "text": "func (client *ClientImpl) UpdateGroupEntitlement(ctx context.Context, args UpdateGroupEntitlementArgs) (*GroupEntitlementOperationReference, error) {\n\tif args.Document == nil {\n\t\treturn nil, &azuredevops.ArgumentNilError{ArgumentName: \"args.Document\"}\n\t}\n\trouteValues := make(map[string]string)\n\tif args.GroupId == nil {\n\t\treturn nil, &azuredevops.ArgumentNilError{ArgumentName: \"args.GroupId\"}\n\t}\n\trouteValues[\"groupId\"] = (*args.GroupId).String()\n\n\tqueryParams := url.Values{}\n\tif args.RuleOption != nil {\n\t\tqueryParams.Add(\"ruleOption\", string(*args.RuleOption))\n\t}\n\tbody, marshalErr := json.Marshal(*args.Document)\n\tif marshalErr != nil {\n\t\treturn nil, marshalErr\n\t}\n\tlocationId, _ := uuid.Parse(\"2280bffa-58a2-49da-822e-0764a1bb44f7\")\n\tresp, err := client.Client.Send(ctx, http.MethodPatch, locationId, \"7.1-preview.1\", routeValues, queryParams, bytes.NewReader(body), \"application/json-patch+json\", \"application/json\", nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar responseValue GroupEntitlementOperationReference\n\terr = client.Client.UnmarshalBody(resp, &responseValue)\n\treturn &responseValue, err\n}", "title": "" }, { "docid": "8e925c84cd84df351f1f8929674faebd", "score": "0.55004984", "text": "func (a *UserManagementApiService) UmGroupsPutExecute(r ApiUmGroupsPutRequest) (Group, *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 Group\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"UserManagementApiService.UmGroupsPut\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/um/groups/{groupId}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"groupId\"+\"}\", _neturl.PathEscape(parameterToString(r.groupId, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\tif r.group == nil {\n\t\treturn localVarReturnValue, nil, reportError(\"group is required and must be specified\")\n\t}\n\n\tif r.pretty != nil {\n\t\tlocalVarQueryParams.Add(\"pretty\", parameterToString(*r.pretty, \"\"))\n\t}\n\tif r.depth != nil {\n\t\tlocalVarQueryParams.Add(\"depth\", parameterToString(*r.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 r.xContractNumber != nil {\n\t\tlocalVarHeaderParams[\"X-Contract-Number\"] = parameterToString(*r.xContractNumber, \"\")\n\t}\n\t// body params\n\tlocalVarPostBody = r.group\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif apiKey, ok := auth[\"Token Authentication\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif apiKey.Prefix != \"\" {\n\t\t\t\t\tkey = apiKey.Prefix + \" \" + apiKey.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = apiKey.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"Authorization\"] = key\n\t\t\t}\n\t\t}\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\n\tlocalVarAPIResponse := &APIResponse {\n\t\tResponse: localVarHTTPResponse,\n\t\tMethod: localVarHTTPMethod,\n\t\tRequestURL: localVarPath,\n\t\tOperation: \"UmGroupsPut\",\n\t}\n\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": "fb7e7052e22ecbe6d0af79017183fd95", "score": "0.54970837", "text": "func (p *LogProject) UpdateMachineGroup(m *MachineGroup) (err error) {\n\tbody, err := json.Marshal(m)\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\tr, err := request(p, \"PUT\", \"/machinegroups/\"+m.Name, 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": "2da14bc44e1b3c7e7db089952d2ee3c6", "score": "0.54920024", "text": "func (client *Client) UpdateEndpointGroup(request *UpdateEndpointGroupRequest) (_result *UpdateEndpointGroupResponse, _err error) {\n\truntime := &util.RuntimeOptions{}\n\t_result = &UpdateEndpointGroupResponse{}\n\t_body, _err := client.UpdateEndpointGroupWithOptions(request, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_result = _body\n\treturn _result, _err\n}", "title": "" }, { "docid": "121178dbb389e009c051129b3a8a9bbd", "score": "0.54774374", "text": "func UpdateMacGroupOfRecord(w http.ResponseWriter, req *http.Request) {\n\t// get all the params from the request\n\tvars := mux.Vars(req)\n\n\t// create the db connection\n\tdb := getDBConn()\n\n\t// close db connection\n\tdefer db.Close()\n\n\t// db name\n\tdbName := os.Getenv(\"SQLITE_DB_NAME\")\n\n\t// form update record query\n\tupdateQuery := fmt.Sprintf(\"UPDATE %s SET mac_group=? WHERE mac_id=?\", dbName)\n\n\t// prepare query\n\tstmtOut, err := db.Prepare(updateQuery)\n\n\t// close stmtOut request\n\tdefer stmtOut.Close()\n\n\tcheckErr(err)\n\n\t_, err = stmtOut.Exec(vars[\"macGroup\"], vars[\"macID\"])\n\n\tcheckErr(err)\n\n\t// return the order in json format\n\tjson.NewEncoder(w).Encode(fmt.Sprintf(\"Mac Group of Record Updated for ID: %v\", vars[\"macID\"]))\n}", "title": "" }, { "docid": "192a8537e8fb9af9104139a8a2bc06e8", "score": "0.5474654", "text": "func UpdateGroupInApplication(projectKey, appName, groupName string, permission int) error {\n\tif permission < 4 || permission > 7 {\n\t\treturn fmt.Errorf(\"Permission should be between 4-7\")\n\t}\n\n\tgroupApplication := GroupPermission{\n\t\tGroup: Group{\n\t\t\tName: groupName,\n\t\t},\n\t\tPermission: permission,\n\t}\n\n\tdata, err := json.Marshal(groupApplication)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tpath := fmt.Sprintf(\"/project/%s/application/%s/group/%s\", projectKey, appName, groupName)\n\tdata, _, err = Request(\"PUT\", path, data)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn DecodeError(data)\n}", "title": "" }, { "docid": "999ce45984409ba1e213caed562fb85c", "score": "0.5471796", "text": "func (mm *OnuMetricsManager) UpdateGroupSupport(ctx context.Context, aGroupName string, pmConfigs *voltha.PmConfigs) error {\n\tgroupSliceIdx := 0\n\tvar group *voltha.PmGroupConfig\n\n\tfor groupSliceIdx, group = range pmConfigs.Groups {\n\t\tif group.GroupName == aGroupName {\n\t\t\tbreak\n\t\t}\n\t}\n\tif group == nil {\n\t\tlogger.Errorw(ctx, \"group metric not found\", log.Fields{\"device-id\": mm.deviceID, \"groupName\": aGroupName})\n\t\treturn fmt.Errorf(\"group-not-found--groupName-%s\", aGroupName)\n\t}\n\n\tupdated := false\n\tmm.OnuMetricsManagerLock.Lock()\n\tdefer mm.OnuMetricsManagerLock.Unlock()\n\tfor k, v := range mm.GroupMetricMap {\n\t\tif k == aGroupName && v.Enabled != group.Enabled {\n\t\t\tmm.pDeviceHandler.GetPmConfigs().Groups[groupSliceIdx].Enabled = group.Enabled\n\t\t\tv.Enabled = group.Enabled\n\t\t\tif group.Enabled {\n\t\t\t\tif v.IsL2PMCounter {\n\t\t\t\t\t// If it is a L2 PM counter we need to mark the PM to be added\n\t\t\t\t\tmm.l2PmToAdd = mm.appendIfMissingString(mm.l2PmToAdd, v.groupName)\n\t\t\t\t\t// If the group support flag toggles too soon, we need to delete the group name from l2PmToDelete slice\n\t\t\t\t\tmm.l2PmToDelete = mm.removeIfFoundString(mm.l2PmToDelete, v.groupName)\n\n\t\t\t\t\t// The GemPortHistory group requires some special handling as the instance IDs are not pre-defined\n\t\t\t\t\t// unlike other L2 PM counters. We need to fetch the active gemport instance IDs in the system to\n\t\t\t\t\t// take further action\n\t\t\t\t\tif v.groupName == GemPortHistoryName {\n\t\t\t\t\t\tmm.updateGemPortNTPInstanceToAddForPerfMonitoring(ctx)\n\t\t\t\t\t}\n\t\t\t\t} else if mm.pDeviceHandler.GetPmConfigs().FreqOverride { // otherwise just update the next collection interval\n\t\t\t\t\tv.NextCollectionInterval = time.Now().Add(time.Duration(v.Frequency) * time.Second)\n\t\t\t\t}\n\t\t\t} else { // group counter is disabled\n\t\t\t\tif v.IsL2PMCounter {\n\t\t\t\t\t// If it is a L2 PM counter we need to mark the PM to be deleted\n\t\t\t\t\tmm.l2PmToDelete = mm.appendIfMissingString(mm.l2PmToDelete, v.groupName)\n\t\t\t\t\t// If the group support flag toggles too soon, we need to delete the group name from l2PmToAdd slice\n\t\t\t\t\tmm.l2PmToAdd = mm.removeIfFoundString(mm.l2PmToAdd, v.groupName)\n\n\t\t\t\t\t// The GemPortHistory group requires some special handling as the instance IDs are not pre-defined\n\t\t\t\t\t// unlike other L2 PM counters. We need to fetch the active gemport instance IDs in the system to\n\t\t\t\t\t// take further action\n\t\t\t\t\tif v.groupName == GemPortHistoryName {\n\t\t\t\t\t\tmm.updateGemPortNTPInstanceToDeleteForPerfMonitoring(ctx)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tupdated = true\n\t\t\tif v.IsL2PMCounter {\n\t\t\t\tlogger.Infow(ctx, \"l2 pm group metric support updated\",\n\t\t\t\t\tlog.Fields{\"device-id\": mm.deviceID, \"groupName\": aGroupName, \"enabled\": group.Enabled, \"l2PmToAdd\": mm.l2PmToAdd, \"l2PmToDelete\": mm.l2PmToDelete})\n\t\t\t} else {\n\t\t\t\tlogger.Infow(ctx, \"group metric support updated\", log.Fields{\"device-id\": mm.deviceID, \"groupName\": aGroupName, \"enabled\": group.Enabled})\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif !updated {\n\t\tlogger.Errorw(ctx, \"group metric support not updated\", log.Fields{\"device-id\": mm.deviceID, \"groupName\": aGroupName})\n\t\treturn fmt.Errorf(\"internal-error-during-group-support-update--groupName-%s\", aGroupName)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ba58e394a8f359fa30c5cb0fb0cf8f06", "score": "0.54697853", "text": "func NewUpdate(nameServerGroupStub NSGroupStub, returnFields []string) *api.BaseAPI {\n\treference := \"/\" + nameServerGroupStub.Reference + \"?_return_fields=\" + strings.Join(returnFields, \",\")\n\tupdateNSGroupStubAPI := api.NewBaseAPI(http.MethodPut, wapiVersion+reference, nameServerGroupStub, new(NSGroupStub))\n\treturn updateNSGroupStubAPI\n}", "title": "" } ]
cccf1e086714e875a034ed15e2cba105
SetBackupCodeIdentifier sets the backup code identifier
[ { "docid": "1d4badfbfd34d856255f87ae28fb5ab8", "score": "0.7487083", "text": "func (request *RegistrationWidgetSessionRequest) SetBackupCodeIdentifier(backupCodeIdentifier string) {\n\trequest.backupCodeIdentifier = backupCodeIdentifier\n}", "title": "" } ]
[ { "docid": "1685be2637d06856735c05c6a23aef24", "score": "0.6041971", "text": "func (m *MacOSPrivacyAccessControlItem) SetIdentifier(value *string)() {\n err := m.GetBackingStore().Set(\"identifier\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "23bf76a5e8d960f21cca251dfa3888c5", "score": "0.5918949", "text": "func (m *Windows10AssociatedApps) SetIdentifier(value *string)() {\n err := m.GetBackingStore().Set(\"identifier\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "7f70afd5ae9817d9750e557a7c971e17", "score": "0.5780522", "text": "func (m *AppleVpnConfiguration) SetIdentifier(value *string)() {\n err := m.GetBackingStore().Set(\"identifier\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "34ab0a2e3385fcbf01f834903936f63e", "score": "0.56658584", "text": "func (request RegistrationWidgetSessionRequest) GetBackupCodeIdentifier() string {\n\treturn request.backupCodeIdentifier\n}", "title": "" }, { "docid": "b15d6ca31bf2636587085d5fd046f255", "score": "0.55499136", "text": "func (m *MacOSLobChildApp) SetBundleId(value *string)() {\n err := m.GetBackingStore().Set(\"bundleId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "71c7fa700b3bf04f001754e0335947b2", "score": "0.55431956", "text": "func (response RegistrationWidgetSessionResponse) GetBackupCodeIdentifier() string {\n\treturn response.backupCodeIdentifier\n}", "title": "" }, { "docid": "cefd9f398e62d8682966514cd9eef360", "score": "0.54680896", "text": "func (m *MacOSLobApp) SetBundleId(value *string)() {\n m.bundleId = value\n}", "title": "" }, { "docid": "9a39efcd932bf46fb9bc00fc7d0edfd5", "score": "0.54638994", "text": "func (m *SelfSignedCertificate) SetCustomKeyIdentifier(value []byte)() {\n err := m.GetBackingStore().Set(\"customKeyIdentifier\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "79855e4f4e5b1c640763eb379434831e", "score": "0.54091674", "text": "func (m *IosStoreApp) SetBundleId(value *string)() {\n err := m.GetBackingStore().Set(\"bundleId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "ac171310bb04cabc5ab243e76b4d1c9d", "score": "0.5353687", "text": "func (m *MacOSPrivacyAccessControlItem) SetIdentifierType(value *MacOSProcessIdentifierType)() {\n err := m.GetBackingStore().Set(\"identifierType\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "a42254f75926c27104784ace17766a75", "score": "0.5305488", "text": "func (s *Server) SetIdentifier(input wrpc.SetIdentifierInput, output *wrpc.SetIdentifierOutput) error {\n\treturn s.rpcMiddleware(&input.CommonInput, func() error {\n\t\tif s.identifier == \"\" {\n\t\t\ts.identifier = input.Identifier\n\t\t\toutput.Ok = true\n\t\t\treturn nil\n\t\t}\n\t\tif s.identifier == input.Identifier {\n\t\t\toutput.Ok = true\n\t\t\treturn nil\n\t\t}\n\n\t\treturn errors.New(\"identifier already set, mismatch\")\n\t})\n}", "title": "" }, { "docid": "f3211b5d6a89eb16214b63103ef5e007", "score": "0.52750415", "text": "func (o *Import) SetIdentifier(id string) {\n\n}", "title": "" }, { "docid": "407872a87342901db9d711b6cfa3624a", "score": "0.5156519", "text": "func (conGen *ControllerGenerator) SetIdentifier(identifier string) *ControllerGenerator {\n\tconGen.identifier = strcase.ToCamel(identifier)\n\tconGen.lowerCamelCaseIdentifier = strcase.ToLowerCamel(conGen.identifier)\n\tconGen.queryVariableName = conGen.lowerCamelCaseIdentifier + Query\n\tconGen.transactorVariableName = conGen.lowerCamelCaseIdentifier + Transactor\n\treturn conGen\n}", "title": "" }, { "docid": "9d09c8cc482e36845938f0fd2971f763", "score": "0.5149148", "text": "func (csdb *CommitStateDB) SetCode(addr ethcmn.Address, code []byte) {\n\tso := csdb.GetOrNewStateObject(addr)\n\tif so != nil {\n\t\tso.SetCode(ethcrypto.Keccak256Hash(code), code)\n\t}\n}", "title": "" }, { "docid": "e9af17c6c7ddded0ab214e79cb5101d7", "score": "0.50923306", "text": "func (o *ServiceToken) SetIdentifier(id string) {\n\n}", "title": "" }, { "docid": "40d8bd40764cc205ae75b126a3a3c4ca", "score": "0.5085835", "text": "func (m *WindowsMobileMSI) SetProductCode(value *string)() {\n err := m.GetBackingStore().Set(\"productCode\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "52a24d9cf2dc0cfc892867f6b90fc6c9", "score": "0.5051163", "text": "func (o *PCCProvider) SetIdentifier(id string) {\n\n\to.ID = id\n}", "title": "" }, { "docid": "eca24cf1ed5d52a05a87c6e4e3ff7a37", "score": "0.5040546", "text": "func (k *Keeper) SetCode(ctx sdk.Context, addr ethcmn.Address, code []byte) {\n\tk.csdb.WithContext(ctx).SetCode(addr, code)\n}", "title": "" }, { "docid": "b97dc6e4d02d243f1dd7f10b232ae263", "score": "0.50386524", "text": "func (r *PurgeFilesByCache_TagsAndHostOrPrefixRequest) SetIdentifier(identifier string) {\n r.Identifier = identifier\n}", "title": "" }, { "docid": "ea3a6b94fc69848b1787d91651606b92", "score": "0.50182694", "text": "func (o *Call) SetIdentifier(id string) {\n\n}", "title": "" }, { "docid": "c12e47e767b92387ffc3cc06069b03a7", "score": "0.49803248", "text": "func (o *SparseCall) SetIdentifier(id string) {\n\n}", "title": "" }, { "docid": "4e0baa8106b4ed34bf6a403006b8ceef", "score": "0.49724585", "text": "func (p *Plane) setIcaoIdentifier(icaoIdentifier uint32) {\n\tp.rwLock.Lock()\n\tdefer p.rwLock.Unlock()\n\tp.icaoIdentifier = icaoIdentifier\n\tp.icao = fmt.Sprintf(\"%06X\", icaoIdentifier)\n}", "title": "" }, { "docid": "f6be180113e7b5c39b05adf4b6df2701", "score": "0.49261773", "text": "func (o *SparseServiceToken) SetIdentifier(id string) {\n\n}", "title": "" }, { "docid": "5a25bfc1df9382d972213e222e42e071", "score": "0.49240133", "text": "func (o *SparseImport) SetIdentifier(id string) {\n\n}", "title": "" }, { "docid": "c29c0d638d44d3552a73b54215eee6fa", "score": "0.49161533", "text": "func (_options *SetProfileIdentityOptions) SetIdentifier(identifier string) *SetProfileIdentityOptions {\n\t_options.Identifier = core.StringPtr(identifier)\n\treturn _options\n}", "title": "" }, { "docid": "36909f2c1edd1d778c0d61068b98efc3", "score": "0.49004826", "text": "func (o *Issue) SetIdentifier(id string) {\n\n}", "title": "" }, { "docid": "8373bcd56af9efc3df80709d25bea59a", "score": "0.4878526", "text": "func (m *SelfSignedCertificate) SetKeyId(value *i561e97a8befe7661a44c8f54600992b4207a3a0cf6770e5559949bc276de2e22.UUID)() {\n err := m.GetBackingStore().Set(\"keyId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "5ee128425c34ce94bf81211ab390148b", "score": "0.48470056", "text": "func (m *CopyNotebookModel) SetId(value *string)() {\n err := m.GetBackingStore().Set(\"id\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "8918d478479fc17c54578ee4db2b0b53", "score": "0.48199016", "text": "func (o *SparseIssue) SetIdentifier(id string) {\n\n}", "title": "" }, { "docid": "cb82019f873955fe77a8d1a4ec55e302", "score": "0.48018685", "text": "func (store *MongoDBWrapper) SetVerficationCode(mail string, code string) error {\n\treturn store.ChangeFieldValue(mail, \"VerficationCode\", code)\n}", "title": "" }, { "docid": "09efb8997dbf4545cd27cdb34a0c4031", "score": "0.47967845", "text": "func (o *SparsePCCProvider) SetIdentifier(id string) {\n\n\tif id != \"\" {\n\t\to.ID = &id\n\t} else {\n\t\to.ID = nil\n\t}\n}", "title": "" }, { "docid": "5eb44d86533c52bd6d06f17f8afd95b9", "score": "0.47508615", "text": "func (m *BookingCustomerInformation) SetCustomerId(value *string)() {\n err := m.GetBackingStore().Set(\"customerId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "6e6c1af3a7b846d62fd86be8d9ad66b0", "score": "0.4745556", "text": "func (m *DeviceHealthScriptPolicyState) SetId(value *string)() {\n err := m.GetBackingStore().Set(\"id\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "3e8bccf576ca4690a30ac261a10d54b7", "score": "0.47123665", "text": "func (m *AccessPackageLocalizedText) SetLanguageCode(value *string)() {\n err := m.GetBackingStore().Set(\"languageCode\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "1dbb191d067e5a5954d52970d4c4da6c", "score": "0.46707618", "text": "func (m *ImportedDeviceIdentity) SetImportedDeviceIdentifier(value *string)() {\n err := m.GetBackingStore().Set(\"importedDeviceIdentifier\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "7b597913fd69076c510231a3885d91c5", "score": "0.46591806", "text": "func (m *PrinterLocation) SetPostalCode(value *string)() {\n m.postalCode = value\n}", "title": "" }, { "docid": "8e603fc9b451f851ee422946ff3f1d76", "score": "0.46310416", "text": "func (s *Stack) SetID() {\n\ts.IDMu.Lock()\n\tdefer s.IDMu.Unlock()\n\n\tif s.Database != nil {\n\t\ts.ID = uuid.New(s.Database.Name + s.Name)\n\t\treturn\n\t}\n\n\ts.ID = uuid.New(s.Name)\n}", "title": "" }, { "docid": "f6e7cdc3837af35520ed53bfb5f7c409", "score": "0.4629433", "text": "func BackupBlobID(l UpgradeLockIntent) blob.ID {\n\treturn blob.ID(BackupBlobIDPrefix + l.OwnerID)\n}", "title": "" }, { "docid": "9cb63d2bf1d50fe31ce907ce0556e95c", "score": "0.46149433", "text": "func (o *BRConnection) SetIdentifier(ID string) {\n\n\to.ID = ID\n}", "title": "" }, { "docid": "000080f8c13161bc45e50686e6d24429", "score": "0.46049044", "text": "func (m *ImportedWindowsAutopilotDeviceIdentity) SetHardwareIdentifier(value []byte)() {\n m.hardwareIdentifier = value\n}", "title": "" }, { "docid": "4845b2ad2e4c79a91911de0f356890cc", "score": "0.45963225", "text": "func (m *EducationSynchronizationError) SetReportableIdentifier(value *string)() {\n err := m.GetBackingStore().Set(\"reportableIdentifier\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "8007b25a31cf3254e084d7a9b7016748", "score": "0.45647407", "text": "func (o *SparseAWSAPIGateway) SetIdentifier(id string) {\n\n\tif id != \"\" {\n\t\to.ID = &id\n\t} else {\n\t\to.ID = nil\n\t}\n}", "title": "" }, { "docid": "ead2d4eca478d5f3161eaff5e3c83d11", "score": "0.4550157", "text": "func (o *PingRequest) SetIdentifier(id string) {\n\n}", "title": "" }, { "docid": "6f46e73c47e6eceae4a235cad529e1f3", "score": "0.4515018", "text": "func (e *LinodeInstanceBuilder) SetBackupID(backupID int) *LinodeInstanceBuilder {\n\te.BackupID = backupID\n\treturn e\n}", "title": "" }, { "docid": "9a4a5ff725bd5e81decc2230fb908b98", "score": "0.45093322", "text": "func (m *ConfigManagerCollection) SetHierarchyIdentifier(value *string)() {\n err := m.GetBackingStore().Set(\"hierarchyIdentifier\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "cf2976da2b2fc41d32eaf7436e3294ba", "score": "0.45086616", "text": "func (m *WindowsKioskDesktopApp) SetDesktopApplicationId(value *string)() {\n err := m.GetBackingStore().Set(\"desktopApplicationId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "0be6a5c59748fb155a2ca7737e609852", "score": "0.44958782", "text": "func (o *AWSAPIGateway) SetIdentifier(id string) {\n\n\to.ID = id\n}", "title": "" }, { "docid": "e9af765ba126be3fb482a5f209166130", "score": "0.44845265", "text": "func (o *OIDCProvider) SetIdentifier(id string) {\n\n\to.ID = id\n}", "title": "" }, { "docid": "07ba41220d40d6daa461ede7e440c344", "score": "0.44778094", "text": "func (o *ZoneTemplate) SetIdentifier(ID string) {\n\n\to.ID = ID\n}", "title": "" }, { "docid": "b6823b1c1b2a9273f974660f28e8a0b6", "score": "0.44769356", "text": "func (o *DSCPRemarkingPolicyTable) SetIdentifier(ID string) {\n\n\to.ID = ID\n}", "title": "" }, { "docid": "f9c6e1efde131aa7751b7f34bf840f5d", "score": "0.44714332", "text": "func (m *ItemRemovePasswordPostRequestBody) SetKeyId(value *i561e97a8befe7661a44c8f54600992b4207a3a0cf6770e5559949bc276de2e22.UUID)() {\n err := m.GetBackingStore().Set(\"keyId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "dd818dcee670be00841167423a96bd96", "score": "0.44559148", "text": "func (options *UpdateWafRuleOptions) SetIdentifier(identifier string) *UpdateWafRuleOptions {\n\toptions.Identifier = core.StringPtr(identifier)\n\treturn options\n}", "title": "" }, { "docid": "93d13902ecb13e23be640b88b4fb3c4b", "score": "0.44558507", "text": "func (m *TenantDetailedInformation) SetCountryCode(value *string)() {\n err := m.GetBackingStore().Set(\"countryCode\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "040affc77110496103f3e6dcd888d100", "score": "0.44502214", "text": "func (m *PurchaseInvoiceLine) SetDocumentId(value *i561e97a8befe7661a44c8f54600992b4207a3a0cf6770e5559949bc276de2e22.UUID)() {\n err := m.GetBackingStore().Set(\"documentId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "d6c6f3a2f3dfaf6b2fd9d4a3aae446c4", "score": "0.44318554", "text": "func (o DdrInstanceOutput) BackupSetId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *DdrInstance) pulumi.StringPtrOutput { return v.BackupSetId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "e42a5f1e594b97f6b25d64e3be609982", "score": "0.4430419", "text": "func (o *SparsePingRequest) SetIdentifier(id string) {\n\n}", "title": "" }, { "docid": "3de1f89e96093e047fb738e7a3f660fa", "score": "0.4426545", "text": "func (options *GetWafRuleOptions) SetIdentifier(identifier string) *GetWafRuleOptions {\n\toptions.Identifier = core.StringPtr(identifier)\n\treturn options\n}", "title": "" }, { "docid": "26b4fad050702aa4f761269d46e17c86", "score": "0.43967098", "text": "func (o *PUTrafficAction) SetIdentifier(id string) {\n\n}", "title": "" }, { "docid": "4d88503a341781421779c2e3d86ed9e2", "score": "0.4379959", "text": "func (m *CopyNotebookModel) SetId(value *string)() {\n m.id = value\n}", "title": "" }, { "docid": "e06542028bafac88c880af995e2935ea", "score": "0.43793827", "text": "func PackIdentCode(serialValue, randomKey int32) (identCode int64) {\n\tidentCode = int64(uint64(serialValue) | (uint64(randomKey) << 32))\n\treturn\n}", "title": "" }, { "docid": "2eeb194941c20013238fef967af67aab", "score": "0.43788046", "text": "func (m *CloudPcSubscription) SetSubscriptionId(value *string)() {\n err := m.GetBackingStore().Set(\"subscriptionId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "8f6802cfd16bd69e894b78b29f17ef9c", "score": "0.4370184", "text": "func (m *AttachmentItem) SetContentId(value *string)() {\n err := m.GetBackingStore().Set(\"contentId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "2e45edb5375c6f63cfd0b8dda6a84990", "score": "0.4358937", "text": "func (o *SparseOIDCProvider) SetIdentifier(id string) {\n\n\tif id != \"\" {\n\t\to.ID = &id\n\t} else {\n\t\to.ID = nil\n\t}\n}", "title": "" }, { "docid": "0b079aab952f761430ff13d5f08abd9a", "score": "0.4341706", "text": "func (m *MacOSLobChildApp) SetVersionNumber(value *string)() {\n err := m.GetBackingStore().Set(\"versionNumber\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "69df72de2673b14f9186b3e0cea8402e", "score": "0.4318545", "text": "func (m *ConfigManagerCollection) SetCollectionIdentifier(value *string)() {\n err := m.GetBackingStore().Set(\"collectionIdentifier\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "4ae25e27ba5c05187c6be7b475105900", "score": "0.43076193", "text": "func (o BackupOutput) BackupId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Backup) pulumi.StringOutput { return v.BackupId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "f945f9137c91dd0ce676a618850499ab", "score": "0.42956877", "text": "func (o *CreateVolumeBackupDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "57920cf59a697423e29f1f1b8ae980b6", "score": "0.4292423", "text": "func (o *SparsePUTrafficAction) SetIdentifier(id string) {\n\n}", "title": "" }, { "docid": "68b1559c9bf1521763007ae50b8e4330", "score": "0.42821854", "text": "func (agi *AGI) SetCallerid(clid string) (Response, error) {\n\tcmd := fmt.Sprintf(\"SET CALLERID %q\\n\", clid)\n\treturn agi.execute(cmd)\n}", "title": "" }, { "docid": "36ba95b8875557696f8f3e60faf19d36", "score": "0.42701286", "text": "func (r *storeCommand) setID(id string) {\n\tr.storage.SetBucket(id)\n\tr.id = id\n}", "title": "" }, { "docid": "62e9881a691c7f47924f7787dd459654", "score": "0.42653838", "text": "func (o *GetAccountsAccountIDBackupsDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "88fc4b1c2eb501f4de9abddf3fb682f1", "score": "0.4265137", "text": "func (k Keeper) setAgreementID(ctx sdk.Context, agreementID uint64) {\r\n\tstore := k.store(ctx)\r\n\tbz := k.codec.MustMarshalBinaryLengthPrefixed(agreementID)\r\n\tstore.Set(AgreementIDKey, bz)\r\n}", "title": "" }, { "docid": "aeaa928bea12593d5a498dca89cce817", "score": "0.42649996", "text": "func (m *ManagedAppProtection) SetDataBackupBlocked(value *bool)() {\n m.dataBackupBlocked = value\n}", "title": "" }, { "docid": "a8852d71af9f42bff3696abf6750dd0f", "score": "0.42597634", "text": "func SetPartitionID(ctx context.Context, value string) context.Context {\n\treturn middleware.WithStackValue(ctx, partitionIDKey{}, value)\n}", "title": "" }, { "docid": "3d5c2a6f5d27aec27fd2445a91ba3f45", "score": "0.42449832", "text": "func (m *DeviceHealthScriptPolicyState) SetPolicyId(value *string)() {\n err := m.GetBackingStore().Set(\"policyId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "2ac8ccad098052897c3b866f0bafb275", "score": "0.42445892", "text": "func SetIDJob(idJob string) {\n\tre := regexp.MustCompile(\"^[a-f0-9]{24}$\")\n\terrIDJob := re.MatchString(idJob)\n\tif !errIDJob {\n\t\tlog.Fatal(\"Invalid id_job\")\n\t}\n\n\tIDJob = idJob\n}", "title": "" }, { "docid": "7ea92911422c07cac341daf6212b5637", "score": "0.4239841", "text": "func (m *PurchaseInvoiceLine) SetTaxCode(value *string)() {\n err := m.GetBackingStore().Set(\"taxCode\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "76ac843442d1317363323f9ac2073aa1", "score": "0.42227766", "text": "func (m *Alert) SetIncidentId(value *string)() {\n err := m.GetBackingStore().Set(\"incidentId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "e3215e32989a677a98bfeea257e71218", "score": "0.42068592", "text": "func (o *Enterprise) SetIdentifier(ID string) {\n\n\to.ID = ID\n}", "title": "" }, { "docid": "6943850690b7750f0befc8b187cf426e", "score": "0.41913962", "text": "func (m *ManagedDevice) SetIccid(value *string)() {\n err := m.GetBackingStore().Set(\"iccid\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "9ac010a6f2af0af65d4627f6a8d3a82b", "score": "0.41857815", "text": "func (s *Func) SetIdentifier(name string) *Func {\n\ts.FunName = name\n\treturn s\n}", "title": "" }, { "docid": "a3aebcf17525cc5f2fb56c110a139ff8", "score": "0.41841263", "text": "func SetAppID(id, version, icon string) error {\n\tif err := inst.assertInit(); err != nil {\n\t\treturn err\n\t}\n\n\tcID, cVersion, cIcon := C.CString(id), C.CString(version), C.CString(icon)\n\tC.dynamic_libvlc_set_app_id(inst.handle, cID, cVersion, cIcon)\n\n\tC.free(unsafe.Pointer(cID))\n\tC.free(unsafe.Pointer(cVersion))\n\tC.free(unsafe.Pointer(cIcon))\n\treturn nil\n}", "title": "" }, { "docid": "9c0d542f5aad6acbf00e8e682267d10d", "score": "0.41811886", "text": "func (d *deployerImpl) setCurrentInstanceID(ctx context.Context, packageDir, instanceID string) error {\n\tif err := common.ValidateInstanceID(instanceID, common.AnyHash); err != nil {\n\t\treturn err\n\t}\n\tvar err error\n\tif runtime.GOOS == \"windows\" {\n\t\terr = fs.EnsureFile(\n\t\t\tctx, d.fs, filepath.Join(packageDir, currentTxt),\n\t\t\tstrings.NewReader(instanceID))\n\t} else {\n\t\terr = d.fs.EnsureSymlink(ctx, filepath.Join(packageDir, currentSymlink), instanceID)\n\t}\n\tif err != nil {\n\t\treturn errors.Annotate(err, \"writing the current instance ID\").Tag(cipderr.IO).Err()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4894a4728b9b8c1f578f36f0253bbd36", "score": "0.41800267", "text": "func (m *PurchaseInvoiceLine) SetAccountId(value *i561e97a8befe7661a44c8f54600992b4207a3a0cf6770e5559949bc276de2e22.UUID)() {\n err := m.GetBackingStore().Set(\"accountId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "9a365a87b66b0b18b834a687dca8b194", "score": "0.41787648", "text": "func (c *Contract) set_code_hash(addr *common.Address, codeAndHash *codeAndHash) {\n\tc.Code = codeAndHash.code\n\tc.CodeHash = codeAndHash.hash\n\tc.CodeAddr = addr\n}", "title": "" }, { "docid": "7d0e9b3cfb736d12af524b21484fca5a", "score": "0.41724074", "text": "func (fr *Frame) SetCode(code Code) {\n\t// TODO: Check non-reserved fields.\n\tcode &= 15\n\tfr.raw[0] &= 15 << 4\n\tfr.raw[0] |= uint8(code)\n}", "title": "" }, { "docid": "024f758f4986862cce0db2e57d33e033", "score": "0.4169091", "text": "func (o *SparseCloudScheduledNetworkQuery) SetIdentifier(id string) {\n\n\tif id != \"\" {\n\t\to.ID = &id\n\t} else {\n\t\to.ID = nil\n\t}\n}", "title": "" }, { "docid": "9bb5f99fa78ef618f0fbfb77191f8afa", "score": "0.416842", "text": "func (m *PurchaseInvoiceLine) SetItemId(value *i561e97a8befe7661a44c8f54600992b4207a3a0cf6770e5559949bc276de2e22.UUID)() {\n err := m.GetBackingStore().Set(\"itemId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "14537568b137357d03aba621b86204a0", "score": "0.41665617", "text": "func (m *AccessReviewStageSettings) SetStageId(value *string)() {\n m.stageId = value\n}", "title": "" }, { "docid": "c27a4b53182c1ebb2d3c6bdfa3ef9bee", "score": "0.41604155", "text": "func (o *ConfigurationBackupModifyDefault) Code() int {\n\treturn o._statusCode\n}", "title": "" }, { "docid": "00d7e2f67e1ed30e96dc36cfedc09767", "score": "0.41459468", "text": "func (r *CreateDNSRecordRequest) SetZone_identifier(zone_identifier string) {\n r.Zone_identifier = zone_identifier\n}", "title": "" }, { "docid": "5b6ab77afacf552777577599db6c5627", "score": "0.4130364", "text": "func (cnu *CardNetworkUpdate) SetCode(s string) *CardNetworkUpdate {\n\tcnu.mutation.SetCode(s)\n\treturn cnu\n}", "title": "" }, { "docid": "b3ae424be51cb438a7d5b267579c1e1b", "score": "0.4127245", "text": "func PutPayloadCode(name serviceinfo.PayloadCodec, v PayloadCodec) {\n\tpayloadCodecs[name] = v\n}", "title": "" }, { "docid": "628f3ecbb63c2880ee6a326a55dad37d", "score": "0.41265392", "text": "func (cnuo *CardNetworkUpdateOne) SetCode(s string) *CardNetworkUpdateOne {\n\tcnuo.mutation.SetCode(s)\n\treturn cnuo\n}", "title": "" }, { "docid": "d73c573c4140e62d5a02ebd2a0cf0fbf", "score": "0.41217455", "text": "func CodeChallenge(codeChallenge string) Option {\n\treturn func(authorization *Authorization) error {\n\t\tauthorization.codeChallenge = codeChallenge\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "10b7f8d7ba8133e9d69d75a4775eecf3", "score": "0.4121708", "text": "func (m *IdentityProvider) SetClientId(value *string)() {\n m.clientId = value\n}", "title": "" }, { "docid": "463b6bc85609658eb08c4a702201d900", "score": "0.41200343", "text": "func (o *BackupDatabaseParams) SetBackupID(backupID *string) {\n\to.BackupID = backupID\n}", "title": "" }, { "docid": "917bc15c38be22834953996550989ef5", "score": "0.41190672", "text": "func (m *AccessPackageResourceScope) SetOriginId(value *string)() {\n err := m.GetBackingStore().Set(\"originId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "cf6394c961dd06b6e2ada6869a640fa7", "score": "0.41188478", "text": "func (options *CreateObjectAccessOptions) SetObjectIdentifier(objectIdentifier string) *CreateObjectAccessOptions {\n\toptions.ObjectIdentifier = core.StringPtr(objectIdentifier)\n\treturn options\n}", "title": "" }, { "docid": "6f4326ac1499354a6a2e609c6bb8ea9a", "score": "0.41121614", "text": "func (m *MockOIDC) QueueCode(code string) {\n\tm.SessionStore.CodeQueue.Push(code)\n}", "title": "" } ]
a493b1e14f088680aa97320af7861c3a
isNum reports whether the byte is an ASCII number
[ { "docid": "5a6b366bf50b8eb4707b2ba65a614196", "score": "0.76777506", "text": "func isNum(c rune) bool {\n\treturn '0' <= c && c <= '9'\n}", "title": "" } ]
[ { "docid": "1ac601e71c1ac9c83ad6acf5cbecec6d", "score": "0.7545646", "text": "func isNumeric(b byte) bool {\n\treturn '0' <= b && b <= '9' ||\n\t\tb == ' '\n}", "title": "" }, { "docid": "1ac601e71c1ac9c83ad6acf5cbecec6d", "score": "0.7545646", "text": "func isNumeric(b byte) bool {\n\treturn '0' <= b && b <= '9' ||\n\t\tb == ' '\n}", "title": "" }, { "docid": "cbe5c1a0261e8a779628d9818e7a98e5", "score": "0.7508517", "text": "func IsNumeric(c byte) bool {\n\treturn c >= '0' && c <= '9'\n}", "title": "" }, { "docid": "cbe5c1a0261e8a779628d9818e7a98e5", "score": "0.7508517", "text": "func IsNumeric(c byte) bool {\n\treturn c >= '0' && c <= '9'\n}", "title": "" }, { "docid": "dde4cbbeebf9e02ab7c6a1a0d8bd76c0", "score": "0.7022159", "text": "func isDigit(ch byte) bool {\n\treturn '0' <= ch && ch <= '9'\n}", "title": "" }, { "docid": "5237c337107aa7c163816f2b356ccacc", "score": "0.69499815", "text": "func IsNum(typ uint8) bool {\n\treturn (typ <= binlog.TypeInt24 && typ != binlog.TypeTimestamp) ||\n\t\ttyp == binlog.TypeYear ||\n\t\ttyp == binlog.TypeNewDecimal\n}", "title": "" }, { "docid": "45e3c6dbc6010993b3e5fadd76c1836d", "score": "0.6932034", "text": "func isDigit(char byte) bool {\n\treturn '0' <= char && char <= '9'\n}", "title": "" }, { "docid": "01facc496cd1003faaeca93b1d5c607e", "score": "0.689231", "text": "func isNum(char string) bool {\n var num = [...]string {\"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\" };\n for i := 0; i < 10; i++ {\n\tif char == num[i] {\n\t return true;\n\t}\n }\n return false;\n}", "title": "" }, { "docid": "36c5b7ff528397b07f3477f2a4a3f6fc", "score": "0.68483067", "text": "func isDigit(ch rune) bool { return (ch >= '0' && ch <= '9') }", "title": "" }, { "docid": "36c5b7ff528397b07f3477f2a4a3f6fc", "score": "0.68483067", "text": "func isDigit(ch rune) bool { return (ch >= '0' && ch <= '9') }", "title": "" }, { "docid": "6c83c98361b7989c4306d068a7e05c33", "score": "0.67901707", "text": "func isDigit(ch byte) bool {\n\treturn (ch >= 47 && ch <= 57)\n}", "title": "" }, { "docid": "028a1cc0985deb06a3ddb5542377e01d", "score": "0.6736378", "text": "func IsNum(s string) bool {\n\treturn strings.Contains(\"0123456789-\", s[0:1])\n}", "title": "" }, { "docid": "b681128f0ba05d1d00b6d17a091db5ca", "score": "0.67271155", "text": "func isAlphaNum(b byte) bool {\n\treturn isAlpha(b) || (b >= '0' && b <= '9')\n}", "title": "" }, { "docid": "218a659f1fb96768110ca3c59f6216e5", "score": "0.66856205", "text": "func isNumber(char string) bool {\n\tif char == \"\" {\n\t\treturn false\n\t}\n\tnum := []rune(char)[0]\n\tif num >= '0' && num <= '9' {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "758225700058c6bc3ba3cf7fa3bbd875", "score": "0.668102", "text": "func CharIsNumber(input string) bool {\n\tfor _, b := range []byte(input) {\n\t\tif !(b >= 48 && b <= 57) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "a4fe493f65a2b9a90b1559f77d2f114d", "score": "0.6597239", "text": "func IsNumber(r rune) bool {\n\treturn is(number, r)\n}", "title": "" }, { "docid": "14b80a8a62fdf51c24b789bf36286b4e", "score": "0.65933526", "text": "func isNumeric(s string) bool {\n\tlength := len(s)\n\tif length == 0 {\n\t\treturn false\n\t}\n\tfor i := 0; i < len(s); i++ {\n\t\tif s[i] < byte('0') || s[i] > byte('9') {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "655c37b640e67d179f7aec82a1b7d1f2", "score": "0.655205", "text": "func checkNum(c string) bool {\n\tIsNumber := regexp.MustCompile(`^[0-9]+$`).MatchString\n\tif !IsNumber(c) && c != \"\" {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "b10a3f29f15fc5d1b7ecb2eda723d0d3", "score": "0.649584", "text": "func isASCIIDigit(c byte) bool {\n\treturn '0' <= c && c <= '9'\n}", "title": "" }, { "docid": "d99a6e9b5ab2947ac951477e06d04b31", "score": "0.64704585", "text": "func isDigit(ch rune) bool {\n\treturn unicode.IsDigit(ch)\n}", "title": "" }, { "docid": "cfbdd9f22e9caee0254bc374f2ad9ea6", "score": "0.64652824", "text": "func IsNum(typ uint8) bool {\n\treturn ((typ <= 9 /* MYSQL_TYPE_INT24 */ && typ != 7 /* MYSQL_TYPE_TIMESTAMP */) || typ == 13 /* MYSQL_TYPE_YEAR */ || typ == 246 /* MYSQL_TYPE_NEWDECIMAL */)\n}", "title": "" }, { "docid": "3a43d2a20d7adfcd73829264797103b2", "score": "0.6405072", "text": "func IsntLetterOrNumber(c rune) bool {\n\treturn !unicode.IsLetter(c) && !unicode.IsNumber(c)\n}", "title": "" }, { "docid": "32e09a1f267e42fde7165f9d2af11f33", "score": "0.63890123", "text": "func asciiAlphaNum(c byte) bool {\n\treturn asciiAlpha(c) || '0' <= c && c <= '9'\n}", "title": "" }, { "docid": "1aebe88b4293b65bd1fceea5005c4ea7", "score": "0.63664097", "text": "func (s *Scanner) isDigit(char string) bool {\n\treturn char >= \"0\" && char <= \"9\"\n}", "title": "" }, { "docid": "57f57e45259ebe509154956ee4b089e4", "score": "0.62977755", "text": "func isNonZeroDigit(ch byte) bool {\n\treturn (ch >= 48 && ch <= 57)\n}", "title": "" }, { "docid": "4a5c4d7e35488b49d45967a4ae9ada40", "score": "0.6268933", "text": "func isDigit(char rune) bool {\n\treturn (char >= '0' && char <= '9')\n}", "title": "" }, { "docid": "2f2e44ceabc630bcc8e05dfb92702eec", "score": "0.6249304", "text": "func (j JSON) IsNum() bool {\n\treturn reflect.TypeOf(j.nosj) == reflect.TypeOf(64.4)\n}", "title": "" }, { "docid": "22dd59af262c2aeadf1a1cc0c96c80e9", "score": "0.6241483", "text": "func isDigit(c rune) bool {\n\treturn unicode.IsDigit(c)\n}", "title": "" }, { "docid": "3b5af18879893d1e52222be084edfc40", "score": "0.6202976", "text": "func isDigit(r rune) bool {\n\treturn '0' <= r && r <= '9' || r >= 0x80 && unicode.IsDigit(r)\n}", "title": "" }, { "docid": "834478582711ac643cfb1e3f2c08ccac", "score": "0.61744565", "text": "func isDigit(c rune) bool {\n\n\treturn c >= '0' && c <= '9'\n}", "title": "" }, { "docid": "e70c9fcdda6762c5b7696bd02fd3ab0f", "score": "0.6160535", "text": "func isAlphaNum(c rune) bool {\n\treturn isAlpha(c) || isNum(c)\n}", "title": "" }, { "docid": "d412c1ab67fd9c3dfc67c6ecb9e07355", "score": "0.6149862", "text": "func StringIsNumeric(s string) (ok bool) {\n\tvar err int32\n\n\tfor _, b := range s {\n\t\terr |= (((b - 48) >> 8) | (57-b)>>8) & 1\n\t}\n\n\treturn err == 0\n}", "title": "" }, { "docid": "d5fc6fa0899f3711eaf9a422717ba1bd", "score": "0.61461985", "text": "func IsNumeric(x SimpleData) bool {\n\tswitch x.(type) {\n\tcase int: // numeric\n\tcase int8: // numeric\n\tcase int16: // numeric\n\tcase int32: // numeric\n\tcase int64: // numeric\n\tcase uint: // numeric\n\tcase uint8: // numeric\n\tcase uint16: // numeric\n\tcase uint32: // numeric\n\tcase uint64: // numeric\n\tcase uintptr: // numeric\n\tcase float32: // numeric\n\tcase float64: // numeric\n\tdefault:\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "b92dcc1578dd70d0ac1d9efebb6f069c", "score": "0.612927", "text": "func IsDigit(val byte) bool {\n\tif val >= '0' && val <= '9' {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "66104ed6822019a20e5e7730049d3003", "score": "0.6128828", "text": "func isNumericControlType(ctype string) bool {\n\treturn ctype != \"text\"\n}", "title": "" }, { "docid": "811202c8ab650d926fad9c6a7f3b38bf", "score": "0.6079141", "text": "func isalnum(b byte) bool {\n\tswitch {\n\tcase '0' <= b && b <= '9':\n\t\treturn true\n\tcase 'a' <= b && b <= 'z':\n\t\treturn true\n\tcase 'A' <= b && b <= 'Z':\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "8aa4b73cdf2e8c4d865c8f82ffb6a48f", "score": "0.6010592", "text": "func IsNumber(txt string) bool {\n\t_, err := strconv.Atoi(txt)\n\tif err != nil {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "8c1661fdd0cbff96dfd7e19ae4d2e53d", "score": "0.59761417", "text": "func IsNumeric(s string) bool {\n\tfor _, c := range s {\n\t\tif int(c) > int('9') || int(c) < int('0') {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "db2b3e935bff372f2b8e50dc0bb6ed7c", "score": "0.59712744", "text": "func isNumeric(num string) bool {\n\t_, err := strconv.ParseFloat(num ,64)\n\treturn err == nil\n}", "title": "" }, { "docid": "1fb6c5e768f959981dbb4cd5ea730e6d", "score": "0.5953674", "text": "func isDigit(s string) bool {\n\tr, _ := utf8.DecodeRuneInString(s)\n\treturn unicode.IsDigit(r)\n}", "title": "" }, { "docid": "3f7f2fa85717c2eafedc75f603282594", "score": "0.5934825", "text": "func (k Kind) IsNumber() bool {\n\treturn k != String\n}", "title": "" }, { "docid": "ab0c88d27fdd0a4be41ab0f7d8458c74", "score": "0.5933229", "text": "func ByteIsAsciiLetter(b byte) bool {\n\tisLetter, _ := regexp.MatchString(`[A-Za-z]{1}`, string(b));\n\treturn isLetter\n}", "title": "" }, { "docid": "83400df764a901283a97105ab9022c23", "score": "0.5931016", "text": "func isAlphaNumeric(c rune) bool {\n\n\treturn isAlpha(c) || isDigit(c)\n}", "title": "" }, { "docid": "a9cda7976af555dc46186d2c1ffe005e", "score": "0.59234995", "text": "func (*GuluRune) IsNumOrLetter(r rune) bool {\n\treturn ('0' <= r && '9' >= r) || Rune.IsLetter(r)\n}", "title": "" }, { "docid": "2ef95bd74ade9b7294ad839308453237", "score": "0.5897102", "text": "func isASCII(b []byte) bool {\n\tfor _, c := range b {\n\t\tif c > unicode.MaxASCII {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "9b671bff5d3dfaced5f85976b8e6cddd", "score": "0.5879755", "text": "func isAlphaNum(bites []byte) bool {\n\tresult := re.Match(bites)\n\tlog.Debug(\"Alphanumeric match: \", result)\n\treturn result\n}", "title": "" }, { "docid": "bef7c704b19ce0709702190e6cf6a41f", "score": "0.58607113", "text": "func isNumeric(s string) bool {\n _, err := strconv.ParseFloat(s, 64)\n return err == nil\n}", "title": "" }, { "docid": "4f40854b50b86d923dc6630595f0d554", "score": "0.58465534", "text": "func isData(r rune) bool {\n\treturn r == '0' || r == '1'\n}", "title": "" }, { "docid": "4d4a165e4f7586068a47b5006787eac6", "score": "0.5824784", "text": "func isAlphaNumeric(r rune) bool {\n\treturn !(unicode.IsSpace(r) || isOperator(r) || r == ';')\n}", "title": "" }, { "docid": "3fcfff5f46daef98c9d44a110aa3ccc4", "score": "0.58237743", "text": "func IsAlNum(r rune) bool {\n\treturn IsAlpha(r) || IsDigit(r)\n}", "title": "" }, { "docid": "3fcfff5f46daef98c9d44a110aa3ccc4", "score": "0.58237743", "text": "func IsAlNum(r rune) bool {\n\treturn IsAlpha(r) || IsDigit(r)\n}", "title": "" }, { "docid": "3fcfff5f46daef98c9d44a110aa3ccc4", "score": "0.58237743", "text": "func IsAlNum(r rune) bool {\n\treturn IsAlpha(r) || IsDigit(r)\n}", "title": "" }, { "docid": "3fcfff5f46daef98c9d44a110aa3ccc4", "score": "0.58237743", "text": "func IsAlNum(r rune) bool {\n\treturn IsAlpha(r) || IsDigit(r)\n}", "title": "" }, { "docid": "b4e8b31cb803cded0648e5ab3c4aac70", "score": "0.58204186", "text": "func IsNumeric(s string) bool {\n _, err := strconv.ParseFloat(s, 64)\n return err == nil\n}", "title": "" }, { "docid": "6fcee7cc04add863bfc7ba7d471f186f", "score": "0.58052534", "text": "func magicNumCheck(number []byte) bool {\n valid := false\n valid = ((number[0] | number[1]) == 0)\n return valid\n}", "title": "" }, { "docid": "0be7e1ddd576503a3955aad2b853c6cc", "score": "0.58007216", "text": "func isNumber(s string) bool {\n\treturn s == \"1\" || s == \"2\" || s == \"3\" || s == \"4\" || s == \"5\" || s == \"6\" || s == \"7\" || s == \"8\"\n}", "title": "" }, { "docid": "4752c6ed44dac532a0224e5d591f3b1e", "score": "0.5798876", "text": "func isAlphaNumeric(r rune) bool {\n\treturn unicode.IsLetter(r) || unicode.IsDigit(r)\n}", "title": "" }, { "docid": "b15a378321696ab83508887f04fbfcf4", "score": "0.5791435", "text": "func IsASCII(s rune) bool {\n\treturn s < unicode.MaxASCII\n}", "title": "" }, { "docid": "158f9a1472e8756596982c00682d72fb", "score": "0.57853734", "text": "func IsNumber(input int) bool {\n\tasStr := strconv.Itoa(input)\n\tacc, length := 0, float64(len(asStr))\n\tfor _, v := range asStr {\n\t\tacc += int(math.Pow(float64(v - 48), length))\n\t}\n\treturn acc == input\n}", "title": "" }, { "docid": "8e7ceb226c624ddba005b142803935bd", "score": "0.5785308", "text": "func isAlphaNumeric(r rune) bool {\n\treturn r == '_' || unicode.IsNumber(r) || unicode.IsLetter(r)\n}", "title": "" }, { "docid": "528dfbae0489a89d0e26fc57da02e46c", "score": "0.57634103", "text": "func IsValidNumberBytes(s []byte) bool {\n\t// This function implements the JSON numbers grammar.\n\t// See https://tools.ietf.org/html/rfc7159#section-6\n\t// and https://www.json.org/img/number.png\n\n\tif len(s) == 0 {\n\t\treturn false\n\t}\n\n\t// Optional -\n\tif s[0] == '-' {\n\t\ts = s[1:]\n\t\tif len(s) == 0 {\n\t\t\treturn false\n\t\t}\n\t}\n\n\t// Digits\n\tswitch {\n\tdefault:\n\t\treturn false\n\n\tcase s[0] == '0':\n\t\ts = s[1:]\n\n\tcase '1' <= s[0] && s[0] <= '9':\n\t\ts = s[1:]\n\t\tfor len(s) > 0 && '0' <= s[0] && s[0] <= '9' {\n\t\t\ts = s[1:]\n\t\t}\n\t}\n\n\t// . followed by 1 or more digits.\n\tif len(s) >= 2 && s[0] == '.' && '0' <= s[1] && s[1] <= '9' {\n\t\ts = s[2:]\n\t\tfor len(s) > 0 && '0' <= s[0] && s[0] <= '9' {\n\t\t\ts = s[1:]\n\t\t}\n\t}\n\n\t// e or E followed by an optional - or + and\n\t// 1 or more digits.\n\tif len(s) >= 2 && (s[0] == 'e' || s[0] == 'E') {\n\t\ts = s[1:]\n\t\tif s[0] == '+' || s[0] == '-' {\n\t\t\ts = s[1:]\n\t\t\tif len(s) == 0 {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\tfor len(s) > 0 && '0' <= s[0] && s[0] <= '9' {\n\t\t\ts = s[1:]\n\t\t}\n\t}\n\n\t// Make sure we are at the end.\n\treturn len(s) == 0\n}", "title": "" }, { "docid": "e8609e71cc2b586ce2048f2837016ee8", "score": "0.575832", "text": "func isPrint(b byte) bool {\n\t// For the standard ASCII character set (used by the \"C\" locale), printing\n\t// characters are all with an ASCII code greater than 0x1f (US), except 0x7f\n\t// (DEL).\n\treturn ' ' <= b && b <= '~'\n}", "title": "" }, { "docid": "ecdb6e8acca87c9e5608b64348eb1560", "score": "0.57452124", "text": "func IntFromASCII(bts []byte) (ret int, ok bool) {\n\t// ASCII numbers all start with the high-order bits 0011.\n\t// If you see that, and the next bits are 0-9 (0000 - 1001) you can grab those\n\t// bits and interpret them directly as an integer.\n\tvar n int\n\tif n = len(bts); n < 1 {\n\t\treturn 0, false\n\t}\n\tfor i := 0; i < n; i++ {\n\t\tif bts[i]&0xf0 != 0x30 {\n\t\t\treturn 0, false\n\t\t}\n\t\tret += int(bts[i]&0xf) * pow(10, n-i-1)\n\t}\n\treturn ret, true\n}", "title": "" }, { "docid": "36a2b8c9085a1d28d9fbf18cca30053a", "score": "0.5744839", "text": "func (s *Scanner) isAlphaNumeric(char string) bool {\n\treturn s.isAlpha(char) || s.isDigit(char)\n}", "title": "" }, { "docid": "084e62817a8c35067c5bb36e0d7ec558", "score": "0.5744443", "text": "func IsNumeric(number string) bool {\n\t_, err := strconv.Atoi(number)\n\treturn err == nil\n}", "title": "" }, { "docid": "7c25a4c6cd950d13a09b1f41df5afe9c", "score": "0.5738416", "text": "func UnicharIsdigit(c rune) bool {\n\tc_c := (C.gunichar)(c)\n\n\tretC := C.g_unichar_isdigit(c_c)\n\tretGo := retC == C.TRUE\n\n\treturn retGo\n}", "title": "" }, { "docid": "40cff01da97b5f3a0bc365f7f2290294", "score": "0.57223547", "text": "func IsNumeric(input string) bool {\n\tif len(input) == 0 {\n\t\treturn false\n\t}\n\tfor i := range input {\n\t\tif input[i] < '0' || input[i] > '9' {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "1be7805384e380b1c11adaca4e704463", "score": "0.57031226", "text": "func IsNumberUnsafe(r rune) bool {\n\treturn isUnsafe(number, r)\n}", "title": "" }, { "docid": "306bdae236eb645f62076f1555219d11", "score": "0.5698952", "text": "func isNumericString(s string) bool {\n\n\tif strings.Count(strings.ToUpper(s), \"E\") > 1 {\n\t\treturn false\n\t}\n\n\tfor _, element := range strings.Split(strings.ToUpper(s), \"E\") {\n\t\tif !isNumber(element) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "c814dce0514375efdd00ee2b60ab03b0", "score": "0.56753147", "text": "func isInt(s string) bool {\n\tfor _, c := range s {\n\t\tif !unicode.IsDigit(c) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "c814dce0514375efdd00ee2b60ab03b0", "score": "0.56753147", "text": "func isInt(s string) bool {\n\tfor _, c := range s {\n\t\tif !unicode.IsDigit(c) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "d7e5e9f7f247472f969454900ec8106c", "score": "0.5660146", "text": "func IsASCIIDigit(str string) bool {\n\tif len(str) == 0 {\n\t\treturn false\n\t}\n\tfor _, x := range str {\n\t\tif !('0' <= x && x <= '9') {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "b236d853be500bb97f87a9d47d062b88", "score": "0.56578696", "text": "func IsNumeric(s string) bool {\n\tfor _, r := range s {\n\t\tif !IsDecimal(r) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "44782d3d47663867ba35c31959337aa5", "score": "0.56526697", "text": "func (s *sc) num() (sym Symbol) {\n\tassert.For(unicode.IsDigit(s.ch), 20, \"digit expected\")\n\tvar buf []rune\n\tvar mbuf []rune\n\thasDot := false\n\n\tfor {\n\t\tbuf = append(buf, s.ch)\n\t\ts.next()\n\t\tif s.ch == '.' {\n\t\t\tif !hasDot {\n\t\t\t\thasDot = true\n\t\t\t} else if hasDot {\n\t\t\t\ts.mark(\"dot unexpected\")\n\t\t\t}\n\t\t}\n\t\tif s.err != nil || !(s.ch == '.' || strings.ContainsRune(hex, s.ch)) {\n\t\t\tbreak\n\t\t}\n\t}\n\tif strings.ContainsRune(modifier, s.ch) {\n\t\tmbuf = append(mbuf, s.ch)\n\t\ts.next()\n\t}\n\tif strings.ContainsAny(string(buf), hhex) && len(mbuf) == 0 {\n\t\ts.mark(\"modifier expected\")\n\t}\n\tif s.err == nil {\n\t\tsym.Code = Number\n\t\tsym.Value = string(buf)\n\t\tsym.NumberOpts.Modifier = string(mbuf)\n\t\tsym.NumberOpts.Period = hasDot\n\t} else {\n\t\ts.mark(\"error reading number\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "ccab171b8856da7757ed3964a4dc4c56", "score": "0.5646555", "text": "func IsASCIIDigit(r rune) bool {\n\treturn IsASCII(r) && unicode.IsDigit(r)\n}", "title": "" }, { "docid": "52d0119e018dd8e6a6969d5b15eec449", "score": "0.56337285", "text": "func isPrintable(char byte) bool {\n\tif char < 0x21 || char > 0x7E {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "8a680d4ad592c52c99d7f14be767180b", "score": "0.56264305", "text": "func isAlnum(c rune) bool {\n\treturn c == '_' || unicode.IsLetter(c) || unicode.IsDigit(c) \n}", "title": "" }, { "docid": "689b8cb5bc24e2837c50478dc3938c35", "score": "0.562062", "text": "func isDigit(s string, i int) bool {\n\tif len(s) <= i {\n\t\treturn false\n\t}\n\tc := s[i]\n\treturn '0' <= c && c <= '9'\n}", "title": "" }, { "docid": "0c9de38ec04365c6c954f5eafae51cfa", "score": "0.5619435", "text": "func isAlphaNumeric(r rune) bool {\n\treturn r == '_' || unicode.IsLetter(r) || unicode.IsDigit(r)\n}", "title": "" }, { "docid": "0c9de38ec04365c6c954f5eafae51cfa", "score": "0.5619435", "text": "func isAlphaNumeric(r rune) bool {\n\treturn r == '_' || unicode.IsLetter(r) || unicode.IsDigit(r)\n}", "title": "" }, { "docid": "0c9de38ec04365c6c954f5eafae51cfa", "score": "0.5619435", "text": "func isAlphaNumeric(r rune) bool {\n\treturn r == '_' || unicode.IsLetter(r) || unicode.IsDigit(r)\n}", "title": "" }, { "docid": "0c9de38ec04365c6c954f5eafae51cfa", "score": "0.5619435", "text": "func isAlphaNumeric(r rune) bool {\n\treturn r == '_' || unicode.IsLetter(r) || unicode.IsDigit(r)\n}", "title": "" }, { "docid": "0c9de38ec04365c6c954f5eafae51cfa", "score": "0.5619435", "text": "func isAlphaNumeric(r rune) bool {\n\treturn r == '_' || unicode.IsLetter(r) || unicode.IsDigit(r)\n}", "title": "" }, { "docid": "5c00b6cab4c937b6cd7c4901ea922d14", "score": "0.5611582", "text": "func IsDigit(r rune) bool {\n\treturn unicode.IsDigit(r)\n}", "title": "" }, { "docid": "5c00b6cab4c937b6cd7c4901ea922d14", "score": "0.5611582", "text": "func IsDigit(r rune) bool {\n\treturn unicode.IsDigit(r)\n}", "title": "" }, { "docid": "5c00b6cab4c937b6cd7c4901ea922d14", "score": "0.5611582", "text": "func IsDigit(r rune) bool {\n\treturn unicode.IsDigit(r)\n}", "title": "" }, { "docid": "5c00b6cab4c937b6cd7c4901ea922d14", "score": "0.5611582", "text": "func IsDigit(r rune) bool {\n\treturn unicode.IsDigit(r)\n}", "title": "" }, { "docid": "ad639593e2c7409f30e4520a0e32a6c6", "score": "0.5601299", "text": "func isHex(c byte) bool {\n\treturn '0' <= c && c <= '9' || 'a' <= c && c <= 'f' || 'A' <= c && c <= 'F'\n}", "title": "" }, { "docid": "fc19b3fe4eb115011051d9a0e346150a", "score": "0.55830705", "text": "func IsNumeric(s string) bool {\n\t_, err := strconv.ParseFloat(s, 64)\n\treturn err == nil\n}", "title": "" }, { "docid": "16d089f71ee1047530d661a35aeb674c", "score": "0.5562243", "text": "func IsAlphaNum(ch rune) bool {\n\treturn unicode.IsDigit(ch) || unicode.IsLetter(ch) || ch == '.'\n}", "title": "" }, { "docid": "9b2fd5952a9acdf6801536a106965d50", "score": "0.5552998", "text": "func GetNum() (r rune) {\n\tif !IsDigit(Look) {\n\t\tExpected(\"Integer\")\n\t}\n\tr = Look\n\tGetChar()\n\treturn\n}", "title": "" }, { "docid": "fb23585d2028b42a85faf39dea3a1097", "score": "0.5549721", "text": "func isASCII(s string) bool {\n\tfor _, c := range s {\n\t\tif c > unicode.MaxASCII {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "fb23585d2028b42a85faf39dea3a1097", "score": "0.5549721", "text": "func isASCII(s string) bool {\n\tfor _, c := range s {\n\t\tif c > unicode.MaxASCII {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "f9ea1cdc97c0de72f727260ba867943f", "score": "0.554204", "text": "func isASCII(str string) bool {\n\tfor _, r := range str {\n\t\tif r > unicode.MaxASCII {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "e03ed615c58cebcb5778e5fc8e035c28", "score": "0.5537028", "text": "func isnumberstring(a string) bool {\n\tif _, err := strconv.Atoi(a); err == nil {\n\t\treturn true\n\t}\n\tif _, err := strconv.ParseFloat(a, 64); err == nil {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "2ab0d7d4daea389607e6926b8cfa1a58", "score": "0.5535847", "text": "func getCharNum(r rune) int32 {\n\tif r < 97 || r > 122 {\n\t\treturn -1\n\t}\n\treturn r - 'a'\n}", "title": "" }, { "docid": "c167126396779aa58c92158b057ba4ea", "score": "0.5526513", "text": "func IsNumber(a int) (ok bool) {\n\t// fmt.Println(a)\n\tn := strconv.Itoa(a)\n\tpower := len(n)\n\tsum := 0\n\tfor _, c := range n {\n\t\tx, good := strconv.Atoi(string(c))\n\t\tif good != nil {\n\t\t\tok = false\n\t\t\treturn\n\t\t}\n\t\tsum += int(math.Pow(float64(x), float64(power)))\n\t}\n\tif a == sum {\n\t\tok = true\n\t}\n\treturn\n}", "title": "" }, { "docid": "58216a1a5f4296df5658dbc0a60acc05", "score": "0.5521898", "text": "func isNumberRune(r rune) (int, bool) {\n\tnumber := 0 // interger representation of rune\n\tflag := false // Flag rune is digit or not (true = digit)\n\tvar err error // error\n\n\tif string(r) >= \"0\" && string(r) <= \"9\" {\n\t\tif number, err = strconv.Atoi(string(r)); err != nil {\n\t\t\tlog.Println(ErrUnableToConvertRuneToNumber, r)\n\t\t\tflag = false\n\t\t\treturn number, flag\n\t\t}\n\t\tif number == 0 {\n\t\t\tflag = false\n\t\t\tlog.Println(ErrZeroNumberDetected)\n\t\t\treturn number, flag\n\t\t}\n\t\tflag = true\n\t}\n\treturn number, flag\n}", "title": "" }, { "docid": "f9ffbe35f5b428876b0fdaf110f5ebf8", "score": "0.55161077", "text": "func IsASCII(s string) bool {\n\tfor _, c := range s {\n\t\tif c < 32 || c > 126 {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "24766419890e24a2a698ffe99fa7fc80", "score": "0.5507784", "text": "func IsASCII(s string) bool {\n\tn := len(s)\n\tfor i := 0; i < n; i++ {\n\t\tif s[i] > 127 {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" } ]
0a8f5e871796758d03eac54ca51ae189
Modificar tamano de particion el tamano viene en bytes
[ { "docid": "b33509705b918ac8627a5378c0b8739d", "score": "0.5028619", "text": "func modificarParticion(path string, nombre string, tam int64, tipo string) {\n\ts := leerDisco(path)\n\tnombre = strings.ReplaceAll(strings.ToLower(nombre), \"\\\"\", \"\")\n\tvar nombreComparar [16]byte\n\tcopy(nombreComparar[:], nombre)\n\tmodificado := 0\n\n\tif s != nil {\n\t\tfinAnterior := s.Tamano - 1\n\t\tfor i := len(s.Tabla) - 1; i >= 0; i-- {\n\t\t\tif modificado == 0 {\n\t\t\t\t//recorriendo las particiones\n\t\t\t\tif s.Tabla[i].Size == 0 {\n\t\t\t\t\t//particion vacia\n\t\t\t\t\t//fin anterior se queda como esta\n\n\t\t\t\t} else {\n\t\t\t\t\tif nombreComparar == s.Tabla[i].Name {\n\t\t\t\t\t\t//encontro la particion en la primera tabla\n\t\t\t\t\t\tif strings.Compare(tipo, \"quitar\") == 0 {\n\t\t\t\t\t\t\tif s.Tabla[i].Type != 'e' {\n\t\t\t\t\t\t\t\tres := s.Tabla[i].Size - tam\n\t\t\t\t\t\t\t\tif res > 0 {\n\t\t\t\t\t\t\t\t\ts.Tabla[i].Size = res\n\t\t\t\t\t\t\t\t\ti = -10\n\t\t\t\t\t\t\t\t\tmodificado = 1\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\ti = -10\n\t\t\t\t\t\t\t\t\tfmt.Println(\"RESULTADO: No se puede reducir el espacio en la particion\")\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t//verificar si hay espacio en la extendida con base a las logicas\n\t\t\t\t\t\t\t\tespacioD := obtenerUtilizacionEBR(path, s.Tabla[i].Start, s.Tabla[i].Size)\n\t\t\t\t\t\t\t\tif espacioD >= tam {\n\t\t\t\t\t\t\t\t\ts.Tabla[i].Size = s.Tabla[i].Size - tam\n\t\t\t\t\t\t\t\t\ti = -10\n\t\t\t\t\t\t\t\t\tmodificado = 1\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\ti = -10\n\t\t\t\t\t\t\t\t\tfmt.Println(\"RESULTADO: No se puede reducir el espacio en la particion extendida\")\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 if strings.Compare(tipo, \"agregar\") == 0 {\n\t\t\t\t\t\t\tres := finAnterior - s.Tabla[i].Start + s.Tabla[i].Size\n\t\t\t\t\t\t\tif res >= tam {\n\t\t\t\t\t\t\t\ts.Tabla[i].Size = res\n\t\t\t\t\t\t\t\tmodificado = 1\n\t\t\t\t\t\t\t\ti = -10\n\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tfmt.Println(\"RESULTADO: No se puede ampliar el tama;o de la particion\")\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if s.Tabla[i].Type == 'e' {\n\t\t\t\t\t\t//puede que la particion a modificar sea una logica****\n\t\t\t\t\t\tebrTemp := ebr{}\n\t\t\t\t\t\tfile, err := os.Open(strings.ReplaceAll(path, \"\\\"\", \"\"))\n\t\t\t\t\t\tdefer file.Close()\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tlog.Fatal(err)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfile.Seek(s.Tabla[i].Start, 0)\n\t\t\t\t\t\tdata := readNextBytes(file, unsafe.Sizeof(ebr{}))\n\t\t\t\t\t\tbuffer := bytes.NewBuffer(data)\n\t\t\t\t\t\terr = binary.Read(buffer, binary.BigEndian, &ebrTemp)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tlog.Fatal(\"binary.Read failed\", err)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlimite := s.Tabla[i].Start + int64(unsafe.Sizeof(ebr{})) + s.Tabla[i].Size\n\t\t\t\t\t\tif &ebrTemp != nil {\n\t\t\t\t\t\t\tfor j := ebrTemp.Start; j < limite; j++ {\n\t\t\t\t\t\t\t\tebrLeido := ebr{}\n\n\t\t\t\t\t\t\t\tfile.Seek(j, 0)\n\t\t\t\t\t\t\t\tdata := readNextBytes(file, unsafe.Sizeof(ebr{}))\n\t\t\t\t\t\t\t\tbuffer := bytes.NewBuffer(data)\n\t\t\t\t\t\t\t\terr = binary.Read(buffer, binary.BigEndian, &ebrLeido)\n\t\t\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\t\t\tlog.Fatal(\"binary.Read failed\", err)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif &ebrLeido != nil {\n\t\t\t\t\t\t\t\t\tif ebrLeido.Next != -1 && ebrLeido.Size == 0 {\n\n\t\t\t\t\t\t\t\t\t\t//Aqui no valuo porque es el primer EBR solo lo salto\n\t\t\t\t\t\t\t\t\t\tj = ebrLeido.Next - 1\n\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\t} else if ebrLeido.Next == -1 && ebrLeido.Size == 0 {\n\t\t\t\t\t\t\t\t\t\t//la particion esta vacia\n\t\t\t\t\t\t\t\t\t\tj = limite + 1\n\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\t} else if ebrLeido.Next == -1 && ebrLeido.Size > 0 { //lego al utimo ebr\n\t\t\t\t\t\t\t\t\t\t//valuo con el limite porque es el ultimo ebr\n\t\t\t\t\t\t\t\t\t\tif ebrLeido.Name == nombreComparar {\n\t\t\t\t\t\t\t\t\t\t\tif strings.Compare(tipo, \"quitar\") == 0 {\n\t\t\t\t\t\t\t\t\t\t\t\tespacio := ebrLeido.Size - tam\n\t\t\t\t\t\t\t\t\t\t\t\tif espacio > 0 {\n\t\t\t\t\t\t\t\t\t\t\t\t\tebrLeido.Size = espacio\n\t\t\t\t\t\t\t\t\t\t\t\t\tmodificado = 1\n\t\t\t\t\t\t\t\t\t\t\t\t\tj = limite + 1\n\t\t\t\t\t\t\t\t\t\t\t\t\tescribirEbr(path, ebrLeido.Start, &ebrLeido)\n\t\t\t\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\t\tj = limite + 1\n\t\t\t\t\t\t\t\t\t\t\t\t\tfmt.Print(\"RESULTADO: No se puede reducir la particion logica\")\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t} else if strings.Compare(tipo, \"agregar\") == 0 {\n\t\t\t\t\t\t\t\t\t\t\t\tespacioDisponible := limite - ebrLeido.Start + ebrLeido.Size\n\t\t\t\t\t\t\t\t\t\t\t\tif espacioDisponible >= tam {\n\t\t\t\t\t\t\t\t\t\t\t\t\tebrLeido.Size = ebrLeido.Size + tam\n\t\t\t\t\t\t\t\t\t\t\t\t\tescribirEbr(path, ebrLeido.Start, &ebrLeido)\n\t\t\t\t\t\t\t\t\t\t\t\t\tmodificado = 1\n\t\t\t\t\t\t\t\t\t\t\t\t\tj = limite + 1\n\t\t\t\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\t\tj = limite + 1\n\t\t\t\t\t\t\t\t\t\t\t\t\tfmt.Print(\"RESULTADO: No se puede ampliar el tamano de la particion logica\")\n\t\t\t\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\tj = ebrLeido.Next - 1\n\t\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t} else if ebrLeido.Next != -1 && ebrLeido.Size > 0 { //esta en los ebr antes del ultimo\n\t\t\t\t\t\t\t\t\t\t//verificar pero con el next\n\t\t\t\t\t\t\t\t\t\tif ebrLeido.Name == nombreComparar {\n\t\t\t\t\t\t\t\t\t\t\tif strings.Compare(tipo, \"quitar\") == 0 {\n\t\t\t\t\t\t\t\t\t\t\t\tespacio := ebrLeido.Size - tam\n\t\t\t\t\t\t\t\t\t\t\t\tif espacio > 0 {\n\t\t\t\t\t\t\t\t\t\t\t\t\tebrLeido.Size = espacio\n\t\t\t\t\t\t\t\t\t\t\t\t\tmodificado = 1\n\t\t\t\t\t\t\t\t\t\t\t\t\tj = limite + 1\n\t\t\t\t\t\t\t\t\t\t\t\t\tescribirEbr(path, ebrLeido.Start, &ebrLeido)\n\t\t\t\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\t\tj = limite + 1\n\t\t\t\t\t\t\t\t\t\t\t\t\tfmt.Print(\"RESULTADO: No se puede reducir la particion logica\")\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t} else if strings.Compare(tipo, \"agregar\") == 0 {\n\t\t\t\t\t\t\t\t\t\t\t\tespacioDisponible := ebrLeido.Next - ebrLeido.Start + ebrLeido.Size\n\t\t\t\t\t\t\t\t\t\t\t\tif espacioDisponible >= tam {\n\t\t\t\t\t\t\t\t\t\t\t\t\tebrLeido.Size = ebrLeido.Size + tam\n\t\t\t\t\t\t\t\t\t\t\t\t\tescribirEbr(path, ebrLeido.Start, &ebrLeido)\n\t\t\t\t\t\t\t\t\t\t\t\t\tmodificado = 1\n\t\t\t\t\t\t\t\t\t\t\t\t\tj = limite + 1\n\t\t\t\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\t\tj = limite + 1\n\t\t\t\t\t\t\t\t\t\t\t\t\tfmt.Print(\"RESULTADO: No se puede ampliar el tamano de la particion logica\")\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\tj = ebrLeido.Next - 1\n\t\t\t\t\t\t\t\t\t\t}\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\tif modificado == 0 {\n\t\t\t\t\t\t\t\t\tj = ebrLeido.Next - 1\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif modificado == 0 {\n\t\t\t\t\t\t\t\tfinAnterior = s.Tabla[i].Start - 1\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\ti = -1\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif modificado == 0 {\n\t\t\t\t\t\t\tfinAnterior = s.Tabla[i].Start - 1\n\t\t\t\t\t\t}\n\t\t\t\t\t\t//fin de las logicas***********************************\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfinAnterior = s.Tabla[i].Start - 1\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif modificado == 1 {\n\t\t\tfmt.Println(\"RESULTADO: Se ha modificado el tamano de la particion\")\n\t\t\treescribir(s, path)\n\t\t\t//graficarMBR(path)\n\t\t\t//graficarDISCO(path)\n\t\t}\n\t}\n}", "title": "" } ]
[ { "docid": "6059be6710194e7d84a59ff7da4790ee", "score": "0.5390911", "text": "func (v *BitVector) accomodateBytes(length int) {\n\tv.accomodate(length * WORDSIZE)\n}", "title": "" }, { "docid": "dd952aeccb5342071a474eeaa4f33cef", "score": "0.53696114", "text": "func IncrementBytes(bytes []byte) {\n for i, _ := range(bytes) {\n bytes[i]++;\n\n if (bytes[i] != 0) {\n break;\n }\n }\n}", "title": "" }, { "docid": "fd62542f373b54293511ee1070038163", "score": "0.5360535", "text": "func Rot13Bytes(b []byte) {\n\tfor i, v := range b {\n\t\tb[i] = Rot13(v)\n\t}\n}", "title": "" }, { "docid": "829f9d938874fcc11806100c754c4b24", "score": "0.53182214", "text": "func TestGenerateBytesSmall(t *testing.T) {\n // generate small sequence of bytes\n data := generateBytes(0x41, 100)\n\n // if lengths don't match, test failed\n if len(data) != 100 {\n t.Errorf(\"len(data) = %d, want %d\", len(data), 100)\n }\n}", "title": "" }, { "docid": "211e31c97581d5b819cd574929cc057a", "score": "0.5279612", "text": "func (b *B) SetBytes(n int64) { b.bytes = n }", "title": "" }, { "docid": "211e31c97581d5b819cd574929cc057a", "score": "0.5279612", "text": "func (b *B) SetBytes(n int64) { b.bytes = n }", "title": "" }, { "docid": "1f673db5e61eaa190945a7bfe6f5535d", "score": "0.51882046", "text": "func put(value []byte, buf []byte, n int) (int, error) {\n\tif len(value)+n+4 > len(buf) {\n\t\treturn 0, errors.Wrap(fmt.Errorf(\"value too big: %d > %d\", len(value), len(buf)), \"put\")\n\t}\n\tm := binary.PutUvarint(buf[n:], uint64(len(value)))\n\tcopy(buf[n+m:], value)\n\treturn len(value) + n + m, nil\n}", "title": "" }, { "docid": "6d3e92c3edd0c052827290587ebe0042", "score": "0.5143432", "text": "func checkSum(b []byte) []byte {\n\tvar sum byte\n\tfor _, i := range b {\n\t\tsum += i\n\t}\n\tmask := sum & 0xFF\n\tck := strings.ToUpper(strconv.FormatInt(int64(mask), 16))\n\treturn []byte(fmt.Sprintf(\"%02s\", ck))\n}", "title": "" }, { "docid": "e00dfe6e77bfdafe7feedc50cc80d718", "score": "0.5138483", "text": "func bytesNext(data []byte) []byte {\n\tfor i := len(data) - 1; i >= 0; i-- {\n\t\tc := data[i]\n\t\tif c < 0xff {\n\t\t\tlimit := make([]byte, len(data))\n\t\t\tcopy(limit, data)\n\t\t\tlimit[i] = c + 1\n\t\t\treturn limit\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "67679044ec6b670c52f426fc40172c04", "score": "0.50978875", "text": "func addOne(v []byte) []byte {\n\tfor len(v) > 0 && v[len(v)-1] == 0xff {\n\t\tv = v[:len(v)-1]\n\t}\n\tif len(v) > 0 {\n\t\tv[len(v)-1]++\n\t}\n\treturn v\n}", "title": "" }, { "docid": "df12112df6d5f6182dc3867d14840302", "score": "0.50811684", "text": "func Bytes(dst, a, b []byte) int {\n\tn := min(len(dst), len(a), len(b))\n\tif n == 0 {\n\t\treturn 0\n\t}\n\tswitch {\n\tcase cpu.X86.HasAVX2:\n\t\txorBytesAVX2(dst, a, b, n)\n\tcase cpu.X86.HasSSE2:\n\t\txorBytesSSE(dst, a, b, n)\n\tdefault:\n\t\txorBytesGeneric(dst, a, b, n)\n\t}\n\treturn n\n}", "title": "" }, { "docid": "4b43e6f389aabfc566643773b4fa0384", "score": "0.50776553", "text": "func TestGenerateBytesLarge(t *testing.T) {\n // generate large sequence of bytes\n data := generateBytes(0x41, 20000)\n\n // if lengths don't match, test failed\n if len(data) != 20000 {\n t.Errorf(\"len(data) = %d, want %d\", len(data), 20000)\n }\n}", "title": "" }, { "docid": "2a21cf04f8e9a094268937bae4132756", "score": "0.505315", "text": "func (e *BooleanDecoder) SetBytes(b []byte) {\n\tif len(b) == 0 {\n\t\treturn\n\t}\n\n\t// First byte stores the encoding type, only have 1 bit-packet format\n\t// currently ignore for now.\n\tb = b[1:]\n\tcount, n := binary.Uvarint(b)\n\tif n <= 0 {\n\t\te.err = fmt.Errorf(\"BooleanDecoder: invalid count\")\n\t\treturn\n\t}\n\n\te.b = b[n:]\n\te.i = -1\n\te.n = int(count)\n\n\tif min := len(e.b) * 8; min < e.n {\n\t\t// Shouldn't happen - TSM file was truncated/corrupted\n\t\te.n = min\n\t}\n}", "title": "" }, { "docid": "b2295cee28c7bc917c444d0dfe3bef44", "score": "0.50497746", "text": "func (c *Cmdrw) getBytes() (cmd []byte) {\n\tfmt.Println(c)\n\tc.Sum = c.Cmd\n\tfor _, v := range c.Pn {\n\t\tc.Sum += v\n\t}\n\tc.Len = byte(1 + len(c.Pn)+1 )\n\tcmd = append(cmd, c.Head, c.Len, c.Cmd)\n\tcmd = append(cmd, c.Pn...)\n\tcmd = append(cmd, c.Sum)\n\tfmt.Println(cmd)\n\t// 转换成小端模式 ?\n\t//reverse(cmd)\n\t//fmt.Println(cmd)\n\treturn\n\n}", "title": "" }, { "docid": "fbe62f790d730ea5aadf392eb3303f42", "score": "0.50404495", "text": "func (fm *FinalModelUInt64) Verify() int {\n if (fm.buffer.Offset() + fm.FBEOffset() + fm.FBESize()) > fm.buffer.Size() {\n return MaxInt\n }\n\n return fm.FBESize()\n}", "title": "" }, { "docid": "592c09421ede287bd292d0e503a37485", "score": "0.5024687", "text": "func (uv *userValidator) rememberMinBytes(user *models.User) error {\n\tif user.Remember == \"\" {\n\t\treturn nil\n\t}\n\tn, err := rand.NBytes(user.Remember)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif n < 32 {\n\t\treturn models.ErrRememberTooShort\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f0906588391ce25c0c87724a4ffe08c6", "score": "0.5014517", "text": "func (s *Skein) putBytes(input []uint64, output []byte) {\n var j uint\n for i := 0; i < len(output); i++ {\n output[i] = byte(input[i/8] >> j)\n j = (j + 8) & 63\n }\n}", "title": "" }, { "docid": "efcd72efa64065fbd2f85f71c1577b5c", "score": "0.4995938", "text": "func putsize(s []byte) {\n\tif s != nil && int32(s[0]) != 0 {\n\t\tnoarch.Fprintf(tabout, []byte(\"\\\\s%s\\x00\"), s)\n\t}\n}", "title": "" }, { "docid": "924517b3c54e8e60663341369f9a96a7", "score": "0.4934343", "text": "func encodedLengthSize(length int) int {\n\tif length < 0x80 {\n\t\treturn 1\n\t}\n\n\tlengthSize := 1\n\tfor ; length > 0; lengthSize++ {\n\t\tlength >>= 8\n\t}\n\treturn lengthSize\n}", "title": "" }, { "docid": "5ebd2d231e19a95d2828dfc50e5e8db6", "score": "0.49308273", "text": "func byteLen(n int) int {\n\treturn (bits.Len(uint(n))-1)/8 + 1\n}", "title": "" }, { "docid": "b1f9335a66edb2f514cb324259db434e", "score": "0.49248445", "text": "func DecodedLen(x int) int {}", "title": "" }, { "docid": "341eb05349621aed2678c85f495dfce5", "score": "0.4922941", "text": "func XorBytes(dst, a, b []byte) int {\n\tn := len(a)\n\tif len(b) < n {\n\t\tn = len(b)\n\t}\n\tif n == 0 {\n\t\treturn 0\n\t}\n\n\tswitch {\n\tcase supportsUnaligned:\n\t\tfastXORBytes(dst, a, b, n)\n\tcase isAligned(&dst[0]) && isAligned(&a[0]) && isAligned(&b[0]):\n\t\tfastXORBytes(dst, a, b, n)\n\tdefault:\n\t\tsafeXORBytes(dst, a, b, n)\n\t}\n\treturn n\n}", "title": "" }, { "docid": "b7b69da3d5ce5535badcaf77e002a32b", "score": "0.4922412", "text": "func mutateByte(b []byte) {\n\tfor r := mrand.Intn(len(b)); ; {\n\t\tnew := byte(mrand.Intn(255))\n\t\tif new != b[r] {\n\t\t\tb[r] = new\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f8336ad904555451409abaab56fa05d5", "score": "0.49220973", "text": "func getLength(b *[]byte) uint64 {\n\tlength := uint64((*b)[1])\n\tif length == 127 {\n\t\tlength = 0\n\n\t\tlength = (uint64((*b)[2]) | length) << 8\n\t\tlength = (uint64((*b)[3]) | length) << 8\n\t\tlength = (uint64((*b)[4]) | length) << 8\n\t\tlength = (uint64((*b)[5]) | length) << 8\n\t\tlength = (uint64((*b)[6]) | length) << 8\n\t\tlength = (uint64((*b)[7]) | length) << 8\n\t\tlength = (uint64((*b)[8]) | length) << 8\n\t\tlength = (uint64((*b)[9]) | length)\n\n\t\treturn length\n\t} else if length == 126 {\n\t\t// Get next two bytes\n\t\tlength = uint64((*b)[2]) << 8\n\t\tlength = length | uint64((*b)[3])\n\t\treturn length\n\t}\n\treturn length\n}", "title": "" }, { "docid": "2276c3215b28aad4ae3d591fa0e04554", "score": "0.4899369", "text": "func emitCopyNoRepeatSize(offset, length int) int {\n\tif offset >= 65536 {\n\t\treturn 5 + 5*(length/64)\n\t}\n\n\t// Offset no more than 2 bytes.\n\tif length > 64 {\n\t\t// Emit remaining as repeats, at least 4 bytes remain.\n\t\treturn 3 + 3*(length/60)\n\t}\n\tif length >= 12 || offset >= 2048 {\n\t\treturn 3\n\t}\n\t// Emit the remaining copy, encoded as 2 bytes.\n\treturn 2\n}", "title": "" }, { "docid": "e5613d822ac046c5343046e801ce8e18", "score": "0.4882443", "text": "func (*NokiaConf_Configure_System_Security_Ssh_KeyReExchange_Server_Mbytes_Union_Uint32) Is_NokiaConf_Configure_System_Security_Ssh_KeyReExchange_Server_Mbytes_Union() {\n}", "title": "" }, { "docid": "a54d7f26f5cff4055f9ee15ff204d194", "score": "0.48819393", "text": "func (hPtr *_N_) SetBytes(b []byte) {\n\t// Use the right most bytes\n\tif len(b) > len(h) {\n\t\tb = b[len(b)-_S_:]\n\t}\n\n\t// Reverse the loop\n\tfor i := len(b) - 1; i >= 0; i-- {\n\t\th[_S_-len(b)+i] = b[i]\n\t}\n}", "title": "" }, { "docid": "f9e6c99b18e5a7f9918250d2a9917cda", "score": "0.48806626", "text": "func EncodedLen(n int) int {}", "title": "" }, { "docid": "53d297bb076be2e3c7da12792088fa17", "score": "0.48602122", "text": "func byteToLength(b byte) int {\n\treturn int(1 << (b + 9))\n}", "title": "" }, { "docid": "64d0935a7712d2ad1331afef017d0528", "score": "0.48576725", "text": "func (*NokiaConf_Configure_System_Security_Ssh_KeyReExchange_Server_Mbytes_Union_E_NokiaConf_Configure_System_Security_Ssh_KeyReExchange_Server_Mbytes) Is_NokiaConf_Configure_System_Security_Ssh_KeyReExchange_Server_Mbytes_Union() {\n}", "title": "" }, { "docid": "cfb53194bede612699755f539c3da303", "score": "0.48570946", "text": "func (b *Buffer) Nbyte() int {\n\tbc := 0\n\tfor _, r := range *b {\n\t\tbc += utf8.RuneLen(r)\n\t}\n\treturn bc\n}", "title": "" }, { "docid": "243af3159928553a361278ce571e5d7b", "score": "0.4855666", "text": "func (m Tversion) Msize() int64 { return int64(guint32(m[7:11])) }", "title": "" }, { "docid": "7cd832a55d17ee9c17e561757683ada8", "score": "0.48493132", "text": "func (a *ArrayU32) Bytes() int {\r\n\r\n\treturn len(*a) * int(unsafe.Sizeof(uint32(0)))\r\n}", "title": "" }, { "docid": "fc2a9f03d684cb47deb953499b0101ed", "score": "0.48482868", "text": "func xorBytes(dst, a, b []byte) int", "title": "" }, { "docid": "ffbb559f86aa4e30217b0f65827b1324", "score": "0.48408362", "text": "func generateChallengeFromByte(values [][]byte) *big.Int {\n\tbytes := privacy.PedCom.G[0].Compress()\n\tfor i := 1; i < len(privacy.PedCom.G); i++ {\n\t\tbytes = append(bytes, privacy.PedCom.G[i].Compress()...)\n\t}\n\n\tfor i := 0; i < len(values); i++ {\n\t\tbytes = append(bytes, values[i]...)\n\t}\n\n\thash := common.HashB(bytes)\n\n\tres := new(big.Int).SetBytes(hash)\n\tres.Mod(res, privacy.Curve.Params().N)\n\treturn res\n}", "title": "" }, { "docid": "3b60e49be0b075254fd7d60887635bb1", "score": "0.4840355", "text": "func mask(key uint32, b []byte) uint32 {\n\tif len(b) >= 8 {\n\t\tkey64 := uint64(key)<<32 | uint64(key)\n\n\t\t// At some point in the future we can clean these unrolled loops up.\n\t\t// See https://github.com/golang/go/issues/31586#issuecomment-487436401\n\n\t\t// Then we xor until b is less than 128 bytes.\n\t\tfor len(b) >= 128 {\n\t\t\tv := binary.LittleEndian.Uint64(b)\n\t\t\tbinary.LittleEndian.PutUint64(b, v^key64)\n\t\t\tv = binary.LittleEndian.Uint64(b[8:16])\n\t\t\tbinary.LittleEndian.PutUint64(b[8:16], v^key64)\n\t\t\tv = binary.LittleEndian.Uint64(b[16:24])\n\t\t\tbinary.LittleEndian.PutUint64(b[16:24], v^key64)\n\t\t\tv = binary.LittleEndian.Uint64(b[24:32])\n\t\t\tbinary.LittleEndian.PutUint64(b[24:32], v^key64)\n\t\t\tv = binary.LittleEndian.Uint64(b[32:40])\n\t\t\tbinary.LittleEndian.PutUint64(b[32:40], v^key64)\n\t\t\tv = binary.LittleEndian.Uint64(b[40:48])\n\t\t\tbinary.LittleEndian.PutUint64(b[40:48], v^key64)\n\t\t\tv = binary.LittleEndian.Uint64(b[48:56])\n\t\t\tbinary.LittleEndian.PutUint64(b[48:56], v^key64)\n\t\t\tv = binary.LittleEndian.Uint64(b[56:64])\n\t\t\tbinary.LittleEndian.PutUint64(b[56:64], v^key64)\n\t\t\tv = binary.LittleEndian.Uint64(b[64:72])\n\t\t\tbinary.LittleEndian.PutUint64(b[64:72], v^key64)\n\t\t\tv = binary.LittleEndian.Uint64(b[72:80])\n\t\t\tbinary.LittleEndian.PutUint64(b[72:80], v^key64)\n\t\t\tv = binary.LittleEndian.Uint64(b[80:88])\n\t\t\tbinary.LittleEndian.PutUint64(b[80:88], v^key64)\n\t\t\tv = binary.LittleEndian.Uint64(b[88:96])\n\t\t\tbinary.LittleEndian.PutUint64(b[88:96], v^key64)\n\t\t\tv = binary.LittleEndian.Uint64(b[96:104])\n\t\t\tbinary.LittleEndian.PutUint64(b[96:104], v^key64)\n\t\t\tv = binary.LittleEndian.Uint64(b[104:112])\n\t\t\tbinary.LittleEndian.PutUint64(b[104:112], v^key64)\n\t\t\tv = binary.LittleEndian.Uint64(b[112:120])\n\t\t\tbinary.LittleEndian.PutUint64(b[112:120], v^key64)\n\t\t\tv = binary.LittleEndian.Uint64(b[120:128])\n\t\t\tbinary.LittleEndian.PutUint64(b[120:128], v^key64)\n\t\t\tb = b[128:]\n\t\t}\n\n\t\t// Then we xor until b is less than 64 bytes.\n\t\tfor len(b) >= 64 {\n\t\t\tv := binary.LittleEndian.Uint64(b)\n\t\t\tbinary.LittleEndian.PutUint64(b, v^key64)\n\t\t\tv = binary.LittleEndian.Uint64(b[8:16])\n\t\t\tbinary.LittleEndian.PutUint64(b[8:16], v^key64)\n\t\t\tv = binary.LittleEndian.Uint64(b[16:24])\n\t\t\tbinary.LittleEndian.PutUint64(b[16:24], v^key64)\n\t\t\tv = binary.LittleEndian.Uint64(b[24:32])\n\t\t\tbinary.LittleEndian.PutUint64(b[24:32], v^key64)\n\t\t\tv = binary.LittleEndian.Uint64(b[32:40])\n\t\t\tbinary.LittleEndian.PutUint64(b[32:40], v^key64)\n\t\t\tv = binary.LittleEndian.Uint64(b[40:48])\n\t\t\tbinary.LittleEndian.PutUint64(b[40:48], v^key64)\n\t\t\tv = binary.LittleEndian.Uint64(b[48:56])\n\t\t\tbinary.LittleEndian.PutUint64(b[48:56], v^key64)\n\t\t\tv = binary.LittleEndian.Uint64(b[56:64])\n\t\t\tbinary.LittleEndian.PutUint64(b[56:64], v^key64)\n\t\t\tb = b[64:]\n\t\t}\n\n\t\t// Then we xor until b is less than 32 bytes.\n\t\tfor len(b) >= 32 {\n\t\t\tv := binary.LittleEndian.Uint64(b)\n\t\t\tbinary.LittleEndian.PutUint64(b, v^key64)\n\t\t\tv = binary.LittleEndian.Uint64(b[8:16])\n\t\t\tbinary.LittleEndian.PutUint64(b[8:16], v^key64)\n\t\t\tv = binary.LittleEndian.Uint64(b[16:24])\n\t\t\tbinary.LittleEndian.PutUint64(b[16:24], v^key64)\n\t\t\tv = binary.LittleEndian.Uint64(b[24:32])\n\t\t\tbinary.LittleEndian.PutUint64(b[24:32], v^key64)\n\t\t\tb = b[32:]\n\t\t}\n\n\t\t// Then we xor until b is less than 16 bytes.\n\t\tfor len(b) >= 16 {\n\t\t\tv := binary.LittleEndian.Uint64(b)\n\t\t\tbinary.LittleEndian.PutUint64(b, v^key64)\n\t\t\tv = binary.LittleEndian.Uint64(b[8:16])\n\t\t\tbinary.LittleEndian.PutUint64(b[8:16], v^key64)\n\t\t\tb = b[16:]\n\t\t}\n\n\t\t// Then we xor until b is less than 8 bytes.\n\t\tfor len(b) >= 8 {\n\t\t\tv := binary.LittleEndian.Uint64(b)\n\t\t\tbinary.LittleEndian.PutUint64(b, v^key64)\n\t\t\tb = b[8:]\n\t\t}\n\t}\n\n\t// Then we xor until b is less than 4 bytes.\n\tfor len(b) >= 4 {\n\t\tv := binary.LittleEndian.Uint32(b)\n\t\tbinary.LittleEndian.PutUint32(b, v^key)\n\t\tb = b[4:]\n\t}\n\n\t// xor remaining bytes.\n\tfor i := range b {\n\t\tb[i] ^= byte(key)\n\t\tkey = bits.RotateLeft32(key, -8)\n\t}\n\n\treturn key\n}", "title": "" }, { "docid": "71f389ff814fc748b76297eb3758a1c8", "score": "0.48403105", "text": "func ObfuscateBytes8(b []byte) []byte {\n\tresp := make([]byte, 8)\n\tival := binary.BigEndian.Uint64(b)\n\tbinary.BigEndian.PutUint64(resp, ival^ObfuscationKey64)\n\treturn resp\n}", "title": "" }, { "docid": "6b499766ffd23a9fb9f222bd98109b7d", "score": "0.48203343", "text": "func execmEncodingEncodedLen(_ int, p *gop.Context) {\n\targs := p.GetArgs(2)\n\tret := args[0].(*base32.Encoding).EncodedLen(args[1].(int))\n\tp.Ret(2, ret)\n}", "title": "" }, { "docid": "fd4858fd9dcbb8ec47b2c6241c47424f", "score": "0.4817321", "text": "func (a *ArrayU32) Bytes() int {\n\n\treturn len(*a) * int(unsafe.Sizeof(uint32(0)))\n}", "title": "" }, { "docid": "02bc0de8c66451e1e19e0b016a7a77a6", "score": "0.48169228", "text": "func readBytes() {\n\n}", "title": "" }, { "docid": "b33a7db76e1bb52ffddee69e4bc99a05", "score": "0.48131305", "text": "func (s *UInt32Serializable) ByteSize() uint32 {\n\t// tag number (2 bytes) + content content (5 bytes)\n\treturn 7\n}", "title": "" }, { "docid": "500cc1f779532277a81add10730626fd", "score": "0.48112607", "text": "func sizeBytesNoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\r\n\tv := *p.Bytes()\r\n\tif len(v) == 0 {\r\n\t\treturn 0\r\n\t}\r\n\treturn f.tagsize + protowire.SizeBytes(len(v))\r\n}", "title": "" }, { "docid": "14693055b9ac0ce6f39fbfd437656f64", "score": "0.48087013", "text": "func bytesequal(nib1 []byte, nib2 []byte) bool {\n\tlen1, len2 := len(nib1), len(nib2)\n\tif len1 != len2 {\n\t\treturn false\n\t}\n\tfor idx := 0; idx < len1 ; idx++ {\n\t\tif nib1[idx] != nib2[idx] {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "467d62754743acca722460a01b6f9a08", "score": "0.4804714", "text": "func bytesToMebibit(bytes float64) float64 {\n\treturn bytes / 131072\n}", "title": "" }, { "docid": "5e67d23866b8c079368bea10889b5cd8", "score": "0.47953415", "text": "func checksumDelta(init uint32, buf []byte) uint32 {\n\n\tsum := init\n\n\tfor ; len(buf) >= 2; buf = buf[2:] {\n\t\tsum += uint32(buf[0])<<8 | uint32(buf[1])\n\t}\n\n\tif len(buf) > 0 {\n\t\tsum += uint32(buf[0]) << 8\n\t}\n\n\treturn sum\n}", "title": "" }, { "docid": "06de19581b8a35f9c3995653c36f6710", "score": "0.4793406", "text": "func (*NokiaConf_Configure_Groups_Group_System_Security_Ssh_KeyReExchange_Server_Mbytes_Union_E_NokiaConf_Configure_Groups_Group_System_Security_Ssh_KeyReExchange_Server_Mbytes) Is_NokiaConf_Configure_Groups_Group_System_Security_Ssh_KeyReExchange_Server_Mbytes_Union() {\n}", "title": "" }, { "docid": "6823bbb77ecd9662da1df5f85ad8bff9", "score": "0.47907752", "text": "func (*NokiaConf_Configure_System_Security_Ssh_KeyReExchange_Client_Mbytes_Union_Uint32) Is_NokiaConf_Configure_System_Security_Ssh_KeyReExchange_Client_Mbytes_Union() {\n}", "title": "" }, { "docid": "1f9fdb73870e6754d27502e22695da62", "score": "0.478975", "text": "func byteReverse(tls *libc.TLS, buf uintptr, longs uint32) { /* test_md5.c:68:13: */\n\tvar t uint32\n\tfor ok := true; ok; ok = libc.PreDecUint32(&longs, 1) != 0 {\n\t\tt = ((((uint32(*(*uint8)(unsafe.Pointer(buf + 3))) << 8) | uint32(*(*uint8)(unsafe.Pointer(buf + 2)))) << 16) | ((uint32(*(*uint8)(unsafe.Pointer(buf + 1))) << 8) | uint32(*(*uint8)(unsafe.Pointer(buf)))))\n\t\t*(*uint32)(unsafe.Pointer(buf)) = t\n\t\tbuf += uintptr(4)\n\t}\n}", "title": "" }, { "docid": "deb055de03567bed0491b68dd3c3ba79", "score": "0.4788793", "text": "func randomBytes(bytes int) (data []byte) {\n\tdata = make([]byte, bytes)\n\tif _, err := io.ReadFull(userlib.Reader, data); err != nil {\n\t\tpanic(err)\n\t}\n\treturn\n}", "title": "" }, { "docid": "c230c7122dac8b3b51ac345fb5f1732d", "score": "0.47886148", "text": "func scanBytesNumBinary(bytes []byte) (num int, err error) {\n\tconst minLen = 6 /* header (label len + payload len) */ +\n\t\tlen(`{\"x\":0}`) /* min JSON payload len */\n\n\tif len(bytes) < minLen {\n\t\treturn 0, ErrMalformedMessage\n\t}\n\n\tfor offset := 0; offset < len(bytes); num++ {\n\t\t// Check whether enough bytes are left\n\t\t// to read the smallest possible message\n\t\tif bytesLeft := len(bytes) - offset - minLen; bytesLeft == 0 {\n\t\t\tnum++\n\t\t\tbreak\n\t\t} else if bytesLeft < 0 {\n\t\t\t// Malformed message\n\t\t\treturn 0, ErrMalformedMessage\n\t\t}\n\t\tb := bytes[offset:]\n\n\t\t// Read label len header\n\t\tlabelLen := binary.LittleEndian.Uint16(b[:2])\n\n\t\t// Read payload len header\n\t\tpayloadLen := binary.LittleEndian.Uint32(b[2:6])\n\n\t\t// Check whether enough bytes are left to read the message\n\t\tmsgLen := (6 + int(labelLen) + int(payloadLen))\n\t\tif bytesLeft := len(b) - msgLen; bytesLeft < 0 {\n\t\t\t// Malformed message\n\t\t\treturn 0, ErrMalformedMessage\n\t\t}\n\t\toffset += msgLen\n\t}\n\treturn\n}", "title": "" }, { "docid": "df46eaf850774b8fbbf9945f8098c8cc", "score": "0.47827742", "text": "func (*NokiaConf_Configure_Groups_Group_System_Security_Ssh_KeyReExchange_Server_Mbytes_Union_Uint32) Is_NokiaConf_Configure_Groups_Group_System_Security_Ssh_KeyReExchange_Server_Mbytes_Union() {\n}", "title": "" }, { "docid": "53a6d0a4f915505fffabc60846934660", "score": "0.47821227", "text": "func encodeSizeGiveBlocksMessage(obj *GiveBlocksMessage) uint64 {\n\ti0 := uint64(0)\n\n\t// obj.Blocks\n\ti0 += 4\n\tfor _, x := range obj.Blocks {\n\t\ti1 := uint64(0)\n\n\t\t// x.Block.Head.Version\n\t\ti1 += 4\n\n\t\t// x.Block.Head.Time\n\t\ti1 += 8\n\n\t\t// x.Block.Head.BkSeq\n\t\ti1 += 8\n\n\t\t// x.Block.Head.Fee\n\t\ti1 += 8\n\n\t\t// x.Block.Head.PrevHash\n\t\ti1 += 32\n\n\t\t// x.Block.Head.BodyHash\n\t\ti1 += 32\n\n\t\t// x.Block.Head.UxHash\n\t\ti1 += 32\n\n\t\t// x.Block.Body.Transactions\n\t\ti1 += 4\n\t\tfor _, x := range x.Block.Body.Transactions {\n\t\t\ti2 := uint64(0)\n\n\t\t\t// x.Length\n\t\t\ti2 += 4\n\n\t\t\t// x.Type\n\t\t\ti2++\n\n\t\t\t// x.InnerHash\n\t\t\ti2 += 32\n\n\t\t\t// x.Sigs\n\t\t\ti2 += 4\n\t\t\t{\n\t\t\t\ti3 := uint64(0)\n\n\t\t\t\t// x\n\t\t\t\ti3 += 65\n\n\t\t\t\ti2 += uint64(len(x.Sigs)) * i3\n\t\t\t}\n\n\t\t\t// x.In\n\t\t\ti2 += 4\n\t\t\t{\n\t\t\t\ti3 := uint64(0)\n\n\t\t\t\t// x\n\t\t\t\ti3 += 32\n\n\t\t\t\ti2 += uint64(len(x.In)) * i3\n\t\t\t}\n\n\t\t\t// x.Out\n\t\t\ti2 += 4\n\t\t\t{\n\t\t\t\ti3 := uint64(0)\n\n\t\t\t\t// x.Address.Version\n\t\t\t\ti3++\n\n\t\t\t\t// x.Address.Key\n\t\t\t\ti3 += 20\n\n\t\t\t\t// x.Coins\n\t\t\t\ti3 += 8\n\n\t\t\t\t// x.Hours\n\t\t\t\ti3 += 8\n\n\t\t\t\ti2 += uint64(len(x.Out)) * i3\n\t\t\t}\n\n\t\t\ti1 += i2\n\t\t}\n\n\t\t// x.Sig\n\t\ti1 += 65\n\n\t\ti0 += i1\n\t}\n\n\treturn i0\n}", "title": "" }, { "docid": "dd00c574ab4609d3018e7c066e5a44d8", "score": "0.47771695", "text": "func (*NokiaConf_Configure_System_Security_Ssh_KeyReExchange_Client_Mbytes_Union_E_NokiaConf_Configure_System_Security_Ssh_KeyReExchange_Client_Mbytes) Is_NokiaConf_Configure_System_Security_Ssh_KeyReExchange_Client_Mbytes_Union() {\n}", "title": "" }, { "docid": "833f8412b68d0ea52f59d93cc9e30d51", "score": "0.47592434", "text": "func toBinary(inputBuffer *bytes.Buffer, encoding Encoding) (*bytes.Buffer, error) {\n\n\t// Each byte is represented by 2 bytes, so regular 8 byte becomes 16 - so a primary, secondary and tertiary\n\t// bitmap in ASCII/EBCDIC is 48 bytes\n\n\tvar tmp []byte\n\tvar err error\n\tvar outputBuffer = &bytes.Buffer{}\n\n\tif tmp, err = NextBytes(inputBuffer, 16); err != nil {\n\t\treturn nil, fmt.Errorf(\"libiso: Failed to read primary bitmap :%w\", err)\n\t}\n\n\tbin, _ := hex.DecodeString(encoding.EncodeToString(tmp))\n\toutputBuffer.Write(bin)\n\tif bin[0]&0x80 == 0x80 {\n\t\tif tmp, err = NextBytes(inputBuffer, 16); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"libiso: Failed to read secondary bitmap :%w\", err)\n\t\t}\n\t\tbin, _ := hex.DecodeString(encoding.EncodeToString(tmp))\n\t\toutputBuffer.Write(bin)\n\t\tif bin[0]&0x80 == 0x80 {\n\t\t\tif tmp, err = NextBytes(inputBuffer, 16); err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"libiso: Failed to read tertiary bitmap :%w\", err)\n\t\t\t}\n\t\t\tbin, _ := hex.DecodeString(encoding.EncodeToString(tmp))\n\t\t\toutputBuffer.Write(bin)\n\t\t}\n\t}\n\n\treturn outputBuffer, nil\n\n}", "title": "" }, { "docid": "f4f8db6ffb548aaa4e7d4d7a0ebfba71", "score": "0.47531706", "text": "func BytesWritable(b []byte) []byte {\n\treturn b[4:]\n}", "title": "" }, { "docid": "d98c472d5e2cdbde6bd059c0aee4c06f", "score": "0.47526878", "text": "func (v *BitVector) accomodate(elements int) {\n\twordsNeeded := (elements-1)/WORDSIZE + 1\n\twords := len(v.bits)\n\tif wordsNeeded > words { // reallocate\n\t\tnewSlice := make([]byte, Max(2*words, wordsNeeded))\n\t\tcopy(newSlice, v.bits)\n\t\tv.bits = newSlice\n\t}\n}", "title": "" }, { "docid": "d11f21d72acb2799472f2b11d3c41c3e", "score": "0.47491032", "text": "func (ut UnitTag) Recycle() byte {\n\treturn byte(uint16(ut) >> 12)\n}", "title": "" }, { "docid": "d11f21d72acb2799472f2b11d3c41c3e", "score": "0.47491032", "text": "func (ut UnitTag) Recycle() byte {\n\treturn byte(uint16(ut) >> 12)\n}", "title": "" }, { "docid": "69c56923b655145e51a5b23bb5fdcec2", "score": "0.4746351", "text": "func (n Prefix) Bytes() []byte { return n }", "title": "" }, { "docid": "a07945301a62b42a761a54af84dd48ba", "score": "0.47458103", "text": "func isMemorySwapBytes(fl validator.FieldLevel) bool {\n\tval := fl.Field().String()\n\tif val == \"-1\" {\n\t\treturn true\n\t}\n\treturn sizeRegex.MatchString(val)\n}", "title": "" }, { "docid": "b5606d45e6672c08acd7cf356cc328ad", "score": "0.4739423", "text": "func vectorizedCastagnoli(crc uint32, p []byte) uint32", "title": "" }, { "docid": "ffca6f679429c79ade52570207547486", "score": "0.4738397", "text": "func Uint64Put(x Uint64, b []byte) int {\n\tif x == 0 {\n\t\treturn 0\n\t}\n\tif x < 0x0101 {\n\t\tx -= 1\n\t\tb[0] = uint8(x)\n\t\treturn 1\n\t}\n\tif x < 0x010101 {\n\t\tx -= 0x0101\n\t\tb[0] = uint8(x)\n\t\tb[1] = uint8(x >> 8)\n\t\treturn 2\n\t}\n\tif x < 0x01010101 {\n\t\tx -= 0x010101\n\t\tb[0] = uint8(x)\n\t\tb[1] = uint8(x >> 8)\n\t\tb[2] = uint8(x >> 16)\n\t\treturn 3\n\t}\n\tif x < 0x0101010101 {\n\t\tx -= 0x01010101\n\t\tb[0] = uint8(x)\n\t\tb[1] = uint8(x >> 8)\n\t\tb[2] = uint8(x >> 16)\n\t\tb[3] = uint8(x >> 24)\n\t\treturn 4\n\t}\n\tif x < 0x010101010101 {\n\t\tx -= 0x0101010101\n\t\tb[0] = uint8(x)\n\t\tb[1] = uint8(x >> 8)\n\t\tb[2] = uint8(x >> 16)\n\t\tb[3] = uint8(x >> 24)\n\t\tb[4] = uint8(x >> 32)\n\t\treturn 5\n\t}\n\tif x < 0x01010101010101 {\n\t\tx -= 0x010101010101\n\t\tb[0] = uint8(x)\n\t\tb[1] = uint8(x >> 8)\n\t\tb[2] = uint8(x >> 16)\n\t\tb[3] = uint8(x >> 24)\n\t\tb[4] = uint8(x >> 32)\n\t\tb[5] = uint8(x >> 40)\n\t\treturn 6\n\t}\n\tif x < 0x0101010101010101 {\n\t\tx -= 0x01010101010101\n\t\tb[0] = uint8(x)\n\t\tb[1] = uint8(x >> 8)\n\t\tb[2] = uint8(x >> 16)\n\t\tb[3] = uint8(x >> 24)\n\t\tb[4] = uint8(x >> 32)\n\t\tb[5] = uint8(x >> 40)\n\t\tb[6] = uint8(x >> 48)\n\t\treturn 7\n\t}\n\tx -= 0x0101010101010101\n\tb[0] = uint8(x)\n\tb[1] = uint8(x >> 8)\n\tb[2] = uint8(x >> 16)\n\tb[3] = uint8(x >> 24)\n\tb[4] = uint8(x >> 32)\n\tb[5] = uint8(x >> 40)\n\tb[6] = uint8(x >> 48)\n\tb[7] = uint8(x >> 56)\n\treturn 8\n}", "title": "" }, { "docid": "775f7027acf710dc1dab68239101e435", "score": "0.4738275", "text": "func (r *buffer) equals(b []byte) bool { return bytes.Equal(r.data[:r.size], b) }", "title": "" }, { "docid": "911522a3614dd76a9b1f4a3a739dc663", "score": "0.47306126", "text": "func Checksum(data []byte) uint32 { return Update(0, data) }", "title": "" }, { "docid": "a35cea7080ec209e19258ca921dd07bd", "score": "0.47115782", "text": "func Checksum(data []byte, tab *Table) uint16 { return Update(0, tab, data) }", "title": "" }, { "docid": "329b953fe136ce3f5cc1cc5a9ca6d855", "score": "0.47107378", "text": "func emitCopySize(offset, length int) int {\n\tif offset >= 65536 {\n\t\ti := 0\n\t\tif length > 64 {\n\t\t\tlength -= 64\n\t\t\tif length >= 4 {\n\t\t\t\t// Emit remaining as repeats\n\t\t\t\treturn 5 + emitRepeatSize(offset, length)\n\t\t\t}\n\t\t\ti = 5\n\t\t}\n\t\tif length == 0 {\n\t\t\treturn i\n\t\t}\n\t\treturn i + 5\n\t}\n\n\t// Offset no more than 2 bytes.\n\tif length > 64 {\n\t\tif offset < 2048 {\n\t\t\t// Emit 8 bytes, then rest as repeats...\n\t\t\treturn 2 + emitRepeatSize(offset, length-8)\n\t\t}\n\t\t// Emit remaining as repeats, at least 4 bytes remain.\n\t\treturn 3 + emitRepeatSize(offset, length-60)\n\t}\n\tif length >= 12 || offset >= 2048 {\n\t\treturn 3\n\t}\n\t// Emit the remaining copy, encoded as 2 bytes.\n\treturn 2\n}", "title": "" }, { "docid": "173c11fce96ac84c329668d582375abb", "score": "0.47085795", "text": "func (v VarLong) WriteToBytes(buf []byte) int {\n\tnum := uint64(v)\n\ti := 0\n\tfor {\n\t\tb := num & 0x7F\n\t\tnum >>= 7\n\t\tif num != 0 {\n\t\t\tb |= 0x80\n\t\t}\n\t\tbuf[i] = byte(b)\n\t\ti++\n\t\tif num == 0 {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn i\n}", "title": "" }, { "docid": "6a4c8a5a4a6a002fe4a69d3ce0b63af1", "score": "0.47076976", "text": "func randomBytes(n int) []byte {\n\tb := make([]byte, n)\n\tif _, err := rand.Read(b); err != nil {\n\t\tfmt.Println(\"Erreur :\", err)\n\t\treturn nil\n\t}\n\treturn b\n}", "title": "" }, { "docid": "2893d41035346edf6ffc58e059ef0823", "score": "0.47051796", "text": "func GoBytesLen(s *int8, len int) []byte {\n\tvar b buffer.Bytes\n\tfor ; len != 0; len-- {\n\t\tb.WriteByte(byte(*s))\n\t\t*(*uintptr)(unsafe.Pointer(&s))++\n\t}\n\treturn b.Bytes()\n}", "title": "" }, { "docid": "8b7bfb062f3ccd73b08de3c5f3ea070a", "score": "0.4704055", "text": "func (*NokiaConf_Configure_Groups_Group_System_Security_Ssh_KeyReExchange_Client_Mbytes_Union_E_NokiaConf_Configure_Groups_Group_System_Security_Ssh_KeyReExchange_Client_Mbytes) Is_NokiaConf_Configure_Groups_Group_System_Security_Ssh_KeyReExchange_Client_Mbytes_Union() {\n}", "title": "" }, { "docid": "066b5623f5ce40071bdc28fc64212bf7", "score": "0.46948203", "text": "func DecodedLen(n int) int { return n / tritsPerByte }", "title": "" }, { "docid": "00b5625f64780a121dc06cae701940a3", "score": "0.46917278", "text": "func (u *Uint64) Write(b []byte) (int, error) {\n\t*u = Uint64Decoder(b...)\n\tif len(b) > 7 {\n\t\tif *u > Uint64(0xFEFEFEFEFEFEFEFE) {\n\t\t\treturn 0, DecErr\n\t\t}\n\t\treturn 8, io.EOF\n\t}\n\treturn len(b), nil\n}", "title": "" }, { "docid": "321826d5849f8c92123a3099d8a71755", "score": "0.46906632", "text": "func ModulusFromBlob(blob []byte) []byte {\n\treturn blob[28:]\n}", "title": "" }, { "docid": "321826d5849f8c92123a3099d8a71755", "score": "0.46906632", "text": "func ModulusFromBlob(blob []byte) []byte {\n\treturn blob[28:]\n}", "title": "" }, { "docid": "f02f2a58c229deba0ef07af1be3581ae", "score": "0.46873108", "text": "func xunbin(tls TLS, _c uintptr /* *Schunk */, _i int32) {\n\tif !(*(*uintptr)(unsafe.Pointer(_c + 24)) == *(*uintptr)(unsafe.Pointer(_c + 16))) {\n\t\tgoto _1\n\t}\n\n\txa_and_64(tls, xmal, ^(uint64(1) << (uint(_i) % 64)))\n_1:\n\t*(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(_c + 24)) + 16)) = *(*uintptr)(unsafe.Pointer(_c + 16))\n\t*(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(_c + 16)) + 24)) = *(*uintptr)(unsafe.Pointer(_c + 24))\n\t{\n\t\tp := (*uint64)(unsafe.Pointer(_c + 8))\n\t\t*p = *p | uint64(1)\n\t}\n\t{\n\t\tp := (*uint64)(unsafe.Pointer(_c + uintptr(*(*uint64)(unsafe.Pointer(_c + 8))&uint64(18446744073709551614))))\n\t\t*p = *p | uint64(1)\n\t}\n}", "title": "" }, { "docid": "a4fd79af50c77c467748c185310917ff", "score": "0.4681386", "text": "func (*NokiaConf_Configure_Groups_Group_System_Security_Ssh_KeyReExchange_Client_Mbytes_Union_Uint32) Is_NokiaConf_Configure_Groups_Group_System_Security_Ssh_KeyReExchange_Client_Mbytes_Union() {\n}", "title": "" }, { "docid": "b89a04857ea130befbde989c5929f463", "score": "0.4679553", "text": "func (a BySecretKey) Len() int { return len(a) }", "title": "" }, { "docid": "360777e9751c2132f580f3713fda8533", "score": "0.46736905", "text": "func (*FileTransferRes) Len() uint8 {\n\treturn 9\n}", "title": "" }, { "docid": "66ce111e066ecbb9481b2d7215ced29c", "score": "0.4673469", "text": "func clearBytes(b []byte) {\n\tfor i := range b {\n\t\tb[i] = 0\n\t}\n}", "title": "" }, { "docid": "88037d492a59b5f717dbf7009a9f2314", "score": "0.4668327", "text": "func (q *quickXorHash) checkSum() (h [Size + 1]byte) {\n\tfor i := 0; i < dataSize; i++ {\n\t\tshift := (i * 11) % 160\n\t\tshiftBytes := shift / 8\n\t\tshiftBits := shift % 8\n\t\tshifted := int(q.data[i]) << shiftBits\n\t\th[shiftBytes] ^= byte(shifted)\n\t\th[shiftBytes+1] ^= byte(shifted >> 8)\n\t}\n\th[0] ^= h[20]\n\n\t// XOR the file length with the least significant bits in little endian format\n\td := q.size\n\th[Size-8] ^= byte(d >> (8 * 0))\n\th[Size-7] ^= byte(d >> (8 * 1))\n\th[Size-6] ^= byte(d >> (8 * 2))\n\th[Size-5] ^= byte(d >> (8 * 3))\n\th[Size-4] ^= byte(d >> (8 * 4))\n\th[Size-3] ^= byte(d >> (8 * 5))\n\th[Size-2] ^= byte(d >> (8 * 6))\n\th[Size-1] ^= byte(d >> (8 * 7))\n\n\treturn h\n}", "title": "" }, { "docid": "54a90ddb358f632151ae34d0b1d9279b", "score": "0.46650144", "text": "func corrupt(b []byte, n int, sz int) {\n\t// Take advatage of the fact that we know how the file is segmented and\n\t// sharded; introduce n errors in each segment.\n\tfor len(b) > 0 {\n\t\tif sz > len(b) {\n\t\t\t// Last time through\n\t\t\tsz = len(b)\n\t\t}\n\n\t\tfor i := 0; i < n; i++ {\n\t\t\toffset := rand.Intn(sz)\n\t\t\tv := b[offset]\n\t\t\tdelta := 1 + rand.Intn(254)\n\t\t\tb[offset] = byte((int(v) + delta) % 255)\n\t\t}\n\t\tb = b[sz:]\n\t}\n}", "title": "" }, { "docid": "ed23fcd03b4bdf30790f4bcaae860df4", "score": "0.4659319", "text": "func (fcr FileContractRevision) MarshalSiaSize() (size int) {\r\n\tsize += len(fcr.ParentID)\r\n\tsize += fcr.UnlockConditions.MarshalSiaSize()\r\n\tsize += 8 // NewRevisionNumber\r\n\tsize += 8 // NewFileSize\r\n\tsize += len(fcr.NewFileMerkleRoot)\r\n\tsize += 8 + 8 // NewWindowStart + NewWindowEnd\r\n\tsize += 8\r\n\tfor _, sco := range fcr.NewValidProofOutputs {\r\n\t\tsize += sco.Value.MarshalSiaSize()\r\n\t\tsize += len(sco.UnlockHash)\r\n\t}\r\n\tsize += 8\r\n\tfor _, sco := range fcr.NewMissedProofOutputs {\r\n\t\tsize += sco.Value.MarshalSiaSize()\r\n\t\tsize += len(sco.UnlockHash)\r\n\t}\r\n\tsize += len(fcr.NewUnlockHash)\r\n\treturn\r\n}", "title": "" }, { "docid": "b1424ddbf9254d5fcca57016db9470d9", "score": "0.465918", "text": "func (s *recvStream) reset(finalSize uint64) (int, error) {\n\tif s.fin {\n\t\tif finalSize != s.length {\n\t\t\treturn 0, errFinalSize\n\t\t}\n\t}\n\tif finalSize < s.length {\n\t\treturn 0, errFinalSize\n\t}\n\tn := int(finalSize - s.length)\n\ts.fin = true\n\ts.length = finalSize\n\treturn n, nil\n}", "title": "" }, { "docid": "fba0777812812fae67ee397db9d215e6", "score": "0.46584684", "text": "func (t *Duo) crc(data []byte) byte {\n\tsum := DuoHead + DuoSec + len(data) + 2\n\tfor _, d := range data {\n\t\tsum += int(d)\n\t}\n\n\treturn byte(0x100 - sum%0xFF)\n}", "title": "" }, { "docid": "fabf3805f55b31184d24ef633a6f0c7d", "score": "0.46568194", "text": "func (b ByteArray) Len() int {\n\treturn len(b)\n}", "title": "" }, { "docid": "dbe4b28ffdc439a933b9d229d9304a36", "score": "0.4653324", "text": "func sizeBytes(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {\r\n\tv := *p.Bytes()\r\n\treturn f.tagsize + protowire.SizeBytes(len(v))\r\n}", "title": "" }, { "docid": "46ab9f8fdfa2020bba02fe4f195d7e9c", "score": "0.46488607", "text": "func fiat_poly1305_from_bytes(out1 *[3]uint64, arg1 *[17]uint8) {\n var x1 uint64 = (uint64((arg1[16])) << 41)\n var x2 uint64 = (uint64((arg1[15])) << 33)\n var x3 uint64 = (uint64((arg1[14])) << 25)\n var x4 uint64 = (uint64((arg1[13])) << 17)\n var x5 uint64 = (uint64((arg1[12])) << 9)\n var x6 uint64 = (uint64((arg1[11])) * uint64(0x2))\n var x7 uint64 = (uint64((arg1[10])) << 36)\n var x8 uint64 = (uint64((arg1[9])) << 28)\n var x9 uint64 = (uint64((arg1[8])) << 20)\n var x10 uint64 = (uint64((arg1[7])) << 12)\n var x11 uint64 = (uint64((arg1[6])) << 4)\n var x12 uint64 = (uint64((arg1[5])) << 40)\n var x13 uint64 = (uint64((arg1[4])) << 32)\n var x14 uint64 = (uint64((arg1[3])) << 24)\n var x15 uint64 = (uint64((arg1[2])) << 16)\n var x16 uint64 = (uint64((arg1[1])) << 8)\n var x17 uint8 = (arg1[0])\n var x18 uint64 = (x16 + uint64(x17))\n var x19 uint64 = (x15 + x18)\n var x20 uint64 = (x14 + x19)\n var x21 uint64 = (x13 + x20)\n var x22 uint64 = (x12 + x21)\n var x23 uint64 = (x22 & 0xfffffffffff)\n var x24 uint8 = uint8((x22 >> 44))\n var x25 uint64 = (x11 + uint64(x24))\n var x26 uint64 = (x10 + x25)\n var x27 uint64 = (x9 + x26)\n var x28 uint64 = (x8 + x27)\n var x29 uint64 = (x7 + x28)\n var x30 uint64 = (x29 & 0x7ffffffffff)\n var x31 fiat_poly1305_uint1 = fiat_poly1305_uint1((x29 >> 43))\n var x32 uint64 = (x6 + uint64(x31))\n var x33 uint64 = (x5 + x32)\n var x34 uint64 = (x4 + x33)\n var x35 uint64 = (x3 + x34)\n var x36 uint64 = (x2 + x35)\n var x37 uint64 = (x1 + x36)\n out1[0] = x23\n out1[1] = x30\n out1[2] = x37\n}", "title": "" }, { "docid": "91d5f87299e530e50d504b2a31c67f0f", "score": "0.4648307", "text": "func (mk *MockStore) IncrementSubBytes(projectUUID string, name string, totalBytes int64) error {\n\tfor i, item := range mk.SubList {\n\t\tif item.ProjectUUID == projectUUID && item.Name == name {\n\t\t\tmk.SubList[i].TotalBytes += totalBytes\n\t\t\treturn nil\n\t\t}\n\t}\n\n\treturn errors.New(\"not found\")\n}", "title": "" }, { "docid": "dda68d8444ddab603e04f56ee92d1a57", "score": "0.4648108", "text": "func (w *bitWriter) WriteBytes(v []byte, n int) error {\n var err error\n for i := 0; i < n; i++ {\n if i < len(v) {\n err = w.w.WriteByte(v[i])\n } else {\n err = w.w.WriteByte(0)\n }\n if err != nil {\n return err\n }\n }\n return nil\n}", "title": "" }, { "docid": "61cd740f9744c35a87c681f61a60c756", "score": "0.46464014", "text": "func HammingDistanceByte(str1 []byte, str2 []byte) int {\n\tres := 0\n\tmlen := 0\n\tif len(str1) > len(str2) {\n\t\tmlen = len(str1)\n\t} else {\n\t\tmlen = len(str2)\n\t}\n\n\tfor i := 0; i < mlen; i++ {\n\t\tvar b1 byte\n\t\tvar b2 byte\n\t\tif i < len(str1) {\n\t\t\tb1 = str1[i]\n\t\t}\n\t\tif i < len(str2) {\n\t\t\tb2 = str2[i]\n\t\t}\n\t\tres += HammingDistance(b1, b2)\n\t}\n\treturn res\n}", "title": "" }, { "docid": "6d50709cd627f76a1da40db697cadfcb", "score": "0.46380377", "text": "func (t *Target) SendBytes(strs ...string) (int, error) {\n\tvar n int\n\tfor _, str := range strs {\n\t\tfor i := 0; i < len(str); i++ {\n\t\t\tv := int(str[i])\n\t\t\tif err := unix.IoctlSetPointerInt(int(t.f.Fd()), unix.TIOCSTI, v); err != nil {\n\t\t\t\treturn n, err\n\t\t\t}\n\t\t\tn++\n\t\t}\n\t\ttime.Sleep(t.d)\n\t}\n\treturn n, nil\n}", "title": "" }, { "docid": "f81f6aacea933e84fa5a8b6835d3c4c5", "score": "0.46326897", "text": "func (m Rlattach) Len() int { return 13 }", "title": "" }, { "docid": "10b126f2372e5fa367c82fecd6d80c17", "score": "0.46322364", "text": "func modulus2048() []byte {\n\tbytes := make([]byte, 256)\n\tfor i := 0; i < len(bytes); i++ {\n\t\tbytes[i] = 0xFD\n\t}\n\treturn bytes\n}", "title": "" }, { "docid": "facdc9e9c5d07f1efcf2963c07182288", "score": "0.4623879", "text": "func (bf *BitField) One() {\n\tbyteSize := int32(math.Ceil(float64(bf.Size) / 8.0))\n\tfor pos := int32(0); pos < byteSize; pos++ {\n\t\tbf.Bitfield[pos] = 0xff\n\t}\n}", "title": "" }, { "docid": "42936ed780ab4346dbc448b05f3a65d8", "score": "0.46208456", "text": "func kyoceraRequestBytes() []byte {\n\treturn []byte{\n\t\t0x30, 0x81,\n\t\t0x9e, 0x02, 0x01, 0x01, 0x04, 0x06, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63,\n\t\t0xa0, 0x81, 0x90, 0x02, 0x04, 0x6f, 0x8c, 0xee, 0x64, 0x02, 0x01, 0x00,\n\t\t0x02, 0x01, 0x00, 0x30, 0x81, 0x81, 0x30, 0x0c, 0x06, 0x08, 0x2b, 0x06,\n\t\t0x01, 0x02, 0x01, 0x01, 0x07, 0x00, 0x05, 0x00, 0x30, 0x0e, 0x06, 0x0a,\n\t\t0x2b, 0x06, 0x01, 0x02, 0x01, 0x02, 0x02, 0x01, 0x0a, 0x01, 0x05, 0x00,\n\t\t0x30, 0x0e, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x02, 0x01, 0x02, 0x02, 0x01,\n\t\t0x05, 0x01, 0x05, 0x00, 0x30, 0x0c, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x02,\n\t\t0x01, 0x01, 0x04, 0x00, 0x05, 0x00, 0x30, 0x0f, 0x06, 0x0b, 0x2b, 0x06,\n\t\t0x01, 0x02, 0x01, 0x2b, 0x05, 0x01, 0x01, 0x0f, 0x01, 0x05, 0x00, 0x30,\n\t\t0x11, 0x06, 0x0d, 0x2b, 0x06, 0x01, 0x02, 0x01, 0x04, 0x15, 0x01, 0x01,\n\t\t0x7f, 0x00, 0x00, 0x01, 0x05, 0x00, 0x30, 0x11, 0x06, 0x0d, 0x2b, 0x06,\n\t\t0x01, 0x04, 0x01, 0x17, 0x02, 0x05, 0x01, 0x01, 0x01, 0x04, 0x02, 0x05,\n\t\t0x00, 0x30, 0x0c, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x02, 0x01, 0x01, 0x03,\n\t\t0x00, 0x05, 0x00,\n\t}\n}", "title": "" }, { "docid": "55404e5fd9c444b54d83a5823f6954dd", "score": "0.4619698", "text": "func (u Uint) MarshalAmino() ([]byte, error) { return u.Marshal() }", "title": "" }, { "docid": "b01801a6eebb2df87dc477109ee0501a", "score": "0.4616844", "text": "func (d *IntegerDecoder) SetBytes(b []byte) {\n\tif len(b) > 0 {\n\t\td.encoding = b[0] >> 4\n\t\td.bytes = b[1:]\n\t} else {\n\t\td.encoding = 0\n\t\td.bytes = nil\n\t}\n\n\td.i = 0\n\td.n = 0\n\td.prev = 0\n\td.first = true\n\n\td.rleFirst = 0\n\td.rleDelta = 0\n\td.err = nil\n}", "title": "" }, { "docid": "49390511196350fe596d93065589723e", "score": "0.46154118", "text": "func reescribir(disco *mbr, path string) {\n\tfile, err := os.OpenFile(strings.ReplaceAll(path, \"\\\"\", \"\"), os.O_RDWR, os.ModeAppend)\n\tdefer file.Close()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t} else {\n\t\tfile.Seek(0, 0)\n\t\t//Escribiendo el MBR\n\t\tvar binario3 bytes.Buffer\n\t\tbinary.Write(&binario3, binary.BigEndian, disco)\n\t\twriteNextBytes(file, binario3.Bytes())\n\t}\n}", "title": "" }, { "docid": "ff1607b76a5afa5643d5d6f77c7cd338", "score": "0.4615216", "text": "func (m *Modulus) Bytes() []byte {\n\treturn m.nat.Bytes()\n}", "title": "" }, { "docid": "54102085e8c3c9cb0d26e1d1286f1fbe", "score": "0.4610156", "text": "func EncodedLen(n int) int { return n * tritsPerByte }", "title": "" } ]
e8285966e394c076ed39f00201d602cd
Fields allows partial responses to be retrieved. See for more information.
[ { "docid": "25ecae31b8aae4efe7df5687c0e9133c", "score": "0.0", "text": "func (c *AccountsContainersWorkspacesCreateCall) Fields(s ...googleapi.Field) *AccountsContainersWorkspacesCreateCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" } ]
[ { "docid": "c7a3be6a69975a80225d314827bc7c55", "score": "0.6794148", "text": "func GetAllFields(res http.ResponseWriter, req *http.Request) {\n\ttranslation.FieldsRequestLanguageCode = req.Header.Get(\"Content-Language\")\n\tresp := response.New()\n\n\tmetadata := response.Metadata{}\n\tif err := metadata.Load(req); err != nil {\n\t\tresp.NewError(\"GetLookupInstance metadata parse\", err)\n\t\tresp.Render(res, req)\n\t\treturn\n\t}\n\topt := metadata.GenerateDBOptions()\n\topt.AddCondition(builder.Equal(\"schema_code\", chi.URLParam(req, \"schema_code\")))\n\tfields := &field.Fields{}\n\tif err := fields.LoadAll(opt); err != nil {\n\t\tresp.NewError(\"GetAllFields\", err)\n\t\tresp.Render(res, req)\n\t\treturn\n\t}\n\tresp.Data = fields\n\tresp.Metadata = metadata\n\tresp.Render(res, req)\n}", "title": "" }, { "docid": "c78a71fad728541c42e2f36eabb9c78c", "score": "0.6571009", "text": "func (TaskResponse) Fields() []ent.Field {\n\treturn []ent.Field{\n\t\tfield.UUID(\"id\", uuid.UUID{}),\n\t\tfield.Time(\"at\").Default(func() time.Time {\n\t\t\treturn time.Now()\n\t\t}),\n\t\tfield.Time(\"lastChange\").Default(func() time.Time {\n\t\t\treturn time.Now()\n\t\t}),\n\t\tfield.Strings(\"observations\"),\n\t\tfield.Strings(\"meta\").Optional(),\n\t}\n}", "title": "" }, { "docid": "d1bc43c68693e0a569328494f9374aec", "score": "0.6527123", "text": "func (r *logpullReceivedResponse) Fields() (map[string]string, error) {\n\tvar fields map[string]string\n\tdata := r.Line()\n\terr := json.Unmarshal(data, &fields)\n\treturn fields, err\n}", "title": "" }, { "docid": "b63e75950f80da3ffebbce29a0ece09f", "score": "0.641031", "text": "func (o SegmentResponseOutput) Fields() pulumi.StringMapOutput {\n\treturn o.ApplyT(func(v SegmentResponse) map[string]string { return v.Fields }).(pulumi.StringMapOutput)\n}", "title": "" }, { "docid": "f2139fd7e9d5944410a050f0062210e3", "score": "0.6383858", "text": "func (e GetResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "3977f52a71ec209dca7ece7576d96d22", "score": "0.6370914", "text": "func (o TemplateParameterResponseOutput) Fields() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v TemplateParameterResponse) []string { return v.Fields }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "5a42c08467d47d69caa0c121aef84eb3", "score": "0.6339482", "text": "func (e VoidResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "b6b2219e75d174d2e1d0056aa1c24a51", "score": "0.6313317", "text": "func (c *FormsResponsesGetCall) Fields(s ...googleapi.Field) *FormsResponsesGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "888b5e3ac389ccd3aa486dc7d84f7a33", "score": "0.622063", "text": "func (s *WebService) GetFields() http.HandlerFunc {\n\n\tlogger := log.WithFields(log.Fields{\n\t\t\"event\": \"GetFields\",\n\t})\n\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\t\tfields, err := s.DB.Fields()\n\t\tif err != nil {\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\tjson.NewEncoder(w).Encode(&ErrorResponse{Message: \"Failed to get fields\"})\n\t\t\tlogger.WithFields(log.Fields{\n\t\t\t\t\"status\": 500,\n\t\t\t\t\"error\": err.Error(),\n\t\t\t}).Error(\"Failed to get fields\")\n\t\t\treturn\n\t\t}\n\n\t\tif len(fields) == 0 {\n\t\t\tlogger.WithFields(log.Fields{\n\t\t\t\t\"status\": 404,\n\t\t\t}).Info(\"No fields found\")\n\t\t\tw.WriteHeader(http.StatusNotFound)\n\t\t\tw.Write([]byte(\"[]\"))\n\t\t\treturn\n\t\t}\n\n\t\tlogger.WithFields(log.Fields{\n\t\t\t\"fieldCount\": len(fields),\n\t\t}).Info(\"Returning fields\")\n\t\tjson.NewEncoder(w).Encode(fields)\n\n\t}\n\n}", "title": "" }, { "docid": "4b3bbfa950f791470f2f0d9bd6e93d82", "score": "0.6205082", "text": "func (e ReadResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "19fbfc44f3d64bf5956ceefd54980178", "score": "0.61926025", "text": "func (c *AnalyzerresultGetCall) Fields(s ...googleapi.Field) *AnalyzerresultGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "c3d0164de6db948e0280a36e188e19c5", "score": "0.6182563", "text": "func (e OaResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "685af4b4159b649bf5d9d481095660cb", "score": "0.6149543", "text": "func (e FirstResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "bad2b35fb23749b68c0babad9a3a6858", "score": "0.61073107", "text": "func (e SecondRequest_BodyValidationError) Field() string { return e.field }", "title": "" }, { "docid": "f4c46d0e93a7ccca67e1d4e7c75eae9b", "score": "0.6106155", "text": "func returnField(w http.ResponseWriter, r *http.Request) {\n\n\tvars := mux.Vars(r)\n\n\t// set response type for http header\n\thttp.Header.Add(w.Header(), \"content-type\", \"application/json\")\n\n\tigcStruct, ok := MgoTrackDB.getMetaByID(vars[\"ID\"])\n\tif !ok {\n\t\tfmt.Println(\"from not found\")\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\treturn\n\t}\n\n\tswitch vars[\"field\"] {\n\tcase \"pilot\":\n\t\tfmt.Fprintln(w, igcStruct.Pilot)\n\tcase \"h_date\":\n\t\tfmt.Fprintln(w, igcStruct.HDate)\n\tcase \"glider\":\n\t\tfmt.Fprintln(w, igcStruct.Glider)\n\tcase \"glider_id\":\n\t\tfmt.Fprintln(w, igcStruct.GliderID)\n\tcase \"track_length\":\n\t\tfmt.Fprintln(w, igcStruct.TrackLength)\n\t}\n\n}", "title": "" }, { "docid": "9eec794e6a5e3ac20da8222849644913", "score": "0.61012477", "text": "func (e ThirdResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "d480eaa7bbe0c2ca485e88b0afd107f1", "score": "0.60799474", "text": "func (c *RepliesGetCall) Fields(s ...googleapi.Field) *RepliesGetCall {\n\tc.params_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "3727af074bc50bad5632e251ba67cd16", "score": "0.6073441", "text": "func (c *TestresultGetCall) Fields(s ...googleapi.Field) *TestresultGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "f04dec00aef9e17287c9b32c0df7a648", "score": "0.60687196", "text": "func (ps *PageService) Fields() ([]string, error) {\n\tf, err := ps.client.getFields(ps.end)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"cannot get Page fields\")\n\t}\n\n\treturn f, nil\n}", "title": "" }, { "docid": "5bcc1ff600ea348e1082744b1e7399fd", "score": "0.6068709", "text": "func (e DictionaryResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "e1259052f4bdf8e65970111c7651986f", "score": "0.60681736", "text": "func (c *ReturnpolicyGetCall) Fields(s ...googleapi.Field) *ReturnpolicyGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "8121e812443e05f245f8b3ad6fa64bf2", "score": "0.6056894", "text": "func (e AvailableRespValidationError) Field() string { return e.field }", "title": "" }, { "docid": "432a46e3be308c75e368e9d054b472d7", "score": "0.60463554", "text": "func (e PageResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "52a65410caa800c124111c6c9fc4a85c", "score": "0.6041515", "text": "func (c *ImagerequestGetCall) Fields(s ...googleapi.Field) *ImagerequestGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "3adfbeb19ced0a535b7349c97824a66d", "score": "0.6022942", "text": "func (e DictionaryListResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "94bffd60ed1fe2a567e8a706839d6723", "score": "0.60090476", "text": "func (e *goof) Fields() map[string]interface{} {\n\treturn e.data\n}", "title": "" }, { "docid": "dde18fa426624c244ff4d959603b01ba", "score": "0.60040414", "text": "func (c *BuildattemptGetCall) Fields(s ...googleapi.Field) *BuildattemptGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "20b25d68e6881201a9fa77d2fc0a27be", "score": "0.6003656", "text": "func (o *BlobInfoResponse) GetFields() map[string]uint32 {\n\tif o == nil {\n\t\tvar ret map[string]uint32\n\t\treturn ret\n\t}\n\n\treturn o.Fields\n}", "title": "" }, { "docid": "7dd191eb3bb0648a034532fe6e798e4f", "score": "0.5990733", "text": "func (c *AnalyzerfindingGetCall) Fields(s ...googleapi.Field) *AnalyzerfindingGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "75ee658ab681140bf12afb7465e0af42", "score": "0.5987758", "text": "func (e FirstRequest_BodyValidationError) Field() string { return e.field }", "title": "" }, { "docid": "812e92422a5465034866948c2f0b2021", "score": "0.5975239", "text": "func (e GetListViewResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "fb78a22c153fd3c7577d536cda97677c", "score": "0.59670824", "text": "func (e ThirdRequest_BodyValidationError) Field() string { return e.field }", "title": "" }, { "docid": "1b0bb300c613725adcaf865111f209a0", "score": "0.59612125", "text": "func (o TypeResponseOutput) Fields() FieldResponseArrayOutput {\n\treturn o.ApplyT(func(v TypeResponse) []FieldResponse { return v.Fields }).(FieldResponseArrayOutput)\n}", "title": "" }, { "docid": "fda173640b488ce3ce5083eb477ccdc8", "score": "0.5934214", "text": "func (c *LiasettingsGetCall) Fields(s ...googleapi.Field) *LiasettingsGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "4b059c46a79d9436e091f1e4f3d6e430", "score": "0.59295833", "text": "func (u User) Fields() (map[string]interface{}, error) {\n\treturn mapper.MapFrom(\"json\", &u)\n}", "title": "" }, { "docid": "7bcfb8c8dfc5d5d30d823de503b48b35", "score": "0.59263635", "text": "func (c *FormsResponsesListCall) Fields(s ...googleapi.Field) *FormsResponsesListCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "8ba60992cc112621c6f1c7a07aeee75a", "score": "0.5923463", "text": "func (e ProductsResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "12519b54f8216b5080ddbe5739de334e", "score": "0.5915093", "text": "func (c *ChangesetspecGetCall) Fields(s ...googleapi.Field) *ChangesetspecGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "a5160b7f7f559f7f5abd24b78af9161d", "score": "0.5903294", "text": "func (m *ListItemItemRequestBuilder) Fields()(*i7845b489557cfe1fb7da17a394e937d94c0ce4e9dca71a3368a3efc8e07926da.FieldsRequestBuilder) {\n return i7845b489557cfe1fb7da17a394e937d94c0ce4e9dca71a3368a3efc8e07926da.NewFieldsRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "title": "" }, { "docid": "7e4f36ba9c68d580b7e47d071b5fbc47", "score": "0.5901389", "text": "func (e ProductResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "a2cfe4b30143a124fb2bb070066652e2", "score": "0.5895396", "text": "func (c *ReturnaddressGetCall) Fields(s ...googleapi.Field) *ReturnaddressGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "5d7b21773b040966afc8cfd59d655603", "score": "0.5881756", "text": "func (e GetUsersRespValidationError) Field() string { return e.field }", "title": "" }, { "docid": "7884a5b710c4acf3d73992c2f2fe0462", "score": "0.5876833", "text": "func (e ResponseFileMetadataValidationError) Field() string { return e.field }", "title": "" }, { "docid": "01a69de84ae7b4a529f280bab42734e2", "score": "0.58746994", "text": "func (c *FirstAndThirdPartyAudiencesGetCall) Fields(s ...googleapi.Field) *FirstAndThirdPartyAudiencesGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "f5d2dba8309ecee67ddd09f7d6f2017f", "score": "0.58725005", "text": "func (e HttpGenericBodyMatchValidationError) Field() string { return e.field }", "title": "" }, { "docid": "80d5b84226e05fdd3d6e656b507dcc03", "score": "0.5868028", "text": "func (c *LabelGetCall) Fields(s ...googleapi.Field) *LabelGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "d9ca9b8f53eadfe9edd28169f1519309", "score": "0.58667773", "text": "func (e GatewayKasResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "3fccc6c5806bcef8f769d2e3090654fc", "score": "0.5865121", "text": "func (c *OperationsGetCall) Fields(s ...googleapi.Field) *OperationsGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "3fccc6c5806bcef8f769d2e3090654fc", "score": "0.5865121", "text": "func (c *OperationsGetCall) Fields(s ...googleapi.Field) *OperationsGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "3fccc6c5806bcef8f769d2e3090654fc", "score": "0.5865121", "text": "func (c *OperationsGetCall) Fields(s ...googleapi.Field) *OperationsGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "9766b3321204f44cd4505acba42a52ec", "score": "0.586512", "text": "func (e VersionResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "44d35d8bf2cabde6032361e1a29ed3c8", "score": "0.5863881", "text": "func (c *MessageGetCall) Fields(s ...googleapi.Field) *MessageGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "ec6a7a77a6a1bb760398fd874185a140", "score": "0.5858017", "text": "func (c *AboutGetCall) Fields(s ...googleapi.Field) *AboutGetCall {\n\tc.params_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "ceb7c31f7f31977bc88d7a13c3b9f118", "score": "0.58579445", "text": "func (e UploadResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "a13ecec478ec3dd147d156992660c874", "score": "0.585756", "text": "func (b *FriendsGetBuilder) Fields(v []string) *FriendsGetBuilder {\n\tb.Params[\"fields\"] = v\n\treturn b\n}", "title": "" }, { "docid": "c84f8c80e9b60cb6f7b9e5006f5b67b3", "score": "0.58574814", "text": "func (c *MachineGetCall) Fields(s ...googleapi.Field) *MachineGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "e6e58e93f256a134422775c64a705343", "score": "0.58568364", "text": "func (i Failure) Fields() []interface{} {\n\treturn []interface{}{i.Metadata}\n}", "title": "" }, { "docid": "bc1316d15195c605b88f11bcf5851b3c", "score": "0.58485556", "text": "func (c *AdminGetCall) Fields(s ...googleapi.Field) *AdminGetCall {\n\tc.opt_[\"fields\"] = googleapi.CombineFields(s)\n\treturn c\n}", "title": "" }, { "docid": "6218dce5281b5afa0e08f108073a1ac9", "score": "0.58453053", "text": "func (e CallbackResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "cad3f93399f33aef36a9a062a56a1d94", "score": "0.58422947", "text": "func (e RetrieveMyCalendarsResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "49a33335ea5bacaa5570682d92fb35fd", "score": "0.58375907", "text": "func (e ProductDetailsResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "c9957300d6e1ca7ff92c158b8d0e84e7", "score": "0.5825307", "text": "func (c *WorkplanGetCall) Fields(s ...googleapi.Field) *WorkplanGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "4a8bc73d4b89948afe64571a1d6bb2a3", "score": "0.5815921", "text": "func (c *InspectOperationsGetCall) Fields(s ...googleapi.Field) *InspectOperationsGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "819775aee2578fea7be74e5ffd31772f", "score": "0.5814647", "text": "func (c *ReturnpolicyonlineGetCall) Fields(s ...googleapi.Field) *ReturnpolicyonlineGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "8736b6fef27cf8c62d9d0f2c1dfa170f", "score": "0.58117133", "text": "func (o DiagnosticResponseOutput) Field() pulumi.StringOutput {\n\treturn o.ApplyT(func(v DiagnosticResponse) string { return v.Field }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "296637dc69b4e48c179da5161a69dcf6", "score": "0.5809334", "text": "func (BasePage) Fields(c context.Context) ([]Field, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "4c23cff43e0bacae781fa06709be13e7", "score": "0.5806648", "text": "func (c *ApplicationDetailServiceGetApkDetailsCall) Fields(s ...googleapi.Field) *ApplicationDetailServiceGetApkDetailsCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "d5336b146cd10fd51807355f721cca7a", "score": "0.58035344", "text": "func (c *PrebuiltfileGetCall) Fields(s ...googleapi.Field) *PrebuiltfileGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "96e0e070153bc52bcc40ab79949d8817", "score": "0.5803087", "text": "func (o GoogleCloudDataplexV1SchemaSchemaFieldResponseOutput) Fields() GoogleCloudDataplexV1SchemaSchemaFieldResponseArrayOutput {\n\treturn o.ApplyT(func(v GoogleCloudDataplexV1SchemaSchemaFieldResponse) []GoogleCloudDataplexV1SchemaSchemaFieldResponse {\n\t\treturn v.Fields\n\t}).(GoogleCloudDataplexV1SchemaSchemaFieldResponseArrayOutput)\n}", "title": "" }, { "docid": "366f6c1413effc19a212a820472cd73c", "score": "0.5802388", "text": "func (c *PromotionsGetCall) Fields(s ...googleapi.Field) *PromotionsGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "42ed323550d29a14a54764d7fbc76f85", "score": "0.58022743", "text": "func (e WorkflowsResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "d9b4f0a581e52c85b292456bbd8b0765", "score": "0.58010876", "text": "func (e GetSurveysResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "7861122d390a182d256746abf26cc651", "score": "0.5800293", "text": "func (Patient) Fields() []ent.Field {\n return []ent.Field{\n field.String(\"Patient_Name\").NotEmpty(),\n field.String(\"Patient_Age\").NotEmpty(),\n field.String(\"Patient_Weight\").NotEmpty(),\n field.String(\"Patient_Height\").NotEmpty(),\n field.String(\"Patient_Prefix\").NotEmpty(),\n field.String(\"Patient_Gender\").NotEmpty(),\n field.String(\"Patient_Blood\").NotEmpty(),\n }\n }", "title": "" }, { "docid": "071d9b4e3931206963f953d0318c34e3", "score": "0.5799396", "text": "func (e GetAmiiboResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "b26a41b72afc173e98485ed88c0839e4", "score": "0.5796548", "text": "func (c *AccessPoliciesGetIamPolicyCall) Fields(s ...googleapi.Field) *AccessPoliciesGetIamPolicyCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "b1ffefcd159e8e485530b45d5f37d82c", "score": "0.57964987", "text": "func (c *StateGetCall) Fields(s ...googleapi.Field) *StateGetCall {\n\tc.opt_[\"fields\"] = googleapi.CombineFields(s)\n\treturn c\n}", "title": "" }, { "docid": "c1d4ea31b6f3f80242eb86af9aa8530d", "score": "0.57954437", "text": "func (c *FreelistingsprogramGetCall) Fields(s ...googleapi.Field) *FreelistingsprogramGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "59da4d91ec48372a4ca55214c9b95b29", "score": "0.5789092", "text": "func (e GetByIDsReqValidationError) Field() string { return e.field }", "title": "" }, { "docid": "b08b482d3e82bcb7316ff08cf79b5b40", "score": "0.5783014", "text": "func (e ListRespValidationError) Field() string { return e.field }", "title": "" }, { "docid": "b08b482d3e82bcb7316ff08cf79b5b40", "score": "0.5783014", "text": "func (e ListRespValidationError) Field() string { return e.field }", "title": "" }, { "docid": "6c0ccb6742d271c83f16a6970862abe2", "score": "0.5778716", "text": "func (e ProductOptionsResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "d5e4a7d992863feeae2b64b5116da6d3", "score": "0.5778526", "text": "func (e GetProviderRespValidationError) Field() string { return e.field }", "title": "" }, { "docid": "1b21a10d01ec6e0edd7b7adfff3965dc", "score": "0.5774795", "text": "func (e CounterfeitedProductsResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "4de7bb443414e672d0260e948f30f3c2", "score": "0.5770505", "text": "func (c *AnalyzerresultPatchCall) Fields(s ...googleapi.Field) *AnalyzerresultPatchCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "9d70ff9acaaa24aba95f4072368396ec", "score": "0.5763614", "text": "func (c *AdvertisersGetCall) Fields(s ...googleapi.Field) *AdvertisersGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "c3fa56b8fd3f746c137da6377f8856af", "score": "0.57633", "text": "func (c *LiensGetCall) Fields(s ...googleapi.Field) *LiensGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "c3fa56b8fd3f746c137da6377f8856af", "score": "0.57633", "text": "func (c *LiensGetCall) Fields(s ...googleapi.Field) *LiensGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "737698b13f400bcd5f2d6efaebd989e7", "score": "0.575594", "text": "func (e ListArchivalEntriesResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "055377153a7b00df0b54268577fc7ed2", "score": "0.57546055", "text": "func (e ListPodsResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "b67dcdf5e655758566fdbe62038794f6", "score": "0.5748893", "text": "func (c *OrderreturnsGetCall) Fields(s ...googleapi.Field) *OrderreturnsGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "20a034eb911cbc6e5a21f88ba015d452", "score": "0.5748744", "text": "func (e SearchServicesResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "94df1ed1c72db82d647fb3c6f405b08f", "score": "0.57483256", "text": "func (e LoginResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "28f257269def99dce2193363adf133b1", "score": "0.57477784", "text": "func (e CreateResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "1862217f3dcaea3b45d36d21a69d2c1d", "score": "0.57441366", "text": "func (c *ContentInspectCall) Fields(s ...googleapi.Field) *ContentInspectCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "70b6f0b98b35ab4b3f10442e4cd620ac", "score": "0.5741497", "text": "func (e ProductAggregationProductViewDetailsResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "6ad168c7663ae0eddcc38ec0aebe7606", "score": "0.5740098", "text": "func (c *DeviceblobGetCall) Fields(s ...googleapi.Field) *DeviceblobGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "8340d913e917038803fd608b3e373cba", "score": "0.5739625", "text": "func (c *SoftwareGetCall) Fields(s ...googleapi.Field) *SoftwareGetCall {\n\tc.urlParams_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" }, { "docid": "c63e438333efbf99c58e0557f7c6e714", "score": "0.5737158", "text": "func (e OverdeployedProductsResponseValidationError) Field() string { return e.field }", "title": "" }, { "docid": "212c0549f570ef3ff8179a3264e6e7dd", "score": "0.5736908", "text": "func (User) Fields() []ent.Field {\n\treturn []ent.Field{\n\t\tfield.Int64(\"id\").StructTag(`json:\"ID\"`),\n\t\tfield.String(\"user_name\").StructTag(`json:\"UserName\"`),\n\t\tfield.String(\"full_name\").StructTag(`json:\"FullName\"`),\n\t\tfield.String(\"city\").StructTag(`json:\"City\"`),\n\t\tfield.Time(\"birth_date\").StructTag(`json:\"BirthDate\"`),\n\t\tfield.String(\"department\").StructTag(`json:\"Department\"`),\n\t\tfield.String(\"gender\").StructTag(`json:\"Gender\"`),\n\t\tfield.Int(\"experience_years\").StructTag(`json:\"ExperienceYears\"`).Positive(),\n\t}\n}", "title": "" }, { "docid": "2ba09e38e2e930dbe20a1ad5753fbd77", "score": "0.5735599", "text": "func (e GetDeviceRespValidationError) Field() string { return e.field }", "title": "" }, { "docid": "3ae34bd5ed91d6da3aa374551eae5c53", "score": "0.5732245", "text": "func (c *PropertiesGetCall) Fields(s ...googleapi.Field) *PropertiesGetCall {\n\tc.params_.Set(\"fields\", googleapi.CombineFields(s))\n\treturn c\n}", "title": "" } ]
f9f8cce9246ba65b86160b9283314ada
WithDir adds the dir to the query directory params
[ { "docid": "ccb5098620a09c211ab60f787703b0f2", "score": "0.7474844", "text": "func (o *QueryDirectoryParams) WithDir(dir *string) *QueryDirectoryParams {\n\to.SetDir(dir)\n\treturn o\n}", "title": "" } ]
[ { "docid": "3da246528f9079424ca99b719c277fe1", "score": "0.697171", "text": "func WithDir(dir string) Option {\n\treturn func(r *Options) error {\n\t\tr.dir = &dir\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "111b41be7f3eecfb23195f046bca28c4", "score": "0.66269016", "text": "func (o *QueryDirectoryParams) SetDir(dir *string) {\n\to.Dir = dir\n}", "title": "" }, { "docid": "05819bfd88ab816ab61d87323c8188eb", "score": "0.6330293", "text": "func Directory(path string) Opt {\n\treturn func(p *params) { p.dir = path }\n}", "title": "" }, { "docid": "80b767eb22a6d92b1ae8ae42ad219bce", "score": "0.62394565", "text": "func Dir(dir string) (queries map[string]QuerySet, err error) {\n\tvar files []File\n\tif files, err = DirOrdered(dir); err != nil {\n\t\treturn\n\t}\n\n\tqueries = make(map[string]QuerySet, len(files))\n\tfor _, f := range files {\n\t\tqueries[f.Name] = make(QuerySet, len(f.Items))\n\n\t\tfor _, i := range f.Items {\n\t\t\tqueries[f.Name][i.Name] = i.Query\n\t\t}\n\t}\n\n\treturn queries, nil\n}", "title": "" }, { "docid": "79a813004932d009d827be8d5ac5fb6c", "score": "0.59939575", "text": "func (o *QueryDirectoryParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\tif o.DirectoryQuery != nil {\n\t\tif err := r.SetBodyParam(o.DirectoryQuery); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param QueryPath\n\tif err := r.SetPathParam(\"QueryPath\", o.QueryPath); err != nil {\n\t\treturn err\n\t}\n\n\tif o.Detail != nil {\n\n\t\t// query param detail\n\t\tvar qrDetail string\n\t\tif o.Detail != nil {\n\t\t\tqrDetail = *o.Detail\n\t\t}\n\t\tqDetail := qrDetail\n\t\tif qDetail != \"\" {\n\t\t\tif err := r.SetQueryParam(\"detail\", qDetail); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Dir != nil {\n\n\t\t// query param dir\n\t\tvar qrDir string\n\t\tif o.Dir != nil {\n\t\t\tqrDir = *o.Dir\n\t\t}\n\t\tqDir := qrDir\n\t\tif qDir != \"\" {\n\t\t\tif err := r.SetQueryParam(\"dir\", qDir); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Hidden != nil {\n\n\t\t// query param hidden\n\t\tvar qrHidden bool\n\t\tif o.Hidden != nil {\n\t\t\tqrHidden = *o.Hidden\n\t\t}\n\t\tqHidden := swag.FormatBool(qrHidden)\n\t\tif qHidden != \"\" {\n\t\t\tif err := r.SetQueryParam(\"hidden\", qHidden); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Limit != nil {\n\n\t\t// query param limit\n\t\tvar qrLimit int64\n\t\tif o.Limit != nil {\n\t\t\tqrLimit = *o.Limit\n\t\t}\n\t\tqLimit := swag.FormatInt64(qrLimit)\n\t\tif qLimit != \"\" {\n\t\t\tif err := r.SetQueryParam(\"limit\", qLimit); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.MaxDepth != nil {\n\n\t\t// query param max-depth\n\t\tvar qrMaxDepth int64\n\t\tif o.MaxDepth != nil {\n\t\t\tqrMaxDepth = *o.MaxDepth\n\t\t}\n\t\tqMaxDepth := swag.FormatInt64(qrMaxDepth)\n\t\tif qMaxDepth != \"\" {\n\t\t\tif err := r.SetQueryParam(\"max-depth\", qMaxDepth); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\t// query param query\n\tqrQuery := o.Query\n\tqQuery := swag.FormatBool(qrQuery)\n\tif qQuery != \"\" {\n\t\tif err := r.SetQueryParam(\"query\", qQuery); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif o.Resume != nil {\n\n\t\t// query param resume\n\t\tvar qrResume string\n\t\tif o.Resume != nil {\n\t\t\tqrResume = *o.Resume\n\t\t}\n\t\tqResume := qrResume\n\t\tif qResume != \"\" {\n\t\t\tif err := r.SetQueryParam(\"resume\", qResume); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Sort != nil {\n\n\t\t// query param sort\n\t\tvar qrSort string\n\t\tif o.Sort != nil {\n\t\t\tqrSort = *o.Sort\n\t\t}\n\t\tqSort := qrSort\n\t\tif qSort != \"\" {\n\t\t\tif err := r.SetQueryParam(\"sort\", qSort); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Type != nil {\n\n\t\t// query param type\n\t\tvar qrType string\n\t\tif o.Type != nil {\n\t\t\tqrType = *o.Type\n\t\t}\n\t\tqType := qrType\n\t\tif qType != \"\" {\n\t\t\tif err := r.SetQueryParam(\"type\", qType); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4967ec3b2924a843c49a89c443a1b788", "score": "0.5882074", "text": "func (o *QueryDirectoryParams) WithQuery(query bool) *QueryDirectoryParams {\n\to.SetQuery(query)\n\treturn o\n}", "title": "" }, { "docid": "2f0270a0acf4197d53db286034024ac6", "score": "0.5852537", "text": "func (e *HTMLApplet) Dir(v string) *HTMLApplet {\n\te.a[\"dir\"] = v\n\treturn e\n}", "title": "" }, { "docid": "44686caf4268f8576b9e1ddd6de883e5", "score": "0.58095396", "text": "func Dir(d string) Option {\n\treturn func(c *Config) Option {\n\t\tprevious := c.Dir\n\t\tc.Dir = d\n\t\treturn Dir(previous)\n\t}\n}", "title": "" }, { "docid": "f0b8c37f023b905dce7651de4c26fbc9", "score": "0.55211484", "text": "func NewQueryDirectoryParams() *QueryDirectoryParams {\n\tvar ()\n\treturn &QueryDirectoryParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "b963b61d4a0707b1fa1469dea2ffbb17", "score": "0.552031", "text": "func (o *QueryDirectoryParams) WithContext(ctx context.Context) *QueryDirectoryParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "ce085d21c8e582f5bfc877846f5fe66f", "score": "0.5517891", "text": "func WithFilesDir(val string) Option {\n\treturn func(o *Options) {\n\t\to.FilesDir = val\n\t}\n}", "title": "" }, { "docid": "7b09f32ebdac4e2f985b5a942cee6cf9", "score": "0.5492253", "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": "97d23c97a9b0256ad10445bd2ee4f243", "score": "0.546891", "text": "func WithWorkDir(v string) (p Pair) {\n\treturn Pair{Key: \"work_dir\", Value: v}\n}", "title": "" }, { "docid": "e4dbc2bb9b3b080e8b07cb6a844de8f3", "score": "0.5388983", "text": "func (*XMLDocument) SetDir(dir string) {\n\tmacro.Rewrite(\"$_.dir = $1\", dir)\n}", "title": "" }, { "docid": "c95013388cfdad5b89e8d969296e2246", "score": "0.5361481", "text": "func NewQueryDirectoryParamsWithHTTPClient(client *http.Client) *QueryDirectoryParams {\n\tvar ()\n\treturn &QueryDirectoryParams{\n\t\tHTTPClient: client,\n\t}\n}", "title": "" }, { "docid": "35f05924bebef73ee48c6747be4517fb", "score": "0.5283768", "text": "func (o *QueryDirectoryParams) WithHidden(hidden *bool) *QueryDirectoryParams {\n\to.SetHidden(hidden)\n\treturn o\n}", "title": "" }, { "docid": "cd457b0f3b46fcf9da7c7eb96eaec994", "score": "0.5274833", "text": "func (e *HTMLTableRow) Dir(v string) *HTMLTableRow {\n\te.a[\"dir\"] = v\n\treturn e\n}", "title": "" }, { "docid": "cc880cf2507bfaaae86b42b7cefcf4cf", "score": "0.52619296", "text": "func (c *CmdReal) SetDir(dir string) {\n\tc.cmd.Dir = dir\n}", "title": "" }, { "docid": "e9991df6ea85d02b0baebc39a03f03e7", "score": "0.5209441", "text": "func (tr *NormalizingTarReader) PrependDir(dir string) {\n\ttr.headerOpts = append(tr.headerOpts, func(hdr *tar.Header) *tar.Header {\n\t\t// Suppress gosec check for zip slip vulnerability, as we set dir in our code.\n\t\t// #nosec G305\n\t\thdr.Name = filepath.Join(dir, hdr.Name)\n\t\treturn hdr\n\t})\n}", "title": "" }, { "docid": "949f031b1587c006909387354094d58a", "score": "0.513638", "text": "func (tp *Template) Dir(path string) *Template {\n\ttp.dir = path\n\treturn tp\n}", "title": "" }, { "docid": "c0dac90618c7279e9c0c78006275a62f", "score": "0.5135367", "text": "func (f *Fs) addDir(entries *fs.DirEntries, dir fs.Directory) {\n\t*entries = append(*entries, f.newDir(dir))\n}", "title": "" }, { "docid": "210ede702d79a34a346e3325b8589662", "score": "0.51261365", "text": "func Dir(useLocal bool, name string) http.FileSystem {\n\tif useLocal {\n\t\treturn _escDirectory{fs: _escLocal, name: name}\n\t}\n\treturn _escDirectory{fs: _escStatic, name: name}\n}", "title": "" }, { "docid": "210ede702d79a34a346e3325b8589662", "score": "0.51261365", "text": "func Dir(useLocal bool, name string) http.FileSystem {\n\tif useLocal {\n\t\treturn _escDirectory{fs: _escLocal, name: name}\n\t}\n\treturn _escDirectory{fs: _escStatic, name: name}\n}", "title": "" }, { "docid": "210ede702d79a34a346e3325b8589662", "score": "0.51261365", "text": "func Dir(useLocal bool, name string) http.FileSystem {\n\tif useLocal {\n\t\treturn _escDirectory{fs: _escLocal, name: name}\n\t}\n\treturn _escDirectory{fs: _escStatic, name: name}\n}", "title": "" }, { "docid": "210ede702d79a34a346e3325b8589662", "score": "0.51261365", "text": "func Dir(useLocal bool, name string) http.FileSystem {\n\tif useLocal {\n\t\treturn _escDirectory{fs: _escLocal, name: name}\n\t}\n\treturn _escDirectory{fs: _escStatic, name: name}\n}", "title": "" }, { "docid": "210ede702d79a34a346e3325b8589662", "score": "0.51261365", "text": "func Dir(useLocal bool, name string) http.FileSystem {\n\tif useLocal {\n\t\treturn _escDirectory{fs: _escLocal, name: name}\n\t}\n\treturn _escDirectory{fs: _escStatic, name: name}\n}", "title": "" }, { "docid": "baa107c42a747d2c0ff0447727fe1cff", "score": "0.50972664", "text": "func WithDirectory(d string) ProcessorOption {\n\treturn func(p *DeliveryConfigProcessor) {\n\t\tp.dirName = d\n\t}\n}", "title": "" }, { "docid": "ccdd36a7c98e1f091debf4b7d32a0dbb", "score": "0.5097215", "text": "func DirFilter() Filter {\n\treturn dirFilter{}\n}", "title": "" }, { "docid": "895f00d5642d37d1d23cfa73b674c54b", "score": "0.50798905", "text": "func (cmd Cmd) In(dir string) Cmd {\n\tcmd.Dir = dir\n\treturn cmd\n}", "title": "" }, { "docid": "ca5b5a7dbb1ef0021b3c8e77b2ad43a0", "score": "0.5054818", "text": "func ApplyDir(dir Dir) {\n\tapplyDir(dir, \"\")\n}", "title": "" }, { "docid": "bc4016fbd384cec50e115595f6f0f6ae", "score": "0.5050753", "text": "func NewDirectoryRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*DirectoryRequestBuilder) {\n m := &DirectoryRequestBuilder{\n }\n m.urlTemplate = \"{+baseurl}/roleManagement/directory{?%24select,%24expand}\";\n urlTplParams := make(map[string]string)\n for idx, item := range pathParameters {\n urlTplParams[idx] = item\n }\n m.pathParameters = urlTplParams;\n m.requestAdapter = requestAdapter;\n return m\n}", "title": "" }, { "docid": "39c22f19d268f7a3636571ed97eb39fd", "score": "0.5027423", "text": "func WithStoreDirectory(value string) Option {\n\treturn func(store *Store) {\n\t\tstore.DataDirectory = value\n\t}\n}", "title": "" }, { "docid": "945f9ca38cd8aa1a80b066de90816213", "score": "0.50199336", "text": "func (t *DataProcessorTask) SetInputDir(dir ...string) *DataProcessorTask {\n\treturn t.Set(InputDirs, dir...)\n}", "title": "" }, { "docid": "fb8774bd3f3d02061c02fd3dabd7607c", "score": "0.50137836", "text": "func WithSpecDirs(specDirs ...string) Option {\n\treturn func(b *builder) {\n\t\tb.specDirs = specDirs\n\t}\n}", "title": "" }, { "docid": "0058f64a7a7f665265f17ac0ce605247", "score": "0.50129265", "text": "func Dir(useLocal bool, name string) http.FileSystem {\n\tif useLocal {\n\t\treturn _escDir{fs: _escLocal, name: name}\n\t}\n\treturn _escDir{fs: _escStatic, name: name}\n}", "title": "" }, { "docid": "0058f64a7a7f665265f17ac0ce605247", "score": "0.50129265", "text": "func Dir(useLocal bool, name string) http.FileSystem {\n\tif useLocal {\n\t\treturn _escDir{fs: _escLocal, name: name}\n\t}\n\treturn _escDir{fs: _escStatic, name: name}\n}", "title": "" }, { "docid": "0058f64a7a7f665265f17ac0ce605247", "score": "0.50129265", "text": "func Dir(useLocal bool, name string) http.FileSystem {\n\tif useLocal {\n\t\treturn _escDir{fs: _escLocal, name: name}\n\t}\n\treturn _escDir{fs: _escStatic, name: name}\n}", "title": "" }, { "docid": "a023a3d4d644bab49b82a4cf27fdbbfe", "score": "0.5009571", "text": "func (o *QueryDirectoryParams) WithDirectoryQuery(directoryQuery *models.DirectoryQuery) *QueryDirectoryParams {\n\to.SetDirectoryQuery(directoryQuery)\n\treturn o\n}", "title": "" }, { "docid": "e1f554d4de72eb8c1356e16a46594840", "score": "0.5005423", "text": "func ServeDir(dir string) router.Handle {\n\treturn func(w http.ResponseWriter, r *http.Request, params router.Params) {\n\t\tfs := http.FileServer(http.Dir(dir))\n\t\tfs.ServeHTTP(w, r)\n\t}\n}", "title": "" }, { "docid": "b577bdd6443cd168fd8e34307f3e9d16", "score": "0.5000978", "text": "func NewDir(dir string) http.Handler {\n\treturn New(Config{Dir: dir})\n}", "title": "" }, { "docid": "97765641a8413541481242a090fc656c", "score": "0.4965742", "text": "func (t *DataProcessorTask) AddInputDir(dir ...string) *DataProcessorTask {\n\treturn t.Add(InputDirs, dir...)\n}", "title": "" }, { "docid": "907ece777b37a1c31d34cca40081603d", "score": "0.49610862", "text": "func Dir(attrs []htmlgo.Attribute, children ...HTML) HTML {\n\treturn &htmlgo.Tree{Tag: \"dir\", Attributes: attrs, Children: children}\n}", "title": "" }, { "docid": "e0fdb526d05f16850f8f47be7d4238c6", "score": "0.495451", "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": "168b8eebc92dd55226f85013f6016fd5", "score": "0.49451214", "text": "func ServeDir(dname string) func(*Request, *Response) {\n\t// collect stats and confirm is-dir\n\tstatFile(dname, true)\n\tfiles := walkDir(dname)\n\t// create muxer for all files given\n\tmux := NewServeMux()\n\tfor _, fname := range files {\n\t\tmux.HandleFunc(\"/\"+fname, ServeFile(fname))\n\t}\n\treturn mux.ServeHTTP()\n}", "title": "" }, { "docid": "fcc994b6175c73a721039c7b6a0ae7b2", "score": "0.49435118", "text": "func WithWorkdir(path string) ClientOpt {\n\treturn clientOptFunc(func(cfg *engineconn.Config) {\n\t\tcfg.Workdir = path\n\t})\n}", "title": "" }, { "docid": "1acebbf997a957cfc51c4000614a8731", "score": "0.4931361", "text": "func (o *QueryDirectoryParams) WithLimit(limit *int64) *QueryDirectoryParams {\n\to.SetLimit(limit)\n\treturn o\n}", "title": "" }, { "docid": "9fbc6ce89d3fa5376d515a042a1cb643", "score": "0.49260265", "text": "func NewQueryDirectoryParamsWithTimeout(timeout time.Duration) *QueryDirectoryParams {\n\tvar ()\n\treturn &QueryDirectoryParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "title": "" }, { "docid": "2269987c1ac979caf795322c18e1312e", "score": "0.49235117", "text": "func (c *Client) SetDir(prefix, name string) {\n\tc.Lock()\n\tc.dir = &models.Directory{\n\t\tBase: fmt.Sprintf(\"%v/%v\", prefix, name),\n\t\tElection: fmt.Sprintf(\"%v/%v/%v\", prefix, name, DirectoryElection),\n\t\tRunning: fmt.Sprintf(\"%v/%v/%v\", prefix, name, DirectoryRunning),\n\t\tQueue: fmt.Sprintf(\"%v/%v/%v\", prefix, name, DirectoryQueue),\n\t\tNodes: fmt.Sprintf(\"%v/%v/%v\", prefix, name, DirectoryNodes),\n\t\tMasters: fmt.Sprintf(\"%v/%v/%v\", prefix, name, DirectoryMasters),\n\t}\n\tc.Unlock()\n}", "title": "" }, { "docid": "39d767bfe696290168d6d18ee4238c6a", "score": "0.49217954", "text": "func WorkingDir(dir string) types.Option {\n\treturn func(g *types.Cmd) {\n\t\tg.Dir = dir\n\t}\n}", "title": "" }, { "docid": "0a6ccb7494decbd5e521010779a30a20", "score": "0.49198893", "text": "func WithBase(inputDir string) Option {\n\treturn func(g *Generator) error {\n\t\tg.getBase = g.makeBaseGetter(inputDir)\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "7024324923b2defa790ef7415f4767a4", "score": "0.491574", "text": "func dirURL(path string) *url.URL {\n\tpath = filepath.ToSlash(path)\n\tif path[len(path)-1] != '/' {\n\t\t// trailing slash is important\n\t\tpath = path + \"/\"\n\t}\n\treturn &url.URL{Scheme: \"file\", Path: path}\n}", "title": "" }, { "docid": "a8168366f22bcd263b23444f61c69a88", "score": "0.48945785", "text": "func (client *Client) AddDir(dir string) (string, error) {\n\tstat, err := os.Lstat(dir)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tsf, err := files.NewSerialFile(dir, false, stat)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tslf := files.NewSliceDirectory([]files.DirEntry{files.FileEntry(filepath.Base(dir), sf)})\n\treader := files.NewMultiFileReader(slf, true)\n\n\tresp, err := client.client.Request(\"add\").\n\t\tOption(\"recursive\", true).\n\t\tOption(\"cid-version\", 1).\n\t\tBody(reader).\n\t\tSend(context.Background())\n\tif err != nil {\n\t\treturn \"\", nil\n\t}\n\n\tdefer resp.Close()\n\n\tif resp.Error != nil {\n\t\treturn \"\", resp.Error\n\t}\n\n\tdec := json.NewDecoder(resp.Output)\n\tvar final string\n\tfor {\n\t\tvar out object\n\t\terr = dec.Decode(&out)\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\t\tfinal = out.Hash\n\t}\n\n\tif final == \"\" {\n\t\treturn \"\", errors.New(\"no results received\")\n\t}\n\n\treturn final, nil\n}", "title": "" }, { "docid": "0b4e39a6c079b181344fb65021d65194", "score": "0.48814708", "text": "func (t *Tables) Dir(corpus, root, path string) (*filetree.Directory, error) {\n\turi := &kytheuri.URI{\n\t\tCorpus: corpus,\n\t\tRoot: root,\n\t\tPath: path,\n\t}\n\tvar dir filetree.Directory\n\treturn &dir, t.dirs.get(uri.String(), &dir)\n}", "title": "" }, { "docid": "08ebc59a32625982db2e8b9b3b3015ff", "score": "0.48766974", "text": "func (s *Space) Dir(path string) (err error) {\n\tpath, err = filepath.Abs(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\ts.dir = path\n\treturn\n}", "title": "" }, { "docid": "d04dc6773aadfe11ebedd5f8b6a734c9", "score": "0.48660302", "text": "func (info *DirInfo) InitDir(root string, filter Filter) error {\n\n\t*info = DirInfo{\n\t\t_focus: 0,\n\t\t_fileCnt: 0,\n\t\t_fileArr: nil,\n\t}\n\tif !strings.HasSuffix(root, \"/\") {\n\t\troot += \"/\"\n\t}\n\n\tinfo._filter = filter\n\terr := filepath.Walk(root, info.handleWalk)\n\tif err != nil {\n\n\t\tfmt.Println(\"there's an error in dict reset : \" + err.Error())\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "f0635ee223d72236ff0d7f09664457b4", "score": "0.48653916", "text": "func NewDir(dir Directory, abspath string, pool *qidpool.Pool) Interface {\n\treturn &dirReader{\n\t\tDirectory: dir,\n\t\tpool: pool,\n\t\tpath: abspath,\n\t}\n}", "title": "" }, { "docid": "161d135e71954326c0e111c4612b22d0", "score": "0.48461166", "text": "func (o *QueryDirectoryParams) WithTimeout(timeout time.Duration) *QueryDirectoryParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "title": "" }, { "docid": "bcc23913f75180cb20be4188d9da263a", "score": "0.48404017", "text": "func DataDir(path string) Option {\n\tif s, err := os.Stat(path); err == nil && s.IsDir() {\n\t\treturn func(args *Options) {\n\t\t\targs.DataDir = path\n\t\t}\n\t}\n\n\treturn func(args *Options) {\n\t}\n}", "title": "" }, { "docid": "dcb0c17034a023c20c7a0ddcbc8535f1", "score": "0.47967014", "text": "func (o *QueryDirectoryParams) WithType(typeVar *string) *QueryDirectoryParams {\n\to.SetType(typeVar)\n\treturn o\n}", "title": "" }, { "docid": "5d558d416f74eba46ce80c22d2f3b045", "score": "0.47819573", "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": "e334a5d59a42e7915edd792f8a0fc000", "score": "0.4777459", "text": "func (builder *Builder) Directory(name string) *Builder {\n\tbuilder.name = name\n\treturn builder\n}", "title": "" }, { "docid": "1570e893c86e0d02b19a4ed49133078f", "score": "0.47767758", "text": "func OptIncludeDirs(includeGlobs ...string) Option {\n\treturn func(p *Profanity) {\n\t\tp.Config.Dirs.Filter.Include = includeGlobs\n\t}\n}", "title": "" }, { "docid": "ba823d4e185dea2b6c12fd01bf9e7f54", "score": "0.4769575", "text": "func (c *Controller) OpenDir(path dir.Path, d dir.Any) error {\n\tparts := strings.Split(string(path), \"/*\")\n\tif len(parts) < 1 {\n\t\treturn errors.New(\"no extension provided\")\n\t}\n\tfolder := parts[0]\n\tif len(parts) < 2 {\n\t\treturn errors.New(\"no extension provided\")\n\t}\n\text := parts[1]\n\n\tinput := &s3.ListObjectsInput{\n\t\tBucket: aws.String(c.bucket),\n\t\tPrefix: aws.String(folder),\n\t}\n\toutput, err := c.c3svc.ListObjects(input)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tswitch d := d.(type) {\n\tcase dir.BananasMon:\n\t\tfor _, obj := range output.Contents {\n\t\t\tfname := *obj.Key\n\t\t\tif fname == folder {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif !strings.Contains(fname, ext) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tvar f file.BananasMon\n\t\t\texists, err := c.Open(fname, &f)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif !exists {\n\t\t\t\treturn errors.New(\"unabled to open '\" + fname + \"'\")\n\t\t\t}\n\t\t\twithoutDir := strings.Replace(fname, folder+`/`, \"\", -1)\n\t\t\twithoutDirExt := strings.Replace(withoutDir, ext, \"\", -1)\n\t\t\td[withoutDirExt] = f\n\t\t}\n\n\t\treturn nil\n\n\tdefault:\n\t\treturn errors.New(\"unknown type; possibly unimplemented\")\n\t}\n}", "title": "" }, { "docid": "a55a784321dec842dae49326efb456ac", "score": "0.4763259", "text": "func dirRequest() {\n\t// the only possible option is --help\n\t// Anything else we will also display the help contents\n\tif len(os.Args[2:]) >= 1 {\n\t\t// Display help\n\t\tfmt.Println(_DIRECTORY_HELP_CONTENT)\n\t\treturn\n\t}\n\t// proceed to obtain and display directory\n\tspartsDir, err := getSpartsDirectory()\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\n\tfmt.Println(\" sparts directory:\")\n\tfmt.Println(\" \", spartsDir)\n\n\tglobalConfigFile, err := getGlobalConfigFile()\n\t//// Clean up string on Windows replace '\\' with '/'\n\t////globalConfigFile = strings.Replace(globalConfigFile, `\\`, `/`, -1)\n\tif globalConfigFile != \"\" {\n\t\tfmt.Println(\" sparts global config file:\")\n\t\tfmt.Println(\" \", globalConfigFile)\n\t} else {\n\t\tfmt.Println(\" sparts global config file does not exist.\")\n\t}\n}", "title": "" }, { "docid": "dca85e1e9eea8cc7c642766ba2e26b7a", "score": "0.47616762", "text": "func NewDirectoryRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*DirectoryRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewDirectoryRequestBuilderInternal(urlParams, requestAdapter)\n}", "title": "" }, { "docid": "78e6f36fab17bdaf33df5bae40aa3a4b", "score": "0.47614586", "text": "func (f *Fs) newDir(dir fs.Directory) fs.Directory {\n\treturn dir // We're using the same dir\n}", "title": "" }, { "docid": "345f9b91bb6f2da88d70cbf97c94d34d", "score": "0.47488612", "text": "func (o *QueryDirectoryParams) SetDirectoryQuery(directoryQuery *models.DirectoryQuery) {\n\to.DirectoryQuery = directoryQuery\n}", "title": "" }, { "docid": "8dd3eb50c21b22712a7d1f6869ffa744", "score": "0.47487038", "text": "func ByDir(left, right *FileInfoPath) bool {\n\treturn left.IsDir() && !right.IsDir()\n}", "title": "" }, { "docid": "ba765e54839bf91f3f2b0f7b13bb0ecf", "score": "0.4748051", "text": "func Dir(index, root string, listDirectory bool) http.FileSystem {\n\tfs := http.Dir(root)\n\tif listDirectory {\n\t\treturn fs\n\t}\n\treturn &onlyFilesFS{fs, index}\n}", "title": "" }, { "docid": "77ba13db84a21a52d69b8a1c78170b7d", "score": "0.47426134", "text": "func SetDir(cmd *exec.Cmd, dir string) {\n\tif dir == \"\" {\n\t\tcmd.Dir = \"\"\n\t\tdir, _ = os.Getwd()\n\t} else {\n\t\tcmd.Dir = dir\n\t}\n\tSetEnv(cmd, \"PWD=\"+dir)\n}", "title": "" }, { "docid": "cc545533cb90d6366495451806381374", "score": "0.47420007", "text": "func PullDir(path string) GitOptions {\n\treturn func(o *options) error {\n\t\to.pullDirectory = path\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "2f01a02eda7dd5cb57fe09200bee2c23", "score": "0.47389588", "text": "func newDir(name string, attr plugin.EntryAttributes, impl Interface, path string) *dir {\n\tvd := &dir{\n\t\tEntryBase: plugin.NewEntry(name),\n\t}\n\tvd.impl = impl\n\tvd.path = path\n\tvd.SetAttributes(attr)\n\treturn vd\n}", "title": "" }, { "docid": "f1c2bd3e4a02e529208672a872a7b90d", "score": "0.47335768", "text": "func ParseDir(dirPath string, globalConfig *mybase.Config) (*Dir, error) {\n\tcleaned, err := filepath.Abs(filepath.Clean(dirPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdir := &Dir{\n\t\tPath: cleaned,\n\t\tConfig: globalConfig.Clone(),\n\t}\n\n\t// Apply the parent option files\n\tvar parentFiles []*mybase.File\n\tparentFiles, dir.repoBase, err = ParentOptionFiles(dirPath, globalConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, optionFile := range parentFiles {\n\t\tdir.Config.AddSource(optionFile)\n\t}\n\n\tdir.parseContents()\n\treturn dir, dir.ParseError\n}", "title": "" }, { "docid": "f1c2bd3e4a02e529208672a872a7b90d", "score": "0.47335768", "text": "func ParseDir(dirPath string, globalConfig *mybase.Config) (*Dir, error) {\n\tcleaned, err := filepath.Abs(filepath.Clean(dirPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdir := &Dir{\n\t\tPath: cleaned,\n\t\tConfig: globalConfig.Clone(),\n\t}\n\n\t// Apply the parent option files\n\tvar parentFiles []*mybase.File\n\tparentFiles, dir.repoBase, err = ParentOptionFiles(dirPath, globalConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, optionFile := range parentFiles {\n\t\tdir.Config.AddSource(optionFile)\n\t}\n\n\tdir.parseContents()\n\treturn dir, dir.ParseError\n}", "title": "" }, { "docid": "de40fb7653fa547a52ce24742bf6d63c", "score": "0.4718214", "text": "func (ctx Context) WithKeyringDir(dir string) Context {\n\tctx.KeyringDir = dir\n\treturn ctx\n}", "title": "" }, { "docid": "18dfb3dc2a52d4822272a040485e1cae", "score": "0.46752915", "text": "func SchemaDirectory(dir string) VitessOption {\n\tif dir == \"\" {\n\t\tlog.Fatal(\"BUG: provided directory must not be empty\")\n\t}\n\n\treturn VitessOption{\n\t\tbeforeRun: func(hdl *Handle) error {\n\t\t\tif hdl.db.SchemaDir != \"\" {\n\t\t\t\treturn fmt.Errorf(\"SchemaDirectory option (%v) would overwrite directory set by another option (%v)\", dir, hdl.db.SchemaDir)\n\t\t\t}\n\t\t\thdl.db.SchemaDir = dir\n\t\t\treturn nil\n\t\t},\n\t}\n}", "title": "" }, { "docid": "5bc9168892fd824895959bd7b67571a3", "score": "0.46607405", "text": "func (o *QueryDirectoryParams) WithHTTPClient(client *http.Client) *QueryDirectoryParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "title": "" }, { "docid": "124e2cbbc879e3666d145d901d9fd456", "score": "0.46541205", "text": "func Dir(path string) func(*Runner) error {\n\treturn func(r *Runner) error {\n\t\tif path == \"\" {\n\t\t\tpath, err := os.Getwd()\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"could not get current dir: %v\", err)\n\t\t\t}\n\t\t\tr.Dir = path\n\t\t\treturn nil\n\t\t}\n\t\tpath, err := filepath.Abs(path)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"could not get absolute dir: %v\", err)\n\t\t}\n\t\tinfo, err := os.Stat(path)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"could not stat: %v\", err)\n\t\t}\n\t\tif !info.IsDir() {\n\t\t\treturn fmt.Errorf(\"%s is not a directory\", path)\n\t\t}\n\t\tr.Dir = path\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "0e2395f01baffe1ef30cae86e3081f56", "score": "0.46523035", "text": "func (p *param) Dir() string {\n\treturn os.Getenv(\"HOME\") + \"/.config/teonet/teol0/\"\n}", "title": "" }, { "docid": "1d2754fe2902c298cdb725e6c4a82fcf", "score": "0.4616811", "text": "func (c *Command) openDir(dir string) {\n\tfiles, _ := ioutil.ReadDir(dir)\n\tresponse := \"\"\n\tfor _, f := range files {\n\t\tresponse = response + f.Name() + \"\\n\"\n\t}\n\trelDir := relativePath(c.session.cwd, dir)\n\n\tc.pushCwd(c.Id, \"openDir\", dir, relDir, response)\n\tc.done()\n}", "title": "" }, { "docid": "a8089a0873d4d8017643a152d7c5a9fb", "score": "0.46011975", "text": "func SetDir(dir string) {\n\tif dir == \"\" {\n\t\tlog.Warn(\"empty-dir\")\n\t\treturn\n\t}\n\twritingDir = dir\n\tlog.Info(\"set-dir\", \"dir\", dir)\n\tos.MkdirAll(dir, os.ModePerm)\n}", "title": "" }, { "docid": "16aed76f95a4e99ff7dadd7aeb7701bc", "score": "0.45887518", "text": "func ByDir(paths ...string) map[string][]string {\n\tm := make(map[string][]string)\n\tfor _, path := range paths {\n\t\tpath = Normalize(path)\n\t\tdir := filepath.Dir(path)\n\t\tm[dir] = append(m[dir], path)\n\t}\n\tfor _, dirPaths := range m {\n\t\tsort.Strings(dirPaths)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "783893f91aaae215fdf18f9b550fb466", "score": "0.45814395", "text": "func (s *Subrepo) Dir(dir string) string {\n\treturn filepath.Join(s.Root, dir)\n}", "title": "" }, { "docid": "f2136298d3048a62bd35aaca428696d8", "score": "0.4577351", "text": "func Dir_(children ...HTML) HTML {\n return Dir(nil, children...)\n}", "title": "" }, { "docid": "e99a54b50bcf31792678146c9c5a24df", "score": "0.4573576", "text": "func (b *downloadFileBuilder) QueryParam(queryParam map[string]string) *downloadFileBuilder {\n\tb.opts.QueryParam = queryParam\n\n\treturn b\n}", "title": "" }, { "docid": "a7e3e8b660ce04dc10a75c094ac015d9", "score": "0.45578203", "text": "func addDir(){\r\n\tdir := dirPath\r\n\tindex := 0\r\n\ts := []byte(\"\\\\\");\r\n\tfor i := len(dir)-1; i > 0; i-- {\r\n\t\tif dir[i] == s[0] {\r\n\t\t\tindex = i\r\n\t\t\tbreak\r\n\t\t}\r\n\t}\r\n\tindex++\r\n\tsubstring := dir[index:]\r\n\tdir = substring\r\n\tnewName = fileName + sepChar + dir\r\n\tfileName = newName\r\n}", "title": "" }, { "docid": "912c6ed1a05419c94aa5782633b881d5", "score": "0.4555746", "text": "func (*XMLDocument) Dir() (dir string) {\n\tmacro.Rewrite(\"$_.dir\")\n\treturn dir\n}", "title": "" }, { "docid": "4c511a2c1e0be1bd64b5a19086da4cad", "score": "0.453657", "text": "func (e *ObservableEditableBuffer) SetDir(flag bool) {\n\te.details.SetDir(flag)\n}", "title": "" }, { "docid": "84cc5cfcad48b6d434c84fb6d764c3b6", "score": "0.4528336", "text": "func (o *QueryDirectoryParams) WithSort(sort *string) *QueryDirectoryParams {\n\to.SetSort(sort)\n\treturn o\n}", "title": "" }, { "docid": "1202750201649834c096e18076cdb601", "score": "0.4524244", "text": "func addDir(dir Direction) {\n\tname := strings.ToLower(dir.Name)\n\tif _, ok := dirMap[name]; ok {\n\t\tpanic(fmt.Errorf(\"direction with name/alias %q already exists\", name))\n\t}\n\tdirMap[name] = dir\n\tfor _, alias := range dir.Aliases {\n\t\talias = strings.ToLower(alias)\n\t\tif _, ok := dirMap[alias]; ok {\n\t\t\tpanic(fmt.Errorf(\"direction with name/alias %q already exists\", alias))\n\t\t}\n\t\tdirMap[alias] = dir\n\t}\n}", "title": "" }, { "docid": "4801303e0f0f4d2215c919a6be02f6db", "score": "0.45116317", "text": "func StaticDir(staticDir string) Option {\n\treturn func(s *Service) {\n\t\ts.staticDir = staticDir\n\t}\n}", "title": "" }, { "docid": "f1922e47e1a5d82529aa8c92c2586871", "score": "0.45093736", "text": "func AddQueryParam(url, query string) string {\n\tif strings.Contains(url, \"?\") {\n\t\treturn url + \"&\" + query\n\t}\n\treturn url + \"?\" + query\n}", "title": "" }, { "docid": "8f43fd497621e810db36126e05e93e58", "score": "0.45056874", "text": "func InputDirFlag(k *kingpin.Application, doc string) *string {\n\treturn k.Flag(\"dir\", doc).Required().ExistingDir()\n}", "title": "" }, { "docid": "84f00bbfc2f6066f3a85c122c6db848c", "score": "0.45055053", "text": "func (app *App) ServeDir(path string) func(*Context) {\n\treturn app.ServeDirCustom(path, 0, true, false, []string{\"index.html\", \"index.htm\"})\n}", "title": "" }, { "docid": "656bdae37e5aa208a63d565086488e19", "score": "0.4504372", "text": "func AddDir(w *watcher.Watcher, path string) error {\n\terr := w.Add(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a75297cc54db522a47231a4314b273a5", "score": "0.45034134", "text": "func NewMoveDirectoryParams() *MoveDirectoryParams {\n\tvar ()\n\treturn &MoveDirectoryParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "3aa6ffbc5c59c6ab87c8a12161c9b675", "score": "0.44884282", "text": "func (s *Server) getMusicDirectory(w http.ResponseWriter, r *http.Request) {\n\tqID := r.URL.Query().Get(\"id\")\n\tif qID == \"\" {\n\t\twriteXML(w, errMissingParameter)\n\t\treturn\n\t}\n\n\tid, err := strconv.Atoi(qID)\n\tif err != nil {\n\t\twriteXML(w, errGeneric)\n\t\treturn\n\t}\n\n\tfs, err := s.db.List(\"file\")\n\tif err != nil {\n\t\ts.logf(\"error listing files from mpd for getting music directory: %v\", err)\n\t\twriteXML(w, errGeneric)\n\t\treturn\n\t}\n\n\tfiles, err := tagFiles(s.db, filterFiles(indexFiles(fs), id))\n\tif err != nil {\n\t\tlog.Println(err)\n\t\ts.logf(\"error tagging files from mpd for getting music directory: %v\", err)\n\t\twriteXML(w, errGeneric)\n\t\treturn\n\t}\n\n\t// No files matching criteria\n\tif len(files) == 0 {\n\t\thttp.NotFound(w, r)\n\t\treturn\n\t}\n\n\tvar children []child\n\tfor _, f := range files {\n\t\text := strings.TrimPrefix(filepath.Ext(f.Name), \".\")\n\t\tchildren = append(children, child{\n\t\t\tID: strconv.Itoa(f.ID),\n\t\t\tAlbum: f.Album,\n\t\t\tArtist: f.Artist,\n\t\t\tIsDir: f.Dir,\n\t\t\tSuffix: ext,\n\t\t\tTitle: f.Title,\n\t\t})\n\t}\n\n\twriteXML(w, func(c *container) {\n\t\tc.MusicDirectory = &musicDirectoryContainer{\n\t\t\tID: strconv.Itoa(id),\n\t\t\tName: files[0].Name,\n\t\t\tChildren: children,\n\t\t}\n\t})\n}", "title": "" }, { "docid": "780a4aec2db3edd3560c2ac2ce18379e", "score": "0.44883135", "text": "func (cli *FakeDatabaseClient) ReadDir(ctx context.Context, in *dbdpb.ReadDirRequest, opts ...grpc.CallOption) (*dbdpb.ReadDirResponse, error) {\n\tpanic(\"implement me\")\n}", "title": "" }, { "docid": "f93abafcfa60e6efcad5af65c70dcbbb", "score": "0.44860172", "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": "e5399991c95954ef5fa63391058fa90b", "score": "0.4481087", "text": "func (hr *httpRouter) AddPublicDir(url string, source string) {\n\thr.dir[url] = source\n}", "title": "" } ]
d17509f034764809ca8879a4842e3393
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HarborSpec.
[ { "docid": "7c159e64945dcc699449a2a1d1debdef", "score": "0.8979786", "text": "func (in *HarborSpec) DeepCopy() *HarborSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(HarborSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" } ]
[ { "docid": "fc327108ae8829137aa1f38340dbdbcc", "score": "0.8222707", "text": "func (in *HarborComponentsSpec) DeepCopy() *HarborComponentsSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(HarborComponentsSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "548952af727eed521003548a6877d237", "score": "0.73064655", "text": "func (in *HarborDatabaseSpec) DeepCopy() *HarborDatabaseSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(HarborDatabaseSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "748cde040b8569188e5d29be86f32790", "score": "0.72926", "text": "func (in *HarborExposeSpec) DeepCopy() *HarborExposeSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(HarborExposeSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "7f88e62eb43b97707b23d9fff20624a5", "score": "0.709587", "text": "func (in *HarborProxySpec) DeepCopy() *HarborProxySpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(HarborProxySpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "5ffed378e155d101296751da1e969591", "score": "0.70294315", "text": "func (in *HarborExposeComponentSpec) DeepCopy() *HarborExposeComponentSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(HarborExposeComponentSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "5153533c6d7438b95ec48df97eec0e16", "score": "0.68948936", "text": "func (in *HbaseSpec) DeepCopy() *HbaseSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(HbaseSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "039d40ec9749c5e3bad2fc7e5180e3e8", "score": "0.6773978", "text": "func (in *Harbor) DeepCopy() *Harbor {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Harbor)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "7549abc43ab522801ddd348a0e382aa6", "score": "0.64390534", "text": "func (in *HarvesterSpec) DeepCopy() *HarvesterSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(HarvesterSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "bc1d5a6bb3efc1c658edcd77d74ad7db", "score": "0.63961816", "text": "func (in *HarborStoragePersistentVolumeSpec) DeepCopy() *HarborStoragePersistentVolumeSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(HarborStoragePersistentVolumeSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "76980d1a22346610e0271e8d9e2841a5", "score": "0.63083816", "text": "func (in *CrcBundleSpec) DeepCopy() *CrcBundleSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CrcBundleSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "009c07273631d56ffce4e2d4b15282bb", "score": "0.6261704", "text": "func (in *HarborExporterCacheSpec) DeepCopy() *HarborExporterCacheSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(HarborExporterCacheSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "c531b8d4422dc69f634c501946e11330", "score": "0.6212412", "text": "func (in *BucketSpec) DeepCopy() *BucketSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BucketSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "c531b8d4422dc69f634c501946e11330", "score": "0.6212412", "text": "func (in *BucketSpec) DeepCopy() *BucketSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BucketSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "c531b8d4422dc69f634c501946e11330", "score": "0.6212412", "text": "func (in *BucketSpec) DeepCopy() *BucketSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BucketSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "c531b8d4422dc69f634c501946e11330", "score": "0.6212412", "text": "func (in *BucketSpec) DeepCopy() *BucketSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BucketSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "f5d34726da6c7bd90df4be52310a20d5", "score": "0.6202215", "text": "func (in *HarborStorageRegistryPersistentVolumeSpec) DeepCopy() *HarborStorageRegistryPersistentVolumeSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(HarborStorageRegistryPersistentVolumeSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "b4c266552585f4a1a4f242912e8e68c3", "score": "0.61778593", "text": "func (in *HarborExposeIngressSpec) DeepCopy() *HarborExposeIngressSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(HarborExposeIngressSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "32152f379174880e55599e5f9c70e437", "score": "0.612817", "text": "func (in *BastionSpec) DeepCopy() *BastionSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BastionSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "ba61941c8d4e6c5408dd8fc03ae3c621", "score": "0.6115665", "text": "func (in *RegistryHealthFileSpec) DeepCopy() *RegistryHealthFileSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RegistryHealthFileSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "3aff96403918acd21aefc5b9f880594c", "score": "0.60929793", "text": "func (in *BOSHDeploymentSpec) DeepCopy() *BOSHDeploymentSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BOSHDeploymentSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "3eacdbaba92ac9de0f8fe8cb3064cc49", "score": "0.6092681", "text": "func (in *BundleSpec) DeepCopy() *BundleSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BundleSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "f20c822b0dbaa0de49ef22fbe9b1fcf0", "score": "0.60585696", "text": "func (in *HarborClusterSpec) DeepCopy() *HarborClusterSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(HarborClusterSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "f20c822b0dbaa0de49ef22fbe9b1fcf0", "score": "0.60585696", "text": "func (in *HarborClusterSpec) DeepCopy() *HarborClusterSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(HarborClusterSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "0bf7a9a05713335a2a183130f556ee22", "score": "0.6052261", "text": "func (in *BOSHConfigSpec) DeepCopy() *BOSHConfigSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BOSHConfigSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "a843f9164bf59b89288f5d942520399d", "score": "0.6040396", "text": "func (in *CleaningSpec) DeepCopy() *CleaningSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CleaningSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "cb6162d4439b22a697fdd06745650b30", "score": "0.60341835", "text": "func (in *Spec) DeepCopy() *Spec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Spec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "cb6162d4439b22a697fdd06745650b30", "score": "0.60341835", "text": "func (in *Spec) DeepCopy() *Spec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Spec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "cb6162d4439b22a697fdd06745650b30", "score": "0.60341835", "text": "func (in *Spec) DeepCopy() *Spec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Spec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "4962fa2d84b49e86ceef6aed45747bce", "score": "0.60130984", "text": "func (in *BOSHStemcellSpec) DeepCopy() *BOSHStemcellSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BOSHStemcellSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "dcd814e12af404fb788b1f57bd028488", "score": "0.59848213", "text": "func (in *HighAvailabilitySpec) DeepCopy() *HighAvailabilitySpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(HighAvailabilitySpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "cde7e3b3785f7f7e5350ea4d146f2e9e", "score": "0.59593666", "text": "func (in *AuctioneerSpec) DeepCopy() *AuctioneerSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AuctioneerSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "8c7a86d40176aaf221a7ba35b5198b69", "score": "0.5944494", "text": "func (in *HealthCheckSpec) DeepCopy() *HealthCheckSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(HealthCheckSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "8c7a86d40176aaf221a7ba35b5198b69", "score": "0.5944494", "text": "func (in *HealthCheckSpec) DeepCopy() *HealthCheckSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(HealthCheckSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "5c90a54d0e3df875b4a4e2c9de0bed3b", "score": "0.5901772", "text": "func (in *CompositeSpec) DeepCopy() *CompositeSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CompositeSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "2263bbce245f55a3cf5cc7b6e78b3675", "score": "0.5892468", "text": "func (in *RefinerySpec) DeepCopy() *RefinerySpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RefinerySpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "4672c646bf0db232b054ce3557caf8c7", "score": "0.58630264", "text": "func (in *RegistryHealthSpec) DeepCopy() *RegistryHealthSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RegistryHealthSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "96329078477baf7145a358c12ed67444", "score": "0.58524764", "text": "func (in *ReaperSpec) DeepCopy() *ReaperSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ReaperSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "58ac551169198c713c843f7158cf7aa6", "score": "0.5830958", "text": "func (in *RabbitVhostSpec) DeepCopy() *RabbitVhostSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RabbitVhostSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "b9a05ab362f8fdc7afb4dec9225847cd", "score": "0.5829125", "text": "func (in *HostSpec) DeepCopy() *HostSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(HostSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "b9a05ab362f8fdc7afb4dec9225847cd", "score": "0.5829125", "text": "func (in *HostSpec) DeepCopy() *HostSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(HostSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "78fb0dacc6f5afe780f1b878a1fcc02d", "score": "0.5801406", "text": "func (in *GitBranchSpec) DeepCopy() *GitBranchSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GitBranchSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "b60104dea2980050821824b30d899614", "score": "0.57944775", "text": "func (in *DeployerSpec) DeepCopy() *DeployerSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DeployerSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "fdaf23fe729f702291069b38dae5629d", "score": "0.5763944", "text": "func (in *HelmReleaseSpec) DeepCopy() *HelmReleaseSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(HelmReleaseSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "fdaf23fe729f702291069b38dae5629d", "score": "0.5763944", "text": "func (in *HelmReleaseSpec) DeepCopy() *HelmReleaseSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(HelmReleaseSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "2671c00a7670e3f86017e05eaed9b5d4", "score": "0.5758096", "text": "func (in *ResourceDistributionSpec) DeepCopy() *ResourceDistributionSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ResourceDistributionSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "a8d4122fb0c5ea7ac534bb746d01e54e", "score": "0.5756899", "text": "func (in *SonarSpec) DeepCopy() *SonarSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SonarSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "db938eb4a09a8813489c9abba5c89cb5", "score": "0.5722605", "text": "func (in *RouterSpec) DeepCopy() *RouterSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RouterSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "3a42b74dfd0a99afb79d1ba743160644", "score": "0.5720303", "text": "func (in *DrainerSpec) DeepCopy() *DrainerSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DrainerSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "be494bbb2d317966d42afa908ec28c0b", "score": "0.57085204", "text": "func (in *CarSpec) DeepCopy() *CarSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CarSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "b01b890ecbd312c226cd00f5dde700e0", "score": "0.5689472", "text": "func (in *BGPPeerSpec) DeepCopy() *BGPPeerSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BGPPeerSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "b01b890ecbd312c226cd00f5dde700e0", "score": "0.5689472", "text": "func (in *BGPPeerSpec) DeepCopy() *BGPPeerSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BGPPeerSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "50d70ae547d8b0d45bf04c49d2113f00", "score": "0.56778604", "text": "func (in *ForwarderSpec) DeepCopy() *ForwarderSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ForwarderSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "50d70ae547d8b0d45bf04c49d2113f00", "score": "0.56778604", "text": "func (in *ForwarderSpec) DeepCopy() *ForwarderSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ForwarderSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "5e1e321c87638ee12357375cb1c626ab", "score": "0.567034", "text": "func (in *FedoraSpec) DeepCopy() *FedoraSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FedoraSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "4d4f975839a5a7535e196fe4c4a18a07", "score": "0.56579614", "text": "func (in *GitOrchestratorSpec) DeepCopy() *GitOrchestratorSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GitOrchestratorSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "59af6863230089623d76e1f8d9e89a75", "score": "0.5642631", "text": "func (in *KeycloakSpec) DeepCopy() *KeycloakSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KeycloakSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "92efa5793b071406733d4b4d8e86b317", "score": "0.56404716", "text": "func (in *AWSBackendSpec) DeepCopy() *AWSBackendSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(AWSBackendSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "5abc32c0a229eb84dbbd415bb57b9f0e", "score": "0.56381285", "text": "func (in *PipelineSpec) DeepCopy() *PipelineSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PipelineSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "5abc32c0a229eb84dbbd415bb57b9f0e", "score": "0.56381285", "text": "func (in *PipelineSpec) DeepCopy() *PipelineSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PipelineSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "5abc32c0a229eb84dbbd415bb57b9f0e", "score": "0.56381285", "text": "func (in *PipelineSpec) DeepCopy() *PipelineSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PipelineSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "5abc32c0a229eb84dbbd415bb57b9f0e", "score": "0.56381285", "text": "func (in *PipelineSpec) DeepCopy() *PipelineSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(PipelineSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "394f900de661818a1c8fa152fdc78246", "score": "0.56193227", "text": "func (in *StatefulguardianSpec) DeepCopy() *StatefulguardianSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(StatefulguardianSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "069df8dacdf9d46d74afab7138096ad2", "score": "0.5604372", "text": "func (in *RabbitmqSpec) DeepCopy() *RabbitmqSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RabbitmqSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "e345871eb78a4881c3bb94ce0740e741", "score": "0.56031436", "text": "func (in *GitWatcherSpec) DeepCopy() *GitWatcherSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(GitWatcherSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "368f64f907bf5c6aa65ded6d64c6c669", "score": "0.5598656", "text": "func (in *Redis_Spec) DeepCopy() *Redis_Spec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Redis_Spec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "694b7510f17087ec43b997f4200c4473", "score": "0.5591148", "text": "func (in *RegistrySpec) DeepCopy() *RegistrySpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RegistrySpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "694b7510f17087ec43b997f4200c4473", "score": "0.5591148", "text": "func (in *RegistrySpec) DeepCopy() *RegistrySpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RegistrySpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "93f8e78156bba8ca869f21b5ffafed71", "score": "0.55853975", "text": "func (in *RouteTable_Spec) DeepCopy() *RouteTable_Spec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RouteTable_Spec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "2f7277eb4c4c25753038f375e997e612", "score": "0.5570917", "text": "func (in *LoadBalancer_Spec) DeepCopy() *LoadBalancer_Spec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(LoadBalancer_Spec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "59b339341de21a5c367483a7fa0181c1", "score": "0.5570243", "text": "func (in *HetznerCloudSpec) DeepCopy() *HetznerCloudSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(HetznerCloudSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "77f50fc268cc662b594b2cc748ac036b", "score": "0.55667114", "text": "func (in *ChallengeSpec) DeepCopy() *ChallengeSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ChallengeSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "77ca8f7e425e87ad299c06069e4d8c8c", "score": "0.5558671", "text": "func (in *InjectorSpec) DeepCopy() *InjectorSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(InjectorSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "100309dcbe1107c9cecd409e8fbd469a", "score": "0.5555449", "text": "func (in *LoadBalanceSpec) DeepCopy() *LoadBalanceSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(LoadBalanceSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "4c0ba6f64fc5b43be7e4c7b8adf8f89d", "score": "0.55448973", "text": "func (in *RegistryComponentSpec) DeepCopy() *RegistryComponentSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RegistryComponentSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "d3998d64fd9617453fb454e3b24842a2", "score": "0.5541818", "text": "func (in *ZyncSpec) DeepCopy() *ZyncSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ZyncSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "6f4b3863de8b98fd91b2e3354d94f40d", "score": "0.5540706", "text": "func (in *ChaosSpec) DeepCopy() *ChaosSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ChaosSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "2711af31895f59c0b2be3a25adb91ec2", "score": "0.55364615", "text": "func (in *SlackBotSpec) DeepCopy() *SlackBotSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SlackBotSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "f5c3a9de3786c3800558ebb2a7fb7504", "score": "0.5529147", "text": "func (in *RouteTables_Route_Spec) DeepCopy() *RouteTables_Route_Spec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RouteTables_Route_Spec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "8e5b356f8c0f0be9083ee54ea6fecd51", "score": "0.5521014", "text": "func (in *LoadbalancerSpec) DeepCopy() *LoadbalancerSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(LoadbalancerSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "a17145fe4bcdb8e941c7ca116fb89e79", "score": "0.5517373", "text": "func (in *BobRDBSpec) DeepCopy() *BobRDBSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BobRDBSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "0605de3b4ad75556384f175387fd5d72", "score": "0.5501941", "text": "func (in *ReceiverSpec) DeepCopy() *ReceiverSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(ReceiverSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "d913abd7b3ad0c07fb420a073f548e96", "score": "0.54851395", "text": "func (in *KubedgeSpec) DeepCopy() *KubedgeSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KubedgeSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "bf35107533b649bb49bdd6bd76912983", "score": "0.54678935", "text": "func (in *RbdComponentSpec) DeepCopy() *RbdComponentSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(RbdComponentSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "f79911f62bc0eb2bdf3671319e161611", "score": "0.5454463", "text": "func (in *SidecarSpec) DeepCopy() *SidecarSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SidecarSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "f79911f62bc0eb2bdf3671319e161611", "score": "0.5454463", "text": "func (in *SidecarSpec) DeepCopy() *SidecarSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(SidecarSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "2f643fd83c5006870215a8530c88359a", "score": "0.54544014", "text": "func (in *DefragmentSpec) DeepCopy() *DefragmentSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DefragmentSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "a86000deefb3be8b42f25c112332d113", "score": "0.5451082", "text": "func (in *DeployerSpecDescriptor) DeepCopy() *DeployerSpecDescriptor {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DeployerSpecDescriptor)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "cad25939c22015ccaac72ecf8bfe0869", "score": "0.5445894", "text": "func (in *VirtualNetworkGateway_Spec) DeepCopy() *VirtualNetworkGateway_Spec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VirtualNetworkGateway_Spec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "1b04406f399ff6f395463ce19375114d", "score": "0.54412895", "text": "func (in *BlogSpec) DeepCopy() *BlogSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(BlogSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "87506cb335cb052c53c999810e2eac9d", "score": "0.54316336", "text": "func (in *WazzaSpec) DeepCopy() *WazzaSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(WazzaSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "76864e379506644a2dd6e3c9080e10df", "score": "0.5431416", "text": "func (in *StatefulSetSpec) DeepCopy() *StatefulSetSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(StatefulSetSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "76864e379506644a2dd6e3c9080e10df", "score": "0.5431416", "text": "func (in *StatefulSetSpec) DeepCopy() *StatefulSetSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(StatefulSetSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "d2f8628c848dda3b218521a893400ee0", "score": "0.54256797", "text": "func (in *CockroachDBSpec) DeepCopy() *CockroachDBSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(CockroachDBSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "5a28009d1092b8a4ceaeef3241b5d698", "score": "0.54234695", "text": "func (in *LinkerdSpec) DeepCopy() *LinkerdSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(LinkerdSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "b5afa4d111bf084f71d538560c4b0b6c", "score": "0.54146546", "text": "func (in *FluentdBufferSpec) DeepCopy() *FluentdBufferSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FluentdBufferSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "87e074e8b478290f1ab9a31ae29d6591", "score": "0.5405316", "text": "func (in *HarborList) DeepCopy() *HarborList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(HarborList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "7412f98900f24f9bb4df9360bbe37379", "score": "0.54013145", "text": "func (in *KubedgeSetSpec) DeepCopy() *KubedgeSetSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KubedgeSetSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "2804304f6a7598b309989c9da87f5050", "score": "0.5401194", "text": "func (in *HarborStorageImageChartStorageFileSystemSpec) DeepCopy() *HarborStorageImageChartStorageFileSystemSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(HarborStorageImageChartStorageFileSystemSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "5d2df356c87eb753e52043a1124577a0", "score": "0.5399022", "text": "func (in *VrouterSpec) DeepCopy() *VrouterSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(VrouterSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "95f786b490304b7835979f3d30be787a", "score": "0.5396784", "text": "func (in *KibanaSpec) DeepCopy() *KibanaSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(KibanaSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" } ]
b0a2d832a68b5424abf29192464e68eb
NormalizeLocalName transforms a repository name into a normalize LocalName Passes through the name without transformation on error (image id, etc)
[ { "docid": "45831b7ce0faf79f49ef3e81ff9cc8ea", "score": "0.88231003", "text": "func NormalizeLocalName(name string) string {\n\trepoInfo, err := ParseRepositoryInfo(name)\n\tif err != nil {\n\t\treturn name\n\t}\n\treturn repoInfo.LocalName\n}", "title": "" } ]
[ { "docid": "d48d17f0922e23efb6240783b62b6ef4", "score": "0.67112714", "text": "func (r *resolver) NormalizePkgName(name string) string {\n\tname = strings.TrimPrefix(name, r.gopath)\n\tname = strings.Replace(name, \"\\\\\", \"/\", -1)\n\tname = strings.TrimPrefix(name, \"/\")\n\treturn name\n}", "title": "" }, { "docid": "57ae8df230d61f240a64cce69289eeec", "score": "0.66127676", "text": "func NormalizeName(name string) (string, string) {\n\n\t// Fastpath check if a name in the GOROOT. There is an issue when a pkg\n\t// is in the GOROOT and GetRootFromPackage tries to look it up because it\n\t// expects remote names.\n\tb, err := util.GetBuildContext()\n\tif err == nil {\n\t\tp := filepath.Join(b.GOROOT, \"src\", filepath.FromSlash(name))\n\t\tif _, err := os.Stat(p); err == nil {\n\t\t\treturn name, \"\"\n\t\t}\n\t}\n\n\troot := util.GetRootFromPackage(name)\n\textra := strings.TrimPrefix(name, root)\n\tif len(extra) > 0 && extra != \"/\" {\n\t\textra = strings.TrimPrefix(extra, \"/\")\n\t} else {\n\t\t// If extra is / (which is what it would be here) we want to return \"\"\n\t\textra = \"\"\n\t}\n\n\treturn root, extra\n\n\t// parts := strings.SplitN(name, \"/\", 4)\n\t// extra := \"\"\n\t// if len(parts) < 3 {\n\t// \treturn name, extra\n\t// }\n\t// if len(parts) == 4 {\n\t// \textra = parts[3]\n\t// }\n\t// return strings.Join(parts[0:3], \"/\"), extra\n}", "title": "" }, { "docid": "9b37e3e9659bb4861d4d91f5c86b6c7e", "score": "0.6267824", "text": "func NormalizeName(s string) string {\n\treturn kmiputil.NormalizeName(s)\n}", "title": "" }, { "docid": "d539d76903facea091178dd48b08cab3", "score": "0.6096417", "text": "func ParseNormalizedNamed(s string) (Named, error) {\n\tif ok := anchoredIdentifierRegexp.MatchString(s); ok {\n\t\treturn nil, fmt.Errorf(\"repository name (%s) cannot be a 64-byte hexadecimal strings\", s)\n\t}\n\tdomain, remainder := splitDockerDomain(s)\n\tvar remoteName string\n\tif tagSep := strings.IndexRune(remainder, ':'); tagSep > -1 {\n\t\tremoteName = remainder[:tagSep]\n\t} else {\n\t\tremoteName = remainder\n\t}\n\tif strings.ToLower(remoteName) != remoteName {\n\t\treturn nil, errors.New(\"in a reference name, the repository part must be lowercase\")\n\t}\n\n\trem := domain + \"/\" + remainder\n\tif domain == \"\" {\n\t\trem = remainder\n\t}\n\tref, err := Parse(rem)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tnamed, isNamed := ref.(Named)\n\tif !isNamed {\n\t\treturn nil, fmt.Errorf(\"reference %s has no name\", ref.String())\n\t}\n\treturn named, nil\n}", "title": "" }, { "docid": "45508b727df633dd0376ec27b61cb2df", "score": "0.6077257", "text": "func (name Name) LocalName() string {\n\tif name.bucketName == \"\" {\n\t\treturn name.objectName\n\t}\n\treturn name.bucketName + \"/\" + name.objectName\n}", "title": "" }, { "docid": "1cc53935dc5af58dfa608637da853df3", "score": "0.6051766", "text": "func cleanRepoName(name string) (string, error) {\n\tif len(name) == 0 {\n\t\treturn name, errors.New(\"Empty repo name.\")\n\t}\n\tif strings.Contains(name, \"..\") {\n\t\treturn \"\", errors.New(\"Cannot change directory in file name.\")\n\t}\n\tname = strings.Replace(name, \"'\", \"\", -1)\n\treturn strings.TrimPrefix(strings.TrimSuffix(name, \".git\"), \"/\"), nil\n}", "title": "" }, { "docid": "17bade71eee0fac863ebd8b3b068596a", "score": "0.6047353", "text": "func ParseNormalizedNamed(s string) (Named, error) {\n\tif ok := anchoredIdentifierRegexp.MatchString(s); ok {\n\t\treturn nil, fmt.Errorf(\"invalid repository name (%s), cannot specify 64-byte hexadecimal strings\", s)\n\t}\n\tdomain, remainder := splitDockerDomain(s)\n\tvar remoteName string\n\tif tagSep := strings.IndexRune(remainder, ':'); tagSep > -1 {\n\t\tremoteName = remainder[:tagSep]\n\t} else {\n\t\tremoteName = remainder\n\t}\n\tif strings.ToLower(remoteName) != remoteName {\n\t\treturn nil, errors.New(\"invalid reference format: repository name must be lowercase\")\n\t}\n\n\tref, err := Parse(domain + \"/\" + remainder)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tnamed, isNamed := ref.(Named)\n\tif !isNamed {\n\t\treturn nil, fmt.Errorf(\"reference %s has no name\", ref.String())\n\t}\n\treturn named, nil\n}", "title": "" }, { "docid": "726e6018c93e5c8da26ecd80d31947cb", "score": "0.5941143", "text": "func NormalizePackageName(name string) string {\n\t// Per https://www.python.org/dev/peps/pep-0503/#normalized-names\n\tre := regexp.MustCompile(`[-_.]+`)\n\treturn strings.ToLower(re.ReplaceAllString(name, \"-\"))\n}", "title": "" }, { "docid": "a03f6b7f2e19d18c8ffc40fbd82a881c", "score": "0.58475983", "text": "func localName(name string) string {\n\treturn \"local_\" + cleanName(name)\n}", "title": "" }, { "docid": "effd8c525bd48ccf144884000edfa4dc", "score": "0.5823786", "text": "func NormalizedWorldName(worldID int) string {\n\tworld := WorldNames[worldID]\n\tif worldID != world.ID {\n\t\treturn \"\"\n\t}\n\tre := regexp.MustCompile(\"[^a-zA-Z]\")\n\tre2 := regexp.MustCompile(\"\\\\[.*\\\\]\")\n\tname := re.ReplaceAllString(world.Name, \"\")\n\tname = re2.ReplaceAllString(name, \"\")\n\treturn name\n}", "title": "" }, { "docid": "edc6a65a1cbd864790b3a1e2b5a52ccf", "score": "0.57586116", "text": "func normalizeName(s string) string {\n\treturn strings.Replace(snakecase.Snakecase(s), \"_\", \"-\", -1)\n}", "title": "" }, { "docid": "0547edd264dc0eeff0e17aa4d595dc5c", "score": "0.5722852", "text": "func NormalizeObjName(objName string) (string, error) {\n\tu, err := url.Parse(objName)\n\tif err != nil {\n\t\treturn \"\", nil\n\t}\n\n\tif u.Path == \"\" {\n\t\treturn objName, nil\n\t}\n\n\treturn url.PathUnescape(u.Path)\n}", "title": "" }, { "docid": "5211ca15cb09cd3d8ec1d65ab1566f6e", "score": "0.5719507", "text": "func getNameFromImgRepoFullName(repo string) string {\n\tidx := strings.Index(repo, \"/\")\n\treturn repo[idx+1:]\n}", "title": "" }, { "docid": "c819e3c999f02c21cdff53d8ae66fa40", "score": "0.56829834", "text": "func CanonicalName(s string) string {\n\treturn strings.ToLower(Fqdn(s))\n}", "title": "" }, { "docid": "b77c82320d79a7858c4e2b341d95b9d9", "score": "0.56680304", "text": "func TestNormalNames(t *testing.T) {\n\tnames := []string{\"AWSPVDriver\",\n\t\t\"AwsEnaNetworkDriver\",\n\t\t\"IntelSriovDriver\",\n\t\t\"a0\",\n\t\t\"Aa\",\n\t\t\"z_._._\",\n\t\t\"0_-_\",\n\t\t\"A\",\n\t\t\"ABCDEFGHIJKLM-NOPQRSTUVWXYZ.abcdefghijklm-nopqrstuvwxyz.1234567890\"}\n\tfor _, original := range names {\n\t\tnormalized := normalizeDirectory(original)\n\t\tassert.True(t, strings.EqualFold(original, normalized))\n\t}\n}", "title": "" }, { "docid": "d6bb01a75e67e6216072f89407f01611", "score": "0.5618293", "text": "func (o VmwareClusterOutput) LocalName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *VmwareCluster) pulumi.StringOutput { return v.LocalName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "5dcb1f2f3dc6e08bdf083d5c86af7e6f", "score": "0.56041586", "text": "func normalize(name string) string {\n\ttagLess := tagRegex.ReplaceAll([]byte(name), []byte(\"\"))\n\tsqueezed := whiteSpaceRegex.ReplaceAll(tagLess, []byte(\" \"))\n\treturn strings.ToLower(strings.TrimSpace(string(squeezed)))\n}", "title": "" }, { "docid": "0741d9b2da126bc5be5ead1498e951d6", "score": "0.5578047", "text": "func (r Repository) Name() string {\n\tparts := strings.Split(string(r), \"/\")\n\tif len(parts) == 2 {\n\t\treturn parts[1]\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "70bcdc422fb96ece87ed61528924c7a5", "score": "0.55546874", "text": "func ContactUtilsNormalizeUsername(username string) (string, error) {\n\tusernameChar := C.CString(username)\n\tdefer C.free(unsafe.Pointer(usernameChar))\n\tusernameStr := C.vsc_str_from_str(usernameChar)\n\n\tnormalizedBuf := C.vsc_str_buffer_new_with_capacity((C.size_t)(len(username)))\n\tdefer C.vsc_str_buffer_delete(normalizedBuf)\n\n\tproxyResult := /*pr4*/ C.vssq_contact_utils_normalize_username(usernameStr, normalizedBuf)\n\n\terr := CommKitErrorHandleStatus(proxyResult)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\truntime.KeepAlive(username)\n\n\treturn C.GoString(C.vsc_str_buffer_chars(normalizedBuf)) /* r7.1 */, nil\n}", "title": "" }, { "docid": "2aaf8de8d9261a17e11827f6d295438a", "score": "0.5525896", "text": "func familiarizeName(named namedRepository) repository {\n\trepo := repository{\n\t\tdomain: named.Domain(),\n\t\tpath: named.Path(),\n\t}\n\n\tif repo.domain == defaultDomain {\n\t\trepo.domain = \"\"\n\t\t// Handle official repositories which have the pattern \"library/<official repo name>\"\n\t\tif split := strings.Split(repo.path, \"/\"); len(split) == 2 && split[0] == officialRepoName {\n\t\t\trepo.path = split[1]\n\t\t}\n\t}\n\treturn repo\n}", "title": "" }, { "docid": "6d7379f85e20b83c8d626faa88cdffbf", "score": "0.55257803", "text": "func (n NormalizedNameRepository) AddNormalizedName(m models.NormalizedName) (normalizedName models.NormalizedName, err error) {\n\tc := n.newNormalizedNameCollection()\n\tdefer c.Close()\n\tm = m.NewNormalizedName()\n\terr = c.Collection.Insert(m)\n\tif mgo.IsDup(err) {\n\t\terr = nil\n\t}\n\treturn m, err\n}", "title": "" }, { "docid": "cbe185b2adcaf936b1b51282cbedfe91", "score": "0.5519518", "text": "func splitAndNormalizeTLFName(name string, public bool) (\n\twriterNames, readerNames []string,\n\textensionSuffix string, err error) {\n\twriterNames, readerNames, extensionSuffix, err = splitTLFName(name)\n\tif err != nil {\n\t\treturn nil, nil, \"\", err\n\t}\n\n\thasPublic := len(readerNames) == 0\n\n\tif public && !hasPublic {\n\t\t// No public folder exists for this folder.\n\t\treturn nil, nil, \"\", NoSuchNameError{Name: name}\n\t}\n\n\tnormalizedName, changes, err := normalizeNamesInTLF(\n\t\twriterNames, readerNames, extensionSuffix)\n\tif err != nil {\n\t\treturn nil, nil, \"\", err\n\t}\n\t// Check for changes - not just ordering differences here.\n\tif changes {\n\t\treturn nil, nil, \"\", TlfNameNotCanonical{name, normalizedName}\n\t}\n\n\treturn writerNames, readerNames, strings.ToLower(extensionSuffix), nil\n}", "title": "" }, { "docid": "71d9218ce0f68260b982d598c76d87aa", "score": "0.5495024", "text": "func NormalizeConfigName(s string) string {\n\treturn regexp.MustCompile(`[._-]([^\\w]|[_])|([^\\w\\-_.])`).ReplaceAllString(s, \"\")\n}", "title": "" }, { "docid": "105b0ce8f4f23a6cd7c27b8aa467fd58", "score": "0.54930276", "text": "func (r *TestRunner) sanitizedNamespaceName(nameToSanitize string) string {\n\tnsName := strings.ToLower(nameToSanitize)\n\tnsName = r.sanitizeRegex.ReplaceAllString(nsName, \"-\")\n\n\tif len(nsName) > 253 {\n\t\tnsName = nsName[:253]\n\t}\n\n\treturn nsName\n}", "title": "" }, { "docid": "105b0ce8f4f23a6cd7c27b8aa467fd58", "score": "0.54930276", "text": "func (r *TestRunner) sanitizedNamespaceName(nameToSanitize string) string {\n\tnsName := strings.ToLower(nameToSanitize)\n\tnsName = r.sanitizeRegex.ReplaceAllString(nsName, \"-\")\n\n\tif len(nsName) > 253 {\n\t\tnsName = nsName[:253]\n\t}\n\n\treturn nsName\n}", "title": "" }, { "docid": "bf6ae61fac6a2eafcc5232f45962065c", "score": "0.5486775", "text": "func (n NormalizedNameRepository) AddNormalizedName(m models.NormalizedName) (normalizedName models.NormalizedName, err error) {\n\tc := n.newNormalizedNameCollection()\n\tdefer c.Close()\n\tm = m.NewNormalizedName()\n\treturn m, c.Session.Insert(m)\n}", "title": "" }, { "docid": "2e3fe886f8482437b81db8c3c05f5230", "score": "0.54828477", "text": "func (n NormalizedNameRepository) GetNormalizedName(id bson.ObjectId) (models.NormalizedName, error) {\n\tvar (\n\t\tnormalizedName models.NormalizedName\n\t\terr error\n\t)\n\n\tc := n.newNormalizedNameCollection()\n\tdefer c.Close()\n\n\terr = c.Session.Find(bson.M{\"_id\": id}).One(&normalizedName)\n\treturn normalizedName, err\n}", "title": "" }, { "docid": "c6a990d478448bd3af2a3f3f12913b3c", "score": "0.54708165", "text": "func NormalizeOrg(org string) string {\n\treturn strings.TrimRight(ensuresHTTPSPrefix(org), \"/\")\n}", "title": "" }, { "docid": "9158b68614aeb7ecff8c7233b693b514", "score": "0.5464222", "text": "func normalizeNick(n string) string {\n\treturn strings.TrimRight(n, \"_\")\n}", "title": "" }, { "docid": "4837a82dd6d5cb9e238313443e3e98f7", "score": "0.54630846", "text": "func (n *SimpleNameNormalizer) Normalize(name string) string {\n\tvar retMe []byte\n\tnameBytes := []byte(name)\n\tfor i, b := range nameBytes {\n\t\tif n.safeByte(b) {\n\t\t\tif retMe != nil {\n\t\t\t\tretMe[i] = b\n\t\t\t}\n\t\t} else {\n\t\t\tif retMe == nil {\n\t\t\t\tretMe = make([]byte, len(nameBytes))\n\t\t\t\tcopy(retMe[0:i], nameBytes[0:i])\n\t\t\t}\n\t\t\tretMe[i] = n.Replacement\n\t\t}\n\t}\n\tif retMe == nil {\n\t\treturn name\n\t}\n\treturn string(retMe)\n}", "title": "" }, { "docid": "5343404a1607ff0daebc3f37b3285461", "score": "0.5458285", "text": "func NamespaceName(nodeName, localNamespace string) string {\n\th := fnv.New64()\n\t_, _ = h.Write([]byte(localNamespace)) // Writing to a hash never errors.\n\treturn fmt.Sprintf(\"%s-%x\", nodeName, h.Sum64())\n}", "title": "" }, { "docid": "40f191ba4216ef9091be67076b3e3e56", "score": "0.5450615", "text": "func authNormalize(auth string) string {\n\twords := strings.Split(auth, \" \")\n\tl := len(words) - 1\n\tif l > 0 {\n\t\twords = authTrimAnnot(words)\n\t\tl = len(words) - 1\n\t}\n\n\tauth = words[l]\n\tif strings.HasPrefix(auth, \"d'\") {\n\t\tauth = auth[2:]\n\t}\n\tauth = strings.TrimRight(auth, \".\")\n\tif auth == \"Linne\" {\n\t\tauth = \"Linn\"\n\t}\n\treturn auth\n}", "title": "" }, { "docid": "e80cd270464bd1515e0c77c4b0887949", "score": "0.5430371", "text": "func splitReposName(reposName string) (string, string) {\n\tnameParts := strings.SplitN(reposName, \"/\", 2)\n\tvar indexName, remoteName string\n\tif len(nameParts) == 1 || (!strings.Contains(nameParts[0], \".\") &&\n\t\t!strings.Contains(nameParts[0], \":\") && nameParts[0] != \"localhost\") {\n\t\t// This is a Docker Index repos (ex: samalba/hipache or ubuntu)\n\t\t// 'docker.io'\n\t\tindexName = IndexServerName()\n\t\tremoteName = reposName\n\t} else {\n\t\tindexName = nameParts[0]\n\t\tremoteName = nameParts[1]\n\t}\n\treturn indexName, remoteName\n}", "title": "" }, { "docid": "c04f1ba6575e822f63a17b62e4c16c52", "score": "0.5410749", "text": "func Canonicalize(repositoryString string) (Repository, error) {\n if !RepositoryRegex.MatchString(repositoryString) {\n return Repository{}, errors.New(`repository not valid`)\n }\n\n // Extracts the owner and name from repositoryString.\n repositoryMatches := matchNamedGroups(repositoryString)\n return Repository{repositoryMatches[`owner`], repositoryMatches[`name`]}, nil\n}", "title": "" }, { "docid": "cb02812662f776d6321d805507c0c9c8", "score": "0.54105014", "text": "func (a *Agent) cleanName(name string) string {\n\tif len(name) > 1 && name[0] == '/' {\n\t\treturn name[1:]\n\t}\n\treturn name\n}", "title": "" }, { "docid": "58fd4cccc54a1af1b9c0b9e99b51f2eb", "score": "0.5409898", "text": "func NormalizeNamespace(namespace string) (string, error) {\n\tvar buf bytes.Buffer\n\n\t// namespace longer than 100 characters are illegal\n\tif len(namespace) > 100 {\n\t\treturn \"\", fmt.Errorf(\"namespace is too long, should contain less than 100 characters\")\n\t}\n\n\tfor _, r := range namespace {\n\t\tswitch r {\n\t\t// has null rune just toss the whole thing\n\t\tcase '\\x00':\n\t\t\treturn \"\", fmt.Errorf(\"namespace cannot contain null character\")\n\t\t// drop these characters entirely\n\t\tcase '\\n', '\\r', '\\t':\n\t\t\tcontinue\n\t\t// replace characters that are generally used for xss with '-'\n\t\tcase '>', '<':\n\t\t\tbuf.WriteByte('-')\n\t\tdefault:\n\t\t\tbuf.WriteRune(r)\n\t\t}\n\t}\n\n\tnormalizedNamespace := buf.String()\n\tif normalizedNamespace == \"\" {\n\t\treturn \"\", fmt.Errorf(\"namespace cannot be empty\")\n\t}\n\n\treturn normalizedNamespace, nil\n}", "title": "" }, { "docid": "9bb0623298422f4ac3f6de12929c483d", "score": "0.54091096", "text": "func normalizeBucketName(name string) string {\n\tnospaces := regSpaces.ReplaceAllString(name, \"_\")\n\tnoslashes := regSlashes.ReplaceAllString(nospaces, \"-\")\n\treturn regInvalid.ReplaceAllString(noslashes, \"\")\n}", "title": "" }, { "docid": "6bbbc1e323e7be0aa4de09cb67811e32", "score": "0.54040986", "text": "func (n *Name) Local() *Name {\n\tif len(n.Names) < 2 {\n\t\treturn n\n\t}\n\treturn &Name{n.Principal, n.Names[0:1]}\n}", "title": "" }, { "docid": "18559f00f410b3b793a929ed73b7ac4c", "score": "0.5402789", "text": "func normalizeBlogName(name string) string {\n\tif !strings.Contains(name, \".\") {\n\t\tname = fmt.Sprintf(\"%s.tumblr.com\", name)\n\t}\n\treturn name\n}", "title": "" }, { "docid": "18559f00f410b3b793a929ed73b7ac4c", "score": "0.5402789", "text": "func normalizeBlogName(name string) string {\n\tif !strings.Contains(name, \".\") {\n\t\tname = fmt.Sprintf(\"%s.tumblr.com\", name)\n\t}\n\treturn name\n}", "title": "" }, { "docid": "c7ef0612693c36beac02b835b232acca", "score": "0.53988427", "text": "func (n NormalizedNameRepository) GetNormalizedName(id string) (models.NormalizedName, error) {\n\tvar (\n\t\tnormalizedName models.NormalizedName\n\t\terr error\n\t)\n\n\tc := n.newNormalizedNameCollection()\n\tdefer c.Close()\n\n\terr = c.Collection.Find(bson.M{\"_id\": id}).One(&normalizedName)\n\treturn normalizedName, err\n}", "title": "" }, { "docid": "978a7218021d4a0659dfc92c7a7ac56e", "score": "0.5367126", "text": "func splitReposName(reposName string) (string, string) {\n\tnameParts := strings.SplitN(reposName, \"/\", 2)\n\tvar indexName, remoteName string\n\tif len(nameParts) == 1 || (!strings.Contains(nameParts[0], \".\") &&\n\t\t!strings.Contains(nameParts[0], \":\") && nameParts[0] != \"localhost\") {\n\t\t// This is a Docker Index repos (ex: samalba/hipache or ubuntu)\n\t\tindexName = \"docker.io\"\n\t\tremoteName = reposName\n\t} else {\n\t\tindexName = nameParts[0]\n\t\tremoteName = nameParts[1]\n\t}\n\treturn indexName, remoteName\n}", "title": "" }, { "docid": "a43cfb2500ff8d0d90cf5185000cc894", "score": "0.53665495", "text": "func (r *Repo) FullName() string {\n\treturn fmt.Sprintf(\"%s/%s\", r.Username(), r.Name)\n}", "title": "" }, { "docid": "76a3f0b5a3080494810c44c6e964caa3", "score": "0.5362942", "text": "func NormalizeCloneURI(cloneURI string) string {\n\treturn strings.TrimRight(ensuresHTTPSPrefix(cloneURI), \"/\")\n}", "title": "" }, { "docid": "db156413707485a3c6d84f1ad16bfe06", "score": "0.5362836", "text": "func (a *Advertisement) LocalName() string {\n\tif a.packets().LocalName() != \"\" {\n\t\treturn a.packets().LocalName()\n\t}\n\tif a.sr != nil && a.sr.LocalName() != \"\" {\n\t\treturn a.sr.LocalName()\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "10fdd03af43def5677cbe843f11b7ca8", "score": "0.5362283", "text": "func NormalizeOrg(s, sep string) string {\n\ts = RemoveHost(s)\n\ts = strings.TrimSpace(s)\n\ts = strings.Trim(s, \"/\")\n\ts = strings.ReplaceAll(s, \"/\", sep)\n\treturn s\n}", "title": "" }, { "docid": "6235c8915357df36b2d2a0bb2b0cdfc0", "score": "0.535124", "text": "func NormalizeTypeName(name string) string {\n\tsegments := strings.Split(name, \".\")\n\treturn segments[len(segments)-1]\n}", "title": "" }, { "docid": "86e893909fb66eaeeaca7be09dde5d13", "score": "0.5343002", "text": "func normalizePackage(pkg string) string {\n\t// ignore leading https://\n\tpkg = strings.Replace(pkg, \"https://\", \"\", 1)\n\n\t// ignore leading github.com/\n\tpkg = strings.Replace(pkg, \"github.com/\", \"\", 1)\n\n\t// implicit github.com\n\tpkg = \"github.com/\" + pkg\n\n\treturn pkg\n}", "title": "" }, { "docid": "0922c1681089cb7e1795a83a8f25365e", "score": "0.5339454", "text": "func sanitizeName(name string) string {\n\tname = strings.Trim(name, \"/\")\n\tname = strings.ReplaceAll(name, \"/\", \".\")\n\tname = strings.ReplaceAll(name, \":\", \"\")\n\n\treturn name\n}", "title": "" }, { "docid": "3d094202286a3756991b6eb4c0b60e5d", "score": "0.53341943", "text": "func NormalizeLocalhost(id string) string {\n\treturn strings.Replace(id, \"localhost\", \"127.0.0.1\", -1)\n}", "title": "" }, { "docid": "31f4fa4deb02c28141a3680432acd30d", "score": "0.5331741", "text": "func TestAbnormalNames(t *testing.T) {\n\tnormalizedSet := make(map[string]bool)\n\tnames := []string{\"_foo_1234\",\n\t\t\"fo..\\\\bar\",\n\t\t\"~\" + longString(\"q\", 250),\n\t\tlongString(\"Qq&12\", 256),\n\t\t\".\",\n\t\t\".abc\",\n\t\t\"-\",\n\t\t\"foo \",\n\t\t\" foo\",\n\t\t\"*abc\",\n\t\t\"abc.\",\n\t\t\"abc:\",\n\t\t\"<0abc\",\n\t\t\"~1234\",\n\t\t\"../foo\",\n\t\t\"abc..def\"}\n\tfor _, original := range names {\n\t\tnormalized := normalizeDirectory(original)\n\t\t_, collision := normalizedSet[normalized]\n\t\tassert.False(t, collision, normalized)\n\t\tnormalizedSet[normalized] = true\n\t\tassert.False(t, strings.EqualFold(original, normalized))\n\t\tassert.True(t, len(normalized) <= dirMaxLength)\n\t\tassert.True(t, normalizedRegExpValidator.MatchString(normalized), normalized)\n\t}\n\t// there should be no collisions between normalized values\n\tassert.Equal(t, len(names), len(normalizedSet))\n\t// name normalization is case insensitive\n\tassert.Equal(t, normalizeDirectory(\"*FOO\"), normalizeDirectory(\"*foo\"))\n}", "title": "" }, { "docid": "fa848fd9c8de90f8586d14ae4aa20988", "score": "0.5304469", "text": "func namespaceNameOrName(obj *unstructured.Unstructured) string {\n\tif obj.GetNamespace() != \"\" {\n\t\treturn fmt.Sprintf(\n\t\t\t\"%s/%s\", obj.GetNamespace(), obj.GetName(),\n\t\t)\n\t}\n\treturn obj.GetName()\n}", "title": "" }, { "docid": "e8812a2efc76031cdd95c9fcbeb615ae", "score": "0.52948034", "text": "func normalizeParamName(orig string) (normalized string) {\n\tnormalized = orig\n\tnormalized = strings.Replace(normalized, \"electra.\", \"bert.\", -1)\n\tnormalized = strings.Replace(normalized, \".gamma\", \".weight\", -1)\n\tnormalized = strings.Replace(normalized, \".beta\", \".bias\", -1)\n\tif strings.HasPrefix(normalized, \"embeddings.\") {\n\t\tnormalized = fmt.Sprintf(\"bert.%s\", normalized)\n\t}\n\tif strings.HasPrefix(normalized, \"encoder.\") {\n\t\tnormalized = fmt.Sprintf(\"bert.%s\", normalized)\n\t}\n\tif strings.HasPrefix(normalized, \"pooler.\") {\n\t\tnormalized = fmt.Sprintf(\"bert.%s\", normalized)\n\t}\n\treturn\n}", "title": "" }, { "docid": "dbcd80d49e95f35b485d691f2b3fc25d", "score": "0.52765346", "text": "func (r *Repo) urlNormalized() *Repo {\n\tnormalized := deepcopy.Copy(*r).(Repo)\n\tnormalized.Name = dcl.SelfLinkToNameWithPattern(r.Name, \"projects/%s/repos/%s\")\n\tnormalized.Url = dcl.SelfLinkToName(r.Url)\n\tnormalized.Project = dcl.SelfLinkToName(r.Project)\n\treturn &normalized\n}", "title": "" }, { "docid": "e2dfd0029384dc54bf6250ebee0c7b84", "score": "0.5273315", "text": "func (r Repository) FullName() string {\n\treturn fmt.Sprintf(\"%s/%s\", r.OwnerName, r.RepoName)\n}", "title": "" }, { "docid": "c85efe367a78deeebdf10246e310bb3f", "score": "0.52376896", "text": "func FullName(r Interface) string {\n\treturn fmt.Sprintf(\"%s/%s\", r.RepoOwner(), r.RepoName())\n}", "title": "" }, { "docid": "99322ae3160e109c954397d57c2ba721", "score": "0.5234596", "text": "func CanonicalSymbolName(symbol string) string {\n\tsymbol = strings.TrimPrefix(symbol, \"io\")\n\tif symbol == \"WETH\" {\n\t\tsymbol = \"ETH\"\n\t}\n\treturn symbol\n}", "title": "" }, { "docid": "4a531e3af4c6364669b8ff8bcf2e3c3b", "score": "0.521508", "text": "func (a *Advertisement) LocalName() string {\n\tv, _ := a.localNameWErr()\n\treturn v\n}", "title": "" }, { "docid": "86456a51edbd9d9aa85d4b48dbaebb7e", "score": "0.52150095", "text": "func templateCleanImageName(s string) string {\n\tif ok, _ := assertManagedImageName(s, \"\"); ok {\n\t\treturn s\n\t}\n\tb := []byte(s)\n\tnewb := make([]byte, len(b))\n\tfor i := range newb {\n\t\tif isValidByteValue(b[i]) {\n\t\t\tnewb[i] = b[i]\n\t\t} else {\n\t\t\tnewb[i] = '-'\n\t\t}\n\t}\n\n\tnewb = bytes.TrimRight(newb, \"-_.\")\n\treturn string(newb)\n}", "title": "" }, { "docid": "e1057522b9efdfca92e74c82507b7739", "score": "0.5208754", "text": "func StudentRepoName(userName string) string {\n\treturn userName + StudentRepoSuffix\n}", "title": "" }, { "docid": "0f549d0d246485c4df551653f4cae968", "score": "0.51960874", "text": "func (o RepositoryUpstreamOutput) RepositoryName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v RepositoryUpstream) string { return v.RepositoryName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "7431913c23e5a9d969a94040947fd9ff", "score": "0.51917845", "text": "func relativeName(ref metav1.Object, obj *unstructured.Unstructured) string {\n\tif ref.GetNamespace() == \"\" && obj.GetNamespace() != \"\" {\n\t\treturn fmt.Sprintf(\"%s/%s\", obj.GetNamespace(), obj.GetName())\n\t}\n\treturn obj.GetName()\n}", "title": "" }, { "docid": "8dacb18824cd69394427a402d2a18a4a", "score": "0.5190746", "text": "func GetLocalName(namespace string) string {\n\treturn localQueueNamePrefix + namespace\n}", "title": "" }, { "docid": "c6547094d631cb9021d5f16dd0e7f291", "score": "0.51829726", "text": "func RepoInfoToName(repoInfo interface{}) interface{} {\n\treturn repoInfo.(*pfs.RepoInfo).Repo.Name\n}", "title": "" }, { "docid": "9584485737154d4a2949d8c7730996d0", "score": "0.51493263", "text": "func SanitizeName(name string) string {\n\tname = strings.ToLower(name)\n\tname = nameRegexp.ReplaceAllString(name, \"_\")\n\tname = firstCharRegexp.ReplaceAllString(name, \"z\")\n\tname = lastCharRegexp.ReplaceAllString(name, \"z\")\n\tif len(name) >= 254 {\n\t\tname = name[0:253]\n\t}\n\treturn name\n}", "title": "" }, { "docid": "169e1ea76da3c903d4545a132f349c7a", "score": "0.513378", "text": "func replaceNamespace(repository string, namespace string) string {\n\tif len(namespace) == 0 {\n\t\treturn repository\n\t}\n\t_, rest := util.ParseRepository(repository)\n\treturn fmt.Sprintf(\"%s/%s\", namespace, rest)\n}", "title": "" }, { "docid": "881b60e114a50b8f9ff554da99543bb8", "score": "0.51147187", "text": "func (l *LocalRepository) Name() string {\n\treturn l.name\n}", "title": "" }, { "docid": "f2c24899ac36df1525a6d78fd5981563", "score": "0.5090236", "text": "func CanonicalMailboxName(name string) string {\n\tif strings.ToUpper(name) == InboxName {\n\t\treturn InboxName\n\t}\n\treturn name\n}", "title": "" }, { "docid": "a023fb2336a41a4239c79d8e5720347b", "score": "0.5082119", "text": "func ValidateAndNormalizeRepositoryIdentifier(identifier string) (string, bool) {\n\t// trim leading and trailing whitespaces\n\tidentifier = strings.TrimSpace(identifier)\n\n\t// match identifier against regexp\n\tmatch := repoRegexp.FindStringSubmatch(identifier)\n\tif len(match) == 0 {\n\t\treturn identifier, false\n\t}\n\n\t// get matching groups from regexp\n\tsubmatches := util.MapSubexpNames(repoRegexp.SubexpNames(), match)\n\n\t// return repo identifier in <owner>/<repo> format\n\treturn fmt.Sprintf(\"%s/%s\", submatches[\"owner\"], submatches[\"repo\"]), true\n}", "title": "" }, { "docid": "c26db49c6f70e52ebc2b46b73921e70e", "score": "0.50741947", "text": "func NormalizeGitURL(repo string) string {\n\t// preprocess\n\trepo = ensureSuffix(repo, \".git\")\n\tif IsSSHURL(repo) {\n\t\trepo = ensurePrefix(repo, \"ssh://\")\n\t}\n\n\t// process\n\trepoURL, err := url.Parse(repo)\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\n\t// postprocess\n\trepoURL.Host = strings.ToLower(repoURL.Host)\n\tnormalized := repoURL.String()\n\treturn strings.TrimPrefix(normalized, \"ssh://\")\n}", "title": "" }, { "docid": "1772d100730ec02eaac7dd587a7cbd44", "score": "0.5058145", "text": "func WordSepNormalizeFunc(f *pflag.FlagSet, name string) pflag.NormalizedName {\n\tif strings.Contains(name, \"_\") {\n\t\treturn pflag.NormalizedName(strings.Replace(name, \"_\", \"-\", -1))\n\t}\n\treturn pflag.NormalizedName(name)\n}", "title": "" }, { "docid": "c843d10b8f2f0edda69c479cfbe0d1fe", "score": "0.50568295", "text": "func GetRepoNameFromURL(url string) (repoName string) {\n\tr := regexp.MustCompile(`(?:MatsuriJapon/)(?P<repoName>[^/]+)`)\n\tmatches := r.FindStringSubmatch(url)\n\trepoName = matches[1]\n\treturn\n}", "title": "" }, { "docid": "e09d83a3ffce6379a71ca7b77aaeb457", "score": "0.50546104", "text": "func (r *repo) Name() string {\n\treturn strings.TrimSuffix((strings.TrimPrefix(r.URL, \"git@github.com:\")), \".git\")\n}", "title": "" }, { "docid": "9bdb536d3a5c5b319600c9b527c78936", "score": "0.50531036", "text": "func SanitizeName(domain string) (string, error) {\n\tif domain == \"\" {\n\t\treturn \"\", errors.New(\"empty server name\")\n\t}\n\n\t// Note that this conversion is necessary because some server names in the handshakes\n\t// started by some clients (such as cURL) are not converted to Punycode, which will\n\t// prevent us from obtaining certificates for them. In addition, we should also treat\n\t// example.com and EXAMPLE.COM as equivalent and return the same certificate for them.\n\t// Fortunately, this conversion also helped us deal with this kind of mixedcase problems.\n\t//\n\t// Due to the \"σςΣ\" problem (see https://unicode.org/faq/idn.html#22), we can't use\n\t// idna.Punycode.ToASCII (or just idna.ToASCII) here.\n\tname, err := idna.Lookup.ToASCII(domain)\n\tif err != nil {\n\t\treturn \"\", errors.New(\"server name contains invalid character\")\n\t}\n\n\treturn name, nil\n}", "title": "" }, { "docid": "d44eb61401976e546c1c1f4997a21016", "score": "0.5053029", "text": "func convertName(name string) (*fullName, error) {\r\n\tif !strings.HasPrefix(name, \"R_\") {\r\n\t\tfmt.Printf(\"Can't understand the unexpected name: %s\\n\", name)\r\n\t\treturn nil, BAD_NAME\r\n\t}\r\n\tif !strings.HasSuffix(name, \".pdf\") {\r\n\t\tfmt.Printf(\"Can't understand the unexpected name: %s\\n\", name)\r\n\t\treturn nil, BAD_NAME\r\n\t}\r\n\tname = name[2:]\r\n\tname = name[0 : len(name)-4]\r\n\r\n\tpieces := strings.Split(name, \"-\")\r\n\tif len(pieces) != 2 && len(pieces) != 3 { //hyphenated last name!\r\n\t\tfmt.Printf(\"Can't understand expected split of 'page' part of name: %s\\n\", name)\r\n\t\treturn nil, BAD_NAME\r\n\t}\r\n\tif !strings.HasPrefix(pieces[len(pieces)-1], \"page\") {\r\n\t\tfmt.Printf(\"Can't understand expected 'page' part of name: %s\\n\", name)\r\n\t\treturn nil, BAD_NAME\r\n\t}\r\n\r\n\tname = strings.Join(pieces[0:len(pieces)-1], \" \")\r\n\tfull := strings.Split(name, \"_\")\r\n\tif len(full) < 2 {\r\n\t\tfmt.Printf(\"Can't understand the full name: %+v\\n\", full)\r\n\t\treturn nil, BAD_NAME\r\n\t}\r\n\r\n\tf := &fullName{}\r\n\r\n\t//special case reorg\r\n\tif len(full) > 3 && (strings.HasPrefix(full[0], \"Van\") || strings.HasPrefix(full[0], \"Di\")) {\r\n\t\tf.last = strings.Join(full[0:2], \" \")\r\n\t\tf.first = full[2]\r\n\t\tf.middle = strings.Join(full[3:], \" \")\r\n\t} else {\r\n\t\tf.last = full[0]\r\n\t\tf.first = full[1]\r\n\t\tif len(full) > 2 {\r\n\t\t\tf.middle = strings.Join(full[2:], \" \")\r\n\t\t}\r\n\t}\r\n\treturn f, nil\r\n}", "title": "" }, { "docid": "853a353aaa4285cf5ceb18cb2db2cf6c", "score": "0.5047009", "text": "func rewriteLabelName(s string) string {\n\treturn strings.TrimRight(strings.TrimLeft(s, \"_\"), \"_\")\n}", "title": "" }, { "docid": "0a849aec977624312adcc504f45b9cb4", "score": "0.5046067", "text": "func (gs *Git) LegacyName() string {\n\treturn filepath.Base(gs.Repo + gs.Subdir)\n}", "title": "" }, { "docid": "a63b316c5661805931c349fa4358df60", "score": "0.50450027", "text": "func cleanName(name string) string {\n\tfor strings.HasPrefix(name, encodedIDPrefix) {\n\t\tname = name[1:]\n\t}\n\treturn name\n}", "title": "" }, { "docid": "b9fba0af704204a328c43d1f7f3859ed", "score": "0.5044933", "text": "func normalizeNamesInTLF(writerNames, readerNames []string,\n\textensionSuffix string) (normalizedName string,\n\tchangesMade bool, err error) {\n\tchangesMade, err = normalizeNames(writerNames)\n\tif err != nil {\n\t\treturn \"\", false, err\n\t}\n\tsort.Strings(writerNames)\n\tnormalizedName = strings.Join(writerNames, \",\")\n\tif len(readerNames) > 0 {\n\t\trchanges, err := normalizeNames(readerNames)\n\t\tif err != nil {\n\t\t\treturn \"\", false, err\n\t\t}\n\t\tchangesMade = changesMade || rchanges\n\t\tsort.Strings(readerNames)\n\t\tnormalizedName += ReaderSep + strings.Join(readerNames, \",\")\n\t}\n\tif len(extensionSuffix) != 0 {\n\t\t// This *should* be normalized already but make sure. I can see not\n\t\t// doing so might surprise a caller.\n\t\tnExt := strings.ToLower(extensionSuffix)\n\t\tnormalizedName += tlf.HandleExtensionSep + nExt\n\t\tchangesMade = changesMade || nExt != extensionSuffix\n\t}\n\n\treturn normalizedName, changesMade, nil\n}", "title": "" }, { "docid": "c5cd26dcb7f6680ea0e61c606de8ba22", "score": "0.5042383", "text": "func (r *Repo) Name() string {\n\t// url part is max 24 chars incl. 8 chars hash.\n\tconst max = 24 - 8\n\n\th := fnv.New32a()\n\t_, _ = h.Write([]byte(r.url))\n\n\tb := path.Base(r.url)\n\tl := len(b)\n\tif l > max {\n\t\tl = max\n\t}\n\treturn fmt.Sprintf(\"src-%s-%x\", b[len(b)-l:], h.Sum32())\n}", "title": "" }, { "docid": "3d1f81812ade9eb77480d7d4fe1476be", "score": "0.5028969", "text": "func trimImage(name string) string {\n\tref, err := reference.ParseAnyReference(name)\n\tif err != nil {\n\t\treturn name\n\t}\n\tnamed, err := reference.ParseNamed(ref.String())\n\tif err != nil {\n\t\treturn name\n\t}\n\tnamed = reference.TrimNamed(named)\n\treturn reference.FamiliarName(named)\n}", "title": "" }, { "docid": "7b79e27b2d669e56d69959e278f69dd9", "score": "0.50285625", "text": "func (fn *NormalizableFunctionName) Normalize() (*QualifiedFunctionName, error) {\n\tswitch t := fn.FunctionName.(type) {\n\tcase *QualifiedFunctionName:\n\t\treturn t, nil\n\tcase UnresolvedName:\n\t\tqfn, err := t.NormalizeFunctionName()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfn.FunctionName = qfn\n\t\treturn qfn, nil\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"unsupported function name: %+v (%T)\", fn.FunctionName, fn.FunctionName))\n\t}\n}", "title": "" }, { "docid": "e089e89300c8d73991e20f45e1872862", "score": "0.50272506", "text": "func normaliseLabel(label string) string {\n\treturn invalidLabelNameCharRE.ReplaceAllString(label, \"_\")\n}", "title": "" }, { "docid": "616382fe86c87038fe60d3c136e532ad", "score": "0.50240695", "text": "func FromFullName(nwo string) (Interface, error) {\n\tvar r ghRepo\n\tparts := strings.SplitN(nwo, \"/\", 2)\n\tif len(parts) != 2 || parts[0] == \"\" || parts[1] == \"\" {\n\t\treturn &r, fmt.Errorf(\"expected OWNER/REPO format, got %q\", nwo)\n\t}\n\tr.owner, r.name = parts[0], parts[1]\n\treturn &r, nil\n}", "title": "" }, { "docid": "f6bb00a6fd4498a64a23d13e4ba8727d", "score": "0.50202334", "text": "func (node *QualifiedName) NormalizeTableName(database string) error {\n\tif node == nil || node.Base == \"\" {\n\t\treturn fmt.Errorf(\"empty table name: %s\", node)\n\t}\n\tif node.normalized == columnName {\n\t\treturn fmt.Errorf(\"already normalized as a column name: %s\", node)\n\t}\n\tif err := node.QualifyWithDatabase(database); err != nil {\n\t\treturn err\n\t}\n\n\tif len(node.Indirect) > 1 {\n\t\treturn fmt.Errorf(\"invalid table name: %s\", node)\n\t}\n\tswitch node.Indirect[0].(type) {\n\tcase NameIndirection:\n\t\t// Nothing to do.\n\tdefault:\n\t\treturn fmt.Errorf(\"invalid table name: %s\", node)\n\t}\n\tnode.normalized = tableName\n\treturn nil\n}", "title": "" }, { "docid": "c5d6163bbfa726fd2d1af4e1dc44ee3a", "score": "0.50150555", "text": "func MutagenSyncName(name string) string {\n\tname = strings.ReplaceAll(name, \".\", \"\")\n\tif unicode.IsNumber(rune(name[0])) {\n\t\tname = \"a\" + name\n\t}\n\treturn name\n}", "title": "" }, { "docid": "d317e5a8ac08720ead1921257e8bb623", "score": "0.5013928", "text": "func (*MetaData) ScrubForDocker(name string) (repoName string, err kv.Error) {\n\tfor _, aChar := range name {\n\t\tif aChar < '0' || aChar > 'z' || (aChar > '9' && aChar < 'A') || (aChar > 'Z' && aChar < 'a') {\n\t\t\tif aChar != '.' && aChar != '_' && aChar != '-' {\n\t\t\t\trepoName += \"-\"\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\trepoName += string(aChar)\n\t}\n\n\treturn strings.ToLower(repoName), nil\n}", "title": "" }, { "docid": "0083ca2e6a2684cf59816a3c1b582ca7", "score": "0.49988878", "text": "func (n UnresolvedName) NormalizeFunctionName() (*QualifiedFunctionName, error) {\n\tif len(n) == 0 {\n\t\treturn nil, fmt.Errorf(\"invalid function name: %q\", n)\n\t}\n\n\tname, ok := n[len(n)-1].(Name)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"invalid function name: %q\", n)\n\t}\n\n\tif len(name) == 0 {\n\t\treturn nil, fmt.Errorf(\"empty function name: %q\", n)\n\t}\n\n\treturn &QualifiedFunctionName{FunctionName: name, Context: NameParts(n[:len(n)-1])}, nil\n}", "title": "" }, { "docid": "4f4ae307f38dc6c3944700da6c6bc51b", "score": "0.4997746", "text": "func snakeCaseToPackageName(name string) string {\n\treturn strings.ReplaceAll(name, \"_\", \"\")\n}", "title": "" }, { "docid": "2d6f1e4d49b4dcc16139d0b8a8378ac8", "score": "0.4993758", "text": "func canonicalizeInstanceNames(instances []string, namespace string) []string {\n\tfor i := range instances {\n\t\tif !isFQN(instances[i]) {\n\t\t\tinstances[i] = instances[i] + \".\" + namespace\n\t\t}\n\t}\n\treturn instances\n}", "title": "" }, { "docid": "c6e7672c13c77e1272e360d1cc9c4d41", "score": "0.49915305", "text": "func ToCanonicalName(name string) string {\n\treturn ToRESTFriendlyName(name)\n}", "title": "" }, { "docid": "591fcd550bbc71348679ffa061e40e64", "score": "0.49813008", "text": "func wordSepNormalizeFunc(f *pflag.FlagSet, name string) pflag.NormalizedName {\n\treturn pflag.NormalizedName(strings.ReplaceAll(name, \"_\", \"-\"))\n}", "title": "" }, { "docid": "07a8f7dc50370a91d8a9a240237a1fe7", "score": "0.49766186", "text": "func NormalizeLocation(input string) string {\n\tif input == \"\" {\n\t\treturn input\n\t}\n\n\t// Check if the input is a recognized simple name.\n\tif _, found := locationsToDisplayNames[input]; found {\n\t\treturn input\n\t}\n\n\t// If input starts with '(', it should be the Regional display name. Then\n\t// removes the first bracket and its content. The leftover will be a\n\t// display name.\n\tif input[0] == '(' {\n\t\tif index := strings.IndexRune(input, ')'); index >= 0 {\n\t\t\tinput = input[index:]\n\t\t}\n\t\tinput = strings.TrimSpace(input)\n\t}\n\n\t// Check if the input is a recognized display name. If so, return the\n\t// simple name from the mapping.\n\tif location, found := displayNamesToLocations[input]; found {\n\t\treturn location\n\t}\n\n\t// Try our best to convert an unregconized input:\n\t// - Remove brackets and spaces.\n\t// - To lower case.\n\treplacer := strings.NewReplacer(\"(\", \"\", \")\", \"\", \" \", \"\")\n\treturn strings.ToLower(replacer.Replace(input))\n}", "title": "" }, { "docid": "6f022dc3b5a57ea78bb9073547829400", "score": "0.49750575", "text": "func NormalizeName(name string) (string, error) {\n\tlowercaseName := strings.ToLower(strings.TrimSpace(name))\n\tif err := IsValidName(lowercaseName); err != nil {\n\t\treturn \"\", errors.Wrapf(err, \"failed to normalize to a valid name for %s\", name)\n\t}\n\treturn lowercaseName, nil\n}", "title": "" }, { "docid": "629dbaffa7f4032b3640360eb19d933e", "score": "0.49708587", "text": "func normMetricNameParse(name string) (string, bool) {\n\tif name == \"\" || len(name) > MaxNameLen {\n\t\treturn name, false\n\t}\n\n\tvar i, ptr int\n\tres := make([]byte, 0, len(name))\n\n\t// skip non-alphabetic characters\n\tfor ; i < len(name) && !isAlpha(name[i]); i++ {\n\t}\n\n\t// if there were no alphabetic characters it wasn't valid\n\tif i == len(name) {\n\t\treturn \"\", false\n\t}\n\n\tfor ; i < len(name); i++ {\n\t\tswitch {\n\t\tcase isAlphaNum(name[i]):\n\t\t\tres = append(res, name[i])\n\t\t\tptr++\n\t\tcase name[i] == '.':\n\t\t\t// we skipped all non-alpha chars up front so we have seen at least one\n\t\t\tswitch res[ptr-1] {\n\t\t\t// overwrite underscores that happen before periods\n\t\t\tcase '_':\n\t\t\t\tres[ptr-1] = '.'\n\t\t\tdefault:\n\t\t\t\tres = append(res, '.')\n\t\t\t\tptr++\n\t\t\t}\n\t\tdefault:\n\t\t\t// we skipped all non-alpha chars up front so we have seen at least one\n\t\t\tswitch res[ptr-1] {\n\t\t\t// no double underscores, no underscores after periods\n\t\t\tcase '.', '_':\n\t\t\tdefault:\n\t\t\t\tres = append(res, '_')\n\t\t\t\tptr++\n\t\t\t}\n\t\t}\n\t}\n\n\tif res[ptr-1] == '_' {\n\t\tres = res[:ptr-1]\n\t}\n\n\treturn string(res), true\n}", "title": "" }, { "docid": "ee50db9dd3cdcb07cee35a70a289455e", "score": "0.49705666", "text": "func trimImage(name string) string {\n\tref, err := reference.ParseNamed(name)\n\tif err != nil {\n\t\treturn name\n\t}\n\treturn reference.TrimNamed(ref).String()\n}", "title": "" }, { "docid": "a102d34712bf77df40a4e963129e2aa7", "score": "0.49651372", "text": "func tarName(p string) (string, error) {\n\t// windows: convert windows style relative path with backslashes\n\t// into forward slashes. Since windows does not allow '/' or '\\'\n\t// in file names, it is mostly safe to replace however we must\n\t// check just in case\n\tif strings.Contains(p, \"/\") {\n\t\treturn \"\", fmt.Errorf(\"windows path contains forward slash: %s\", p)\n\t}\n\n\treturn strings.Replace(p, string(os.PathSeparator), \"/\", -1), nil\n}", "title": "" }, { "docid": "603efaf79ce0ef5d055f5162cf235777", "score": "0.4964662", "text": "func (mf *MongoFiles) getLocalFileName(gridFile *gfsFile) string {\n\tlocalFileName := mf.StorageOptions.LocalFileName\n\tif localFileName == \"\" {\n\t\tif gridFile != nil {\n\t\t\tlocalFileName = gridFile.Name\n\t\t} else {\n\t\t\tlocalFileName = mf.FileName\n\t\t}\n\t}\n\treturn localFileName\n}", "title": "" }, { "docid": "5fb1c249ae26cbc5fcc2856d6e3142cf", "score": "0.4950287", "text": "func sanitizeLabelName(name string) string {\n\tname = strings.ReplaceAll(name, \" \", \"_\")\n\tname = strings.ReplaceAll(name, \"/\", \"_\")\n\tname = strings.ReplaceAll(name, \"-\", \"_\")\n\tname = strings.ReplaceAll(name, \".\", \"_\")\n\treturn strings.ToLower(name)\n}", "title": "" }, { "docid": "844979b2fa7d7214c726dee53f872639", "score": "0.49493513", "text": "func ParseName(input string) (name Name) {\n\tinput = strings.TrimPrefix(input, \"ndn:\")\n\tfor _, token := range strings.Split(input, \"/\") {\n\t\tif token == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tcomp := ParseNameComponent(token)\n\t\tname = append(name, comp)\n\t}\n\treturn name\n}", "title": "" } ]
80d91778f31fd6759ac46c351ae0ea24
IsAbleToScaleDown check if is able to scale down, return the scale down num
[ { "docid": "5c9e22572f9b90fdb6c650c95c395f9d", "score": "0.69718724", "text": "func (e *BufferStrategyExecutor) IsAbleToScaleDown(strategy *storage.NodeGroupMgrStrategy) (int,\n\tbool, error) {\n\tblog.Infof(\"controller handle strategy %s for ResourcePool %s\", strategy.Name, strategy.ResourcePool)\n\tconsumerID := strategy.ReservedNodeGroup.ConsumerID\n\tif consumerID == \"\" {\n\t\treturn 0, false, fmt.Errorf(\"strategy %s consumer id is empty\", strategy.Name)\n\t}\n\t// query relative ResourcePool information from resource-manager\n\tpool, err := e.opt.ResourceManager.GetResourcePoolByCondition(strategy.ResourcePool, consumerID, \"\", nil)\n\tif err != nil {\n\t\tblog.Errorf(\"controller got ResourcePool %s from resource-manager failed, %s\",\n\t\t\tstrategy.ResourcePool, err.Error())\n\t\treturn 0, false, fmt.Errorf(\"get dependent resourcepool %s failed\", strategy.ResourcePool)\n\t}\n\ttotal := float64(pool.InitNum + pool.IdleNum + pool.ConsumedNum + pool.ReturnedNum)\n\tidleNum := pool.IdleNum + pool.InitNum + pool.ReturnedNum\n\twarnBuffer := float64(strategy.Strategy.Buffer.Low)\n\treservedNum := int(math.Ceil(total * warnBuffer / 100))\n\tblog.Infof(\"strategy %s, resourcePool:%s: total:%d, idleNum:%d, warnBuffer:%d, reservedNum:%d\",\n\t\tstrategy.Name, pool.ID, int(total), idleNum, int(warnBuffer), reservedNum)\n\tif idleNum >= reservedNum {\n\t\t//resource is enough, do nothing\n\t\tblog.Infof(\"ResourcePool %s resource is idle %d >= reserved %d, elasticNodeGroup don't scaleDown\",\n\t\t\tpool.ID, idleNum, reservedNum)\n\t\treturn 0, false, nil\n\t}\n\t//buffer resource is not enough, calculate necessary number for scale down\n\tscaleDownNum := reservedNum - idleNum\n\tblog.Infof(\"strategy:%s, scaleDownNum:%d\", strategy.Name, scaleDownNum)\n\treturn scaleDownNum, true, nil\n\n}", "title": "" } ]
[ { "docid": "ddb7ffcb50ef926dab2878899490b95e", "score": "0.63968635", "text": "func (r *LocalResource) scaleDown(ctx context.Context, g Group, byN int, repo Repository) error {\n\tr.log.WithField(\"by-n\", byN).Info(\"scaling down\")\n\n\tr.count = r.count - byN\n\treturn nil\n}", "title": "" }, { "docid": "a269123d2f658712e1e988ec885e960a", "score": "0.6281442", "text": "func (r *ReconcilePerconaServerMongoDB) safeDownscale(ctx context.Context, cr *api.PerconaServerMongoDB) (bool, error) {\n\tisDownscale := false\n\tfor _, rs := range cr.Spec.Replsets {\n\t\tsf, err := r.getRsStatefulset(ctx, cr, rs.Name)\n\t\tif err != nil && !k8serrors.IsNotFound(err) {\n\t\t\treturn false, errors.Wrap(err, \"get rs statefulset\")\n\t\t}\n\n\t\tif k8serrors.IsNotFound(err) {\n\t\t\tcontinue\n\t\t}\n\n\t\t// downscale 1 pod on each reconciliation\n\t\tif *sf.Spec.Replicas-rs.Size > 1 {\n\t\t\trs.Size = *sf.Spec.Replicas - 1\n\t\t\tisDownscale = true\n\t\t}\n\t}\n\n\treturn isDownscale, nil\n}", "title": "" }, { "docid": "1b2c6c43a4cdce3ed2c51a8b6ef7f5ff", "score": "0.62550664", "text": "func (e *BufferStrategyExecutor) IsAbleToScaleUp(strategy *storage.NodeGroupMgrStrategy) (int,\n\tbool, error) {\n\tblog.Infof(\"controller handle strategy %s for ResourcePool %s\", strategy.Name, strategy.ResourcePool)\n\t// query relative ResourcePool information from resource-manager\n\tconsumerID := strategy.ReservedNodeGroup.ConsumerID\n\tif consumerID == \"\" {\n\t\treturn 0, false, fmt.Errorf(\"strategy %s consumer id is empty\", strategy.Name)\n\t}\n\tpool, getErr := e.opt.ResourceManager.GetResourcePoolByCondition(strategy.ResourcePool, consumerID, \"\", nil)\n\tif getErr != nil {\n\t\tblog.Errorf(\"controller got ResourcePool %s from resource-manager failed, %s\",\n\t\t\tstrategy.ResourcePool, getErr.Error())\n\t\treturn 0, false, fmt.Errorf(\"get dependent resourcepool %s failed\", strategy.ResourcePool)\n\t}\n\ttotal := float64(pool.InitNum + pool.IdleNum + pool.ConsumedNum + pool.ReturnedNum)\n\tidleNum := pool.IdleNum + pool.InitNum + pool.ReturnedNum\n\twarnBuffer := float64(strategy.Strategy.Buffer.High)\n\treservedNum := int(math.Ceil(total * warnBuffer / 100))\n\tblog.Infof(\"strategy %s, resourcePool:%s: total:%d, idleNum:%d, warnBuffer:%d, reservedNum:%d\",\n\t\tstrategy.Name, pool.ID, int(total), idleNum, int(warnBuffer), reservedNum)\n\tif idleNum <= reservedNum {\n\t\t//resource is not idle enough\n\t\tblog.Infof(\"ResourcePool %s idle resource %d <= reserved %d, elasticNodeGroup don't scaleUp\",\n\t\t\tpool.ID, idleNum, reservedNum)\n\t\treturn 0, false, nil\n\t}\n\t// check resource pool is idle and stable\n\tnow := time.Now()\n\tdiff := now.Sub(pool.UpdatedTime)\n\tif diff.Seconds() < float64(strategy.Strategy.MaxIdleDelay*60) {\n\t\tblog.Infof(\"ResourcePool %s is not stable enough for elasticNodeGroup scaleUp, now: %.f, target: %d\",\n\t\t\tpool.ID, diff.Seconds(), strategy.Strategy.MaxIdleDelay*60)\n\t\treturn 0, false, nil\n\t}\n\t// resource is more than expected, check if controller can scale up\n\tscaleUpNum := idleNum - reservedNum\n\tif scaleUpNum < strategy.Strategy.MinScaleUpSize {\n\t\tblog.Infof(\"ResourcePool %s idle resource %d is less than MinScaleUpSize %d\",\n\t\t\tpool.ID, scaleUpNum, strategy.Strategy.MinScaleUpSize)\n\t\treturn 0, false, nil\n\t}\n\tblog.Infof(\"strategy %s scaleUpNum:%d\", strategy.Name, scaleUpNum)\n\t// feature(DeveloperJim): try to check ScaleUpCoolDown\n\t// if diff.Seconds() < strategy.Strategy.ScaleUpCoolDown do nothing\n\treturn scaleUpNum, true, nil\n}", "title": "" }, { "docid": "1cb96876d2b3a02b28a8496a8a2bb9fb", "score": "0.60951144", "text": "func (ts *TestService) GetScale() int {\n\tif ts.Service.Spec.Scale != nil {\n\t\treturn *ts.Service.Spec.Scale\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "c40521190f247c7e6939cf55a9a0449b", "score": "0.602779", "text": "func isDownscaleQuota(claim *cagipv1.ResourceQuotaClaim, managedQuota *v1.ResourceQuota) bool {\n\treturn claim.Spec.Cpu().MilliValue() < managedQuota.Spec.Hard.Cpu().MilliValue() ||\n\t\tclaim.Spec.Memory().Value() < managedQuota.Spec.Hard.Memory().Value()\n}", "title": "" }, { "docid": "6a335bdc40edabc02ee1abbcdfced7d8", "score": "0.59323347", "text": "func (f *FilesystemOperation) ScaleDown(name, namespace string) error {\n\tlogger.Infof(\"scaling down the number of filesystem active metadata servers via CRD\")\n\tif _, err := f.k8sh.ResourceOperation(\"apply\", f.manifests.GetFilesystem(namespace, name, 1)); err != nil {\n\t\treturn err\n\t}\n\n\tassert.True(f.k8sh.T(), f.k8sh.CheckPodCountAndState(\"rook-ceph-mds\", namespace, 2, \"Running\"),\n\t\t\"Make sure there are two rook-ceph-mds pods present in Running state\")\n\n\treturn nil\n}", "title": "" }, { "docid": "f6b47921727d34c3e864904c6d2e5919", "score": "0.59244055", "text": "func GetScaleMetrics(ctx context.Context, scalers []scalers.Scaler, scaledJob *kedav1alpha1.ScaledJob, recorder record.EventRecorder) (bool, int64, int64) {\n\tvar queueLength int64\n\tvar maxValue int64\n\tisActive := false\n\n\tlogger := logf.Log.WithName(\"scalemetrics\")\n\tscalersMetrics := getScalersMetrics(ctx, scalers, scaledJob, logger, recorder)\n\tswitch scaledJob.Spec.ScalingStrategy.MultipleScalersCalculation {\n\tcase \"min\":\n\t\tfor _, metrics := range scalersMetrics {\n\t\t\tif (queueLength == 0 || metrics.queueLength < queueLength) && metrics.isActive {\n\t\t\t\tqueueLength = metrics.queueLength\n\t\t\t\tmaxValue = metrics.maxValue\n\t\t\t\tisActive = metrics.isActive\n\t\t\t}\n\t\t}\n\tcase \"avg\":\n\t\tqueueLengthSum := int64(0)\n\t\tmaxValueSum := int64(0)\n\t\tlength := 0\n\t\tfor _, metrics := range scalersMetrics {\n\t\t\tif metrics.isActive {\n\t\t\t\tqueueLengthSum += metrics.queueLength\n\t\t\t\tmaxValueSum += metrics.maxValue\n\t\t\t\tisActive = metrics.isActive\n\t\t\t\tlength++\n\t\t\t}\n\t\t}\n\t\tif length != 0 {\n\t\t\tqueueLength = divideWithCeil(queueLengthSum, int64(length))\n\t\t\tmaxValue = divideWithCeil(maxValueSum, int64(length))\n\t\t}\n\tcase \"sum\":\n\t\tfor _, metrics := range scalersMetrics {\n\t\t\tif metrics.isActive {\n\t\t\t\tqueueLength += metrics.queueLength\n\t\t\t\tmaxValue += metrics.maxValue\n\t\t\t\tisActive = metrics.isActive\n\t\t\t}\n\t\t}\n\tdefault: // max\n\t\tfor _, metrics := range scalersMetrics {\n\t\t\tif metrics.queueLength > queueLength && metrics.isActive {\n\t\t\t\tqueueLength = metrics.queueLength\n\t\t\t\tmaxValue = metrics.maxValue\n\t\t\t\tisActive = metrics.isActive\n\t\t\t}\n\t\t}\n\t}\n\tmaxValue = min(scaledJob.MaxReplicaCount(), maxValue)\n\tlogger.V(1).WithValues(\"ScaledJob\", scaledJob.Name).Info(\"Checking if ScaleJob scalers are active\", \"isActive\", isActive, \"maxValue\", maxValue, \"MultipleScalersCalculation\", scaledJob.Spec.ScalingStrategy.MultipleScalersCalculation)\n\n\treturn isActive, queueLength, maxValue\n}", "title": "" }, { "docid": "6be2ee97a3b6437e006b7dbd3e2f649a", "score": "0.5860098", "text": "func canDownscaleQuota(claim *cagipv1.ResourceQuotaClaim, totalRequest *v1.ResourceList) string {\n\tif totalRequest.Memory().Value() > claim.Spec.Memory().Value() {\n\t\treturn fmt.Sprintf(\n\t\t\tutils.MessagePendingMemoryDownscale,\n\t\t\tutils.BytesSize(float64(claim.Spec.Memory().Value())),\n\t\t\tutils.BytesSize(float64(totalRequest.Memory().Value())))\n\n\t}\n\n\tif totalRequest.Cpu().MilliValue() > claim.Spec.Cpu().MilliValue() {\n\t\treturn fmt.Sprintf(\n\t\t\tutils.MessagePendingCpuDownscale,\n\t\t\tclaim.Spec.Cpu().String(),\n\t\t\ttotalRequest.Cpu().String())\n\t}\n\n\treturn utils.EmptyMsg\n}", "title": "" }, { "docid": "d7b0f7a7100cd125c953d86c9fa99861", "score": "0.5770303", "text": "func (ds *DynoScaler) checkScaling(\n\tqc WorkerConfig,\n\tqueues []rabbithole.QueueInfo,\n\tformations []heroku.Formation,\n) (newQuantity int, scale bool, err error) {\n\n\tvar qInfo *rabbithole.QueueInfo\n\tfor _, qi := range queues {\n\t\tif qi.Name == qc.QueueName {\n\t\t\tqInfo = &qi\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif qInfo == nil {\n\t\treturn 0, false, errors.New(\"unable to find queue info from RabbitMQ data\")\n\t}\n\n\tvar formation *heroku.Formation\n\tfor _, f := range formations {\n\t\tif f.Type == qc.WorkerType {\n\t\t\tformation = &f\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif formation == nil {\n\t\treturn 0, false, errors.New(\"unable to find formation info from Heroku data\")\n\t}\n\n\ttotalMsgs := qInfo.MessagesUnacknowledged + qInfo.Messages\n\n\tif totalMsgs > 0 {\n\t\tdesiredQuantity := maxWorkerCount(qc.MsgWorkerRatios, totalMsgs)\n\t\tif formation.Quantity < desiredQuantity {\n\t\t\tscale = true\n\t\t\tnewQuantity = desiredQuantity\n\t\t}\n\t} else if formation.Quantity > 0 {\n\t\tscale = true\n\t\tnewQuantity = 0\n\t}\n\n\treturn newQuantity, scale, nil\n}", "title": "" }, { "docid": "8068357e6bdaf0301aa57209f3377f3e", "score": "0.57666224", "text": "func (t *TCNP) ShouldScale(ctx context.Context, md infrastructurev1alpha2.AWSMachineDeployment) (bool, error) {\n\tcc, err := controllercontext.FromContext(ctx)\n\tif err != nil {\n\t\treturn false, microerror.Mask(err)\n\t}\n\n\tasgEmpty := cc.Status.TenantCluster.TCNP.ASG.IsEmpty()\n\tasgMaxEqual := cc.Status.TenantCluster.TCNP.ASG.MaxSize == key.MachineDeploymentScalingMax(md)\n\tasgMinEqual := cc.Status.TenantCluster.TCNP.ASG.MinSize == key.MachineDeploymentScalingMin(md)\n\n\tif !asgEmpty && !asgMaxEqual {\n\t\tt.logger.LogCtx(ctx, \"level\", \"debug\", \"message\", fmt.Sprintf(\"detected tenant cluster node pool should scale up due to scaling max changes from %d to %d\", cc.Status.TenantCluster.TCNP.ASG.MaxSize, key.MachineDeploymentScalingMax(md)))\n\t\treturn true, nil\n\t}\n\tif !asgEmpty && !asgMinEqual {\n\t\tt.logger.LogCtx(ctx, \"level\", \"debug\", \"message\", fmt.Sprintf(\"detected tenant cluster node pool should scale down due to scaling min changes from %d to %d\", cc.Status.TenantCluster.TCNP.ASG.MinSize, key.MachineDeploymentScalingMin(md)))\n\t\treturn true, nil\n\t}\n\n\treturn false, nil\n}", "title": "" }, { "docid": "93e46f0e3f9d8ec269b9b8c6563a0154", "score": "0.5756693", "text": "func (e *scaleExecutor) scaleToZeroOrIdle(ctx context.Context, logger logr.Logger, scaledObject *kedav1alpha1.ScaledObject, scale *autoscalingv1.Scale) {\n\tvar cooldownPeriod time.Duration\n\n\tif scaledObject.Spec.CooldownPeriod != nil {\n\t\tcooldownPeriod = time.Second * time.Duration(*scaledObject.Spec.CooldownPeriod)\n\t} else {\n\t\tcooldownPeriod = time.Second * time.Duration(defaultCooldownPeriod)\n\t}\n\n\t// LastActiveTime can be nil if the ScaleTarget was scaled outside of KEDA.\n\t// In this case we will ignore the cooldown period and scale it down\n\tif scaledObject.Status.LastActiveTime == nil ||\n\t\tscaledObject.Status.LastActiveTime.Add(cooldownPeriod).Before(time.Now()) {\n\t\t// or last time a trigger was active was > cooldown period, so scale in.\n\n\t\tidleValue, scaleToReplicas := getIdleOrMinimumReplicaCount(scaledObject)\n\n\t\tcurrentReplicas, err := e.updateScaleOnScaleTarget(ctx, scaledObject, scale, scaleToReplicas)\n\t\tif err == nil {\n\t\t\tmsg := \"Successfully set ScaleTarget replicas count to ScaledObject\"\n\t\t\tif idleValue {\n\t\t\t\tmsg += \" idleReplicaCount\"\n\t\t\t} else {\n\t\t\t\tmsg += \" minReplicaCount\"\n\t\t\t}\n\t\t\tlogger.Info(msg, \"Original Replicas Count\", currentReplicas, \"New Replicas Count\", scaleToReplicas)\n\n\t\t\te.recorder.Eventf(scaledObject, corev1.EventTypeNormal, eventreason.KEDAScaleTargetDeactivated,\n\t\t\t\t\"Deactivated %s %s/%s from %d to %d\", scaledObject.Status.ScaleTargetKind, scaledObject.Namespace, scaledObject.Spec.ScaleTargetRef.Name, currentReplicas, scaleToReplicas)\n\t\t\tif err := e.setActiveCondition(ctx, logger, scaledObject, metav1.ConditionFalse, \"ScalerNotActive\", \"Scaling is not performed because triggers are not active\"); err != nil {\n\t\t\t\tlogger.Error(err, \"Error in setting active condition\")\n\t\t\t\treturn\n\t\t\t}\n\t\t} else {\n\t\t\te.recorder.Eventf(scaledObject, corev1.EventTypeWarning, eventreason.KEDAScaleTargetDeactivationFailed,\n\t\t\t\t\"Failed to deactivated %s %s/%s\", scaledObject.Status.ScaleTargetKind, scaledObject.Namespace, scaledObject.Spec.ScaleTargetRef.Name, currentReplicas, scaleToReplicas)\n\t\t}\n\t} else {\n\t\tlogger.V(1).Info(\"ScaleTarget cooling down\",\n\t\t\t\"LastActiveTime\", scaledObject.Status.LastActiveTime,\n\t\t\t\"CoolDownPeriod\", cooldownPeriod)\n\n\t\tactiveCondition := scaledObject.Status.Conditions.GetActiveCondition()\n\t\tif !activeCondition.IsFalse() || activeCondition.Reason != \"ScalerCooldown\" {\n\t\t\tif err := e.setActiveCondition(ctx, logger, scaledObject, metav1.ConditionFalse, \"ScalerCooldown\", \"Scaler cooling down because triggers are not active\"); err != nil {\n\t\t\t\tlogger.Error(err, \"Error in setting active condition\")\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "228853aca412d9ea4a0ae9be3f8108ab", "score": "0.5728424", "text": "func (r *LocalResource) Scale(ctx context.Context, g Group, byN int, repo Repository) (bool, error) {\n\tif byN > 0 {\n\t\treturn true, r.scaleUp(ctx, g, byN, repo)\n\t} else if byN < 0 {\n\t\treturn false, r.scaleDown(ctx, g, 0-byN, repo)\n\t} else {\n\t\treturn false, nil\n\t}\n}", "title": "" }, { "docid": "0536b8f816aac287e4d4854f33148248", "score": "0.56960016", "text": "func (mgr *IndexerClusterPodManager) PrepareScaleDown(n int32) (bool, error) {\n\t// first, decommission indexer peer with enforceCounts=true; this will rebalance buckets across other peers\n\tcomplete, err := mgr.decommission(n, true)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tif !complete {\n\t\treturn false, nil\n\t}\n\n\t// next, remove the peer\n\tc := mgr.getClusterMasterClient()\n\treturn true, c.RemoveIndexerClusterPeer(mgr.cr.Status.Peers[n].ID)\n}", "title": "" }, { "docid": "b623e22a15dcc50358ee527024c6b2ed", "score": "0.56689584", "text": "func (a *Autoscaler) Scale(ctx context.Context, now time.Time) (int32, bool) {\n\tlogger := logging.FromContext(ctx)\n\ta.statsMutex.Lock()\n\tdefer a.statsMutex.Unlock()\n\n\tconfig := a.Current()\n\n\t// 60 second window\n\tstableData := newTotalAggregation(config.StableWindow)\n\n\t// 6 second window\n\tpanicData := newTotalAggregation(config.PanicWindow)\n\n\t// Last stat per Pod\n\tlastStat := make(map[string]Stat)\n\n\t// accumulate stats into their respective buckets\n\tfor key, stat := range a.stats {\n\t\tinstant := key.time\n\t\tif instant.Add(config.PanicWindow).After(now) {\n\t\t\tpanicData.aggregate(stat)\n\t\t}\n\t\tif instant.Add(config.StableWindow).After(now) {\n\t\t\tstableData.aggregate(stat)\n\n\t\t\t// If there's no last stat for this pod, set it\n\t\t\tif _, ok := lastStat[stat.PodName]; !ok {\n\t\t\t\tlastStat[stat.PodName] = stat\n\t\t\t}\n\t\t\t// If the current last stat is older than the new one, override\n\t\t\tif lastStat[stat.PodName].Time.Before(*stat.Time) {\n\t\t\t\tlastStat[stat.PodName] = stat\n\t\t\t}\n\t\t} else {\n\t\t\t// Drop metrics after 60 seconds\n\t\t\tdelete(a.stats, key)\n\t\t}\n\t}\n\n\t// Do nothing when we have no data.\n\tif stableData.observedPods(now) < 1.0 {\n\t\tlogger.Debug(\"No data to scale on.\")\n\t\treturn 0, false\n\t}\n\n\t// Log system totals\n\ttotalCurrentQPS := int32(0)\n\ttotalCurrentConcurrency := float64(0)\n\tfor _, stat := range lastStat {\n\t\ttotalCurrentQPS = totalCurrentQPS + stat.RequestCount\n\t\ttotalCurrentConcurrency = totalCurrentConcurrency + stat.AverageConcurrentRequests\n\t}\n\tlogger.Debugf(\"Current QPS: %v Current concurrent clients: %v\", totalCurrentQPS, totalCurrentConcurrency)\n\n\tobservedStableConcurrencyPerPod := stableData.observedConcurrencyPerPod(now)\n\tobservedPanicConcurrencyPerPod := panicData.observedConcurrencyPerPod(now)\n\t// Desired scaling ratio is observed concurrency over desired (stable) concurrency.\n\t// Rate limited to within MaxScaleUpRate.\n\tdesiredStableScalingRatio := a.rateLimited(observedStableConcurrencyPerPod / config.TargetConcurrency(a.containerConcurrency))\n\tdesiredPanicScalingRatio := a.rateLimited(observedPanicConcurrencyPerPod / config.TargetConcurrency(a.containerConcurrency))\n\n\tdesiredStablePodCount := desiredStableScalingRatio * stableData.observedPods(now)\n\tdesiredPanicPodCount := desiredPanicScalingRatio * stableData.observedPods(now)\n\n\ta.reporter.Report(ObservedPodCountM, float64(stableData.observedPods(now)))\n\ta.reporter.Report(ObservedStableConcurrencyM, observedStableConcurrencyPerPod)\n\ta.reporter.Report(ObservedPanicConcurrencyM, observedPanicConcurrencyPerPod)\n\ta.reporter.Report(TargetConcurrencyM, config.TargetConcurrency(a.containerConcurrency))\n\n\tlogger.Debugf(\"STABLE: Observed average %0.3f concurrency over %v seconds over %v samples over %v pods.\",\n\t\tobservedStableConcurrencyPerPod, config.StableWindow, stableData.probeCount, stableData.observedPods(now))\n\tlogger.Debugf(\"PANIC: Observed average %0.3f concurrency over %v seconds over %v samples over %v pods.\",\n\t\tobservedPanicConcurrencyPerPod, config.PanicWindow, panicData.probeCount, panicData.observedPods(now))\n\n\t// Stop panicking after the surge has made its way into the stable metric.\n\tif a.panicking && a.panicTime.Add(config.StableWindow).Before(now) {\n\t\tlogger.Info(\"Un-panicking.\")\n\t\ta.reporter.Report(PanicM, 0)\n\t\ta.panicking = false\n\t\ta.panicTime = nil\n\t\ta.maxPanicPods = 0\n\t}\n\n\t// Begin panicking when we cross the 6 second concurrency threshold.\n\tif !a.panicking && panicData.observedPods(now) > 0.0 && observedPanicConcurrencyPerPod >= (config.TargetConcurrency(a.containerConcurrency)*2) {\n\t\tlogger.Info(\"PANICKING\")\n\t\ta.reporter.Report(PanicM, 1)\n\t\ta.panicking = true\n\t\ta.panicTime = &now\n\t}\n\n\tvar desiredPodCount int32\n\n\tif a.panicking {\n\t\tlogger.Debug(\"Operating in panic mode.\")\n\t\tif desiredPanicPodCount > a.maxPanicPods {\n\t\t\tlogger.Infof(\"Increasing pods from %v to %v.\", panicData.observedPods(now), int(desiredPanicPodCount))\n\t\t\ta.panicTime = &now\n\t\t\ta.maxPanicPods = desiredPanicPodCount\n\t\t}\n\t\tdesiredPodCount = int32(math.Ceil(a.maxPanicPods))\n\t} else {\n\t\tlogger.Debug(\"Operating in stable mode.\")\n\t\tdesiredPodCount = int32(math.Ceil(desiredStablePodCount))\n\t}\n\n\ta.reporter.Report(DesiredPodCountM, float64(desiredPodCount))\n\treturn desiredPodCount, true\n}", "title": "" }, { "docid": "5d467a1ed676ff3987173d39bdf770a7", "score": "0.55811876", "text": "func Scale(ctx context.Context, db DB, p0 float64) (int, error) {\n\t// call pg_catalog.scale\n\tconst sqlstr = `SELECT * FROM pg_catalog.scale($1)`\n\t// run\n\tvar r0 int\n\tlogf(sqlstr, p0)\n\tif err := db.QueryRowContext(ctx, sqlstr, p0).Scan(&r0); err != nil {\n\t\treturn 0, logerror(err)\n\t}\n\treturn r0, nil\n}", "title": "" }, { "docid": "d5f327bc0a37884e990a7e45359cf364", "score": "0.5524968", "text": "func (self Sprite) GetScale() (float32, float32) {\n\tv := C.sfSprite_getScale(self.Cref)\n\treturn float32(v.x), float32(v.y)\n}", "title": "" }, { "docid": "c9457b4f96d4af42df67d7bf6a08f775", "score": "0.55054355", "text": "func (ts *TestService) waitForScale(want int) error {\n\tf := wait.ConditionFunc(func() (bool, error) {\n\t\terr := ts.reload()\n\t\tif err == nil {\n\t\t\tif ts.GetScale() == want {\n\t\t\t\treturn true, nil\n\t\t\t}\n\t\t}\n\t\treturn false, nil\n\t})\n\terr := wait.Poll(2*time.Second, 60*time.Second, f)\n\tif err != nil {\n\t\treturn errors.New(\"service failed to scale\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0e7299b7e5aa22fb8533e67e6fe38b78", "score": "0.55041826", "text": "func NewScaleDownInfo(size int, redis redis.RedisClient) *ScaleInfo {\n\treturn &ScaleInfo{\n\t\tsize: int64(size),\n\t\tredis: redis,\n\t\tscaleType: scaleTypeDown,\n\t}\n}", "title": "" }, { "docid": "44c14676c22181da918ee9908c61ab91", "score": "0.5497214", "text": "func (s *Stdout) Scale(ctx context.Context, newQ types.Quantity) (types.Quantity, types.ScalingMode, error) {\n\tactionStr := \"\"\n\tc, _ := s.Current(ctx)\n\tmode := types.NotScaling\n\tswitch {\n\n\tcase newQ.Q > c.Q:\n\t\tactionStr = \"Scaling up\"\n\t\tmode = types.ScalingUp\n\tcase newQ.Q < c.Q:\n\t\tactionStr = \"Scaling down\"\n\t\tmode = types.ScalingDown\n\tdefault:\n\t\tactionStr = \"Don't scalingup/down\"\n\t}\n\ts.currentQ = newQ.Q\n\tfmt.Fprintf(s.dst, \"%s %s: %d\\n\", s.MsgPrefix, actionStr, newQ.Q)\n\treturn newQ, mode, nil\n}", "title": "" }, { "docid": "f97a2ae73f3a3289f90fe1f79a533d60", "score": "0.54487115", "text": "func (s *ScaleInfo) Size() int {\n\treturn int(s.size)\n}", "title": "" }, { "docid": "9bb795dcfc1f0ae74c9fe81aa076b707", "score": "0.53771645", "text": "func (scaler *Scaler) ScaleUp(jobID string, region string) (err error) {\n\tnow := time.Now()\n\tmapID := jobID + \"-\" + region\n\tmutex.Lock()\n\t_, ok := scaler.jobMap[mapID]\n\tmutex.Unlock()\n\tif ok {\n\t\tmutex.Lock()\n\t\tdiff := now.Sub(scaler.jobMap[mapID].ScaleCooldownUp)\n\t\tmutex.Unlock()\n\t\tlog.Info(\"Job: \", jobID, \" ScaleUp can be retrigger in: \", diff)\n\t\treturn fmt.Errorf(\"Job in cooldown\")\n\t}\n\n\tvar nomadJob nomad.Job\n\tjobMapMutex.Lock()\n\t_, ok = jobMap[jobID]\n\tif ok {\n\t\tnomadJob = *jobMap[jobID]\n\t} else {\n\t\tnomadJob, err = GetJob(jobID, region)\n\t\tif err != nil {\n\t\t\tlog.Warn(\"Error getting job with err: \", err)\n\t\t\treturn err\n\t\t}\n\t}\n\tjobMapMutex.Unlock()\n\n\tvar AnyTrue bool\n\tgroupsMap, nomadJob := job.ParseJSON(nomadJob, \"up\")\n\n\tfor _, job := range groupsMap {\n\t\tif (job.ScaleMin == 0) || (job.ScaleMax == 0) || (job.ScaleCountUp == 0) || (job.ScaleCountDown == 0) || (job.Count == 0) {\n\t\t\tlog.Warn(jobID, \"Group: \", job.Group, \" doesn't have a scale stanza in it.\")\n\t\t\tjob.NoGo = true\n\t\t}\n\n\t\tjob.ScaleCooldown = job.ScaleCooldownUp\n\t\tmutex.Lock()\n\n\t\tscaler.jobMap[mapID] = job\n\t\tmutex.Unlock()\n\n\t\tif job.Count >= job.ScaleMax {\n\t\t\tlog.Info(\"Job: \", jobID, \" Group: \", job.GroupName, \" in: \", region, \" is at MaxCount (\", job.ScaleMax, \" allocations)\")\n\t\t\tjob.NoGo = true\n\t\t} else if job.Count < job.ScaleMin {\n\t\t\tlog.Info(\"Job \", jobID, \" Group: \", job.GroupName, \" in: \", region, \" is below the MinCount\")\n\t\t\tjob.NoGo = true\n\t\t} else {\n\t\t\tjob.NoGo = false\n\t\t}\n\t\tstructLocal := groupsMap[job.GroupName]\n\t\tstructLocal = job\n\t\tgroupsMap[job.GroupName] = structLocal\n\t}\n\n\tfor _, job := range groupsMap {\n\t\tif job.NoGo == false {\n\t\t\tlog.Debug(job.GroupName, \" Group needs to be scaled Up.\")\n\t\t\tAnyTrue = true\n\t\t}\n\t}\n\n\tif AnyTrue {\n\t\tp := log.Debug\n\t\tp(\"\")\n\t\tp(\"Scaling UP: \")\n\t\tp(\"JobName: \", jobID)\n\n\t\tfor _, job := range groupsMap {\n\t\t\tp(\"Group: \", job.GroupName)\n\t\t\tif job.TaskName != \"\" {\n\t\t\t\tp(\"TaskName: \", job.TaskName)\n\t\t\t}\n\t\t\tp(\"Region: \", job.Region)\n\t\t\tp(\"ScaleMin: \", job.ScaleMin)\n\t\t\tp(\"ScaleMax: \", job.ScaleMax)\n\t\t\tp(\"ScaleCountUp: \", job.ScaleCountUp)\n\t\t\tp(\"ScaleCountDown: \", job.ScaleCountDown)\n\t\t\tp(\"Count: \", job.Count)\n\t\t\tp(\"ScaleCooldown: \", job.ScaleCooldown)\n\t\t}\n\t\terr := ScaleJobUp(groupsMap, nomadJob)\n\t\tif err != nil {\n\t\t\tlog.Error(\"Scale down failed with err: \", err)\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c86fc4ffa43d49822ee560b311a59a33", "score": "0.5369636", "text": "func (t *T) Scale(v bool) {\n\tt.scale = v\n}", "title": "" }, { "docid": "5081743260651fc7a0fd03baf00c3551", "score": "0.53388005", "text": "func scale(n float64) string { return fmt.Sprintf(`scale(%g)`, n) }", "title": "" }, { "docid": "b81140c2ff84050692aa01c2320a59ea", "score": "0.5338226", "text": "func ScaleDownDeployment(client clientset.Interface, deploymentObject *apps.Deployment, namespace string, replicaCount int32) {\n\ts, err := client.AppsV1().\n\t\tDeployments(namespace).\n\t\tGetScale(context.TODO(), deploymentObject.Name, metav1.GetOptions{})\n\tgomega.Expect(err).NotTo(gomega.HaveOccurred())\n\n\tsc := *s\n\tsc.Spec.Replicas = replicaCount\n\n\t_, err = client.AppsV1().\n\t\tDeployments(namespace).\n\t\tUpdateScale(context.TODO(),\n\t\t\tdeploymentObject.Name, &sc, metav1.UpdateOptions{})\n\tgomega.Expect(err).NotTo(gomega.HaveOccurred())\n\t// wait for few seconds to delete pods\n\tfor i := 0; i < 2; i++ {\n\t\ttime.Sleep(10 * time.Second)\n\t\ts, err := client.AppsV1().\n\t\t\tDeployments(namespace).\n\t\t\tGetScale(context.TODO(), deploymentObject.Name, metav1.GetOptions{})\n\t\tgomega.Expect(err).NotTo(gomega.HaveOccurred())\n\t\tif s.Spec.Replicas == replicaCount {\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b24f6b7641116c44d3da7288e888aa42", "score": "0.53203297", "text": "func ScaleUpDown(dbtask structs.DB_TASK, replicas int) (string, error) {\n\tlog.Println(\"Rotterdam > CAAS > Adapters > Kubernetes > Scaling [ScaleUpDown] Scaling up/down task [\" + dbtask.TaskDefinition.Name + \"] ...\")\n\n\tscale_obj, err := getK8sScale(dbtask.TaskDefinition)\n\tif err != nil {\n\t\tlog.Println(\"Rotterdam > CAAS > Adapters > Kubernetes > Scaling [ScaleUpDown] ERROR (1) \", err)\n\t\treturn \"\", err\n\t} else {\n\t\tscale_obj.Spec.Replicas = replicas\n\t\tstatus, err := updateK8sScale(dbtask.TaskDefinition, *scale_obj)\n\t\tif err == nil {\n\t\t\treturn status, nil\n\t\t}\n\t\terr = errors.New(\"Task creation failed. status = [\" + status + \"]\")\n\t\tlog.Println(\"Rotterdam > CAAS > Adapters > Kubernetes > Scaling [ScaleUpDown] ERROR (2) \", err)\n\t\treturn \"\", err\n\t}\n}", "title": "" }, { "docid": "02bc2e30768771bb06c9de9928535626", "score": "0.5306461", "text": "func (mr *myRaster) getCurrentScale() float32 {\n\treturn mr.a.mainWin.Canvas().Scale()\n}", "title": "" }, { "docid": "1b6d07cbf5083c30b0b1073b994b1854", "score": "0.5299045", "text": "func scaleHasDesiredReplicas(sClient scaleclient.ScalesGetter, gr schema.GroupResource, resourceName string, namespace string, desiredReplicas int32) wait.ConditionFunc {\n\treturn func() (bool, error) {\n\t\tactualScale, err := sClient.Scales(namespace).Get(context.TODO(), gr, resourceName, metav1.GetOptions{})\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\t\t// this means the desired scale target has been reset by something else\n\t\tif actualScale.Spec.Replicas != desiredReplicas {\n\t\t\treturn true, nil\n\t\t}\n\t\treturn actualScale.Spec.Replicas == actualScale.Status.Replicas &&\n\t\t\tdesiredReplicas == actualScale.Status.Replicas, nil\n\t}\n}", "title": "" }, { "docid": "b2a581d38d49748437cd4ecf864cc3d0", "score": "0.52838266", "text": "func (o OceanLaunchSpecOutput) RestrictScaleDown() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v *OceanLaunchSpec) pulumi.BoolPtrOutput { return v.RestrictScaleDown }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "dde32e1745315c08abd39c584b6a9f88", "score": "0.52678466", "text": "func (r *Req) Scale() float64 {\n\treturn math.Abs(r.Upper.X()-r.Lower.X()) / float64(r.Width)\n}", "title": "" }, { "docid": "409aed9c6d7967e90364df9fde8b18d9", "score": "0.52661633", "text": "func (mon *Monitor) GetScale() float64 {\n\treturn float64(C.ulMonitorGetScale(mon.m))\n}", "title": "" }, { "docid": "8d4cda705f840888d4c8da7937417b11", "score": "0.5258835", "text": "func (ops *pxClusterOps) isScaleDownOfSharedAppsRequired(isMajorVerUpgrade bool, opts *UpgradeOptions) bool {\n\tif opts == nil || len(opts.SharedAppsScaleDown) == 0 || opts.SharedAppsScaleDown == SharedAppsScaleDownAuto {\n\t\treturn isMajorVerUpgrade\n\t}\n\n\treturn opts.SharedAppsScaleDown == SharedAppsScaleDownOn\n}", "title": "" }, { "docid": "3d0639277e1ebe781f1fee52f8af8f7b", "score": "0.5245366", "text": "func testScaleOut(t *testing.T, kc *kubernetes.Clientset, data templateData) {\n\tt.Log(\"--- testing scale out ---\")\n\tdata.MetricValue = 50\n\tKubectlApplyWithTemplate(t, data, \"updateMetricsTemplate\", updateMetricsTemplate)\n\n\tassert.True(t, WaitForDeploymentReplicaReadyCount(t, kc, deploymentName, namespace, maxReplicas, 60, 3),\n\t\t\"replica count should be %d after 3 minutes\", maxReplicas)\n}", "title": "" }, { "docid": "ad26b6eae9bd7890db50b9de339f3730", "score": "0.52392596", "text": "func (d *L3GD20HDriver) Scale() L3GD20HScale {\n\treturn d.scale\n}", "title": "" }, { "docid": "485ab58168b3d34e0c2859e420672dde", "score": "0.5222814", "text": "func (u *databaseUpgrade) scaleDownDatabase() error {\n\tu.log.Info(\"Scaling down the database deployment\", \"deployment\", \"syndesis-db\")\n\tif err := u.client().Patch(u.context, &oappsv1.DeploymentConfig{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"syndesis-db\",\n\t\t\tNamespace: u.namespace,\n\t\t},\n\t}, client.RawPatch(types.MergePatchType, []byte(`{\"spec\":{\"replicas\":0}}`))); err != nil {\n\t\treturn err\n\t}\n\n\tif err := u.awaitScale(\"syndesis-db\", newDeploymentConfigTracker()); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ff7abc9bc487845ee70e2af11e289c47", "score": "0.521163", "text": "func (o *Node2D) GetScale() gdnative.Vector2 {\n\t//log.Println(\"Calling Node2D.GetScale()\")\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(\"Node2D\", \"get_scale\")\n\n\t// Call the parent method.\n\t// Vector2\n\tretPtr := gdnative.NewEmptyVector2()\n\tgdnative.MethodBindPtrCall(methodBind, o.GetBaseObject(), ptrArguments, retPtr)\n\n\t// If we have a return type, convert it from a pointer into its actual object.\n\tret := gdnative.NewVector2FromPointer(retPtr)\n\treturn ret\n}", "title": "" }, { "docid": "d1826944c0454ccd075e09adf9f591b1", "score": "0.5210327", "text": "func Scale(app App, streamlet string, scale int) error {\n\tcmd := exec.Command(\"kubectl\", \"cloudflow\", \"scale\", app.Name, streamlet, strconv.Itoa(scale))\n\t_, err := cmd.CombinedOutput()\n\treturn err\n}", "title": "" }, { "docid": "4479118d0429407ff382f2232c768c0a", "score": "0.5207977", "text": "func wrapper_scale(t *eval.Thread, in []eval.Value, out []eval.Value) {\n\tif uiSettings.Terminated() {\n\t\treturn\n\t}\n\tn := in[0].(eval.UintValue).Get(t)\n\tswitch n {\n\tcase 1:\n\t\tmutex.Lock()\n\t\tuiSettings.ResizeVideo(false, false)\n\t\tmutex.Unlock()\n\tcase 2:\n\t\tmutex.Lock()\n\t\tuiSettings.ResizeVideo(true, false)\n\t\tmutex.Unlock()\n\t}\n}", "title": "" }, { "docid": "1c0e3a3ff77dc837eb37d036e20fc26f", "score": "0.52023286", "text": "func (a *Policy) ScalingAdjustment() *int64 {\n\tif a.ScalingAdjustmentVal != nil {\n\t\treturn a.ScalingAdjustmentVal\n\t}\n\n\tswitch *a.Type {\n\tcase cpuScaleDown:\n\t\treturn to.Int64p(-1) // default scale down one\n\tcase cpuScaleUp:\n\t\treturn to.Int64p(1) // default scale up one\n\t}\n\n\treturn to.Int64p(1)\n}", "title": "" }, { "docid": "26b9ea20d6b6c653862f3514c1213110", "score": "0.5200447", "text": "func AtScale(idx, tot int, val float64) bool {\n\tsize := 1 / float64(tot) * 100\n\tif val >= float64(idx)*size {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "38b1557f5c05c55ce0fbf84dd829ace2", "score": "0.5196796", "text": "func (dec *Decimal) GetScaleVal() (*big.Int, error) {\n\n\treturn dec.bigINum.GetScaleFactor(), nil\n}", "title": "" }, { "docid": "2cecadca2c1dd79e708cc21754411372", "score": "0.5168918", "text": "func (r *LocalResource) scaleUp(ctx context.Context, g Group, byN int, repo Repository) error {\n\tr.log.WithField(\"by-n\", byN).Info(\"scaling up\")\n\n\tr.count = r.count + byN\n\treturn nil\n}", "title": "" }, { "docid": "7182c5609da6b33759f961fb8c166fc8", "score": "0.51675457", "text": "func (rs *kpaScaler) Scale(kpa *kpa.PodAutoscaler, desiredScale int32) error {\n\tlogger := loggerWithKPAInfo(rs.logger, kpa.Namespace, kpa.Name)\n\n\tif desiredScale < 0 {\n\t\tlogger.Debug(\"Metrics are not yet being collected.\")\n\t\treturn nil\n\t}\n\n\t// TODO(mattmoor): Drop this once the KPA is the source of truth and we\n\t// scale exclusively on metrics.\n\trevGVK := v1alpha1.SchemeGroupVersion.WithKind(\"Revision\")\n\towner := metav1.GetControllerOf(kpa)\n\tif owner == nil || owner.Kind != revGVK.Kind ||\n\t\towner.APIVersion != revGVK.GroupVersion().String() {\n\t\tlogger.Debug(\"KPA is not owned by a Revision.\")\n\t\treturn nil\n\t}\n\n\t// Do not scale an inactive revision.\n\trevisionClient := rs.servingClientSet.ServingV1alpha1().Revisions(kpa.Namespace)\n\trev, err := revisionClient.Get(owner.Name, metav1.GetOptions{})\n\tif err != nil {\n\t\tlogger.Error(\"Unable to fetch Revision.\", zap.Error(err))\n\t\treturn err\n\t}\n\tif rev.Spec.ServingState != v1alpha1.RevisionServingStateActive {\n\t\tlogger.Info(\"Don't scale an inactive revision.\")\n\t\treturn nil\n\t}\n\n\tgv, err := schema.ParseGroupVersion(kpa.Spec.ScaleTargetRef.APIVersion)\n\tif err != nil {\n\t\tlogger.Error(\"Unable to parse APIVersion.\", zap.Error(err))\n\t\treturn err\n\t}\n\tresource := schema.GroupResource{\n\t\tGroup: gv.Group,\n\t\t// TODO(mattmoor): Do something better than this.\n\t\tResource: strings.ToLower(kpa.Spec.ScaleTargetRef.Kind) + \"s\",\n\t}\n\tresourceName := kpa.Spec.ScaleTargetRef.Name\n\n\t// Identify the current scale.\n\tscl, err := rs.scaleClientSet.Scales(kpa.Namespace).Get(resource, resourceName)\n\tif err != nil {\n\t\tlogger.Errorf(\"Resource %q not found.\", resourceName, zap.Error(err))\n\t\treturn err\n\t}\n\n\tcurrentScale := scl.Spec.Replicas\n\tif desiredScale == currentScale {\n\t\treturn nil\n\t}\n\n\t// Don't scale if current scale is zero. Rely on the activator to scale\n\t// from zero.\n\tif currentScale == 0 {\n\t\tlogger.Info(\"Cannot scale: Current scale is 0; activator must scale from 0.\")\n\t\treturn nil\n\t}\n\tlogger.Infof(\"Scaling from %d to %d\", currentScale, desiredScale)\n\n\t// When scaling to zero, flip the revision's ServingState to Reserve.\n\tif desiredScale == 0 {\n\t\t// TODO(mattmoor): Delay the scale to zero until the LTT of \"Active=False\"\n\t\t// is some time in the past.\n\t\tlogger.Debug(\"Setting revision ServingState to Reserve.\")\n\t\trev.Spec.ServingState = v1alpha1.RevisionServingStateReserve\n\t\tif _, err := revisionClient.Update(rev); err != nil {\n\t\t\tlogger.Error(\"Error updating revision serving state.\", zap.Error(err))\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t}\n\n\t// Scale the target reference.\n\tscl.Spec.Replicas = desiredScale\n\t_, err = rs.scaleClientSet.Scales(kpa.Namespace).Update(resource, scl)\n\tif err != nil {\n\t\tlogger.Errorf(\"Error scaling target reference %v.\", resourceName, zap.Error(err))\n\t\treturn err\n\t}\n\n\tlogger.Debug(\"Successfully scaled.\")\n\treturn nil\n}", "title": "" }, { "docid": "bd80d6b8b45a408c518bfa37d8c38488", "score": "0.5162004", "text": "func (i *InputWebFileGeoPointLocation) GetScale() (value int) {\n\tif i == nil {\n\t\treturn\n\t}\n\treturn i.Scale\n}", "title": "" }, { "docid": "a5a8508d3686cce375c3238a6ebb4fc1", "score": "0.51604176", "text": "func ScreenScale() float64 {\n\treturn ui.ScreenScale()\n}", "title": "" }, { "docid": "40dc9e8a21aabc958d01d5974b911cf6", "score": "0.5156624", "text": "func (bt backpressureTracker) delayScale() float64 {\n\tusedFrac := bt.usedFrac()\n\n\t// We want the delay to be 0 if usedFrac <= m and the max\n\t// delay if usedFrac >= M, so linearly interpolate the delay\n\t// scale.\n\tm := bt.minThreshold\n\tM := bt.maxThreshold\n\treturn math.Min(1.0, math.Max(0.0, (usedFrac-m)/(M-m)))\n}", "title": "" }, { "docid": "d42595d00d04d2b863e161ce9461304c", "score": "0.5155801", "text": "func Scaling(ctx context.Context, cluster *kubernetes.Cluster, appRef models.AppRef) (int32, error) {\n\tscaleSecret, err := scaleLoad(ctx, cluster, appRef)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn ScalingFromSecret(scaleSecret)\n}", "title": "" }, { "docid": "0835a9a77b0966870ef1793a2ed8f7b1", "score": "0.5149019", "text": "func HasNoScaleDownAnnotation(node *apiv1.Node) bool {\n\treturn node.Annotations[ScaleDownDisabledKey] == \"true\"\n}", "title": "" }, { "docid": "6500ac4958fe9550059b8f0b7ecc600f", "score": "0.5127322", "text": "func (ts *TestService) getScalingTimeout() time.Duration {\n\tscalingTimeout := time.Duration(math.Max(float64(ts.GetScale())*20, 120))\n\treturn time.Second * scalingTimeout\n}", "title": "" }, { "docid": "248f554dcc49d92cee272729fee96a03", "score": "0.5126295", "text": "func (s *genericScaler) Scale(namespace, resourceName string, newSize uint, preconditions *ScalePrecondition, retry, waitForReplicas *RetryParams, gvr schema.GroupVersionResource, dryRun bool) error {\n\tif retry == nil {\n\t\t// make it try only once, immediately\n\t\tretry = &RetryParams{Interval: time.Millisecond, Timeout: time.Millisecond}\n\t}\n\tcond := ScaleCondition(s, preconditions, namespace, resourceName, newSize, nil, gvr, dryRun)\n\tif err := wait.PollImmediate(retry.Interval, retry.Timeout, cond); err != nil {\n\t\treturn err\n\t}\n\tif waitForReplicas != nil {\n\t\treturn WaitForScaleHasDesiredReplicas(s.scaleNamespacer, gvr.GroupResource(), resourceName, namespace, newSize, waitForReplicas)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d7c68caaa998b77642d17cea2a0163a8", "score": "0.5120937", "text": "func cleanupScale(s *types.Scale) error {\n\tswitch s.Type {\n\tcase types.ScaleNominal, types.ScaleOrdinal:\n\t\ts.UnitDesc = nil\n\tcase types.ScaleInterval:\n\t\ts.Values = nil\n\tdefault:\n\t\treturn fmt.Errorf(\"Invalid scale type for scale id %d\", s.Id)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "eac3fd7bd1e253bbe3c8dc2bf8f950de", "score": "0.5120511", "text": "func (s *StatefulSetScanner) Scale(obj *Object, state *int, replicas int) error {\n\tglog.Infof(\"Scaling %s/%s to %d replicas\", obj.Namespace, obj.Name, replicas)\n\tss, err := s.getStatefulSet(obj)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"GetScale failed with: %s\", err)\n\t}\n\trepl := int32(replicas)\n\tss.Spec.Replicas = &repl\n\tif state != nil {\n\t\tss.ObjectMeta = updateState(ss.ObjectMeta, *state)\n\t}\n\tapps, _ := appsv1beta.NewForConfig(s.kubernetes)\n\t_, err = apps.StatefulSets(obj.Namespace).Update(ss)\n\treturn err\n}", "title": "" }, { "docid": "b4726957a4767ccb54c8640c6b7d311c", "score": "0.51129144", "text": "func (o OpenWhiskDockerRunner) Scale(deployment falco.Deployment, options ...falco.ScaleOptions) (falco.Deployment, error) {\n\treturn deployment, nil\n}", "title": "" }, { "docid": "f31de03020efaf715071fe8b869babee", "score": "0.5106774", "text": "func intScale(val int, val_range int, out_range int) int {\n\tnum := val*(out_range-1)*2 + (val_range - 1)\n\tdem := (val_range - 1) * 2\n\treturn num / dem\n}", "title": "" }, { "docid": "29f00ef0b4559535df9ab28d40ad7b56", "score": "0.50954115", "text": "func Scale(c *deis.Client, appID string, targets map[string]int) error {\n\tu := fmt.Sprintf(\"/v2/apps/%s/scale/\", appID)\n\n\tbody, err := json.Marshal(targets)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tres, err := c.Request(\"POST\", u, body)\n\tif err == nil {\n\t\treturn res.Body.Close()\n\t}\n\treturn err\n}", "title": "" }, { "docid": "c251df919343b7945c05b053569531ce", "score": "0.5093003", "text": "func (mr *F64) Scale() float64 {\n\tr := mr.Range()\n\tif r != 0 {\n\t\treturn 1 / r\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "81b4469f74b4dd3a863bab4598e2eb1a", "score": "0.50863695", "text": "func (o *AnimationTreePlayer) TimescaleNodeGetScale(id string) float64 {\n\tlog.Println(\"Calling AnimationTreePlayer.TimescaleNodeGetScale()\")\n\n\t// Build out the method's arguments\n\tgoArguments := make([]reflect.Value, 1, 1)\n\tgoArguments[0] = reflect.ValueOf(id)\n\n\t// Call the parent method.\n\n\tgoRet := o.callParentMethod(o.baseClass(), \"timescale_node_get_scale\", goArguments, \"float64\")\n\n\treturnValue := goRet.Interface().(float64)\n\n\tlog.Println(\" Got return value: \", returnValue)\n\treturn returnValue\n\n}", "title": "" }, { "docid": "732c2c839e4add91f5558277e5d05a31", "score": "0.5075602", "text": "func (d Display) ScaleFactor() float64 {\n\treturn *d.o.ScaleFactor\n}", "title": "" }, { "docid": "14bd3224277041824a80b1c30c2be5fc", "score": "0.5057982", "text": "func (p *downSamplePolicyType) DownSampleSize() float64 {\n\treturn float64(p.downSampleSize)\n}", "title": "" }, { "docid": "4b20db13320f3a8fad801412836ccbaf", "score": "0.5051375", "text": "func (scaler *DeploymentScaler) Scale(namespace, name string, newSize uint, preconditions *ScalePrecondition, retry, waitForReplicas *RetryParams) error {\n\tif preconditions == nil {\n\t\tpreconditions = &ScalePrecondition{-1, \"\"}\n\t}\n\tif retry == nil {\n\t\t// Make it try only once, immediately\n\t\tretry = &RetryParams{Interval: time.Millisecond, Timeout: time.Millisecond}\n\t}\n\tcond := ScaleCondition(scaler, preconditions, namespace, name, newSize, nil)\n\tif err := wait.Poll(retry.Interval, retry.Timeout, cond); err != nil {\n\t\treturn err\n\t}\n\tif waitForReplicas != nil {\n\t\tdeployment, err := scaler.c.Deployments(namespace).Get(name, metav1.GetOptions{})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = wait.Poll(waitForReplicas.Interval, waitForReplicas.Timeout, client.DeploymentHasDesiredReplicas(scaler.c, deployment))\n\t\tif err == wait.ErrWaitTimeout {\n\t\t\treturn fmt.Errorf(\"timed out waiting for %q to be synced\", name)\n\t\t}\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9d96d644089007d047760736364218a8", "score": "0.5041545", "text": "func (w *Watcher) AutoScale() error {\n\tw.gracefulShutdown.wg.Add(1)\n\tdefer w.gracefulShutdown.wg.Done()\n\n\tlogger := w.Logger.WithFields(logrus.Fields{\n\t\t\"executionID\": uuid.NewV4().String(),\n\t\t\"operation\": \"autoScale\",\n\t\t\"scheduler\": w.SchedulerName,\n\t})\n\tlogger.Info(\"starting auto scale\")\n\n\tscheduler, autoScalingInfo, roomCountByStatus, err := controller.GetSchedulerScalingInfo(\n\t\tlogger,\n\t\tw.MetricsReporter,\n\t\tw.DB,\n\t\tw.RedisClient.Client,\n\t\tw.SchedulerName,\n\t)\n\tif err != nil {\n\t\tif strings.Contains(err.Error(), \"not found\") {\n\t\t\tw.Run = false\n\t\t\treturn err\n\t\t}\n\t\tlogger.WithError(err).Error(\"failed to get scheduler scaling info\")\n\t\treturn err\n\t}\n\n\terr = w.updateOccupiedTimeout(scheduler)\n\tif err != nil {\n\t\tlogger.WithError(err).Error(\"failed to update scheduler occupied timeout\")\n\t\treturn err\n\t}\n\n\tl := logger.WithFields(logrus.Fields{\n\t\t\"ready\": roomCountByStatus.Ready,\n\t\t\"creating\": roomCountByStatus.Creating,\n\t\t\"occupied\": roomCountByStatus.Occupied,\n\t\t\"terminating\": roomCountByStatus.Terminating,\n\t\t\"state\": scheduler.State,\n\t})\n\n\terr = controller.CreateNamespaceIfNecessary(\n\t\tlogger,\n\t\tw.MetricsReporter,\n\t\tw.KubernetesClient,\n\t\tscheduler,\n\t)\n\tif err != nil {\n\t\tlogger.WithError(err).Error(\"failed to create namespace\")\n\t\treturn err\n\t}\n\n\tnowTimestamp := time.Now().Unix()\n\n\tscaling, err := w.checkState(\n\t\tautoScalingInfo,\n\t\troomCountByStatus,\n\t\tscheduler,\n\t\tnowTimestamp,\n\t)\n\tif err != nil {\n\t\tlogger.WithError(err).Error(\"failed to get scheduler occupancy info\")\n\t\treturn err\n\t}\n\n\tif scaling.Delta > 0 {\n\t\tl.Info(\"scheduler is subdimensioned, scaling up\")\n\t\ttimeoutSec := w.Config.GetInt(\"scaleUpTimeoutSeconds\")\n\n\t\terr = controller.ScaleUp(\n\t\t\tlogger,\n\t\t\tw.RoomManager,\n\t\t\tw.MetricsReporter,\n\t\t\tw.DB,\n\t\t\tw.RedisClient.Client,\n\t\t\tw.KubernetesClient,\n\t\t\tscheduler,\n\t\t\tscaling.Delta,\n\t\t\ttimeoutSec,\n\t\t\tfalse,\n\t\t\tw.Config,\n\t\t)\n\t\tscheduler.State = models.StateInSync\n\t\tscheduler.StateLastChangedAt = nowTimestamp\n\t\tscaling.ChangedState = true\n\t\tif err == nil {\n\t\t\tscheduler.LastScaleOpAt = nowTimestamp\n\t\t}\n\t} else if scaling.Delta < 0 {\n\t\tl.Info(\"scheduler is overdimensioned, should scale down\")\n\t\ttimeoutSec := w.Config.GetInt(\"scaleDownTimeoutSeconds\")\n\n\t\tscaleDown := func() error {\n\t\t\treturn controller.ScaleDown(\n\t\t\t\tcontext.Background(),\n\t\t\t\tlogger,\n\t\t\t\tw.RoomManager,\n\t\t\t\tw.MetricsReporter,\n\t\t\t\tw.DB,\n\t\t\t\tw.RedisClient,\n\t\t\t\tw.KubernetesClient,\n\t\t\t\tscheduler,\n\t\t\t\t-scaling.Delta,\n\t\t\t\ttimeoutSec,\n\t\t\t)\n\t\t}\n\t\tlockErr, err := w.WithDownscalingLock(l, scaleDown)\n\t\tif lockErr != nil {\n\t\t\tl.WithError(err).Info(\"not able to acquire downScalingLock. Not scaling down\")\n\t\t\treturn nil\n\t\t}\n\n\t\tscheduler.State = models.StateInSync\n\t\tscheduler.StateLastChangedAt = nowTimestamp\n\t\tscaling.ChangedState = true\n\t\tif err == nil {\n\t\t\tscheduler.LastScaleOpAt = nowTimestamp\n\t\t}\n\t} else {\n\t\tl.Infof(\"scheduler '%s': state is as expected\", scheduler.Name)\n\t}\n\n\tif err != nil {\n\t\tlogger.WithError(err).Error(\"error scaling scheduler\")\n\t}\n\n\tif scaling.ChangedState {\n\t\terr = controller.UpdateSchedulerState(logger, w.MetricsReporter, w.DB, scheduler)\n\t\tif err != nil {\n\t\t\tlogger.WithError(err).Error(\"failed to update scheduler info\")\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "991512c5fb071f73db28034ab05c62a8", "score": "0.5038191", "text": "func (s *step) awaitScale(name string, tracker scaleTracker) error {\n\tif err := wait.PollImmediate(time.Second*3, time.Minute*15, func() (done bool, err error) {\n\t\tif err = s.client().Get(s.context, types.NamespacedName{Namespace: s.namespace, Name: name}, tracker.obj()); err != nil {\n\t\t\tif k8serr.IsNotFound(err) {\n\t\t\t\t// May not have been created yet so wait until the timeout\n\t\t\t\treturn false, nil\n\t\t\t}\n\n\t\t\treturn false, err\n\t\t}\n\n\t\tif !tracker.hasScaled() {\n\t\t\ts.log.Info(\"Waiting for the deployment to scale\", \"deployment\", name)\n\t\t\treturn false, nil\n\t\t}\n\n\t\treturn true, nil\n\t}); err != nil {\n\t\ts.log.Error(err, \"Failed in waiting for the deployment to scale\", \"deployment\", name)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7a0c305b7e146071d5804c9980e4ebd1", "score": "0.5002302", "text": "func (s *DeploymentScanner) Scale(obj *Object, state *int, replicas int) error {\n\tglog.Infof(\"Scaling %s/%s to %d replicas\", obj.Namespace, obj.Name, replicas)\n\tapps, err := kubernetes.NewForConfig(s.kubernetes)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdp, err := apps.AppsV1().Deployments(obj.Namespace).Get(obj.Name, metav1.GetOptions{})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"GetScale failed with: %s\", err)\n\t}\n\trepl := int32(replicas)\n\tdp.Spec.Replicas = &repl\n\tif state != nil {\n\t\tdp.ObjectMeta = updateState(dp.ObjectMeta, *state)\n\t}\n\t_, err = apps.AppsV1().Deployments(obj.Namespace).Update(dp)\n\treturn err\n}", "title": "" }, { "docid": "432308dee4a4000ce08d83d57ab39889", "score": "0.4999078", "text": "func (c *Context) Scale(src *uint8, str int, y, h int, d *uint8, ds int) int {\n\tcctxt := (*C.struct_SwsContext)(unsafe.Pointer(c))\n\tcsrc := (*C.uint8_t)(unsafe.Pointer(src))\n\tcstr := (*C.int)(unsafe.Pointer(&str))\n\tcd := (*C.uint8_t)(unsafe.Pointer(d))\n\tcds := (*C.int)(unsafe.Pointer(&ds))\n\treturn int(C.sws_scale(cctxt, &csrc, cstr, C.int(y), C.int(h), &cd, cds))\n}", "title": "" }, { "docid": "55b48cae1439036a4ba5d81894f3e612", "score": "0.49967954", "text": "func ScaleJobUp(groupsMap map[string]structs.JobStruct, nomadJob nomad.Job) error {\n\tfor _, job := range groupsMap {\n\t\tif job.Count >= job.ScaleMax {\n\t\t\tjob.EndValue = job.Count\n\t\t\tjob.NoGo = true\n\t\t} else {\n\t\t\tjob.EndValue = job.Count + job.ScaleCountUp\n\t\t\tif job.EndValue > job.ScaleMax {\n\t\t\t\tjob.EndValue = job.ScaleMax\n\t\t\t\tlog.Info(\"Scaling up Job: \", job.JobName, \" Group: \", job.GroupName, \" to maximum allowed. Max: \", job.ScaleMax)\n\t\t\t\tjob.NoGo = false\n\t\t\t}\n\t\t\tlog.Info(\"Job: \"+job.JobName+\" Group: \"+job.GroupName+\" on: \"+job.Region+\" NewCount is: \", job.EndValue)\n\t\t}\n\t\tstructLocal := groupsMap[job.GroupName]\n\t\tstructLocal.EndValue = job.EndValue\n\t\tgroupsMap[job.GroupName] = structLocal\n\t}\n\n\tfor _, newJob := range nomadJob.TaskGroups {\n\t\tif groupsMap[*newJob.Name].EndValue != 0 {\n\t\t\t*newJob.Count = groupsMap[*newJob.Name].EndValue\n\t\t}\n\t\tlog.Info(\"Job: \", *nomadJob.Name, \" Group: \", *newJob.Name, \" NewCount: \", *newJob.Count)\n\t}\n\n\tok, err := executeJob(nomadJob)\n\tif !ok {\n\t\tlog.Error(\"Error executing scaleup operation!\")\n\t\treturn err\n\t}\n\n\tmessage := `SCALE UP:\n\t- Job: ` + *nomadJob.Name + `\n\t- Region: ` + *nomadJob.Region\n\tslack.SendMessage(message)\n\tslack.MessageBuffered(*nomadJob.Name, \"up\", time.Now())\n\n\tscalerVec.WithLabelValues(*nomadJob.Name, *nomadJob.Region, \"up\").Inc()\n\tLastJobs(*nomadJob.Name, *nomadJob.Region, \"scaleUp\", time.Now())\n\treturn nil\n}", "title": "" }, { "docid": "8393afb5ed7b77f0511687a640b7bf5e", "score": "0.49941656", "text": "func (win *Window) GetScale() float64 {\n\treturn float64(C.ulWindowGetScale(win.w))\n}", "title": "" }, { "docid": "2684e8f634cb0c5c16a45b3c7cde5cd8", "score": "0.49817917", "text": "func (a *ASG) Scale(ctx context.Context, newQ types.Quantity) (types.Quantity, types.ScalingMode, error) {\n\tmode := types.NotScaling\n\tcurrentQ, err := a.Current(ctx)\n\tif err != nil {\n\t\treturn types.Quantity{}, mode, err\n\t}\n\n\t// No change\n\tswitch {\n\tcase newQ.Q > currentQ.Q:\n\t\tmode = types.ScalingUp\n\tcase newQ.Q < currentQ.Q:\n\t\tmode = types.ScalingDown\n\tdefault:\n\t\treturn types.Quantity{}, mode, nil\n\t}\n\n\t// Limit the new valid to the ones closest to the finish hour that have run at least\n\t// the desired minutes of the running hour\n\tif a.remainingClosestHourLimit > 0 && mode == types.ScalingDown {\n\t\ta.log.Debugf(\"Filtering running instances with: %s\", a.remainingClosestHourLimit)\n\t\tq, err2 := a.filterClosestHourQ(newQ)\n\t\tif err2 != nil {\n\t\t\ta.log.Error(err2)\n\t\t} else {\n\t\t\tnewQ = q\n\t\t}\n\t}\n\n\tdesired := int64(newQ.Q)\n\tparams := &autoscaling.UpdateAutoScalingGroupInput{\n\t\tAutoScalingGroupName: aws.String(a.asgName),\n\t\tDesiredCapacity: aws.Int64(desired),\n\t}\n\n\t// If we want to force then set to desired\n\tif a.forceMinMax {\n\t\ta.log.Debugf(\"Forcing max & min with the same value as desired: %d \", desired)\n\t\tparams.MaxSize = params.DesiredCapacity\n\t\tparams.MinSize = params.DesiredCapacity\n\t}\n\n\t// Closest hour limit could change the wanted and not scale, check\n\tif currentQ.Q == newQ.Q {\n\t\ta.log.Infof(\"Want to scale to %d but didn't due to closest hour limiter, Iterations by filter without scaling: %d (max: %d)\", newQ.Q, a.remainingNoDownscaleC, a.maxTimesRemainingNoDownscale)\n\t\treturn types.Quantity{}, types.NotScaling, nil\n\t}\n\n\t_, err = a.asClient.UpdateAutoScalingGroup(params)\n\n\tif err != nil {\n\t\treturn types.Quantity{}, types.NotScaling, err\n\t}\n\n\ta.log.Infof(\"Scaled %s group from %d to %d desired instances\", a.asgName, currentQ.Q, newQ.Q)\n\treturn newQ, mode, nil\n}", "title": "" }, { "docid": "7b8d35748c8e96492bd7860b10535139", "score": "0.49783224", "text": "func scaleUpdate(ctx context.Context, cluster *kubernetes.Cluster,\n\tappRef models.AppRef, modifyScaling func(*v1.Secret)) error {\n\n\treturn retry.RetryOnConflict(retry.DefaultRetry, func() error {\n\t\tscaleSecret, err := scaleLoad(ctx, cluster, appRef)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif scaleSecret.Data == nil {\n\t\t\tscaleSecret.Data = map[string][]byte{\n\t\t\t\tinstanceKey: []byte(`1`),\n\t\t\t}\n\t\t}\n\n\t\tmodifyScaling(scaleSecret)\n\n\t\t_, err = cluster.Kubectl.CoreV1().Secrets(appRef.Namespace).Update(\n\t\t\tctx, scaleSecret, metav1.UpdateOptions{})\n\n\t\treturn err\n\t})\n}", "title": "" }, { "docid": "5fcaf068da67ce6ef6a4eaea1c4ea3f4", "score": "0.49776873", "text": "func (sg *SScalingGroup) Scale(ctx context.Context, triggerDesc IScalingTriggerDesc, action IScalingAction,\n\tcoolingTime int) error {\n\tlockman.LockObject(ctx, sg)\n\tdefer lockman.ReleaseObject(ctx, sg)\n\tisExec := false\n\tdefer func() {\n\t\tif isExec && coolingTime > 0 {\n\t\t\tsg.SetAllowScaleTime(time.Now().Add(time.Duration(coolingTime) * time.Second))\n\t\t}\n\t}()\n\tif sg.Enabled.IsFalse() {\n\t\treturn nil\n\t}\n\tscalingActivity, err := ScalingActivityManager.CreateScalingActivity(ctx, sg.Id, triggerDesc.TriggerDescription(), api.SA_STATUS_EXEC)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"create ScalingActivity whose ScalingGroup is %s error\", sg.Id)\n\t}\n\tif action.CheckCoolTime() && !sg.AllowScale() {\n\t\terr = scalingActivity.SetReject(\"\",\n\t\t\tfmt.Sprintf(\"The Cooling Time limit the execution time of the policy to at least: %s\",\n\t\t\t\tsg.AllowScaleTime.In(CoolingTimeLocation).Format(\"2006-01-02 15:04:05 -0700\")))\n\t\treturn nil\n\t}\n\n\tret := sg.exec(ctx, action)\n\tswitch ret.code {\n\tcase 0:\n\t\terr = scalingActivity.SetResult(ret.actionStr, api.SA_STATUS_SUCCEED, \"\", ret.intanceNum)\n\t\tisExec = true\n\tcase 1:\n\t\terr = scalingActivity.SetResult(ret.actionStr, api.SA_STATUS_PART_SUCCEED, ret.reason, ret.intanceNum)\n\t\tisExec = true\n\tcase 2:\n\t\terr = scalingActivity.SetReject(\"\", ret.reason)\n\tcase 3:\n\t\terr = scalingActivity.SetFailed(ret.actionStr, ret.reason)\n\t}\n\n\tif err != nil {\n\t\tlog.Errorf(\"ScalingActivity set result failed: %s\", err.Error())\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "46a08eacc049d566d2a5cc2e1874f2ff", "score": "0.49733394", "text": "func (o TableFieldSchemaResponseOutput) Scale() pulumi.StringOutput {\n\treturn o.ApplyT(func(v TableFieldSchemaResponse) string { return v.Scale }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "93ab74172395040786dc8a94ebdd16c8", "score": "0.49728996", "text": "func (o *Tween) GetSpeedScale() float64 {\n\tlog.Println(\"Calling Tween.GetSpeedScale()\")\n\n\t// Build out the method's arguments\n\tgoArguments := make([]reflect.Value, 0, 0)\n\n\t// Call the parent method.\n\n\tgoRet := o.callParentMethod(o.baseClass(), \"get_speed_scale\", goArguments, \"float64\")\n\n\treturnValue := goRet.Interface().(float64)\n\n\tlog.Println(\" Got return value: \", returnValue)\n\treturn returnValue\n\n}", "title": "" }, { "docid": "7b41134570f42ae95519511f08524c91", "score": "0.496489", "text": "func calculateNewShardCount(scaleAction string, downThreshold float64, currentShardCount int64) (int64, float64) {\n\tvar targetShardCount int64\n\tif scaleAction == \"Up\" {\n\t\ttargetShardCount = currentShardCount * 2\n\t}\n\n\tif scaleAction == \"Down\" {\n\t\ttargetShardCount = currentShardCount / 2\n\t\t// Set to minimum shard count\n\t\tif targetShardCount <= 1 {\n\t\t\ttargetShardCount = 1\n\t\t\t// At minimum shard count,set the scale down threshold to -1, so that scale down alarm remains in OK state\n\t\t\tdownThreshold = -1.0\n\t\t}\n\t}\n\treturn targetShardCount, downThreshold\n}", "title": "" }, { "docid": "2c54756c420da4210c4e4ca2bab961a9", "score": "0.4955792", "text": "func aeScale(interval time.Duration, n int) time.Duration {\n\t// Don't scale until we cross the threshold\n\tif n <= aeScaleThreshold {\n\t\treturn interval\n\t}\n\n\tmultiplier := math.Ceil(math.Log2(float64(n))-math.Log2(aeScaleThreshold)) + 1.0\n\treturn time.Duration(multiplier) * interval\n}", "title": "" }, { "docid": "03ad82370cdcb460ef34eab466c8ae8b", "score": "0.49457514", "text": "func (o LookupDatabaseResultOutput) ReadScale() pulumi.BoolOutput {\n\treturn o.ApplyT(func(v LookupDatabaseResult) bool { return v.ReadScale }).(pulumi.BoolOutput)\n}", "title": "" }, { "docid": "d1f3305bb0f35f869d7d7625aca8791c", "score": "0.4943317", "text": "func (c *Check) Scale(ctx context.Context, groupID string) *ActionStatus {\n\tlog := ctxutil.LogFromContext(ctx).WithField(\"group-id\", groupID)\n\n\tas := &ActionStatus{\n\t\tDone: make(chan bool, 1),\n\t}\n\n\tdefer func() {\n\t\tas.Done <- true\n\t}()\n\n\tgroup, err := c.repo.GetGroup(ctx, groupID)\n\tif err != nil {\n\t\tas.Err = err\n\t\treturn as\n\t}\n\n\tresource, err := group.Resource()\n\tif err != nil {\n\t\tas.Err = err\n\t\treturn as\n\t}\n\n\tvalue, err := group.MetricsValue(ctx)\n\tif err != nil {\n\t\tas.Err = err\n\t\treturn as\n\t}\n\n\tpolicy := group.Policy\n\tcount, err := resource.Count()\n\tif err != nil {\n\t\tas.Err = err\n\t\treturn as\n\t}\n\n\tnewCount := policy.CalculateSize(count, value)\n\n\tdelta := newCount - count\n\n\tchanged, err := resource.Scale(ctx, *group, delta, c.repo)\n\tif err != nil {\n\t\tas.Err = err\n\t\treturn as\n\t}\n\n\tif changed {\n\t\tlog.WithFields(logrus.Fields{\n\t\t\t\"metric\": group.MetricType,\n\t\t\t\"metric-value\": value,\n\t\t\t\"new-count\": newCount,\n\t\t\t\"delta\": delta,\n\t\t}).Info(\"group change status\")\n\n\t\tif err := group.MetricNotify(); err != nil {\n\t\t\tlog.WithError(err).Error(\"notifying metric of current config\")\n\t\t\tas.Err = err\n\t\t\treturn as\n\t\t}\n\n\t\twup := policy.WarmUpPeriod()\n\t\tlog.WithField(\"warm-up-duration\", wup).Info(\"waiting for new service to warm up\")\n\t\ttime.Sleep(wup)\n\t\tlog.Info(\"new service has warmed up\")\n\t}\n\n\tas.Delta = delta\n\tas.Count = newCount\n\treturn as\n}", "title": "" }, { "docid": "dffc8ea434cb853175df367ed6d6eba3", "score": "0.49343553", "text": "func (s *BasejvmBasicListener) ExitScalestmt(ctx *ScalestmtContext) {}", "title": "" }, { "docid": "3c2e1f46d165b1034e239e9c62f85278", "score": "0.49307075", "text": "func (o *AnimationPlayer) GetSpeedScale() float64 {\n\tlog.Println(\"Calling AnimationPlayer.GetSpeedScale()\")\n\n\t// Build out the method's arguments\n\tgoArguments := make([]reflect.Value, 0, 0)\n\n\t// Call the parent method.\n\n\tgoRet := o.callParentMethod(o.baseClass(), \"get_speed_scale\", goArguments, \"float64\")\n\n\treturnValue := goRet.Interface().(float64)\n\n\tlog.Println(\" Got return value: \", returnValue)\n\treturn returnValue\n\n}", "title": "" }, { "docid": "a60b11b327dde99f3d711df2b6097c24", "score": "0.4930323", "text": "func (this *TComDataCU) xGetDistScaleFactor(iCurrPOC, iCurrRefPOC, iColPOC, iColRefPOC int) int {\n iDiffPocD := iColPOC - iColRefPOC\n iDiffPocB := iCurrPOC - iCurrRefPOC\n\n if iDiffPocD != iDiffPocB {\n var iTDB, iTDD, iX, iScale int\n iTDB = iDiffPocB\n if iTDB < -128 {\n iTDB = -128\n } else if iTDB > 127 {\n iTDB = 127\n }\n\n iTDD = iDiffPocD\n if iTDD < -128 {\n iTDD = -128\n } else if iTDD > 127 {\n iTDD = 127\n }\n\n if iTDD < 0 {\n iX = (0x4000 - (iTDD / 2)) / iTDD\n } else {\n iX = (0x4000 + (iTDD / 2)) / iTDD\n }\n\n iScale = (iTDB*iX + 32) >> 6\n if iScale < -4096 {\n iScale = -4096\n } else if iScale > 4095 {\n iScale = 4095\n }\n return iScale\n }\n\n return 4096\n}", "title": "" }, { "docid": "2c8f30604c3146103134783629439901", "score": "0.4930251", "text": "func handleAutoscale(w http.ResponseWriter, r *http.Request) {\n\tif r == nil {\n\t\thttp.Error(w, \"Empty request\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tvar faReq autoscalingv1.FleetAutoscaleReview\n\tres, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n\n\terr = json.Unmarshal(res, &faReq)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n\tfaResp := autoscalingv1.FleetAutoscaleResponse{\n\t\tScale: false,\n\t\tReplicas: faReq.Request.Status.Replicas,\n\t\tUID: faReq.Request.UID,\n\t}\n\n\tif faReq.Request.Status.Replicas != 0 {\n\t\tallocatedPercent := float64(faReq.Request.Status.AllocatedReplicas) / float64(faReq.Request.Status.Replicas)\n\t\tif allocatedPercent > replicaUpperThreshold {\n\t\t\t// After scaling we would have percentage of 0.7/2 = 0.35 > replicaLowerThreshold\n\t\t\t// So we won't scale down immediately after scale up\n\t\t\tcurrentReplicas := float64(faReq.Request.Status.Replicas)\n\t\t\tfaResp.Scale = true\n\t\t\tfaResp.Replicas = int32(math.Ceil(currentReplicas * scaleFactor))\n\t\t} else if allocatedPercent < replicaLowerThreshold && faReq.Request.Status.Replicas > minReplicasCount {\n\t\t\tfaResp.Scale = true\n\t\t\tfaResp.Replicas = int32(math.Ceil(float64(faReq.Request.Status.Replicas) / scaleFactor))\n\t\t}\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\treview := &autoscalingv1.FleetAutoscaleReview{\n\t\tRequest: faReq.Request,\n\t\tResponse: &faResp,\n\t}\n\tlogger.WithField(\"review\", review).Info(\"FleetAutoscaleReview\")\n\tresult, _ := json.Marshal(&review)\n\n\t_, err = io.WriteString(w, string(result))\n\tif err != nil {\n\t\tlogger.WithError(err).Fatal(\"Error writing json from /scale\")\n\t}\n}", "title": "" }, { "docid": "ab4b1efe399db861b27907f17ae7ae9b", "score": "0.49249104", "text": "func decide(scale lib.Scale) (int, lib.Weight) {\n\treturn -1, lib.Equal // always wrong\n}", "title": "" }, { "docid": "daf6ff08a0f93035575d0d75d17e427b", "score": "0.49215174", "text": "func Scale(db server.Database, s Scaler) {\n\n\tresp, err := db.GetWorkers(context.TODO(), &pbr.GetWorkersRequest{})\n\tif err != nil {\n\t\tlog.Error(\"Failed GetWorkers request. Recovering.\", err)\n\t\treturn\n\t}\n\n\tfor _, w := range resp.Workers {\n\n\t\tif !s.ShouldStartWorker(w) {\n\t\t\tcontinue\n\t\t}\n\n\t\tserr := s.StartWorker(w)\n\t\tif serr != nil {\n\t\t\tlog.Error(\"Error starting worker\", serr)\n\t\t\tcontinue\n\t\t}\n\n\t\t// TODO should the Scaler instance handle this? Is it possible\n\t\t// that Initializing is the wrong state in some cases?\n\t\tw.State = pbr.WorkerState_Initializing\n\t\t_, err := db.UpdateWorker(context.TODO(), w)\n\n\t\tif err != nil {\n\t\t\t// TODO an error here would likely result in multiple workers\n\t\t\t// being started unintentionally. Not sure what the best\n\t\t\t// solution is. Possibly a list of failed workers.\n\t\t\t//\n\t\t\t// If the scheduler and database API live on the same server,\n\t\t\t// this *should* be very unlikely.\n\t\t\tlog.Error(\"Error marking worker as initializing\", err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "424f0ca85b45580e62e39538023d4452", "score": "0.49209526", "text": "func (asg *AutoScalingGroup) TargetSize() (int, error) {\n\tdesireNumber, err := asg.cloudServiceManager.GetDesireInstanceNumber(asg.groupID)\n\tif err != nil {\n\t\tklog.Warningf(\"failed to get group target size. groupID: %s, error: %v\", asg.groupID, err)\n\t\treturn 0, err\n\t}\n\n\treturn desireNumber, nil\n}", "title": "" }, { "docid": "86dc5a264466003e9e11365cb7b85aac", "score": "0.4912593", "text": "func (s *Slider) ScaleFactor() float32 {\n\n\treturn s.scaleFactor\n}", "title": "" }, { "docid": "fbfc48455dd85d0a4ddc7d81fcd48645", "score": "0.49090534", "text": "func (s *BasejvmBasicListener) EnterScalestmt(ctx *ScalestmtContext) {}", "title": "" }, { "docid": "7a8089f4d6273a470fc2a484f62b4ced", "score": "0.48998058", "text": "func (s *Driver) scaleVal(val byte) byte {\n\treturn byte(uint16(val) * uint16(s.brightness) / 255)\n}", "title": "" }, { "docid": "54b66f260d2f42b9041cfab05aed2f83", "score": "0.48986647", "text": "func (m *FloorPlanMutation) ScaleCleared() bool {\n\treturn m.clearedscale\n}", "title": "" }, { "docid": "50535eb8142bcbc0cf14899a293eb5b0", "score": "0.48985022", "text": "func UlMonitorGetScale(monitor ULMonitor) float64 {\n\tcmonitor, _ := *(*C.ULMonitor)(unsafe.Pointer(&monitor)), cgoAllocsUnknown\n\t__ret := C.ulMonitorGetScale(cmonitor)\n\t__v := (float64)(__ret)\n\treturn __v\n}", "title": "" }, { "docid": "7cfdb494d80d94a109a8484878f65b26", "score": "0.48969084", "text": "func (scaler *ReplicaSetScaler) Scale(namespace, name string, newSize uint, preconditions *ScalePrecondition, retry, waitForReplicas *RetryParams) error {\n\tif preconditions == nil {\n\t\tpreconditions = &ScalePrecondition{-1, \"\"}\n\t}\n\tif retry == nil {\n\t\t// Make it try only once, immediately\n\t\tretry = &RetryParams{Interval: time.Millisecond, Timeout: time.Millisecond}\n\t}\n\tcond := ScaleCondition(scaler, preconditions, namespace, name, newSize, nil)\n\tif err := wait.Poll(retry.Interval, retry.Timeout, cond); err != nil {\n\t\treturn err\n\t}\n\tif waitForReplicas != nil {\n\t\trs, err := scaler.c.ReplicaSets(namespace).Get(name, metav1.GetOptions{})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = wait.Poll(waitForReplicas.Interval, waitForReplicas.Timeout, client.ReplicaSetHasDesiredReplicas(scaler.c, rs))\n\n\t\tif err == wait.ErrWaitTimeout {\n\t\t\treturn fmt.Errorf(\"timed out waiting for %q to be synced\", name)\n\t\t}\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ca1456c86782a85ff438f8c0ef8c4d2e", "score": "0.48912448", "text": "func ConvoxScale(appName string, config *RanchConfig) (err error) {\n\n\tfmt.Println(\"🐮 Scaling your app:\")\n\n\texistingFormation, err := ConvoxGetFormation(appName)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// scale down hidden 'run' process, which is used by ranch run and cron.\n\tif existingEntry, ok := existingFormation[\"run\"]; ok {\n\t\tfmt.Printf(\" - run count=0 memory=%d \", config.CronMemory)\n\t\tif existingEntry.Count != 0 || existingEntry.Memory != config.CronMemory {\n\t\t\tif err = ConvoxScaleProcess(appName, \"run\", 0, config.CronMemory); err != nil {\n\t\t\t\tfmt.Println(\"✘\")\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\ttime.Sleep(5 * time.Second) // wait for scale to apply\n\n\t\t\tif err = ConvoxWaitForStatusWithMessage(appName, \"running\", \"\"); err != nil {\n\t\t\t\t// graphics handled by parent\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else {\n\t\t\tfmt.Println(\"✔\")\n\t\t}\n\t}\n\n\tfor processName, processConfig := range config.Processes {\n\t\tfmt.Printf(\" - %s count=%d memory=%d \", processName, processConfig.Count, processConfig.Memory)\n\t\tif existingEntry, ok := existingFormation[processName]; ok {\n\t\t\tif existingEntry.Count == processConfig.Count && existingEntry.Memory == processConfig.Memory {\n\t\t\t\tfmt.Println(\"✔\")\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tif err = ConvoxScaleProcess(appName, processName, processConfig.Count, processConfig.Memory); err != nil {\n\t\t\tfmt.Println(\"✘\")\n\t\t\treturn err\n\t\t}\n\n\t\ttime.Sleep(5 * time.Second) // wait for scale to apply\n\n\t\tif err = ConvoxWaitForStatusWithMessage(appName, \"running\", \"\"); err != nil {\n\t\t\t// graphics handled by parent\n\t\t\treturn err\n\t\t}\n\t\tfmt.Println(\"✔\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c09707c427e2843ac5980331b6e2c36c", "score": "0.48828796", "text": "func (m *IosEduCertificateSettings) GetCertificateValidityPeriodScale()(*CertificateValidityPeriodScale) {\n val, err := m.GetBackingStore().Get(\"certificateValidityPeriodScale\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*CertificateValidityPeriodScale)\n }\n return nil\n}", "title": "" }, { "docid": "27ebeb41225e755c067a4f5b4dc8f8c3", "score": "0.48818964", "text": "func (c *nomadClient) JobScale(scalingDoc *structs.JobScalingPolicy) {\n\n\t// In order to scale the job, we need information on the current status of the\n\t// running job from Nomad.\n\tjobResp, _, err := c.nomad.Jobs().Info(scalingDoc.JobName, &nomad.QueryOptions{})\n\n\tif err != nil {\n\t\tlogging.Info(\"client/nomad: unable to determine job info of %v\", scalingDoc.JobName)\n\t\treturn\n\t}\n\n\t// Use the current task count in order to determine whether or not a\n\t// scaling event will violate the min/max job policy and exit the function if\n\t// it would.\n\tfor _, group := range scalingDoc.GroupScalingPolicies {\n\n\t\tif group.Scaling.ScaleDirection != \"None\" {\n\n\t\t\tfor i, taskGroup := range jobResp.TaskGroups {\n\t\t\t\tif group.Scaling.ScaleDirection == \"Out\" && *taskGroup.Count >= group.Scaling.Max ||\n\t\t\t\t\tgroup.Scaling.ScaleDirection == \"In\" && *taskGroup.Count <= group.Scaling.Min {\n\t\t\t\t\tlogging.Debug(\"client/nomad: scale %v not permitted due to constraints on job \\\"%v\\\" and group \\\"%v\\\"\",\n\t\t\t\t\t\tgroup.Scaling.ScaleDirection, *jobResp.ID, group.GroupName)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tlogging.Info(\"client/nomad: scaling action (%v) will now be initiated against job \\\"%v\\\" and group \\\"%v\\\"\",\n\t\t\t\t\tgroup.Scaling.ScaleDirection, scalingDoc.JobName, group.GroupName)\n\t\t\t\t// Depending on the scaling direction decrement/incrament the count;\n\t\t\t\t// currently replicator only supports addition/subtraction of 1.\n\t\t\t\tif *taskGroup.Name == group.GroupName && group.Scaling.ScaleDirection == \"Out\" {\n\t\t\t\t\t*jobResp.TaskGroups[i].Count++\n\t\t\t\t}\n\n\t\t\t\tif *taskGroup.Name == group.GroupName && group.Scaling.ScaleDirection == \"In\" {\n\t\t\t\t\t*jobResp.TaskGroups[i].Count--\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t// Nomad 0.5.5 introduced a Jobs.Validate endpoint within the API package\n\t// which validates the job syntax before submition.\n\t_, _, err = c.nomad.Jobs().Validate(jobResp, &nomad.WriteOptions{})\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// Submit the job to the Register API endpoint with the altered count number\n\t// and check that no error is returned.\n\t_, _, err = c.nomad.Jobs().Register(jobResp, &nomad.WriteOptions{})\n\tif err != nil {\n\t\treturn\n\t}\n\n\tlogging.Info(\"client/nomad: scaling action successfully taken against job \\\"%v\\\"\", *jobResp.ID)\n\treturn\n}", "title": "" }, { "docid": "575564397fa7f5dcc312630f3599563f", "score": "0.48817667", "text": "func diffComponentScale(oldDef, newDef ComponentDefinition, componentName ComponentName) DiffInfos {\n\toldScaleDef := &ScaleDefinition{}\n\tif oldDef.Scale != nil {\n\t\toldScaleDef = oldDef.Scale\n\t}\n\n\tnewScaleDef := &ScaleDefinition{}\n\tif newDef.Scale != nil {\n\t\tnewScaleDef = newDef.Scale\n\t}\n\n\tdiffInfos := DiffInfos{}\n\n\tif !isDefaultPlacement(oldScaleDef.Placement, newScaleDef.Placement) && oldScaleDef.Placement != newScaleDef.Placement {\n\t\tdiffInfos = append(diffInfos, DiffInfo{\n\t\t\tType: DiffTypeComponentScalePlacementUpdated,\n\t\t\tKey: \"scale.placement\",\n\t\t\tComponent: componentName,\n\t\t\tOld: string(oldScaleDef.Placement),\n\t\t\tNew: string(newScaleDef.Placement),\n\t\t})\n\t}\n\n\tif oldScaleDef.Min != newScaleDef.Min {\n\t\tdiffInfos = append(diffInfos, DiffInfo{\n\t\t\tType: DiffTypeComponentScaleMinUpdated,\n\t\t\tKey: \"scale.min\",\n\t\t\tComponent: componentName,\n\t\t\tOld: strconv.Itoa(oldScaleDef.Min),\n\t\t\tNew: strconv.Itoa(newScaleDef.Min),\n\t\t})\n\t}\n\n\tif oldScaleDef.Max != newScaleDef.Max {\n\t\tdiffInfos = append(diffInfos, DiffInfo{\n\t\t\tType: DiffTypeComponentScaleMaxUpdated,\n\t\t\tKey: \"scale.max\",\n\t\t\tComponent: componentName,\n\t\t\tOld: strconv.Itoa(oldScaleDef.Max),\n\t\t\tNew: strconv.Itoa(newScaleDef.Max),\n\t\t})\n\t}\n\n\treturn diffInfos\n}", "title": "" }, { "docid": "602560c42b81de1d15dd4242b974cd46", "score": "0.48816514", "text": "func updateK8sScale(task structs.CLASS_TASK, scale_obj structs.K8S_SCALE) (string, error) {\n\tlog.Println(\"Rotterdam > CAAS > Adapters > Kubernetes > Scaling [updateK8sScale] Updating scaling info from task [\" + task.Name + \"] ...\")\n\tstatus, _, err := common.HttpPUT_GenericStruct(\n\t\tcfg.Config.Clusters[0].KubernetesEndPoint+\"/apis/apps/v1/namespaces/\"+task.Dock+\"/deployments/\"+task.Name+\"/scale\",\n\t\tscale_obj)\n\tif err != nil {\n\t\tlog.Println(\"Rotterdam > CAAS > Adapters > Kubernetes > Scaling [updateK8sScale] ERROR\", err)\n\t\treturn \"\", err\n\t}\n\tlog.Println(\"Rotterdam > CAAS > Adapters > Kubernetes > Scaling [updateK8sScale] RESPONSE: OK\")\n\n\treturn strconv.Itoa(status), nil\n}", "title": "" }, { "docid": "0972264a5b26d6b02f39183c89f090ca", "score": "0.48587474", "text": "func (mgr *SearchHeadClusterPodManager) PrepareScaleDown(n int32) (bool, error) {\n\t// start by quarantining the pod\n\tresult, err := mgr.PrepareRecycle(n)\n\tif err != nil || !result {\n\t\treturn result, err\n\t}\n\n\t// pod is quarantined; decommission it\n\tmemberName := enterprise.GetSplunkStatefulsetPodName(enterprise.SplunkSearchHead, mgr.cr.GetIdentifier(), n)\n\tmgr.log.Info(\"Removing member from search head cluster\", \"memberName\", memberName)\n\tc := mgr.getClient(n)\n\terr = c.RemoveSearchHeadClusterMember()\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\t// all done -> ok to scale down the statefulset\n\treturn true, nil\n}", "title": "" }, { "docid": "497375d2b7247248014bc083899cd668", "score": "0.4856657", "text": "func (scaler *ReplicationControllerScaler) Scale(namespace, name string, newSize uint, preconditions *ScalePrecondition, retry, waitForReplicas *RetryParams) error {\n\tif preconditions == nil {\n\t\tpreconditions = &ScalePrecondition{-1, \"\"}\n\t}\n\tif retry == nil {\n\t\t// Make it try only once, immediately\n\t\tretry = &RetryParams{Interval: time.Millisecond, Timeout: time.Millisecond}\n\t}\n\tvar updatedResourceVersion string\n\tcond := ScaleCondition(scaler, preconditions, namespace, name, newSize, &updatedResourceVersion)\n\tif err := wait.PollImmediate(retry.Interval, retry.Timeout, cond); err != nil {\n\t\treturn err\n\t}\n\tif waitForReplicas != nil {\n\t\tcheckRC := func(rc *api.ReplicationController) bool {\n\t\t\tif uint(rc.Spec.Replicas) != newSize {\n\t\t\t\t// the size is changed by other party. Don't need to wait for the new change to complete.\n\t\t\t\treturn true\n\t\t\t}\n\t\t\treturn rc.Status.ObservedGeneration >= rc.Generation && rc.Status.Replicas == rc.Spec.Replicas\n\t\t}\n\t\t// If number of replicas doesn't change, then the update may not event\n\t\t// be sent to underlying databse (we don't send no-op changes).\n\t\t// In such case, <updatedResourceVersion> will have value of the most\n\t\t// recent update (which may be far in the past) so we may get \"too old\n\t\t// RV\" error from watch or potentially no ReplicationController events\n\t\t// will be deliver, since it may already be in the expected state.\n\t\t// To protect from these two, we first issue Get() to ensure that we\n\t\t// are not already in the expected state.\n\t\tcurrentRC, err := scaler.c.ReplicationControllers(namespace).Get(name, metav1.GetOptions{})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif !checkRC(currentRC) {\n\t\t\twatchOptions := metav1.ListOptions{\n\t\t\t\tFieldSelector: fields.OneTermEqualSelector(\"metadata.name\", name).String(),\n\t\t\t\tResourceVersion: updatedResourceVersion,\n\t\t\t}\n\t\t\twatcher, err := scaler.c.ReplicationControllers(namespace).Watch(watchOptions)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t_, err = watch.Until(waitForReplicas.Timeout, watcher, func(event watch.Event) (bool, error) {\n\t\t\t\tif event.Type != watch.Added && event.Type != watch.Modified {\n\t\t\t\t\treturn false, nil\n\t\t\t\t}\n\t\t\t\treturn checkRC(event.Object.(*api.ReplicationController)), nil\n\t\t\t})\n\t\t\tif err == wait.ErrWaitTimeout {\n\t\t\t\treturn fmt.Errorf(\"timed out waiting for %q to be synced\", name)\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a153211b7d628ee447fe870cd42d969e", "score": "0.48553282", "text": "func (o TableFieldSchemaOutput) Scale() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v TableFieldSchema) *string { return v.Scale }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "2312e6525559efeea2096a2035f9f555", "score": "0.4848228", "text": "func Scale(x, y VGfloat) {\n\tC.Scale(C.VGfloat(x), C.VGfloat(y))\n}", "title": "" }, { "docid": "31a49357ae9767716efa571bbac8fa2d", "score": "0.4844501", "text": "func (r *MachineReconciler) isMachineScaleUping(machineName string) bool {\n\n\tnodeIns := corev1.Node{}\n\terr := r.Get(context.Background(), client.ObjectKey{\n\t\tName: machineName,\n\t}, &nodeIns)\n\tif err != nil && k8serrors.IsNotFound(err) {\n\t\texecutionEntity := []entities.ExecutionClusterAutoscalerMachineset{}\n\t\terr := r.DatahubClient.List(&executionEntity, datahubpkg.Option{\n\t\t\tEntity: entities.ExecutionClusterAutoscalerMachineset{\n\t\t\t\tClusterName: r.ClusterUID,\n\t\t\t\tNodeName: machineName,\n\t\t\t},\n\t\t\tFields: []string{\"ClusterName\", \"NodeName\"},\n\t\t})\n\t\tif err != nil {\n\t\t\tscope.Errorf(\"cannot check is node %s scaling up: %s\", machineName, err.Error())\n\t\t\treturn false\n\t\t}\n\t\tif err == nil && len(executionEntity) == 0 {\n\t\t\treturn true\n\t\t}\n\t} else if err != nil {\n\t\tscope.Errorf(\"cannot check is node %s scaling up: %s\", machineName, err.Error())\n\t\treturn false\n\t}\n\treturn false\n}", "title": "" }, { "docid": "b86042221676d55811ca73abfe1a7a8a", "score": "0.4837442", "text": "func ScalingFromSecret(scaleSecret *v1.Secret) (int32, error) {\n\ti, err := strconv.ParseInt(string(scaleSecret.Data[instanceKey]), 10, 32)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tresult := int32(i)\n\n\t// Reject bad values, and assume single instance - Return err better ? Save back, fix resource ?\n\tif result < 0 {\n\t\tresult = 1\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "e7dad8248a36fc0ae7b06fbd84d3b9f2", "score": "0.48345187", "text": "func (s *genericScaler) ScaleSimple(namespace, name string, preconditions *ScalePrecondition, newSize uint, gvr schema.GroupVersionResource, dryRun bool) (updatedResourceVersion string, err error) {\n\tif preconditions != nil {\n\t\tscale, err := s.scaleNamespacer.Scales(namespace).Get(context.TODO(), gvr.GroupResource(), name, metav1.GetOptions{})\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tif err = preconditions.validate(scale); err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tscale.Spec.Replicas = int32(newSize)\n\t\tupdateOptions := metav1.UpdateOptions{}\n\t\tif dryRun {\n\t\t\tupdateOptions.DryRun = []string{metav1.DryRunAll}\n\t\t}\n\t\tupdatedScale, err := s.scaleNamespacer.Scales(namespace).Update(context.TODO(), gvr.GroupResource(), scale, updateOptions)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\treturn updatedScale.ResourceVersion, nil\n\t}\n\n\t// objectForReplicas is used for encoding scale patch\n\ttype objectForReplicas struct {\n\t\tReplicas uint `json:\"replicas\"`\n\t}\n\t// objectForSpec is used for encoding scale patch\n\ttype objectForSpec struct {\n\t\tSpec objectForReplicas `json:\"spec\"`\n\t}\n\tspec := objectForSpec{\n\t\tSpec: objectForReplicas{Replicas: newSize},\n\t}\n\tpatch, err := json.Marshal(&spec)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tpatchOptions := metav1.PatchOptions{}\n\tif dryRun {\n\t\tpatchOptions.DryRun = []string{metav1.DryRunAll}\n\t}\n\tupdatedScale, err := s.scaleNamespacer.Scales(namespace).Patch(context.TODO(), gvr, name, types.MergePatchType, patch, patchOptions)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn updatedScale.ResourceVersion, nil\n}", "title": "" }, { "docid": "6a52a26c01f5dd4fb3e6fdd88cacfffb", "score": "0.48282048", "text": "func (canvas *Canvas) Scale(sx, sy Scalar) {\n\ttoimpl()\n}", "title": "" } ]
fd0dd577d5a7e1a63bbd12c1993b00fd
ListEvents returns a paginated slice of Events from the API.
[ { "docid": "d15283fb9bfd9c8c7b9584dcf3c47c9a", "score": "0.7616554", "text": "func (client *Client) ListEvents(ctx context.Context, params *ListEventsParams) (*ListEventsResults, error) {\n\treq := NewRequest(http.MethodGet, \"events.v1\", nil)\n\tif params != nil {\n\t\treq.SetValues(params.Params())\n\t}\n\n\tresp, err := client.Do(ctx, req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\tvar doc map[string]json.RawMessage\n\tdecoder := json.NewDecoder(resp.Body)\n\terr = decoder.Decode(&doc)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trawResults, ok := doc[\"results\"]\n\tif !ok {\n\t\treturn nil, errors.New(\"ticketswitch: no results in ListEvents response\")\n\t}\n\n\tvar results ListEventsResults\n\terr = json.Unmarshal(rawResults, &results)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trawCurrencies, ok := doc[\"currency_details\"]\n\n\tif ok {\n\t\tvar currencies map[string]Currency\n\t\terr := json.Unmarshal(rawCurrencies, &currencies)\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresults.Currencies = currencies\n\t}\n\n\treturn &results, nil\n}", "title": "" } ]
[ { "docid": "9723a9edfcfed945ae9a7f4cdb383cc5", "score": "0.7862708", "text": "func (s *EventService) ListEvents(p *ListEventsParams) (*ListEventsResponse, error) {\n\tresp, err := s.cs.newRequest(\"listEvents\", p.toURLValues())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar r ListEventsResponse\n\tif err := json.Unmarshal(resp, &r); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &r, nil\n}", "title": "" }, { "docid": "25520e029f6b393ff9b71b189a313302", "score": "0.78004473", "text": "func (a *Client) ListEvents(params *ListEventsParams, authInfo runtime.ClientAuthInfoWriter) (*ListEventsOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewListEventsParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"list_events\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/events\",\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: &ListEventsReader{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.(*ListEventsOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for list_events: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "eac89403a46ce1b4ff1bc94681eb2da0", "score": "0.7529196", "text": "func (v EventsResource) List(c buffalo.Context) error {\n\t// Get the DB connection from the context\n\ttx, ok := c.Value(\"tx\").(*pop.Connection)\n\tif !ok {\n\t\treturn fmt.Errorf(\"no transaction found\")\n\t}\n\n\tevents := &models.Events{}\n\n\t// Paginate results. Params \"page\" and \"per_page\" control pagination.\n\t// Default values are \"page=1\" and \"per_page=20\".\n\tq := tx.PaginateFromParams(c.Params())\n\n\t// Retrieve all Events from the DB\n\tif err := q.All(events); err != nil {\n\t\treturn err\n\t}\n\n\t// Add the paginator to the context so it can be used in the template.\n\tc.Set(\"pagination\", q.Paginator)\n\n\treturn c.Render(200, r.Auto(c, events))\n}", "title": "" }, { "docid": "4e77758dd31b8b37a033cb9f0f19b901", "score": "0.7441876", "text": "func (a *DefaultApiService) ListEvents(ctx _context.Context, localVarOptionals *ListEventsOpts) (EventsList, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue EventsList\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/events\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif localVarOptionals != nil && localVarOptionals.SourceServicename.IsSet() {\n\t\tlocalVarQueryParams.Add(\"source_servicename\", parameterToString(localVarOptionals.SourceServicename.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.SourceHostid.IsSet() {\n\t\tlocalVarQueryParams.Add(\"source_hostid\", parameterToString(localVarOptionals.SourceHostid.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.EventType.IsSet() {\n\t\tlocalVarQueryParams.Add(\"event_type\", parameterToString(localVarOptionals.EventType.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.ResourceType.IsSet() {\n\t\tlocalVarQueryParams.Add(\"resource_type\", parameterToString(localVarOptionals.ResourceType.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.ResourceId.IsSet() {\n\t\tlocalVarQueryParams.Add(\"resource_id\", parameterToString(localVarOptionals.ResourceId.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Level.IsSet() {\n\t\tlocalVarQueryParams.Add(\"level\", parameterToString(localVarOptionals.Level.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Since.IsSet() {\n\t\tlocalVarQueryParams.Add(\"since\", parameterToString(localVarOptionals.Since.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Before.IsSet() {\n\t\tlocalVarQueryParams.Add(\"before\", parameterToString(localVarOptionals.Before.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Page.IsSet() {\n\t\tlocalVarQueryParams.Add(\"page\", parameterToString(localVarOptionals.Page.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Limit.IsSet() {\n\t\tlocalVarQueryParams.Add(\"limit\", parameterToString(localVarOptionals.Limit.Value(), \"\"))\n\t}\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif localVarOptionals != nil && localVarOptionals.XAnchoreAccount.IsSet() {\n\t\tlocalVarHeaderParams[\"x-anchore-account\"] = parameterToString(localVarOptionals.XAnchoreAccount.Value(), \"\")\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 200 {\n\t\t\tvar v EventsList\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\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": "9d8b1a77ac2827140f9a60d059bc9eb9", "score": "0.7422878", "text": "func (c *ErrorStatsClient) ListEvents(ctx context.Context, req *clouderrorreportingpb.ListEventsRequest) *ErrorEventIterator {\n\tctx = metadata.NewContext(ctx, c.metadata)\n\tit := &ErrorEventIterator{}\n\tit.apiCall = func() error {\n\t\tvar resp *clouderrorreportingpb.ListEventsResponse\n\t\terr := gax.Invoke(ctx, func(ctx context.Context) error {\n\t\t\tvar err error\n\t\t\treq.PageToken = it.nextPageToken\n\t\t\treq.PageSize = it.pageSize\n\t\t\tresp, err = c.client.ListEvents(ctx, req)\n\t\t\treturn err\n\t\t}, c.CallOptions.ListEvents...)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif resp.NextPageToken == \"\" {\n\t\t\tit.atLastPage = true\n\t\t}\n\t\tit.nextPageToken = resp.NextPageToken\n\t\tit.items = resp.ErrorEvents\n\t\treturn nil\n\t}\n\treturn it\n}", "title": "" }, { "docid": "c4d999c13523603318090ecb3364b3f3", "score": "0.7394753", "text": "func (c *MockClient) ListEvents(deviceID string, options *packngo.ListOptions) ([]packngo.Event, *packngo.Response, error) {\n\treturn c.MockListEvents(deviceID, options)\n}", "title": "" }, { "docid": "a99a205d1a879d431f1a8e5cfa2cd230", "score": "0.7326607", "text": "func (s *Service) EventsList() *EventsListOp {\n\treturn &EventsListOp{\n\t\tCredential: s.credential,\n\t\tMethod: \"GET\",\n\t\tPath: \"connect/logs\",\n\t\tAccept: \"application/json\",\n\t\tQueryOpts: make(url.Values),\n\t\tVersion: esign.APIv2,\n\t}\n}", "title": "" }, { "docid": "0c518c6c34c33650963db62749f2f9f7", "score": "0.7277421", "text": "func (c *EventsController) List(ctx *app.ListEventsContext) error {\n\t// EventsController_List: start_implement\n\n\t// Put your logic here\n\tvar events []*app.Event\n\teventDB := models.NewEventDB(c.db)\n\terr := c.db.Scopes(\n\t\tmodels.CreatePagingQuery(ctx.Page),\n\t\tmodels.CreateSortQuery(\"desc\"),\n\t\tmodels.CreateLikeQuery(ctx.Q, \"description\")).\n\t\tTable(eventDB.TableName()).\n\t\tFind(&events).Error\n\tif err != nil {\n\t\treturn fmt.Errorf(\"%v\", err)\n\t}\n\treturn ctx.OK(events)\n\t// EventsController_List: end_implement\n}", "title": "" }, { "docid": "83021420efa86b7f4e7a9776147bbe7f", "score": "0.7224463", "text": "func eventList(w http.ResponseWriter, r *http.Request, t auth.Token) error {\n\tfilter := &event.Filter{}\n\tif target := r.URL.Query().Get(\"target\"); target != \"\" {\n\t\tt, err := event.GetTargetType(target)\n\t\tif err == nil {\n\t\t\tfilter.Target = event.Target{Type: t}\n\t\t}\n\t}\n\tif running, err := strconv.ParseBool(r.URL.Query().Get(\"running\")); err == nil {\n\t\tfilter.Running = &running\n\t}\n\tif kindName := r.URL.Query().Get(\"kindName\"); kindName != \"\" {\n\t\tfilter.KindName = kindName\n\t}\n\tevents, err := event.List(filter)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(events) == 0 {\n\t\tw.WriteHeader(http.StatusNoContent)\n\t\treturn nil\n\t}\n\tw.Header().Add(\"Content-Type\", \"application/json\")\n\treturn json.NewEncoder(w).Encode(events)\n}", "title": "" }, { "docid": "149dc5343d3d21510ef2b7ad1e02ad90", "score": "0.7094356", "text": "func (c *ApiService) ListEvent(params *ListEventParams) ([]MonitorV1Event, error) {\n\tresponse, errors := c.StreamEvent(params)\n\n\trecords := make([]MonitorV1Event, 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": "0e7d2c9f44895931cdc0e9444c686a99", "score": "0.6950351", "text": "func (c *EventsController) List(ctx *app.ListWorkItemEventsContext) error {\n\tvar eventList []event.Event\n\terr := application.Transactional(c.db, func(appl application.Application) error {\n\t\tvar err error\n\t\teventList, err = appl.Events().List(ctx, ctx.WiID)\n\t\treturn errs.Wrap(err, \"list events model failed\")\n\t})\n\tif err != nil {\n\t\treturn jsonapi.JSONErrorResponse(ctx, err)\n\t}\n\treturn ctx.ConditionalEntities(eventList, c.config.GetCacheControlEvents, func() error {\n\t\tres := &app.EventList{}\n\t\tres.Data = ConvertEvents(c.db, ctx.Request, eventList, ctx.WiID)\n\t\treturn ctx.OK(res)\n\t})\n}", "title": "" }, { "docid": "5ef2aaa58f6a1853f5e823fccc839676", "score": "0.68767256", "text": "func (f *Festa) GetEvents() (events []Event) {\n\n\tvar eventResponse EventResponse\n\tqueryParam := map[string]string{\n\t\t\"page\": \"1\",\n\t\t\"pageSize\": \"24\",\n\t\t\"order\": \"startDate\",\n\t\t\"excludeExternalEvents\": \"false\",\n\t}\n\tresp, _ := http.Get(fmt.Sprintf(\"%s?%s\", apiEndpoint, toQueryString(queryParam)))\n\n\tresponseBytes, _ := ioutil.ReadAll(resp.Body)\n\n\tjson.Unmarshal(responseBytes, &eventResponse)\n\n\treturn eventResponse.Rows\n}", "title": "" }, { "docid": "2c4f6f3cee4ddec31b991876a0c09f25", "score": "0.68241906", "text": "func (a *Agent) ListEvents(name string, namespace string) (*v1.EventList, error) {\n\treturn a.Clientset.CoreV1().Events(namespace).List(\n\t\tcontext.TODO(),\n\t\tmetav1.ListOptions{\n\t\t\tFieldSelector: fmt.Sprintf(\"involvedObject.name=%s,involvedObject.namespace=%s\", name, namespace),\n\t\t},\n\t)\n}", "title": "" }, { "docid": "bec8c3d0d84528097e39b7e221323876", "score": "0.6793768", "text": "func handleListEvents(w http.ResponseWriter, r *http.Request) {\n\ttx, err := db.Beginx()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tevents, err := GetEvents(tx, \"SELECT * FROM events\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\terr = tx.Commit()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tevent := events[0]\n\tstartTime := time.Date(event.Date.Year(), event.Date.Month(), event.Date.Day(), int(event.StartTime.Hour), int(event.StartTime.Minute), int(event.StartTime.Second), 0, time.Local)\n\tendTime := time.Date(event.Date.Year(), event.Date.Month(), event.Date.Day(), int(event.EndTime.Hour), int(event.EndTime.Minute), int(event.EndTime.Second), 0, time.Local)\n\n\tresponse := EventResponse{\n\t\tID: events[0].ID,\n\t\tStart: startTime,\n\t\tEnd: endTime,\n\t\tTitle: event.Lecture.Name,\n\t}\n\n\terr = json.NewEncoder(w).Encode([]EventResponse{response})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "219c7baaf5e5d4d18408b3a42938a7ea", "score": "0.666443", "text": "func (c *ApiService) PageEvent(params *ListEventParams, pageToken, pageNumber string) (*ListEventResponse, error) {\n\tpath := \"/v1/Events\"\n\n\tdata := url.Values{}\n\theaders := make(map[string]interface{})\n\n\tif params != nil && params.ActorSid != nil {\n\t\tdata.Set(\"ActorSid\", *params.ActorSid)\n\t}\n\tif params != nil && params.EventType != nil {\n\t\tdata.Set(\"EventType\", *params.EventType)\n\t}\n\tif params != nil && params.ResourceSid != nil {\n\t\tdata.Set(\"ResourceSid\", *params.ResourceSid)\n\t}\n\tif params != nil && params.SourceIpAddress != nil {\n\t\tdata.Set(\"SourceIpAddress\", *params.SourceIpAddress)\n\t}\n\tif params != nil && params.StartDate != nil {\n\t\tdata.Set(\"StartDate\", fmt.Sprint((*params.StartDate).Format(time.RFC3339)))\n\t}\n\tif params != nil && params.EndDate != nil {\n\t\tdata.Set(\"EndDate\", fmt.Sprint((*params.EndDate).Format(time.RFC3339)))\n\t}\n\tif params != nil && params.PageSize != nil {\n\t\tdata.Set(\"PageSize\", fmt.Sprint(*params.PageSize))\n\t}\n\n\tif pageToken != \"\" {\n\t\tdata.Set(\"PageToken\", pageToken)\n\t}\n\tif pageNumber != \"\" {\n\t\tdata.Set(\"Page\", pageNumber)\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 := &ListEventResponse{}\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": "425d1d3bae93651f3fabc59db2bcc3f3", "score": "0.6633009", "text": "func (c *Unifi) GetEvents(ctx context.Context, within int, start int, limit int) (Events, error) {\n\tevents := Events{}\n\n\tjsonString := fmt.Sprintf(`{\"_sort\":\"-time\",\"within\":\"%d\",\"_start\":\"%d\",\"_limit\":\"%d\"}`, within, start, limit)\n\tjsonData := []byte(jsonString)\n\n\treq, err := http.NewRequest(\"POST\", fmt.Sprintf(\"%s/s/%s/stat/event\", c.BaseURL, c.site), bytes.NewBuffer(jsonData))\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tif err != nil {\n\t\treturn events, err\n\t}\n\n\treq = req.WithContext(ctx)\n\n\tif err := c.sendRequest(req, &events); err != nil {\n\t\tlog.Println(\"ERROR: \" + err.Error())\n\t\treturn events, err\n\t}\n\n\treturn events, nil\n}", "title": "" }, { "docid": "a903ce22b89a0f857d11e82c2722b6bc", "score": "0.65309703", "text": "func (svc *ServiceContext) GetEvents(c *gin.Context) {\n\tq := svc.DB.NewQuery(\"SELECT id, event_date, description FROM events order by event_date desc\")\n\tvar events []Event\n\terr := q.All(&events)\n\tif err != nil {\n\t\tc.String(http.StatusInternalServerError, \"Unable to retrive events: %s\", err.Error())\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, events)\n}", "title": "" }, { "docid": "9ad830acde755615bd0ce932c554f3e6", "score": "0.6438039", "text": "func (s *DataStore) GetAllEventsList() (runtime.Object, error) {\n\treturn s.kubeClient.CoreV1().Events(s.namespace).List(metav1.ListOptions{})\n}", "title": "" }, { "docid": "5caaa4f38fe812822636ac64762ab6d0", "score": "0.6379417", "text": "func ListEvents(cmd *cobra.Command, args []string) error {\n\n\tvar files []string\n\n\terr := filepath.Walk(ionModulesDir, func(path string, info os.FileInfo, err error) error {\n\t\tif strings.Contains(path, filepath.FromSlash(filepath.Join(listEventsOpts.moduleID, \"_events\"))) {\n\t\t\tif info.IsDir() {\n\t\t\t\treturn nil // ignore events directory\n\t\t\t}\n\t\t\tfiles = append(files, path)\n\t\t}\n\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error reading module's event directory in %s: %+v\", ionModulesDir, err)\n\t}\n\tif len(files) == 0 {\n\t\tfmt.Println(\"module raised no events\")\n\t\treturn nil\n\t}\n\n\tfor _, file := range files {\n\t\tb, err := ioutil.ReadFile(file)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error reading module event %s: %+v\", file, err)\n\t\t}\n\t\tvar event common.Event\n\t\tif err = json.Unmarshal(b, &event); err != nil {\n\t\t\treturn fmt.Errorf(\"error parsing module event %s: %+v\", file, err)\n\t\t}\n\t\tfmt.Println(string(b))\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "142b841b18fda0e67716951bcaa36b3d", "score": "0.6340699", "text": "func (repo *Repo) GetEvents(c *gin.Context) {\n\tvar events []models.Event\n\terr := models.GetEvents(repo.Db, &events)\n\tif err != nil {\n\t\tc.AbortWithStatus(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tc.HTML(http.StatusOK, \"events/index.tmpl\", gin.H{\n\t\t\"events\": events,\n\t})\n}", "title": "" }, { "docid": "799b443434a90e4a88ea54a986dc1965", "score": "0.6334801", "text": "func GetEvents(offset int, count int) ([]EventRow, error) {\n\trequestedEvents := make([]EventRow, 0, 0)\n\n\t// Find Events\n\trows, err := model.Database.Queryx(\"SELECT * FROM events ORDER BY eventid ASC LIMIT ?, ?\",\n\t\toffset, count)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Create structs\n\tfor rows.Next() {\n\t\tnewObj := EventRow{}\n\t\terr = rows.StructScan(&newObj)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\trequestedEvents = append(requestedEvents, newObj)\n\t}\n\n\treturn requestedEvents, nil\n}", "title": "" }, { "docid": "5df6d5a61029c43cf560bd2cfa964021", "score": "0.6307208", "text": "func (c *eventsClusterInterface) List(ctx context.Context, opts metav1.ListOptions) (*corev1.EventList, error) {\n\treturn c.clientCache.ClusterOrDie(logicalcluster.Wildcard).Events(metav1.NamespaceAll).List(ctx, opts)\n}", "title": "" }, { "docid": "dcfde8c53c6973b86087cb990e2e6b7a", "score": "0.629578", "text": "func (es EventSet) ListEvents() (ecodes []Event, err error) {\n\tvar numEvents int\n\tif numEvents, err = es.NumEvents(); err != nil {\n\t\treturn\n\t}\n\tc_ecodes := make([]C.int, numEvents)\n\tc_num_events := C.int(numEvents)\n\tif errno := Errno(C.PAPI_list_events(C.int(es), &c_ecodes[0], &c_num_events)); errno != papi_ok {\n\t\terr = errno\n\t\treturn\n\t}\n\tecodes = make([]Event, c_num_events)\n\tfor i, ev := range c_ecodes {\n\t\tecodes[i] = Event(ev)\n\t}\n\treturn\n}", "title": "" }, { "docid": "4c542b55fd6c8caf11b916fc1bb0fe2d", "score": "0.62749004", "text": "func (s *Service) EventsDeleteList() *EventsDeleteListOp {\n\treturn &EventsDeleteListOp{\n\t\tCredential: s.credential,\n\t\tMethod: \"DELETE\",\n\t\tPath: \"connect/logs\",\n\t\tQueryOpts: make(url.Values),\n\t\tVersion: esign.APIv2,\n\t}\n}", "title": "" }, { "docid": "4edbc6a3bfe2d248e382b137a67b8eef", "score": "0.62692267", "text": "func (s *API) ListServerEvents(req *ListServerEventsRequest, opts ...scw.RequestOption) (*ListServerEventsResponse, error) {\n\tvar err error\n\n\tif req.Zone == \"\" {\n\t\tdefaultZone, _ := s.client.GetDefaultZone()\n\t\treq.Zone = defaultZone\n\t}\n\n\tdefaultPageSize, exist := s.client.GetDefaultPageSize()\n\tif (req.PageSize == nil || *req.PageSize == 0) && exist {\n\t\treq.PageSize = &defaultPageSize\n\t}\n\n\tquery := url.Values{}\n\tparameter.AddToQuery(query, \"page\", req.Page)\n\tparameter.AddToQuery(query, \"page_size\", req.PageSize)\n\tparameter.AddToQuery(query, \"order_by\", req.OrderBy)\n\n\tif fmt.Sprint(req.Zone) == \"\" {\n\t\treturn nil, errors.New(\"field Zone cannot be empty in request\")\n\t}\n\n\tif fmt.Sprint(req.ServerID) == \"\" {\n\t\treturn nil, errors.New(\"field ServerID cannot be empty in request\")\n\t}\n\n\tscwReq := &scw.ScalewayRequest{\n\t\tMethod: \"GET\",\n\t\tPath: \"/baremetal/v1alpha1/zones/\" + fmt.Sprint(req.Zone) + \"/servers/\" + fmt.Sprint(req.ServerID) + \"/events\",\n\t\tQuery: query,\n\t\tHeaders: http.Header{},\n\t}\n\n\tvar resp ListServerEventsResponse\n\n\terr = s.client.Do(scwReq, &resp, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resp, nil\n}", "title": "" }, { "docid": "4edbc6a3bfe2d248e382b137a67b8eef", "score": "0.62692267", "text": "func (s *API) ListServerEvents(req *ListServerEventsRequest, opts ...scw.RequestOption) (*ListServerEventsResponse, error) {\n\tvar err error\n\n\tif req.Zone == \"\" {\n\t\tdefaultZone, _ := s.client.GetDefaultZone()\n\t\treq.Zone = defaultZone\n\t}\n\n\tdefaultPageSize, exist := s.client.GetDefaultPageSize()\n\tif (req.PageSize == nil || *req.PageSize == 0) && exist {\n\t\treq.PageSize = &defaultPageSize\n\t}\n\n\tquery := url.Values{}\n\tparameter.AddToQuery(query, \"page\", req.Page)\n\tparameter.AddToQuery(query, \"page_size\", req.PageSize)\n\tparameter.AddToQuery(query, \"order_by\", req.OrderBy)\n\n\tif fmt.Sprint(req.Zone) == \"\" {\n\t\treturn nil, errors.New(\"field Zone cannot be empty in request\")\n\t}\n\n\tif fmt.Sprint(req.ServerID) == \"\" {\n\t\treturn nil, errors.New(\"field ServerID cannot be empty in request\")\n\t}\n\n\tscwReq := &scw.ScalewayRequest{\n\t\tMethod: \"GET\",\n\t\tPath: \"/baremetal/v1alpha1/zones/\" + fmt.Sprint(req.Zone) + \"/servers/\" + fmt.Sprint(req.ServerID) + \"/events\",\n\t\tQuery: query,\n\t\tHeaders: http.Header{},\n\t}\n\n\tvar resp ListServerEventsResponse\n\n\terr = s.client.Do(scwReq, &resp, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resp, nil\n}", "title": "" }, { "docid": "47d417161544e816342076c9baa396dd", "score": "0.62573785", "text": "func (s *API) ListServerEvents(req *ListServerEventsRequest, opts ...scw.RequestOption) (*ListServerEventsResponse, error) {\n\tvar err error\n\n\tif req.Zone == \"\" {\n\t\tdefaultZone, _ := s.client.GetDefaultZone()\n\t\treq.Zone = defaultZone\n\t}\n\n\tdefaultPageSize, exist := s.client.GetDefaultPageSize()\n\tif (req.PageSize == nil || *req.PageSize == 0) && exist {\n\t\treq.PageSize = &defaultPageSize\n\t}\n\n\tquery := url.Values{}\n\tparameter.AddToQuery(query, \"page\", req.Page)\n\tparameter.AddToQuery(query, \"page_size\", req.PageSize)\n\tparameter.AddToQuery(query, \"order_by\", req.OrderBy)\n\n\tif fmt.Sprint(req.Zone) == \"\" {\n\t\treturn nil, errors.New(\"field Zone cannot be empty in request\")\n\t}\n\n\tif fmt.Sprint(req.ServerID) == \"\" {\n\t\treturn nil, errors.New(\"field ServerID cannot be empty in request\")\n\t}\n\n\tscwReq := &scw.ScalewayRequest{\n\t\tMethod: \"GET\",\n\t\tPath: \"/baremetal/v1/zones/\" + fmt.Sprint(req.Zone) + \"/servers/\" + fmt.Sprint(req.ServerID) + \"/events\",\n\t\tQuery: query,\n\t\tHeaders: http.Header{},\n\t}\n\n\tvar resp ListServerEventsResponse\n\n\terr = s.client.Do(scwReq, &resp, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resp, nil\n}", "title": "" }, { "docid": "511c6cdeee88a5635d0dad7807716732", "score": "0.62185585", "text": "func (r *REST) List(ctx genericapirequest.Context, options *metainternalversion.ListOptions) (runtime.Object, error) {\n\n\tnamespace := genericapirequest.NamespaceValue(ctx)\n\tif namespace == \"\" {\n\t\treturn r.evProvider.ListAllEvents()\n\t}\n\n\teventName, methodSingleEvent, ok := specificinstaller.RequestInformationFrom(ctx)\n\tmethodListEvents, list := specificinstaller.RequestListInformationFrom(ctx)\n\n\tif methodListEvents == \"\" && methodSingleEvent == \"\" {\n\t\treturn nil, fmt.Errorf(\"Unable to serve the request: forgiven method\")\n\t}\n\n\tif list {\n\t\treturn r.listEventsAPI(namespace, methodListEvents)\n\t}\n\n\tif ok {\n\t\treturn r.singleEventAPI(namespace, eventName, methodSingleEvent)\n\t}\n\n\treturn nil, fmt.Errorf(\"Unable to serve the request\")\n}", "title": "" }, { "docid": "cbc8d6d017983e23106292d7000c2227", "score": "0.61878747", "text": "func GetEvents(c *fiber.Ctx) error {\n\tevents, errQuery := models.EventQuery.GetAll()\n\tif errQuery != nil {\n\t\treturn utils.CusResponse(utils.CusResp{\n\t\t\tContext: c,\n\t\t\tCode: errQuery.Code,\n\t\t\tData: nil,\n\t\t\tError: errors.New(errQuery.Message)})\n\t}\n\n\treturn utils.CusResponse(utils.CusResp{\n\t\tContext: c,\n\t\tCode: 200,\n\t\tData: events,\n\t\tError: nil})\n\n}", "title": "" }, { "docid": "2c99424e61c1b3fddb980921121b1670", "score": "0.61840415", "text": "func GetEvents(w http.ResponseWriter, r *http.Request) {\n\tctx := r.Context()\n\tu := middleware.UserFromContext(ctx)\n\tp := getPagination(r)\n\n\tevents, err := models.GetEventsByUser(ctx, &u, p)\n\tif err != nil {\n\t\tbjson.HandleError(w, err)\n\t\treturn\n\t}\n\n\tbjson.WriteJSON(w, map[string][]*models.Event{\"events\": events}, http.StatusOK)\n}", "title": "" }, { "docid": "d08dfb401dcd14a56457c36544690cd8", "score": "0.6170888", "text": "func (p *StackdriverProvider) ListAllEvents() (*api.EventList, error) {\n\treturn nil, fmt.Errorf(\"ListAllEvents is not implemented yet.\")\n}", "title": "" }, { "docid": "2dc0ee86598a08736047ad20341e2a1f", "score": "0.6158417", "text": "func (h *Handler) ListPodEvents(c *gin.Context) {\n\tnamespace := c.Param(\"namespace\")\n\tname := c.Param(\"name\")\n\n\tevents, err := h.kubeClient.CoreV1().Events(namespace).List(c, metav1.ListOptions{\n\t\tFieldSelector: fields.OneTermEqualSelector(\"involvedObject.name\", name).String(),\n\t})\n\tif err != nil {\n\t\th.handleError(c, err)\n\t\treturn\n\t}\n\n\tc.JSON(200, gin.H{\n\t\t\"events\": events,\n\t})\n}", "title": "" }, { "docid": "480c244debfff27558096ebfa62f0ecf", "score": "0.6149819", "text": "func GetEvents(w http.ResponseWriter, r *http.Request) {\n\tvar (\n\t\tfromStart bool\n\t\tdecoder = utils.GetDecoder(r)\n\t\truntime = r.Context().Value(api.RuntimeKey).(*libpod.Runtime)\n\t\tjson = jsoniter.ConfigCompatibleWithStandardLibrary // FIXME: this should happen on the package level\n\t)\n\n\t// NOTE: the \"filters\" parameter is extracted separately for backwards\n\t// compat via `filterFromRequest()`.\n\tquery := struct {\n\t\tSince string `schema:\"since\"`\n\t\tUntil string `schema:\"until\"`\n\t\tStream bool `schema:\"stream\"`\n\t}{\n\t\tStream: true,\n\t}\n\tif err := decoder.Decode(&query, r.URL.Query()); err != nil {\n\t\tutils.Error(w, http.StatusBadRequest, fmt.Errorf(\"failed to parse parameters for %s: %w\", r.URL.String(), err))\n\t\treturn\n\t}\n\n\tif len(query.Since) > 0 || len(query.Until) > 0 {\n\t\tfromStart = true\n\t}\n\n\tlibpodFilters, err := util.FiltersFromRequest(r)\n\tif err != nil {\n\t\tutils.Error(w, http.StatusBadRequest, fmt.Errorf(\"failed to parse parameters for %s: %w\", r.URL.String(), err))\n\t\treturn\n\t}\n\teventChannel := make(chan *events.Event)\n\terrorChannel := make(chan error)\n\n\t// Start reading events.\n\tgo func() {\n\t\treadOpts := events.ReadOptions{\n\t\t\tFromStart: fromStart,\n\t\t\tStream: query.Stream,\n\t\t\tFilters: libpodFilters,\n\t\t\tEventChannel: eventChannel,\n\t\t\tSince: query.Since,\n\t\t\tUntil: query.Until,\n\t\t}\n\t\terrorChannel <- runtime.Events(r.Context(), readOpts)\n\t}()\n\n\tflush := func() {}\n\tif flusher, ok := w.(http.Flusher); ok {\n\t\tflush = flusher.Flush\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\tflush()\n\n\tcoder := json.NewEncoder(w)\n\tcoder.SetEscapeHTML(true)\n\n\tfor {\n\t\tselect {\n\t\tcase err := <-errorChannel:\n\t\t\tif err != nil {\n\t\t\t\t// FIXME StatusOK already sent above cannot send 500 here\n\t\t\t\tutils.InternalServerError(w, err)\n\t\t\t}\n\t\t\treturn\n\t\tcase evt := <-eventChannel:\n\t\t\tif evt == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\te := entities.ConvertToEntitiesEvent(*evt)\n\t\t\t// Some events differ between Libpod and Docker endpoints.\n\t\t\t// Handle these differences for Docker-compat.\n\t\t\tif !utils.IsLibpodRequest(r) && e.Type == \"image\" && e.Status == \"remove\" {\n\t\t\t\te.Status = \"delete\"\n\t\t\t\te.Action = \"delete\"\n\t\t\t}\n\t\t\tif !utils.IsLibpodRequest(r) && e.Status == \"died\" {\n\t\t\t\te.Status = \"die\"\n\t\t\t\te.Action = \"die\"\n\t\t\t\te.Actor.Attributes[\"exitCode\"] = e.Actor.Attributes[\"containerExitCode\"]\n\t\t\t}\n\n\t\t\tif err := coder.Encode(e); err != nil {\n\t\t\t\tlogrus.Errorf(\"Unable to write json: %q\", err)\n\t\t\t}\n\t\t\tflush()\n\t\tcase <-r.Context().Done():\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6b344b611bb8c2b061f027068c76e48a", "score": "0.614847", "text": "func NewListEventsRequest(server string, params *ListEventsParams) (*http.Request, error) {\n\tvar err error\n\n\tserverURL, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\toperationPath := fmt.Sprintf(\"/event\")\n\tif operationPath[0] == '/' {\n\t\toperationPath = \".\" + operationPath\n\t}\n\n\tqueryURL, err := serverURL.Parse(operationPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryValues := queryURL.Query()\n\n\tif params.From != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", true, \"from\", runtime.ParamLocationQuery, *params.From); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.To != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", true, \"to\", runtime.ParamLocationQuery, *params.To); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tqueryURL.RawQuery = queryValues.Encode()\n\n\treq, err := http.NewRequest(\"GET\", queryURL.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "a75845a5d82206613c469c1358510d93", "score": "0.6137709", "text": "func (c *Client) GetEvents(params string) (*simplejson.Json, error) {\n\treturn c.GetJSON(\"/events?\" + params)\n}", "title": "" }, { "docid": "adf3355f0236dade46625bed5b3f5410", "score": "0.61108524", "text": "func (p *proxyALMemory) GetEventList() ([]string, error) {\n\tvar err error\n\tvar ret []string\n\tvar buf bytes.Buffer\n\tresponse, err := p.Call(\"getEventList\", buf.Bytes())\n\tif err != nil {\n\t\treturn ret, fmt.Errorf(\"call getEventList failed: %s\", err)\n\t}\n\tresp := bytes.NewBuffer(response)\n\tret, err = func() (b []string, err error) {\n\t\tsize, err := basic.ReadUint32(resp)\n\t\tif err != nil {\n\t\t\treturn b, fmt.Errorf(\"read slice size: %s\", err)\n\t\t}\n\t\tb = make([]string, size)\n\t\tfor i := 0; i < int(size); i++ {\n\t\t\tb[i], err = basic.ReadString(resp)\n\t\t\tif err != nil {\n\t\t\t\treturn b, fmt.Errorf(\"read slice value: %s\", err)\n\t\t\t}\n\t\t}\n\t\treturn b, nil\n\t}()\n\tif err != nil {\n\t\treturn ret, fmt.Errorf(\"parse getEventList response: %s\", err)\n\t}\n\treturn ret, nil\n}", "title": "" }, { "docid": "1192ad288f99274da277cf4c316e5a39", "score": "0.6097118", "text": "func (bc *BoltClient) getEvents(fn func(encoded []byte) bool, limit int) ([]contract.Event, error) {\n\tevents := []contract.Event{}\n\tjson := jsoniter.ConfigCompatibleWithStandardLibrary\n\n\t// Check if limit is not 0\n\tif limit == 0 {\n\t\treturn events, nil\n\t}\n\tcnt := 0\n\n\terr := bc.db.View(func(tx *bolt.Tx) error {\n\t\tb := tx.Bucket([]byte(db.EventsCollection))\n\t\tif b == nil {\n\t\t\treturn nil\n\t\t}\n\t\terr := b.ForEach(func(id, encoded []byte) error {\n\t\t\tif fn(encoded) == true {\n\t\t\t\tevent := contract.Event{}\n\t\t\t\terr := json.Unmarshal(encoded, &event)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tevents = append(events, event)\n\t\t\t\tif limit > 0 {\n\t\t\t\t\tcnt++\n\t\t\t\t\tif cnt >= limit {\n\t\t\t\t\t\treturn ErrLimReached\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t\tif err == ErrLimReached {\n\t\t\treturn nil\n\t\t}\n\t\treturn err\n\t})\n\treturn events, err\n}", "title": "" }, { "docid": "d71ddd134c43f9ee144262e2114945cd", "score": "0.6095811", "text": "func GetFullCalendarEvents(c echo.Context) (err error) {\n\tvar startDate, endDate string\n\tstartDate = c.QueryParam(\"start\")\n\tendDate = c.QueryParam(\"end\")\n\tvar fEvents []FullcalendarEvent\n\tdb, err := db.Db()\n\tif err != nil { return err }\n\tcondition := \"event_date >= '\" + startDate + \"' AND event_date <= '\" + endDate + \"'\"\n\tevts, err := models.Events(db, qm.Where(condition), qm.OrderBy(\"event_date ASC\"), qm.Limit(100)).All()\n\tif err != nil {\n\t\treturn serr.Wrap(err, \"Error obtaining events\")\n\t}\n\n\tfor _, evt := range evts {\n\t\tfe := FullcalendarEvent{ AllDay: true } // We have no end date\n\t\tfe.Title = evt.Title\n\t\tfe.Start = evt.EventDate.Format(tu.ISO8601DateTime)\n\t\tfe.Url = \"/events/\" + strconv.FormatInt(evt.ID, 10)\n\t\tfEvents = append(fEvents, fe)\n\t}\n\n\treturn c.JSON(http.StatusOK, &fEvents)\n}", "title": "" }, { "docid": "997887fcaa4083511cb0c724ee41fb5c", "score": "0.6080253", "text": "func GetEvents(c *gin.Context) {\n\tc.JSON(200, gin.H{\"ok\": \"Retrieving Events\"})\n}", "title": "" }, { "docid": "50cd7c66fb8bf06120032baf9a92c9ee", "score": "0.6075418", "text": "func (c *Client) Events(groupName string, status *string) ([]*Event, error) {\n\tvar params []param\n\tif status != nil {\n\t\tparams = append(params, param{\n\t\t\tkey: \"status\",\n\t\t\tvalue: *status,\n\t\t})\n\t}\n\n\tr, err := c.doGet(fmt.Sprintf(\"%s/events\", groupName), params...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer r.Body.Close() // nolint: errcheck\n\n\tvar events []*Event\n\terr = json.NewDecoder(r.Body).Decode(&events)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"invalid or missing payload\")\n\t}\n\n\tif len(events) == 0 {\n\t\treturn nil, nil\n\t}\n\n\treturn events, nil\n}", "title": "" }, { "docid": "9c5335216336e3fe9ce3f87f99efe35c", "score": "0.6067622", "text": "func (a *Client) ListEventTypes(params *ListEventTypesParams, authInfo runtime.ClientAuthInfoWriter) (*ListEventTypesOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewListEventTypesParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"list_event_types\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/event_types\",\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: &ListEventTypesReader{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.(*ListEventTypesOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for list_event_types: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "e275200a69149e8244a39f0ef37101e6", "score": "0.60618895", "text": "func (ec *EventContract) ListEvent(APIstub shim.ChaincodeStubInterface, args []string) sc.Response {\n\teventLogger.Infof(\"invoke ListEvent, args=%s\\n\", args)\n\tif len(args) > 1 {\n\t\terrMsg := fmt.Sprintf(\"Incorrect number of arguments. Expecting = [Optional('%s'|'%s'|'%s'), Actual = %s\\n\", types.DepositEvent, types.RemitEvent, types.WithdrawEvent, args)\n\t\teventLogger.Error(errMsg)\n\t\treturn shim.Error(errMsg)\n\t}\n\n\tquery := map[string]interface{}{\n\t\t\"selector\": map[string]interface{}{\n\t\t\t\"model_type\": types.EventModel,\n\t\t},\n\t}\n\n\tif len(args) == 1 {\n\t\tswitch args[0] {\n\t\tcase types.DepositEvent.String():\n\t\t\tquery[\"selector\"].(map[string]interface{})[\"event_type\"] = types.DepositEvent\n\t\tcase types.RemitEvent.String():\n\t\t\tquery[\"selector\"].(map[string]interface{})[\"event_type\"] = types.RemitEvent\n\t\tcase types.WithdrawEvent.String():\n\t\t\tquery[\"selector\"].(map[string]interface{})[\"event_type\"] = types.WithdrawEvent\n\t\tdefault:\n\t\t\terrMsg := fmt.Sprintf(\"Incorrect arguments. Expecting = [Optional('%s'|'%s'|'%s'), Actual = %s\\n\", types.DepositEvent, types.RemitEvent, types.WithdrawEvent, args)\n\t\t\teventLogger.Error(errMsg)\n\t\t\treturn shim.Error(errMsg)\n\t\t}\n\t}\n\n\tqueryBytes, err := json.Marshal(query)\n\tif err != nil {\n\t\teventLogger.Error(err.Error())\n\t\treturn shim.Error(err.Error())\n\t}\n\teventLogger.Infof(\"Query string = '%s'\", string(queryBytes))\n\tresultsIterator, err := APIstub.GetQueryResult(string(queryBytes))\n\tif err != nil {\n\t\teventLogger.Error(err.Error())\n\t\treturn shim.Error(err.Error())\n\t}\n\tdefer resultsIterator.Close()\n\n\tresults := make([]*models.Event, 0)\n\tfor resultsIterator.HasNext() {\n\t\tqueryResponse, err := resultsIterator.Next()\n\t\tif err != nil {\n\t\t\teventLogger.Error(err.Error())\n\t\t\treturn shim.Error(err.Error())\n\t\t}\n\t\tevent := new(models.Event)\n\t\tif err := json.Unmarshal(queryResponse.Value, event); err != nil {\n\t\t\teventLogger.Error(err.Error())\n\t\t\treturn shim.Error(err.Error())\n\t\t}\n\t\tresults = append(results, event)\n\t}\n\tjsonBytes, err := json.Marshal(results)\n\tif err != nil {\n\t\teventLogger.Error(err.Error())\n\t\treturn shim.Error(err.Error())\n\t}\n\treturn shim.Success(jsonBytes)\n}", "title": "" }, { "docid": "4ee1a23d2e9cbac77b68ee48a07975c9", "score": "0.60516906", "text": "func (m *MockOps) ListEvents(arg0 string, arg1 v11.ListOptions) (*v1.EventList, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListEvents\", arg0, arg1)\n\tret0, _ := ret[0].(*v1.EventList)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "5020b984125705fbc0b0533e456ede53", "score": "0.60453427", "text": "func (a *EventApiService) GetEventEventlist(ctx context.Context, eventEventlistId string) (EventEventlists, *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 EventEventlists\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/platform/3/event/eventlists/{EventEventlistId}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"EventEventlistId\"+\"}\", fmt.Sprintf(\"%v\", eventEventlistId), -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\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn successPayload, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn successPayload, localVarHttpResponse, err\n\t}\n\tdefer localVarHttpResponse.Body.Close()\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tbodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)\n\t\treturn successPayload, localVarHttpResponse, reportError(\"Status: %v, Body: %s\", localVarHttpResponse.Status, bodyBytes)\n\t}\n\n\tif err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {\n\t\treturn successPayload, localVarHttpResponse, err\n\t}\n\n\n\treturn successPayload, localVarHttpResponse, err\n}", "title": "" }, { "docid": "16e3d19ab41c7dce8191aaa94f6d58e3", "score": "0.6028937", "text": "func (c *ClientWithResponses) ListEventsWithResponse(ctx context.Context, params *ListEventsParams, reqEditors ...RequestEditorFn) (*ListEventsResponse, error) {\n\trsp, err := c.ListEvents(ctx, params, reqEditors...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ParseListEventsResponse(rsp)\n}", "title": "" }, { "docid": "b62a96e8e3536267e69ca692a230f300", "score": "0.60159165", "text": "func (g *GRPCServer) GetEvents(ctx context.Context, in *PeriodRequest) (*EventsResponse, error) {\n\tdate, err := ptypes.Timestamp(in.Date)\n\tif err != nil {\n\t\tg.logger.Error(err.Error())\n\t\treturn nil, err\n\t}\n\n\tpr := &domain.PeriodWithDate{\n\t\tDate: date,\n\t\tPeriod: domain.Periods(in.Period),\n\t}\n\n\tevents, err := g.calendar.SelectByDatePeriod(pr)\n\tif err != nil {\n\t\tg.logger.Error(err.Error())\n\t\treturn nil, err\n\t}\n\n\tresults := make([]*Event, 0, len(events))\n\tfor _, event := range events {\n\t\tprotoEvent, err := fromEven(event)\n\t\tif err != nil {\n\t\t\tg.logger.Error(err.Error())\n\t\t\treturn nil, err\n\t\t}\n\t\tresults = append(results, protoEvent)\n\t}\n\treturn &EventsResponse{\n\t\tStatus: true,\n\t\tEvents: results,\n\t\tDetail: \"\",\n\t}, nil\n}", "title": "" }, { "docid": "bc7495ee50c2b0f939a18f0271d60ee0", "score": "0.60124606", "text": "func (c Consumer) GetEvents(year int) ([]event.BasicEvent, error) {\n\tpath := fmt.Sprintf(\"%s/events/%d\", c.tbaURL, year)\n\n\tresp, err := c.makeRequest(path)\n\tif err != nil {\n\t\treturn []event.BasicEvent{}, err\n\t}\n\n\tif resp.StatusCode == http.StatusNotModified {\n\t\treturn []event.BasicEvent{}, tba.ErrNotModified\n\t} else if resp.StatusCode != http.StatusOK {\n\t\treturn []event.BasicEvent{}, fmt.Errorf(\"tba: polling failed with status code: %d\", resp.StatusCode)\n\t}\n\n\tvar tbaEvents []tbaEvent\n\tif err := json.NewDecoder(io.LimitReader(resp.Body, 1.049e+6)).Decode(&tbaEvents); err != nil {\n\t\treturn []event.BasicEvent{}, err\n\t}\n\n\tvar bEvents []event.BasicEvent\n\tfor _, tbaEvent := range tbaEvents {\n\t\ttimeZone, err := time.LoadLocation(tbaEvent.TimeZone)\n\t\tif err != nil {\n\t\t\treturn bEvents, err\n\t\t}\n\t\tdate, err := time.ParseInLocation(\"2006-01-02\", tbaEvent.Date, timeZone)\n\t\tif err != nil {\n\t\t\treturn bEvents, err\n\t\t}\n\t\tendDate, err := time.ParseInLocation(\"2006-01-02\", tbaEvent.EndDate, timeZone)\n\t\tif err != nil {\n\t\t\treturn bEvents, err\n\t\t}\n\n\t\tbEvents = append(bEvents, event.BasicEvent{\n\t\t\tKey: tbaEvent.Key,\n\t\t\tName: tbaEvent.Name,\n\t\t\tShortName: tbaEvent.ShortName,\n\t\t\tEventType: tbaEvent.EventType,\n\t\t\tLat: tbaEvent.Lat,\n\t\t\tLong: tbaEvent.Lng,\n\t\t\tDate: date,\n\t\t\tEndDate: endDate,\n\t\t})\n\t}\n\n\tlastModified.Set(path, resp.Header.Get(\"Last-Modified\"))\n\n\treturn bEvents, nil\n}", "title": "" }, { "docid": "7be6abf44351a0762d6af5ce745afc52", "score": "0.60057735", "text": "func (s *service) ListByApplicationIDPage(ctx context.Context, appID string, pageSize int, cursor string) (*model.EventDefinitionPage, error) {\n\ttnt, err := tenant.LoadFromContext(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif pageSize < 1 || pageSize > 200 {\n\t\treturn nil, apperrors.NewInvalidDataError(\"page size must be between 1 and 200\")\n\t}\n\n\treturn s.eventAPIRepo.ListByApplicationIDPage(ctx, tnt, appID, pageSize, cursor)\n}", "title": "" }, { "docid": "ab755c0f146a7d49e4f76c510237fae8", "score": "0.5954223", "text": "func (s *sfeventLister) List(selector labels.Selector) (ret []*v1alpha1.Sfevent, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.Sfevent))\n\t})\n\treturn ret, err\n}", "title": "" }, { "docid": "424c3eb7e8c3c3e4ad297e469812474d", "score": "0.5949833", "text": "func (c *Client) GetEvents() (*[]model.Event, error) {\n\t//So this uses a scan. Not brilliant with a large data set\n\t//For this though, we're fine\n\tsi := &dynamodb.ScanInput{\n\t\tTableName: aws.String(c.tableName),\n\t}\n\n\tresult, err := c.client.Scan(si)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"GetEvents error scanning db: %s\", err.Error())\n\t}\n\n\tevts := make([]model.Event, *result.Count)\n\tfor i, e := range result.Items {\n\t\tevt := &model.Event{}\n\t\terr = dynamodbattribute.UnmarshalMap(e, evt)\n\n\t\tif err != nil {\n\t\t\t//Log out if we error, no need to crash out completely\n\t\t\tlog.Printf(\"GetNextEvent error unmarshalling: %s\", err.Error())\n\t\t\tcontinue\n\t\t}\n\n\t\tevts[i] = *evt\n\t}\n\n\treturn &evts, nil\n}", "title": "" }, { "docid": "f3fb3f660f670f4d4e33332d1f5c6e97", "score": "0.59379005", "text": "func GetEvents() ([]Event, error) {\n\tvar (\n\t\tevents []Event\n\t\terr error\n\t)\n\n\tc := newEventCollection()\n\tdefer c.Close()\n\n\terr = c.Session.Find(nil).Sort(\"-createdAt\").All(&events)\n\treturn events, err\n}", "title": "" }, { "docid": "1e1b741060c4e13043d8a26ffa6ed860", "score": "0.5930164", "text": "func getAllEvents() ([]Event, error) {\n\tvar events []Event\n\tquery := `SELECT id,title,location,image,date FROM events`\n\trows, err := db.Query(query)\n\tif err != nil {\n\t\treturn events, err\n\t}\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\tvar e Event\n\t\terr := rows.Scan(&e.ID, &e.Title, &e.Location, &e.Image, &e.Date)\n\t\tif err != nil {\n\t\t\treturn events, err\n\t\t}\n\t\tevents = append(events, e)\n\t}\n\treturn events, nil\n}", "title": "" }, { "docid": "0c11efe73703b73ad4f1bb2dba0be0fd", "score": "0.59051734", "text": "func (a *Client) GetEvents(params *GetEventsParams) (*GetEventsOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetEventsParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getEvents\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/v1/events\",\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: &GetEventsReader{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.(*GetEventsOK), nil\n\n}", "title": "" }, { "docid": "fedab7ebb850b97b9ea4f93772600833", "score": "0.5899558", "text": "func (a *DefaultApiService) ListEventTypes(ctx _context.Context) ([]EventCategory, *_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 []EventCategory\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/event_types\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 200 {\n\t\t\tvar v []EventCategory\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\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": "7a4a8e4224784293e8ef6578a7b0ccc8", "score": "0.58882457", "text": "func (h *Events) getEvents(ctx context.Context) ([]types.Event, error) {\r\n\tquery := \"select * from public.getevents_sp();\"\r\n\tvar events []types.Event\r\n\r\n\terr := h.Data.SelectContext(ctx, &events, query)\r\n\tif err != nil {\r\n\t\treturn events, err\r\n\t}\r\n\r\n\treturn events, nil\r\n}", "title": "" }, { "docid": "5863d9b6f0be08a9d0ae3975d0fca56c", "score": "0.58877116", "text": "func (s *APIServer) searchEvents(auth ClientI, w http.ResponseWriter, r *http.Request, p httprouter.Params, version string) (interface{}, error) {\n\tvar err error\n\tto := time.Now().In(time.UTC)\n\tfrom := to.AddDate(0, -1, 0) // one month ago\n\tquery := r.URL.Query()\n\t// parse 'to' and 'from' params:\n\tfromStr := query.Get(\"from\")\n\tif fromStr != \"\" {\n\t\tfrom, err = time.Parse(time.RFC3339, fromStr)\n\t\tif err != nil {\n\t\t\treturn nil, trace.BadParameter(\"from\")\n\t\t}\n\t}\n\ttoStr := query.Get(\"to\")\n\tif toStr != \"\" {\n\t\tto, err = time.Parse(time.RFC3339, toStr)\n\t\tif err != nil {\n\t\t\treturn nil, trace.BadParameter(\"to\")\n\t\t}\n\t}\n\tvar limit int\n\tlimitStr := query.Get(\"limit\")\n\tif limitStr != \"\" {\n\t\tlimit, err = strconv.Atoi(limitStr)\n\t\tif err != nil {\n\t\t\treturn nil, trace.BadParameter(\"failed to parse limit: %q\", limit)\n\t\t}\n\t}\n\n\teventTypes := query[events.EventType]\n\teventsList, _, err := auth.SearchEvents(r.Context(), events.SearchEventsRequest{\n\t\tFrom: from,\n\t\tTo: to,\n\t\tEventTypes: eventTypes,\n\t\tLimit: limit,\n\t\tOrder: types.EventOrderDescending,\n\t})\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\treturn eventsList, nil\n}", "title": "" }, { "docid": "038b08f80dbd2811568977b1f6d2226b", "score": "0.58680004", "text": "func ListEvents ( votes [][] *big.Float) []Events {\n\tvar ids [] *big.Float\n\tvar events [] Events\n\t \n\tfor m,_:=range votes{ \n\t\tif (! contains(ids, votes[m][0])) {\n\t\t\tids= append(ids, votes[m][0])\n\t\t\tvar e Events\n\t\t\te.id= votes[m][0]\n\t\t\te.votes= append(e.votes,votes[m][1])\n\t\t\tevents= append(events,e)\n\t\t\t\n\t\t} else {\n\t\t for i,event := range events{\n\t\t \tif (event.id.Cmp(votes[m][0])==0) {\n\t\t\t\tevent.votes= append(event.votes,votes[m][1])\n\t\t\t\tevents[i]=event\n\t\t\t\t\n\t\t\t\t}}\n\t\t}}\n\treturn events\n}", "title": "" }, { "docid": "122e72ae50b0e179cf4f27c66cc232f5", "score": "0.5862427", "text": "func (a *Client) GetEvents(params *GetEventsParams, authInfo runtime.ClientAuthInfoWriter) (*GetEventsOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetEventsParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"GetEvents\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/events\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetEventsReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*GetEventsOK), nil\n}", "title": "" }, { "docid": "fe2e4c2bdfeb7d3f895efc04edc62cef", "score": "0.5847897", "text": "func (r *EventRepository) ReadList(userID int64, from time.Time, to time.Time) ([]*model.Event, error) {\n\tclient, err := r.Connect()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer r.Disconnect()\n\n\tquery := EventListQuery{UserID: userID}\n\n\tfromTimestamp, err := ptypes.TimestampProto(from)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tquery.From = fromTimestamp\n\n\ttoTimestamp, err := ptypes.TimestampProto(to)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tquery.To = toTimestamp\n\n\treply, err := client.ReadList(r.ctx, &query)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlist := make([]*model.Event, 0, len(reply.Items))\n\tfor _, event := range reply.Items {\n\t\tm, err := CreateEventModel(event)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tlist = append(list, m)\n\t}\n\treturn list, nil\n}", "title": "" }, { "docid": "7da3cecd74f39de66b29eb0246d167de", "score": "0.58420324", "text": "func GetEvents(params event.GetEventsParams) (result *event.GetEventsOKBody, err error) {\n\tkeptnutils.Debug(\"\", \"getting events from the datastore\")\n\tclient, err := mongo.NewClient(options.Client().ApplyURI(mongoDBConnection))\n\tif err != nil {\n\t\tkeptnutils.Error(\"\", fmt.Sprintf(\"error creating client: %s\", err.Error()))\n\t}\n\n\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\tdefer cancel()\n\n\terr = client.Connect(ctx)\n\tif err != nil {\n\t\tkeptnutils.Error(\"\", fmt.Sprintf(\"could not connect: %s\", err.Error()))\n\t}\n\n\tcollection := client.Database(mongoDBName).Collection(eventsCollectionName)\n\n\tsearchOptions := bson.M{}\n\tif params.KeptnContext != nil {\n\t\tsearchOptions[\"shkeptncontext\"] = primitive.Regex{Pattern: *params.KeptnContext, Options: \"\"}\n\t}\n\tif params.Type != nil {\n\t\tsearchOptions[\"type\"] = params.Type\n\t}\n\tvar newNextPageKey int64\n\tvar nextPageKey int64 = 0\n\tif params.NextPageKey != nil {\n\t\ttmpNextPageKey, _ := strconv.Atoi(*params.NextPageKey)\n\t\tnextPageKey = int64(tmpNextPageKey)\n\t\tnewNextPageKey = nextPageKey + *params.PageSize\n\t} else {\n\t\tnewNextPageKey = *params.PageSize\n\t}\n\n\tpagesize := *params.PageSize\n\n\tsortOptions := options.Find().SetSort(bson.D{{\"time\", -1}}).SetSkip(nextPageKey).SetLimit(pagesize)\n\n\ttotalCount, err := collection.CountDocuments(ctx, searchOptions)\n\tif err != nil {\n\t\tkeptnutils.Error(\"\", fmt.Sprintf(\"error counting elements in events collection: %s\", err.Error()))\n\t}\n\n\tcur, err := collection.Find(ctx, searchOptions, sortOptions)\n\tif err != nil {\n\t\tkeptnutils.Error(\"\", fmt.Sprintf(\"error finding elements in events collection: %s\", err.Error()))\n\t}\n\n\tvar resultEvents []*event.EventsItems0\n\tfor cur.Next(ctx) {\n\t\tvar result event.EventsItems0\n\t\terr := cur.Decode(&result)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t// flatten the data property\n\t\tdata := result.Data.(bson.D)\n\t\tmyMap := data.Map()\n\t\tflat, err := flatten.Flatten(myMap, \"\", flatten.RailsStyle)\n\t\tif err != nil {\n\t\t\tkeptnutils.Error(\"\", fmt.Sprintf(\"could not flatten element: %s\", err.Error()))\n\t\t}\n\t\tresult.Data = flat\n\t\tresultEvents = append(resultEvents, &result)\n\t}\n\n\tvar myresult event.GetEventsOKBody\n\tmyresult.Events = resultEvents\n\tmyresult.PageSize = pagesize\n\tmyresult.TotalCount = totalCount\n\tif newNextPageKey < totalCount {\n\t\tmyresult.NextPageKey = strconv.FormatInt(newNextPageKey, 10)\n\t}\n\n\treturn &myresult, nil\n\n}", "title": "" }, { "docid": "8f41e5f177caddf730abea6c60cac702", "score": "0.5815696", "text": "func ParseListEventsResponse(rsp *http.Response) (*ListEventsResponse, error) {\n\tbodyBytes, err := ioutil.ReadAll(rsp.Body)\n\tdefer func() { _ = rsp.Body.Close() }()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse := &ListEventsResponse{\n\t\tBody: bodyBytes,\n\t\tHTTPResponse: rsp,\n\t}\n\n\tswitch {\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 200:\n\t\tvar dest []Event\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON200 = &dest\n\n\t}\n\n\treturn response, nil\n}", "title": "" }, { "docid": "4db566c9dee224d6162b354ebf966803", "score": "0.5803671", "text": "func listEvents(cmd *cobra.Command, args []string) {\n\tt := table.NewWriter()\n\tt.SetOutputMirror(os.Stdout)\n\tt.AppendHeader(table.Row{\"Name\", \"Category\", \"Description\"})\n\tt.SetStyle(table.StyleLight)\n\n\tfor _, ktyp := range ktypes.GetKtypesMeta() {\n\t\tt.AppendRow(table.Row{ktyp.Name, ktyp.Category, ktyp.Description})\n\t}\n\n\tt.Render()\n}", "title": "" }, { "docid": "419d30aa0536291e5751ec1928136e83", "score": "0.57685274", "text": "func GetAllEvents() ([]*Event, error) {\n\tvar events []*Event\n\n\tclient, ctx, cancel, err := getConnection()\n\tif err != nil {\n\t\treturn events, err\n\t}\n\tdefer cancel()\n\tdefer client.Disconnect(ctx)\n\tdb := client.Database(\"penpal\")\n\tcollection := db.Collection(\"events\")\n\tcursor, err := collection.Find(ctx, bson.D{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer cursor.Close(ctx)\n\terr = cursor.All(ctx, &events)\n\tif err != nil {\n\t\tlog.Printf(\"Failed marshalling %v\", err)\n\t\treturn nil, err\n\t}\n\treturn events, nil\n}", "title": "" }, { "docid": "2a2f9419348a437f42299720c83b001e", "score": "0.57644147", "text": "func (k K8sClient) GetEvents(fieldSelector string) (*corev1.EventList, error) {\n\tevents, err := k.K8sCS.CoreV1().Events(\"\").List(context.TODO(), metav1.ListOptions{FieldSelector: fieldSelector})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error getting events for the resource : %v\", err)\n\t}\n\treturn events, nil\n}", "title": "" }, { "docid": "10deeb7d0cb589b3e9bb152ebd897073", "score": "0.5762544", "text": "func (s *IssuesService) ListIssueEvents(owner, repo string, number int, opt *ListOptions) ([]IssueEvent, *Response, error) {\n\tu := fmt.Sprintf(\"repos/%v/%v/issues/%v/events\", owner, repo, number)\n\tu, err := addOptions(u, opt)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treq, err := s.client.NewRequest(\"GET\", u, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tvar events []IssueEvent\n\tresp, err := s.client.Do(req, &events)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn events, resp, err\n}", "title": "" }, { "docid": "bddf549d7c4ef68cf370f65343ea64e8", "score": "0.57531685", "text": "func (s *Service) Events(ctx context.Context, req *pb.EventsRequest) (*pb.EventsResponse, error) {\n\tcurrentHeight := s.blockchain.Height()\n\tif req.Height > currentHeight {\n\t\treturn nil, status.Errorf(codes.NotFound, \"wanted to load target %d but only found up to %d\", req.Height, currentHeight)\n\t}\n\n\theight := uint32(req.Height)\n\tevents := s.blockchain.GetEventsDB().LoadEvents(height)\n\tresultEvents := make([]*_struct.Struct, 0, len(events))\n\tfor _, event := range events {\n\n\t\tif timeoutStatus := s.checkTimeout(ctx); timeoutStatus != nil {\n\t\t\treturn nil, timeoutStatus.Err()\n\t\t}\n\n\t\tvar find = true\n\t\tfor _, s := range req.Search {\n\t\t\tif event.AddressString() == s || event.ValidatorPubKeyString() == s {\n\t\t\t\tfind = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tfind = false\n\t\t}\n\t\tif !find {\n\t\t\tcontinue\n\t\t}\n\n\t\tmarshalJSON, err := s.cdc.MarshalJSON(event)\n\t\tif err != nil {\n\t\t\treturn nil, status.Errorf(codes.Internal, err.Error())\n\t\t}\n\n\t\tdata, err := encodeToStruct(marshalJSON)\n\t\tif err != nil {\n\t\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t\t}\n\n\t\tresultEvents = append(resultEvents, data)\n\t}\n\treturn &pb.EventsResponse{\n\t\tEvents: resultEvents,\n\t}, nil\n}", "title": "" }, { "docid": "a4ddee82c6178e39476a2a2f644fa6cd", "score": "0.57198936", "text": "func GetAllEvents() []Event {\n\tdb, err := db.Init()\n\tif err != nil {\n\t\tlog.Printf(\"Error initalizing database on retrieving event: %v\", err)\n\t}\n\tdefer db.Close()\n\tvar events []Event\n\tdb.Raw(`select * from events where deleted_at is null`).Scan(&events)\n\treturn events\n}", "title": "" }, { "docid": "0d77be330d01dd55e3f7f624606192e5", "score": "0.5679463", "text": "func getAll(db *sql.DB) ([]Event, error) {\n\treturn performRequest(db, \"SELECT * FROM events\")\n}", "title": "" }, { "docid": "2cd57547de6fa9328f95fb5973a9f2fc", "score": "0.5673429", "text": "func (s *EventService) NewListEventsParams() *ListEventsParams {\n\tp := &ListEventsParams{}\n\tp.p = make(map[string]interface{})\n\treturn p\n}", "title": "" }, { "docid": "feb4e26d0070f21a2336f0b5f23ca3e5", "score": "0.5669959", "text": "func (s *API) ListIPFailoverEvents(req *ListIPFailoverEventsRequest, opts ...scw.RequestOption) (*ListIPFailoverEventsResponse, error) {\n\tvar err error\n\n\tif req.Zone == \"\" {\n\t\tdefaultZone, _ := s.client.GetDefaultZone()\n\t\treq.Zone = defaultZone\n\t}\n\n\tdefaultPageSize, exist := s.client.GetDefaultPageSize()\n\tif (req.PageSize == nil || *req.PageSize == 0) && exist {\n\t\treq.PageSize = &defaultPageSize\n\t}\n\n\tquery := url.Values{}\n\tparameter.AddToQuery(query, \"page\", req.Page)\n\tparameter.AddToQuery(query, \"page_size\", req.PageSize)\n\tparameter.AddToQuery(query, \"order_by\", req.OrderBy)\n\n\tif fmt.Sprint(req.Zone) == \"\" {\n\t\treturn nil, errors.New(\"field Zone cannot be empty in request\")\n\t}\n\n\tif fmt.Sprint(req.IPFailoverID) == \"\" {\n\t\treturn nil, errors.New(\"field IPFailoverID cannot be empty in request\")\n\t}\n\n\tscwReq := &scw.ScalewayRequest{\n\t\tMethod: \"GET\",\n\t\tPath: \"/baremetal/v1alpha1/zones/\" + fmt.Sprint(req.Zone) + \"/ip-failovers/\" + fmt.Sprint(req.IPFailoverID) + \"/events\",\n\t\tQuery: query,\n\t\tHeaders: http.Header{},\n\t}\n\n\tvar resp ListIPFailoverEventsResponse\n\n\terr = s.client.Do(scwReq, &resp, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resp, nil\n}", "title": "" }, { "docid": "9cc58769a41af6f9b2d1b3cbd56bc9ab", "score": "0.5654645", "text": "func (e *Environment) GetEvents(limit int) ([]Event, error) {\n\treturn GetObjectEvents(\"environment\", e.ID, limit)\n}", "title": "" }, { "docid": "76e62d081889d0303ed5a602cc926b03", "score": "0.5601078", "text": "func (p *StackdriverProvider) ListAllEventsByNamespace(namespace string) (*api.EventList, error) {\n\treturn nil, fmt.Errorf(\"ListAllEventsByNamespace is not implemented yet.\")\n}", "title": "" }, { "docid": "d963ac181624e116b915f90eca1123a3", "score": "0.55826324", "text": "func (m *Mock) List() []string {\n\tvar events []string\n\n\tfor _, event := range m.events {\n\t\tevents = append(events, event.Message)\n\t}\n\n\treturn events\n}", "title": "" }, { "docid": "c30eb87e41f3fe17a15426d4e66ac2be", "score": "0.55759907", "text": "func (o *InlineResponse2003) GetEvents() []InlineResponse2003Events {\n\tif o == nil || o.Events == nil {\n\t\tvar ret []InlineResponse2003Events\n\t\treturn ret\n\t}\n\treturn *o.Events\n}", "title": "" }, { "docid": "25b44ff35ebedd028d508b11689e4d6d", "score": "0.55753404", "text": "func EventList() string {\n\tvar eventList string\n\tfor _, event := range EventNames() {\n\t\teventList += fmt.Sprintf(\" %s\\n\", event)\n\t}\n\n\treturn eventList\n}", "title": "" }, { "docid": "45cb5e9ec28f3edd2a22920abb72c6c2", "score": "0.55539995", "text": "func (s APIServer) GetEventsForDate(ctx context.Context, in *eventapi.EventDate) (*eventapi.EventList, error) {\n\ts.logger.Info(\"get event list for date received\")\n\n\ts.metrics.requests.WithLabelValues(\"get_for_date\").Inc()\n\n\tstartTime := time.Now()\n\tdefer s.addMetricLatency(startTime, \"get_for_date\")\n\n\teventList, err := s.eventStorage.GetEventsForDate(ctx, *in.GetDate())\n\tif err != nil {\n\t\treturn nil, s.getStatusFromError(err, \"get_for_date\")\n\t}\n\ts.logger.Info(\"get event list for date processed\")\n\treturn &eventapi.EventList{Events: eventList}, err\n}", "title": "" }, { "docid": "ac73c366f50a2a67bf824c6bcff7c790", "score": "0.5540856", "text": "func (client *Client) GetEvents(ctx context.Context, eventIDs []string, params *UniversalParams) (map[string]*Event, error) {\n\treq := NewRequest(http.MethodGet, \"events_by_id.v1\", nil)\n\tif params != nil {\n\t\treq.SetValues(params.Universal())\n\t}\n\n\treq.SetValues(map[string]string{\"event_id_list\": strings.Join(eventIDs, \",\")})\n\n\tresp, err := client.Do(ctx, req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\tvar results getEventResults\n\tdecoder := json.NewDecoder(resp.Body)\n\terr = decoder.Decode(&results)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tevents := make(map[string]*Event)\n\tfor k, v := range results.EventsByID {\n\t\tevents[k] = v.Event\n\t}\n\n\treturn events, nil\n}", "title": "" }, { "docid": "9ef3f5fec75f50760733db7fcb41bc6e", "score": "0.55349016", "text": "func (e *EventServer) GetEvents(params *api.GetParams, stream api.SecurityModule_GetEventsServer) error {\n\tmsgs := 10\n\tif !e.rate.limiter.AllowN(time.Now(), msgs) {\n\t\treturn nil\n\t}\nLOOP:\n\tfor {\n\t\tselect {\n\t\tcase msg := <-e.msgs:\n\t\t\tif err := stream.Send(msg); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tmsgs--\n\t\tcase <-time.After(time.Second):\n\t\t\tbreak LOOP\n\t\t}\n\n\t\tif msgs <= 0 {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9defda2c4be743efdd939a796d346645", "score": "0.5517166", "text": "func (t *Tree) GetEvents(limit int) ([]Event, error) {\r\n\treturn GetObjectEvents(\"tree\", t.ID, limit)\r\n}", "title": "" }, { "docid": "6f771f370bfbe8afa3b9358a9c58834b", "score": "0.5489535", "text": "func (c *analyticsAdminRESTClient) ListConversionEvents(ctx context.Context, req *adminpb.ListConversionEventsRequest, opts ...gax.CallOption) *ConversionEventIterator {\n\tit := &ConversionEventIterator{}\n\treq = proto.Clone(req).(*adminpb.ListConversionEventsRequest)\n\tunm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}\n\tit.InternalFetch = func(pageSize int, pageToken string) ([]*adminpb.ConversionEvent, string, error) {\n\t\tresp := &adminpb.ListConversionEventsResponse{}\n\t\tif pageToken != \"\" {\n\t\t\treq.PageToken = pageToken\n\t\t}\n\t\tif pageSize > math.MaxInt32 {\n\t\t\treq.PageSize = math.MaxInt32\n\t\t} else if pageSize != 0 {\n\t\t\treq.PageSize = int32(pageSize)\n\t\t}\n\t\tbaseUrl, err := url.Parse(c.endpoint)\n\t\tif err != nil {\n\t\t\treturn nil, \"\", err\n\t\t}\n\t\tbaseUrl.Path += fmt.Sprintf(\"/v1alpha/%v/conversionEvents\", req.GetParent())\n\n\t\tparams := url.Values{}\n\t\tparams.Add(\"$alt\", \"json;enum-encoding=int\")\n\t\tif req.GetPageSize() != 0 {\n\t\t\tparams.Add(\"pageSize\", fmt.Sprintf(\"%v\", req.GetPageSize()))\n\t\t}\n\t\tif req.GetPageToken() != \"\" {\n\t\t\tparams.Add(\"pageToken\", fmt.Sprintf(\"%v\", req.GetPageToken()))\n\t\t}\n\n\t\tbaseUrl.RawQuery = params.Encode()\n\n\t\t// Build HTTP headers from client and context metadata.\n\t\thds := append(c.xGoogHeaders, \"Content-Type\", \"application/json\")\n\t\theaders := gax.BuildHeaders(ctx, hds...)\n\t\te := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {\n\t\t\tif settings.Path != \"\" {\n\t\t\t\tbaseUrl.Path = settings.Path\n\t\t\t}\n\t\t\thttpReq, err := http.NewRequest(\"GET\", baseUrl.String(), nil)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\thttpReq.Header = headers\n\n\t\t\thttpRsp, err := c.httpClient.Do(httpReq)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tdefer httpRsp.Body.Close()\n\n\t\t\tif err = googleapi.CheckResponse(httpRsp); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tbuf, err := io.ReadAll(httpRsp.Body)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif err := unm.Unmarshal(buf, resp); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\treturn nil\n\t\t}, opts...)\n\t\tif e != nil {\n\t\t\treturn nil, \"\", e\n\t\t}\n\t\tit.Response = resp\n\t\treturn resp.GetConversionEvents(), resp.GetNextPageToken(), nil\n\t}\n\n\tfetch := func(pageSize int, pageToken string) (string, error) {\n\t\titems, nextPageToken, err := it.InternalFetch(pageSize, pageToken)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tit.items = append(it.items, items...)\n\t\treturn nextPageToken, nil\n\t}\n\n\tit.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)\n\tit.pageInfo.MaxSize = int(req.GetPageSize())\n\tit.pageInfo.Token = req.GetPageToken()\n\n\treturn it\n}", "title": "" }, { "docid": "f06ee9b927536a4905078c855bce1cb2", "score": "0.54797065", "text": "func ExampleWebhooksClient_NewListEventsPager() {\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 := armcontainerregistry.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := clientFactory.NewWebhooksClient().NewListEventsPager(\"myResourceGroup\", \"myRegistry\", \"myWebhook\", nil)\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.EventListResult = armcontainerregistry.EventListResult{\n\t\t// \tValue: []*armcontainerregistry.Event{\n\t\t// \t\t{\n\t\t// \t\t\tID: to.Ptr(\"00000000-0000-0000-0000-000000000000\"),\n\t\t// \t\t\tEventRequestMessage: &armcontainerregistry.EventRequestMessage{\n\t\t// \t\t\t\tMethod: to.Ptr(\"POST\"),\n\t\t// \t\t\t\tContent: &armcontainerregistry.EventContent{\n\t\t// \t\t\t\t\tAction: to.Ptr(\"push\"),\n\t\t// \t\t\t\t\tActor: &armcontainerregistry.Actor{\n\t\t// \t\t\t\t\t},\n\t\t// \t\t\t\t\tID: to.Ptr(\"00000000-0000-0000-0000-000000000000\"),\n\t\t// \t\t\t\t\tSource: &armcontainerregistry.Source{\n\t\t// \t\t\t\t\t\tAddr: to.Ptr(\"xtal.local:5000\"),\n\t\t// \t\t\t\t\t\tInstanceID: to.Ptr(\"00000000-0000-0000-0000-000000000000\"),\n\t\t// \t\t\t\t\t},\n\t\t// \t\t\t\t\tTarget: &armcontainerregistry.Target{\n\t\t// \t\t\t\t\t\tDigest: to.Ptr(\"sha256:fea8895f450959fa676bcc1df0611ea93823a735a01205fd8622846041d0c7cf\"),\n\t\t// \t\t\t\t\t\tLength: to.Ptr[int64](708),\n\t\t// \t\t\t\t\t\tMediaType: to.Ptr(\"application/vnd.docker.distribution.manifest.v2+json\"),\n\t\t// \t\t\t\t\t\tRepository: to.Ptr(\"hello-world\"),\n\t\t// \t\t\t\t\t\tSize: to.Ptr[int64](708),\n\t\t// \t\t\t\t\t\tTag: to.Ptr(\"latest\"),\n\t\t// \t\t\t\t\t\tURL: to.Ptr(\"http://192.168.100.227:5000/v2/hello-world/manifests/sha256:fea8895f450959fa676bcc1df0611ea93823a735a01205fd8622846041d0c7cf\"),\n\t\t// \t\t\t\t\t},\n\t\t// \t\t\t\t\tTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2017-03-01T23:14:37.0707808Z\"); return t}()),\n\t\t// \t\t\t\t\tRequest: &armcontainerregistry.Request{\n\t\t// \t\t\t\t\t\tMethod: to.Ptr(\"GET\"),\n\t\t// \t\t\t\t\t\tAddr: to.Ptr(\"192.168.64.11:42961\"),\n\t\t// \t\t\t\t\t\tHost: to.Ptr(\"192.168.100.227:5000\"),\n\t\t// \t\t\t\t\t\tID: to.Ptr(\"00000000-0000-0000-0000-000000000000\"),\n\t\t// \t\t\t\t\t\tUseragent: to.Ptr(\"curl/7.38.0\"),\n\t\t// \t\t\t\t\t},\n\t\t// \t\t\t\t},\n\t\t// \t\t\t\tHeaders: map[string]*string{\n\t\t// \t\t\t\t\t\"Authorization\": to.Ptr(\"******\"),\n\t\t// \t\t\t\t\t\"Content-Length\": to.Ptr(\"719\"),\n\t\t// \t\t\t\t\t\"Content-Type\": to.Ptr(\"application/json\"),\n\t\t// \t\t\t\t},\n\t\t// \t\t\t\tRequestURI: to.Ptr(\"http://myservice.com\"),\n\t\t// \t\t\t\tVersion: to.Ptr(\"1.1\"),\n\t\t// \t\t\t},\n\t\t// \t\t\tEventResponseMessage: &armcontainerregistry.EventResponseMessage{\n\t\t// \t\t\t\tHeaders: map[string]*string{\n\t\t// \t\t\t\t\t\"Content-Length\": to.Ptr(\"0\"),\n\t\t// \t\t\t\t},\n\t\t// \t\t\t\tStatusCode: to.Ptr(\"200\"),\n\t\t// \t\t\t\tVersion: to.Ptr(\"1.1\"),\n\t\t// \t\t\t},\n\t\t// \t}},\n\t\t// }\n\t}\n}", "title": "" }, { "docid": "68c91e0a95b9c090961ead29747a6308", "score": "0.5450163", "text": "func (sm *SysModel) Events() *objects.EventsCollection {\n\teventsList, err := sm.ListEvents(&api.ListWatchOptions{\n\t\tObjectMeta: api.ObjectMeta{Tenant: globals.DefaultTenant, Namespace: globals.DefaultNamespace}})\n\tif err != nil {\n\t\tlog.Errorf(\"failed to list events, err: %v\", err)\n\t\treturn &objects.EventsCollection{}\n\t}\n\n\treturn &objects.EventsCollection{List: eventsList}\n}", "title": "" }, { "docid": "117dd58210f07781373fd8e675bf8bf2", "score": "0.54415596", "text": "func (s *IssuesService) ListRepositoryEvents(owner, repo string, opt *ListOptions) ([]IssueEvent, *Response, error) {\n\tu := fmt.Sprintf(\"repos/%v/%v/issues/events\", owner, repo)\n\tu, err := addOptions(u, opt)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treq, err := s.client.NewRequest(\"GET\", u, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tvar events []IssueEvent\n\tresp, err := s.client.Do(req, &events)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn events, resp, err\n}", "title": "" }, { "docid": "2f3c7afc5bf188dd1eedaba28e28cb0d", "score": "0.54351467", "text": "func List(client *golangsdk.ServiceClient) (r ListResult) {\n\t_, r.Err = client.Get(listURL(client), &r.Body, openstack.StdRequestOpts())\n\treturn\n}", "title": "" }, { "docid": "1357d3d47404d15846ab3f560afcc42b", "score": "0.5434748", "text": "func ExtractEvents(page pagination.Page) ([]Event, error) {\n\tcasted := page.(EventPage).Body\n\n\tvar res struct {\n\t\tRes []Event `mapstructure:\"events\"`\n\t}\n\n\tif err := mapstructure.Decode(casted, &res); err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar events []interface{}\n\tswitch casted.(type) {\n\tcase map[string]interface{}:\n\t\tevents = casted.(map[string]interface{})[\"events\"].([]interface{})\n\tcase map[string][]interface{}:\n\t\tevents = casted.(map[string][]interface{})[\"events\"]\n\tdefault:\n\t\treturn res.Res, fmt.Errorf(\"Unknown type: %v\", reflect.TypeOf(casted))\n\t}\n\n\tfor i, eventRaw := range events {\n\t\tevent := eventRaw.(map[string]interface{})\n\t\tif date, ok := event[\"event_time\"]; ok && date != nil {\n\t\t\tt, err := time.Parse(gophercloud.STACK_TIME_FMT, date.(string))\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tres.Res[i].Time = t\n\t\t}\n\t}\n\n\treturn res.Res, nil\n}", "title": "" }, { "docid": "2dc15a97bacc2461b8443f1f8c1fc599", "score": "0.54315627", "text": "func (m *MockMailgun) ListEvents(arg0 *mailgun.ListEventOptions) *mailgun.EventIterator {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListEvents\", arg0)\n\tret0, _ := ret[0].(*mailgun.EventIterator)\n\treturn ret0\n}", "title": "" }, { "docid": "87b7049b80591fc47e74f6e0dfcb263f", "score": "0.543028", "text": "func (v EventsResource) ListUpcoming(c buffalo.Context) error {\n\t// Get the DB connection from the context\n\ttx, ok := c.Value(\"tx\").(*pop.Connection)\n\tif !ok {\n\t\treturn fmt.Errorf(\"no transaction found\")\n\t}\n\n\tevents := &models.Events{}\n\n\tq := tx.Select()\n\n\t// Retrieve all Events from the DB\n\tif err := q.Where(\"events.end_date > now()\").All(events); err != nil {\n\t\treturn err\n\t}\n\tc.Set(\"events\", events)\n\tc.Set(\"slots\", getSlots(*events))\n\n\treturn c.Render(200, r.HTML(\"events/upcoming\"))\n}", "title": "" }, { "docid": "bdba72b1eb3fa9eed00c652594bcf1b7", "score": "0.54224306", "text": "func (s *eventPolicyLister) List(selector labels.Selector) (ret []*v1alpha1.EventPolicy, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.EventPolicy))\n\t})\n\treturn ret, err\n}", "title": "" }, { "docid": "9783b01cc3ece6caf7cd15f390d1e5f6", "score": "0.54174787", "text": "func GetAllEvents() []*LogEvent {\n\tdb := createConnection()\n\n\trows, err := db.Query(\"SELECT * FROM LogEvent\")\n\tif err != nil {\n\t\tlog.Fatal(\"query failed\", err.Error())\n\t}\n\tdefer rows.Close()\n\n\tvar LogEvents []*LogEvent\n\tfor rows.Next() {\n\t\tle := new(LogEvent)\n\t\tif err := rows.Scan(&le.Id, &le.Severity, &le.Message, &le.Time); err != nil {\n\t\t\tlog.Fatal(\"scanning failed\", err.Error())\n\t\t}\n\t\tLogEvents = append(LogEvents, le)\n\t}\n\n\tcloseConnection(db)\n\n\treturn LogEvents\n\n}", "title": "" }, { "docid": "5eb5944d7c1cbe981467ec8a49ef9d50", "score": "0.5415971", "text": "func githubEvents(config config) []rawEvent {\n\tvar events []rawEvent\n\tpage := 1\n\tfor ; page <= 10; page++ {\n\t\turl := fmt.Sprintf(\"https://api.github.com/repos/%v/events?access_token=%v&page=%v\", config.repo, config.token, page)\n\t\tresp, getErr := http.Get(url)\n\t\tif getErr != nil {\n\t\t\tpanic(getErr)\n\t\t}\n\t\tdefer resp.Body.Close()\n\t\tbodyBytes, err := ioutil.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tpageEvents := decodeEvents(bodyBytes)\n\t\tif len(pageEvents) == 0 {\n\t\t\tbreak\n\t\t}\n\t\tevents = append(events, pageEvents...)\n\t}\n\treturn events\n}", "title": "" }, { "docid": "aaa07d6f18830281a5b538bf5ebda605", "score": "0.54083335", "text": "func (o *InlineResponse2003) SetEvents(v []InlineResponse2003Events) {\n\to.Events = &v\n}", "title": "" }, { "docid": "1a99bf9c459788a8177728fb7ca06c9e", "score": "0.5391252", "text": "func (e *mockBatch) GetEvents() []*evtsapi.Event {\n\treturn e.events\n}", "title": "" }, { "docid": "e65a4e7c0e2cf3a7520e659f84a74153", "score": "0.5384452", "text": "func ListaEvento(e *evento.Eventos) func(http.ResponseWriter, *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tparams := mux.Vars(r)\n\t\tresultado := e.Lista(params[\"id_evento\"])\n\t\tjson.NewEncoder(w).Encode(resultado)\n\t}\n}", "title": "" }, { "docid": "0a0a80eececd08227ac37ec7298f554c", "score": "0.5382065", "text": "func (m *User) GetEvents()([]Eventable) {\n val, err := m.GetBackingStore().Get(\"events\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]Eventable)\n }\n return nil\n}", "title": "" }, { "docid": "0b522829fd7cd830957377093177f156", "score": "0.5375413", "text": "func (c *Client) SearchEvents(ctx context.Context, req events.SearchEventsRequest) ([]apievents.AuditEvent, string, error) {\n\tevents, lastKey, err := c.APIClient.SearchEvents(ctx, req.From, req.To, apidefaults.Namespace, req.EventTypes, req.Limit, req.Order, req.StartKey)\n\tif err != nil {\n\t\treturn nil, \"\", trace.Wrap(err)\n\t}\n\n\treturn events, lastKey, nil\n}", "title": "" }, { "docid": "c170e585e4f968a31704489e395df7f4", "score": "0.53538626", "text": "func (f *FakeClient) ListIssueEvents(owner, repo string, number int) ([]github.ListedIssueEvent, error) {\n\tf.lock.RLock()\n\tdefer f.lock.RUnlock()\n\treturn append([]github.ListedIssueEvent{}, f.IssueEvents[number]...), nil\n}", "title": "" }, { "docid": "f18a1de011e463da93761ccdd61a3fee", "score": "0.53520066", "text": "func (c *Client) GetEvents(evtType string) (events *Events, err error) {\n\terr = c.doJSON(http.MethodGet, \"events?type=\"+evtType, &events)\n\treturn\n}", "title": "" }, { "docid": "7f3647c409d9c434b767c6b1abd2f793", "score": "0.53513646", "text": "func (s sfeventNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.Sfevent, err error) {\n\terr = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.Sfevent))\n\t})\n\treturn ret, err\n}", "title": "" }, { "docid": "832017041ffee31e14f966cdfb16aa83", "score": "0.5349786", "text": "func (m *Monitor) GetAlertEvents(ctx *gin.Context) {\n\tvar (\n\t\terr error\n\t)\n\toptions := make(map[string]interface{})\n\tif ctx.Query(\"ack\") == \"\" {\n\t\toptions[\"ack\"] = false\n\t} else {\n\t\toptions[\"ack\"], err = strconv.ParseBool(ctx.Query(\"ack\"))\n\t\tif err != nil {\n\t\t\tutils.ErrorResponse(ctx, utils.NewError(AckEventError, err))\n\t\t\treturn\n\t\t}\n\t}\n\n\tgroups := ctx.QueryArray(\"group\")\n\n\tif ctx.Query(\"app\") != \"\" {\n\t\toptions[\"app\"] = ctx.Query(\"app\")\n\t}\n\tif ctx.Query(\"start\") != \"\" {\n\t\toptions[\"start\"] = ctx.Query(\"start\")\n\t}\n\tif ctx.Query(\"end\") != \"\" {\n\t\toptions[\"end\"] = ctx.Query(\"end\")\n\t}\n\n\tresult, err := m.Alert.GetAlertEvents(ctx.MustGet(\"page\").(models.Page), options, groups)\n\tif err != nil {\n\t\tutils.ErrorResponse(ctx, utils.NewError(AckEventError, err))\n\t\treturn\n\t}\n\tutils.Ok(ctx, result)\n}", "title": "" }, { "docid": "025b08b2840c923c9eca7f4871df0514", "score": "0.5346019", "text": "func (r *Runtime) GetEvents(ctx context.Context, filters []string) ([]*events.Event, error) {\n\teventChannel := make(chan *events.Event)\n\toptions := events.ReadOptions{\n\t\tEventChannel: eventChannel,\n\t\tFilters: filters,\n\t\tFromStart: true,\n\t\tStream: false,\n\t}\n\n\tlogEvents := make([]*events.Event, 0, len(eventChannel))\n\treadLock := sync.Mutex{}\n\treadLock.Lock()\n\tgo func() {\n\t\tfor e := range eventChannel {\n\t\t\tlogEvents = append(logEvents, e)\n\t\t}\n\t\treadLock.Unlock()\n\t}()\n\n\treadErr := r.eventer.Read(ctx, options)\n\treadLock.Lock() // Wait for the events to be consumed.\n\treturn logEvents, readErr\n}", "title": "" } ]
4dc5e2fb29f4272bc199c8e5614ad1ec
Save a bucket that is getting hit the least to a file, and get room for the new item
[ { "docid": "8d81183a11448d694ba588807b42b667", "score": "0.526674", "text": "func (s *urlLookupServer) vacate(bno int, url *URL, info *URLInfo) (int, error) {\n\ts.lock.Lock()\n\thit := s.maxHit\n\tbucketNo := 0\n\turlCount := 0\n\tfor i := 0; i < hashTableSize; i++ {\n\t\tif s.urlht[i].hit <= hit && len(s.urlht[i].urldb) > urlCount {\n\t\t\tbucketNo = i\n\t\t\thit = s.urlht[i].hit\n\t\t\turlCount = len(s.urlht[i].urldb)\n\t\t}\n\t}\n\ts.cachedCount = s.cachedCount - len(s.urlht[bucketNo].urldb)\n\ts.urlht[bucketNo].hit = 0\n\ts.lock.Unlock()\n\n\tlog.Printf(\"Vacate bucket '%v' with %v urls\\n\", bucketNo, urlCount)\n\t// Vacate this bucket\n\tbucket := &s.urlht[bucketNo]\n\tbucket.lock.Lock()\n\n\t// if it's the same bucket, add it to the map first\n\tif url != nil && bno == bucketNo {\n\t\tbucket.urldb[*url] = info\n\t}\n\n\tentries := &URLs{\n\t\tURLEntries: make([]URLDBEntry, len(bucket.urldb)),\n\t}\n\tindex := 0\n\tfor url1, info := range bucket.urldb {\n\t\tlog.Printf(\"url1: %v, info: %v\", url1, *info)\n\t\tentries.URLEntries[index].HostAndPort = url1.hostAndPort\n\t\tentries.URLEntries[index].OriginalPath = url1.originalPath\n\t\tentries.URLEntries[index].Category = info.Category\n\t\tentries.URLEntries[index].Safe = info.Safe\n\t\tindex++\n\t\tdelete(bucket.urldb, url1)\n\t}\n\n\tdata, err := json.Marshal(entries)\n\tif err != nil {\n\t\tlog.Printf(\"failed to Marshall: %v\\n\", err)\n\t\treturn 0, err\n\t}\n\tif err = ioutil.WriteFile(bucket.fileName, data, 0666); err != nil {\n\t\tlog.Printf(\"failed to Marshall: %v\\n\", err)\n\t\treturn 0, err\n\t}\n\tbucket.lock.Unlock()\n\treturn bucketNo, nil\n}", "title": "" } ]
[ { "docid": "d3678026a590a25dbb9944d18a994ce6", "score": "0.6867102", "text": "func (f Bucket) Save(c context.Context, quote float32, buy float32, regMTime int64) error {\n\t//determine default bucket name\n\tbucketName, err := file.DefaultBucketName(c)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get default GCS bucket name: %v\", err)\n\t}\n\n\tclient, err := storage.NewClient(c)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get default GCS bucket name: %v\", err)\n\t}\n\tdefer client.Close()\n\n\tbucket := client.Bucket(bucketName)\n\n\tfileName := f.path\n\n\t//no append in bucket files - so we need to read in the bucket values first\n\trc, err := bucket.Object(f.path).NewReader(c)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer rc.Close()\n\n\tdata, err := getData(rc)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tnewData := AppendToList(data, Data{Value: quote, Diff: quote - buy}, regMTime)\n\n\t//store everything into bucket\n\twc := bucket.Object(fileName).NewWriter(c)\n\twc.ContentType = \"application/json\"\n\n\ts, err := convert2JSON(newData)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif _, err := wc.Write([]byte(s)); err != nil {\n\t\treturn fmt.Errorf(\"createFile: unable to write data to bucket %v, file %q: %v\", bucket, fileName, err)\n\t}\n\n\tif err := wc.Close(); err != nil {\n\t\treturn fmt.Errorf(\"createFile: unable to close bucket %v, file %q: %v\", bucket, fileName, err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f7a702f266e7666ed0deb99c3a64b9eb", "score": "0.639542", "text": "func (b *bucketLocker) write(bucket string) func() {\n\tload, _ := b.m.LoadOrStore(bucket, &sync.RWMutex{})\n\trw := load.(*sync.RWMutex)\n\trw.Lock()\n\treturn rw.Unlock\n}", "title": "" }, { "docid": "549ec07f5c199729151df5cef5e34743", "score": "0.622525", "text": "func (l *Limiter) GetAndSave(info BucketInfo) (b *Bucket, err error) {\n\tb, err = l.Get(info.ID)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tif b == nil {\n\t\tb, err = NewBucket(l.db, info)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t} else if (b.Interval != info.Interval && info.Interval != 0) ||\n\t\t(b.Size != info.Size && info.Size != 0) {\n\t\terr = b.Save(l.db)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "0a6e611330fe85c6c0d846679e3dc0ca", "score": "0.62033004", "text": "func (dal *DAL) Put(key string, val []byte, bucket string) {\n\tdb, _ := bolt.Open(dal.fileName, 0600, nil)\n\tdefer db.Close()\n\tdb.Update(func(tx *bolt.Tx) error {\n\t\tbucket := tx.Bucket([]byte(bucket))\n\t\treturn bucket.Put([]byte(key), val)\n\t})\n}", "title": "" }, { "docid": "47192cddb48192ae1a98a76f9943b539", "score": "0.6062207", "text": "func (b *Bucket) Save(key string, data []byte) (*brazier.Item, error) {\n\tvar i internal.Item\n\n\ttx, err := b.node.Begin(true)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer tx.Rollback()\n\n\terr = tx.One(\"Key\", key, &i)\n\tif err != nil {\n\t\tif err != storm.ErrNotFound {\n\t\t\treturn nil, err\n\t\t}\n\n\t\ti = internal.Item{\n\t\t\tKey: key,\n\t\t\tData: data,\n\t\t}\n\t} else {\n\t\ti.Data = data\n\t}\n\n\terr = tx.Save(&i)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &brazier.Item{\n\t\tKey: i.Key,\n\t\tData: i.Data,\n\t}, tx.Commit()\n}", "title": "" }, { "docid": "04c47a4deb167ea80e9c399267464d12", "score": "0.597489", "text": "func (b *bucketHandle) write() error {\n\tbuf, err := b.MarshalBinary()\n\tif err != nil {\n\t\treturn err\n\t}\n\tb.MmapFile.WriteAt(b.offset, buf)\n\treturn nil\n}", "title": "" }, { "docid": "286e534e2d662216224ca7f5cdad784f", "score": "0.5927746", "text": "func TestBucketPut(t *testing.T) {\n\twithOpenDB(func(db *DB, path string) {\n\t\tdb.Update(func(tx *Tx) error {\n\t\t\ttx.CreateBucket(\"widgets\")\n\t\t\terr := tx.Bucket(\"widgets\").Put([]byte(\"foo\"), []byte(\"bar\"))\n\t\t\tassert.NoError(t, err)\n\t\t\tvalue := tx.Bucket(\"widgets\").Get([]byte(\"foo\"))\n\t\t\tassert.Equal(t, value, []byte(\"bar\"))\n\t\t\treturn nil\n\t\t})\n\t})\n}", "title": "" }, { "docid": "90411100400b7d9763c939c82a1baf0c", "score": "0.588951", "text": "func TestBucketPutSingle(t *testing.T) {\n\tif testing.Short() {\n\t\tt.Skip(\"skipping test in short mode.\")\n\t}\n\n\tindex := 0\n\tf := func(items testdata) bool {\n\t\twithOpenDB(func(db *DB, path string) {\n\t\t\tm := make(map[string][]byte)\n\n\t\t\tdb.Update(func(tx *Tx) error {\n\t\t\t\treturn tx.CreateBucket(\"widgets\")\n\t\t\t})\n\t\t\tfor _, item := range items {\n\t\t\t\tdb.Update(func(tx *Tx) error {\n\t\t\t\t\tif err := tx.Bucket(\"widgets\").Put(item.Key, item.Value); err != nil {\n\t\t\t\t\t\tpanic(\"put error: \" + err.Error())\n\t\t\t\t\t}\n\t\t\t\t\tm[string(item.Key)] = item.Value\n\t\t\t\t\treturn nil\n\t\t\t\t})\n\n\t\t\t\t// Verify all key/values so far.\n\t\t\t\tdb.View(func(tx *Tx) error {\n\t\t\t\t\ti := 0\n\t\t\t\t\tfor k, v := range m {\n\t\t\t\t\t\tvalue := tx.Bucket(\"widgets\").Get([]byte(k))\n\t\t\t\t\t\tif !bytes.Equal(value, v) {\n\t\t\t\t\t\t\tdb.CopyFile(\"/tmp/bolt.put.single.db\", 0666)\n\t\t\t\t\t\t\tt.Fatalf(\"value mismatch [run %d] (%d of %d):\\nkey: %x\\ngot: %x\\nexp: %x\", index, i, len(m), []byte(k), value, v)\n\t\t\t\t\t\t}\n\t\t\t\t\t\ti++\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})\n\n\t\tindex++\n\t\treturn true\n\t}\n\tif err := quick.Check(f, qconfig()); err != nil {\n\t\tt.Error(err)\n\t}\n\tfmt.Fprint(os.Stderr, \"\\n\")\n}", "title": "" }, { "docid": "c835c0e5499e1c726f4f9a8dd8e62a0a", "score": "0.5881903", "text": "func (m MapBucketStorage) SaveBucket(ctx context.Context, id string, rateLimit uint64, bucket interfaces.Bucket) error {\n\tm.mu.Lock()\n\tm.Buckets[id] = bucket\n\tm.mu.Unlock()\n\n\tgo func(ctx context.Context, bucketStorage MapBucketStorage, id string, done <-chan struct{}) {\n\t\t<-done\n\t\terr := bucketStorage.DeleteBucket(ctx, id)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Can't delete inactive bucket %s: %s\", id, err)\n\t\t}\n\t\tlog.Printf(\"Deleted inactive bucket %s\", id)\n\t}(ctx, m, id, bucket.Inactive(ctx))\n\treturn nil\n}", "title": "" }, { "docid": "02807fb06f7ab81b1b9370528d173e8f", "score": "0.58801603", "text": "func modBucket(s concurrency.STM, cfg *storagepb.Config, now time.Time, add int64) (int64, error) {\n\tkey := bucketKey(cfg)\n\n\tval := s.Get(key)\n\tvar prevBucket storagepb.Bucket\n\tif err := proto.Unmarshal([]byte(val), &prevBucket); err != nil {\n\t\treturn 0, fmt.Errorf(\"error unmarshaling %v: %v\", key, err)\n\t}\n\tnewBucket := proto.Clone(&prevBucket).(*storagepb.Bucket)\n\n\tif tb := cfg.GetTimeBased(); tb != nil {\n\t\tif now.Unix() >= newBucket.LastReplenishMillisSinceEpoch/1e3+tb.ReplenishIntervalSeconds {\n\t\t\tnewBucket.Tokens += tb.TokensToReplenish\n\t\t\tif newBucket.Tokens > cfg.MaxTokens {\n\t\t\t\tnewBucket.Tokens = cfg.MaxTokens\n\t\t\t}\n\t\t\tnewBucket.LastReplenishMillisSinceEpoch = now.UnixNano() / 1e6\n\t\t}\n\t\tif add > 0 {\n\t\t\tadd = 0 // Do not replenish time-based quotas\n\t\t}\n\t}\n\n\tnewBucket.Tokens += add\n\tif newBucket.Tokens < 0 {\n\t\treturn 0, fmt.Errorf(\"insufficient tokens on %v (%v vs %v)\", key, prevBucket.Tokens, -add)\n\t}\n\tif newBucket.Tokens > cfg.MaxTokens {\n\t\tnewBucket.Tokens = cfg.MaxTokens\n\t}\n\n\tif !proto.Equal(&prevBucket, newBucket) {\n\t\tpb, err := proto.Marshal(newBucket)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\ts.Put(key, string(pb))\n\t}\n\n\treturn newBucket.Tokens, nil\n}", "title": "" }, { "docid": "766602ad7f825b36a631c54a4aa24e9c", "score": "0.5846046", "text": "func (b *DB) Put(tx *bolt.Tx, item Item) error {\n\tbucket, err := tx.CreateBucketIfNotExists(item.StoreID())\n\tif err == nil {\n\t\tbytes, err := item.Bytes()\n\t\tif err == nil {\n\t\t\tbucket.Put(item.Key(), bytes)\n\t\t}\n\t}\n\treturn err\n}", "title": "" }, { "docid": "bf2b531ba0e8385687e903d9f3b6fda7", "score": "0.58272904", "text": "func (c *Client) Save(key, value, bucket string) error {\n\treturn c.Update(func(tx *bolt.Tx) error {\n\t\tb, err := tx.CreateBucketIfNotExists([]byte(bucket))\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"create bucket error\")\n\t\t}\n\t\treturn b.Put([]byte(key), []byte(value))\n\t})\n}", "title": "" }, { "docid": "aee9a22042bb42c3b9a320fde3a59058", "score": "0.58043486", "text": "func (b *Bucket) write() []byte {\n\t// Allocate the appropriate size.\n\tvar n = b.rootNode\n\tvar value = make([]byte, bucketHeaderSize+n.size())\n\n\t// Write a bucket header.\n\tvar bucket = (*bucket)(unsafe.Pointer(&value[0]))\n\t*bucket = *b.bucket\n\n\t// Convert byte slice to a fake page and write the root node.\n\tvar p = (*page)(unsafe.Pointer(&value[bucketHeaderSize]))\n\tn.write(p)\n\n\treturn value\n}", "title": "" }, { "docid": "aee9a22042bb42c3b9a320fde3a59058", "score": "0.58043486", "text": "func (b *Bucket) write() []byte {\n\t// Allocate the appropriate size.\n\tvar n = b.rootNode\n\tvar value = make([]byte, bucketHeaderSize+n.size())\n\n\t// Write a bucket header.\n\tvar bucket = (*bucket)(unsafe.Pointer(&value[0]))\n\t*bucket = *b.bucket\n\n\t// Convert byte slice to a fake page and write the root node.\n\tvar p = (*page)(unsafe.Pointer(&value[bucketHeaderSize]))\n\tn.write(p)\n\n\treturn value\n}", "title": "" }, { "docid": "e7fdd1cb006573c2ff26dbbb728eeddf", "score": "0.57665503", "text": "func writeBucketChunk(key string, bucket_chunk []*fastq_util.ReadPair, output_dir string) map[string]string {\n\tread_fname := strings.Join([]string{output_dir, \"/\", key, \"R.fastq.gz\"}, \"\")\n\n\tfile_map := map[string]string{\"R\": read_fname}\n\n\twriter := fastq_util.NewReadPairWriter(read_fname)\n\n\t// and be a good boy and close my files\n\tdefer writer.Close()\n\n\tfor i := 0; i < len(bucket_chunk); i++ {\n\t\tr := bucket_chunk[i]\n\t\twriter.WriteReadPair(r)\n\t}\n\treturn file_map\n}", "title": "" }, { "docid": "58143169a3cf4d7b624c637e2fe132e2", "score": "0.57535124", "text": "func WriteBucket(bucketURL string, key string, reader io.Reader, timeout time.Duration) (err error) {\n\tctx, _ := context.WithTimeout(context.Background(), timeout)\n\tbucket, err := blob.Open(ctx, bucketURL)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"failed to open bucket %s\", bucketURL)\n\t}\n\tdata, err := ioutil.ReadAll(reader)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"failed to read data for key %s in bucket %s\", key, bucketURL)\n\t}\n\terr = bucket.WriteAll(ctx, key, data, nil)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"failed to write key %s in bucket %s\", key, bucketURL)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2c8aec0984ddaa1ce6f673997c47a39e", "score": "0.57419425", "text": "func (b *Bucket) openBucket(value []byte) *Bucket {\n\tvar child = newBucket(b.tx)\n\n\t// Unaligned access requires a copy to be made.\n\tconst unalignedMask = unsafe.Alignof(struct {\n\t\tbucket\n\t\tpage\n\t}{}) - 1\n\tunaligned := uintptr(unsafe.Pointer(&value[0]))&unalignedMask != 0\n\tif unaligned {\n\t\tvalue = cloneBytes(value)\n\t}\n\n\t// If this is a writable transaction then we need to copy the bucket entry.\n\t// Read-only transactions can point directly at the mmap entry.\n\tif b.tx.writable && !unaligned {\n\t\tchild.bucket = &bucket{}\n\t\t*child.bucket = *(*bucket)(unsafe.Pointer(&value[0]))\n\t} else {\n\t\tchild.bucket = (*bucket)(unsafe.Pointer(&value[0]))\n\t}\n\n\t// Save a reference to the inline page if the bucket is inline.\n\tif child.root == 0 {\n\t\tchild.page = (*page)(unsafe.Pointer(&value[bucketHeaderSize]))\n\t}\n\n\treturn &child\n}", "title": "" }, { "docid": "6f46a0cb72cadf31499abea272884834", "score": "0.5735719", "text": "func (b *Bucket) Put(n int64) (added int64) {\n\tfor {\n\t\tif tokens := atomic.LoadInt64(&b.tokens); tokens == b.capacity {\n\t\t\treturn 0\n\t\t} else if left := b.capacity - tokens; n <= left {\n\t\t\tif !atomic.CompareAndSwapInt64(&b.tokens, tokens, tokens+n) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn n\n\t\t} else if atomic.CompareAndSwapInt64(&b.tokens, tokens, b.capacity) {\n\t\t\treturn left\n\t\t}\n\t}\n}", "title": "" }, { "docid": "86d1384517f7c434bededf0b5a61deab", "score": "0.5712562", "text": "func TestBucketPutKeyTooLarge(t *testing.T) {\n\twithOpenDB(func(db *DB, path string) {\n\t\tdb.Update(func(tx *Tx) error {\n\t\t\ttx.CreateBucket(\"widgets\")\n\t\t\terr := tx.Bucket(\"widgets\").Put(make([]byte, 32769), []byte(\"bar\"))\n\t\t\tassert.Equal(t, err, ErrKeyTooLarge)\n\t\t\treturn nil\n\t\t})\n\t})\n}", "title": "" }, { "docid": "ddbe17cef612dff221fde9f747961d18", "score": "0.57077575", "text": "func (b Bucket) Set(ctx context.Context, item *store.Item) error {\n\tif item == nil {\n\t\treturn ErrNilItem\n\t}\n\n\toldItem, err := b.Get(ctx, item.Field)\n\n\tif err != nil {\n\t\tlog.Warningf(ctx, \"bucket.Set - Unable to get previous item, creating new\\n%v\", err)\n\n\t\titem.DataElement = store.WithNew(store.WithPerson(ctx))\n\t\titem.Key = datastore.NewIncompleteKey(ctx, bucketEntity, nil)\n\t} else {\n\t\titem.DataElement = store.WithOld(store.WithPerson(ctx), oldItem.DataElement)\n\t}\n\n\titem.Key, err = datastore.Put(ctx, item.Key, item)\n\treturn err\n}", "title": "" }, { "docid": "12d3ae30861ad6d8c8dd5398c1bf1943", "score": "0.56711024", "text": "func (fs *fsChunkedUploadProgressStorer) Save(up UploadProgress) {\n\tfs.Lock()\n\tdefer fs.Unlock()\n\tfs.up = up\n\tnow := time.Now()\n\tif now.Sub(fs.since).Seconds() > 1 {\n\t\tif fs.isRemoved {\n\t\t\treturn\n\t\t}\n\n\t\tbuf, err := json.Marshal(fs.up)\n\t\tif err != nil {\n\t\t\tlogger.Logger.Error(\"[progress] save \", fs.up, err)\n\t\t\treturn\n\t\t}\n\t\terr = sys.Files.WriteFile(fs.up.ID, buf, 0666)\n\t\tif err != nil {\n\t\t\tlogger.Logger.Error(\"[progress] save \", fs.up, err)\n\t\t\treturn\n\t\t}\n\n\t\tfs.since = now\n\t}\n}", "title": "" }, { "docid": "8bd8e1f4c1477ab92d5c8586cde188e4", "score": "0.5662363", "text": "func (d *Database) put(bucket *bolt.Bucket, key []byte, object interface{}) error {\n\tvar buffer bytes.Buffer\n\n\tif err := gob.NewEncoder(&buffer).Encode(object); err != nil {\n\t\treturn err\n\t}\n\n\treturn bucket.Put(key, buffer.Bytes())\n}", "title": "" }, { "docid": "db91d7c7f26bb647344f10b58bc15373", "score": "0.5641212", "text": "func putBucketVersion(bv *bucketVersion) {\n\t// bucketItemVCache.Set(bv.bucketKey, bv.itemVersions)\n\n\t// ch := make(chan error)\n\t// go func(ibv *bucketVersion, ich chan error) {\n\t// \terr := persistBucketVersion(ibv)\n\t// \tich <- err\n\t// }(bv, ch)\n\t// return ch\n\n\tlog.Println(\"Debug - Putting version meta in cache - \" + bv.bucketKey)\n\tbucketItemVCache.Set(bv.bucketKey, bv.itemVersions)\n\n\tgo func(ibv *bucketVersion) {\n\t\tpersistBucketVersion(ibv)\n\t}(bv)\n}", "title": "" }, { "docid": "99f5f687dc0f95ef7d730209507fc0a3", "score": "0.56214225", "text": "func (s *Drive) PutChunk(sha256sum []byte, chunk []byte, _ *shade.File) error {\n\t/*\n\t\tfmt.Printf(\"%d: \", s.chunks.Len())\n\t\tfor _, k := range s.chunks.Keys() {\n\t\t\tfmt.Printf(\"%x \", k.(string)[0:3])\n\t\t}\n\t\tfmt.Println()\n\t\tfmt.Printf(\"adding %x\\n\", sha256sum)\n\t*/\n\tif !s.chunks.Contains(string(sha256sum)) {\n\t\ts.chunkBytes += uint64(len(chunk))\n\t}\n\ts.wgl.Lock()\n\tfor s.chunkBytes > s.config.MaxChunkBytes {\n\t\t//fmt.Printf(\"%d > %d\\n\", s.chunkBytes, s.config.MaxChunkBytes)\n\t\ts.wg.Add(1)\n\t\ts.chunks.RemoveOldest()\n\t\ts.wg.Wait()\n\t}\n\ts.wgl.Unlock()\n\t//fmt.Printf(\"adding %x to LRU...\\n\", sha256sum)\n\ts.chunks.Add(string(sha256sum), chunk)\n\tmemoryChunks.Set(int64(s.chunks.Len()))\n\tmemoryChunkBytes.Set(int64(s.chunkBytes))\n\treturn nil\n}", "title": "" }, { "docid": "711b03357bcd92f0731332129c68aaa4", "score": "0.5618345", "text": "func copyFileToBuckets(t *testing.T, context *common.Context, filename string) {\n\tpathToFile := testutil.PathToUnitTestBag(\"example.edu.multipart.b01.of02.tar\")\n\tgfIdentifier := fmt.Sprintf(\"%s/%s\", objIdentifier, filename)\n\n\tresp := context.RegistryClient.GenericFileByIdentifier(gfIdentifier)\n\trequire.Nil(t, resp.Error)\n\tgf := resp.GenericFile()\n\trequire.NotNil(t, gf)\n\n\tfor _, preservationBucket := range context.Config.PreservationBuckets {\n\t\t_url := preservationBucket.URLFor(filename)\n\t\tif util.StringListContains(alreadySaved, _url) {\n\t\t\tcontinue\n\t\t}\n\t\tclient := context.S3Clients[preservationBucket.Provider]\n\t\t_, err := client.FPutObject(\n\t\t\tctx.Background(),\n\t\t\tpreservationBucket.Bucket,\n\t\t\tfilename,\n\t\t\tpathToFile,\n\t\t\tminio.PutObjectOptions{},\n\t\t)\n\t\trequire.Nil(t, err)\n\n\t\tstorageRecord := &registry.StorageRecord{\n\t\t\tURL: _url,\n\t\t\tGenericFileID: gf.ID,\n\t\t}\n\t\tresp := context.RegistryClient.StorageRecordCreate(storageRecord, gf.InstitutionID)\n\t\trequire.Nil(t, resp.Error)\n\t\talreadySaved = append(alreadySaved, _url)\n\t}\n}", "title": "" }, { "docid": "80cb2cd2b6885b7412faf8d19ef7c0c3", "score": "0.56108993", "text": "func (r *RateLimitBucket) Put() {\n\t<-r.ch\n}", "title": "" }, { "docid": "b914835d4e1ecefa08c6c0f42c8aeda0", "score": "0.5606744", "text": "func (ht *CowHashTable) Insert(key interface{}, cluster interface{}, item interface{}) interface{} {\n\n\tbkt := ht._handler.Hash_key(key) % ht._nbucket\n\n\tbucket := ht._table[bkt]\n\t//find not equal from head to end bucket,\n\tfor nil != bucket {\n\t\t//if only unique key and equal break\n\t\tif ht._handler.Eq_key(key, bucket._item) && cluster == nil {\n\t\t\tbreak\n\t\t}\n\t\t//if unique key and cluster key bath equal break\n\t\tif ht._handler.Eq_key(key, bucket._item) && ht._handler.Eq_cluster(cluster, bucket._item) {\n\t\t\tbreak\n\t\t}\n\t\tbucket = bucket._next\n\t}\n\n\t//not find equal insert table head\n\tif nil == bucket {\n\n\t\tif ht.isResize() { // re-calculate bucket\n\t\t\tbkt = ht._handler.Hash_key(key) % ht._nbucket\n\t\t}\n\n\t\thead_bucket := &Bucket{_ref: 1, _item: item}\n\n\t\thead_bucket._next = ht._table[bkt]\n\n\t\tht._table[bkt] = head_bucket\n\n\t\tht._nitem++\n\t\treturn head_bucket._item\n\t}\n\t//if not CowCopy replace new item\n\tif bucket.isMutable() {\n\t\tbucket._item = item\n\t\treturn bucket._item\n\t}\n\n\tnew_bucket := &Bucket{_ref: 1, _item: item}\n\n\tnew_bucket._next = ht._table[bkt]\n\n\tprior_next := &new_bucket._next\n\n\tshare_bucket := ht._table[bkt]\n\n\tfor share_bucket != bucket && share_bucket.isMutable() {\n\t\tprior_next = &(share_bucket._next)\n\t\tshare_bucket = share_bucket._next\n\t}\n\n\t//copy ref > 2 bucket until was found item\n\tfor share_bucket != bucket {\n\t\tcow_bucket := &Bucket{_ref: 1, _item: share_bucket._item}\n\t\tshare_bucket.decRef()\n\t\t*prior_next = cow_bucket\n\t\tprior_next = &(cow_bucket._next)\n\t\tshare_bucket = share_bucket._next\n\t}\n\n\t*prior_next = bucket._next\n\tbucket.decRef()\n\tht._table[bkt] = new_bucket\n\treturn new_bucket._item\n}", "title": "" }, { "docid": "f921af8e3f1b0e4a30eaa7eeb52eeb8c", "score": "0.5600747", "text": "func (k *KeyFile) PutBucket(idx int, b *Bucket) error {\n\tvar bmu *sync.Mutex\n\tk.blmu.Lock()\n\tfor idx > len(k.bucketLocks)-1 {\n\t\tk.bucketLocks = append(k.bucketLocks, &sync.Mutex{})\n\t}\n\tk.bucketLocks[idx].Lock()\n\tbmu = k.bucketLocks[idx]\n\tk.blmu.Unlock()\n\tif bmu == nil {\n\t\tpanic(\"attempt to put invalid bucket index\")\n\t}\n\tdefer bmu.Unlock()\n\n\toffset := KeyFileHeaderSize + int64(idx)*int64(k.Header.BlockSize)\n\tsw := NewSectionWriter(k.file, offset, int64(k.Header.BlockSize))\n\t_, err := b.storeFullTo(sw)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"write bucket: %w\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ead88459b17be8613bc511cf7c5fd48a", "score": "0.5598066", "text": "func (ki *keyIndex) put(lg *zap.Logger, main int64, sub int64) {\n\trev := revision{main: main, sub: sub}\n\n\tif !rev.GreaterThan(ki.modified) {\n\t\tlg.Panic(\n\t\t\t\"'put' with an unexpected smaller revision\",\n\t\t\tzap.Int64(\"given-revision-main\", rev.main),\n\t\t\tzap.Int64(\"given-revision-sub\", rev.sub),\n\t\t\tzap.Int64(\"modified-revision-main\", ki.modified.main),\n\t\t\tzap.Int64(\"modified-revision-sub\", ki.modified.sub),\n\t\t)\n\t}\n\tif len(ki.generations) == 0 {\n\t\tki.generations = append(ki.generations, generation{})\n\t}\n\tg := &ki.generations[len(ki.generations)-1]\n\tif len(g.revs) == 0 { // create a new key\n\t\tg.created = rev\n\t}\n\tg.revs = append(g.revs, rev)\n\tg.ver++\n\tki.modified = rev\n}", "title": "" }, { "docid": "518de92c2e4a7dcfeffec445df549c6f", "score": "0.55853355", "text": "func newBucket() *bucket {\n\tbucket := &bucket{}\n\tbucket.list = list.New()\n\tbucket.mutex = &sync.Mutex{}\n\tbucket.lastUpdate = time.Now()\n\treturn bucket\n}", "title": "" }, { "docid": "f547908caf3c35ebab0117b78101a0d0", "score": "0.5566192", "text": "func TestBucketStat(t *testing.T) {\n\tif testing.Short() {\n\t\tt.Skip(\"skipping test in short mode.\")\n\t}\n\n\twithOpenDB(func(db *DB, path string) {\n\t\tdb.Update(func(tx *Tx) error {\n\t\t\t// Add bucket with lots of keys.\n\t\t\ttx.CreateBucket(\"widgets\")\n\t\t\tb := tx.Bucket(\"widgets\")\n\t\t\tfor i := 0; i < 100000; i++ {\n\t\t\t\tb.Put([]byte(strconv.Itoa(i)), []byte(strconv.Itoa(i)))\n\t\t\t}\n\n\t\t\t// Add bucket with fewer keys but one big value.\n\t\t\ttx.CreateBucket(\"woojits\")\n\t\t\tb = tx.Bucket(\"woojits\")\n\t\t\tfor i := 0; i < 500; i++ {\n\t\t\t\tb.Put([]byte(strconv.Itoa(i)), []byte(strconv.Itoa(i)))\n\t\t\t}\n\t\t\tb.Put([]byte(\"really-big-value\"), []byte(strings.Repeat(\"*\", 10000)))\n\n\t\t\t// Add a bucket that fits on a single root leaf.\n\t\t\ttx.CreateBucket(\"whozawhats\")\n\t\t\tb = tx.Bucket(\"whozawhats\")\n\t\t\tb.Put([]byte(\"foo\"), []byte(\"bar\"))\n\n\t\t\treturn nil\n\t\t})\n\t\tmustCheck(db)\n\t\tdb.View(func(tx *Tx) error {\n\t\t\tb := tx.Bucket(\"widgets\")\n\t\t\tstat := b.Stat()\n\t\t\tassert.Equal(t, stat.BranchPageCount, 15)\n\t\t\tassert.Equal(t, stat.LeafPageCount, 1281)\n\t\t\tassert.Equal(t, stat.OverflowPageCount, 0)\n\t\t\tassert.Equal(t, stat.KeyCount, 100000)\n\t\t\tassert.Equal(t, stat.MaxDepth, 3)\n\n\t\t\tb = tx.Bucket(\"woojits\")\n\t\t\tstat = b.Stat()\n\t\t\tassert.Equal(t, stat.BranchPageCount, 1)\n\t\t\tassert.Equal(t, stat.LeafPageCount, 6)\n\t\t\tassert.Equal(t, stat.OverflowPageCount, 2)\n\t\t\tassert.Equal(t, stat.KeyCount, 501)\n\t\t\tassert.Equal(t, stat.MaxDepth, 2)\n\n\t\t\tb = tx.Bucket(\"whozawhats\")\n\t\t\tstat = b.Stat()\n\t\t\tassert.Equal(t, stat.BranchPageCount, 0)\n\t\t\tassert.Equal(t, stat.LeafPageCount, 1)\n\t\t\tassert.Equal(t, stat.OverflowPageCount, 0)\n\t\t\tassert.Equal(t, stat.KeyCount, 1)\n\t\t\tassert.Equal(t, stat.MaxDepth, 1)\n\n\t\t\treturn nil\n\t\t})\n\t})\n}", "title": "" }, { "docid": "a1754e32895a2194691f4a7e521efdcd", "score": "0.55403656", "text": "func (dal *DAL) Get(key string, bucket string) []byte {\n\tdb, _ := bolt.Open(dal.fileName, 0600, nil)\n\tdefer db.Close()\n\tvar returnB []byte\n\tdb.Update(func(tx *bolt.Tx) error {\n\t\tbucket := tx.Bucket([]byte(bucket))\n\t\tb := bucket.Get([]byte(key))\n\t\treturnB = make([]byte, 0, len(b))\n\t\treturnB = append(returnB, b...)\n\t\treturn nil\n\t})\n\n\treturn returnB\n}", "title": "" }, { "docid": "8712c4269729560d2a6c7d80ad7c63c5", "score": "0.5529164", "text": "func (poi *putObjInfo) writeToFile() (err error) {\n\tvar (\n\t\tfile *os.File\n\t\tbuf []byte\n\t\tslab *memsys.Slab2\n\t\treader = poi.r\n\t)\n\tif dryRun.disk {\n\t\treturn\n\t}\n\tif file, err = cmn.CreateFile(poi.workFQN); err != nil {\n\t\tpoi.t.fshc(err, poi.workFQN)\n\t\treturn fmt.Errorf(\"failed to create %s, err: %s\", poi.workFQN, err)\n\t}\n\n\tif poi.size == 0 {\n\t\tbuf, slab = nodeCtx.mm.AllocDefault()\n\t} else {\n\t\tbuf, slab = nodeCtx.mm.AllocForSize(poi.size)\n\t}\n\tdefer func() { // free & cleanup on err\n\t\tslab.Free(buf)\n\t\treader.Close()\n\n\t\tif err != nil {\n\t\t\tif nestedErr := file.Close(); nestedErr != nil {\n\t\t\t\tglog.Errorf(\"Nested (%v): failed to close received object %s, err: %v\", err, poi.workFQN, nestedErr)\n\t\t\t}\n\t\t\tif nestedErr := os.Remove(poi.workFQN); nestedErr != nil {\n\t\t\t\tglog.Errorf(\"Nested (%v): failed to remove %s, err: %v\", err, poi.workFQN, nestedErr)\n\t\t\t}\n\t\t}\n\t}()\n\n\t// receive and checksum\n\tvar (\n\t\twritten int64\n\n\t\tcheckCksumType string\n\t\texpectedCksum cmn.Cksummer\n\t\tsaveHash, checkHash hash.Hash\n\t\thashes []hash.Hash\n\t)\n\n\tpoiCkConf := poi.lom.CksumConf()\n\tif !poi.cold && poiCkConf.Type != cmn.ChecksumNone {\n\t\tcheckCksumType = poiCkConf.Type\n\t\tcmn.AssertMsg(checkCksumType == cmn.ChecksumXXHash, checkCksumType)\n\n\t\tif !poi.migrated || poiCkConf.ValidateObjMove {\n\t\t\tsaveHash = xxhash.New64()\n\t\t\thashes = []hash.Hash{saveHash}\n\n\t\t\t// if sender provided checksum we need to ensure that it is correct\n\t\t\tif expectedCksum = poi.cksumToCheck; expectedCksum != nil {\n\t\t\t\tcheckHash = saveHash\n\t\t\t}\n\t\t} else {\n\t\t\t// if migration validation is not configured we can just take\n\t\t\t// the checksum that has arrived with the object (and compute it if not present)\n\t\t\tpoi.lom.SetCksum(poi.cksumToCheck)\n\t\t\tif poi.cksumToCheck == nil {\n\t\t\t\tsaveHash = xxhash.New64()\n\t\t\t\thashes = []hash.Hash{saveHash}\n\t\t\t}\n\t\t}\n\t} else if poi.cold {\n\t\t// compute xxhash (the default checksum) and save it as part of the object metadata\n\t\tsaveHash = xxhash.New64()\n\t\thashes = []hash.Hash{saveHash}\n\n\t\t// if validate-cold-get and the cksum is provied we should also check md5 hash (aws, gcp)\n\t\tif poiCkConf.ValidateColdGet && poi.cksumToCheck != nil {\n\t\t\texpectedCksum = poi.cksumToCheck\n\t\t\tcheckCksumType, _ = expectedCksum.Get()\n\t\t\tcmn.AssertMsg(checkCksumType == cmn.ChecksumMD5 || checkCksumType == cmn.ChecksumCRC32C, checkCksumType)\n\n\t\t\tcheckHash = md5.New()\n\t\t\tif checkCksumType == cmn.ChecksumCRC32C {\n\t\t\t\tcheckHash = cmn.NewCRC32C()\n\t\t\t}\n\n\t\t\thashes = append(hashes, checkHash)\n\t\t}\n\t}\n\n\tif written, err = cmn.ReceiveAndChecksum(file, reader, buf, hashes...); err != nil {\n\t\treturn\n\t}\n\n\tif checkHash != nil {\n\t\tcomputedCksum := cmn.NewCksum(checkCksumType, cmn.HashToStr(checkHash))\n\t\tif !cmn.EqCksum(expectedCksum, computedCksum) {\n\t\t\ts := cmn.BadCksum(expectedCksum, computedCksum) + \", \" + poi.lom.StringEx() + \"[\" + poi.workFQN + \"]\"\n\t\t\terr = fmt.Errorf(s)\n\t\t\tpoi.t.statsif.AddMany(stats.NamedVal64{stats.ErrCksumCount, 1}, stats.NamedVal64{stats.ErrCksumSize, written})\n\t\t\treturn\n\t\t}\n\t}\n\tpoi.lom.SetSize(written)\n\tif saveHash != nil {\n\t\tpoi.lom.SetCksum(cmn.NewCksum(cmn.ChecksumXXHash, cmn.HashToStr(saveHash)))\n\t}\n\tif err = file.Close(); err != nil {\n\t\treturn fmt.Errorf(\"failed to close received file %s, err: %v\", poi.workFQN, err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "961e608cdd59931c3c96e8c67332f0ef", "score": "0.5521355", "text": "func (s *GCS) Write(data []byte) (int, error) {\n\tctx := context.Background()\n\tw := s.client.Bucket(s.bucket).Object(s.key).NewWriter(ctx)\n\tdefer w.Close()\n\n\treturn w.Write(data)\n}", "title": "" }, { "docid": "11df3ee73cd6bf8ccb207d32dd4c3eca", "score": "0.55007684", "text": "func newBucket(tx *Tx) Bucket {\n\tvar b = Bucket{tx: tx, FillPercent: DefaultFillPercent}\n\tif tx.writable {\n\t\tb.buckets = make(map[string]*Bucket)\n\t\tb.nodes = make(map[pgid]*node)\n\t}\n\treturn b\n}", "title": "" }, { "docid": "e16547caf20b1bf1e4c43a46dac9fe3e", "score": "0.5492108", "text": "func WriteSongToBucket(entityList []Song, bucket *bolt.Bucket) {\n\tfor i := range entityList {\n\t\tdata, err := entityList[i].Encode()\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tif err := bucket.Put([]byte(strconv.Itoa(entityList[i].ID)), data); err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9830baac92955762d63d5f3e67b2dbce", "score": "0.5488952", "text": "func (ctrl *ProvisionController) enqueueBucket(obj interface{}) {\n\tvar key string\n\tvar err error\nfmt.Println(\"enqueueBucketRequest obj \", obj)\n\tif key, err = cache.DeletionHandlingMetaNamespaceKeyFunc(obj); err != nil {\n\t\tutilruntime.HandleError(err)\n\t\treturn\n\t}\n\t// Re-Adding is harmless but try to add it to the queue only if it is not\n\t// already there, because if it is already there we *must* be retrying it\n//fmt.Println(\"Putting into bucketQueue \", key)\n\tif ctrl.bucketQueue.NumRequeues(key) == 0 {\n\t\tctrl.bucketQueue.Add(key)\n\t}\n}", "title": "" }, { "docid": "4e5a331f175cff46721982792e5d880d", "score": "0.5484087", "text": "func (b *Buffer) Write(name string, data ...[]byte) error {\n\tbucket, err := b.Get(name)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := bucket.Write(data...); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0cca252972d1845be45f8c83eec32d26", "score": "0.5475143", "text": "func TestBucketPutReadOnly(t *testing.T) {\n\twithOpenDB(func(db *DB, path string) {\n\t\tdb.Update(func(tx *Tx) error {\n\t\t\ttx.CreateBucket(\"widgets\")\n\t\t\treturn nil\n\t\t})\n\t\tdb.View(func(tx *Tx) error {\n\t\t\tb := tx.Bucket(\"widgets\")\n\t\t\terr := b.Put([]byte(\"foo\"), []byte(\"bar\"))\n\t\t\tassert.Equal(t, err, ErrBucketNotWritable)\n\t\t\treturn nil\n\t\t})\n\t})\n}", "title": "" }, { "docid": "4d9fda0c10216c9d8f5bccbd62c71f5e", "score": "0.5471069", "text": "func (b *Bucket) Put(key []byte, value []byte) (uint64, error) {\n\tbd, err := b.loc.CreateBucketIfNotExists(bucketNameData)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tbs, err := b.loc.CreateBucketIfNotExists(bucketNameSeq)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\t// Delete current value\n\tif v := Value(bd.Get(key)); v != nil {\n\t\tif !v.IsValid() {\n\t\t\treturn 0, ErrInvalidValue\n\t\t}\n\t\tif err := bs.Delete(v.seqBytes()); err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\tif err := bd.Delete(key); err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\t// Get next sequence\n\tseq, err := bs.NextSequence()\n\tif err != nil {\n\t\treturn seq, err\n\t}\n\n\t// Make value\n\tval := newValue(seq, value)\n\n\t// Add seq->key mapping. Fill percent is set to 100% as\n\t// we add keys in order.\n\tbs.FillPercent = 1\n\tif err := bs.Put(val.seqBytes(), key); err != nil {\n\t\treturn seq, err\n\t}\n\n\treturn seq, bd.Put(key, val)\n}", "title": "" }, { "docid": "739629386861329eca53854cd2b553c4", "score": "0.54690635", "text": "func (client *StowClient) putFile(reader io.Reader, fileSize int64, uploadName string) (string, error) {\n\tif uploadName == \"\" {\n\t\t// This is not the item ID (that's returned by Put)\n\t\t// should we just use handler.Filename? what are the constraints here?\n\t\tuploadName = uuid.NewV4().String()\n\t}\n\n\tr := client.uploads.declare(uploadName, fileSize, reader)\n\tdefer client.uploads.remove(uploadName, r)\n\n\titem, err := client.writeContainer.Put(uploadName, r, int64(fileSize), nil)\n\tif err != nil {\n\t\tlog.WithError(err).Errorf(\"Error writing file: %s on storage, size %d\", uploadName, fileSize)\n\t\treturn \"\", ErrWritingFile\n\t}\n\n\tlog.Debugf(\"Successfully wrote file:%s on storage\", uploadName)\n\treturn item.ID(), nil\n}", "title": "" }, { "docid": "1380eb647b3090c1fe6ab66e939fb050", "score": "0.5437828", "text": "func (this *BoltDB) Put(bucketName string, key string, value string) {\n\tthis.log(\"Put('\" + bucketName + \"', '\" + key + \"', '\" + value + \"')\")\n\tthis.checkIfOpen()\n\n\terr := this.db.Update(func(tx *bolt.Tx) error {\n\t\tbucket := tx.Bucket([]byte(bucketName))\n\t\tif bucket == nil {\n\t\t\tpanic(\"Bucket '\" + bucketName + \"' not found\")\n\t\t}\n\t\tbucket.Put([]byte(key), []byte(value))\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\tpanic(\"Cannot put key '\" + key + \"' in bucket '\" + bucketName + \"'\")\n\t}\n}", "title": "" }, { "docid": "7d15a67025f32e5cfb21e9f854391477", "score": "0.5433967", "text": "func updateBucket(session *mgo.Session, id string, bForm BucketPart) (*Bucket, error) {\n\tsessionCopy := session.Copy()\n\tdefer sessionCopy.Close()\n\tcollection := sessionCopy.DB(AuthDatabase).C(\"buckets\")\n\n\ttasksIds := make([]bson.ObjectId, len(bForm.Tasks))\n\tfor i, task := range bForm.Tasks {\n\t\ttasksIds[i] = bson.ObjectIdHex(task)\n\t}\n\tbucketUpdate := bson.M{\"name\": bForm.Name, \"tasks\": tasksIds}\n\terr := collection.Update(bson.M{\"_id\": bson.ObjectIdHex(id)}, bson.M{\"$set\": bucketUpdate})\n\tif err != nil {\n\t\tlog.Fatal(\"updateBucket ERROR:\", err)\n\t}\n\tbucket := Bucket{}\n\terr = collection.Find(bson.M{\"_id\": bson.ObjectIdHex(id)}).One(&bucket)\n\treturn &bucket, err\n}", "title": "" }, { "docid": "f48a029c9449cd368f04b1b6a1e0be50", "score": "0.54148865", "text": "func (db *Database) Save(bucket, key string, newData []byte) {\n\tdb, err := db.openSession()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer db.ref.Close()\n\n\tif err := db.ref.Update(func(tx *bolt.Tx) error {\n\t\tmainBucket := tx.Bucket([]byte(DbMainBucket))\n\n\t\tb, err := mainBucket.CreateBucketIfNotExists([]byte(bucket))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err = b.Put([]byte(key), newData); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfmt.Println(\"Saved succesfully\")\n\t\treturn nil\n\t}); err != nil {\n\t\tpanic(err.Error())\n\t}\n}", "title": "" }, { "docid": "d728533d0b5b1ca04ecb965dc1dc0d8a", "score": "0.5414094", "text": "func downloadFile(w io.Writer) ([]byte, error) {\n bucket := os.Getenv(\"BUCKET_NAME\")\n object := \"notes.txt\"\n ctx := context.Background()\n client, err := storage.NewClient(ctx)\n if err != nil {\n return nil, fmt.Errorf(\"storage.NewClient: %v\", err)\n }\n defer client.Close()\n\n ctx, cancel := context.WithTimeout(ctx, time.Second*50)\n defer cancel()\n\n rc, err := client.Bucket(bucket).Object(object).NewReader(ctx)\n if err != nil {\n return nil, fmt.Errorf(\"Object(%q).NewReader: %v\", object, err)\n }\n defer rc.Close()\n\n data, err := ioutil.ReadAll(rc)\n if err != nil {\n return nil, fmt.Errorf(\"ioutil.ReadAll: %v\", err)\n }\n fmt.Println(\"File \"+object+\" downloaded from bucket \"+ bucket)\n return data, nil\n}", "title": "" }, { "docid": "8b5453258a1e7993d714b5a5b5f6360c", "score": "0.54032624", "text": "func (b *bucket) write(records []Record) {\n\tif b != nil && len(records) > 0 {\n\t\tb.incoming <- records\n\t}\n}", "title": "" }, { "docid": "7ee3cae52fcf70ee4813d979905163ac", "score": "0.5403107", "text": "func (rt *routingTableImpl) addNewBucket() node.RemoteNodeData {\n\n\t// the last bucket\n\tlastBucket := rt.buckets[len(rt.buckets)-1]\n\n\t// the new bucket\n\tnewBucket := lastBucket.Split(len(rt.buckets)-1, rt.local)\n\n\trt.buckets = append(rt.buckets, newBucket)\n\n\tif newBucket.Len() > rt.bucketsize {\n\t\t// new bucket is overflowing - we need to split it again\n\t\treturn rt.addNewBucket()\n\t}\n\n\tif lastBucket.Len() > rt.bucketsize {\n\t\t// If all elements were on left side of the split and last bucket is full\n\t\t// We remove the least active node in the last bucket and return it\n\t\treturn lastBucket.PopBack()\n\t}\n\n\t// no node was removed\n\treturn nil\n}", "title": "" }, { "docid": "e3f237a4f50e85bd1868a4e1f61d4132", "score": "0.5387722", "text": "func (r *RateLimiter) Take() {\n\t<-r.bucket.C\n}", "title": "" }, { "docid": "6864853f6ef679b27f51981ba39e81e3", "score": "0.5379254", "text": "func (m *Minio) Put(fileName string, content io.Reader, fileSize int64, metadata rsync.FileMetadata) (written int64, err error) {\n\tdata := make(map[string]string)\n\tdata[\"mtime\"] = strconv.Itoa(int(metadata.Mtime))\n\tdata[\"mode\"] = strconv.Itoa(int(metadata.Mode))\n\n\tfpath := filepath.Join(m.prefix, fileName)\n\tfsize := fileSize\n\tfname := fpath\n\t/* EXPERIMENTAL */\n\t// Folder\n\tif metadata.Mode.IsDIR() {\n\t\tfname = filepath.Join(m.prefix, fileName, S3_DIR)\n\t\tfsize = 0\n\t\t// FIXME: How to handle a file named \".rsync-os.dir\"?\n\t}\n\n\tif metadata.Mode.IsLNK() {\n\t\t// Additional data of symbol link\n\t}\n\n\twritten, err = m.client.PutObject(m.bucketName, fname, content, fsize, minio.PutObjectOptions{UserMetadata: data})\n\n\tvalue, err := proto.Marshal(&cache.FInfo{\n\t\tSize: fileSize,\n\t\tMtime: metadata.Mtime,\n\t\tMode: int32(metadata.Mode),\t// FIXME: convert uint32 to int32\n\t})\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\tif err := m.bucket.Put([]byte(fpath), value); err != nil {\n\t\treturn -1, err\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "2fe121b846e9a22d9052adb06148f23e", "score": "0.53607523", "text": "func (b *bucketLocker) read(bucket string) func() {\n\tload, _ := b.m.LoadOrStore(bucket, &sync.RWMutex{})\n\trw := load.(*sync.RWMutex)\n\trw.RLock()\n\treturn rw.RUnlock\n}", "title": "" }, { "docid": "9fa76108c76656c2bb495034bd376c97", "score": "0.5360284", "text": "func (tc *textileClient) setBucket(slug string, b Bucket) Bucket {\n\ttc.bucketsLock.Lock()\n\n\tdefer tc.bucketsLock.Unlock()\n\tif b := tc.buckets[slug]; b != nil {\n\t\treturn b\n\t}\n\ttc.buckets[slug] = b.(*bucket)\n\n\treturn tc.buckets[slug]\n}", "title": "" }, { "docid": "fa6499cc5a7c94804141289986020d41", "score": "0.5354733", "text": "func (ap *accountsPersister) openFingerprintBucket(path string) (modules.File, error) {\n\t// open file in append-only mode and create if it does not exist yet\n\treturn ap.openFileWithMetadata(path, os.O_RDWR|os.O_CREATE|os.O_APPEND, fingerprintsMetadata)\n}", "title": "" }, { "docid": "e0685769aa39e26e5edc5d6b27772746", "score": "0.5342703", "text": "func (c *AliOSSClient) AppendObjectForBuff(bucket string, key string, position int, data []byte) (int, string, error) {\n\turi := fmt.Sprintf(\"/%s/%s?append&position=%d\", bucket, key, position)\n\tquery := make(map[string]string)\n\theader := make(map[string]string)\n\n\ts := &oss_agent{\n\t\tAccessKey: c.AccessKey,\n\t\tAccessKeySecret: c.AccessKeySecret,\n\t\tVerb: \"POST\",\n\t\tUrl: fmt.Sprintf(\"http://%s.%s/%s\", bucket, c.EndPoint, key),\n\t\tCanonicalizedHeaders: header,\n\t\tCanonicalizedUri: uri,\n\t\tCanonicalizedQuery: query,\n\t\tContent: bytes.NewReader(data),\n\t\tContentType: \"application/octet-stream\",\n\t\tDebug: c.Debug,\n\t\tlogger: c.logger,\n\t}\n\n\te := &AliOssError{}\n\tresp, _, err := s.send_request(true)\n\tif err != nil {\n\t\treturn 0, \"\", err\n\t} else {\n\t\tdefer resp.Body.Close()\n\t}\n\tif resp.StatusCode/100 == 2 {\n\t\tposition, _ := strconv.Atoi(resp.Header.Get(\"x-oss-next-append-position\"))\n\t\treturn position, resp.Header.Get(\"x-oss-hash-crc64ecma\"), nil\n\t} else {\n\t\txml_result, _ := ioutil.ReadAll(resp.Body)\n\t\txml.Unmarshal(xml_result, e)\n\t\treturn 0, \"\", e\n\t}\n}", "title": "" }, { "docid": "3751de8a124abeb99ac2fcf955f02bf4", "score": "0.53309256", "text": "func (db *DB) Put(key int, value string, timeStamp int64) {\n db.lock.Lock()\n defer db.lock.Unlock()\n\n db.data[key % len(db.data)] = value\n db.puts++\n delay := GetTimeMs() - timeStamp\n db.delays += delay\n db.distribution[int(delay) % 10] += 1\n if db.server.snapshot > 0 &&\n int64(db.puts- db.lastSnapshotPuts) * int64(db.server.txnSize) >= db.server.snapshot {\n log.Println(\"snapshot\")\n go db.server.raftServer.TakeSnapshot()\n db.lastSnapshotPuts = db.puts\n }\n}", "title": "" }, { "docid": "9a5dea07ae40ea00d7303a84b0b6b99e", "score": "0.5329332", "text": "func (c *Cache) Add(bucketName []byte, key []byte, value []byte) bool {\n\tif !c.enable {\n\t\treturn false\n\t}\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\n\t// Check for existing bucket\n\tvar bucket map[string]*list.Element\n\tvar ok bool\n\n\tbucketKey := string(bucketName)\n\n\tif bucket, ok = c.items[bucketKey]; !ok {\n\t\tbucket = make(map[string]*list.Element)\n\t\tc.logger.Printf(\"cache new bucket %s\", bucketKey)\n\t}\n\n\t// copy bytes\n\tdst := make([]byte, len(value))\n\tcopy(dst, value)\n\n\t// Check for existing item\n\tif ent, ok := bucket[string(key)]; ok {\n\t\tc.evictList.MoveToFront(ent)\n\t\tent.Value.(*entry).value = dst\n\t\treturn false\n\t}\n\n\t// Add new item\n\tent := &entry{bucketName, key, dst}\n\tentry := c.evictList.PushFront(ent)\n\tbucket[string(key)] = entry\n\n\tc.items[bucketKey] = bucket\n\tc.size += uint64(ent.Size())\n\tc.count++\n\tatomic.AddInt64(&c.stats.AddCount, 1)\n\n\t// Verify size not exceeded\n\tevict := c.maxSize > 0 && c.size > c.maxSize\n\tif evict {\n\t\tc.removeOldest()\n\t}\n\treturn evict\n}", "title": "" }, { "docid": "2fbf80c61dde33883384e18ad1abf6ce", "score": "0.5315917", "text": "func (s *blockDiskStore) put(id kbfsblock.ID, context kbfsblock.Context,\n\tbuf []byte, serverHalf kbfscrypto.BlockCryptKeyServerHalf,\n\ttag string) (putData bool, err error) {\n\terr = validateBlockPut(id, context, buf)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\t// Check the data and retrieve the server half, if they exist.\n\t_, existingServerHalf, err := s.getDataWithContext(id, context)\n\tvar exists bool\n\tswitch err.(type) {\n\tcase blockNonExistentError:\n\t\texists = false\n\tcase nil:\n\t\texists = true\n\tdefault:\n\t\treturn false, err\n\t}\n\n\tif exists {\n\t\t// If the entry already exists, everything should be\n\t\t// the same, except for possibly additional\n\t\t// references.\n\n\t\t// We checked that both buf and the existing data hash\n\t\t// to id, so no need to check that they're both equal.\n\n\t\tif existingServerHalf != serverHalf {\n\t\t\treturn false, errors.Errorf(\n\t\t\t\t\"key server half mismatch: expected %s, got %s\",\n\t\t\t\texistingServerHalf, serverHalf)\n\t\t}\n\t} else {\n\t\terr = s.makeDir(id)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\n\t\terr = ioutil.WriteFile(s.dataPath(id), buf, 0600)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\n\t\t// TODO: Add integrity-checking for key server half?\n\n\t\tdata, err := serverHalf.MarshalBinary()\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\t\terr = ioutil.WriteFile(s.keyServerHalfPath(id), data, 0600)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\t}\n\n\terr = s.addRefs(id, []kbfsblock.Context{context}, liveBlockRef, tag)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\treturn !exists, nil\n}", "title": "" }, { "docid": "dc344f5a1329af304b594222fe4604c8", "score": "0.53116536", "text": "func (b *Bucket) spill() error {\n\t// Spill all child buckets first.\n\tfor name, child := range b.buckets {\n\t\t// If the child bucket is small enough and it has no child buckets then\n\t\t// write it inline into the parent bucket's page. Otherwise spill it\n\t\t// like a normal bucket and make the parent value a pointer to the page.\n\t\tvar value []byte\n\t\tif child.inlineable() {\n\t\t\tchild.free()\n\t\t\tvalue = child.write()\n\t\t} else {\n\t\t\tif err := child.spill(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t// Update the child bucket header in this bucket.\n\t\t\tvalue = make([]byte, unsafe.Sizeof(bucket{}))\n\t\t\tvar bucket = (*bucket)(unsafe.Pointer(&value[0]))\n\t\t\t*bucket = *child.bucket\n\t\t}\n\n\t\t// Skip writing the bucket if there are no materialized nodes.\n\t\tif child.rootNode == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Update parent node.\n\t\tvar c = b.Cursor()\n\t\tk, _, flags := c.seek([]byte(name))\n\t\tif !bytes.Equal([]byte(name), k) {\n\t\t\tpanic(fmt.Sprintf(\"misplaced bucket header: %x -> %x\", []byte(name), k))\n\t\t}\n\t\tif flags&bucketLeafFlag == 0 {\n\t\t\tpanic(fmt.Sprintf(\"unexpected bucket header flag: %x\", flags))\n\t\t}\n\t\tc.node().put([]byte(name), []byte(name), value, 0, bucketLeafFlag)\n\t}\n\n\t// Ignore if there's not a materialized root node.\n\tif b.rootNode == nil {\n\t\treturn nil\n\t}\n\n\t// Spill nodes.\n\tif err := b.rootNode.spill(); err != nil {\n\t\treturn err\n\t}\n\tb.rootNode = b.rootNode.root()\n\n\t// Update the root node for this bucket.\n\tif b.rootNode.pgid >= b.tx.meta.pgid {\n\t\tpanic(fmt.Sprintf(\"pgid (%d) above high water mark (%d)\", b.rootNode.pgid, b.tx.meta.pgid))\n\t}\n\tb.root = b.rootNode.pgid\n\n\treturn nil\n}", "title": "" }, { "docid": "546cb032e1a3a1379185f41b6346819a", "score": "0.53110695", "text": "func (b *Bin) PutItem(item *Item, p Pivot) (fit bool) {\n\t// Check weight first\n\t// A checagem de peso está nos pull requests do github bp3d.\n\tvar totalWeight float64\n\tfor _, ib := range b.Items {\n\t\ttotalWeight += ib.Weight\n\t}\n\tif totalWeight+item.Weight > b.MaxWeight {\n\t\tfit = false\n\t\treturn\n\t}\n\n\titem.Position = p\n\tfor i := 0; i < 6; i++ {\n\t\titem.RotationType = RotationType(i)\n\t\td := item.GetDimension()\n\t\tif b.GetWidth() < p[0]+d[0] || b.GetHeight() < p[1]+d[1] || b.GetDepth() < p[2]+d[2] {\n\t\t\tcontinue\n\t\t}\n\t\tfit = true\n\n\t\tfor _, ib := range b.Items {\n\t\t\tif ib.Intersect(item) {\n\t\t\t\tfit = false\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif fit {\n\t\t\tb.Items = append(b.Items, item)\n\t\t}\n\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "c75558fa62de8f942c135a2513473812", "score": "0.53021467", "text": "func (self *NetStore) Put(entry *Chunk) {\n\tself.localStore.Put(entry)\n\n\t// handle deliveries\n\tif entry.Req != nil {\n\t\tlog.Trace(fmt.Sprintf(\"NetStore.Put: localStore.Put %v hit existing request...delivering\", entry.Key.Log()))\n\t\t// closing C signals to other routines (local requests)\n\t\t// that the chunk is has been retrieved\n\t\tclose(entry.Req.C)\n\t\t// deliver the chunk to requesters upstream\n\t\tgo self.cloud.Deliver(entry)\n\t} else {\n\t\tlog.Trace(fmt.Sprintf(\"NetStore.Put: localStore.Put %v stored locally\", entry.Key.Log()))\n\t\t// handle propagating store requests\n\t\t// go self.cloud.Store(entry)\n\t\tgo self.cloud.Store(entry)\n\t}\n}", "title": "" }, { "docid": "1569f9f3a3a2b9447f947df731f576ca", "score": "0.5296888", "text": "func TestBucketForEach(t *testing.T) {\n\twithOpenDB(func(db *DB, path string) {\n\t\tdb.Update(func(tx *Tx) error {\n\t\t\ttx.CreateBucket(\"widgets\")\n\t\t\ttx.Bucket(\"widgets\").Put([]byte(\"foo\"), []byte(\"0000\"))\n\t\t\ttx.Bucket(\"widgets\").Put([]byte(\"baz\"), []byte(\"0001\"))\n\t\t\ttx.Bucket(\"widgets\").Put([]byte(\"bar\"), []byte(\"0002\"))\n\n\t\t\tvar index int\n\t\t\terr := tx.Bucket(\"widgets\").ForEach(func(k, v []byte) error {\n\t\t\t\tswitch index {\n\t\t\t\tcase 0:\n\t\t\t\t\tassert.Equal(t, k, []byte(\"bar\"))\n\t\t\t\t\tassert.Equal(t, v, []byte(\"0002\"))\n\t\t\t\tcase 1:\n\t\t\t\t\tassert.Equal(t, k, []byte(\"baz\"))\n\t\t\t\t\tassert.Equal(t, v, []byte(\"0001\"))\n\t\t\t\tcase 2:\n\t\t\t\t\tassert.Equal(t, k, []byte(\"foo\"))\n\t\t\t\t\tassert.Equal(t, v, []byte(\"0000\"))\n\t\t\t\t}\n\t\t\t\tindex++\n\t\t\t\treturn nil\n\t\t\t})\n\t\t\tassert.NoError(t, err)\n\t\t\tassert.Equal(t, index, 3)\n\t\t\treturn nil\n\t\t})\n\t})\n}", "title": "" }, { "docid": "045acfb3cbfb7828943f3a878110d654", "score": "0.52857554", "text": "func (self *submitStore) Put(req *protocol.Request, id protocol.ID) error {\n\tself.mu.Lock()\n\tdefer self.mu.Unlock()\n\tif _, ok := self.idx[id]; ok {\n\t\treturn fmt.Errorf(\"entry already exists\")\n\t}\n\n\tself.cursor++\n\tself.cursor %= self.capacity\n\tif self.entries[self.cursor] != nil {\n\t\tdelete(self.idx, self.entries[self.cursor].Id)\n\t}\n\tself.entries[self.cursor] = req\n\tself.idx[id] = req\n\treturn nil\n}", "title": "" }, { "docid": "1849b85abf8486ed743cb50fd4cacc76", "score": "0.5282202", "text": "func (cache *SiaCacheLayer) dbInsertBucket(bucket string) *SiaServiceError {\n\tcache.debugmsg(\"SiaCacheLayer.dbInsertBucket\")\n\n\tcache.dbLockDB()\n\tdefer cache.dbUnlockDB()\n\n\t// Start a transaction\n tx, err := cache.Db.Begin(true)\n if err != nil {\n return siaErrorDatabaseInsertError\n }\n defer tx.Rollback()\n\n\tb, err := tx.CreateBucket([]byte(cache.dbBucketName(bucket)))\n\tif err != nil {\n\t\treturn siaErrorDatabaseInsertError\n\t}\n\n\terr = b.Put([]byte(\"name\"), []byte(bucket))\n\tif err != nil {\n\t\treturn siaErrorDatabaseInsertError\n\t}\n\n\terr = b.Put([]byte(\"created\"), []byte(strconv.FormatInt(time.Now().Unix(), 10)))\n\tif err != nil {\n\t\treturn siaErrorDatabaseInsertError\n\t}\n\n\tpolicyInfo := policy.BucketAccessPolicy{}\n\tres, _ := json.Marshal(&policyInfo)\n\tif err != nil {\n\t\tcache.debugmsg(err.Error())\n\t\treturn siaErrorDatabaseInsertError\n\t}\n\terr = b.Put([]byte(\"policy\"), []byte(string(res)))\n\tif err != nil {\n\t\treturn siaErrorDatabaseInsertError\n\t}\n\n // Commit the transaction\n if err = tx.Commit(); err != nil {\n return siaErrorDatabaseInsertError\n }\n\n return nil\n}", "title": "" }, { "docid": "adcf7b5f5a03781b6a5e4c5dbea02150", "score": "0.52812964", "text": "func (b TestS3Bucket) create(svc *s3.S3) error {\n\tlogging.Logger.Infof(\"Bucket: %s - creating\", b.name)\n\n\t_, err := svc.CreateBucket(&s3.CreateBucketInput{\n\t\tBucket: aws.String(b.name),\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Add default tag for testing\n\tvar awsTagSet []*s3.Tag\n\n\tfor _, tagSet := range b.tags {\n\t\tawsTagSet = append(awsTagSet, &s3.Tag{Key: aws.String(tagSet[\"Key\"]), Value: aws.String(tagSet[\"Value\"])})\n\t}\n\n\tif len(awsTagSet) > 0 {\n\t\tinput := &s3.PutBucketTaggingInput{\n\t\t\tBucket: aws.String(b.name),\n\t\t\tTagging: &s3.Tagging{\n\t\t\t\tTagSet: awsTagSet,\n\t\t\t},\n\t\t}\n\t\t_, err = svc.PutBucketTagging(input)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif b.isVersioned {\n\t\tinput := &s3.PutBucketVersioningInput{\n\t\t\tBucket: aws.String(b.name),\n\t\t\tVersioningConfiguration: &s3.VersioningConfiguration{\n\t\t\t\tStatus: aws.String(\"Enabled\"),\n\t\t\t},\n\t\t}\n\t\t_, err = svc.PutBucketVersioning(input)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\terr = svc.WaitUntilBucketExists(\n\t\t&s3.HeadBucketInput{\n\t\t\tBucket: aws.String(b.name),\n\t\t},\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9467e6cf248b25d261c4b4348e5c4340", "score": "0.5275345", "text": "func (b *Bucket) Put(key []byte, value []byte) error {\n\tif b.tx.db == nil {\n\t\treturn ErrTxClosed\n\t} else if !b.Writable() {\n\t\treturn ErrTxNotWritable\n\t} else if len(key) == 0 {\n\t\treturn ErrKeyRequired\n\t} else if len(key) > MaxKeySize {\n\t\treturn ErrKeyTooLarge\n\t} else if int64(len(value)) > MaxValueSize {\n\t\treturn ErrValueTooLarge\n\t}\n\n\t// Move cursor to correct position.\n\tc := b.Cursor()\n\tk, _, flags := c.seek(key)\n\n\t// Return an error if there is an existing key with a bucket value.\n\tif bytes.Equal(key, k) && (flags&bucketLeafFlag) != 0 {\n\t\treturn ErrIncompatibleValue\n\t}\n\n\t// Insert into node.\n\tkey = cloneBytes(key)\n\tc.node().put(key, key, value, 0, 0)\n\n\treturn nil\n}", "title": "" }, { "docid": "59caa031ca9fc9fec3e42b525733f913", "score": "0.52720296", "text": "func (bs *BoltStore) Put(bucket string, key string, value string) error {\n\treturn bs.boltDB.Update(func(tx *bolt.Tx) error {\n\t\tb := tx.Bucket([]byte(bucket))\n\n\t\tif b == nil {\n\t\t\treturn fmt.Errorf(\"%s is not a bucket\", bucket)\n\t\t}\n\n\t\treturn b.Put([]byte(key), []byte(value))\n\t})\n}", "title": "" }, { "docid": "e51b2d376c52cce6d2fbabb3fc75395e", "score": "0.52718353", "text": "func (ctrl *Controller) bucketWorker() {\n\tkeyObj, quit := ctrl.bucketQueue.Get()\n\tif quit {\n\t\treturn\n\t}\n\tdefer ctrl.bucketQueue.Done(keyObj)\n\tctx := correlation.WithCorrelationContext(context.Background(), \"px-object-controller/pkg/controller\")\n\n\tif err := ctrl.processBucket(ctx, keyObj.(string)); err != nil {\n\t\t// Rather than wait for a full resync, re-add the key to the\n\t\t// queue to be processed.\n\t\tctrl.bucketQueue.AddRateLimited(keyObj)\n\t\tlogrus.WithContext(ctx).Infof(\"Failed to sync bucket %q, will retry again: %v\", keyObj.(string), err)\n\t} else {\n\t\t// Finally, if no error occurs we Forget this item so it does not\n\t\t// get queued again until another change happens.\n\t\tctrl.bucketQueue.Forget(keyObj)\n\t}\n}", "title": "" }, { "docid": "3746509e33b5525b2606f03b3f587d07", "score": "0.5252247", "text": "func (s *Store) Put(path, url string) error {\n\treturn s.db.Update(func(tx *bolt.Tx) error {\n\t\tb, err := tx.CreateBucketIfNotExists(backetName)\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\treturn err\n\t\t}\n\n\t\treturn b.Put([]byte(path), []byte(url))\n\t})\n}", "title": "" }, { "docid": "70cf2711df841349a74e2c324e6c82d2", "score": "0.52513397", "text": "func (m *Manager) lockBucket(addr uintptr) *bucket {\n\tb := &m.buckets[bucketIndexForAddr(addr)]\n\tb.mu.Lock()\n\treturn b\n}", "title": "" }, { "docid": "3f1d7c4079a9fbd5cebec65391632e59", "score": "0.52501", "text": "func ensure_bucket(project *C.Project, bucket_name *C.char) C.BucketResult { //nolint:golint\n\tif project == nil {\n\t\treturn C.BucketResult{\n\t\t\terror: mallocError(ErrNull.New(\"project\")),\n\t\t}\n\t}\n\tif bucket_name == nil {\n\t\treturn C.BucketResult{\n\t\t\terror: mallocError(ErrNull.New(\"bucket_name\")),\n\t\t}\n\t}\n\n\tproj, ok := universe.Get(project._handle).(*Project)\n\tif !ok {\n\t\treturn C.BucketResult{\n\t\t\terror: mallocError(ErrInvalidHandle.New(\"project\")),\n\t\t}\n\t}\n\n\tbucket, err := proj.EnsureBucket(proj.scope.ctx, C.GoString(bucket_name))\n\n\treturn C.BucketResult{\n\t\terror: mallocError(err),\n\t\tbucket: mallocBucket(bucket),\n\t}\n}", "title": "" }, { "docid": "08bbe99329c4a378ac8881d2c70b935e", "score": "0.52460957", "text": "func newBucket(tokens uint64, interval time.Duration) *bucket {\n\tb := &bucket{\n\t\tstartTime: fasttime.Now(),\n\t\tmaxTokens: tokens,\n\t\tavailableTokens: tokens,\n\t\tinterval: interval,\n\t\tfillRate: float64(interval) / float64(tokens),\n\t}\n\treturn b\n}", "title": "" }, { "docid": "cb3fc43f5b87980b93541e2afe79a2a1", "score": "0.5240442", "text": "func (lru *Queue) Add(bucket string, fkey string, size int64, inmem bool, data []byte) (*Node, error) {\n\t//add node to LRU queue and evict if already full\n\t_, queued := lru.Retrieve(fkey, bucket)\n\tif queued == true {\n\t\treturn nil, nil\n\t}\n\tnew := &Node{dirty: false, Bucket: bucket, Fkey: fkey,\n\t\tLocalFname: lru.args.LocalPath + bucket + fkey,\n\t\tsize: size, ModTime: time.Now(), prev: nil, next: nil}\n\tif inmem == true {\n\t\tnew.Inmem = true\n\t\tnewMem := &MemFile{offset: 0, dirOffset: 0, Content: data}\n\t\tnew.MemFile = newMem\n\t} else {\n\t\tnew.Inmem = false\n\t}\n\n\t//pop objects off the end of the queue if we need room\n\tfor {\n\t\tif ((lru.currMem+size > lru.memCap) && inmem == true) || (lru.currDisk+size) > lru.diskCap {\n\t\t\tlog.Debugln(\"Check evict state: \", fkey, inmem, lru.currMem+size, lru.memCap, lru.currDisk+size, lru.diskCap, lru.args.MaxMemFileSize)\n\t\t\tlru.evict()\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\n\t}\n\tif lru.args.Cluster == true {\n\t\tgo hashes.Ghash.AddToGH(fkey, bucket, lru.args.LocalName, true)\n\t}\n\n\tif lru.currFiles == 0 {\n\t\tlru.head = new\n\t\tlru.tail = new\n\t\tlru.currFiles++\n\t\tlru.currMem += size\n\t\tlru.currDisk += size\n\t\treturn new, nil\n\t}\n\n\tlru.moveToHead(new)\n\tlru.currFiles++\n\tlru.currMem += size\n\tlru.currDisk += size\n\treturn new, nil\n}", "title": "" }, { "docid": "70980c758f9906cc7350a8dc78c6e181", "score": "0.5240302", "text": "func (self *Blockchain)storeCurrentBlockAndCreateNew(block *Block,\n savingPoint int,trChanges *map[string]string){\n self.access_data.Lock()\n defer self.access_data.Unlock()\n if block!=nil{\n self.Head = block\n self.applyTransactionsChanges(trChanges)\n }else{\n self.Head = self.Current\n self.applyTransactionsChanges(&self.currentTrChanges)\n }\n self.Current = BuildBlock(self.id,self.Head)\n self.currentTrChanges = make(map[string]string)\n b := self.Head\n for i:=0;i<savingPoint+1;i++{\n if b==nil{break}\n var filename string = fmt.Sprintf(\"%v/block%v.json\",self.folder,b.LenSubChain)\n data := b.Serialize()\n err := ioutil.WriteFile(filename,data, 0644)\n if err!=nil{fmt.Println(err)}\n b = b.Previous\n }\n self.checkJobsToClose()\n self.discloseDeclaredSolutionsAndIntegrateShared()\n}", "title": "" }, { "docid": "9f983b761d2e61b88a96e30b9f4e6a79", "score": "0.5238594", "text": "func (b *Buffer) Get(name string) (*Bucket, error) {\n\tb.Lock()\n\tdefer b.Unlock()\n\n\tif bucket, ok := b.buckets[name]; ok {\n\t\treturn bucket, nil\n\t}\n\n\tbucket := NewBucket(BucketOptions{\n\t\tPath: filepath.Join(b.root, name),\n\t\tFs: b.fs,\n\t})\n\tif err := bucket.Open(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tb.buckets[name] = bucket\n\treturn bucket, nil\n}", "title": "" }, { "docid": "bcc5f687e8e1a7cb9be416a88552f672", "score": "0.52374774", "text": "func newBucket() *bucket {\n\tbucket := &bucket{}\n\tbucket.list = list.New()\n\treturn bucket\n}", "title": "" }, { "docid": "b91e8b37bfda6378be3e3a0eb83eb670", "score": "0.52345586", "text": "func emptyBucket(db *bolt.DB, bucket []byte) error {\n\terr := db.Update(func(tx *bolt.Tx) error {\n\t\tpbkt := tx.Bucket(poolBkt)\n\t\tif pbkt == nil {\n\t\t\tdesc := fmt.Sprintf(\"bucket %s not found\", string(poolBkt))\n\t\t\treturn MakeError(ErrBucketNotFound, desc, nil)\n\t\t}\n\t\tb := pbkt.Bucket(bucket)\n\t\ttoDelete := [][]byte{}\n\t\tc := b.Cursor()\n\t\tfor k, _ := c.First(); k != nil; k, _ = c.Next() {\n\t\t\ttoDelete = append(toDelete, k)\n\t\t}\n\t\tfor _, k := range toDelete {\n\t\t\terr := b.Delete(k)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n\treturn err\n}", "title": "" }, { "docid": "8cac0d4662a4384e6895383c2db200e7", "score": "0.52279603", "text": "func (service *GCSService) WriteObject(ctx context.Context, params GCSObjectParams, r io.Reader) (int64, error) {\n\tobj := service.Client.Bucket(params.Bucket).Object(params.ID)\n\n\tw := obj.NewWriter(ctx)\n\n\tn, err := io.Copy(w, r)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\terr = w.Close()\n\tif err != nil {\n\t\tif gErr, ok := err.(*googleapi.Error); ok && gErr.Code == 404 {\n\t\t\treturn 0, fmt.Errorf(\"gcsstore: the bucket %s could not be found while trying to write an object\", params.Bucket)\n\t\t}\n\t\treturn 0, err\n\t}\n\n\treturn n, err\n}", "title": "" }, { "docid": "23704ad01fb4f72cd11e804776cc99e1", "score": "0.52267385", "text": "func (qs *QuotaStorage) Put(ctx context.Context, names []string, tokens int64) error {\n\tif tokens < 0 {\n\t\treturn fmt.Errorf(\"invalid number of tokens: %v\", tokens)\n\t}\n\treturn qs.mod(ctx, names, tokens)\n}", "title": "" }, { "docid": "a219e8a14021a5a79fe8d8cad567ce53", "score": "0.5218067", "text": "func getBucketInfo(svc *s3.S3, bucket *s3.Bucket, excludeAfter time.Time, regionClients map[string]*s3.S3, bucketCh chan<- *S3Bucket, configObj config.Config) {\n\tvar bucketData S3Bucket\n\tbucketData.Name = aws.StringValue(bucket.Name)\n\tbucketData.CreationDate = aws.TimeValue(bucket.CreationDate)\n\n\tbucketRegion, err := getS3BucketRegion(svc, bucketData.Name)\n\tif err != nil {\n\t\tbucketData.Error = err\n\t\tbucketCh <- &bucketData\n\t\treturn\n\t}\n\tbucketData.Region = bucketRegion\n\n\t// Check if the bucket is in target region\n\tmatchedRegion := false\n\tfor region := range regionClients {\n\t\tif region == bucketData.Region {\n\t\t\tmatchedRegion = true\n\t\t\tbreak\n\t\t}\n\t}\n\tif !matchedRegion {\n\t\tbucketData.InvalidReason = \"Not in target region\"\n\t\tbucketCh <- &bucketData\n\t\treturn\n\t}\n\n\t// Check if the bucket has valid tags\n\tbucketTags, err := getS3BucketTags(regionClients[bucketData.Region], bucketData.Name)\n\tif err != nil {\n\t\tbucketData.Error = err\n\t\tbucketCh <- &bucketData\n\t\treturn\n\t}\n\tbucketData.Tags = bucketTags\n\tif !hasValidTags(bucketData.Tags) {\n\t\tbucketData.InvalidReason = \"Matched tag filter\"\n\t\tbucketCh <- &bucketData\n\t\treturn\n\t}\n\n\t// Check if the bucket is older than the required time\n\tif !excludeAfter.After(bucketData.CreationDate) {\n\t\tbucketData.InvalidReason = \"Matched CreationDate filter\"\n\t\tbucketCh <- &bucketData\n\t\treturn\n\t}\n\n\t// Check if the bucket matches config file rules\n\tif !shouldIncludeBucket(bucketData.Name, configObj.S3.IncludeRule.NamesRE, configObj.S3.ExcludeRule.NamesRE) {\n\t\tbucketData.InvalidReason = \"Filtered by config file rules\"\n\t\tbucketCh <- &bucketData\n\t\treturn\n\t}\n\n\tbucketData.IsValid = true\n\tbucketCh <- &bucketData\n}", "title": "" }, { "docid": "d0203e99f855fbdbc77b465ff6ee3429", "score": "0.5217448", "text": "func (hm *Hmap) Put(key Key, val interface{}) {\n\thm.ensureBuckets()\nrestart:\n\tb, top := hm.hash(key)\n\tinserti := -1\n\tvar insertb *bucket = nil\n\tbuck := &hm.buckets[b]\n\tfor {\n\t\tfor i := 0; i < bucketsize; i++ {\n\t\t\tif buck.tophash[i] != top {\n\t\t\t\tif buck.tophash[i] == 0 && inserti == -1 {\n\t\t\t\t\tinserti = i\n\t\t\t\t\tinsertb = buck\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// found one where tophash matches\n\t\t\tif key.Equals(buck.keys[i]) {\n\t\t\t\t// update existing entry\n\t\t\t\tbuck.vals[i] = val\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif buck.overflow == nil {\n\t\t\tbreak\n\t\t}\n\t\tbuck = buck.overflow\n\t}\n\t// not found, add it\n\tif hm.size > bucketsize && hm.size > load*len(hm.buckets) {\n\t\thm.grow()\n\t\tgoto restart\n\t}\n\tif inserti == -1 {\n\t\t// buckets are full, make a new one\n\t\tinsertb = &bucket{}\n\t\tinserti = 0\n\t\tbuck.overflow = insertb\n\t}\n\tinsertb.tophash[inserti] = top\n\tinsertb.keys[inserti] = key\n\tinsertb.vals[inserti] = val\n\thm.version++\n\thm.size++\n}", "title": "" }, { "docid": "f822aa71c2ab7c3304b49c16822fba3d", "score": "0.52117354", "text": "func (fss3 *FSS3) putObject(key string, r io.Reader, size int64, opts *putObjectOptions) (*uploadInfo, error) {\n\tif opts == nil {\n\t\topts = &putObjectOptions{}\n\t}\n\tui, err := fss3.client.PutObject(context.Background(), fss3.cfg.BucketName, key, r, size, *opts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &ui, nil\n}", "title": "" }, { "docid": "0a12466d2da9732049a604f1ebacd24e", "score": "0.5208877", "text": "func (b *bucket) insert(k string) {\n\tif !b.search(k) {\n\t\tnewNode := &bucketNode{key: k}\n\t\tnewNode.next = b.head\n\t\tb.head = newNode\n\t} else {\n\t\tfmt.Println(k, \"already exists\")\n\t}\n}", "title": "" }, { "docid": "17a3a18af54332532bddd137acba94fc", "score": "0.52048683", "text": "func (m MapBucketStorage) Close(ctx context.Context) {}", "title": "" }, { "docid": "9a398a8226c85c3aa0dae8767549cce7", "score": "0.51971984", "text": "func persistBucketVersion(bv *bucketVersion) error {\n\tbv.mu.Lock()\n\n\tm := new(bytes.Buffer)\n\tenc := gob.NewEncoder(m)\n\tenc.Encode(bv.itemVersions) // just the map\n\n\tblob := BlobArg{\n\t\tKey: bv.bucketKey,\n\t\tSubKey: \".versions\",\n\t\tMessage: \"\",\n\t\tPayload: m.Bytes(),\n\t}\n\n\terr := putData(&blob)\n\n\tbv.mu.Unlock()\n\treturn err\n}", "title": "" }, { "docid": "c8d1d11ca4f14ede47f6b213db261ec1", "score": "0.51971084", "text": "func (b *bucket) insert(k string) {\n\tif !b.search(k) {\n\t\tnewNode := &bucketNode{key: k}\n\t\tnewNode.next = b.head\n\t\tb.head = newNode\n\t} else {\n\t\tfmt.Printf(\"%s already exist\", k)\n\t}\n}", "title": "" }, { "docid": "8585d7e92260c166cc03c596815469f4", "score": "0.5197045", "text": "func (o *boltdbStorage) purge(tx *bolt.Tx) error {\n\tmeta := tx.Bucket([]byte(\"meta\"))\n\tkey := meta.Get([]byte(\"last_snapshot\"))\n\n\tif key == nil {\n\t\treturn nil\n\t}\n\n\tbucket := tx.Bucket([]byte(\"data\"))\n\tif bucket == nil {\n\t\treturn errors.Errorf(\"the bucket of server_id: %d is missing\", o.curServerID)\n\t}\n\n\tc := bucket.Cursor()\n\tk, _ := c.Seek(key)\n\tif k == nil {\n\t\treturn errors.Errorf(\"the k-v of key: %d is missing\", key)\n\t}\n\n\tfor {\n\t\tk, v := c.Prev()\n\t\tif k == nil {\n\t\t\tbreak\n\t\t}\n\n\t\tvar value value\n\t\terr := json.Unmarshal(v, &value)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif time.Now().Sub(value.Time) >= 7*24*time.Hour {\n\t\t\tbucket.Delete(k)\n\t\t}\n\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "82ed95dd259a6f74b4d9fa8245ec2c04", "score": "0.5195871", "text": "func (b *bucket) Put(key, value []byte) error {\n\t// Ensure transaction state is valid.\n\tif err := b.tx.checkClosed(); err != nil {\n\t\treturn err\n\t}\n\n\t// Ensure the transaction is writable.\n\tif !b.tx.writable {\n\t\tstr := \"setting a key requires a writable database transaction\"\n\t\treturn makeDbErr(store.ErrTxNotWritable, str, nil)\n\t}\n\n\t// Ensure a key was provided.\n\tif len(key) == 0 {\n\t\tstr := \"put requires a key\"\n\t\treturn makeDbErr(store.ErrKeyRequired, str, nil)\n\t}\n\n\tif err := b.bucket.Put(key, value); err != nil {\n\t\treturn convertErr(\"put\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c7d4de50263f6c216bdaf58e1caab322", "score": "0.519379", "text": "func TestBucketGetNonExistent(t *testing.T) {\n\twithOpenDB(func(db *DB, path string) {\n\t\tdb.Update(func(tx *Tx) error {\n\t\t\ttx.CreateBucket(\"widgets\")\n\t\t\tvalue := tx.Bucket(\"widgets\").Get([]byte(\"foo\"))\n\t\t\tassert.Nil(t, value)\n\t\t\treturn nil\n\t\t})\n\t})\n}", "title": "" }, { "docid": "50e07725273b432cf06de9a3f73cf289", "score": "0.5186615", "text": "func putObject(msg *common.ChangeEvent, thing *Thing) (*s3.PutObjectOutput, error) {\n\tvar b []byte\n\tvar err error\n\tvar s3res *s3.PutObjectOutput\n\n\t// Serialize the Thing to JSON\n\tif b, err = json.Marshal(thing); err != nil {\n\t\treturn nil, fmt.Errorf(\"Unable to marshal JSON: %w\", err)\n\t}\n\n\t// Upload to S3\n\ts3res, err = s3client.PutObject(\n\t\t&s3.PutObjectInput{\n\t\t\tBody: aws.ReadSeekCloser(bytes.NewReader(b)),\n\t\t\tBucket: aws.String(s3Bucket),\n\t\t\tKey: aws.String(fmt.Sprintf(\"%s/%s/%s-%d.json\", s3Folder, msg.ServerName, msg.Title, msg.Revision)),\n\t\t\tContentType: aws.String(\"application/json\"),\n\t\t\tMetadata: map[string]*string{\n\t\t\t\t\"title\": aws.String(msg.Title),\n\t\t\t\t\"server_name\": aws.String(msg.ServerName),\n\t\t\t\t\"revision\": aws.String(fmt.Sprintf(\"%d\", msg.Revision)),\n\t\t\t},\n\t\t})\n\tif err != nil {\n\t\tif aerr, ok := err.(awserr.Error); ok {\n\t\t\treturn nil, fmt.Errorf(\"%s: %s (%+v)\", aerr.Code(), aerr.Message(), aerr.OrigErr())\n\t\t}\n\n\t\treturn nil, err\n\t}\n\n\treturn s3res, nil\n}", "title": "" }, { "docid": "c3bbe0ece0e0846ef602ffa5e54e6802", "score": "0.51842123", "text": "func (trail *Trail) getCachedBucket(ctxt context.Context, imageBucketTime Time) *ebiten.Image {\n\tdefer trace.StartRegion(ctxt, \"getCachedBucket\").End()\n\ttrail.mu.Lock()\n\tdefer trail.mu.Unlock()\n\n\tif !trail.cachedReady[imageBucketTime] {\n\t\tif trail.cached[imageBucketTime] == nil {\n\t\t\ttrail.cached[imageBucketTime] = trail.allocateImage()\n\t\t}\n\t\timage := trail.cached[imageBucketTime]\n\n\t\tvar spans []*Span\n\t\timageBucketEndTime := imageBucketTime.Add(trail.bucketSize)\n\t\timage.DrawImage(trail.getCachedGrid(ctxt), &ebiten.DrawImageOptions{})\n\n\t\tfor _, bucket := range trail.buckets {\n\t\t\tif err := bucket.Validate(); err != nil {\n\t\t\t\tlog.Fatalf(\"Invalid bucket: %v\", err)\n\t\t\t}\n\t\t\tif !bucket.InRange(imageBucketTime, imageBucketEndTime) {\n\t\t\t\t//log.Printf(\"Bucket %v not in range\", bucket.start)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tfor _, span := range bucket.spans {\n\t\t\t\tif !span.InRange(imageBucketTime, imageBucketEndTime) {\n\t\t\t\t\t//log.Printf(\"Span %v not in range\", span.start)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tspans = append(spans, span)\n\t\t\t}\n\t\t}\n\n\t\tsubSpans := Subindex(spans)\n\t\tfor _, subSpan := range subSpans {\n\t\t\ttrail.drawSubSpan(image, imageBucketTime, subSpan)\n\t\t}\n\t\t//log.Printf(\n\t\t//\t\"New image slice %dx%d with %d spans for bucket at %v\",\n\t\t//\timage.Bounds().Max.X, image.Bounds().Max.Y, spanCount, imageBucketTime,\n\t\t//)\n\n\t\ttrail.cachedReady[imageBucketTime] = true\n\t}\n\treturn trail.cached[imageBucketTime]\n}", "title": "" }, { "docid": "134028d2f8aa06792e1dc5aac7d7a228", "score": "0.5184068", "text": "func (fc *FileCache) Put(key string, value interface{}, timeout time.Duration) error {\n\tgob.Register(value)\n\n\titem := FileCacheItem{Content: value}\n\titem.Expire = time.Now().Add(timeout)\n\n\tdata, err := gobEncode(item)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn ioutil.WriteFile(fc.getMD5Hash(key)+fc.Ext, data, 0644)\n}", "title": "" }, { "docid": "7f7007880d59b4848c16b05e3af57277", "score": "0.5183888", "text": "func TestBucketForEachShortCircuit(t *testing.T) {\n\twithOpenDB(func(db *DB, path string) {\n\t\tdb.Update(func(tx *Tx) error {\n\t\t\ttx.CreateBucket(\"widgets\")\n\t\t\ttx.Bucket(\"widgets\").Put([]byte(\"bar\"), []byte(\"0000\"))\n\t\t\ttx.Bucket(\"widgets\").Put([]byte(\"baz\"), []byte(\"0000\"))\n\t\t\ttx.Bucket(\"widgets\").Put([]byte(\"foo\"), []byte(\"0000\"))\n\n\t\t\tvar index int\n\t\t\terr := tx.Bucket(\"widgets\").ForEach(func(k, v []byte) error {\n\t\t\t\tindex++\n\t\t\t\tif bytes.Equal(k, []byte(\"baz\")) {\n\t\t\t\t\treturn errors.New(\"marker\")\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t})\n\t\t\tassert.Equal(t, errors.New(\"marker\"), err)\n\t\t\tassert.Equal(t, 2, index)\n\t\t\treturn nil\n\t\t})\n\t})\n}", "title": "" }, { "docid": "a00614a9b918d3711694fe89b1f60c27", "score": "0.51830703", "text": "func (b *basicBatcher) Put(item interface{}) error {\n\tb.lock.Lock()\n\tif b.disposed {\n\t\tb.lock.Unlock()\n\t\treturn ErrDisposed\n\t}\n\n\tb.items = append(b.items, item)\n\tif b.calculateBytes != nil {\n\t\tb.availableBytes += b.calculateBytes(item)\n\t}\n\tif b.ready() {\n\t\t// To guarantee ordering this MUST be in the lock, otherwise multiple\n\t\t// flush calls could be blocked at the same time, in which case\n\t\t// there's no guarantee each batch is placed into the channel in\n\t\t// the proper order\n\t\tb.flush()\n\t}\n\n\tb.lock.Unlock()\n\treturn nil\n}", "title": "" }, { "docid": "078d5beecf7ec10fa70b37f39edb13ed", "score": "0.5180715", "text": "func (b Bucket) Put(k [][]byte, v []byte) error {\n\tbb, err := b.CreateBucketIfNotExists(k[:len(k)-1])\n\tif err != nil {\n\t\treturn errorsp.WithStacksAndMessage(err, \"CreateBucketIfNotExists %q failed\", string(bytes.Join(k[:len(k)-1], []byte(\" \"))))\n\t}\n\treturn errorsp.WithStacks(bb.Bucket.Put(k[len(k)-1], v))\n}", "title": "" }, { "docid": "b5a2248b2c41af5ec4e4fa7af533fb6b", "score": "0.51735216", "text": "func (bs *blobStore) put(p []byte) (digest.Digest, error) {\n\tdgst, err := digest.FromBytes(p)\n\tif err != nil {\n\t\tctxu.GetLogger(bs.ctx).Errorf(\"error digesting content: %v, %s\", err, string(p))\n\t\treturn \"\", err\n\t}\n\n\tbp, err := bs.path(dgst)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// If the content already exists, just return the digest.\n\tif exists, err := bs.exists(dgst); err != nil {\n\t\treturn \"\", err\n\t} else if exists {\n\t\treturn dgst, nil\n\t}\n\n\treturn dgst, bs.driver.PutContent(bp, p)\n}", "title": "" }, { "docid": "4d440006609d450d8410a3ec3f52a797", "score": "0.5172932", "text": "func (awsp *awsProvider) putObj(ctx context.Context, r io.Reader, lom *cluster.LOM) (version string, err error, errCode int) {\n\tvar (\n\t\tuploadOutput *s3manager.UploadOutput\n\t\tcksumType, cksumValue = lom.Cksum().Get()\n\t\tmd = make(map[string]*string)\n\t)\n\tmd[awsChecksumType] = aws.String(cksumType)\n\tmd[awsChecksumVal] = aws.String(cksumValue)\n\n\tuploader := s3manager.NewUploader(createSession(ctx))\n\tuploadOutput, err = uploader.Upload(&s3manager.UploadInput{\n\t\tBucket: aws.String(lom.BckName()),\n\t\tKey: aws.String(lom.Objname),\n\t\tBody: r,\n\t\tMetadata: md,\n\t})\n\tif err != nil {\n\t\terr, errCode = awsErrorToAISError(err, lom.Bck(), lom.T.Snode().Name())\n\t\treturn\n\t}\n\tif glog.FastV(4, glog.SmoduleAIS) {\n\t\tif uploadOutput.VersionID != nil {\n\t\t\tversion = *uploadOutput.VersionID\n\t\t\tglog.Infof(\"[put_object] %s, version %s\", lom, version)\n\t\t} else {\n\t\t\tglog.Infof(\"[put_object] %s\", lom)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "11030eb531ce99f9dde51c0ae713f2dd", "score": "0.51728356", "text": "func (b *bucket) unlock() {\n\tb.mu.Unlock()\n}", "title": "" }, { "docid": "72e780b13dae16f547837a609d609481", "score": "0.51711774", "text": "func (b *bucket) Push(p interface{}) {\n\tb.activePeers = append(b.activePeers, p.(peer.Peer))\n\tb.positions[p.(peer.Peer).ID().String()] = len(b.activePeers) - 1\n}", "title": "" }, { "docid": "0343db1e384925ea50e451ef6a971a55", "score": "0.5166851", "text": "func (gcpp *gcpProvider) PutObj(ctx context.Context, r io.Reader, lom *cluster.LOM) (version string, err error, errCode int) {\n\tgcpClient, gctx, _, err := createClient(ctx)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvar (\n\t\tcloudBck = lom.Bck().CloudBck()\n\t\tmd = make(cmn.SimpleKVs, 2)\n\t\tgcpObj = gcpClient.Bucket(cloudBck.Name).Object(lom.ObjName)\n\t\twc = gcpObj.NewWriter(gctx)\n\t)\n\n\tmd[gcpChecksumType], md[gcpChecksumVal] = lom.Cksum().Get()\n\n\twc.Metadata = md\n\tbuf, slab := gcpp.t.GetMMSA().Alloc()\n\twritten, err := io.CopyBuffer(wc, r, buf)\n\tslab.Free(buf)\n\tif err != nil {\n\t\treturn\n\t}\n\tif err = wc.Close(); err != nil {\n\t\terr = fmt.Errorf(\"failed to close, err: %v\", err)\n\t\treturn\n\t}\n\tattr, err := gcpObj.Attrs(gctx)\n\tif err != nil {\n\t\terr, errCode = handleObjectError(err, lom, gcpClient.Bucket(cloudBck.Name), gctx)\n\t\treturn\n\t}\n\tversion = fmt.Sprintf(\"%d\", attr.Generation)\n\tif glog.FastV(4, glog.SmoduleAIS) {\n\t\tglog.Infof(\"[put_object] %s, size %d, version %s\", lom, written, version)\n\t}\n\treturn\n}", "title": "" }, { "docid": "ad17ee8839f47d2dd8ab7dff0e24c12f", "score": "0.51660496", "text": "func updateBucket(stub shim.ChaincodeStubInterface, bucketCriteria string, CustomerId string, data string) (error) {\n\tmyLogger.Debugf(\"Updating Bucket \", bucketCriteria, \"for CustomerId \", CustomerId)\n\tvar columns []shim.Column\n\tcol1 := shim.Column{Value: &shim.Column_String_{String_: dummyValue}}\n\tcolumns = append(columns, col1)\n\n\trows, err := ciav.GetAllRows(stub, bucketCriteria, columns)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed retriving data\", err)\n\t}\n\tvar idBuffer bytes.Buffer\n\tfor i := range rows {\n\t\tmyLogger.Debugf(\"Bucket rows : \")\n\t\tmyLogger.Debugf(\"Hash - \", rows[i].Columns[1].GetString_())\n\t\tmyLogger.Debugf(\"Customer Ids - \", rows[i].Columns[2].GetString_())\n\t\tif strings.Contains(rows[i].Columns[2].GetString_(), CustomerId) {\n\t\t\tids := strings.Split(rows[i].Columns[2].GetString_(), \"|\")\n\t\t\tfor _,val := range ids{\n\t\t\t\tif val != CustomerId {\n\t\t\t\t\tif idBuffer.String() != \"\"{\n\t\t\t\t\t\tidBuffer.WriteString(\"|\")\n\t\t\t\t\t}\n\t\t\t\t\tidBuffer.WriteString(val)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tok, err := stub.ReplaceRow(bucketCriteria, shim.Row{\n\t\t\t\tColumns: []*shim.Column{\n\t\t\t\t\t&shim.Column{Value: &shim.Column_String_{String_: dummyValue}},\n\t\t\t\t\t&shim.Column{Value: &shim.Column_String_{String_: rows[i].Columns[1].GetString_()}},\n\t\t\t\t\t&shim.Column{Value: &shim.Column_String_{String_: idBuffer.String()}},\n\t\t\t\t},\n\t\t\t})\n\t\t\tif !ok && err == nil {\n\t\t\t\tmyLogger.Debugf(\"Error in updating bucket\",err)\n\t\t\t\treturn errors.New(\"Error in updating bucket\")\n\t\t\t}\n\t\t}\n\t}\n\tmyLogger.Debugf(\"Updating(Add) bucket for CustomerId : \", CustomerId)\n\tAddToBkt(stub, bucketCriteria, CustomerId, data)\n\treturn nil\n}", "title": "" }, { "docid": "7cb848c378229b8ed120eda885c236ee", "score": "0.51651365", "text": "func (p *filePartition) put(rows Rows) error {\n\treturn errorReadyOnlyPartition\n}", "title": "" } ]
56bfe3b3036c2b2e5775576219a0ae9b
Connect to RPC server. The parameters are the same as that of net.Dial(), and depend on where the preactrpc server is listening.
[ { "docid": "7c2b546360a78b42caf6d6ce5daf71c2", "score": "0.5913322", "text": "func Connect(network string, address string) {\n connNet = network\n connAddr = address\n shouldConnect = true\n}", "title": "" } ]
[ { "docid": "63590a6fc2fce359bb451c5e8ff174cc", "score": "0.7319835", "text": "func (e *Executor) Connect() (err error) {\n\taddr := e.Host + \":\" + strconv.Itoa(e.Port)\n\n\te.client, err = rpc.Dial(\"tcp\", addr)\n\n\treturn err\n}", "title": "" }, { "docid": "400df49859b763dc5337b5c281478088", "score": "0.71394527", "text": "func (c *Client) Connect(address string, port uint16) error {\n\tclient, err := rpc.DialHTTP(tcpProtocol,\n\t\tfmt.Sprintf(\"%s:%d\", address, port))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tc.connect = client\n\treturn nil\n}", "title": "" }, { "docid": "c2cf875cb2d05dc4d0bd48d823268745", "score": "0.69749945", "text": "func RPCConnect(serverAddress string) (*RPCClient, error) {\n\tclient := NewClient()\n\terr := client.Connect(serverAddress)\n\treturn client, err\n}", "title": "" }, { "docid": "4fda68d4557f956c6e691fbc1f083888", "score": "0.66612524", "text": "func Connect(addr string, timeout_duration time.Duration) (*ServerConn, error) {\n if strings.Contains(addr, \":\") == false {\n\t\taddr = addr + \":21\"\n }\n netconn, err := net.DialTimeout(\"tcp\", addr, timeout_duration)\n if err != nil {\n\t\treturn nil, err\n }\n\n\tconn := textproto.NewConn(netconn)\n\n a := strings.SplitN(addr, \":\", 2)\n c := &ServerConn{conn: conn, host: a[0], realhost: \"\", timeout_reads: false, timeout_duration: timeout_duration}\n\n _, _, err = c.conn.ReadCodeLine(StatusReady)\n if err != nil {\n\t\tc.Quit()\n\t\treturn nil, err\n }\n\n return c, nil\n}", "title": "" }, { "docid": "7de881c7a99c210a4d8df41d7385aec8", "score": "0.6636661", "text": "func (r *RPC) Connect(address string, _ *struct{}) (err error) {\n\t_, err = r.ns.Connect(address)\n\treturn\n}", "title": "" }, { "docid": "b69e7b0692ef300c6efbfc8506e1e49c", "score": "0.6593493", "text": "func (s *TCPServer) Connect(ctx context.Context) *jsonrpc2.Conn {\n\tnetConn, err := net.Dial(\"tcp\", s.Addr)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"servertest: failed to connect to test instance: %v\", err))\n\t}\n\ts.cls.add(func() {\n\t\tnetConn.Close()\n\t})\n\tconn := jsonrpc2.NewConn(jsonrpc2.NewHeaderStream(netConn, netConn))\n\tgo conn.Run(ctx)\n\treturn conn\n}", "title": "" }, { "docid": "5f6bb435f02c4d7d2898fce92ee28202", "score": "0.6575022", "text": "func Connect() *grpc.ClientConn {\n\n\t// connection to server port\n\tconn, err := grpc.Dial(\"localhost\"+viper.GetString(\"client.port\"), grpc.WithInsecure())\n\tif err != nil {\n\t\tlog.Panic().AnErr(\"unable to connect to server from client : \", err)\n\t}\n\n\t// connection is returned\n\treturn conn\n\n}", "title": "" }, { "docid": "d0130327a8cb6729368d81cbcf2acd6e", "score": "0.6521502", "text": "func Connect(addr string) (*ServerConn, os.Error) {\n\tconn, err := textproto.Dial(\"tcp\", addr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ta := strings.SplitN(addr, \":\", 2)\n\tc := &ServerConn{conn, a[0]}\n\n\t_, _, err = c.conn.ReadCodeLine(StatusReady)\n\tif err != nil {\n\t\tc.Quit()\n\t\treturn nil, err\n\t}\n\n\treturn c, nil\n}", "title": "" }, { "docid": "e1e01e74cd6b9ee07e0e2d2dc206b6f8", "score": "0.64999336", "text": "func Connect(addr string, os ...*ConnectOptions) (_ *Server, err error) {\n\ts := &Server{\n\t\taddr: addr,\n\t}\n\tif len(os) > 0 {\n\t\to := os[0]\n\t\ts.dial = o.Dial\n\t\ts.rconPassword = o.RCONPassword\n\t\ts.timeout = o.Timeout\n\t}\n\tif s.dial == nil {\n\t\ts.dial = (&net.Dialer{\n\t\t\tTimeout: 1 * time.Second,\n\t\t}).Dial\n\t}\n\tif s.rconPassword == \"\" {\n\t\treturn s, nil\n\t}\n\tif err := s.initRCON(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn s, nil\n}", "title": "" }, { "docid": "4741e5a3be1645f26a72a388b0c87a86", "score": "0.6357225", "text": "func (r *RPC) Connect(arg *proto.ConnArg, reply *proto.ConnReply) (err error) {\n\tif arg == nil {\n\t\terr = ErrConnectArgs\n\t\tlog.Error(\"connect arg is nil\")\n\t\treturn\n\t}\n\n\tvar loginReq LoginReq\n\tif err = json.Unmarshal(arg.Data, &loginReq); err != nil {\n\t\tlog.Error(\"connect parse LoginReq failed.data=%s, serverId:%d, err:%v\", string(arg.Data), arg.Server, err)\n\t\treturn\n\t}\n\n\tlog.Info(\"receive serverId:%d, LoginReq:%v\", arg.Server, loginReq)\n\n\tvar key string\n\tvar resp *LoginResp\n\tif key, resp, err = r.doLogin(arg.Server, &loginReq); err != nil {\n\t\tlog.Error(\"connect doLogin failed. server:%d, LoginReq:%v, err:%v\", arg.Server, loginReq, err)\n\t\treturn\n\t}\n\n\treply.Ok = true\n\treply.Key = key\n\treply.Heartbeat = Conf.ClientHeartbeat\n\n\tif resp != nil {\n\t\tif reply.Data, err = json.Marshal(resp); err != nil {\n\t\t\tlog.Error(\"Login marshal data failed.resp:%v, err:%v\", resp, err)\n\t\t\treturn\n\t\t}\n\t}\n\n\tlog.Info(\"connect doLogin ok.LoginReq:%v, reply:%v\", loginReq, reply)\n\n\treturn\n}", "title": "" }, { "docid": "d789d0a10f255012283e116886338254", "score": "0.6356993", "text": "func Connect(raddr string) (net.Conn, error) {\n\t// Remote address.\n\tconn, err := net.DialTimeout(\"tcp\", raddr, connectTimeout*time.Second)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn conn, nil\n}", "title": "" }, { "docid": "1456128110017639c8a9c3f4c0bc1481", "score": "0.634979", "text": "func (rd *RPCDUT) Connect(ctx context.Context) error {\n\tif err := rd.RPCClose(ctx); err != nil {\n\t\ttesting.ContextLog(ctx, \"Failed to close rpc connection before connect: \", err)\n\t}\n\tif err := rd.d.Connect(ctx); err != nil {\n\t\treturn err\n\t}\n\tif err := rd.RPCDial(ctx); err != nil {\n\t\ttesting.ContextLog(ctx, \"Failed to dial rpc connection after connect: \", err)\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "de83e0bb20b9740daa8f880afa9b781d", "score": "0.6288447", "text": "func Connect(ip string, port string) (openolt.OpenoltClient, *grpc.ClientConn) {\n\tserver := fmt.Sprintf(\"%s:%s\", ip, port)\n\tconn, err := grpc.Dial(server, grpc.WithInsecure())\n\n\tif err != nil {\n\t\tlog.Fatalf(\"did not connect: %v\", err)\n\t\treturn nil, conn\n\t}\n\treturn openolt.NewOpenoltClient(conn), conn\n}", "title": "" }, { "docid": "99061f29e8049e061aa6962c2446fac8", "score": "0.6272432", "text": "func (c *Client) connect() (err error) {\n\tutils.L.Debugf(\"ethClient connect to %s\", c.config.RpcAddr)\n\tc.rpcClient, err = rpc.Dial(c.config.RpcAddr)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "72574c6b18352ef7a3ac5e74e26d854b", "score": "0.62568516", "text": "func (c *Client) Connect(ctx context.Context, address string) error {\n\tdialer := &net.Dialer{\n\t\tTimeout: 30 * time.Second,\n\t\tKeepAlive: 30 * time.Second,\n\t\tDualStack: true,\n\t}\n\n\tconn, err := dialer.DialContext(ctx, \"tcp\", address)\n\tif err != nil {\n\t\treturn err\n\t}\n\tc.conn = conn\n\tc.w = bufio.NewWriter(conn)\n\n\tc.res = make(chan response)\n\tgo c.readLoop()\n\n\terr = c.login()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = c.getInfo()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f0c855111eb76391687915c737d3d9a9", "score": "0.6234065", "text": "func execConnect(_ int, p *gop.Context) {\n\targs := p.GetArgs(2)\n\tret := syscall.Connect(args[0].(int), args[1].(syscall.Sockaddr))\n\tp.Ret(2, ret)\n}", "title": "" }, { "docid": "46bacb1f839280e91f024005ce06120b", "score": "0.6205491", "text": "func (c *client) Connect(host string, pwd string, code string) error {\n\tconn, err := net.DialTimeout(\"tcp\", host, time.Second)\n\tif err != nil {\n\t\treturn err\n\t}\n\tc.conn = conn\n\tc.pwd = pwd\n\tc.code = code\n\tgo c.listen()\n\treturn nil\n}", "title": "" }, { "docid": "287691c2c139a8e7ea307b215bf00c5a", "score": "0.6165583", "text": "func Dial(username, host, context, service string, auth Auth) (rc *Conn,\n\terr error) {\n\n\t// hadoop has great protocols.\n\trc = &Conn{\n\t\tClientId: []byte(NewUUID()),\n\t\tCallId: -3,\n\t\tContext: context,\n\t\tUsername: username,\n\t\tHostname: strings.Split(host, \":\")[0],\n\t\tService: service,\n\t}\n\n\tif rc.Conn, err = net.Dial(\"tcp\", host); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := rc.writeHeader(auth); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := rc.authenticate(auth); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// conn write the RPC header and the context\n\tipc := rc.newIpcConnectionContextProto()\n\theader := rc.newRpcRequestHeaderProto()\n\tbuf, err := rpcPackage(header, ipc)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif _, err := rc.Write(buf); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn rc, err\n}", "title": "" }, { "docid": "4f665590e48a92ccfeb31513d5fa88fa", "score": "0.61635196", "text": "func Connect(hostPort, pwd string) (c net.Conn, err error) {\n\tc, err = net.DialTimeout(\"tcp\", hostPort, 2*time.Second)\n\tif err != nil {\n\t\treturn nil, errors.New(\"tor: down\")\n\t}\n\tif err := send(c, fmt.Sprintf(`authenticate \"%s\"`, pwd)); err != nil {\n\t\treturn nil, err\n\t}\n\tline, err := read(c)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif line != \"250 OK\" {\n\t\treturn nil, errors.New(\"tor: auth failed\")\n\t}\n\treturn c, nil\n}", "title": "" }, { "docid": "ba8fa94edcf6a6673988429907275ab2", "score": "0.6120674", "text": "func (cm *rpcConnManager) Connect(addr string, permanent bool) error {\n\treplyChan := make(chan error)\n\tcm.server.query <- connectNodeMsg{\n\t\taddr: addr,\n\t\tpermanent: permanent,\n\t\treply: replyChan,\n\t}\n\treturn <-replyChan\n}", "title": "" }, { "docid": "f05c44d9230388130ead8f3337dd43fc", "score": "0.61093557", "text": "func Connect(addr string) (*Client, error) {\n\tcc, err := grpc.Dial(addr, grpc.WithInsecure())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn NewClient(cc), nil\n}", "title": "" }, { "docid": "0abdd9d372f33dc70f7c9af38c95ca1d", "score": "0.6093712", "text": "func (h *Harness) connectRPCClient() error {\n\tvar client *rpc.Client\n\tvar err error\n\n\trpcConf := h.node.config.rpcConnConfig()\n\tfor i := 0; i < h.maxConnRetries; i++ {\n\t\tif client, err = rpc.New(&rpcConf, h.handlers); err != nil {\n\t\t\ttime.Sleep(time.Duration(math.Log(float64(i+3))) * 50 * time.Millisecond)\n\t\t\tcontinue\n\t\t}\n\t\tbreak\n\t}\n\n\tif client == nil {\n\t\treturn fmt.Errorf(\"connection timed out: %v\", err)\n\t}\n\n\terr = client.NotifyBlocks()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\th.Node = client\n\treturn nil\n}", "title": "" }, { "docid": "543284bd7d6ed32ac589a38875546f88", "score": "0.606608", "text": "func Connect(connect string) (*PgConnection, error) {\n\tci, err := parseConnectString(connect)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tconn, err := net.Dial(\"tcp\", fmt.Sprintf(\"%s:%d\", ci.host, ci.port))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tc := &PgConnection{\n\t\tconn: conn,\n\t\thost: ci.host,\n\t\tport: ci.port,\n\t}\n\n\tsuccess := false\n\tdefer func() {\n\t\tif !success {\n\t\t\tconn.Close()\n\t\t}\n\t}()\n\n\tif ci.ssl {\n\t\terr = c.startSSL(ci)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Send \"Startup\" message\n\terr = c.sendStartup(ci)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Loop here later for challenge-response\n\terr = c.authenticationLoop(ci)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Finish up with receiving parameters and all that\n\terr = c.finishConnect(ci)\n\tif err == nil {\n\t\tsuccess = true\n\t}\n\treturn c, err\n}", "title": "" }, { "docid": "ecdbe9118c95a4880f60baa2f9b6fa2b", "score": "0.60628724", "text": "func (*KVServer) Connect(args *shared.Args, reply *shared.Response) error {\n\tserverId, err := strconv.Atoi(args.Value)\n\tif err != nil {\n\t\tlog.Println(\"server error:\", err)\n\t}\n\tshared.Outputln(\"server: connected to server\")\n\n\tconn, _ := shared.Dial(shared.BasePort + serverId)\n\tserverCalls[serverId] = &rpcClient{client: rpc.NewClient(conn)}\n\treturn nil\n}", "title": "" }, { "docid": "801b44e64ab2ace0c43e036a742d06fe", "score": "0.60457903", "text": "func Connect(url string, options Options) (*Conn, error) {\n\tconn, err := net.Dial(\"tcp\", url)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlog.Println(\"Connected to socket\")\n\n\tnc := &Conn{\n\t\tconn: conn,\n\t\toptions: options,\n\t\tcommandToSocket: make(chan c.NCCCommand),\n\t\tsubs: make(map[string]([]MsgHandler)),\n\t\tparsers: map[string]Parser{\n\t\t\t\"FullCallsList\": nil,\n\t\t\t\"FullBuddyList\": &FullBuddyListParser{},\n\n\t\t\t\"Response:RegisterPeer\": &RegisterPeerRsParser{},\n\t\t\t\"Response:Register\": nil,\n\t\t\t\"Response:Subscribe\": nil,\n\n\t\t\t\"Request:Echo\": nil,\n\t\t\t\"Request:Authenticate\": &AuthenificateRqParser{},\n\t\t},\n\t}\n\n\tnc.Subscribe(\"Event\", func(*Msg) {})\n\tnc.Subscribe(\"Command\", func(*Msg) {})\n\n\tnc.Subscribe(\"DialPlan\", func(*Msg) {})\n\tnc.Subscribe(\"DialplanUploadResult\", func(*Msg) {})\n\n\tnc.Subscribe(\"Success\", func(*Msg) {})\n\tnc.Subscribe(\"Failure\", func(*Msg) {})\n\n\tnc.Subscribe(\"FullCallsList\", func(*Msg) {})\n\tnc.Subscribe(\"FullBuddyList\", func(*Msg) {})\n\tnc.Subscribe(\"ShortBuddyList\", func(*Msg) {})\n\tnc.Subscribe(\"BuddyListDiff\", func(*Msg) {})\n\n\tnc.Subscribe(\"LicenseUsage\", func(*Msg) {})\n\tnc.Subscribe(\"Progress\", func(*Msg) {})\n\n\tnc.Subscribe(\"Response:RegisterPeer\", func(msg *Msg) { HandleRegisterPeer(nc, msg) })\n\tnc.Subscribe(\"Response:Register\", func(*Msg) {\n\t\tif nc.options.RegisteredCB != nil {\n\t\t\tnc.options.RegisteredCB(nc)\n\t\t}\n\t})\n\tnc.Subscribe(\"Response:Subscribe\", func(*Msg) {})\n\tnc.Subscribe(\"Request:Authenticate\", func(msg *Msg) { HandleAuthenificate(nc, msg) })\n\tnc.Subscribe(\"Request:Echo\", func(*Msg) {\n\t\tnc.Publish(c.CreateEchoResponse())\n\t})\n\n\tstartSender(nc)\n\tstartReceiver(nc)\n\n\treturn nc, nil\n}", "title": "" }, { "docid": "43303acd97cf1b591b3c858f57030db8", "score": "0.6011275", "text": "func (i *Invokee) Connect(address string) (e error) {\n\tif i.Conn, e = grpc.Dial(address, grpc.WithInsecure()); e != nil {\n\t\treturn\n\t}\n\n\ti.Client = invokeeV1API.NewInvokeeClient(i.Conn)\n\n\treturn\n}", "title": "" }, { "docid": "1fc25da8bec132e15dc58f826f0d97aa", "score": "0.59928465", "text": "func (c *Client) Connect() (err error) {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\n\tif c.conn != nil {\n\t\treturn errors.New(\"connect already called\")\n\t}\n\n\tc.conn, err = grpc.Dial(c.target, c.dialOpts...)\n\n\treturn err\n}", "title": "" }, { "docid": "c2ad91fcf6020c3736a242164915d4ac", "score": "0.597809", "text": "func (self *Node) Connect(url string, handler ResponseHandler) error {\n\n\tself.url = url\n\n\tvar err error\n\n\tif self.sock, err = pair.NewSocket(); err != nil {\n\t\treturn err\n\t}\n\tself.sock.AddTransport(ipc.NewTransport())\n\tself.sock.AddTransport(tcp.NewTransport())\n\tif err = self.sock.Dial(url); err != nil {\n\t\treturn err\n\t}\n\n\tgo self.processData(handler)\n\n\treturn nil\n}", "title": "" }, { "docid": "50b891297d3bddc8c890c506294e9bbf", "score": "0.5966222", "text": "func (c *Connection) Connect() error {\n\topts := []grpc.DialOption{\n\t\tgrpc.WithInsecure(),\n\t\tgrpc.WithBlock(),\n\t\tgrpc.WithBackoffMaxDelay(ConnectInterval),\n\t}\n\tad := fmt.Sprintf(\"%s:%d\", c.addr, c.port)\n\n\tctx, cancel := context.WithCancel(context.Background())\n\tc.cancelFunc = cancel\n\n\tvar conn *grpc.ClientConn\n\tvar err error\n\tif conn, err = grpc.DialContext(ctx, ad, opts...); err != nil {\n\t\treturn err\n\t}\n\n\tc.conn = conn\n\n\treturn nil\n}", "title": "" }, { "docid": "805eed323ad891441122bdef515d8d48", "score": "0.5960184", "text": "func connect() (*grpc.ClientConn, error) {\n\t// Set up a connection to the server.\n\t// TODO: Secure me through TLS.\n\tconn, err := grpc.Dial(\n\t\tsysFsGrpcSockAddr,\n\t\tgrpc.WithInsecure(),\n\t\tgrpc.WithDialer(unixConnect),\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn conn, nil\n}", "title": "" }, { "docid": "fc92c20cf71a5768185b08bf745ace7a", "score": "0.59295547", "text": "func (s *RFC) Connect(g gorfc.ConnectionParameter) error {\n\tif g.Passwd == \"\" {\n\t\tg.Passwd = os.Getenv(\"SAPRFC_PASS\")\n\t}\n\tc, err := gorfc.ConnectionFromParams(g)\n\ts.conn = c\n\treturn err\n}", "title": "" }, { "docid": "e78f9e031b69cdf2af9dcec36733bf52", "score": "0.5909502", "text": "func (qb *QBot) Connect() {\n\tvar err error\n\tfmt.Printf(\"Connecting to %s ... \\n\", qb.Config.Server)\n\tqb.conn, err = net.Dial(\"tcp\", qb.Config.Server+\":\"+qb.Config.Port)\n\tif err != nil {\n\t\t// Print out the cause of the connection failure\n\t\t// Can be many issues (no connection, lack of route to host, etc)\n\t\tlog.Fatal(\"Network error: %s\", err)\n\t\treturn\n\t}\n\tfmt.Printf(\"Connected to %s\\n\", qb.Config.Server)\n\tqb.StartTime = time.Now()\n}", "title": "" }, { "docid": "db3f00d2d393a354a6dd84f70e7614ed", "score": "0.58647853", "text": "func Connect(\n\tonReceiveMarketDataCallback OnReceiveDataCallback,\n\tonErrorCallback OnErrorCallback,\n) (socket SocketInterface, err error) {\n\tsocket = &Socket{\n\t\tOnReceiveMarketDataCallback: onReceiveMarketDataCallback,\n\t\tOnErrorCallback: onErrorCallback,\n\t}\n\n\terr = socket.Init()\n\n\treturn\n}", "title": "" }, { "docid": "32c9f6111d1ad53315133e0aa87e8890", "score": "0.58593595", "text": "func (c *Client) Connect(addr string) error {\n\treturn c.conn.Connect(addr)\n}", "title": "" }, { "docid": "f34b7930c9a8aa77b12874be13a4bda6", "score": "0.5834797", "text": "func (c *Client) Connect() error {\n\tif c.mode == local {\n\t\t// Nothing to do here yet..\n\t\treturn nil\n\t}\n\n\t// Attempt connection to remote host.\n\tclient, err := client.NewClient(c.url)\n\tif err != nil {\n\t\treturn err\n\t}\n\tc.rc = client\n\n\t// Success.\n\treturn nil\n}", "title": "" }, { "docid": "2ceb7383a96eb03f38efb88219642433", "score": "0.5833553", "text": "func (r *Runner) ConnectAndRun(joinCode, addr, port string) error {\n\tlog.LogInfo(fmt.Sprintf(\"starting runner of kind %s\", r.runner.Kind))\n\n\tconn, err := grpc.Dial(fmt.Sprintf(\"%s:%s\", addr, port), grpc.WithInsecure())\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to Dial\")\n\t}\n\n\tr.client = service.NewRunnerServiceClient(conn)\n\n\tchallenge, err := r.auth(joinCode)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to auth\")\n\t}\n\n\tif err := r.run(challenge); err != nil {\n\t\treturn errors.Wrap(err, \"failed to run\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0926ec9c03b31606dd15aaa5d89b4ac4", "score": "0.58125114", "text": "func Dial(addr string) (*Client, error) {}", "title": "" }, { "docid": "eddc34b5d9ba14b4f0b080ebb615ba1d", "score": "0.58104", "text": "func lconnect(proto, host, port string) error {\n\tc, err := net.Dial(proto, host+\":\"+port)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer c.Close()\n\n\treturn nil\n}", "title": "" }, { "docid": "7614d1f516944bc5ea8bba325c987f66", "score": "0.5809986", "text": "func Connect(ctx context.Context, a *tpb.Connection) (gpb.GNMIClient, func(), error) {\n\tif a.Address == \"\" {\n\t\treturn nil, nil, errors.New(\"an address must be specified\")\n\t}\n\n\tctx, cancel := context.WithTimeout(ctx, time.Duration(a.Timeout)*time.Second)\n\tdefer cancel()\n\n\tconn, err := grpc.DialContext(ctx, a.Address, grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{\n\t\tInsecureSkipVerify: true,\n\t})))\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"cannot dial target %s, %v\", a.Address, err)\n\t}\n\n\treturn gpb.NewGNMIClient(conn), func() { conn.Close() }, nil\n}", "title": "" }, { "docid": "78a517bbd18fb41637835bb025db472c", "score": "0.57905895", "text": "func (a *Client) Connect() (int, error) {\n\tconn, err := grpc.Dial(a.address, a.opts...)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tctx := metadata.AppendToOutgoingContext(context.Background(),\n\t\theader.AgentID, a.agentID,\n\t\theader.AgentIdentifiers, a.agentIdentifiers)\n\tif a.serviceAccountTokenPath != \"\" {\n\t\tif ctx, err = a.initializeAuthContext(ctx); err != nil {\n\t\t\terr := conn.Close()\n\t\t\tif err != nil {\n\t\t\t\tklog.ErrorS(err, \"failed to close connection\")\n\t\t\t}\n\t\t\treturn 0, err\n\t\t}\n\t}\n\tstream, err := agent.NewAgentServiceClient(conn).Connect(ctx)\n\tif err != nil {\n\t\tconn.Close() /* #nosec G104 */\n\t\treturn 0, err\n\t}\n\tserverID, err := serverID(stream)\n\tif err != nil {\n\t\tconn.Close() /* #nosec G104 */\n\t\treturn 0, err\n\t}\n\tserverCount, err := serverCount(stream)\n\tif err != nil {\n\t\tconn.Close() /* #nosec G104 */\n\t\treturn 0, err\n\t}\n\ta.conn = conn\n\ta.stream = stream\n\ta.serverID = serverID\n\tklog.V(2).InfoS(\"Connect to\", \"server\", serverID)\n\treturn serverCount, nil\n}", "title": "" }, { "docid": "469998083e35c60f82e13d2c0f9c6def", "score": "0.5788695", "text": "func (rt *Runtime) ConnectModule(module string) (*grpc.ClientConn, error) {\n\tadr, err := rt.LoadModule(module)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn grpc.Dial(adr, grpc.WithInsecure())\n}", "title": "" }, { "docid": "f75eb12b2da1aef2742a60678a164df2", "score": "0.57869387", "text": "func Connect(c *Config) error {\n\tvar active = false\n\tvar remotePort = -1\n\tvar svcUser = \"\"\n\n\tvar timeout = 120 * 1000 // 2 min\n\n\tfmt.Fprintf(os.Stdout, \"Connect proxy: %v server: %v\\n\", c.Proxy, c.URL)\n\n\taddr := fmt.Sprintf(\"%s:%d\", c.Host, c.Port)\n\n\tconn, err := dial(addr, c.User, timeout)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsession, err := conn.NewSession()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer session.Close()\n\n\tin, err := session.StdinPipe()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tout, err := session.StdoutPipe()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := session.Shell(); err != nil {\n\t\treturn err\n\t}\n\n\terr = session.RequestPty(\"xterm\", 1, maxInputLength, ssh.TerminalModes{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t//\n\tgreet := func() error {\n\t\tmeMsg := fmt.Sprintf(`/me {\"name\": \"%v\", \"type\": \"link\", \"addr\": \"%v\", \"status\": \"on\" , \"uuid\": \"%v\"}`, c.User, addr, c.UUID)\n\t\twhoisMsg := fmt.Sprintf(`/whois %v`, c.Service.Name)\n\n\t\tfmt.Println(\"Sending greetings ...\")\n\t\tfmt.Println(meMsg)\n\t\tfmt.Println(whoisMsg)\n\n\t\tif !active {\n\t\t\t_, err := send(in, meMsg)\n\t\t\tfmt.Printf(\"greet: %v\\n\", err)\n\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tactive = true\n\t\t}\n\t\tif active && remotePort == -1 {\n\t\t\t_, err := send(in, whoisMsg)\n\t\t\tfmt.Printf(\"greet: %v\\n\", err)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\treturn nil\n\t}\n\n\t//\n\thandle := func() error {\n\t\tscanner := bufio.NewScanner(out)\n\n\t\tfor scanner.Scan() {\n\t\t\tline := scanner.Text()\n\n\t\t\tfmt.Println(\"Got: \", line)\n\t\t\tif strings.HasPrefix(line, \"/\") {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcm := ChatMessage{}\n\t\t\terr := json.Unmarshal([]byte(line), &cm)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"TODO: %v\\r\\n\", line)\n\t\t\t} else {\n\t\t\t\tif !active {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\t//\n\t\t\t\tif cm.Msg == nil {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tif cm.Type == \"system\" && cm.Msg[\"error\"] == \"\" && cm.Msg[\"user_type\"] == \"service\" && strings.HasPrefix(cm.Msg[\"name\"], strings.Split(c.Service.Name, \"/\")[0]+\"/\") {\n\n\t\t\t\t\tremotePort = parseInt(cm.Msg[\"remote_port\"], -1)\n\t\t\t\t\tsvcUser = cm.Msg[\"name\"]\n\n\t\t\t\t\tfmt.Printf(\"whois response: %v user: %v\\n\", cm.Msg, svcUser)\n\t\t\t\t\tgo tun(c, remotePort)\n\n\t\t\t\t\t//notify\n\t\t\t\t\tc.Ready <- true\n\t\t\t\t}\n\n\t\t\t\tif cm.Type == \"presence\" && cm.Msg[\"who\"] == svcUser {\n\t\t\t\t\tfmt.Printf(\"service user presence who: %v status: %v\\r\\n\", svcUser, cm.Msg[\"status\"])\n\n\t\t\t\t\tif cm.Msg[\"status\"] == \"left\" {\n\t\t\t\t\t\tremotePort = -1\n\t\t\t\t\t\tsvcUser = \"\"\n\n\t\t\t\t\t\t//\n\t\t\t\t\t\tc.Ready <- false\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn scanner.Err()\n\t}\n\n\t//\n\tfmt.Printf(\"Connect greeting\\n\")\n\n\terr = greet()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfmt.Printf(\"Connect handle msg\\n\")\n\n\terr = handle()\n\n\treturn err\n}", "title": "" }, { "docid": "8e0a039933f1e16f41a4c28d839a23ef", "score": "0.57784957", "text": "func (c *Connection) Connect(address string) error {\n\n\tvar err error\n\n\ttcpaddr, err := net.ResolveTCPAddr(\"tcp\", address)\n\tif nil != err {\n\t\treturn err\n\t}\n\n\tc.conn, err = net.DialTCP(\"tcp\", nil, tcpaddr)\n\tif nil != err {\n\t\treturn err\n\t}\n\n\terr = c.initConnection()\n\tif nil != err {\n\t\tc.conn.Close()\n\t\treturn err\n\t}\n\n\tc.CloseChan = make(chan interface{})\n\n\tgo c.run()\n\n\treturn nil\n}", "title": "" }, { "docid": "30fb792f1be3c4276072d390e5486bc3", "score": "0.57775974", "text": "func Connect(addr string, opts ...ServerOpts) (*Server, error) {\n\ts := &Server{}\n\tfor _, opt := range opts {\n\t\topt(s)\n\t}\n\tif s.logger == nil {\n\t\ts.logger = log.DefaultLogger\n\t}\n\tclient, conn, err := connect(addr, s.logger, s.dialOpts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ts.Client = client\n\ts.conn = conn\n\treturn s, nil\n}", "title": "" }, { "docid": "5adf02a8b5435ec6c85122058c0f05ad", "score": "0.5775484", "text": "func Connect(info *mgo.DialInfo) (*Connection, error) {\n\tset := make(map[string]interface{})\n\tconn := &Connection{\n\t\tDialInfo: info,\n\t\tContext: &Context{\n\t\t\tset: set,\n\t\t},\n\t}\n\terr := conn.Connect()\n\treturn conn, err\n}", "title": "" }, { "docid": "05adce9fcbce6e539abce6108efa139c", "score": "0.57742715", "text": "func Connect(shm string) (*core.Connection, error) {\n\tif vppAdapter == nil {\n\t\tvppAdapter = vppapiclient.NewVppAdapter(shm)\n\t}\n\treturn core.Connect(vppAdapter)\n}", "title": "" }, { "docid": "f325996cab3944a14079814faafce5f2", "score": "0.57719946", "text": "func Connect(addr string, grpcServer *grpc.Server) *grpc.ClientConn {\n\t// create client\n\tyDialer := NewYamuxDialer()\n\tgconn, err := grpc.Dial(addr, grpc.WithInsecure(), grpc.WithDialer(yDialer.Dial))\n\tif err != nil {\n\t\tlog.Fatalf(\"did not connect: %v\", err)\n\t}\n\n\tgo func() {\n\t\tfor {\n\t\t\t// connect and loop forever to keep retrying in the case that the connection\n\t\t\t// drops for any reason\n\t\t\tconnect(addr, grpcServer, yDialer)\n\t\t\ttime.Sleep(1 * time.Second)\n\t\t}\n\t}()\n\n\treturn gconn\n}", "title": "" }, { "docid": "751b3cbf60f426858c956d0cd6eac47c", "score": "0.5755612", "text": "func ConnectServer() pb.ConnectClient {\n\tconn, err := grpc.Dial(address, grpc.WithInsecure(), grpc.WithBlock())\n\tif err != nil {\n\t\tlog.Fatalf(\"did not connect: %v\", err)\n\t}\n\treturn pb.NewConnectClient(conn)\n}", "title": "" }, { "docid": "98cae588f4253b901b55ebb4c7dab151", "score": "0.5748867", "text": "func Dial(network, address string) (*rpc.Client, error) {\n\tconn, err := net.Dial(network, address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn NewClient(conn), err\n}", "title": "" }, { "docid": "613b68167983384481c4eb52622cf3f1", "score": "0.5732922", "text": "func Connect(conn net.Conn, addr string) (net.Conn, error) {\n\treturn DefaultClient.Connect(conn, addr)\n}", "title": "" }, { "docid": "9f8156ba3529045341870a1a47523b8e", "score": "0.57220733", "text": "func (client *Client) Connect() error {\n\tif client.Connection != nil {\n\t\tclient.Connection.Close()\n\t}\n\n\tvar err error\n\n\taddress := fmt.Sprintf(\"%s:%d\", client.Host, client.Port)\n\n\tif client.Timeout == 0 {\n\t\tclient.Timeout = defaultTimeout * time.Second\n\t}\n\n\tif client.Protocol == \"udp\" {\n\t\tudpAddr, err := net.ResolveUDPAddr(\"udp\", address)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tclient.Connection, err = net.DialUDP(client.Protocol, nil, udpAddr)\n\t} else {\n\t\tclient.Connection, err = net.DialTimeout(client.Protocol, address, client.Timeout)\n\t}\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "cb8fec82354506177e004f0867f5663b", "score": "0.57151854", "text": "func (ls *libstore) SetUpConn(hostPort string) *rpc.Client {\n\tcli, err := rpc.DialHTTP(\"tcp\", hostPort)\n\tif err != nil {\n\t\treturn nil\n\t}\n\treturn cli\n}", "title": "" }, { "docid": "66a50886b3fec08034aa688e7db534f1", "score": "0.57145494", "text": "func (c *Client) ConnectString(str string) error {\n\tclient, err := rpc.DialHTTP(tcpProtocol, str)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tc.connect = client\n\treturn nil\n}", "title": "" }, { "docid": "e0d4457ff02bc7fd04780147fa0078e7", "score": "0.5711172", "text": "func (c *Client) Connect() (err error) {\n\t// Create the socket\n\tif c.sock, err = c.context.NewSocket(zmq.REQ); err != nil {\n\t\treturn err\n\t}\n\n\t// Create an identity for the client\n\t// NOTE: the identity must be unique - do not rely on randomness since\n\t// parallel instantiation may result in the same seed!\n\tc.identity = fmt.Sprintf(\"%s-%04X\", c.name, rand.Intn(0x10000))\n\tc.sock.SetIdentity(c.identity)\n\n\t// Connect to the server\n\tep := c.addr\n\tif err = c.sock.Connect(ep); err != nil {\n\t\treturn err\n\t}\n\tinfo(\"connected to %s\\n\", ep)\n\n\treturn nil\n}", "title": "" }, { "docid": "5d151f3da5bcfd7f846c2ce810f02524", "score": "0.57089853", "text": "func Connect(address string, port int, user, pass string) (*Connection, error) {\n\turi := fmt.Sprintf(\"amqp://%s:%s@%s:%d\", user, pass, address, port)\n\tconn, err := establishConnection(uri, amqpConnectionTimeout*time.Second)\n\tif err != nil {\n\t\tlog.Fatalf(\"Could not connect to RabbitMQ: %s\", err)\n\t\treturn nil, err\n\t}\n\n\tchannel, err := conn.Channel()\n\tif err != nil {\n\t\tlog.Fatalf(\"Could not open main channel: %s\", err)\n\t\treturn nil, err\n\t}\n\n\treturn &Connection{\n\t\tConnection: conn,\n\t\tChannel: channel,\n\t}, nil\n}", "title": "" }, { "docid": "d3b44dc56ec198d550e3121cd1978f3a", "score": "0.5701749", "text": "func Connect(address string) (*grpc.ClientConn, error) {\n\treturn connection.Connect(address, metrics.NewCSIMetricsManager(\"\"), connection.OnConnectionLoss(connection.ExitOnConnectionLoss()))\n}", "title": "" }, { "docid": "0857b2bf6e185932ecd8b9c48e49d601", "score": "0.5688343", "text": "func (client *NSClient) Connect(gwMAC string, onReceive udpPacketCallback) error {\n\n\tip := net.ParseIP(client.Server)\n\n\tif ip == nil {\n\t\treturn errors.New(\"bad network server IP\")\n\t}\n\n\taddr := net.UDPAddr{\n\t\tIP: ip,\n\t\tPort: client.Port,\n\t}\n\n\tconn, err := net.DialUDP(\"udp\", nil, &addr)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\tclient.connexion = conn\n\n\tlog.Infoln(\"UDP listening bindpoint=%s\", conn.LocalAddr())\n\tgo client.receiveUDP(onReceive)\n\tgo client.sendPullData(gwMAC)\n\n\tclient.connected = true\n\treturn nil\n}", "title": "" }, { "docid": "54e16a3e790b10115182c60afe7ba7c1", "score": "0.56816775", "text": "func connectToServer() (connection net.Conn) { // connect to relay server\n\tconnection, err := net.Dial(\"tcp\", \"121.159.177.222:8200\")\n\t// connection, err := net.Dial(\"tcp\", \"127.0.0.1:8200\") // for debugging\n\n\tif err != nil { // if failed to connect to server\n\t\tfmt.Println(\"Failed to connect to server: \", err)\n\t\tfmt.Println(\"Please make sure that the server is available now. If so, please try again.\")\n\t\tfmt.Println(\"Battleship client shut down.\")\n\t\ttime.Sleep(5 * time.Second)\n\t\treturn\n\t}\n\t// if connected to server\n\tfmt.Println(\"Successfully connected to server.\")\n\treturn\n}", "title": "" }, { "docid": "2d22cf7e12f98c6b453a04bc249e4884", "score": "0.5680435", "text": "func Start_server(srv Server) error {\r\n\t// handle server requests\r\n\t// \r\n\t\r\n\tport := srv.Port\r\n\tPORT.Client = port.Client\r\n\tPORT.Server = port.Server\r\n\t\r\n\t// register RPC commands\r\n\t// \r\n\trpctype := new(RPCType)\r\n\tfor retries := 0; retries < RETRY_COUNT + 1; retries ++ {\r\n\t\terr := rpc.Register(rpctype)\r\n\t\t\r\n\t\t// after retrying enough times, fail this attempt\r\n\t\t// \r\n\t\tif err != nil && retries == RETRY_COUNT {\r\n\t\t\tlog.Println(err)\r\n\t\t\treturn err\r\n\t\t} else if err == nil {\r\n\t\t\tbreak\r\n\t\t}\r\n\t}\r\n\trpc.HandleHTTP()\r\n\t\r\n\t// listen for TCP connections\r\n\t// \r\n\tl := *new(net.Listener)\r\n\te := error(nil)\r\n\tfor retries := 0; retries < RETRY_COUNT + 1; retries ++ {\r\n\t\tl, e = net.Listen(\"tcp\", \":\" + port.Client)\r\n\t\t\r\n\t\t// after retrying enough times, fail this attempt\r\n\t\t//\r\n\t\tif e != nil && retries == RETRY_COUNT {\r\n\t\t\tlog.Println(e)\r\n\t\t\treturn e\r\n\t\t} else if e == nil {\r\n\t\t\tbreak\r\n\t\t}\r\n\t}\r\n\t\r\n\t// serve TCP connections\r\n\t// \r\n\trpc.Accept(l)\r\n\tl.Close()\r\n\t\r\n\treturn nil\r\n}", "title": "" }, { "docid": "59593fceade0d7bbc8dcca959cc73b49", "score": "0.56793135", "text": "func InitRPCClient(url string) error {\n\n\trpcClient, err := rpc.Dial(url)\n\n\tif err != nil {\n\t\tlog.Errorf(\"Failed to connect to the ETH client: %v\", err)\n\t\treturn err\n\t}\n\tfmt.Printf(\"Connected to the ETH RPC provider: %s\\n\", url)\n\tRPCClient = rpcClient\n\treturn nil\n\n}", "title": "" }, { "docid": "ad36b64e49775d180d13ea7d68e73026", "score": "0.5677649", "text": "func (self ConnManager) Connect(addr string) {\n\tif atomic.LoadInt32(&self.stop) != 0 {\n\t\treturn\n\t}\n\t// The following code extracts target's peer ID from the\n\t// given multiaddress\n\tipfsaddr, err := ma.NewMultiaddr(addr)\n\tif err != nil {\n\t\tlog.Print(err)\n\t\treturn\n\t}\n\n\tpid, err := ipfsaddr.ValueForProtocol(ma.P_IPFS)\n\tif err != nil {\n\t\tlog.Print(err)\n\t\treturn\n\t}\n\n\tpeerId, err := libpeer.IDB58Decode(pid)\n\tif err != nil {\n\t\tlog.Print(err)\n\t\treturn\n\t}\n\n\t// Decapsulate the /ipfs/<peerID> part from the target\n\t// /ip4/<a.b.c.d>/ipfs/<peer> becomes /ip4/<a.b.c.d>\n\ttargetPeerAddr, _ := ma.NewMultiaddr(\n\t\tfmt.Sprintf(\"/ipfs/%s\", libpeer.IDB58Encode(peerId)))\n\ttargetAddr := ipfsaddr.Decapsulate(targetPeerAddr)\n\n\tconnReq := ConnReq{\n\t\tPermanent: true,\n\t\tPeer: peer.Peer{\n\t\t\tTargetAddress: targetAddr,\n\t\t\tPeerId: peerId,\n\t\t},\n\t}\n\tif atomic.LoadUint64(&connReq.Id) == 0 {\n\t\tatomic.StoreUint64(&connReq.Id, atomic.AddUint64(&self.connReqCount, 1))\n\n\t\t// Submit a request of a pending connection attempt to the\n\t\t// connection manager. By registering the id before the\n\t\t// connection is even established, we'll be able to later\n\t\t// cancel the connection via the Remove method.\n\t\tdone := make(chan struct{})\n\t\tselect {\n\t\tcase self.Requests <- registerPending{&connReq, done}:\n\t\tcase <-self.Quit:\n\t\t\treturn\n\t\t}\n\n\t\t// Wait for the registration to successfully add the pending\n\t\t// conn req to the conn manager's internal state.\n\t\tselect {\n\t\tcase <-done:\n\t\tcase <-self.Quit:\n\t\t\treturn\n\t\t}\n\t}\n\n\t//spew.Dump(\"Attempting to connect to\", connRequest.Peer.TargetAddress.String())\n\n\tfor _, listen := range self.Config.ListenerPeers {\n\t\tlisten.Host.Peerstore().AddAddr(connReq.Peer.PeerId, connReq.Peer.TargetAddress, pstore.PermanentAddrTTL)\n\t\tlog.Printf(\"opening stream %s \\n\", connReq.Peer.PeerId.String())\n\t\t// make a new stream from host B to host A\n\t\t// it should be handled on host A by the handler we set above because\n\t\t// we use the same /peer/1.0.0 protocol\n\t\tstream, err := listen.Host.NewStream(context.Background(), connReq.Peer.PeerId, \"/blockchain/1.0.0\")\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\tcontinue\n\t\t}\n\t\t// Create a buffered stream so that read and writes are non blocking.\n\t\trw := bufio.NewReadWriter(bufio.NewReader(stream), bufio.NewWriter(stream))\n\n\t\t// Create a thread to read and write data.\n\t\tgo listen.InMessageHandler(rw)\n\t\tgo listen.OutMessageHandler(rw)\n\t}\n\n\tselect {\n\tcase self.Requests <- handleConnected{&connReq, connReq.Peer}:\n\tcase <-self.Quit:\n\t}\n}", "title": "" }, { "docid": "24f3b684f8fd66d7d0f4f29722decf1c", "score": "0.5674207", "text": "func (cli *Client) Connect(serverAddr *net.TCPAddr) error {\n\ttcpDataStreamer, err := cli.dataStream.CreateConnection(serverAddr)\n\tcli.dataStream = tcpDataStreamer\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tgo cli.Start()\n\treturn nil\n\n}", "title": "" }, { "docid": "3a4ac4a9811152cf00f6bfccfd64b70d", "score": "0.5652038", "text": "func (s *Server) Connect(ctx context.Context, req *pb.ConnectRequest) (*pb.ConnectResponse, error) {\n\ts.initialize()\n\n\tsession, err := s.generateSessionID(10)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Unable to generate session identifier. %s\", err)\n\t}\n\n\tif _, err := s.addSession(session, nil); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &pb.ConnectResponse{\n\t\tSession: session,\n\t}, nil\n}", "title": "" }, { "docid": "87e175924731440a0b1b1150b748a04d", "score": "0.56359136", "text": "func (c *TCPClient) Connect() error {\n\tconn, err := net.Dial(\"tcp\", c.address)\n\tc.conn = conn\n\n\treturn err\n}", "title": "" }, { "docid": "db23b8a9705e92fc914561c17091db18", "score": "0.5625915", "text": "func connect(t *testing.T, url string) *grpc.ClientConn {\n\tconn, err := grpc.Dial(url, grpc.WithInsecure())\n\tif err != nil {\n\t\tt.Fatalf(\"unable to connect to %s - %s\", url, err)\n\t}\n\treturn conn\n}", "title": "" }, { "docid": "f295ab4c820cf460c817562f62d3123c", "score": "0.5624298", "text": "func (rd *RPCDUT) RPCDial(ctx context.Context) error {\n\ttesting.ContextLog(ctx, \"Dialing RPC connection\")\n\tcl, err := rpc.Dial(ctx, rd.d, rd.h)\n\tif err != nil {\n\t\treturn err\n\t}\n\trd.cl = cl\n\treturn nil\n}", "title": "" }, { "docid": "9ace15cfdfd8eea31deb26b5c7675842", "score": "0.5619169", "text": "func (n *Node) Connect(ctx context.Context, proto protocol.ID, addr string) (*Connection, error) {\n\t// The following code extracts target's the peer ID from the\n\t// given multiaddress\n\tipfsaddr, err := ma.NewMultiaddr(addr)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\tpid, err := ipfsaddr.ValueForProtocol(ma.P_IPFS)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\tpeerid, err := peer.IDB58Decode(pid)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\t// Decapsulate the /ipfs/<peerID> part from the target\n\t// /ip4/<a.b.c.d>/ipfs/<peer> becomes /ip4/<a.b.c.d>\n\ttargetPeerAddr, _ := ma.NewMultiaddr(\n\t\tfmt.Sprintf(\"/ipfs/%s\", peer.IDB58Encode(peerid)))\n\ttargetAddr := ipfsaddr.Decapsulate(targetPeerAddr)\n\n\t// We have a peer ID and a targetAddr so we add it to the peerstore\n\t// so LibP2P knows how to contact it\n\tn.Peerstore().AddAddr(peerid, targetAddr, pstore.PermanentAddrTTL)\n\n\tlog.Println(\"opening stream\")\n\t// make a new stream from host B to host A\n\t// it should be handled on host A by the handler we set above because\n\t// we use the same /echo/1.0.0 protocol\n\ts, err := n.NewStream(ctx, peerid, proto)\n\treturn newConn(s), err\n}", "title": "" }, { "docid": "64dddc7bba2531cb21f67ec3f48d82ec", "score": "0.5614738", "text": "func (i *IRC) connect() (net.Conn, error) {\n\treturn net.Dial(\"tcp\", i.server)\n}", "title": "" }, { "docid": "64dddc7bba2531cb21f67ec3f48d82ec", "score": "0.5614738", "text": "func (i *IRC) connect() (net.Conn, error) {\n\treturn net.Dial(\"tcp\", i.server)\n}", "title": "" }, { "docid": "a4fc63c6419de5732b39bc6f9fe04357", "score": "0.55999637", "text": "func joinWithServer(hostport string) (net.Conn, error) {\r\n\tconn, err := net.Dial(\"tcp\", hostport)\r\n\treturn conn, err\r\n}", "title": "" }, { "docid": "4f8407f39ef9f167a825c771b5cc4572", "score": "0.55928034", "text": "func Connect(addr, uname, pass string) (*FrankConn, error) {\n\treturn NewFrankConn(addr, uname, pass, false)\n}", "title": "" }, { "docid": "94d857c0a7b6c7a0501302a8b472cb26", "score": "0.5592558", "text": "func (client *Client) Connect(address string) (err error) {\n\t// Establish connection with the server\n conn, err := net.Dial(\"tcp\", address)\n\tdefer conn.Close()\n if err != nil {\n return\n }\n\tencoder := gob.NewEncoder(conn)\n // Send the cmd 'init' to let the server know this is our first time connecting\n\trequest := &gochat.Msg{User: client.Username, Cmd: \"init\"}\n err = encoder.Encode(request)\n if err != nil {\n fmt.Println(\"Encoder error:\", err)\n\t\treturn\n }\n\t// Get response from server for the port\n\tvar port string\n decoder := gob.NewDecoder(conn)\n err = decoder.Decode(&port)\n if err != nil {\n fmt.Println(\"Decoding error:\",err)\n\t\treturn\n }\n\t// Check for special case that this username already exists on the server\n\tif (port == \"alreadyExists\") {\n\t\treturn errors.New(fmt.Sprintf(\"Error: User '%s' already exists on the server!\\n\", client.Username))\n\t}\n\t// Start the Listen goroutine\n\terrCh := make(chan error)\n\tgo client.Listen(port, errCh)\n\t// Check if Listen encountered an error starting up net.Listen\n\tif err = <- errCh; err != nil {\n\t\treturn err\n\t}\n\t//Add the global group to cache of client's groups\n\tclient.MyGroups.Create(\"global\", \"\")\n\tclient.MyGroups.AddUser(\"global\", client.Username)\n\t\n\treturn nil\n}", "title": "" }, { "docid": "dfe7fe4aeb8bdb9137e20e50b79db6dc", "score": "0.5586628", "text": "func (c *connector) Connect(ctx context.Context) (driver.Conn, error) {\n\tvar err error\n\n\t// New mysqlConn\n\tmc := &mysqlConn{\n\t\tmaxAllowedPacket: maxPacketSize,\n\t\tmaxWriteSize: maxPacketSize - 1,\n\t\tclosech: make(chan struct{}),\n\t\tcfg: c.cfg,\n\t}\n\tmc.parseTime = mc.cfg.ParseTime\n\n\t// Connect to Server\n\tdialsLock.RLock()\n\tdial, ok := dials[mc.cfg.Net]\n\tdialsLock.RUnlock()\n\tif ok {\n\t\tdctx := ctx\n\t\tif mc.cfg.Timeout > 0 {\n\t\t\tvar cancel context.CancelFunc\n\t\t\tdctx, cancel = context.WithTimeout(ctx, c.cfg.Timeout)\n\t\t\tdefer cancel()\n\t\t}\n\t\tmc.netConn, err = dial(dctx, mc.cfg.Addr)\n\t} else {\n\t\tnd := net.Dialer{Timeout: mc.cfg.Timeout}\n\t\tmc.netConn, err = nd.DialContext(ctx, mc.cfg.Net, mc.cfg.Addr)\n\t}\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Enable TCP Keepalives on TCP connections\n\tif tc, ok := mc.netConn.(*net.TCPConn); ok {\n\t\tif err := tc.SetKeepAlive(true); err != nil {\n\t\t\t// Don't send COM_QUIT before handshake.\n\t\t\tmc.netConn.Close()\n\t\t\tmc.netConn = nil\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Call startWatcher for context support (From Go 1.8)\n\tmc.startWatcher()\n\tif err := mc.watchCancel(ctx); err != nil {\n\t\tmc.cleanup()\n\t\treturn nil, err\n\t}\n\tdefer mc.finish()\n\n\tmc.buf = newBuffer(mc.netConn)\n\n\t// Set I/O timeouts\n\tmc.buf.timeout = mc.cfg.ReadTimeout\n\tmc.writeTimeout = mc.cfg.WriteTimeout\n\n\t// Reading Handshake Initialization Packet\n\tauthData, plugin, err := mc.readHandshakePacket()\n\tif err != nil {\n\t\tmc.cleanup()\n\t\treturn nil, err\n\t}\n\n\tif plugin == \"\" {\n\t\tplugin = defaultAuthPlugin\n\t}\n\n\t// Send Client Authentication Packet\n\tauthResp, err := mc.auth(authData, plugin)\n\tif err != nil {\n\t\t// try the default auth plugin, if using the requested plugin failed\n\t\terrLog.Print(\"could not use requested auth plugin '\"+plugin+\"': \", err.Error())\n\t\tplugin = defaultAuthPlugin\n\t\tauthResp, err = mc.auth(authData, plugin)\n\t\tif err != nil {\n\t\t\tmc.cleanup()\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif err = mc.writeHandshakeResponsePacket(authResp, plugin); err != nil {\n\t\tmc.cleanup()\n\t\treturn nil, err\n\t}\n\n\t// Handle response to auth packet, switch methods if possible\n\tif err = mc.handleAuthResult(authData, plugin); err != nil {\n\t\t// Authentication failed and MySQL has already closed the connection\n\t\t// (https://dev.mysql.com/doc/internals/en/authentication-fails.html).\n\t\t// Do not send COM_QUIT, just cleanup and return the error.\n\t\tmc.cleanup()\n\t\treturn nil, err\n\t}\n\n\tif mc.cfg.MaxAllowedPacket > 0 {\n\t\tmc.maxAllowedPacket = mc.cfg.MaxAllowedPacket\n\t} else {\n\t\t// Get max allowed packet size\n\t\tmaxap, err := mc.getSystemVar(\"max_allowed_packet\")\n\t\tif err != nil {\n\t\t\tmc.Close()\n\t\t\treturn nil, err\n\t\t}\n\t\tmc.maxAllowedPacket = stringToInt(maxap) - 1\n\t}\n\tif mc.maxAllowedPacket < maxPacketSize {\n\t\tmc.maxWriteSize = mc.maxAllowedPacket\n\t}\n\n\t// Handle DSN Params\n\terr = mc.handleParams()\n\tif err != nil {\n\t\tmc.Close()\n\t\treturn nil, err\n\t}\n\n\treturn mc, nil\n}", "title": "" }, { "docid": "3d4eda1c9f220072dca76ffb63d5e207", "score": "0.5583547", "text": "func (c *Client) Connect(host string, port int, socksProxy Proxy) error {\n\tif socksProxy.Host == \"\" && socksProxy.Port == 0 {\n\t\tconn, err := net.Dial(\"tcp\", net.JoinHostPort(host, strconv.Itoa(port)))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tc.Conn = conn\n\t} else {\n\t\tdialer, err := proxy.SOCKS5(\"tcp\", net.JoinHostPort(socksProxy.Host, strconv.Itoa(socksProxy.Port)), nil, proxy.Direct)\n\t\tconn, err := dialer.Dial(\"tcp\", net.JoinHostPort(host, strconv.Itoa(port)))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tc.Conn = conn\n\t}\n\n\terr := c.Send(fmt.Sprintf(\"NICK %s\\r\\nUSER %s 0 0 :%s\\r\\n\", c.Nickname, c.Username, c.Realname))\n\tif err != nil {\n\t\tc.Conn.Close()\n\t\treturn err\n\t}\n\n\tfor {\n\t\tif c.Connected {\n\t\t\tbreak\n\t\t}\n\t\tbuf := make([]byte, 1024)\n\t\t_, err := c.Conn.Read(buf)\n\t\tif err != nil {\n\t\t\tc.Conn.Close()\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, line := range strings.Split(string(buf), \"\\n\") {\n\t\t\tif len(line) == 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcmd := strings.Split(line, \" \")[0]\n\t\t\tif strings.ToLower(cmd) == \"error\" {\n\t\t\t\tc.Connected = false\n\t\t\t\tc.Conn.Close()\n\t\t\t\treturn fmt.Errorf(\"server sent error: %s\", line)\n\t\t\t}\n\t\t\tif strings.ToLower(cmd) == \"ping\" {\n\t\t\t\tc.Send(fmt.Sprintf(\"PONG %s\", strings.Split(line, \" \")[1]))\n\t\t\t}\n\t\t\tif len(strings.Split(line, \" \")) >= 2 {\n\t\t\t\tif strings.Split(line, \" \")[1] == \"376\" || strings.Split(line, \" \")[1] == \"422\" {\n\t\t\t\t\tc.Connected = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\ttime.Sleep(1 * time.Second)\n\n\tgo c.reader()\n\n\treturn nil\n}", "title": "" }, { "docid": "63e73ce30678eacb280cddd66035f4f7", "score": "0.5583085", "text": "func ConnectTo(addr string) (*urpc.Client, error) {\n\t// Connect to the server.\n\tconn, err := unet.Connect(addr, false)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Wrap in our stream codec.\n\treturn urpc.NewClient(conn), nil\n}", "title": "" }, { "docid": "05c2e5beaea0438e76539064e63582dc", "score": "0.5578228", "text": "func (c *Client) Connect(addr, username string) (net.Conn, error) {\n\tconn, err := net.DialTimeout(\"tcp\", c.addr, 3 * time.Second)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tip, port, err := parseIPv4(addr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbufLen := 8 + len(username) + 1\n\tbuf := make([]byte, bufLen)\n\n\tbuf[0] = 4\n\tbuf[1] = 1\n\tbinary.BigEndian.PutUint16(buf[2:], port)\n\tbinary.BigEndian.PutUint32(buf[4:], ip)\n\tcopy(buf[8:], []byte(username))\n\tbuf[8+len(username)] = 0\n\n\tn, err := conn.Write(buf)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"write failed: %v\", err)\n\t}\n\n\tif n != bufLen {\n\t\treturn nil, fmt.Errorf(\"wrote %d of %d bytes\", n, bufLen)\n\t}\n\n\trespBufLen := 8\n\trespBuf := make([]byte, respBufLen)\n\tn, err = conn.Read(respBuf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif n != respBufLen {\n\t\treturn nil, fmt.Errorf(\"read %d of %d bytes\", n, respBufLen)\n\t}\n\n\tswitch respBuf[1] {\n\tcase RequestGranted:\n\t\treturn conn, nil\n\tcase RequestRejectedOrFailed:\n\t\treturn nil, fmt.Errorf(\"rejected or failed\")\n\tcase RequestFailedIdentdNotRunning:\n\t\treturn nil, fmt.Errorf(\"identd not running (or not reachable from server)\")\n\tcase RequestFailedIdentdInvalidUserID:\n\t\treturn nil, fmt.Errorf(\"identd could not confirm the user ID\")\n\t}\n\n\treturn nil, fmt.Errorf(\"unknown reply code %d\", respBuf[1])\n}", "title": "" }, { "docid": "03f673b82f005834fa0bdade0a417166", "score": "0.55780977", "text": "func (conn *Conn) Connect() error {\n\tif conn.isConnected {\n\t\treturn ErrAlreadyConnected\n\t}\n\tdialer := &net.Dialer{KeepAlive: time.Second * 10}\n\tsocket, err := tls.DialWithDialer(dialer, \"tcp\", fmt.Sprintf(\"%s:%d\", IP, 6697), nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(conn.Username) < 1 || len(conn.token) < 1 {\n\t\tconn.SetLogin(\"justinfan123\", \"Kappa123\")\n\t}\n\tconn.socket = socket\n\tconn.isConnected = true\n\tgo conn.reader()\n\treturn conn.SendRaw(\n\t\t\"CAP REQ :twitch.tv/membership twitch.tv/tags twitch.tv/commands\",\n\n\t\tfmt.Sprintf(\"PASS oauth:%s\", conn.token),\n\t\tfmt.Sprintf(\"NICK %s\", conn.Username),\n\t)\n}", "title": "" }, { "docid": "17996eaa01db5105c4fb448286bcfc5d", "score": "0.55677545", "text": "func Connect(path string, port uint16) (net.Conn, error) {\n\treturn connect(path, port)\n}", "title": "" }, { "docid": "415047d72fcbcfbf192616abdbf02695", "score": "0.5566093", "text": "func (t *Telegram) Connect() error {\n\tif err := t.TestConnection(); err != nil {\n\t\treturn err\n\t}\n\tt.Connected = true\n\tgo t.PollerStart()\n\treturn nil\n}", "title": "" }, { "docid": "97536eeaa06758c8dcc112b467db8a11", "score": "0.5560837", "text": "func (c *Client) Connect() error {\n\tif c.IrcAddress == \"\" && c.TLS {\n\t\tc.IrcAddress = ircTwitchTLS\n\t} else if c.IrcAddress == \"\" && !c.TLS {\n\t\tc.IrcAddress = ircTwitch\n\t}\n\n\tdialer := &net.Dialer{\n\t\tKeepAlive: time.Second * 10,\n\t}\n\n\tvar conf *tls.Config\n\t// This means we are connecting to \"localhost\". Disable certificate chain check\n\tif strings.HasPrefix(c.IrcAddress, \"127.0.0.1:\") {\n\t\tconf = &tls.Config{\n\t\t\tInsecureSkipVerify: true,\n\t\t}\n\t} else {\n\t\tconf = &tls.Config{}\n\t}\n\n\tfor {\n\t\terr := c.makeConnection(dialer, conf)\n\n\t\tswitch err {\n\t\tcase errReconnect:\n\t\t\tcontinue\n\n\t\tdefault:\n\t\t\treturn err\n\t\t}\n\t}\n}", "title": "" }, { "docid": "682a8095bfbdf7bb6b37185b06fe1872", "score": "0.5557969", "text": "func Connect(address string) (*GRPCClient, error) {\n\tconst dialTimeout = 5 * time.Second\n\tctx, cancel := context.WithTimeout(context.Background(), dialTimeout)\n\tdefer cancel()\n\n\tgRPCConnection, err := grpc.DialContext(ctx, address, grpc.WithInsecure(), grpc.WithBlock())\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"error connecting to %s\", address)\n\t}\n\n\tgrpcClient := protowire.NewRPCClient(gRPCConnection)\n\tstream, err := grpcClient.MessageStream(context.Background(), grpc.UseCompressor(gzip.Name),\n\t\tgrpc.MaxCallRecvMsgSize(grpcserver.RPCMaxMessageSize), grpc.MaxCallSendMsgSize(grpcserver.RPCMaxMessageSize))\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"error getting client stream for %s\", address)\n\t}\n\treturn &GRPCClient{stream: stream, connection: gRPCConnection}, nil\n}", "title": "" }, { "docid": "4090c49564d9dd9d56dabe859b263d16", "score": "0.55525696", "text": "func (c *RPCClient) Start() {\n\tc.connect()\n\tlog.Infof(\"A new rpc client connect to %s\", c.Queue)\n}", "title": "" }, { "docid": "15d44f103127a6e27e63d33852903a37", "score": "0.55493635", "text": "func Dial(addr string, opts ...ConnOption) (*Client, error) {\n\tu, err := url.Parse(addr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\thost, port := u.Hostname(), u.Port()\n\tif port == \"\" {\n\t\tport = \"5672\"\n\t\tif u.Scheme == \"amqps\" {\n\t\t\tport = \"5671\"\n\t\t}\n\t}\n\n\t// prepend SASL credentials when the user/pass segment is not empty\n\tif u.User != nil {\n\t\tpass, _ := u.User.Password()\n\t\topts = append([]ConnOption{\n\t\t\tConnSASLPlain(u.User.Username(), pass),\n\t\t}, opts...)\n\t}\n\n\t// append default options so user specified can overwrite\n\topts = append([]ConnOption{\n\t\tConnServerHostname(host),\n\t}, opts...)\n\n\tc, err := newConn(nil, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdialer := &net.Dialer{Timeout: c.connectTimeout}\n\tswitch u.Scheme {\n\tcase \"amqp\", \"\":\n\t\tc.net, err = dialer.Dial(\"tcp\", net.JoinHostPort(host, port))\n\tcase \"amqps\":\n\t\tc.initTLSConfig()\n\t\tc.tlsNegotiation = false\n\t\tc.net, err = tls.DialWithDialer(dialer, \"tcp\", net.JoinHostPort(host, port), c.tlsConfig)\n\tdefault:\n\t\treturn nil, errorErrorf(\"unsupported scheme %q\", u.Scheme)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = c.start()\n\treturn &Client{conn: c}, err\n}", "title": "" }, { "docid": "7ab9288bfe6fbda38d8e9b9a999f4696", "score": "0.5543616", "text": "func ExampleConnect() {\n\tnc, _ := nats.Connect(\"demo.nats.io\")\n\tnc.Close()\n\n\tnc, _ = nats.Connect(\"nats://derek:secretpassword@demo.nats.io:4222\")\n\tnc.Close()\n\n\tnc, _ = nats.Connect(\"tls://derek:secretpassword@demo.nats.io:4443\")\n\tnc.Close()\n\n\topts := nats.Options{\n\t\tAllowReconnect: true,\n\t\tMaxReconnect: 10,\n\t\tReconnectWait: 5 * time.Second,\n\t\tTimeout: 1 * time.Second,\n\t}\n\n\tnc, _ = opts.Connect()\n\tnc.Close()\n}", "title": "" }, { "docid": "6b3483eaf2b816e512f76843a8b94a46", "score": "0.55400175", "text": "func NewConnection(endpoint, commitment string) *Connection {\n\tc := &Connection{}\n\tc.client, _ = rpc.Dial(endpoint)\n\treturn c\n}", "title": "" }, { "docid": "374a302da671722a6ce7ed64f167d7df", "score": "0.5535578", "text": "func (c *connection) Connect() error {\n\tsession, err := r.Connect(c.opts)\n\tif err != nil {\n\t\treturn err\n\t}\n\tc.session = session\n\treturn nil\n}", "title": "" }, { "docid": "6fc3dfa46f5ea70ed1366d22c8891a18", "score": "0.55294853", "text": "func (lc *LDAPClient) Connect() (err error) {\n\tif lc.TLS {\n\t\tlc.Conn, err = ldap.DialTLS(\"tcp\", lc.Addr, &tls.Config{InsecureSkipVerify: true})\n\t} else {\n\t\tlc.Conn, err = ldap.Dial(\"tcp\", lc.Addr)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !lc.TLS && lc.StartTLS {\n\t\terr = lc.Conn.StartTLS(&tls.Config{InsecureSkipVerify: true})\n\t\tif err != nil {\n\t\t\tlc.Conn.Close()\n\t\t\treturn err\n\t\t}\n\t}\n\n\terr = lc.Conn.Bind(lc.BindDn, lc.BindPass)\n\tif err != nil {\n\t\tlc.Conn.Close()\n\t\treturn err\n\t}\n\treturn err\n}", "title": "" }, { "docid": "53b0419611430d494d913ee437150091", "score": "0.55267614", "text": "func (c *Connection) Connect() (err error) {\n\tif c.config.Ssl {\n\t\ttlsConfig := &tls.Config{\n\t\t\tServerName: c.config.GetHostname(),\n\t\t}\n\n\t\tif c.config.SslInsecure {\n\t\t\tlog.Print(\"Using insecure TLS for \", c.config.Name)\n\t\t\ttlsConfig.InsecureSkipVerify = true\n\t\t}\n\n\t\tif c.config.SslCertificate != \"\" {\n\t\t\troots := x509.NewCertPool()\n\t\t\ttlsCert, err := readTLSCertificate(c.config.SslCertificate)\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatalf(\"Cannot read TLS certificate %s: %s\", c.config.SslCertificate, err)\n\t\t\t}\n\t\t\tif ok := roots.AppendCertsFromPEM(tlsCert); !ok {\n\t\t\t\tlog.Fatalf(\"Cannot use TLS certificate %s: %s\", c.config.SslCertificate, err)\n\t\t\t}\n\t\t\ttlsConfig.RootCAs = roots\n\t\t}\n\n\t\tc.sock, err = tls.Dial(\"tcp\", c.config.Address, tlsConfig)\n\t} else {\n\t\tc.sock, err = net.Dial(\"tcp\", c.config.Address)\n\t}\n\tif err != nil {\n\t\treturn\n\t}\n\n\tlog.Print(\"Connected to: \", c.config.Name)\n\tc.io = bufio.NewReadWriter(bufio.NewReader(c.sock), bufio.NewWriter(c.sock))\n\n\t// remember to update numLoops if you add or remove loop methods!\n\tc.wg.Add(numLoops)\n\tgo c.writeLoop()\n\tgo c.readLoop()\n\tgo c.pingLoop()\n\tgo c.errLoop()\n\n\tc.RunCallbacks(&Message{Cmd: \"INIT\"})\n\n\tc.wg.Wait()\n\n\treturn nil\n}", "title": "" }, { "docid": "6be7517df82a7edfb047e04342312a5d", "score": "0.5520676", "text": "func (client *Client) connect() (err error) {\n\tif strings.Index(client.serverAddr, \":\") < 0 {\n\t\tclient.serverAddr += \":25565\"\n\t}\n\n\tif client.DebugWriter != nil {\n\t\tfmt.Fprintf(client.DebugWriter, \"Connecting to %s via TCP\\n\", client.serverAddr)\n\t}\n\n\tclient.netConn, err = net.Dial(\"tcp\", client.serverAddr)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tclient.conn = LogReadWriter{client.netConn}\n\n\treturn nil\n}", "title": "" }, { "docid": "c5b4d19ccb6597e4ee54f9fa5ac726db", "score": "0.55173314", "text": "func Connect(cfg grpccli.ConnectionOpts) (*Client, error) {\n\tmxpConn, err := grpccli.Connect(cfg)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"couldn't create mxprotocol server client: %v\", err)\n\t}\n\treturn &Client{\n\t\tmxpConn: mxpConn,\n\t}, nil\n}", "title": "" }, { "docid": "4b290e057f39874ebf51aee570276ceb", "score": "0.5509716", "text": "func (b *Bot) Connect() error {\n\tlog.Println(\"Connecting to\", b.Config.Server)\n\treturn b.Client.Connect()\n}", "title": "" }, { "docid": "5f14029c7cfa8f3de1a3e7f1a165ffc7", "score": "0.55087656", "text": "func (c *grpcClient) connect(ctx context.Context, addr string, opts ...grpc.DialOption) error {\n\n\t// if not options provided, use default settings\n\tif len(opts) == 0 {\n\t\topts = append(opts, grpc.WithInsecure(),\n\t\t\tgrpc.WithBlock(), //block connect until healthy or timeout\n\t\t\tgrpc.WithTimeout(2*time.Second)) // set connect timeout to 2 Second\n\t}\n\n\tconn, err := grpc.DialContext(ctx, addr, opts...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tc.conn = conn\n\tc.service = server.NewMilvusServiceClient(c.conn)\n\treturn nil\n}", "title": "" }, { "docid": "a4f7bc2c14cf09387d93fc8ef3dff70e", "score": "0.5508226", "text": "func (tcp *Client) Connect(address string, timeout time.Duration) error {\n\t// 如果已经连接,直接返回\n\tif tcp.status&statusConnect > 0 {\n\t\treturn g.ErrIsConnected\n\t}\n\tdial := net.Dialer{Timeout: timeout}\n\tconn, err := dial.Dial(\"tcp\", address)\n\tif err != nil {\n\t\tlog.Errorf(\"[E] start client with error: %+v\", err)\n\t\treturn err\n\t}\n\tif tcp.status&statusConnect <= 0 {\n\t\ttcp.status |= statusConnect\n\t}\n\ttcp.conn = conn\n\treturn nil\n}", "title": "" }, { "docid": "1f95771be7cb19516236cf4273dada04", "score": "0.5507313", "text": "func (d *Dispatcher) Connect() error {\n\tvar err error\n\tif err = d.transport.Init(d.endpoint, &d.transportOpts); err != nil {\n\t\treturn err\n\t}\n\n\tif err = d.metaHandshake(); err != nil {\n\t\treturn err\n\t}\n\treturn d.metaConnect()\n}", "title": "" }, { "docid": "07b24bd06253519e2abc9e508977984a", "score": "0.5506068", "text": "func Connect(to *L, tag string) (net.Conn, error) {\n\tclientPipe, err := newPipe()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclientPipe.local = simpleAddr(tag)\n\tclientPipe.remote = simpleAddr(to.name)\n\n\tserverPipe, err := newPipe()\n\tserverPipe.local = simpleAddr(to.name)\n\tserverPipe.remote = simpleAddr(tag)\n\tif err != nil {\n\t\tclientPipe.Close()\n\t\treturn nil, err\n\t}\n\t// swap the read files to allow the server to read data written from the client\n\t// and vice-versa\n\tclientPipe.r, serverPipe.r = serverPipe.r, clientPipe.r\n\tselect {\n\t// send the server pipe to the listener newconns channel\n\tcase to.newconns <- serverPipe:\n\tcase <-time.After(1 * time.Second):\n\t\treturn nil, errors.New(\"timeout\")\n\t}\n\t// and give the other end to the client\n\treturn clientPipe, nil\n}", "title": "" }, { "docid": "0f879058ec2fb84f2fd4392fb2d2e832", "score": "0.5504448", "text": "func (c *Client) OnionDial(ctx context.Context, proto string, host core.PeerID, port int) (net.Conn, error) {\n\n\t// validate network\n\tif proto != \"tcp\" {\n\t\treturn nil, errors.Errorf(\"Protocol %v is not supported\", proto)\n\t}\n\n\t// construct onion chain\n\tchain, err := c.GenPath(host)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// create payload && connection request\n\tvar (\n\t\tpayload [256]byte\n\t\trequest = connectionOpenRequest{\n\t\t\tPort: uint32(port),\n\t\t\tTimestamp: time.Now().Unix(),\n\t\t\tStreamID: uuid.New(),\n\t\t}\n\t\tbuf = &bytes.Buffer{}\n\t)\n\n\t{ // log the packet path\n\t\tvar debugPath []string\n\t\tfor _, hop := range chain {\n\t\t\tdebugPath = append(debugPath, hop.HostID.Pretty())\n\t\t}\n\t\tlog.Debugf(\"Packet %v will travel the path: %v\", request.StreamID, debugPath)\n\t}\n\n\t// generate session key\n\t_, err = rand.Read(request.Key[:])\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err,\n\t\t\t\"failed to get some random bytes (stream=%v)\", request.StreamID)\n\t}\n\n\t// write payload to buffer\n\terr = binary.Write(buf, binary.BigEndian, request)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err,\n\t\t\t\"failed to send welcome message (stream=%v)\", request.StreamID)\n\t}\n\n\tcopy(payload[:], buf.Bytes())\n\n\t// create header packet\n\tnetPacket, err := c.ConstructRelayHeader(chain, payload)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err,\n\t\t\t\"failed to construct relay header (stream=%v)\", request.StreamID)\n\t}\n\n\tlog.Debugf(\"constructed packet with len %v\", len(netPacket))\n\n\tvar (\n\t\tconnectionEstablished bool\n\t\tinsideEnd, returnEnd = net.Pipe()\n\t)\n\n\t// connect to the first peer\n\tstream, err := c.Host.NewStream(ctx, chain[0].HostID, ProxyRelayProtocol)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err,\n\t\t\t\"failed to dial first host of the chain (host=%v,stream=%v\", chain[0].HostID, request.StreamID)\n\t}\n\n\t// establish e2e encryption (no data sent yet)\n\te2e, err := NewCryptoReadWriter(stream, request.Key[:])\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err,\n\t\t\t\"while establishing e2e encryption (stream=%v)\", request.StreamID)\n\t}\n\n\tdefer func() {\n\n\t\t// connection is not fully open - error occurred\n\t\tif !connectionEstablished {\n\t\t\tlog.Debugf(\"Connection not established, closing (stream=%v)\", request.StreamID)\n\n\t\t\terr := stream.Close()\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"Failed closing the stream (stream=%v): %v\",\n\t\t\t\t\trequest.StreamID, err)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\t// connection fully open - connect the pipe\n\t\t// @TODO\n\t\tgo func() {\n\n\t\t\tlog.Debugf(\"connecting dial stuff (steam=%v)\", request.StreamID)\n\t\t\terr := connectstream.Connect(e2e, insideEnd)\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"Error with connected stream (stream=%v): %v\",\n\t\t\t\t\trequest.StreamID, err)\n\t\t\t}\n\t\t\tlog.Debugf(\"connecting cleanup stuff (stream=%v)\", request.StreamID)\n\n\t\t\terr = stream.Close()\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"Error while closing connected stream (stream=%v): %v\",\n\t\t\t\t\trequest.StreamID, err)\n\t\t\t}\n\n\t\t\terr = insideEnd.Close()\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"Error while closing insideEnd (stream=%v): %v\",\n\t\t\t\t\trequest.StreamID, err)\n\t\t\t}\n\n\t\t}()\n\t}()\n\n\t// send header packet (to non-encrypted stream)\n\t_, err = stream.Write(netPacket)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlog.Debugf(\"sent welcome (stream=%v)\", request.StreamID)\n\n\t// read magic number\n\tvar respBuf [1]byte\n\t_, err = e2e.Read(respBuf[:])\n\tif err != nil {\n\t\treturn nil, errors.Errorf(\"failed to read magic byte (stream=%v): %v\", request.StreamID, err)\n\t}\n\n\tlog.Debugf(\"got magic (stream=%v)\", request.StreamID)\n\n\t// check magic byte\n\tif respBuf[0] != MagicWelcomeByte {\n\t\treturn nil, errors.Errorf(\"bad magic response number %v (stream=%v)\", respBuf[0], request.StreamID)\n\t}\n\n\t// establish encrypted connection\n\tconnectionEstablished = true\n\treturn returnEnd, nil\n}", "title": "" }, { "docid": "3f05f24c1e1e63f338cd7dc3243be6a4", "score": "0.5503219", "text": "func TestRPCConn(t testing.T) (*rpc.Client, *rpc.Server) {\n\tclientConn, serverConn := TestConn(t)\n\n\tserver := rpc.NewServer()\n\tgo server.ServeConn(serverConn)\n\n\tclient := rpc.NewClient(clientConn)\n\treturn client, server\n}", "title": "" }, { "docid": "8d676340fead9ea69249669792bcc710", "score": "0.55008924", "text": "func Dial(ctx context.Context, server, nick, fullname, pass string) (*Client, error) {\n\tvar dialer net.Dialer\n\tc, err := dialer.DialContext(ctx, \"tcp\", server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn dial(ctx, c, server, nick, fullname, pass)\n}", "title": "" }, { "docid": "f99386f6a074064dd0369e5e368703b7", "score": "0.54901135", "text": "func (c *Client) Connect(ctx context.Context, proxyBrokerURL string) (*api.CommandConnected, error) {\n\treturn c.connector.connect(ctx, \"\", proxyBrokerURL)\n}", "title": "" }, { "docid": "2a4fe4774e5dfb2d7a19d86c9fa8ffc7", "score": "0.54891086", "text": "func (app *Application) connect(ctx context.Context, onProgress func(*protocol.ProgressParams)) (*connection, error) {\n\tswitch {\n\tcase app.Remote == \"\":\n\t\tclient := newClient(app, onProgress)\n\t\tserver := lsp.NewServer(cache.NewSession(ctx, cache.New(nil), app.options), client)\n\t\tconn := newConnection(server, client)\n\t\tif err := conn.initialize(protocol.WithClient(ctx, client), app.options); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn conn, nil\n\n\tcase strings.HasPrefix(app.Remote, \"internal@\"):\n\t\tinternalMu.Lock()\n\t\tdefer internalMu.Unlock()\n\t\topts := source.DefaultOptions().Clone()\n\t\tif app.options != nil {\n\t\t\tapp.options(opts)\n\t\t}\n\t\tkey := fmt.Sprintf(\"%s %v %v %v\", app.wd, opts.PreferredContentFormat, opts.HierarchicalDocumentSymbolSupport, opts.SymbolMatcher)\n\t\tif c := internalConnections[key]; c != nil {\n\t\t\treturn c, nil\n\t\t}\n\t\tremote := app.Remote[len(\"internal@\"):]\n\t\tctx := xcontext.Detach(ctx) //TODO:a way of shutting down the internal server\n\t\tconnection, err := app.connectRemote(ctx, remote)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tinternalConnections[key] = connection\n\t\treturn connection, nil\n\tdefault:\n\t\treturn app.connectRemote(ctx, app.Remote)\n\t}\n}", "title": "" } ]
85ee0cc27ae3c2969ad58cfbacb49d83
NewUpdateRobotNotFound creates a UpdateRobotNotFound with default headers values
[ { "docid": "b374570a3c7fbeb01da94a50d6d50850", "score": "0.6769756", "text": "func NewUpdateRobotNotFound() *UpdateRobotNotFound {\n\treturn &UpdateRobotNotFound{}\n}", "title": "" } ]
[ { "docid": "55124438ac706495ce56f60cbfc2401e", "score": "0.6028253", "text": "func NewUpdateRobotV1NotFound() *UpdateRobotV1NotFound {\n\treturn &UpdateRobotV1NotFound{}\n}", "title": "" }, { "docid": "99fe8c9f859689cbb7ebadb5c2c58fa3", "score": "0.5846288", "text": "func NewNotFound() (int, http.Header, interface{}, error) {\n\treturn http.StatusNotFound, nil, nil, NotFoundError{ErrContentNotFound}\n}", "title": "" }, { "docid": "a9adcc30f8ee0f6f6176d84c642e6f6c", "score": "0.57913166", "text": "func NewUpdateTechNotFound(body *UpdateTechNotFoundResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "cf44466a27c8d2cbd0761d7c1b2f68ee", "score": "0.5693183", "text": "func NewRefreshNotFound(body *RefreshNotFoundResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "acee6449e4c452e1ea6f12b3a08bb9ac", "score": "0.56557834", "text": "func NewWeaviateThingsUpdateNotFound() *WeaviateThingsUpdateNotFound {\n\treturn &WeaviateThingsUpdateNotFound{}\n}", "title": "" }, { "docid": "acb96e4dda28395c65696885d7a26d94", "score": "0.55996305", "text": "func NewPatchNotFound(name string, id string, message string, temporary bool, timeout bool, fault bool) *goa.ServiceError {\n\tv := &goa.ServiceError{}\n\tv.Name = name\n\tv.ID = id\n\tv.Message = message\n\tv.Temporary = temporary\n\tv.Timeout = timeout\n\tv.Fault = fault\n\n\treturn v\n}", "title": "" }, { "docid": "88e96228e50c37893fc0edb7dee7f2f5", "score": "0.549284", "text": "func NewHeadNotFound(name string, id string, message string, temporary bool, timeout bool, fault bool) *goa.ServiceError {\n\tv := &goa.ServiceError{}\n\tv.Name = name\n\tv.ID = id\n\tv.Message = message\n\tv.Temporary = temporary\n\tv.Timeout = timeout\n\tv.Fault = fault\n\n\treturn v\n}", "title": "" }, { "docid": "cd2efd67ed76184eea88d65297e2c2cb", "score": "0.54777867", "text": "func NewNotFound(err error) error {\n\treturn NewBadRequestStatus(err, \"Not found\", http.StatusNotFound)\n}", "title": "" }, { "docid": "d33fbb1328f3f23aad7d414d5e59c595", "score": "0.5431079", "text": "func NewUpdateRobotBadRequest() *UpdateRobotBadRequest {\n\treturn &UpdateRobotBadRequest{}\n}", "title": "" }, { "docid": "64e2cd03a853559eb9135cfe13b6a7ef", "score": "0.53011453", "text": "func NewNotFound(err error, msg string) error {\n\treturn &notFound{wrap(err, msg, \"\")}\n}", "title": "" }, { "docid": "44799076c1b32dc8989aafb660a0f883", "score": "0.52807504", "text": "func NewUpdateTodoNotFound() *UpdateTodoNotFound {\n\treturn &UpdateTodoNotFound{}\n}", "title": "" }, { "docid": "ddb3b3d2cf983b11c073a9fb8fbbff75", "score": "0.52768046", "text": "func newErrNotFound(msg string, err error) error {\n\treturn &ErrNotFound{\n\t\tmyError: myError{\n\t\t\tmsg: msg,\n\t\t\twerr: err,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "95e8a89e35fc25adb0e44af5865112c6", "score": "0.52412295", "text": "func (w *updateSourceResponseWriter) NotFound(err error) {\n\truntime.WriteError(w, 404, err)\n}", "title": "" }, { "docid": "3e019eb409deb094eb2389022c22cf07", "score": "0.52390367", "text": "func NewNotFound(message string) *RestError {\n\treturn &RestError{\n\t\tMessage: message,\n\t\tStatus: http.StatusNotFound,\n\t\tError: \"not_found\",\n\t}\n}", "title": "" }, { "docid": "afb2ccc301cea4a689f908bf2abeae3b", "score": "0.5208965", "text": "func NewSecretUpdateNotFound() *SecretUpdateNotFound {\n\treturn &SecretUpdateNotFound{}\n}", "title": "" }, { "docid": "18c3bc2ef42c202a6f68f535e5fc9956", "score": "0.52030087", "text": "func NewGetUserRobotNotFound() *GetUserRobotNotFound {\n\treturn &GetUserRobotNotFound{}\n}", "title": "" }, { "docid": "0b33d9c4c03c36169d101890ad02c124", "score": "0.5196265", "text": "func NewUpdateWopiDocuemntContentNotFound() *UpdateWopiDocuemntContentNotFound {\n\treturn &UpdateWopiDocuemntContentNotFound{}\n}", "title": "" }, { "docid": "577f5b204d52ff269147b01cbb80be71", "score": "0.51893675", "text": "func TestUpdateNotFound(t *testing.T) {\n\n\tname := \"testname\"\n\n\tupdater := AutoscalerUpdater{\n\t\t&mockHorizontalPodAutoscalerNotFound{},\n\t}\n\n\terr := updater.Update(name, &AutoscalerUpdate{})\n\tif !errors.IsNotFound(err) {\n\t\tt.Errorf(\"Unexpected error for not found %v\", err)\n\t}\n}", "title": "" }, { "docid": "c9916ea522b1fdbe60468fa6b66ab616", "score": "0.5182204", "text": "func NewGetRobotByIDNotFound() *GetRobotByIDNotFound {\n\treturn &GetRobotByIDNotFound{}\n}", "title": "" }, { "docid": "7e0b2a255120fe4048dc5c59876de2aa", "score": "0.5172983", "text": "func NotFoundHandlerUpdate(cfg *config.Config,\n\tredis *redis.Client,\n\tbot *tgbotapi.BotAPI,\n\tupdate *tgbotapi.Update,\n) error {\n\tmsg := tgbotapi.NewMessage(update.Message.Chat.ID, msgs.MsgCantUnderstand)\n\t_, err := bot.Send(msg)\n\treturn err\n}", "title": "" }, { "docid": "c4e47c92014016f3cbb636266a6c3a80", "score": "0.51717716", "text": "func HttpNotFound(resp *api.Response, message string) string {\n\tresp.Status = http.StatusNotFound\n\n\treturn message\n}", "title": "" }, { "docid": "96f9183fb8a27950dba76da860bdf52d", "score": "0.5151885", "text": "func DefineNotFound(name, messageFormat string, publicAttributes ...string) *Definition {\n\tdef := define(uint32(codes.NotFound), name, messageFormat, publicAttributes...)\n\treturn def\n}", "title": "" }, { "docid": "43485ea7859ebcbcc7fca5119e7e8758", "score": "0.5138546", "text": "func NewNotFound(name string, uid string) *StatusError {\n\tvar message string\n\tif len(uid) > 0 {\n\t\tmessage = fmt.Sprintf(\"%s (%s) not found\", name, uid)\n\t} else {\n\t\tmessage = fmt.Sprintf(\"%s not found\", name)\n\t}\n\treturn &StatusError{Status{\n\t\tStatus: StatusFailure,\n\t\tCode: http.StatusNotFound,\n\t\tReason: StatusReasonNotFound,\n\t\tDetails: &StatusDetails{\n\t\t\tName: name,\n\t\t\tUID: uid,\n\t\t},\n\t\tMessage: message,\n\t}}\n}", "title": "" }, { "docid": "2935e9d07cab2cb6f64cf311f9055160", "score": "0.51242095", "text": "func RespNotFound() *HTTPResponse {\r\n\tresp := RespOK()\r\n\tresp.status = \"NOT FOUND\"\r\n\tresp.code = 404\r\n\treturn resp\r\n}", "title": "" }, { "docid": "d2780dcb36c9780607cfb74f5f497779", "score": "0.5114915", "text": "func NotFound(rw http.ResponseWriter, r *http.Request) {\n\tt, _ := template.New(\"beegoerrortemp\").Parse(errtpl)\n\t// template.New(\"sd\").ParseFiles(...)\n\tdata := make(map[string]interface{})\n\tdata[\"Title\"] = \"Page Not Found\"\n\tdata[\"Url\"] = r.URL\n\t//rw.WriteHeader(http.StatusNotFound)\n\tt.Execute(rw, data)\n}", "title": "" }, { "docid": "b7fa6942d4088227ff6c4c1c5ab1a355", "score": "0.50845414", "text": "func TestUpdateNotFound(t *testing.T) {\n\ttodoService := NewInmemTodoService()\n\n\tusername := \"test@test.com\"\n\n\ttodo := Todo{\n\t\tID: xid.New().String(),\n\t\tUsername: username,\n\t\tText: \"Finish off this microservice\",\n\t\tCompleted: false,\n\t}\n\n\terr := todoService.Update(context.Background(), todo.ID, todo)\n\trequire.EqualError(t, err, \"Not found\", \"Not found error expected to be returned\")\n}", "title": "" }, { "docid": "a3f028f82f20399d9a7a83a780a7cd07", "score": "0.5050605", "text": "func errorNotFound() (string, error, int) {\n return \"\", errors.New(\"Requested URL not found\"), http.StatusNotFound\n}", "title": "" }, { "docid": "10624a5ddf325f1b85e8472afe46a006", "score": "0.5047811", "text": "func (vars V) StatusNotFound() {\n\tvars.Status(http.StatusNotFound)\n}", "title": "" }, { "docid": "ee8928eab884d99088982868f8924010", "score": "0.5031855", "text": "func NewNotFound(hash common.Hash) msgCommon.Message {\n\tvar notFound msgCommon.NotFound\n\tnotFound.Hash = hash\n\n\treturn &notFound\n}", "title": "" }, { "docid": "485780b5295a796b38be327537fc3ebe", "score": "0.5029527", "text": "func NewNotFound(s string) error {\n\treturn notFoundError{s: s}\n}", "title": "" }, { "docid": "fa29c8cc19bd1e2fcbd6c76d6327fbf5", "score": "0.50244355", "text": "func NewNotFound(group string, name string) *StatusError {\n\treturn &StatusError{\n\t\thttpCode: http.StatusNotFound,\n\t\tDetails: detailError{\n\t\t\tMessage: fmt.Sprintf(\"%s %q not found\", group, name),\n\t\t\tCode: notFoundError,\n\t\t},\n\t\tstack: callers(),\n\t}\n}", "title": "" }, { "docid": "751afe82995cff76865aafe2aa1d0c91", "score": "0.5021053", "text": "func TestNewNotFound(t *testing.T) {\n\trunTest(t, func(s *res.Service) {\n\t\t//lint:ignore SA1019 to allow test of deprecated feature\n\t\ts.Handle(\"collection\", res.New(func(r res.NewRequest) {\n\t\t\tr.NotFound()\n\t\t}))\n\t}, func(s *restest.Session) {\n\t\ts.Call(\"test.collection\", \"new\", nil).\n\t\t\tResponse().\n\t\t\tAssertError(res.ErrNotFound)\n\t})\n}", "title": "" }, { "docid": "b0bd08b323f0e6107e0e1c9fc0dc1c9c", "score": "0.5011645", "text": "func UpdateNotFound(t *testing.T, repo rel.Repository) {\n\tvar (\n\t\tuser = User{\n\t\t\tID: 0,\n\t\t\tName: \"update\",\n\t\t}\n\t)\n\n\t// update unchanged\n\tassert.Equal(t, rel.NotFoundError{}, repo.Update(ctx, &user))\n}", "title": "" }, { "docid": "baa7ef3bdf821a29e5a90a08e93ec94d", "score": "0.49980044", "text": "func notFound(http_reply http.ResponseWriter, request *http.Request) {\n\tif MAIN_config.Debug_On {\n\t\tdisplayURLRequest(request)\n\t} // display url data\n\n\ttype notFoundReply struct {\n\t\tStatus string `json:\"status\"`\n\t\tMessage string `json:\"error_message\"`\n\t\tDocumentationUrl string `json:\"documentation_url\"`\n\t}\n\n\treplyData := notFoundReply{Status: \"failed\",\n\t\tMessage: \"Not Found\",\n\t\tDocumentationUrl: \"https://github.com/Wind-river/sparts\"}\n\thttpSendReply(http_reply, replyData)\n}", "title": "" }, { "docid": "17e1232eb4809efd99cfc5a15020225f", "score": "0.4996758", "text": "func notFound(w http.ResponseWriter, r *http.Request) {\n\twriteErrorResponse(w, r,\n\t\thttpError(http.StatusNotFound, \"Not Found\"))\n}", "title": "" }, { "docid": "28ac7371e581c299c02364eef7876c8a", "score": "0.49892458", "text": "func (w *updateAppResponseWriter) NotFound(err error) {\n\truntime.WriteError(w, 404, err)\n}", "title": "" }, { "docid": "ce375b0873901fcf89bf5c66e7ab3bde", "score": "0.4988385", "text": "func ResourceNotFound(w http.ResponseWriter, r *http.Request, message string) {\n\tCommReply(w, r, http.StatusNotFound, message)\n}", "title": "" }, { "docid": "ba29b43a0ec4542f3406b6c98192605a", "score": "0.49878752", "text": "func NewResourceControlUpdateNotFound() *ResourceControlUpdateNotFound {\n\treturn &ResourceControlUpdateNotFound{}\n}", "title": "" }, { "docid": "616e4963181a16385e1533149064517f", "score": "0.4952718", "text": "func pageNotFound(rw http.ResponseWriter, r *http.Request) {\n\tm := `{status:\"fail\",\"description\":\"api not supported\"}`\n\tt, _ := template.New(\"beegoerrortemp\").Parse(m)\n\tt.Execute(rw, nil)\n}", "title": "" }, { "docid": "f7744fafc0d5a1e5a68685d38265299c", "score": "0.49419612", "text": "func NewNotFound(kind, namespace, name string) *NotFound {\n\treturn &NotFound{kind: kind, namespace: namespace, name: name}\n}", "title": "" }, { "docid": "db574ee66b03bb1b7762cd1e7ae3da31", "score": "0.49300432", "text": "func NewUpdateRobotOK() *UpdateRobotOK {\n\treturn &UpdateRobotOK{}\n}", "title": "" }, { "docid": "4f9773d86e2a18f1a09cfce58e7ea52b", "score": "0.49259993", "text": "func NotFound(w http.ResponseWriter, r *http.Request) {\n\t// TODO: Complete this function\n}", "title": "" }, { "docid": "b191ae434c9cfc8060cdb32cc08916a8", "score": "0.49233073", "text": "func NewUpdateNotFoundResponseBody(res *goa.ServiceError) *UpdateNotFoundResponseBody {\n\tbody := &UpdateNotFoundResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "title": "" }, { "docid": "b191ae434c9cfc8060cdb32cc08916a8", "score": "0.49233073", "text": "func NewUpdateNotFoundResponseBody(res *goa.ServiceError) *UpdateNotFoundResponseBody {\n\tbody := &UpdateNotFoundResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "title": "" }, { "docid": "10da77521f1a701c45d5e1fef65ed5b3", "score": "0.49166226", "text": "func NewUpdateModelRegistryNotFound() *UpdateModelRegistryNotFound {\n\treturn &UpdateModelRegistryNotFound{}\n}", "title": "" }, { "docid": "e833f7971614d620fa345c92aaf9394f", "score": "0.49142116", "text": "func NewWebhookNotFound(body *WebhookNotFoundResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "c0a1c3062cc9b12380a7a5ec5921fca8", "score": "0.49139893", "text": "func ErrNotFound() *Error {\n\treturn newStandardError(http.StatusNotFound)\n}", "title": "" }, { "docid": "505409e1388fb97642a71c8a3f763636", "score": "0.48743942", "text": "func NewServiceEditNotFound() *ServiceEditNotFound {\n\n\treturn &ServiceEditNotFound{}\n}", "title": "" }, { "docid": "22bb6cc8e079705da84068022fc55b25", "score": "0.48637703", "text": "func NewAPIUpdateApikeyNotFound() *APIUpdateApikeyNotFound {\n\treturn &APIUpdateApikeyNotFound{}\n}", "title": "" }, { "docid": "08d9d90d43dfb8bccb92b66ddc58be0b", "score": "0.48630533", "text": "func NotFound(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusNotFound)\n\tw.Write([]byte(`\n\t{\n\t\t\"message\": \"not found\",\n\t\t\"owner\": \"mpermperpisang\",\n\t\t\"command\": [{\n\t\t\t\"GET1\": \"/example\",\n\t\t\t\"GET2\": \"/biodata\",\n\t\t\t\"GET3\": \"/biodata/{id}\",\n\t\t\t\"POST\": \"/biodata\",\n\t\t\t\"PATCH\": \"/biodata/{id}\",\n\t\t\t\"DELETE\": \"/biodata/{id}\"\n\t\t}]\n\t}`))\n}", "title": "" }, { "docid": "97d5646b91d88690a29959f7dd8f7982", "score": "0.48630518", "text": "func TestNewMethodNotFound(t *testing.T) {\n\trunTest(t, func(s *res.Service) {\n\t\t//lint:ignore SA1019 to allow test of deprecated feature\n\t\ts.Handle(\"collection\", res.New(func(r res.NewRequest) {\n\t\t\tr.MethodNotFound()\n\t\t}))\n\t}, func(s *restest.Session) {\n\t\ts.Call(\"test.collection\", \"new\", nil).\n\t\t\tResponse().\n\t\t\tAssertError(res.ErrMethodNotFound)\n\t})\n}", "title": "" }, { "docid": "d1caa18f7830f2acf99d7cb8a14cbb4f", "score": "0.486282", "text": "func NewUpdateRobotV1BadRequest() *UpdateRobotV1BadRequest {\n\treturn &UpdateRobotV1BadRequest{}\n}", "title": "" }, { "docid": "612ba51ba4f8a73b4520492905f6fbe2", "score": "0.48619777", "text": "func NewUpdateServiceNotFound() *UpdateServiceNotFound {\n\treturn &UpdateServiceNotFound{}\n}", "title": "" }, { "docid": "97226a9208bb361650891e8b51f58d40", "score": "0.485602", "text": "func NewConfigUpdateNotFound() *ConfigUpdateNotFound {\n\treturn &ConfigUpdateNotFound{}\n}", "title": "" }, { "docid": "b2eccf58377924ae958d8fe31e99f25e", "score": "0.48482725", "text": "func NotFoundDefault(w http.ResponseWriter, r *http.Request) {\n\tw.WriteHeader(404)\n}", "title": "" }, { "docid": "63439e8fdcedb02b3a57565733482a77", "score": "0.4848162", "text": "func (s *TestSuite) TestFindBadRequest(c *C) {\n\n\t// when\n\turl := fmt.Sprintf(\"%s/location/%s\", s.host, \"asd\")\n\tr, err := rest.MakeRequest(\"GET\", url, nil)\n\terr = rest.ProcessResponseEntity(r, nil, http.StatusOK)\n\n\t// then\n\tc.Assert(err, Equals, rest.ErrStatusBadRequest)\n}", "title": "" }, { "docid": "3d89c6b63d21c52d98a7e2a079b84ca5", "score": "0.48415592", "text": "func NotFound(w http.ResponseWriter, r *http.Request) {\n\tlog.Printf(\"%s\\t%s\\t%s\\t%s\\t%d\\t%d\\t%d\",\n\t\tr.RemoteAddr,\n\t\tr.Method,\n\t\tr.RequestURI,\n\t\tr.Proto,\n\t\thttp.StatusNotFound,\n\t\t0,\n\t\t0,\n\t)\n\tw.WriteHeader(http.StatusNotFound)\n}", "title": "" }, { "docid": "63636e5025c95e54405aa8425871965c", "score": "0.48389775", "text": "func notFoundHandler(w http.ResponseWriter, r *http.Request, dbUtils *DatabaseUtils) *apiError {\n\treturn &apiError{\n\t\t\"notFoundHandler\",\n\t\terrors.New(\"Not Found\"),\n\t\t\"Not Found\",\n\t\thttp.StatusNotFound,\n\t}\n}", "title": "" }, { "docid": "98e2bcb6fb1c8d749b28f1d250e664d4", "score": "0.48373106", "text": "func updateNotExists(err error) bool {\n\tif err == nil {\n\t\treturn false\n\t}\n\tawsErr, ok := err.(awserr.Error)\n\tif ok && awsErr.Code() == \"ResourceNotFoundException\" &&\n\t\tstrings.HasPrefix(awsErr.Message(), \"No update found for\") {\n\t\treturn true\n\t}\n\t// An error occurred (ResourceNotFoundException) when calling the DescribeUpdate operation: No update found for ID: 10bddb13-a71b-425a-b0a6-71cd03e59161\n\treturn strings.Contains(err.Error(), \"No update found\")\n}", "title": "" }, { "docid": "44e1b770960d177fa269e3e8e73636dc", "score": "0.48337397", "text": "func NewTechListNotFound(body *TechListNotFoundResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "e6a3f6ce4c47cab498b0aa5ff5cd9eae", "score": "0.48331746", "text": "func NewUpdateByNameUsingPUT2NotFound() *UpdateByNameUsingPUT2NotFound {\n\treturn &UpdateByNameUsingPUT2NotFound{}\n}", "title": "" }, { "docid": "0ec4e51551a06ebb4fa73947afc7cea7", "score": "0.4830654", "text": "func NewUpdateAppNotFound() *UpdateAppNotFound {\n\n\treturn &UpdateAppNotFound{}\n}", "title": "" }, { "docid": "4c3a930c06a211803563ce7a1f98805a", "score": "0.48302257", "text": "func NewNotFound() http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tresponse.WriteErrorString(w, http.StatusNotFound, fmt.Sprintf(\"%s %s not found\", r.Method, r.RequestURI))\n\t})\n}", "title": "" }, { "docid": "2bd35704ce13d2c9ec45cd3a1a7bd303", "score": "0.48282546", "text": "func NewNotFoundf(s string, i ...interface{}) error {\n\treturn notFoundError{s: fmt.Sprintf(s, i...)}\n}", "title": "" }, { "docid": "5ea0c1f3ac0af62841efeb4a9dbaca3f", "score": "0.48233378", "text": "func NewUpdateReweighNotFound() *UpdateReweighNotFound {\n\treturn &UpdateReweighNotFound{}\n}", "title": "" }, { "docid": "1dd009769f900a297808b01d9f66aeb0", "score": "0.48200357", "text": "func NewResourceInfoNotFound() *ResourceInfoNotFound {\n\n\treturn &ResourceInfoNotFound{}\n}", "title": "" }, { "docid": "262888c950470731af5070efc1f2c0c2", "score": "0.4818048", "text": "func (client *LROsClient) putNoHeaderInRetryCreateRequest(ctx context.Context, product Product, options *LROsClientBeginPutNoHeaderInRetryOptions) (*policy.Request, error) {\n\turlPath := \"/lro/put/noheader/202/200\"\n\treq, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\tif err := runtime.MarshalAsJSON(req, product); err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "32865e00f6d7d265fec1e4b271f554dd", "score": "0.48047858", "text": "func NewDeleteNotFound(name string, id string, message string, temporary bool, timeout bool, fault bool) *goa.ServiceError {\n\tv := &goa.ServiceError{}\n\tv.Name = name\n\tv.ID = id\n\tv.Message = message\n\tv.Temporary = temporary\n\tv.Timeout = timeout\n\tv.Fault = fault\n\n\treturn v\n}", "title": "" }, { "docid": "d834b1932f5ee2b5ce649d469ae27fd5", "score": "0.48038647", "text": "func handleNotFound(rq *message.HTTPRequest, rsp *message.HTTPResponse) {\n\tlog.Tracef(\"returning 404 for %v %v\", rq.Method, rq.RequestURI)\n\trsp.Status = message.StatusNotFound\n\trsp.SetStringBody(notFound)\n}", "title": "" }, { "docid": "bd3b21c94bf1749bba24e06b6849aab2", "score": "0.48000842", "text": "func NewUpdateMTOServiceItemNotFound() *UpdateMTOServiceItemNotFound {\n\n\treturn &UpdateMTOServiceItemNotFound{}\n}", "title": "" }, { "docid": "75a1e79980a1334a76b1702df8ff8a44", "score": "0.47921082", "text": "func NotFound(w http.ResponseWriter, r *http.Request) (int, string, http.ResponseWriter) {\n\treturn http.StatusNotFound, http.StatusText(http.StatusNotFound) + \" (\" + getRequestMessage(r) + \")\", w\n}", "title": "" }, { "docid": "d380c4cda620937dcf82eb74cde3f959", "score": "0.47916692", "text": "func TestNotFound(t *testing.T) {\n\tmakeRequest(t, \"GET\", \"/404\", \"\", 404, \"404 page not found\\n\", false)\n}", "title": "" }, { "docid": "52379e7ee8c7041f808dc546037fa5e1", "score": "0.47726047", "text": "func NewConfigurationNotFound(body *ConfigurationNotFoundResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "499de0f0b41c5233a84e940f12527073", "score": "0.47677478", "text": "func NewGetNotFound(body *GetNotFoundResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "4177bc1db0a0c57a8846513be6537ba2", "score": "0.47676176", "text": "func NotFound(message string) *AppError { // 404\n\treturn &AppError{http.StatusNotFound, message}\n}", "title": "" }, { "docid": "025ac53519d64db76d319be02676fc02", "score": "0.4767462", "text": "func MatchVersionableNotFound(responseBody *utilhttp.Response) {\n\tgm.Expect(responseBody.Status.HTTPStatusCode).To(gm.Equal(fconstants.HTTPCode(http.StatusNotFound)))\n\tgm.Expect(responseBody.Status.Errors[0].Code).To(gm.Equal(fconstants.APPErrorCode(1601)))\n\tgm.Expect(responseBody.Status.Errors[0].Message).To(gm.Equal(\"Versionable not found in version manager\"))\n\t//TODO\n\t//gm.Expect(responeBody.DebugData).To(gm.Equal(\"\"))\n}", "title": "" }, { "docid": "e50155aa44ffbdb10cd244643370d760", "score": "0.47665685", "text": "func (ctx *UpdateEventContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "title": "" }, { "docid": "31c85f760a646ed3c64821a240b83a02", "score": "0.47659206", "text": "func StatusNotFound(w http.ResponseWriter, err error) {\n\terrMsg := RespondMessage(err.Error(), http.StatusNotFound)\n\tResponseWriter(w, http.StatusNotFound, errMsg)\n}", "title": "" }, { "docid": "3c0a00d4e2ecde7d5c51407c48c928b2", "score": "0.4763135", "text": "func MethodNotFound(message string, data interface{}) *Error {\n\treturn &Error{Code: -32601, Message: message, Data: data}\n}", "title": "" }, { "docid": "41cf8c9e45262e9561638d1305901f4e", "score": "0.47613344", "text": "func (ctx *UpdateProjectContext) NotFound() error {\n\tctx.ResponseData.WriteHeader(404)\n\treturn nil\n}", "title": "" }, { "docid": "803be7dd8dc51a60587e6be65651bb7f", "score": "0.47575378", "text": "func NewUpdateScheduleNotFound() *UpdateScheduleNotFound {\n\n\treturn &UpdateScheduleNotFound{}\n}", "title": "" }, { "docid": "5b52f50fa19c70b7c016884bc6ba30c7", "score": "0.47453377", "text": "func NewUpdateLookmlModelNotFound() *UpdateLookmlModelNotFound {\n\treturn &UpdateLookmlModelNotFound{}\n}", "title": "" }, { "docid": "80f94239e9af6590e4982a35db5cf381", "score": "0.47422487", "text": "func UpdatePodsNotFound(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.PodsController, id int, payload *app.UpdatePodsPayload) (http.ResponseWriter, error) {\n\t// Setup service\n\tvar (\n\t\tlogBuf bytes.Buffer\n\t\tresp interface{}\n\n\t\trespSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }\n\t)\n\tif service == nil {\n\t\tservice = goatest.Service(&logBuf, respSetter)\n\t} else {\n\t\tlogger := log.New(&logBuf, \"\", log.Ltime)\n\t\tservice.WithLogger(goa.NewLogger(logger))\n\t\tnewEncoder := func(io.Writer) goa.Encoder { return respSetter }\n\t\tservice.Encoder = goa.NewHTTPEncoder() // Make sure the code ends up using this decoder\n\t\tservice.Encoder.Register(newEncoder, \"*/*\")\n\t}\n\n\t// Setup request context\n\trw := httptest.NewRecorder()\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"/v1/pods/%v\", id),\n\t}\n\treq, err := http.NewRequest(\"PUT\", u.String(), nil)\n\tif err != nil {\n\t\tpanic(\"invalid test \" + err.Error()) // bug\n\t}\n\tprms := url.Values{}\n\tprms[\"id\"] = []string{fmt.Sprintf(\"%v\", id)}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tgoaCtx := goa.NewContext(goa.WithAction(ctx, \"PodsTest\"), rw, req, prms)\n\tupdateCtx, _err := app.NewUpdatePodsContext(goaCtx, req, service)\n\tif _err != nil {\n\t\te, ok := _err.(goa.ServiceError)\n\t\tif !ok {\n\t\t\tpanic(\"invalid test data \" + _err.Error()) // bug\n\t\t}\n\t\treturn nil, e\n\t}\n\tupdateCtx.Payload = payload\n\n\t// Perform action\n\t_err = ctrl.Update(updateCtx)\n\n\t// Validate response\n\tif _err != nil {\n\t\tt.Fatalf(\"controller returned %+v, logs:\\n%s\", _err, logBuf.String())\n\t}\n\tif rw.Code != 404 {\n\t\tt.Errorf(\"invalid response status code: got %+v, expected 404\", rw.Code)\n\t}\n\tvar mt error\n\tif resp != nil {\n\t\tvar _ok bool\n\t\tmt, _ok = resp.(error)\n\t\tif !_ok {\n\t\t\tt.Fatalf(\"invalid response media: got variable of type %T, value %+v, expected instance of error\", resp, resp)\n\t\t}\n\t}\n\n\t// Return results\n\treturn rw, mt\n}", "title": "" }, { "docid": "fee7ebf033535adf904e90ac1c539413", "score": "0.47397813", "text": "func NotFound(w http.ResponseWriter, details string) error {\n\treturn New(errNotFound, details).write(w, http.StatusNotFound)\n}", "title": "" }, { "docid": "a26be18581c283eef667776e08793627", "score": "0.4737015", "text": "func NewUpdateStatNotFound() *UpdateStatNotFound {\n\treturn &UpdateStatNotFound{}\n}", "title": "" }, { "docid": "ee666a4fca2721a61400cf97954d66d6", "score": "0.4733805", "text": "func Default(w http.ResponseWriter) {\n\tw.WriteHeader(http.StatusNotFound)\n}", "title": "" }, { "docid": "3d621687d798e63782cce1e7471f18c0", "score": "0.473347", "text": "func NewAddUpdateNotFoundResponseBody(res *goa.ServiceError) *AddUpdateNotFoundResponseBody {\n\tbody := &AddUpdateNotFoundResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "title": "" }, { "docid": "814c14070082269a9d3634253d7b4a06", "score": "0.47327828", "text": "func NewUpdateDynamicScanRequestOfProjectVersionNotFound() *UpdateDynamicScanRequestOfProjectVersionNotFound {\n\treturn &UpdateDynamicScanRequestOfProjectVersionNotFound{}\n}", "title": "" }, { "docid": "f65900c243c9c3b000158de531eda631", "score": "0.47257894", "text": "func NewUpdateMTOServiceItemNotFound() *UpdateMTOServiceItemNotFound {\n\treturn &UpdateMTOServiceItemNotFound{}\n}", "title": "" }, { "docid": "2849a6c9775b7f6cb06f02d15ee1fab4", "score": "0.4719133", "text": "func (app *application) notFound(w http.ResponseWriter) {\n\tapp.clientError(w, http.StatusNotFound)\n}", "title": "" }, { "docid": "7eafa1fae10882be3097c8659c63d9df", "score": "0.47176108", "text": "func NewEditNotFound() *EditNotFound {\n\treturn &EditNotFound{}\n}", "title": "" }, { "docid": "ce47a4a7fc23863d9527e29e15f2cc22", "score": "0.4716421", "text": "func NewModifyUpdateNotFoundResponseBody(res *goa.ServiceError) *ModifyUpdateNotFoundResponseBody {\n\tbody := &ModifyUpdateNotFoundResponseBody{\n\t\tName: res.Name,\n\t\tID: res.ID,\n\t\tMessage: res.Message,\n\t\tTemporary: res.Temporary,\n\t\tTimeout: res.Timeout,\n\t\tFault: res.Fault,\n\t}\n\treturn body\n}", "title": "" }, { "docid": "16299b0101c4d8f622dff83674ec0b0b", "score": "0.4716188", "text": "func (e notFoundError) NotFound() {}", "title": "" }, { "docid": "c610a2f9b36213ce7f0886da301ed915", "score": "0.47093803", "text": "func notFound(w http.ResponseWriter) {\n\tw.WriteHeader(http.StatusNotFound)\n\tw.Header().Set(\"Content-Type\", \"text/html; charset=utf-8\")\n\tfmt.Fprintf(w, \"<!doctype html><title>BlobStash</title><p>%s</p>\\n\", http.StatusText(http.StatusNotFound))\n}", "title": "" }, { "docid": "d5a3180b2b9f2c502b3de1fd59060d5c", "score": "0.47057477", "text": "func apiTerminationHandler(w http.ResponseWriter, r *http.Request, params map[string]string) {\n http.NotFound(w, r)\n}", "title": "" }, { "docid": "065b28f8d1f6588708af93237aae9cf9", "score": "0.47034812", "text": "func WriteNotFound(w http.ResponseWriter, errr *Error) {\n\terrr.Code = http.StatusNotFound\n\to := newNotFound(Ack{Ack: false}, errr)\n\tw.WriteHeader(http.StatusNotFound)\n\terr := gojay.NewEncoder(w).EncodeObject(o)\n\tif err != nil {\n\t\tlogrus.WithError(err).Error(\"could not write NotFound response\")\n\t}\n}", "title": "" }, { "docid": "3dd864f3177554c2a6001330acab6e70", "score": "0.46992013", "text": "func NewGetTechNotFound(body *GetTechNotFoundResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "b5ab5bfccbed15d3ca43308017aad734", "score": "0.46978647", "text": "func NewPatchAgentNotFound() *PatchAgentNotFound {\n\treturn &PatchAgentNotFound{}\n}", "title": "" }, { "docid": "52c6d4ae068ecfb30ec5f93afbe35a58", "score": "0.4697507", "text": "func NewPetUpdateNotFound() *PetUpdateNotFound {\n\n\treturn &PetUpdateNotFound{}\n}", "title": "" }, { "docid": "44ba982e8fec002ba5bda97cb99373b3", "score": "0.46936786", "text": "func NewUpdateRobotUnauthorized() *UpdateRobotUnauthorized {\n\treturn &UpdateRobotUnauthorized{}\n}", "title": "" } ]
fa9a4cdbd7b72ff8d55378536a9d9e20
PID returns a process ID of Docker daemon
[ { "docid": "7e5114a846ea3b41d37fac8e1dba1763", "score": "0.8348394", "text": "func (d *DockerDriver) PID() (int, error) {\n\treturn getDockerPID(\"\")\n}", "title": "" } ]
[ { "docid": "b3fb8cf442742fcdf22b7b00ce86c07d", "score": "0.7194285", "text": "func (p *dockerContainer) ProcessID() int {\n\treturn 0\n}", "title": "" }, { "docid": "0d11958c4f99f050f11136dfc63a66db", "score": "0.70152587", "text": "func (c *Client) ContainerPID(ctx context.Context, id string) (int, error) {\n\tpack, err := c.watch.get(id)\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\treturn int(pack.task.Pid()), nil\n}", "title": "" }, { "docid": "1e296b2a424ff075e4f116a81624702d", "score": "0.68278307", "text": "func (c *Container) Pid() int {\n\treturn c.pid\n}", "title": "" }, { "docid": "af817a59835e76a815c9dd872b6e5a06", "score": "0.67776877", "text": "func DockerID() (string, error) {\n\tif \"linux\" != runtime.GOOS {\n\t\treturn \"\", ErrFeatureUnsupported\n\t}\n\n\tf, err := os.Open(\"/proc/self/cgroup\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer f.Close()\n\n\treturn parseDockerID(f)\n}", "title": "" }, { "docid": "7d902c80f0c15cdbeb8493973377f243", "score": "0.67619216", "text": "func DockerID() (string, error) {\n\tif \"linux\" != runtime.GOOS {\n\t\treturn \"\", ErrDockerUnsupported\n\t}\n\n\tf, err := os.Open(\"/proc/self/cgroup\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer f.Close()\n\n\treturn parseDockerID(f)\n}", "title": "" }, { "docid": "1314e09e39b22c1b638b6015d9bfbf0e", "score": "0.67435324", "text": "func Pid() int {\n\treturn processPid\n}", "title": "" }, { "docid": "b557d81f54b6a2fb677789ad4f908720", "score": "0.67121464", "text": "func (s *Service) Pid() int {\n\ts.stateLock.RLock()\n\tdefer s.stateLock.RUnlock()\n\n\tif s.process != nil {\n\t\treturn s.process.Pid\n\t} else if s.state != nil {\n\t\treturn s.state.Pid()\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "a977e8ae0653217959359d619d587620", "score": "0.67097366", "text": "func (e *local) PID() int {\n\tif e.cmd.Process == nil {\n\t\treturn -1\n\t}\n\treturn e.cmd.Process.Pid\n}", "title": "" }, { "docid": "51de9dd848c44d16818a541e9070d007", "score": "0.66991264", "text": "func getIsuladContainerPid(name string) (int, error) {\n\tcmd := exec.Command(\"isula\", \"inspect\", \"-f\", \"{{json .State.Pid}}\", name)\n\tout, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\treturn -1, fmt.Errorf(\"%s: %v\", string(out), err)\n\t}\n\tstrPid := strings.Trim(string(out), \"\\n\")\n\tpid, err := strconv.Atoi(strPid)\n\tif err != nil {\n\t\treturn -1, fmt.Errorf(\"failed to convert %q to int: %v\", strPid, err)\n\t}\n\treturn pid, nil\n}", "title": "" }, { "docid": "7421d1733c4d597b4ef1f2c94f4af6d6", "score": "0.6653305", "text": "func (p *Process) Pid() (int, error) {\n\tif p.mon == nil || p.cmd.Process == nil {\n\t\treturn 0, ErrorNotRunning\n\t}\n\treturn p.cmd.Process.Pid, nil\n}", "title": "" }, { "docid": "95b94e5512bc50f77428eb6a5b760677", "score": "0.66148096", "text": "func ProcessID() int {\n\treturn os.Getpid()\n}", "title": "" }, { "docid": "91efae25d57fe788f1b3886cf01df6a7", "score": "0.6579442", "text": "func GetContainerPid(containerId string) string{\n\tpath := filepath.Join(\"/var/lib/docker/containers/\",containerId,\"config.v2.json\")\n\n\tfile,err := os.Open(path)\n\tdefer file.Close()\n\tif err != nil {\n\t\tklog.Error(err)\n\t\treturn \"\"\n\t}\n\n\t//read all content\n\tdata,err := ioutil.ReadAll(file)\n\tif err != nil {\n\t\tklog.Error(err)\n\t\treturn \"\"\n\t}\n\n\t// if container is not running, the pid is 0\n\tpid := GetFiledFromJason(strings.Split(\"State/Pid\",\"/\"),data)\n\n\treturn pid\n}", "title": "" }, { "docid": "3ca9adcf9b0ba68f62a47b7d0535bc19", "score": "0.65605056", "text": "func (e *Executor) PID() uint32 {\n\tif e.command.Process != nil {\n\t\treturn uint32(e.command.Process.Pid)\n\t}\n\n\treturn 0\n}", "title": "" }, { "docid": "7e32d663aee60524394a24c90397f2c9", "score": "0.655342", "text": "func (p *process) PID() int {\n\treturn p.pid\n}", "title": "" }, { "docid": "05c2d311e15c346a107da9b85aef5e8d", "score": "0.6526664", "text": "func (c *Commander) Pid() int {\n\tif c.cmd == nil || c.cmd.Process == nil {\n\t\treturn 0\n\t}\n\treturn c.cmd.Process.Pid\n}", "title": "" }, { "docid": "db19103d1e46f981607bdf4bbf4a66af", "score": "0.64859974", "text": "func (d *Docker) SandboxPid() (int, error) {\n\tout, err := do(\"inspect\", \"-f={{.State.Pid}}\", d.Name)\n\tif err != nil {\n\t\treturn -1, fmt.Errorf(\"error retrieving pid: %v\", err)\n\t}\n\tpid, err := strconv.Atoi(strings.TrimSuffix(string(out), \"\\n\"))\n\tif err != nil {\n\t\treturn -1, fmt.Errorf(\"error parsing pid %q: %v\", out, err)\n\t}\n\treturn pid, nil\n}", "title": "" }, { "docid": "1905c98be19b9ef8087cdf04291687fe", "score": "0.6414034", "text": "func RunningDockerId() ([]byte, error) {\n\tout, err := exec.Command(\"/usr/bin/docker\", \"ps\", \"-q\", \"-n=1\", \"-f\", \"status=running\").CombinedOutput()\n\tout = TrimRightNewline(out)\n\treturn out, err\n}", "title": "" }, { "docid": "1e412fc84d152b0891e2ff6b175df4f4", "score": "0.63975996", "text": "func (mp *provider) ContainerIDForPID(pid int) (string, error) {\n\t// FIXME: Figure out how to list PIDs from containers on Windows\n\treturn \"\", fmt.Errorf(\"not supported on windows\")\n}", "title": "" }, { "docid": "ee0a7bcbdc9c91ffac49a5a1cc8f53c5", "score": "0.63181484", "text": "func (p *UnixProcess) Pid() int {\n\treturn p.pid\n}", "title": "" }, { "docid": "ed105a215537be40345cbffc6c6f929c", "score": "0.63117903", "text": "func (s *Service) Getpid() int {\n\treturn os.Getpid()\n}", "title": "" }, { "docid": "fadf9a1c87044268912da8c6d6c46a8f", "score": "0.62803024", "text": "func (e *Execution) DaemonPID() int {\n\treturn e.daemonPid\n}", "title": "" }, { "docid": "240605723ae4087ff2fdef396b786571", "score": "0.62427676", "text": "func (p *PodmanTestIntegration) PodmanPID(args []string) (*PodmanSessionIntegration, int) {\n\tpodmanOptions := p.MakeOptions(args)\n\tfmt.Printf(\"Running: %s %s\\n\", p.PodmanBinary, strings.Join(podmanOptions, \" \"))\n\tcommand := exec.Command(p.PodmanBinary, podmanOptions...)\n\tsession, err := gexec.Start(command, GinkgoWriter, GinkgoWriter)\n\tif err != nil {\n\t\tFail(fmt.Sprintf(\"unable to run podman command: %s\", strings.Join(podmanOptions, \" \")))\n\t}\n\tpodmanSession := &PodmanSession{session}\n\treturn &PodmanSessionIntegration{podmanSession}, command.Process.Pid\n}", "title": "" }, { "docid": "713191008b97b69e617d25d31277320e", "score": "0.6241387", "text": "func (s *server) Pid() int {\n\treturn s.pid\n}", "title": "" }, { "docid": "ebc1e88a9b9003359641465bf322c487", "score": "0.62182075", "text": "func (s *agentRunner) PID() int {\n\ts.mu.RLock()\n\tdefer s.mu.RUnlock()\n\treturn s.pid\n}", "title": "" }, { "docid": "ec25b78816788312ee3cfe381db22026", "score": "0.61713797", "text": "func (c *Gcd) PID() int {\n\tc.processLock.Lock()\n\tpid := c.chromeProcess.Pid\n\tc.processLock.Unlock()\n\treturn pid\n}", "title": "" }, { "docid": "0203704697f548ce6c0bafc6ab80093b", "score": "0.6167911", "text": "func GetPid(app string) string {\n\t// RED the match is not working for non-java apps. If the string is not matched 100% it will fail.\n\tJavaApp = true\n\tpidExp := regexp.MustCompile(\"[0-9]+\")\n\ttermExp := regexp.MustCompile(`pts/[0-9]`)\n\tappPid := \"\"\n\n\t/// the pid for the binary\n\tgoPid := os.Getpid()\n\n\tpsAEF := exec.Command(\"ps\", \"-aef\")\n\n\tout, err := psAEF.Output()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tpsAEF.Start()\n\n\tlines := strings.Split(string(out), \"\\n\")\n\n\tif !JavaApp {\n\t\tfor i := range lines {\n\t\t\tif !strings.Contains(lines[i], strconv.Itoa(goPid)) && !termExp.MatchString(lines[i]) {\n\t\t\t\twords := strings.Split(lines[i], \" \")\n\t\t\t\tfor j := range words {\n\t\t\t\t\tif app == words[j] {\n\t\t\t\t\t\tappPid = pidExp.FindString(lines[i])\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfor i := range lines {\n\t\t\tif strings.Contains(lines[i], app) && !strings.Contains(lines[i], strconv.Itoa(goPid)) && !termExp.MatchString(lines[i]) {\n\t\t\t\tappPid = pidExp.FindString(lines[i])\n\n\t\t\t}\n\t\t}\n\t}\n\tif appPid == \"\" {\n\t\tif Standalone {\n\t\t\tsyslogLog.WithFields(logrus.Fields{\n\t\t\t\t\"check\": \"checkFileHandles\",\n\t\t\t\t\"client\": host,\n\t\t\t\t//\"version\": version.AppVersion(),\n\t\t\t}).Error(`The configured process cannot be found. Did you spell it right?`)\n\t\t\tsensuutil.Exit(\"CONFIGERROR\")\n\t\t} else {\n\t\t\treturn \"\"\n\t\t}\n\t}\n\treturn appPid\n}", "title": "" }, { "docid": "0d33590e3c060f51aaee350b5f724616", "score": "0.6147027", "text": "func (p *ChrootedProcess) GetPID() (int, error) {\n\n\tif p.getState() == NotStarted {\n\t\treturn 0, fmt.Errorf(\"Error getting PID: process has not started\")\n\t}\n\n\treturn p.cmd.Process.Pid, nil\n}", "title": "" }, { "docid": "c12277d7609a40375cc459d3dd4cdb74", "score": "0.60995185", "text": "func (d *Docker) ID() (string, error) {\n\tout, err := do(\"inspect\", \"-f={{.Id}}\", d.Name)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"error retrieving ID: %v\", err)\n\t}\n\treturn strings.TrimSpace(string(out)), nil\n}", "title": "" }, { "docid": "98da9179700d85ad4e1974be73182765", "score": "0.6045932", "text": "func getPID(port string) (string, error) {\n\toutput, err := exec.Command(\"lsof\", []string{\"-sTCP:LISTEN\", \"-i\", \":\" + port}...).CombinedOutput()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"error executing LSOF command: %v\", err)\n\t}\n\n\t// Skip lines before first appearance of \"COMMAND\"\n\tlines := strings.Split(string(output), \"\\n\")\n\ti := 0\n\tfor ; ; i++ {\n\t\tif strings.HasPrefix(lines[i], \"COMMAND\") {\n\t\t\tbreak\n\t\t}\n\t}\n\n\t// second colume is the pid\n\treturn strings.Fields(lines[i+1])[1], nil\n}", "title": "" }, { "docid": "2fab304c27de1f864249bb8c4007538d", "score": "0.6042956", "text": "func (p *CNIPod) GetPid() int {\n\tif p.netTask == nil {\n\t\treturn 0\n\t}\n\treturn p.netTask.RuntimeConf.Pid\n}", "title": "" }, { "docid": "6def022da1651b55d62307b8f2ad0dbe", "score": "0.60077345", "text": "func pid(name string) (int, error) {\n\td, err := os.Open(\"/proc\")\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"pid %s: %w\", name, err)\n\t}\n\tfor {\n\t\tfis, err := d.Readdir(10)\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t} else if err != nil {\n\t\t\treturn 0, fmt.Errorf(\"pid %s: %w\", name, err)\n\t\t}\n\t\tfor _, fi := range fis {\n\t\t\tpid := fi.Name()\n\t\t\tif !fi.IsDir() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tp, err := strconv.ParseInt(pid, 10, 0)\n\t\t\tif err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tb, err := ioutil.ReadFile(\"/proc/\" + pid + \"/stat\")\n\t\t\tif err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tpname := b[bytes.IndexRune(b, '(')+1 : bytes.IndexRune(b, ')')]\n\t\t\tif string(pname) == name {\n\t\t\t\treturn int(p), nil\n\t\t\t}\n\t\t}\n\t}\n\treturn 0, fmt.Errorf(\"pid %s: not found\", name)\n}", "title": "" }, { "docid": "8bd5e2929ef3cb3bc2665b0593538eb7", "score": "0.6006574", "text": "func findMounterPID(mounter string) (int32, error) {\n\tprocs, err := process.Processes()\n\tif err != nil {\n\t\treturn -1, errors.Wrap(err, \"could not list running processes\")\n\t}\n\n\tfor _, proc := range procs {\n\t\t// With 'cros deploy', the underlying cryptohomed binary may be overwritten\n\t\t// which results in a dangling symlink ('/usr/sbin/cryptohomed (deleted)').\n\t\tif exe, err := proc.Exe(); err == nil && exe != \"\" && strings.Contains(exe, mounter) {\n\t\t\treturn proc.Pid, nil\n\t\t}\n\t}\n\n\t// If the mounter process is not found, don't return an error.\n\treturn -1, nil\n}", "title": "" }, { "docid": "377d56fb27b2cf496fefd6d47ba994cb", "score": "0.6001748", "text": "func getPID(port string) (int, error) {\n\toutput, err := exec.Command(\"lsof\", []string{\"-sTCP:LISTEN\", \"-i\", \":\" + port}...).CombinedOutput()\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"error executing LSOF command: %v\", err)\n\t}\n\n\t// Skip lines before first appearance of \"COMMAND\"\n\tlines := strings.Split(string(output), \"\\n\")\n\ti := 0\n\tfor ; ; i++ {\n\t\tif strings.HasPrefix(lines[i], \"COMMAND\") {\n\t\t\tbreak\n\t\t}\n\t}\n\n\t// Second column is the pid.\n\tpid := strings.Fields(lines[i+1])[1]\n\treturn strconv.Atoi(pid)\n}", "title": "" }, { "docid": "d95fd0c4f222a68a22ef510435714871", "score": "0.59881973", "text": "func getNginxPID() int {\n\tdat, err := ioutil.ReadFile(\"/run/nginx.pid\")\n\tif err != nil {\n\t\treturn -1\n\t} else {\n\t\tstr := strings.TrimSpace(string(dat))\n\t\tpid, err := strconv.Atoi(str)\n\t\tif err != nil {\n\t\t\tlog(\"Error: Could not convert \" + str + \" to an int\")\n\t\t\tshutdown(2)\n\t\t\treturn -1\n\t\t}\n\t\treturn pid\n\t}\n}", "title": "" }, { "docid": "9c710f9385a84c3853546e79afab8259", "score": "0.5957246", "text": "func ContainerID() string {\n\t// docker sets the hostname to 12 character hex string\n\tcid := os.Getenv(\"HOSTNAME\")\n\tif len(cid) != 12 {\n\t\treturn \"\"\n\t}\n\treturn cid\n}", "title": "" }, { "docid": "29cf48804970028d5255cc04e13dd576", "score": "0.5943829", "text": "func GetPid(port int, timeout time.Duration) (pid int, err error) {\n\tnetstat := exec.Command(\"netstat\", \"-a\", \"-n\", \"-o\")\n\tfindstr := exec.Command(\"findstr\", fmt.Sprintf(\"%d\", port))\n\tfindstr.Stdin, _ = netstat.StdoutPipe()\n\n\tbuf := new(bytes.Buffer)\n\tfindstr.Stdout = buf\n\tif err = findstr.Start(); err != nil {\n\t\treturn 0, fmt.Errorf(\"error starting findstr: %v\", err)\n\t}\n\tif err = netstat.Run(); err != nil {\n\t\treturn 0, fmt.Errorf(\"error running netstat: %v\", err)\n\t}\n\tif err = findstr.Wait(); err != nil {\n\t\treturn 0, fmt.Errorf(\"error waiting on findstr: %v\", err)\n\t}\n\n\tfirstLine := strings.Split(buf.String(), \"\\n\")[0]\n\tcolumns := strings.Split(firstLine, \" \")\n\n\tid := columns[len(columns)-1]\n\tclean := strings.Trim(id, \" \\r\\n\")\n\treturn strconv.Atoi(clean)\n}", "title": "" }, { "docid": "41eb34f1906e983748097b15f4b0364d", "score": "0.59035546", "text": "func GetProcessPID(name, vdlOut string) string {\n\tfile, err := os.Open(vdlOut)\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\tdefer file.Close()\n\tprocessRegex := regexp.MustCompile(`\\s+processes:\\s+\\{$`)\n\tprocessNameRegex := regexp.MustCompile(`\\s+name:\\s+\"(?P<name>\\w+)\"$`)\n\tprocessPIDRegex := regexp.MustCompile(`\\s+pid:\\s+(?P<id>\\d+)$`)\n\n\tfoundProcess := false\n\tfoundProcessName := false\n\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tline := scanner.Text()\n\t\tif processRegex.MatchString(line) {\n\t\t\tfoundProcess = true\n\t\t\tcontinue\n\t\t}\n\t\tif foundProcess && !foundProcessName {\n\t\t\tmatched := processNameRegex.FindStringSubmatch(line)\n\t\t\tif len(matched) == 2 {\n\t\t\t\tif matched[1] == name {\n\t\t\t\t\tfoundProcessName = true\n\t\t\t\t} else {\n\t\t\t\t\tfoundProcessName = false\n\t\t\t\t\tfoundProcess = false\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tif foundProcess && foundProcessName {\n\t\t\tmatched := processPIDRegex.FindStringSubmatch(line)\n\t\t\tif len(matched) == 2 {\n\t\t\t\treturn matched[1]\n\t\t\t}\n\t\t\tfoundProcess = false\n\t\t\tfoundProcessName = false\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "08ff504a3695611fb2a320ac67fce584", "score": "0.5900009", "text": "func (p PHPDaemonRunning) Identifier() tasks.Identifier {\n\treturn tasks.IdentifierFromString(\"PHP/Daemon/Running\")\n}", "title": "" }, { "docid": "32dac2a764a3a55cf482fd18a425572e", "score": "0.58890617", "text": "func PID(path string) {\n\tif isRunning {\n\t\tpanic(\"GRACE PANIC set pid dir after running.\")\n\t}\n\tdefaultPidDir = &path\n}", "title": "" }, { "docid": "242d555046ff5814f6264302198a9b12", "score": "0.58672506", "text": "func IdentifyProcessOfContainer(socket *Socket, container *container.Container, packet *gopacket.Packet) (process *Process, err error) {\n\targFields := logrus.WithFields(logrus.Fields{\n\t\t\"target_socket\": socket,\n\t\t\"communicated_container\": container,\n\t})\n\targFields.Debug(\"trying to identify process of container\")\n\n\tif cacheRawData, exist := SocketCache.Get(socket.Hash()); exist {\n\t\tvar ok bool\n\t\tprocess, ok = cacheRawData.(*Process)\n\t\tif ok {\n\t\t\targFields.WithField(\"identified_process\", process).Debug(\"the process identified\")\n\t\t\treturn\n\t\t}\n\t\tprocess = nil\n\t}\n\n\tswitch socket.Protocol {\n\tcase layers.LayerTypeTCP, layers.LayerTypeUDP:\n\t\tvar inode uint64\n\t\tinode, err = SearchInodeFromNetOfPid(socket, container.Pid)\n\t\tif err != nil {\n\t\t\targFields.WithField(\"error\", err).Debug(\"failed to indentify process of container\")\n\t\t\treturn\n\t\t}\n\t\tprocess, err = SearchProcessOfContainerFromInode(container, socket, inode)\n\t\tif err != nil {\n\t\t\targFields.WithField(\"warn\", err).Debug(\"could not identify the process by tcp or udp\")\n\t\t\tbreak\n\t\t}\n\t\targFields.WithField(\"identified_process\", process).Debug(\"the process identified\")\n\t\tSocketCache.Set(socket.Hash(), process, 0)\n\t\treturn\n\t}\n\n\t// detect the process of raw socket\n\tvar inodes []uint64\n\tinodes, err = RetrieveAllInodeFromRawOfPid(container.Pid, socket)\n\tif err != nil {\n\t\targFields.WithField(\"error\", err).Debug(\"failed to identify process of container\")\n\t\treturn\n\t}\n\tsuspiciousProcesses := map[Process]struct{}{}\n\tfor _, inode := range inodes {\n\t\tvar suspiciousProcess *Process\n\t\tsuspiciousProcess, err = SearchProcessOfContainerFromInode(container, socket, inode)\n\t\tif err != nil {\n\t\t\targFields.WithField(\"error\", err).Trace(\"process not found\")\n\t\t\tcontinue\n\t\t}\n\t\tsuspiciousProcesses[*suspiciousProcess] = struct{}{}\n\t}\n\tif len(suspiciousProcesses) == 1 {\n\t\tfor suspiciousProcess := range suspiciousProcesses {\n\t\t\tprocess = &suspiciousProcess\n\t\t\targFields.WithField(\"identified_process\", process).Debug(\"the process identified\")\n\t\t\treturn\n\t\t}\n\t}\n\tvar identifier uint16\n\tidentifier, err = CheckIdentifierOfICMP(socket, packet)\n\tif err == nil {\n\t\tidentifierStr := strconv.FormatUint(uint64(identifier), 10)\n\t\tfor suspiciousProcess := range suspiciousProcesses {\n\t\t\tif NSpidExists(suspiciousProcess.ID, identifierStr) {\n\t\t\t\tprocess = &suspiciousProcess\n\t\t\t\targFields.WithField(\"identified_process\", process).Debug(\"the process identified\")\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\n\tresult := make([]*Process, 0, len(suspiciousProcesses))\n\tfor suspiciousProcess := range suspiciousProcesses {\n\t\tresult = append(result, &suspiciousProcess)\n\t}\n\targFields.WithField(\"suspicious_processes\", result).Warn(\"multiple processes detected\")\n\n\terr = errors.New(\"the process not found\")\n\targFields.WithField(\"error\", err).Debug(\"failed to indentify process of container\")\n\treturn\n}", "title": "" }, { "docid": "d54e1dc2a5487dd4e89cee4db51b8547", "score": "0.5834246", "text": "func (c *Client) PID(pid int) (*Stats, error) {\n\treturn c.c.PID(pid)\n}", "title": "" }, { "docid": "0edb488f32972719c2befabe55160494", "score": "0.58286786", "text": "func PPid() int {\n\tif !IsChild() {\n\t\treturn Pid()\n\t}\n\tppidValue := os.Getenv(envKeyPPid)\n\tif ppidValue != \"\" && ppidValue != \"0\" {\n\t\treturn gconv.Int(ppidValue)\n\t}\n\treturn PPidOS()\n}", "title": "" }, { "docid": "f3dd279064e85a0dad2bfb7a5ba545a7", "score": "0.581948", "text": "func (c *Config) GetContainerPid() int {\n\treturn int(c.config.containerPid)\n}", "title": "" }, { "docid": "4669af7abbd82fe3972d5d9a1fcaad52", "score": "0.5816269", "text": "func (p *ProcessState) Pid() int {\n\treturn p.pid\n}", "title": "" }, { "docid": "bbea4f7076edea0d2d30fb9ac67ca05b", "score": "0.57868224", "text": "func GetID() (string, error) {\n\tf, err := os.Open(\"/proc/self/cgroup\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer f.Close()\n\n\treturn getContainerIDFromReader(f)\n}", "title": "" }, { "docid": "348d0f4305c5e4b5def9337b4187a311", "score": "0.5770892", "text": "func (p *UnixProcess) PPid() int {\n\treturn p.ppid\n}", "title": "" }, { "docid": "856bc7735287c538a2a4d2dc97fd4770", "score": "0.5746606", "text": "func (s *PerProcessStat) Pid() string {\n\treturn s.Metrics.Pid\n}", "title": "" }, { "docid": "98b5dd30e303f37ad6104787f5cbef9b", "score": "0.5732418", "text": "func getPostmasterPID(pgData string) (postmasterPID int, err error) {\n\tpidFile := pgData + \"/postmaster.pid\"\n\tpostmasterPID = -1\n\tfile, err := os.Open(pidFile)\n\tif err != nil {\n\t\tlog.Error(\"Can not open PID file \", pidFile)\n\t\treturn postmasterPID, err\n\t}\n\n\tscanner := bufio.NewScanner(file)\n\n\t// Read first line\n\tscanner.Scan()\n\tline := scanner.Text()\n\n\tpostmasterPID, err = strconv.Atoi(line)\n\tif err != nil {\n\t\tlog.Error(\"Can not parse postmaster PID: \", string(line), \" from: \", pidFile)\n\t}\n\n\tif postmasterPID < 1 {\n\t\tlog.Error(\"PID found in \", pidFile, \" is to low: \", postmasterPID)\n\t}\n\treturn postmasterPID, err\n}", "title": "" }, { "docid": "5f518d1459c6dd75c7c5cf3cdd6200af", "score": "0.5730903", "text": "func (d *driver) ID() string {\n\treturn d.Config.Container\n}", "title": "" }, { "docid": "3381cfc7b1fb4b39ffd93dda067176c1", "score": "0.5723888", "text": "func (p *Process) ID() string {\n\treturn p.id\n}", "title": "" }, { "docid": "c226d4eb23c54f9bd7b1244c4b91034a", "score": "0.5710236", "text": "func GetPid(port int, timeout time.Duration) (pid int, err error) {\n\tctx, cancel := context.WithTimeout(context.Background(), timeout)\n\tdefer cancel()\n\n\tcmd := exec.CommandContext(ctx, \"lsof\", \"-t\", \"-i\", fmt.Sprintf(\":%d\", port))\n\tbuf := new(bytes.Buffer)\n\tcmd.Stdout = buf\n\tcmd.Stderr = os.Stderr\n\n\tif err := cmd.Run(); err != nil {\n\t\treturn 0, fmt.Errorf(\"error fetching ports: %v\", err)\n\t}\n\n\tclean := strings.Trim(buf.String(), \" \\n\")\n\treturn strconv.Atoi(clean)\n}", "title": "" }, { "docid": "0eeb5865c8ad78a8836ba5a8927a3299", "score": "0.56911004", "text": "func (t *OpenconfigSystem_System_Processes_Process) GetPid() uint64 {\n\tif t == nil || t.Pid == nil {\n\t\treturn 0\n\t}\n\treturn *t.Pid\n}", "title": "" }, { "docid": "0eeb5865c8ad78a8836ba5a8927a3299", "score": "0.5689718", "text": "func (t *OpenconfigSystem_System_Processes_Process) GetPid() uint64 {\n\tif t == nil || t.Pid == nil {\n\t\treturn 0\n\t}\n\treturn *t.Pid\n}", "title": "" }, { "docid": "c2217d6a8413710074dc3e0c024e3807", "score": "0.56882286", "text": "func (m *Message) PID() (*PID, error) {\n\tps, err := m.Parse(\"PID\")\n\tpst, ok := ps.(*PID)\n\tif ok {\n\t\treturn pst, err\n\t}\n\treturn nil, err\n}", "title": "" }, { "docid": "49667d1d76cb6d7aed51a98d955f596c", "score": "0.56377244", "text": "func (s *KubeServiceService) GetPid(context.Context) (int, error) {\n\treturn -1, ErrNotSupported\n}", "title": "" }, { "docid": "16151e7321c739b5e2cf13ae1d728116", "score": "0.560405", "text": "func getCryptohomeNamespaceMounterPID() (int, error) {\n\tconst exePath = \"/usr/sbin/cryptohome-namespace-mounter\"\n\n\tall, err := process.Pids()\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\n\tfor _, pid := range all {\n\t\tif proc, err := process.NewProcess(pid); err != nil {\n\t\t\t// Assume that the process exited.\n\t\t\tcontinue\n\t\t} else if exe, err := proc.Exe(); err == nil && exe == exePath {\n\t\t\treturn int(pid), nil\n\t\t}\n\t}\n\treturn -1, errors.New(\"mounter process not found\")\n}", "title": "" }, { "docid": "c501fa65869b5f82d2a32fa3eef4dc76", "score": "0.5590002", "text": "func (s *Server) ServerPid(_ bool, pid *int) error {\n\tlog.Print(\"CMD server-pid\")\n\t*pid = os.Getpid()\n\treturn nil\n}", "title": "" }, { "docid": "3027ad201a80a88ffa82eec3c886ff61", "score": "0.5578959", "text": "func (c *PodmanClient) PsID(containerID string) (*iopodman.PsContainer, error) {\n\tfilters := []string{\"id=\" + containerID}\n\tpsInfo, err := c.Ps(filters)\n\tif err == nil {\n\t\tif len(psInfo) == 1 {\n\t\t\treturn &psInfo[0], nil\n\t\t} else {\n\t\t\treturn nil, fmt.Errorf(\"No such container: %s\", containerID)\n\t\t}\n\t}\n\treturn nil, err\n}", "title": "" }, { "docid": "81067c133c5c29779ec756902512109e", "score": "0.55766433", "text": "func pidPath(dir, id string) string {\n\t// If no directory is given we do not write a pid\n\tif dir == \"\" {\n\t\treturn \"\"\n\t}\n\n\treturn filepath.Join(dir, fmt.Sprintf(\"%s.pid\", id))\n}", "title": "" }, { "docid": "9ed085d8beb75d87c93aafdf647945be", "score": "0.55755496", "text": "func (c *Client) ContainerPIDs(ctx context.Context, id string) ([]int, error) {\n\tif !c.lock.Trylock(id) {\n\t\treturn nil, errtypes.ErrLockfailed\n\t}\n\tdefer c.lock.Unlock(id)\n\n\tpack, err := c.watch.get(id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tprocesses, err := pack.task.Pids(ctx)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to get task's pids\")\n\t}\n\n\t// convert []uint32 to []int.\n\tlist := make([]int, 0, len(processes))\n\tfor _, ps := range processes {\n\t\tlist = append(list, int(ps.Pid))\n\t}\n\treturn list, nil\n}", "title": "" }, { "docid": "b0241808354e602608e7695247a0f097", "score": "0.5563808", "text": "func (f *Future) PID() *PID {\n\treturn f.pid\n}", "title": "" }, { "docid": "938b0470a6c5cfa5aa8c514f5cf408ca", "score": "0.55451685", "text": "func getProcess(port string) (pid int, cmd string, args []string, err error) {\n\tpid, err = getPID(port)\n\tif err != nil {\n\t\treturn 0, \"\", nil, fmt.Errorf(\"error getting pid on port: %v\", err)\n\t}\n\n\toutput, err := exec.Command(\"ps\", \"-p\", strconv.Itoa(pid), \"-o\", \"command\").CombinedOutput()\n\tif err != nil {\n\t\treturn 0, \"\", nil, fmt.Errorf(\"error executing PS command: %v\", err)\n\t}\n\n\tline := strings.Split(string(output), \"\\n\")[1]\n\tfields := strings.Fields(line)\n\tif len(fields) == 0 {\n\t\treturn 0, \"\", nil, fmt.Errorf(\"no returned fields\")\n\t}\n\n\treturn pid, fields[0], fields[1:], nil\n}", "title": "" }, { "docid": "13ee01e0bed11d786100a3ebd3a5c097", "score": "0.5530325", "text": "func Pid(packet Packet) (uint16, error) {\n\tif badLen(packet) {\n\t\treturn 0, gots.ErrInvalidPacketLength\n\t}\n\treturn pid(packet), nil\n}", "title": "" }, { "docid": "dc33f1231dc40d8376193aa8f70c0f64", "score": "0.55282205", "text": "func run(args ...string) (c ContainerID, err error) {\n\tstdout, err := exec.Command(\"docker\", append([]string{\"run\", \"-dP\"}, args...)...).Output()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"Error running %s: %v\", strings.Join(args, \" \"), err)\n\t}\n\treturn ContainerID(strings.TrimSpace(string(stdout))), nil\n}", "title": "" }, { "docid": "7304bdf42db8dfadbbb764d34a0f6d8d", "score": "0.550438", "text": "func getProcess(port string) (string, string, []string, error) {\n\tpid, err := getPID(port)\n\tif err != nil {\n\t\treturn \"\", \"\", nil, fmt.Errorf(\"error getting pid on port: %v\", err)\n\t}\n\n\toutput, err := exec.Command(\"ps\", \"-p\", pid, \"-o\", \"command\").CombinedOutput()\n\tif err != nil {\n\t\treturn \"\", \"\", nil, fmt.Errorf(\"error executing PS command: %v\", err)\n\t}\n\n\tline := strings.Split(string(output), \"\\n\")[1]\n\tfields := strings.Fields(line)\n\tif len(fields) == 0 {\n\t\treturn \"\", \"\", nil, fmt.Errorf(\"no returned fields\")\n\t}\n\n\treturn pid, fields[0], fields[1:], nil\n}", "title": "" }, { "docid": "0da41e4c7fac90a0b2f2625b06cf68d4", "score": "0.5493447", "text": "func (t *OpenconfigSystem_System_Processes_Process_State) GetPid() uint64 {\n\tif t == nil || t.Pid == nil {\n\t\treturn 0\n\t}\n\treturn *t.Pid\n}", "title": "" }, { "docid": "1a42e996541af1e161adf23a4253b809", "score": "0.54917014", "text": "func hostPort(t *testing.T, id string) int {\n\tt.Helper()\n\n\tformat := \"--format={{(index (index .NetworkSettings.Ports \\\"8080/tcp\\\") 0).HostPort}}\"\n\tportstr, err := runOutput(\"docker\", \"inspect\", id, format)\n\tif err != nil {\n\t\tt.Fatalf(\"Error getting port: %v\", err)\n\t}\n\tport, err := strconv.Atoi(portstr)\n\tif err != nil {\n\t\tt.Fatalf(\"Error converting port to int: %v\", err)\n\t}\n\tt.Logf(\"Successfully got port: %d\", port)\n\treturn port\n}", "title": "" }, { "docid": "0da41e4c7fac90a0b2f2625b06cf68d4", "score": "0.54914194", "text": "func (t *OpenconfigSystem_System_Processes_Process_State) GetPid() uint64 {\n\tif t == nil || t.Pid == nil {\n\t\treturn 0\n\t}\n\treturn *t.Pid\n}", "title": "" }, { "docid": "e901f5a4181c440e4a3b5973d8c711c7", "score": "0.5490182", "text": "func pidPrefix() string {\n\treturn fmt.Sprintf(\"[%d] \", os.Getpid())\n}", "title": "" }, { "docid": "2ea8888f529386d9ac01a652987e194b", "score": "0.5475099", "text": "func Getpid() (pid int) {\n\treturn unix.Getpid()\n}", "title": "" }, { "docid": "fe76ad2c874067abf2bfc6e6fb28e282", "score": "0.54733425", "text": "func runDaemon(ctx *cli.Context) error {\n\tcmd := exec.Command(os.Args[0], \"run\")\n\tcmd.Start()\n\tfmt.Println(\"Daemon process ID is : \", cmd.Process.Pid)\n\tsavePID(cmd.Process.Pid)\n\tos.Exit(0)\n\treturn nil\n}", "title": "" }, { "docid": "6ec74e958fa94cf709ed1036675db4f2", "score": "0.545398", "text": "func (t *System_Process) GetPid() uint64 {\n\tif t == nil || t.Pid == nil {\n\t\treturn 0\n\t}\n\treturn *t.Pid\n}", "title": "" }, { "docid": "a8ac17f6a22a1be161bbe800f4ca9434", "score": "0.5430419", "text": "func getIsuladContainerID(name string) (string, error) {\n\tcmd := exec.Command(\"isula\", \"inspect\", \"-f\", \"{{json .Id}}\", name)\n\tout, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"%s: %v\", string(out), err)\n\t}\n\treturn strings.Trim(strings.Trim(string(out), \"\\n\"), \"\\\"\"), nil\n}", "title": "" }, { "docid": "96109fb9c45f887e7a737d5f0838117f", "score": "0.54200673", "text": "func getCurrentPid() int {\n\t// pid file\n\tfilepath := \"./log/pid.log\"\n\tfin, err := os.OpenFile(filepath, os.O_RDONLY, 0777)\n\tif err != nil {\n\t\tglog.Errorln(err)\n\t\treturn 0\n\t}\n\tdefer fin.Close()\n\t// read current pid\n\tbuf := make([]byte, 1024)\n\n\tn, _ := fin.Read(buf)\n\tif 0 >= n {\n\t\treturn 0\n\t} else {\n\t\tpid, err := strconv.Atoi(string(buf[0:n]))\n\t\tif err != nil {\n\t\t\tglog.Errorln(err)\n\t\t\treturn 0\n\t\t} else {\n\t\t\treturn pid\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5bb64d395128b64b12ed45546e34bbc0", "score": "0.541464", "text": "func parsePID(pid string) (string, string) {\n\thost := strings.Split(strings.Split(pid, \":\")[0], \"@\")[1]\n\tport := strings.Split(pid, \":\")[1]\n\n\treturn host, port\n}", "title": "" }, { "docid": "24c58d1ef9b568e79cd396358cbbbcfc", "score": "0.5401141", "text": "func (d *Docker) logDockerID() {\n\tid, err := d.ID()\n\tif err != nil {\n\t\tlog.Printf(\"%v\\n\", err)\n\t}\n\tlog.Printf(\"Name: %s ID: %v\\n\", d.Name, id)\n}", "title": "" }, { "docid": "6a754cb35d98111d6155376c573f89ad", "score": "0.5390448", "text": "func (s *SimpleSession) ProcessID() id.ID {\n\treturn s.processID\n}", "title": "" }, { "docid": "5c65a9d338de396666e65a9495bbe271", "score": "0.5390323", "text": "func getClientID() string {\n\thostname, err := os.Hostname()\n\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"Can't determine hostname: %v\", err))\n\t}\n\n\treturn fmt.Sprintf(\"%s:%d:%d\", hostname, os.Getpid(), idCount)\n}", "title": "" }, { "docid": "f82a94341e2bf7d742f00b190e6e7dbb", "score": "0.53877157", "text": "func (o DatadogAgentSpecClusterChecksRunnerConfigVolumesPhotonPersistentDiskPtrOutput) PdID() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *DatadogAgentSpecClusterChecksRunnerConfigVolumesPhotonPersistentDisk) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.PdID\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "20ebb97c7a2f3d1d8d2865c54e14e368", "score": "0.5384631", "text": "func BenchmarkPid(b *testing.B) {\n\tb.ReportAllocs()\n\tb.ResetTimer()\n\tfor i := 0; i < b.N; i++ {\n\t\tos.Getpid()\n\t}\n}", "title": "" }, { "docid": "6877c0f36805f7e7ee0581dac51a7ba2", "score": "0.5374657", "text": "func (t *Tailer) Identifier() string {\n\treturn fmt.Sprintf(\"docker:%s\", t.ContainerID)\n}", "title": "" }, { "docid": "6877c0f36805f7e7ee0581dac51a7ba2", "score": "0.5374657", "text": "func (t *Tailer) Identifier() string {\n\treturn fmt.Sprintf(\"docker:%s\", t.ContainerID)\n}", "title": "" }, { "docid": "5fae4b782bfd5dd97deb08d4c4808395", "score": "0.5372671", "text": "func (c context) findWatchdogPid() (watchdogPid int, found bool, err error) {\n\tc.log.Infof(\"findWatchdogPid\")\n\tpath, err := Dir(\"Keybase\")\n\tif err != nil {\n\t\treturn 0, false, err\n\t}\n\t// find all of the keybase processes\n\tkeybaseBinPath := filepath.Join(path, \"keybase.exe\")\n\tmatcher := process.NewMatcher(keybaseBinPath, process.PathEqual, c.log)\n\tkbProcesses, err := process.FindProcesses(matcher, time.Second, 200*time.Millisecond, c.log)\n\tif err != nil {\n\t\treturn 0, false, err\n\t}\n\t// build a map of pid -> process\n\tpidLookup := make(map[int]ps.Process, len(kbProcesses))\n\tfor _, proc := range kbProcesses {\n\t\tpidLookup[proc.Pid()] = proc\n\t}\n\t// find the process whose parent process (ppid) is the pid of one of the other processes\n\tmyPid := os.Getpid()\n\tvar parentProcessPids []int\n\tfor _, proc := range pidLookup {\n\t\tparentPid := proc.PPid()\n\t\tif parentPid == myPid {\n\t\t\t// under no circumstances should we accidentally terminate this process\n\t\t\tc.log.Warningf(\"findWatchdogPid: this process appears to have children keybase processes, which is unexpected\")\n\t\t\tcontinue\n\t\t}\n\t\tif _, parentIsAlsoInList := pidLookup[parentPid]; parentIsAlsoInList {\n\t\t\tparentProcessPids = append(parentProcessPids, parentPid)\n\t\t}\n\t}\n\tif len(parentProcessPids) == 0 {\n\t\tc.log.Infof(\"findWatchdogPid: no keybase processes have children\")\n\t\treturn 0, false, nil\n\t}\n\tif len(parentProcessPids) > 1 {\n\t\tc.log.Errorf(\"findWatchdogPid: found %d candidate processes for the watchdog, but there should only be 1\", len(parentProcessPids))\n\t\treturn 0, false, nil\n\t}\n\tc.log.Infof(\"findWatchdogPid: %d\", parentProcessPids[0])\n\treturn parentProcessPids[0], true, nil\n}", "title": "" }, { "docid": "c938ef5281d600746cf7c2271eeb0acf", "score": "0.5368565", "text": "func standalonePIDFilePath(dir string) string {\n\treturn filepath.Join(dir, \"pid.txt\")\n}", "title": "" }, { "docid": "9e8f8352b8bd6e46de57beb8a9e3142a", "score": "0.53510433", "text": "func (p *Process) GetPid() int {\n\tp.lock.RLock()\n\tdefer p.lock.RUnlock()\n\n\tif p.state == Stopped || p.state == Fatal || p.state == Unknown || p.state == Exited || p.state == Backoff {\n\t\treturn 0\n\t}\n\treturn p.cmd.Process.Pid\n}", "title": "" }, { "docid": "a578ea41f34db325f735eeaf1e4620ef", "score": "0.5335806", "text": "func FindDaemonProcess() (present bool, process *os.Process) {\n\tif IsPidFileExists() {\n\t\ts, _ := ioutil.ReadFile(pd.PidFileName())\n\t\tpid, err := strconv.ParseInt(string(s), 0, 64)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tlog.Printf(\"cat %v ... pid = %v\", pd.PidFileName(), pid)\n\n\t\tprocess, err = os.FindProcess(int(pid))\n\t\tif err == nil {\n\t\t\tpresent = true\n\t\t}\n\t} else {\n\t\tlog.Printf(\"cat %v ... app stopped\", pd.PidFileName())\n\t}\n\treturn\n}", "title": "" }, { "docid": "d43a7229475f594a62a551157c4f275d", "score": "0.5329848", "text": "func (o DatadogAgentSpecClusterChecksRunnerConfigVolumesPhotonPersistentDiskOutput) PdID() pulumi.StringOutput {\n\treturn o.ApplyT(func(v DatadogAgentSpecClusterChecksRunnerConfigVolumesPhotonPersistentDisk) string { return v.PdID }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "892e835ae87a817c5fc15eb824411967", "score": "0.5325137", "text": "func PidInfo() Info {\n\treturn SimpleInfo(\"pid\", os.Getpid())\n}", "title": "" }, { "docid": "b1d417664ed849b1d40f4da4280c1c27", "score": "0.5325", "text": "func (db *ContainerDB) GetPIDFromName(name string) (int, bool) {\n\treturn db.pidBidiName.GetInteger(name)\n}", "title": "" }, { "docid": "da22c22c37ca1c5ec59490e1d64ba3bb", "score": "0.53041863", "text": "func (y *RedpandaYaml) PIDFile() string {\n\treturn path.Join(y.Redpanda.Directory, \"pid.lock\")\n}", "title": "" }, { "docid": "4ad97527248298401587e631945d9642", "score": "0.5301637", "text": "func (*TestPID) Name() string { return \"PID\" }", "title": "" }, { "docid": "2236c143dae5d1ee19a1a5ecfddcb56d", "score": "0.5300562", "text": "func (proc *consensusProcess) ID() types.LayerID {\n\treturn proc.instanceID\n}", "title": "" }, { "docid": "34ac61bcf825c10c532cc63853b14f63", "score": "0.52821815", "text": "func (p *CNIPod) GetContainerID() string {\n\tif p.netTask == nil {\n\t\treturn \"\"\n\t}\n\treturn p.netTask.RuntimeConf.ID\n}", "title": "" }, { "docid": "98dc01d2e2cf56258a397c29c994e1e0", "score": "0.5280437", "text": "func (c *Container) GetContainerPidInformation(descriptors []string) ([]string, error) {\n\treturn nil, define.ErrNotImplemented\n}", "title": "" }, { "docid": "ec014b874298de576d00382c3571d653", "score": "0.527782", "text": "func pidOfClockID(c int32) kernel.ThreadID {\n\treturn kernel.ThreadID(^(c >> 3))\n}", "title": "" }, { "docid": "27d0682fc2f45ad5cd87f2058a51c135", "score": "0.52632976", "text": "func (vm *VM) ProcID() uint32 {\n\treturn uint32(vm.id)\n}", "title": "" }, { "docid": "a38154272a71b4ec2d00426683676485", "score": "0.525774", "text": "func ImageID(n nodes.Node, image string) (string, error) {\n\tvar out bytes.Buffer\n\tif err := n.Command(\"crictl\", \"inspecti\", image).SetStdout(&out).Run(); err != nil {\n\t\treturn \"\", err\n\t}\n\t// we only care about the image ID\n\tcrictlOut := struct {\n\t\tStatus struct {\n\t\t\tID string `json:\"id\"`\n\t\t} `json:\"status\"`\n\t}{}\n\tif err := json.Unmarshal(out.Bytes(), &crictlOut); err != nil {\n\t\treturn \"\", err\n\t}\n\treturn crictlOut.Status.ID, nil\n}", "title": "" }, { "docid": "fe5c85a3a96145e0875dd776c10ef4d7", "score": "0.52516264", "text": "func (p *dockerContainer) ContainerID() string {\n\treturn p.container.ID\n}", "title": "" }, { "docid": "ea4f7d16f3ab73dfa12e81d00702a7f9", "score": "0.52458847", "text": "func (p *Pod) ID() string {\n\treturn p.config.ID\n}", "title": "" }, { "docid": "e70fca3ac1fcc5e0ab4c5f8b395ccf2f", "score": "0.5219552", "text": "func SearchProcessOfContainerFromInode(communicatedContainer *container.Container, targetSocket *Socket, inode uint64) (process *Process, err error) {\n\targFields := logrus.WithFields(logrus.Fields{\n\t\t\"communicated_container\": communicatedContainer,\n\t\t\"inode\": inode,\n\t})\n\targFields.Debug(\"trying to search process of container from inode\")\n\n\tif targetSocket.Protocol == layers.LayerTypeUDP && targetSocket.RemotePort == 53 && SocketInodeExists(docker.PID, inode) {\n\t\tprocess, err = MakeProcessStruct(docker.PID)\n\t\tif err != nil {\n\t\t\targFields.WithField(\"error\", err).Debug(\"failed to search process of container from inode\")\n\t\t\treturn\n\t\t}\n\t\targFields.WithField(\"process\", process).Debug(\"process exists\")\n\t\treturn\n\t}\n\n\tvar containerdShimPid int\n\tcontainerdShimPid, err = RetrievePPID(communicatedContainer.Pid)\n\tif err != nil {\n\t\targFields.WithField(\"error\", err).Debug(\"failed to search process of container from inode\")\n\t\treturn\n\t}\n\targFields.WithField(\"pid_of_containerd_shim\", containerdShimPid).Trace(\"pid of containered-shim retrieved\")\n\tvar childPIDs []int\n\tchildPIDs, err = RetrieveChildPIDs(containerdShimPid)\n\tif err != nil {\n\t\targFields.WithField(\"error\", err).Debug(\"failed to search process of container from inode\")\n\t\treturn\n\t}\n\n\t// Check inode of pids\n\tfor _, pid := range childPIDs {\n\t\tif SocketInodeExists(pid, inode) {\n\t\t\tprocess, err = MakeProcessStruct(pid)\n\t\t\tif err != nil {\n\t\t\t\targFields.WithField(\"error\", err).Debug(\"failed to search process of container from inode\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\targFields.WithField(\"process\", process).Debug(\"process exists\")\n\t\t\treturn\n\t\t}\n\t}\n\terr = errors.New(\"process not found\")\n\targFields.WithField(\"error\", err).Debug(\"failed to search process of container from inode\")\n\treturn\n}", "title": "" } ]
4d0d32b3dba9e5b401b4523050fe32b4
TODO: Should find an intersection where both the overlap count is 1 and the whole claim is used. urgh.
[ { "docid": "287e99122c58d3d5b0f2ea79348c0b0c", "score": "0.63311666", "text": "func findNotOverlappingClaimID(bitmap [][]inch) string {\n\tfor y := range bitmap {\n\t\tfor x := range bitmap[y] {\n\t\t\tif len(bitmap[y][x].claims) == 1 {\n\t\t\t\tfmt.Printf(\"Bitmap %d, %d has only one claim %+v\\n\", y, x, bitmap[y][x].claims)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn \"blaat\"\n}", "title": "" } ]
[ { "docid": "4cff4e619bde9ff5003cf0e13aaa7757", "score": "0.7107014", "text": "func (f *fabric) overlap(n int) int {\n\tvar count int\n\tfor _, c := range f.claims {\n\t\tif c >= n {\n\t\t\tcount++\n\t\t}\n\t}\n\treturn count\n}", "title": "" }, { "docid": "d93df090f16d0b8fdce893b17501d542", "score": "0.71000224", "text": "func Overlaps(claims []string) int {\n\tfabric := CreateMap(1000, 1000)\n\tfor _, claim := range claims {\n\t\tfabric = AddToMap(fabric, ParseClaim(claim))\n\t}\n\treturn CountThe(fabric, \"X\")\n}", "title": "" }, { "docid": "8d4a7417589a8d714503e0c3cee35960", "score": "0.6215964", "text": "func FindPerfectClaim(claims []string) int {\n\tfabric := CreateMap(1000, 1000)\n\tfor _, claim := range claims {\n\t\tfabric = AddToMap(fabric, ParseClaim(claim))\n\t}\n\tfor _, claim := range claims {\n\t\tc := ParseClaim(claim)\n\t\tarea := c.Width * c.Height\n\t\tcount := CountThe(fabric, strconv.Itoa(c.ID))\n\t\tfmt.Printf(\"Testing Claim %d: area=%d and count==%d \\n\", c.ID, area, count)\n\t\tif area == count {\n\t\t\treturn c.ID\n\t\t}\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "3091e094cb022dc6fd70fe53ea0b0cc9", "score": "0.586244", "text": "func (f *fabric) claim(c *claim) {\n\tfor x := 0; x < c.w; x++ {\n\t\tfor y := 0; y < c.h; y++ {\n\t\t\tf.claims[coord{x: c.x + x, y: c.y + y}]++\n\t\t}\n\t}\n}", "title": "" }, { "docid": "41e0575e52bce935225b5397eae885ca", "score": "0.5749227", "text": "func assignClaim(c claim, layout *[1001][1001][]claim, overlaps map[string]bool) {\n\tfor i := c.Left; i <= c.Width+c.Left-1; i++ {\n\t\tfor j := c.Top; j <= c.Height+c.Top-1; j++ {\n\t\t\tlayout[i][j] = append(layout[i][j], c)\n\t\t\tif len(layout[i][j]) > 1 {\n\t\t\t\tfor _, key := range layout[i][j] {\n\t\t\t\t\toverlaps[key.Number] = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0595af2c79db801c37deb6ec54102ce0", "score": "0.5706534", "text": "func (ra *ResAccumulator) Intersection(other resmap.ResMap) error {\n\totherIds := other.AllIds()\n\tfor _, curId := range ra.resMap.AllIds() {\n\t\ttoDelete := true\n\t\tfor _, otherId := range otherIds {\n\t\t\tif otherId == curId {\n\t\t\t\ttoDelete = false\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif toDelete {\n\t\t\terr := ra.resMap.Remove(curId)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0340abb45190329a149985f5f43c6f10", "score": "0.5685613", "text": "func calcIntersection(acs []*BatchProposal, n uint16) ([]iscp.RequestID, [][32]byte) {\n\tminNumberMentioned := n/3 + 1\n\tnumMentioned := make(map[[keyLen]byte]uint16)\n\n\tmaxLen := 0\n\tfor _, prop := range acs {\n\t\tfor i, reqid := range prop.RequestIDs {\n\t\t\t// save ID + Hash as key to avoid batching requests where different nodes have mismatching request content with the same ID\n\t\t\thash := prop.RequestHashes[i]\n\t\t\tvar key [keyLen]byte\n\t\t\tcopy(key[:], append(reqid.Bytes(), hash[:]...))\n\t\t\tnumMentioned[key]++\n\t\t}\n\t\tif len(prop.RequestIDs) > maxLen {\n\t\t\tmaxLen = len(prop.RequestIDs)\n\t\t}\n\t}\n\tretIDs := make([]iscp.RequestID, 0, maxLen)\n\tretHashes := make([][32]byte, 0)\n\tfor key, num := range numMentioned {\n\t\tif num < minNumberMentioned {\n\t\t\tcontinue\n\t\t}\n\t\treqID, err := iscp.RequestIDFromBytes(key[:])\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tretIDs = append(retIDs, reqID)\n\t\tvar hash [32]byte\n\t\tcopy(hash[:], key[len(key)-32:])\n\t\tretHashes = append(retHashes, hash)\n\t}\n\treturn retIDs, retHashes\n}", "title": "" }, { "docid": "0ceaf23d2df2b3ecb0ff202d83f6ab66", "score": "0.56530726", "text": "func (ts1 TimeSpan) Intersect(ts2 TimeSpan) (ts3 TimeSpan) {\n\tswitch {\n\tcase ts1.Start.Before(ts2.Start):\n\t\tts3.Start = ts2.Start\n\t\tts3.NotStartInclusive = ts2.NotStartInclusive\n\tcase ts2.Start.Before(ts1.Start):\n\t\tts3.Start = ts1.Start\n\t\tts3.NotStartInclusive = ts1.NotStartInclusive\n\tdefault:\n\t\tts3.Start = ts1.Start\n\t\tts3.NotStartInclusive = ts1.NotStartInclusive || ts2.NotStartInclusive\n\t}\n\n\tswitch {\n\tcase ts1.End.After(ts2.End):\n\t\tts3.End = ts2.End\n\t\tts3.EndInclusive = ts2.EndInclusive\n\tcase ts2.End.After(ts1.End):\n\t\tts3.End = ts1.End\n\t\tts3.EndInclusive = ts1.EndInclusive\n\tdefault:\n\t\tts3.End = ts1.End\n\t\tts3.EndInclusive = ts1.EndInclusive && ts2.EndInclusive\n\t}\n\treturn\n}", "title": "" }, { "docid": "8b38feeda236475805aefdbf762c3afe", "score": "0.56158304", "text": "func intersectionAllowed(op string, lhit, inl, inr bool) bool {\n\tswitch op {\n\tcase union:\n\t\treturn (lhit && !inr) || (!lhit && !inl)\n\tcase intersection:\n\t\treturn (lhit && inr) || (!lhit && inl)\n\tcase difference:\n\t\treturn (lhit && !inr) || (!lhit && inl)\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "99ac0711eb0f42080d445b0e58328143", "score": "0.55552065", "text": "func Intersect(l List, span U64Span) (first, count int) {\n\ts := intersection{}\n\ts.intersect(l, span, false)\n\treturn s.lowIndex, s.overlap\n}", "title": "" }, { "docid": "e2b3cf9b49ca5afed662a581eb80c204", "score": "0.55312115", "text": "func (any) Intersect(c Constraint) Constraint {\r\n\treturn c\r\n}", "title": "" }, { "docid": "982d4ff1e4231ac9aef1e214bfdd4c5c", "score": "0.55212134", "text": "func (none) Intersect(Constraint) Constraint {\r\n\treturn None()\r\n}", "title": "" }, { "docid": "dafc6087437ef5cc228904a5cde0c1b7", "score": "0.54664826", "text": "func TestIntersectSlice(t *testing.T) {\n\tslice1 := []uint32{0, 1, 2, 3}\n\tslice2 := []uint32{3, 4, 5}\n\n\tresult := IntersectSlice(slice1, slice2)\n\tassert.Equal(t, 1, len(result))\n\tassert.Equal(t, uint32(3), result[0])\n}", "title": "" }, { "docid": "cb8b9632ab54c4123fc3e14196265be2", "score": "0.5448897", "text": "func overlap(a, b Span) bool {\n\t// [1,2,3,4] [4,5,6,7] - intersects\n\t// [1,2,3,4) [4,5,6,7] - doesn't intersect\n\t// [1,2,3,4] (4,5,6,7] - doesn't intersect\n\t// [1,2,3,4) (4,5,6,7] - doesn't intersect\n\n\taStartType := a.StartType()\n\taEndType := a.EndType()\n\tbStartType := b.StartType()\n\tbEndType := b.EndType()\n\n\tif IsInstant(a) {\n\t\taStartType = Closed\n\t\taEndType = Closed\n\t}\n\tif IsInstant(b) {\n\t\tbStartType = Closed\n\t\tbEndType = Closed\n\t}\n\n\t// Given [a_s,a_e] and [b_s,b_e]\n\t// If a_s > b_e || a_e < b_s, overlap == false\n\n\tc1 := false // is a_s after b_e\n\tif a.Start().After(b.End()) {\n\t\tc1 = true\n\t} else if a.Start().Equal(b.End()) {\n\t\tc1 = (aStartType == Open || bEndType == Open)\n\t}\n\n\tc2 := false // is a_e before b_s\n\tif a.End().Before(b.Start()) {\n\t\tc2 = true\n\t} else if a.End().Equal(b.Start()) {\n\t\tc2 = (aEndType == Open || bStartType == Open)\n\t}\n\n\tif c1 || c2 {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "2f2d9b22fc7aac6b62f908e24f66bcde", "score": "0.54401934", "text": "func (index *Index[K, F]) Intersect(bounds *primitives.Rect) ([]F, error) {\n\treturn index.Query(bounds, query.Build[K, F]().Query())\n}", "title": "" }, { "docid": "d6b69193e19fd495927ed96aecd41d68", "score": "0.5428591", "text": "func (a Seg2) DoesIsect(b Seg2) bool {\n aray := a.Ray()\n bray := b.Ray()\n\n bp := b.P.Sub(a.P)\n bq := b.Q.Sub(a.P)\n ap := a.P.Sub(b.P)\n aq := a.Q.Sub(b.P)\n\n cross_bp := CrossProduct(aray, bp)\n cross_bq := CrossProduct(aray, bq)\n cross_ap := CrossProduct(bray, ap)\n cross_aq := CrossProduct(bray, aq)\n\n return ((cross_ap < 0 && cross_aq > 0) || (cross_ap > 0 && cross_aq < 0)) &&\n ((cross_bp < 0 && cross_bq > 0) || (cross_bp > 0 && cross_bq < 0))\n}", "title": "" }, { "docid": "6f8b5b8f21150ffe2c453e77d2ff186d", "score": "0.54274166", "text": "func intersectionRange(start, end, newStart, newEnd int) (s int, e int) {\n\tif start > newStart {\n\t\ts = start\n\t} else {\n\t\ts = newStart\n\t}\n\n\tif end < newEnd {\n\t\te = end\n\t} else {\n\t\te = newEnd\n\t}\n\treturn s, e\n}", "title": "" }, { "docid": "e8d8bcebc0933e5ca9f5b1b53a1eec39", "score": "0.5408615", "text": "func (p Span) Intersects(q Span) bool {\n\treturn (p.start < q.end) && (p.end > q.start);\n}", "title": "" }, { "docid": "a6448e7d1665ee019c43e2cb47895ce7", "score": "0.5400231", "text": "func Problem350() {\n\n\ttest11 := []int{1, 2, 2, 1}\n\ttest12 := []int{2, 2}\n\tfmt.Println(intersect(test11, test12))\n\n\ttest21 := []int{4, 9, 5}\n\ttest22 := []int{9, 4, 9, 8, 4}\n\tfmt.Println(intersect(test21, test22))\n\n}", "title": "" }, { "docid": "02d21339b4b4cec149328f6ab30c0e7d", "score": "0.5353419", "text": "func (rc *runContainer16) intersectCardinality(b *runContainer16) int {\n\tanswer := int(0)\n\n\ta := rc\n\tnuma := int(len(a.iv))\n\tnumb := int(len(b.iv))\n\tif numa == 0 || numb == 0 {\n\t\treturn 0\n\t}\n\n\tif numa == 1 && numb == 1 {\n\t\tif !haveOverlap16(a.iv[0], b.iv[0]) {\n\t\t\treturn 0\n\t\t}\n\t}\n\n\tvar acuri int\n\tvar bcuri int\n\n\tastart := int(a.iv[acuri].start)\n\tbstart := int(b.iv[bcuri].start)\n\n\tvar intersection interval16\n\tvar leftoverstart int\n\tvar isOverlap, isLeftoverA, isLeftoverB bool\n\tvar done bool\n\tpass := 0\ntoploop:\n\tfor acuri < numa && bcuri < numb {\n\t\tpass++\n\n\t\tisOverlap, isLeftoverA, isLeftoverB, leftoverstart, intersection =\n\t\t\tintersectWithLeftover16(astart, int(a.iv[acuri].last()), bstart, int(b.iv[bcuri].last()))\n\n\t\tif !isOverlap {\n\t\t\tswitch {\n\t\t\tcase astart < bstart:\n\t\t\t\tacuri, done = a.findNextIntervalThatIntersectsStartingFrom(acuri+1, bstart)\n\t\t\t\tif done {\n\t\t\t\t\tbreak toploop\n\t\t\t\t}\n\t\t\t\tastart = int(a.iv[acuri].start)\n\n\t\t\tcase astart > bstart:\n\t\t\t\tbcuri, done = b.findNextIntervalThatIntersectsStartingFrom(bcuri+1, astart)\n\t\t\t\tif done {\n\t\t\t\t\tbreak toploop\n\t\t\t\t}\n\t\t\t\tbstart = int(b.iv[bcuri].start)\n\t\t\t}\n\n\t\t} else {\n\t\t\t// isOverlap\n\t\t\tanswer += int(intersection.last()) - int(intersection.start) + 1\n\t\t\tswitch {\n\t\t\tcase isLeftoverA:\n\t\t\t\t// note that we change astart without advancing acuri,\n\t\t\t\t// since we need to capture any 2ndary intersections with a.iv[acuri]\n\t\t\t\tastart = leftoverstart\n\t\t\t\tbcuri++\n\t\t\t\tif bcuri >= numb {\n\t\t\t\t\tbreak toploop\n\t\t\t\t}\n\t\t\t\tbstart = int(b.iv[bcuri].start)\n\t\t\tcase isLeftoverB:\n\t\t\t\t// note that we change bstart without advancing bcuri,\n\t\t\t\t// since we need to capture any 2ndary intersections with b.iv[bcuri]\n\t\t\t\tbstart = leftoverstart\n\t\t\t\tacuri++\n\t\t\t\tif acuri >= numa {\n\t\t\t\t\tbreak toploop\n\t\t\t\t}\n\t\t\t\tastart = int(a.iv[acuri].start)\n\t\t\tdefault:\n\t\t\t\t// neither had leftover, both completely consumed\n\n\t\t\t\t// advance to next a interval\n\t\t\t\tacuri++\n\t\t\t\tif acuri >= numa {\n\t\t\t\t\tbreak toploop\n\t\t\t\t}\n\t\t\t\tastart = int(a.iv[acuri].start)\n\n\t\t\t\t// advance to next b interval\n\t\t\t\tbcuri++\n\t\t\t\tif bcuri >= numb {\n\t\t\t\t\tbreak toploop\n\t\t\t\t}\n\t\t\t\tbstart = int(b.iv[bcuri].start)\n\t\t\t}\n\t\t}\n\t} // end for toploop\n\n\treturn answer\n}", "title": "" }, { "docid": "4ccf08cf1e5c870cb89c85b167a2db63", "score": "0.53526723", "text": "func intersection(L1, L2 *LineSegment) int {\n\trel1 := L1.L.RelationOf(L2.A) * L1.L.RelationOf(L2.B)\n\trel2 := L2.L.RelationOf(L1.A) * L2.L.RelationOf(L1.B)\n\tif rel1 > 0 {\n\t\treturn 1\n\t}\n\tif rel2 > 0 {\n\t\treturn 1\n\t}\n\tif rel1 == 0 {\n\t\treturn 0\n\t}\n\tif rel2 == 0 {\n\t\treturn 0\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "40ab54f33e982008f62190c078217a8b", "score": "0.5324089", "text": "func (t Tombstone) Overlaps(cmp base.Compare, other Tombstone) int {\n\tif cmp(t.Start.UserKey, other.Start.UserKey) == 0 && bytes.Equal(t.End, other.End) {\n\t\tif other.Start.SeqNum() < t.Start.SeqNum() {\n\t\t\treturn -1\n\t\t}\n\t\treturn 1\n\t}\n\tif cmp(t.End, other.Start.UserKey) <= 0 {\n\t\treturn -1\n\t}\n\tif cmp(other.End, t.Start.UserKey) <= 0 {\n\t\treturn 1\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "988c923e19006055a9f27c483c4c80b4", "score": "0.5263174", "text": "func (s1 Segmentf64) Intersect(s2 Segmentf64) bool {\r\n\ts1 = s1.Standardize()\r\n\ts2 = s2.Standardize()\r\n\tv1 := s1.ToVector()\r\n\tv2 := s2.ToVector()\r\n\tif v2.Mult(v1) == 0 {\r\n\t\t// parallel\r\n\t\trefVec1 := NewVector2f64(s2.Point1.X-s1.Point2.X, s2.Point1.Y-s1.Point2.Y)\r\n\t\trefVec2 := NewVector2f64(s1.Point1.X-s2.Point1.X, s1.Point1.Y-s2.Point1.Y)\r\n\t\tif refVec1.Mult(refVec2) == 0 {\r\n\t\t\t// in one line\r\n\t\t\treturn s2.Point1.X <= s1.Point2.X && s1.Point1.X <= s2.Point1.X && s2.Point1.Y <= s1.Point2.Y && s1.Point1.Y <= s2.Point1.Y\r\n\t\t} else {\r\n\t\t\t// parallel\r\n\t\t\treturn false\r\n\t\t}\r\n\t} else {\r\n\t\t// no parallel\r\n\t\treturn s1.Straddle(s2) && s2.Straddle(s1)\r\n\t}\r\n}", "title": "" }, { "docid": "d85f4ecd004487ff84c0968e31968af0", "score": "0.5262904", "text": "func (p *ProfileId) IsOverlappingWith(other *ProfileId) bool {\n return p.IsValid(other.FirstSeenAt) || p.IsValid(other.ValidUntil) || (p.Id == other.Id && p.ValidUntil.Add(NameChangeRateLimitPeriod).After(p.FirstSeenAt))\n}", "title": "" }, { "docid": "fb1d8ece2dbe92213c16b029c1c0710c", "score": "0.5262541", "text": "func (p *AllocationProperties) Intersection(that *AllocationProperties) *AllocationProperties {\n\tif p == nil || that == nil {\n\t\treturn nil\n\t}\n\tintersectionProps := &AllocationProperties{}\n\tif p.Cluster == that.Cluster {\n\t\tintersectionProps.Cluster = p.Cluster\n\t}\n\tif p.Node == that.Node {\n\t\tintersectionProps.Node = p.Node\n\t}\n\tif p.Container == that.Container {\n\t\tintersectionProps.Container = p.Container\n\t}\n\tif p.Controller == that.Controller {\n\t\tintersectionProps.Controller = p.Controller\n\t}\n\tif p.ControllerKind == that.ControllerKind {\n\t\tintersectionProps.ControllerKind = p.ControllerKind\n\t}\n\tif p.Namespace == that.Namespace {\n\n\t\tintersectionProps.Namespace = p.Namespace\n\n\t\t// CORE-140: In the case that the namespace is the same, also copy over the namespaceLabels and annotations\n\t\t// Note - assume that if the namespace is the same on both, then namespace label/annotation sets\n\t\t// will be the same, so just carry one set over\n\t\tif p.Container == UnmountedSuffix {\n\t\t\t// This logic is designed to effectively ignore the unmounted/unallocated objects\n\t\t\t// and just copy over the labels from the other, 'legitimate' allocation.\n\t\t\tintersectionProps.NamespaceLabels = copyStringMap(that.NamespaceLabels)\n\t\t\tintersectionProps.NamespaceAnnotations = copyStringMap(that.NamespaceAnnotations)\n\t\t} else {\n\t\t\tintersectionProps.NamespaceLabels = copyStringMap(p.NamespaceLabels)\n\t\t\tintersectionProps.NamespaceAnnotations = copyStringMap(p.NamespaceAnnotations)\n\t\t}\n\n\t\t// ignore the incoming labels from unallocated or unmounted special case pods\n\t\tif p.AggregatedMetadata || that.AggregatedMetadata {\n\t\t\tintersectionProps.AggregatedMetadata = true\n\n\t\t\t// When aggregating by metadata, we maintain the intersection of the labels/annotations\n\t\t\t// of the two AllocationProperties objects being intersected here.\n\t\t\t// Special case unallocated/unmounted Allocations never have any labels or annotations.\n\t\t\t// As a result, they have the effect of always clearing out the intersection,\n\t\t\t// regardless if all the other actual allocations/etc have them.\n\t\t\t// This logic is designed to effectively ignore the unmounted/unallocated objects\n\t\t\t// and just copy over the labels from the other object - we only take the intersection\n\t\t\t// of 'legitimate' allocations.\n\t\t\tif p.Container == UnmountedSuffix {\n\t\t\t\tintersectionProps.Annotations = that.Annotations\n\t\t\t\tintersectionProps.Labels = that.Labels\n\t\t\t} else if that.Container == UnmountedSuffix {\n\t\t\t\tintersectionProps.Annotations = p.Annotations\n\t\t\t\tintersectionProps.Labels = p.Labels\n\t\t\t} else {\n\t\t\t\tintersectionProps.Annotations = mapIntersection(p.Annotations, that.Annotations)\n\t\t\t\tintersectionProps.Labels = mapIntersection(p.Labels, that.Labels)\n\t\t\t}\n\t\t}\n\t}\n\n\tif p.Pod == that.Pod {\n\t\tintersectionProps.Pod = p.Pod\n\t}\n\tif p.ProviderID == that.ProviderID {\n\t\tintersectionProps.ProviderID = p.ProviderID\n\t}\n\n\treturn intersectionProps\n}", "title": "" }, { "docid": "78a8f793115c73445b20d2523307fa9c", "score": "0.5257242", "text": "func doOverlap(a []int, b []int) bool {\n\t// Start of b lies within a\n\tif b[0] >= a[0] && b[0] <= a[1] {\n\t\treturn true\n\t}\n\t// End of b lies within a\n\tif b[1] >= a[0] && b[0] <= a[1] {\n\t\treturn true\n\t}\n\t// a completely lies inside b\n\tif b[0] < a[0] && b[1] > a[1] {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "cafb432ad810bb463613e8ec8ca0dd1f", "score": "0.52565914", "text": "func FindOverlap(one []string, two []string) []string {\n\n\tvar overlap []string\n\n\t// Loop through one, and see if present in two\n\tfor _, string1 := range one {\n\t\tif IncludesString(string1, two) {\n\t\t\toverlap = append(overlap, string1)\n\t\t}\n\t}\n\treturn overlap\n}", "title": "" }, { "docid": "35a76826611889d5245d128257a2fc19", "score": "0.5236487", "text": "func intersectaion(members []models.User, N int) []models.User {\n\tuniqueUsers := make(map[models.User]int)\n\tfor _, id := range members {\n\t\tif _, ok := uniqueUsers[id]; ok {\n\t\t\tuniqueUsers[id]++\n\t\t} else {\n\t\t\tuniqueUsers[id] = 1\n\t\t}\n\t}\n\n\t// Start find intersection\n\tintersUsers := []models.User{}\n\tfor k, v := range uniqueUsers {\n\t\tif v >= N {\n\t\t\tintersUsers = append(intersUsers, k)\n\t\t}\n\t}\n\n\treturn intersUsers\n}", "title": "" }, { "docid": "8fd5ba39a71643bb5adaf8c6b9bc2b6d", "score": "0.52299017", "text": "func (set Uint) Intersect(other Uint) Uint {\n\tvar big, small Uint\n\tif len(set) < len(other) {\n\t\tbig = other\n\t\tsmall = set\n\t} else {\n\t\tbig = set\n\t\tsmall = other\n\t}\n\n\tresult := NewUint()\n\tfor value := range small {\n\t\tif _, ok := big[value]; ok {\n\t\t\tresult[value] = struct{}{}\n\t\t}\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "55e55e4c273da998213f893f41973658", "score": "0.52230936", "text": "func intersectSpan(\n\tspan roachpb.Span,\n\tdesc roachpb.RangeDescriptor,\n) (middle *roachpb.Span, outside []roachpb.Span) {\n\tstart, end := desc.StartKey.AsRawKey(), desc.EndKey.AsRawKey()\n\tif len(span.EndKey) == 0 {\n\t\toutside = append(outside, span)\n\t\treturn\n\t}\n\tif bytes.Compare(span.Key, keys.LocalRangeMax) < 0 {\n\t\tif bytes.Compare(span.EndKey, keys.LocalRangeMax) >= 0 {\n\t\t\tpanic(\"a local intent range may not have a non-local portion\")\n\t\t}\n\t\tif containsKeyRange(desc, span.Key, span.EndKey) {\n\t\t\treturn &span, nil\n\t\t}\n\t\treturn nil, append(outside, span)\n\t}\n\t// From now on, we're dealing with plain old key ranges - no more local\n\t// addressing.\n\tif bytes.Compare(span.Key, start) < 0 {\n\t\t// Intent spans a part to the left of [start, end).\n\t\tiCopy := span\n\t\tif bytes.Compare(start, span.EndKey) < 0 {\n\t\t\tiCopy.EndKey = start\n\t\t}\n\t\tspan.Key = iCopy.EndKey\n\t\toutside = append(outside, iCopy)\n\t}\n\tif bytes.Compare(span.Key, span.EndKey) < 0 && bytes.Compare(end, span.EndKey) < 0 {\n\t\t// Intent spans a part to the right of [start, end).\n\t\tiCopy := span\n\t\tif bytes.Compare(iCopy.Key, end) < 0 {\n\t\t\tiCopy.Key = end\n\t\t}\n\t\tspan.EndKey = iCopy.Key\n\t\toutside = append(outside, iCopy)\n\t}\n\tif bytes.Compare(span.Key, span.EndKey) < 0 && bytes.Compare(span.Key, start) >= 0 && bytes.Compare(end, span.EndKey) >= 0 {\n\t\tmiddle = &span\n\t}\n\treturn\n}", "title": "" }, { "docid": "ee284eca2933f94c6924169e0f21b2f3", "score": "0.51911783", "text": "func (e Envelope) Intersects(o Envelope) bool {\n\treturn true &&\n\t\t(e.min.X <= o.max.X) && (e.max.X >= o.min.X) &&\n\t\t(e.min.Y <= o.max.Y) && (e.max.Y >= o.min.Y)\n}", "title": "" }, { "docid": "39e11d0deba1a9a58a72064bb60722f5", "score": "0.5175128", "text": "func overlapper(setlist []*BitSet, newchars *BitSet) int {\n\tif !newchars.IsEmpty() {\n\t\tfor i := range setlist {\n\t\t\tif !setlist[i].And(newchars).IsEmpty() {\n\t\t\t\treturn i\n\t\t\t}\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "a67b16a4ec49c68cc2dd8ad414acc644", "score": "0.5172929", "text": "func adjsIntersectP(a ClumpAdj, b ClumpAdj, m map[string]*Clump) bool {\n\ta1, found := m[a.EndIDs[0]]\n\tif !found {\n\t\treturn false\n\t}\n\ta2, found := m[a.EndIDs[1]]\n\tif !found {\n\t\treturn false\n\t}\n\tb1, found := m[b.EndIDs[0]]\n\tif !found {\n\t\treturn false\n\t}\n\tb2, found := m[b.EndIDs[1]]\n\tif !found {\n\t\treturn false\n\t}\n\tendSet := map[string]bool{ // if two adjs \"share\" an endpoint, that's not ∩. Count distinct endpoints:\n\t\ta.EndIDs[0]: true,\n\t\ta.EndIDs[1]: true,\n\t\tb.EndIDs[0]: true,\n\t\tb.EndIDs[1]: true,\n\t}\n\tif len(endSet) < 4 {\n\t\treturn false\n\t}\n\treturn segsIntersectP(a1.Lat, a1.Lng, a2.Lat, a2.Lng, b1.Lat, b1.Lng, b2.Lat, b2.Lng)\n}", "title": "" }, { "docid": "ce8246366a9cf4d83c0eafed6fa99598", "score": "0.51231235", "text": "func (p Span) Overlap(q Span) (float64) {\n\tif !p.Intersects(q) {\n\t\treturn 0.0\n\t}\n\t\n\treturn min(p.end - p.start,\n\t\t p.end - q.start,\n\t\t q.end - q.start,\n\t\t q.end - p.start)\n}", "title": "" }, { "docid": "e1fc4300d28e25aac1ac91f4f1aec18a", "score": "0.51139706", "text": "func (self *Circle) Intersects(a *Circle, b *Circle) bool{\n return self.Object.Call(\"intersects\", a, b).Bool()\n}", "title": "" }, { "docid": "58e5313a90017b0ef016d45ced0f6667", "score": "0.51040095", "text": "func IntersectPosting(plist1 []int, plist2 []int) (result []int) {\n // plist1 and plist 2 are assumed to be sorted.\n result = []int{}\n pointer1, pointer2 := 0, 0\n for pointer1 < len(plist1) && pointer2 < len(plist2) {\n docID1 := plist1[pointer1]\n docID2 := plist2[pointer2]\n if docID1 == docID2 {\n result = append(result, docID1)\n pointer1++\n pointer2++\n } else if docID1 < docID2 {\n pointer1++\n } else {\n pointer2++\n }\n }\n return\n}", "title": "" }, { "docid": "50bb87ac22162cabba3ec07fcab09f7a", "score": "0.509704", "text": "func (pr pointRange) intersect(selOrg, selEnd string) pointRange {\n\tif pr.isPoint() {\n\t\tif selOrg <= pr.org && pr.org < selEnd {\n\t\t\treturn pr\n\t\t}\n\t} else { // range\n\t\tpr = pointRange{org: max(pr.org, selOrg), end: min(pr.end, selEnd)}\n\t\tif pr.org < pr.end {\n\t\t\treturn pr\n\t\t}\n\t}\n\treturn pointRange{org: \"z\", end: \"a\"} // conflict\n}", "title": "" }, { "docid": "017572f0851a3b2e375aa3ed26daf5bc", "score": "0.5081495", "text": "func (pb *Body) Intersect(p Physic) bool {\n\tax, ay := pb.position.X, pb.position.Y\n\taw, ah := pb.Dimension().W, pb.Dimension().H\n\n\tbx, by := p.Position().X, p.Position().Y\n\tbw, bh := p.Dimension().W, p.Dimension().H\n\n\treturn (ax < bx+bw && ay < by+bh) && (ax+aw > bx && ay+ah > by)\n}", "title": "" }, { "docid": "7429ee20cdf358fc5f4e8c79b6440e64", "score": "0.5073834", "text": "func (rc *runContainer16) intersect(b *runContainer16) *runContainer16 {\n\n\ta := rc\n\tnuma := int(len(a.iv))\n\tnumb := int(len(b.iv))\n\tres := &runContainer16{}\n\tif numa == 0 || numb == 0 {\n\t\treturn res\n\t}\n\n\tif numa == 1 && numb == 1 {\n\t\tif !haveOverlap16(a.iv[0], b.iv[0]) {\n\t\t\treturn res\n\t\t}\n\t}\n\n\tvar output []interval16\n\n\tvar acuri int\n\tvar bcuri int\n\n\tastart := int(a.iv[acuri].start)\n\tbstart := int(b.iv[bcuri].start)\n\n\tvar intersection interval16\n\tvar leftoverstart int\n\tvar isOverlap, isLeftoverA, isLeftoverB bool\n\tvar done bool\ntoploop:\n\tfor acuri < numa && bcuri < numb {\n\n\t\tisOverlap, isLeftoverA, isLeftoverB, leftoverstart, intersection =\n\t\t\tintersectWithLeftover16(astart, int(a.iv[acuri].last()), bstart, int(b.iv[bcuri].last()))\n\n\t\tif !isOverlap {\n\t\t\tswitch {\n\t\t\tcase astart < bstart:\n\t\t\t\tacuri, done = a.findNextIntervalThatIntersectsStartingFrom(acuri+1, bstart)\n\t\t\t\tif done {\n\t\t\t\t\tbreak toploop\n\t\t\t\t}\n\t\t\t\tastart = int(a.iv[acuri].start)\n\n\t\t\tcase astart > bstart:\n\t\t\t\tbcuri, done = b.findNextIntervalThatIntersectsStartingFrom(bcuri+1, astart)\n\t\t\t\tif done {\n\t\t\t\t\tbreak toploop\n\t\t\t\t}\n\t\t\t\tbstart = int(b.iv[bcuri].start)\n\t\t\t}\n\n\t\t} else {\n\t\t\t// isOverlap\n\t\t\toutput = append(output, intersection)\n\t\t\tswitch {\n\t\t\tcase isLeftoverA:\n\t\t\t\t// note that we change astart without advancing acuri,\n\t\t\t\t// since we need to capture any 2ndary intersections with a.iv[acuri]\n\t\t\t\tastart = leftoverstart\n\t\t\t\tbcuri++\n\t\t\t\tif bcuri >= numb {\n\t\t\t\t\tbreak toploop\n\t\t\t\t}\n\t\t\t\tbstart = int(b.iv[bcuri].start)\n\t\t\tcase isLeftoverB:\n\t\t\t\t// note that we change bstart without advancing bcuri,\n\t\t\t\t// since we need to capture any 2ndary intersections with b.iv[bcuri]\n\t\t\t\tbstart = leftoverstart\n\t\t\t\tacuri++\n\t\t\t\tif acuri >= numa {\n\t\t\t\t\tbreak toploop\n\t\t\t\t}\n\t\t\t\tastart = int(a.iv[acuri].start)\n\t\t\tdefault:\n\t\t\t\t// neither had leftover, both completely consumed\n\n\t\t\t\t// advance to next a interval\n\t\t\t\tacuri++\n\t\t\t\tif acuri >= numa {\n\t\t\t\t\tbreak toploop\n\t\t\t\t}\n\t\t\t\tastart = int(a.iv[acuri].start)\n\n\t\t\t\t// advance to next b interval\n\t\t\t\tbcuri++\n\t\t\t\tif bcuri >= numb {\n\t\t\t\t\tbreak toploop\n\t\t\t\t}\n\t\t\t\tbstart = int(b.iv[bcuri].start)\n\t\t\t}\n\t\t}\n\t} // end for toploop\n\n\tif len(output) == 0 {\n\t\treturn res\n\t}\n\n\tres.iv = output\n\treturn res\n}", "title": "" }, { "docid": "d23efc9d15e3dcf4e3aa05ef3f9e13ee", "score": "0.50669205", "text": "func TestIntersectionOfTwoArrays(t *testing.T) {\n\tfmt.Println(intersection([]int{4, 9, 5}, []int{9, 4, 9, 8, 4}))\n}", "title": "" }, { "docid": "707b13313a522fb90179516861fa86a8", "score": "0.50609666", "text": "func execmRectangleIntersect(_ int, p *gop.Context) {\n\targs := p.GetArgs(2)\n\tret := args[0].(image.Rectangle).Intersect(args[1].(image.Rectangle))\n\tp.Ret(2, ret)\n}", "title": "" }, { "docid": "770ba5d4b5ddd14a677bf0b55ece2a62", "score": "0.5055917", "text": "func (resourceSet ResourceSet) Intersection(sset ResourceSet) ResourceSet {\n\tnset := NewResourceSet()\n\tfor k := range resourceSet {\n\t\tif _, ok := sset[k]; ok {\n\t\t\tnset.Add(k)\n\t\t}\n\t}\n\n\treturn nset\n}", "title": "" }, { "docid": "6c5cb5663dc127b3ffbf63b01456bacf", "score": "0.50518996", "text": "func (m Matcher) Intersect(other Matcher) Matcher {\n\tif m.All {\n\t\treturn other\n\t}\n\tif other.All {\n\t\treturn m\n\t}\n\tvar pl []specs.Platform\n\tfor i := 0; i < len(m.Platforms); i++ {\n\t\tmatcher := platforms.OnlyStrict(m.Platforms[i])\n\t\tfor j := 0; j < len(other.Platforms); j++ {\n\t\t\tif matcher.Match(other.Platforms[j]) {\n\t\t\t\tpl = append(pl, m.Platforms[i])\n\t\t\t}\n\t\t}\n\t}\n\tres := Matcher{Platforms: pl}\n\tlog.Entry(context.TODO()).Debugf(\"intersect matchers %q and %q, result %q\", m, other, res)\n\treturn res\n}", "title": "" }, { "docid": "18f685dc0f2895168f2f93a40871b364", "score": "0.5040341", "text": "func (r addrRange) Intersect(r2 addrRange) addrRange {\n\tif r.Start < r2.Start {\n\t\tr.Start = r2.Start\n\t}\n\tif r.End > r2.End {\n\t\tr.End = r2.End\n\t}\n\tif r.End < r.Start {\n\t\tr.End = r.Start\n\t}\n\treturn r\n}", "title": "" }, { "docid": "730ecb5a68baa921e6b92193321b2828", "score": "0.5034598", "text": "func haveOverlap(a1, a2 []string) bool {\n\tif len(a1) > len(a2) {\n\t\ta1, a2 = a2, a1\n\t}\n\tm := sets.New(a1...)\n\tfor _, val := range a2 {\n\t\tif _, ok := m[val]; ok {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "ef2c923d7fd5e417444a992af76e3a19", "score": "0.50326174", "text": "func intersection(nums1 []int, nums2 []int) []int {\n\tm1, m2 := make(map[int]bool), make(map[int]bool)\n\tfor _, val := range nums1 {\n\t\tm1[val] = true\n\t}\n\tfor _, val := range nums2 {\n\t\tm2[val] = true\n\t}\n\tvar short, long map[int]bool\n\tif len(m1) > len(m2) {\n\t\tshort = m2\n\t\tlong = m1\n\t} else {\n\t\tshort = m1\n\t\tlong = m2\n\t}\n\tresult := make([]int, 0)\n\tfor key := range short {\n\t\tif _, exist := long[key]; exist {\n\t\t\tresult = append(result, key)\n\t\t}\n\t}\n\treturn result\n}", "title": "" }, { "docid": "cd19153d99e0e9ef8a4f2d48276dc99c", "score": "0.5021886", "text": "func (room1 *RoomStruct) Intersects(room2 *RoomStruct) bool {\n\tvar x, y bool\n\tif (room2.X1 >= room1.X1) && (room2.X1 <= room1.X2) {\n\t\tx = true\n\t}\n\tif (room2.Y1 >= room1.Y1) && (room2.Y1 <= room1.Y2) {\n\t\ty = true\n\t}\n\tif (x) && (y) {\n\t\tfmt.Println(\"BUUUUUUUUUUUMP\")\n\t\treturn true\n\t} else {\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "3ac6bd19058894899f69964a6a85c270", "score": "0.5015617", "text": "func intersect(a, b []model.Fingerprint) []model.Fingerprint {\n\tif a == nil {\n\t\treturn b\n\t}\n\tresult := []model.Fingerprint{}\n\tfor i, j := 0, 0; i < len(a) && j < len(b); {\n\t\tif a[i] == b[j] {\n\t\t\tresult = append(result, a[i])\n\t\t}\n\t\tif a[i] < b[j] {\n\t\t\ti++\n\t\t} else {\n\t\t\tj++\n\t\t}\n\t}\n\treturn result\n}", "title": "" }, { "docid": "0382529efe44fd4f6d2b20e6732005eb", "score": "0.50130737", "text": "func TestIntersectionOfTwoArraysIi(t *testing.T) {\n\tfmt.Println(intersect([]int{1, 2, 2,2,3,3,4, 1}, []int{2, 2,3,3}))\n\tfmt.Println(intersect([]int{4, 9, 5}, []int{9, 4, 9, 8, 4}))\n}", "title": "" }, { "docid": "9e7e63107ecafc9c4de2c575d1e630b5", "score": "0.5011399", "text": "func intersect(nums1 []int, nums2 []int) []int {\n\tmaps := make(map[int]int)\n\tfor i := 0; i < len(nums1); i++ {\n\t\tmaps[nums1[i]]++ // Calculate the number of occurrences\n\t}\n\tres := []int{}\n\tfor j := 0; j < len(nums2); j++ {\n\t\tif v, ok := maps[nums2[j]]; ok && v > 0 {\n\t\t\tmaps[nums2[j]]-- // need to subtract one\n\t\t\tres = append(res, nums2[j])\n\t\t}\n\t}\n\treturn res\n}", "title": "" }, { "docid": "9d64812177fc466db17c827fa3b28f61", "score": "0.50074244", "text": "func (pb *Body) IntersectMultiple(physics map[string]Physic) (string, bool) {\n\tfor _, p := range physics {\n\t\tif pb.Intersect(p) {\n\t\t\tpb.Log.Warnf(\"%s [%d , %d] (%dx%d) intersect with %s [%d , %d] (%dx%d)\",\n\t\t\t\tpb.ID(),\n\t\t\t\tint(pb.Position().X), int(pb.Position().Y),\n\t\t\t\tint(pb.Dimension().W), int(pb.Dimension().H),\n\t\t\t\tp.ID(),\n\t\t\t\tint(p.Position().X), int(p.Position().Y),\n\t\t\t\tint(p.Dimension().W), int(p.Dimension().H))\n\t\t\treturn p.ID(), true\n\t\t}\n\t}\n\treturn \"\", false\n}", "title": "" }, { "docid": "6677c748c2d873ba046763874ab880d0", "score": "0.49931112", "text": "func busyStudent(startTime []int, endTime []int, queryTime int) int {\n\tbusy := 0\n\n\tfor i := 0; i < len(startTime); i++ {\n\t\tif startTime[i] <= queryTime && endTime[i] >= queryTime {\n\t\t\tbusy++\n\t\t}\n\t}\n\n\treturn busy\n}", "title": "" }, { "docid": "5cb1fd6bbb21e71c2a612d19af404eee", "score": "0.49916875", "text": "func (r IPRange) overlapsStartOf(other IPRange) bool {\n\treturn r.from.lessOrEq(other.from) && r.to.Less(other.to)\n}", "title": "" }, { "docid": "20f0cbd2f7ebf5d7a4ecd4f2335ec6c1", "score": "0.49888605", "text": "func intersection(array1, array2 []int) int {\n\tvar count int\n\tfor _, elem1 := range array1 {\n\t\tfor _, elem2 := range array2 {\n\t\t\tif elem1 == elem2 {\n\t\t\t\tcount++\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\treturn count\n}", "title": "" }, { "docid": "9d3b14b59ef92a9f2a2ce81266ca995c", "score": "0.49833173", "text": "func ownershipMap(ctx *ValidationContext) map[int]OwnershipContext {\n\townershipMap := map[int]OwnershipContext{}\n\n\tif !ctx.Stasher.Edges(func(lineContext reader2.LineContext, edge reader.Edge) bool {\n\t\tif lineContext.Element.Label != \"contains\" {\n\t\t\treturn true\n\t\t}\n\t\tedge, ok := lineContext.Element.Payload.(reader.Edge)\n\t\tif !ok {\n\t\t\treturn true\n\t\t}\n\t\tif outContext, ok := ctx.Stasher.Vertex(edge.OutV); !ok || outContext.Element.Label != \"document\" {\n\t\t\treturn true\n\t\t}\n\n\t\treturn forEachInV(edge, func(inV int) bool {\n\t\t\tif other, ok := ownershipMap[inV]; ok {\n\t\t\t\tctx.AddError(\"range %d already claimed by document %d\", inV, other.DocumentID).AddContext(lineContext, other.LineContext)\n\t\t\t\treturn false\n\t\t\t}\n\n\t\t\townershipMap[inV] = OwnershipContext{DocumentID: edge.OutV, LineContext: lineContext}\n\t\t\treturn true\n\t\t})\n\t}) {\n\t\treturn nil\n\t}\n\n\treturn ownershipMap\n}", "title": "" }, { "docid": "15e50413b316dce70fd47c44d2170550", "score": "0.49809942", "text": "func iou(r1, r2 image.Rectangle) float64 {\n\t// get the intesection rectangle\n\tintersection := image.Rect(\n\t\tmax(r1.Min.X, r2.Min.X),\n\t\tmax(r1.Min.Y, r2.Min.Y),\n\t\tmin(r1.Max.X, r2.Max.X),\n\t\tmin(r1.Max.Y, r2.Max.Y),\n\t)\n\t// compute the area of intersection rectangle\n\tinterArea := area(intersection)\n\tr1Area := area(r1)\n\tr2Area := area(r2)\n\t// compute the intersection over union by taking the intersection\n\t// area and dividing it by the sum of prediction + ground-truth\n\t// areas - the interesection area\n\treturn float64(interArea) / float64(r1Area+r2Area-interArea)\n}", "title": "" }, { "docid": "890de96350d788f44db987475ec73852", "score": "0.49803978", "text": "func Intersect(a string, b string) string {\n\tsa := SetOfStrings(a)\n\tsb := SetOfStrings(b)\n\tintersect := \"\"\n\tfor _, val := range sa {\n\t\tif SliceContains(sb, val) {\n\t\t\tif len(intersect) == 0 {\n\t\t\t\tintersect = val\n\t\t\t} else {\n\t\t\t\tintersect = intersect + \" \" + val\n\t\t\t}\n\t\t}\n\t}\n\treturn intersect\n}", "title": "" }, { "docid": "cb84009aae56f1bd4d93dd8dfe063892", "score": "0.49641794", "text": "func (n AngularInterval) Intersection(x AngularInterval) AngularInterval {\n\tswitch {\n\tcase n.Empty || x.Empty:\n\t\treturn EmptyAngularInterval\n\tcase n.Full:\n\t\treturn x\n\tcase x.Full:\n\t\treturn n\n\tdefault:\n\t\tvar rad0, rad1 float64\n\t\tswitch {\n\t\tcase n.Contains(x.Rad0):\n\t\t\trad0 = x.Rad0\n\t\tcase x.Contains(n.Rad0):\n\t\t\trad0 = n.Rad0\n\t\tdefault:\n\t\t\treturn EmptyAngularInterval\n\t\t}\n\t\tswitch {\n\t\tcase n.Contains(x.Rad1):\n\t\t\trad1 = x.Rad1\n\t\tcase x.Contains(n.Rad1):\n\t\t\trad1 = n.Rad1\n\t\tdefault:\n\t\t\treturn EmptyAngularInterval\n\t\t}\n\t\treturn NewAngularInterval(rad0, rad1)\n\t}\n}", "title": "" }, { "docid": "71bc669a3bbe18564404ebd27794c92f", "score": "0.49635524", "text": "func TestIntersectSliceNil(t *testing.T) {\n\tvar s1, s2 []uint32\n\n\tassert.Nil(t, IntersectSlice(s1, s2))\n}", "title": "" }, { "docid": "06dbfd7e7c4af383bb289d7a0f3ff396", "score": "0.49612826", "text": "func countIntersect(froms, tos []Point) int {\n\tm := make(map[Point]int)\n\trs := 0\n\tfor i := 0; i < len(froms); i++ {\n\t\tif froms[i].x != tos[i].x && froms[i].y != tos[i].y {\n\t\t\tcontinue\n\t\t}\n\t\tif froms[i].x == tos[i].x {\n\t\t\tfor j := min(froms[i].y, tos[i].y); j <= max(froms[i].y, tos[i].y); j++ {\n\t\t\t\tm[Point{froms[i].x, j}]++\n\t\t\t\tif m[Point{froms[i].x, j}] == 2 {\n\t\t\t\t\trs++\n\t\t\t\t}\n\t\t\t}\n\t\t} else if froms[i].y == tos[i].y {\n\t\t\tfor j := min(froms[i].x, tos[i].x); j <= max(froms[i].x, tos[i].x); j++ {\n\t\t\t\tm[Point{j, froms[i].y}]++\n\t\t\t\tif m[Point{j, froms[i].y}] == 2 {\n\t\t\t\t\trs++\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn rs\n}", "title": "" }, { "docid": "4caced34963d67e2f58586a05818dc32", "score": "0.4959676", "text": "func intersection(nums1 []int, nums2 []int) []int {\n\tif nums1 == nil || nums2 == nil || len(nums1) == 0 || len(nums2) == 0 {\n\t\treturn nil\n\t}\n\tm := make(map[int]struct{})\n\tans := make(map[int]struct{})\n\tfor _, v := range nums1 {\n\t\tm[v] = struct{}{}\n\t}\n\n\tfor _, v := range nums2 {\n\t\tif _, ok := m[v]; ok {\n\t\t\tans[v] = struct{}{}\n\t\t}\n\t}\n\tansSlice := []int{}\n\tfor k, _ := range ans {\n\t\tansSlice = append(ansSlice, k)\n\t}\n\treturn ansSlice\n}", "title": "" }, { "docid": "c06483bcd007ece91a22a4f588be0c9e", "score": "0.4956636", "text": "func intersect(nums1 []int, nums2 []int) []int {\n\tvar record = make(map[int]int)\n\tfor _, v := range nums1 {\n\t\trecord[v]++\n\t}\n\n\tvar resultRecord = make(map[int]int)\n\tfor _, v := range nums2 {\n\t\tif vv, ok := record[v]; ok && vv > 0 {\n\t\t\tresultRecord[v]++\n\t\t\trecord[v]--\n\t\t}\n\t}\n\n\tvar res []int\n\tfor k, v := range resultRecord {\n\t\tfor i := 0; i < v; i++ {\n\t\t\tres = append(res, k)\n\t\t}\n\t}\n\treturn res\n}", "title": "" }, { "docid": "9aae1f45893acc5424881cc7fb78c5ac", "score": "0.49527502", "text": "func Intersection(a []corev1.ResourceName, b []corev1.ResourceName) []corev1.ResourceName {\n\tresult := make([]corev1.ResourceName, 0, len(a))\n\tfor _, item := range a {\n\t\tif Contains(result, item) {\n\t\t\tcontinue\n\t\t}\n\t\tif !Contains(b, item) {\n\t\t\tcontinue\n\t\t}\n\t\tresult = append(result, item)\n\t}\n\tsort.Slice(result, func(i, j int) bool { return result[i] < result[j] })\n\treturn result\n}", "title": "" }, { "docid": "e0310cd47ac249907da1b86764dd5c41", "score": "0.49488798", "text": "func intersect(slice1, slice2 []string) []string {\n\tvar result []string\n\tfor _, i := range slice1 {\n\t\tif Contains(slice2, i) {\n\t\t\tresult = append(result, i)\n\t\t}\n\t}\n\treturn result\n}", "title": "" }, { "docid": "71c3941d15b319301744bb8075d5ff24", "score": "0.49442703", "text": "func (s Span) Overlaps(o Span) bool {\n\tif len(s.EndKey) == 0 && len(o.EndKey) == 0 {\n\t\treturn s.Key.Equal(o.Key)\n\t} else if len(s.EndKey) == 0 {\n\t\treturn bytes.Compare(s.Key, o.Key) >= 0 && bytes.Compare(s.Key, o.EndKey) < 0\n\t} else if len(o.EndKey) == 0 {\n\t\treturn bytes.Compare(o.Key, s.Key) >= 0 && bytes.Compare(o.Key, s.EndKey) < 0\n\t}\n\treturn bytes.Compare(s.EndKey, o.Key) > 0 && bytes.Compare(s.Key, o.EndKey) < 0\n}", "title": "" }, { "docid": "83d763e08a1b83eaff41442214eaaf49", "score": "0.4926249", "text": "func isIntersecting(l1, l2 *LinkedLists.List) bool {\n\tfmt.Println(l1.Size, l2.Size)\n\treturn true\n}", "title": "" }, { "docid": "8043a49b76a5d1f9b9df0996d1691b2d", "score": "0.49262443", "text": "func main() {\n\tvar nums1, nums2 []int\n\n\tnums1 = []int{4, 9, 5}\n\tnums2 = []int{9, 4, 9, 8, 4}\n\tfmt.Println(intersect(nums1, nums2))\n\n\tnums1 = []int{1}\n\tnums2 = []int{1}\n\tfmt.Println(intersect(nums1, nums2))\n}", "title": "" }, { "docid": "65ee77ebfbf31344279676aa203f8f62", "score": "0.49247876", "text": "func (gdt *AABB) Intersection(\n\tp_with AABB, /* godot_aabb */\n) AABB {\n\n\t/* go_godot_aabb_intersection(API_STRUCT, *godot_aabb) ->godot_aabb */\n\n\tapi := CoreApi\n\trcv := (*C.godot_aabb)(unsafe.Pointer(gdt))\n\tin0 := (*C.godot_aabb)(unsafe.Pointer(&p_with))\n\n\tret := C.go_godot_aabb_intersection(\n\t\tapi,\n\t\trcv,\n\t\tin0,\n\t)\n\truntime.KeepAlive(in0)\n\n\treturn *(*AABB)(unsafe.Pointer(&ret))\n}", "title": "" }, { "docid": "063d7519c518ab81d0a7625fa81277ad", "score": "0.4923891", "text": "func skyline0(rects []rect) []seg {\n var segs []seg\n\n sort.Sort(ByLeftCoord(rects))\n\n // for a []rect of [A, B, C], we look\n // for the intersections of the rects \n // AB, AC, BC\n for i := 0; i < len(rects) - 1; i++ {\n for j := i + 1; j < len(rects); j++ {\n if (rects[i].intersects(rects[j])) {\n\n }\n }\n }\n\n \n\n return segs\n}", "title": "" }, { "docid": "cca842f444fdb2d9f4de3a5ba2edb079", "score": "0.49067703", "text": "func intersection(a []int, b []int) []int {\n\tmaxLen := len(a)\n\tif len(b) > maxLen {\n\t\tmaxLen = len(b)\n\t}\n\tr := make([]int, 0, maxLen)\n\tvar i, j int\n\tfor i < len(a) && j < len(b) {\n\t\tif a[i] < b[j] {\n\t\t\ti++\n\t\t} else if a[i] > b[j] {\n\t\t\tj++\n\t\t} else {\n\t\t\tr = append(r, a[i])\n\t\t\ti++\n\t\t\tj++\n\t\t}\n\t}\n\treturn r\n}", "title": "" }, { "docid": "07029117382ee49d954af27cc260de2a", "score": "0.49063945", "text": "func execmRectangleOverlaps(_ int, p *gop.Context) {\n\targs := p.GetArgs(2)\n\tret := args[0].(image.Rectangle).Overlaps(args[1].(image.Rectangle))\n\tp.Ret(2, ret)\n}", "title": "" }, { "docid": "dfc29debda76e254af14566d756e21ab", "score": "0.490143", "text": "func IsMemberOf(claim string, claims ...string) bool {\n\tif len(claims) == 0 {\n\t\treturn false\n\t}\n\tfor _, s := range claims {\n\t\tif s == claim {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "f07ae75d4b1b27181b6613426c0da89c", "score": "0.48997602", "text": "func (r Rectangle) Intersect(s Rectangle) Rectangle {\n\tir := Rect(r.Min[0], r.Min[1], r.Min[2], r.Max[0], r.Max[1], r.Max[2])\n\tif ir.Min[0] < s.Min[0] {\n\t\tir.Min[0] = s.Min[0]\n\t}\n\tif ir.Min[1] < s.Min[1] {\n\t\tir.Min[1] = s.Min[1]\n\t}\n\tif ir.Min[2] < s.Min[2] {\n\t\tir.Min[2] = s.Min[2]\n\t}\n\tif ir.Max[0] > s.Max[0] {\n\t\tir.Max[0] = s.Max[0]\n\t}\n\tif ir.Max[1] > s.Max[1] {\n\t\tir.Max[1] = s.Max[1]\n\t}\n\tif ir.Max[2] > s.Max[2] {\n\t\tir.Max[2] = s.Max[2]\n\t}\n\tif ir.Min[0] > ir.Max[0] || ir.Min[1] > ir.Max[1] {\n\t\treturn ZR\n\t}\n\treturn ir\n}", "title": "" }, { "docid": "e0e4d818385bed46543cfddf52a17878", "score": "0.48982888", "text": "func (pgs *PrefetchGlobalState) findCoveredRange(\n\tpfm *PrefetchFileMetadata,\n\tstartOfs int64,\n\tendOfs int64) (int, int) {\n\t// check if there is ANY intersection with cache\n\tif endOfs < pfm.cache.startByte ||\n\t\tpfm.cache.endByte < startOfs {\n\t\treturn -1, -1\n\t}\n\n\tfirst := -1\n\tfor k, iovec := range pfm.cache.iovecs {\n\t\tif iovec.startByte <= startOfs &&\n\t\t\tiovec.endByte >= startOfs {\n\t\t\tfirst = k\n\t\t\tbreak\n\t\t}\n\t}\n\tcheck(first >= 0)\n\n\tlast := -1\n\tfor k, iovec := range pfm.cache.iovecs {\n\t\tif iovec.startByte <= endOfs &&\n\t\t\tiovec.endByte >= endOfs {\n\t\t\tlast = k\n\t\t\tbreak\n\t\t}\n\t}\n\tif last == -1 {\n\t\t// The IO ends after the cache.\n\t\tlast = len(pfm.cache.iovecs) - 1\n\t}\n\n\tif pgs.verboseLevel >= 2 {\n\t\tpfm.log(\"findCoverRange: first,last=(%d,%d) IO=[%d -- %d]\",\n\t\t\tfirst, last, startOfs, endOfs)\n\t}\n\n\treturn first, last\n}", "title": "" }, { "docid": "1f08c290fbaed1adfb2a7b7b999b4e31", "score": "0.48970342", "text": "func areOverlapping(event1, event2 Event) bool {\n\treturn event2.StartTime < event1.EndTime\n}", "title": "" }, { "docid": "b549df9dd5fad7dbd9445a44ac587e46", "score": "0.48957354", "text": "func intersection(nums1 []int, nums2 []int) []int {\r\n\trst := []int{}\r\n\tmap1 := make(map[int]bool)\r\n\tfor _, num := range nums1 {\r\n\t\tmap1[num] = true\r\n\t}\r\n\tfor _, num := range nums2 {\r\n\t\tif _, ok := map1[num]; ok {\r\n\t\t\tdelete(map1, num)\r\n\t\t\trst = append(rst, num)\r\n\t\t}\r\n\t}\r\n\treturn rst\r\n}", "title": "" }, { "docid": "b52e2f1ed699fe8ce91c87bb349c21c5", "score": "0.48911968", "text": "func DetectOverlaps(subfile SubtitleFile) []Subtitle {\n\t// Maybe in case of \"longer\" overlaps eg. sub 5 w/ sub 20, we should return the offending pair instead of the consecutive ones\n\tvar overlaps []Subtitle\n\tfor i := 0; i < len(subfile.Subtitles)-1; i++ {\n\t\tif subfile.Subtitles[i].End > subfile.Subtitles[i+1].Start {\n\t\t\toverlaps = append(overlaps, subfile.Subtitles[i], subfile.Subtitles[i+1])\n\t\t}\n\t}\n\treturn overlaps\n}", "title": "" }, { "docid": "ecbdc8c45fca457c5888ec39d612bb5e", "score": "0.48890683", "text": "func FindIntersection(strArr []string) string {\n splitted := splitStrArr(strArr[0])\n m1 := buildMap(splitted)\n m2 := buildMap(splitStrArr(strArr[1]))\n \n \n var r []string\n for _, v := range splitted {\n if (m1[v] > 0 && m2[v] > 0) {\n if (m1[v] <= m2[v]) {\n for i := 0; i < m1[v]; i++ {\n r = append(r, v)\n }\n } else {\n for i := 0; i < m2[v]; i++ {\n r = append(r, v)\n }\n }\n }\n }\n\n if (len(r) == 0) {\n return \"false\"\n }\n\n return strings.Join(r, \",\");\n\n}", "title": "" }, { "docid": "0783812f29a44e1047521e4490cfe4b3", "score": "0.48848656", "text": "func (a Seg2) DoesIsectOrTouch(b Seg2) bool {\n aray := a.Ray()\n bray := b.Ray()\n\n bp := b.P.Sub(a.P)\n bq := b.Q.Sub(a.P)\n ap := a.P.Sub(b.P)\n aq := a.Q.Sub(b.P)\n\n cross_bp := CrossProduct(aray, bp)\n cross_bq := CrossProduct(aray, bq)\n cross_ap := CrossProduct(bray, ap)\n cross_aq := CrossProduct(bray, aq)\n\n return ((cross_ap <= 0 && cross_aq >= 0) || (cross_ap >= 0 && cross_aq <= 0)) &&\n ((cross_bp <= 0 && cross_bq >= 0) || (cross_bp >= 0 && cross_bq <= 0))\n}", "title": "" }, { "docid": "f9a5f852c627ce55dec93afe514a5172", "score": "0.48836625", "text": "func (in CompositeResourceDefinition) OffersClaim() bool {\n\treturn in.Spec.ClaimNames != nil\n}", "title": "" }, { "docid": "68618d5a69a07924dee7441ee2333dfa", "score": "0.487949", "text": "func (set Int) Intersect(other Int) Int {\n\tvar big, small Int\n\tif len(set) < len(other) {\n\t\tbig = other\n\t\tsmall = set\n\t} else {\n\t\tbig = set\n\t\tsmall = other\n\t}\n\n\tresult := NewInt()\n\tfor value := range small {\n\t\tif _, ok := big[value]; ok {\n\t\t\tresult[value] = struct{}{}\n\t\t}\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "be12a3efc16ea80b4ea7bc871bae7de7", "score": "0.48728377", "text": "func verifyCIDRsNotOverlap(acidr, bcidr *net.IPNet) error {\n\tif acidr.Contains(bcidr.IP) || bcidr.Contains(acidr.IP) {\n\t\treturn errors.Errorf(\"CIDRS %s and %s overlap\", acidr.String(), bcidr.String())\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1da11b1f6d4d4e8f498ad99e2e29ab38", "score": "0.4870369", "text": "func main() {\n\t// same object means same list suffix ? so we need to find common suffix then so we can start from back with 2 pointers\n\t// it s simple link list though, so we would want to reverse it first so we can traverse in order, but thats not efficient\n\t// cut the list to same length because only that part can have a matching suffix,\n\t// actually, dont need to cut just move the pointer there\n\n\ta := []int{2, 4, 77, 3, 7, 8, 10}\n\tb := []int{99, 1, 8, 10}\n\tia := 0\n\tib := 0\n\t// move indexes until tails are the same length\n\tfor i := 0; i < len(a)-len(b); i++ {\n\t\tia++ // next\n\t}\n\tfor i := 0; i < len(b)-len(a); i++ {\n\t\tib++ // next\n\t}\n\t// iterate the two pointers until we get the same node\n\tfor ia < len(a) && ib < len(b) {\n\t\tif a[ia] == b[ib] {\n\t\t\tfmt.Printf(\"found intersection at %d \\n\", a[ia])\n\t\t\treturn\n\t\t}\n\t\tia++ // next\n\t\tib++ // next\n\t}\n\tfmt.Println(\"No intersection\")\n}", "title": "" }, { "docid": "91cb11f1861a76a76d993d81247b29a8", "score": "0.4866063", "text": "func MakeIntersectOperator(op *Operator, operands map[string]string) {\n\tmode := \"all\"\n\tif operands[\"mode\"] == \"any\" {\n\t\tmode = \"any\"\n\t}\n\tmatrix := make(map[[2]int]int)\n\n\tgetMatrixVal := func(cell [2]int, t time.Time) int {\n\t\tval, ok := matrix[cell]\n\t\tif ok {\n\t\t\treturn val\n\t\t}\n\t\tmd := driver.GetMatrixDataBefore(op.Parents[1].Name, cell[0], cell[1], t)\n\t\tif md == nil {\n\t\t\tmatrix[cell] = 0\n\t\t} else {\n\t\t\tmatrix[cell] = md.Val\n\t\t}\n\t\treturn matrix[cell]\n\t}\n\n\t// map from parent sequence ID to our sequence\n\tsequences := make(map[int]*Sequence)\n\n\t// set of parent sequence IDs that failed the intersection test\n\trejectedSeqs := make(map[int]bool)\n\n\top.InitFunc = func(frame *Frame) {\n\t\tdriver.UndoSequences(op.Name, frame.Time)\n\n\t\tfor _, seq := range GetUnterminatedSequences(op.Name) {\n\t\t\tparentID, _ := strconv.Atoi(seq.GetMetadata()[0])\n\t\t\tsequences[parentID] = seq\n\t\t}\n\n\t\top.updateChildRerunTime(frame.Time)\n\t}\n\n\top.Func = func(frame *Frame, pd ParentData) {\n\t\tseqs := pd.Sequences[0]\n\t\tmatrixData := pd.MatrixData[0]\n\n\t\t// update matrix\n\t\tfor _, md := range matrixData {\n\t\t\tmatrix[[2]int{md.I, md.J}] = md.Val\n\t\t}\n\n\t\t// evaluate new sequences\n\t\t// TODO: should we do evaluation only when sequence is about to disappear?\n\t\t// (so we use the latest image data)\n\t\tfor _, seq := range seqs {\n\t\t\tif sequences[seq.ID] != nil || rejectedSeqs[seq.ID] {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// determine intersection depending on mode\n\t\t\tvar okay bool\n\t\t\tif mode == \"all\" {\n\t\t\t\tokay = true\n\t\t\t\tfor _, member := range seq.Members {\n\t\t\t\t\tcell := ToCell(member.Detection.Polygon.Bounds().Center(), MatrixGridSize)\n\t\t\t\t\tval := getMatrixVal(cell, frame.Time)\n\t\t\t\t\tif val <= 0 {\n\t\t\t\t\t\tokay = false\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if mode == \"any\" {\n\t\t\t\tokay = false\n\t\t\t\tfor _, member := range seq.Members {\n\t\t\t\t\tcell := ToCell(member.Detection.Polygon.Bounds().Center(), MatrixGridSize)\n\t\t\t\t\tval := getMatrixVal(cell, frame.Time)\n\t\t\t\t\tif val > 0 {\n\t\t\t\t\t\tokay = true\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif !okay {\n\t\t\t\trejectedSeqs[seq.ID] = true\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tmySeq := NewSequence(op.Name, seq.Time)\n\t\t\tmySeq.AddMetadata(fmt.Sprintf(\"%d\", seq.ID), seq.Time)\n\t\t\tfor _, member := range seq.Members {\n\t\t\t\tmySeq.AddMember(member.Detection, seq.Time)\n\t\t\t}\n\t\t\tmySeq.Terminate(mySeq.Members[len(mySeq.Members)-1].Detection.Time)\n\t\t\tsequences[seq.ID] = mySeq\n\t\t}\n\t}\n\n\top.Loader = op.SequenceLoader\n}", "title": "" }, { "docid": "a3f9f6bac12f3a8ceca4ddb36ef8f4f2", "score": "0.48641905", "text": "func intersect(a, b, c, d []int32) bool {\n\tif intersectProp(a, b, c, d) {\n\t\treturn true\n\t} else if between(a, b, c) || between(a, b, d) || between(c, d, a) || between(c, d, b) {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "6a4ae5649c896499ef625f96fa90cefb", "score": "0.4862909", "text": "func (p *AdamanPlayer) evalClaim(target *DecktetCard, cards []*DecktetCard) int {\n\t// list should already match suits\n\tvar targetV, listV int\n\ttargetV = rankToInt(target)\n\tfor _, c := range cards {\n\t\tlistV += rankToInt(c)\n\t}\n\treturn listV - targetV\n}", "title": "" }, { "docid": "970610a2d64ce386fe8298935e4e16b5", "score": "0.48585102", "text": "func intersection(nums1 []int, nums2 []int) []int {\n\tm := make(map[int]int)\n\tfor _, n := range nums1 {\n\t\tm[n] = 1\n\t}\n\n\tout := make([]int, 0)\n\tfor _, n := range nums2 {\n\t\tif v, ok := m[n]; ok && v == 1 {\n\t\t\tm[n]++\n\t\t\tout = append(out, n)\n\t\t}\n\t}\n\treturn out\n}", "title": "" }, { "docid": "de421186ba97df87f1b7864920455721", "score": "0.48565653", "text": "func (r Rectangle) Intersect(s Rectangle) Rectangle {\n\tif r.Min.X < s.Min.X {\n\t\tr.Min.X = s.Min.X\n\t}\n\tif r.Min.Y < s.Min.Y {\n\t\tr.Min.Y = s.Min.Y\n\t}\n\tif r.Max.X > s.Max.Y {\n\t\tr.Max.X = s.Max.X\n\t}\n\tif r.Max.Y > s.Max.Y {\n\t\tr.Max.Y = s.Max.Y\n\t}\n\tif r.Min.X > r.Max.X || r.Min.Y > r.Max.Y {\n\t\treturn ZR\n\t}\n\treturn r\n}", "title": "" }, { "docid": "3fc6b30f65fc5c470c2967cc39700c60", "score": "0.4854305", "text": "func (b *Series) intersection(start, end time.Time) (bool, time.Time, time.Time) {\n\tif b.EndTime().Before(start) || b.StartTime().After(end) {\n\t\treturn false, start, end\n\t}\n\tif start.Before(b.StartTime()) {\n\t\tstart = b.StartTime()\n\t}\n\tif end.After(b.EndTime()) {\n\t\tend = b.EndTime()\n\t}\n\tif start.Equal(end) {\n\t\treturn false, start, end\n\t}\n\treturn true, start, end\n}", "title": "" }, { "docid": "aa0c058aae64a9d0a863fca3b65e0b7b", "score": "0.48480368", "text": "func IntersectTwoMap(IDsA, IDsB map[int]bool) map[int]bool {\n\tvar retIDs map[int]bool // for traversal it is smaller one\n\tvar checkIDs map[int]bool // for checking it is bigger one\n\tif len(IDsA) >= len(IDsB) {\n\t\tretIDs = IDsB\n\t\tcheckIDs = IDsA\n\t} else {\n\t\tretIDs = IDsA\n\t\tcheckIDs = IDsB\n\t}\n\tfor id := range retIDs {\n\t\tif _, exists := checkIDs[id]; !exists {\n\t\t\tdelete(checkIDs, id)\n\t\t}\n\t}\n\treturn retIDs\n}", "title": "" }, { "docid": "5ee6b2fc151d29cc461c151b05df8b5a", "score": "0.48399088", "text": "func DoClaim(ctx *Context, req *ClaimMessage) (uint64, *common.HexInt) {\n\tclaim := ctx.preCommit.queryAndAdd(req.BlockHeight, req.BlockHash, req.Address)\n\tif claim != nil {\n\t\t// already claimed in current block\n\t\treturn claim.BlockHeight, nil\n\t}\n\n\tvar ia *IScoreAccount = nil\n\tvar err error\n\tisDB := ctx.DB\n\n\tvar cDB, qDB db.Database\n\tvar bucket db.Bucket\n\tvar bs []byte\n\n\t// read from claim DB\n\tcDB = isDB.getClaimDB()\n\tbucket, _ = cDB.GetBucket(db.PrefixIScore)\n\tbs, _ = bucket.Get(req.Address.Bytes())\n\tif bs != nil {\n\t\tclaim, _ = NewClaimFromBytes(bs)\n\t}\n\n\t// read from account query DB\n\tqDB = isDB.getQueryDB(req.Address)\n\tbucket, _ = qDB.GetBucket(db.PrefixIScore)\n\tbs, _ = bucket.Get(req.Address.Bytes())\n\tif bs != nil {\n\t\tia, err = NewIScoreAccountFromBytes(bs)\n\t\tif nil != err {\n\t\t\tgoto ERROR\n\t\t}\n\t\tia.Address = req.Address\n\t} else {\n\t\t// No Info. about account\n\t\tgoto ERROR\n\t}\n\n\tif claim != nil {\n\t\tif ia.BlockHeight == claim.BlockHeight {\n\t\t\t// already claimed in current period\n\t\t\tctx.preCommit.delete(req.BlockHeight, req.BlockHash, req.Address)\n\t\t\treturn ia.BlockHeight, nil\n\t\t}\n\t\t// subtract claimed I-Score\n\t\tia.IScore.Sub(&ia.IScore.Int, &claim.IScore.Int)\n\t}\n\n\t// Can't claim an I-Score less than 1000\n\tif ia.IScore.Cmp(BigIntClaimMinIScore) == -1 {\n\t\tgoto ERROR\n\t} else {\n\t\tvar remain common.HexInt\n\t\tremain.Mod(&ia.IScore.Int, BigIntClaimMinIScore)\n\t\tia.IScore.Sub(&ia.IScore.Int, &remain.Int)\n\t}\n\n\t// update preCommit with calculated I-Score\n\terr = ctx.preCommit.update(req.BlockHeight, req.BlockHash, ia)\n\tif err != nil {\n\t\tlog.Printf(\"Failed to update preCommit. err=%+v\", err)\n\t\tgoto ERROR\n\t}\n\n\treturn ia.BlockHeight, &ia.IScore\n\nERROR:\n\tctx.preCommit.delete(req.BlockHeight, req.BlockHash, req.Address)\n\treturn 0, nil\n}", "title": "" }, { "docid": "4e76de1b44a9349ab5c3b28443400d22", "score": "0.48359767", "text": "func Example() {\n\tvar c jwt.Claims\n\tc.Issuer = \"malory\"\n\tc.Subject = \"sterling\"\n\tc.Audiences = []string{\"armory\"}\n\n\t// Approval is a custom claim element.\n\ttype Approval struct {\n\t\tName string `json:\"name\"`\n\t\tCount int `json:\"count\"`\n\t}\n\tc.Set = map[string]interface{}{\n\t\t\"approved\": []Approval{{\"RPG-7\", 1}},\n\t}\n\n\t// issue a JWT\n\ttoken, err := c.RSASign(jwt.RS256, RSAPrivateKey)\n\tif err != nil {\n\t\tfmt.Println(\"token creation failed on\", err)\n\t\treturn\n\t}\n\n\t// validate the JWT\n\tclaims, err := jwt.RSACheck(token, RSAPublicKey)\n\tif err != nil {\n\t\tfmt.Println(\"credentials denied on\", err)\n\t\treturn\n\t}\n\tif !claims.Valid(time.Now()) {\n\t\tfmt.Println(\"time constraints exceeded\")\n\t\treturn\n\t}\n\tif !claims.AcceptAudience(\"armory\") {\n\t\tfmt.Println(\"reject on audience\", claims.Audiences)\n\t\treturn\n\t}\n\tfmt.Println(string(claims.Raw))\n\t// Output:\n\t// {\"approved\":[{\"name\":\"RPG-7\",\"count\":1}],\"aud\":[\"armory\"],\"iss\":\"malory\",\"sub\":\"sterling\"}\n}", "title": "" }, { "docid": "7e4f28048ca9e0b65826f7af7d37616e", "score": "0.48352185", "text": "func (ms *MemberSet) Intersection(b *MemberSet) *MemberSet {\n\tresult := hamt.NewSet()\n\n\tset := ms.set\n\n\tfor set.Size() != 0 {\n\t\tvar entry hamt.Entry\n\t\tentry, set = set.FirstRest()\n\n\t\tif b.set.Include(entry) {\n\t\t\tresult = result.Insert(entry)\n\t\t}\n\t}\n\n\treturn &MemberSet{result}\n}", "title": "" }, { "docid": "143b5198e88122ddfab90ee2793d561a", "score": "0.4831025", "text": "func (w Wire) Intersect(other Wire) []h.Point {\n\tvar res []h.Point\n\tfor k := range w {\n\t\tif _, ok := other[k]; ok {\n\t\t\tres = append(res, k)\n\t\t}\n\t}\n\treturn res\n}", "title": "" }, { "docid": "afb8316aa281e6e9cb48daf8d9a855ac", "score": "0.48293632", "text": "func Intersect(nums1 []int, nums2 []int) []int {\n\tres := make([]int, 0)\n\t// Sort the smallest one\n\tif len(nums1) < len(nums2) {\n\t\tsort.Ints(nums1)\n\t\t// Search every element of bigger array in smaller array\n\t\t// and print the element if found\n\t\tfor _, v := range nums2 {\n\t\t\tif i := Search(nums1, v); i != -1 {\n\t\t\t\tnums1 = append(nums1[:i], nums1[i+1:]...)\n\t\t\t\tres = append(res, v)\n\t\t\t}\n\t\t}\n\t} else {\n\t\tsort.Ints(nums2)\n\t\t// Search every element of bigger array in smaller array\n\t\t// and print the element if found\n\t\tfor _, v := range nums1 {\n\t\t\tif i := Search(nums2, v); i != -1 {\n\t\t\t\tnums2 = append(nums2[:i], nums2[i+1:]...)\n\t\t\t\tres = append(res, v)\n\t\t\t}\n\t\t}\n\t}\n\treturn res\n}", "title": "" }, { "docid": "da85a9547a301daf8ab6d31044061d7b", "score": "0.4828965", "text": "func intersect(nums1 []int, nums2 []int) []int {\n\tm1, m2 := make(map[int]int), make(map[int]int)\n\tfor _, val := range nums1 {\n\t\tif num, ok := m1[val]; ok {\n\t\t\tm1[val] = num + 1\n\t\t} else {\n\t\t\tm1[val] = 1\n\t\t}\n\t}\n\tfor _, val := range nums2 {\n\t\tif num, ok := m2[val]; ok {\n\t\t\tm2[val] = num + 1\n\t\t} else {\n\t\t\tm2[val] = 1\n\t\t}\n\t}\n\tvar short, long map[int]int\n\tif len(m1) > len(m2) {\n\t\tshort = m2\n\t\tlong = m1\n\t} else {\n\t\tshort = m1\n\t\tlong = m2\n\t}\n\tresult := make([]int, 0)\n\tfor key := range short {\n\t\tif longCount, exist := long[key]; exist {\n\t\t\tvar count int\n\t\t\tif longCount < short[key] {\n\t\t\t\tcount = longCount\n\t\t\t} else {\n\t\t\t\tcount = short[key]\n\t\t\t}\n\t\t\tfor i := 0; i < count; i++ {\n\t\t\t\tresult = append(result, key)\n\t\t\t}\n\t\t}\n\t}\n\treturn result\n}", "title": "" }, { "docid": "2e803c3e3494e231349f5afcf663aebe", "score": "0.4825451", "text": "func (obj Object) Intersect(other Object) [][3]*Term {\n\tr := [][3]*Term{}\n\tfor _, i := range obj {\n\t\tfor _, j := range other {\n\t\t\tif i[0].Equal(j[0]) {\n\t\t\t\tr = append(r, [...]*Term{&Term{Value: i[0].Value}, i[1], j[1]})\n\t\t\t}\n\t\t}\n\t}\n\treturn r\n}", "title": "" }, { "docid": "b30f045957836f4cbfb506fcffb7deae", "score": "0.48105064", "text": "func Intersect(rows ...string) string {\n\treturn rowOperation(\"Intersect\", rows...)\n}", "title": "" }, { "docid": "c2fa71f2ab755cd0172a1a0974479673", "score": "0.48066658", "text": "func (r *Region) Intersect(other *Region) Status {\n\tc_r := (*C.cairo_region_t)(r.ToC())\n\tc_other := (*C.cairo_region_t)(other.ToC())\n\n\tretC := C.cairo_region_intersect(c_r, c_other)\n\treturn Status(retC)\n}", "title": "" }, { "docid": "3dfa06e301925bc8bd2e2d5e1d792c64", "score": "0.48058623", "text": "func checkInclusion(s1 string, s2 string) bool {\n target := make(map[byte]int)\n window := make(map[byte]int)\n for i:=0; i<len(s1); i++ {\n target[s1[i]]++\n }\n \n left, right, match := 0, 0, 0\n \n for right < len(s2) {\n c := s2[right]\n right++\n if target[c] != 0 {\n window[c]++\n if window[c] == target[c] {\n match ++\n }\n }\n \n for right - left >= len(s1) {\n if match == len(target) {\n return true\n }\n \n d := s2[left]\n left ++\n if target[d] != 0 {\n if target[d] == window[d] {\n match --\n }\n window[d] --\n }\n }\n }\n return false\n}", "title": "" } ]
5f604c35f8908d6d8fcabbe165436b51
NewIssueGetLabelParams creates a new IssueGetLabelParams object with the default values initialized.
[ { "docid": "db4567a54c73d1ed07247b2f929ec64d", "score": "0.8693827", "text": "func NewIssueGetLabelParams() *IssueGetLabelParams {\n\tvar ()\n\treturn &IssueGetLabelParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" } ]
[ { "docid": "fe6bec5ce1278790dbc4ef4c00e59775", "score": "0.7380474", "text": "func NewIssueGetLabelParamsWithHTTPClient(client *http.Client) *IssueGetLabelParams {\n\tvar ()\n\treturn &IssueGetLabelParams{\n\t\tHTTPClient: client,\n\t}\n}", "title": "" }, { "docid": "1b8a2940aeae19ce998be024fc6b5a4e", "score": "0.7211782", "text": "func NewIssueGetLabelParamsWithTimeout(timeout time.Duration) *IssueGetLabelParams {\n\tvar ()\n\treturn &IssueGetLabelParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "title": "" }, { "docid": "0a5c9ac9d54ecaed672347e2ab7d64e1", "score": "0.66395134", "text": "func NewIssueRemoveLabelParams() *IssueRemoveLabelParams {\n\tvar ()\n\treturn &IssueRemoveLabelParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "24bc4ef90b18986e843209c9f7aa8550", "score": "0.65039396", "text": "func (o *IssueGetLabelParams) WithTimeout(timeout time.Duration) *IssueGetLabelParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "title": "" }, { "docid": "eee1e382d995daacff7fbee5f27f3701", "score": "0.6237525", "text": "func (o *IssueGetLabelParams) WithContext(ctx context.Context) *IssueGetLabelParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "0216aa60e6fbbd0cfb929f84868102fb", "score": "0.6073367", "text": "func (o *IssueGetLabelParams) WithID(id int64) *IssueGetLabelParams {\n\to.SetID(id)\n\treturn o\n}", "title": "" }, { "docid": "fe5b38b60abc97bf6e7fac27d4a2478c", "score": "0.5919073", "text": "func (o *IssueGetLabelParams) WithHTTPClient(client *http.Client) *IssueGetLabelParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "title": "" }, { "docid": "7f8ee5fbade5be2bc9bd395b4431a759", "score": "0.58949965", "text": "func NewGetIconParams() *GetIconParams {\n\treturn &GetIconParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "5be4c1634fd02c25edaf6acb41acd022", "score": "0.58045185", "text": "func NewGetBootstrapParams() *GetBootstrapParams {\n\tvar ()\n\treturn &GetBootstrapParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "c0fae75e106ef2ac4c3bbc8303011c47", "score": "0.56372285", "text": "func NewIssueRemoveLabelParamsWithHTTPClient(client *http.Client) *IssueRemoveLabelParams {\n\tvar ()\n\treturn &IssueRemoveLabelParams{\n\t\tHTTPClient: client,\n\t}\n}", "title": "" }, { "docid": "78a8daa217a4c8da78e5aea6a621c939", "score": "0.56118137", "text": "func NewGetUIParams() *GetUIParams {\n\n\treturn &GetUIParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "8c9bc72b47e17ec15bdf9c83953790aa", "score": "0.5497574", "text": "func NewIssueGetLabelParamsWithContext(ctx context.Context) *IssueGetLabelParams {\n\tvar ()\n\treturn &IssueGetLabelParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "0ba4f7bc430310329c16eeb385d3fae6", "score": "0.54281986", "text": "func NewGetParams() *GetParams {\n\tvar (\n\t\tdeviceOSDefault = string(\"Android 9\")\n\t\tsendToEmailDefault = string(\"no\")\n\t)\n\treturn &GetParams{\n\t\tDeviceOS: &deviceOSDefault,\n\t\tSendToEmail: &sendToEmailDefault,\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "a32f6f95a8dcb11e38cd5e1bb0393c32", "score": "0.5423726", "text": "func (fc *fakeClient) GetIssueLabels(owner, repo string, number int) ([]github.Label, error) {\n\tvar la []github.Label\n\tfor _, l := range fc.labels {\n\t\tla = append(la, github.Label{Name: l})\n\t}\n\treturn la, nil\n}", "title": "" }, { "docid": "2314c74b56416c8cb5f6063fdd70f939", "score": "0.53958136", "text": "func (m *MockClient) GetIssueLabels(org, repo string, number int) ([]github.Label, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetIssueLabels\", org, repo, number)\n\tret0, _ := ret[0].([]github.Label)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "8236a61aa746d87cc0abd7b48b19549b", "score": "0.5374779", "text": "func (m *MockRerunClient) GetIssueLabels(org, repo string, number int) ([]github.Label, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetIssueLabels\", org, repo, number)\n\tret0, _ := ret[0].([]github.Label)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "ffe3f1982db3952de87d268af5a2b6ba", "score": "0.53173363", "text": "func NewGetParams() *GetParams {\n\treturn &GetParams{}\n}", "title": "" }, { "docid": "4d4402342db54277e808af9b12a64ac3", "score": "0.53005415", "text": "func (m *MockIssueClient) GetIssueLabels(org, repo string, number int) ([]github.Label, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetIssueLabels\", org, repo, number)\n\tret0, _ := ret[0].([]github.Label)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "573dfb9575b2f22bd0e11f93d8ac68f2", "score": "0.5286426", "text": "func (c *client) GetIssueLabels(org, repo string, number int) ([]Label, error) {\n\tdurationLogger := c.log(\"GetIssueLabels\", org, repo, number)\n\tdefer durationLogger()\n\n\treturn c.getLabels(fmt.Sprintf(\"/repos/%s/%s/issues/%d/labels\", org, repo, number), org)\n}", "title": "" }, { "docid": "3dd4c4693c822e68e61d4579d1d11c1d", "score": "0.5211125", "text": "func NewGetCustomRuleParams() *GetCustomRuleParams {\n\tvar ()\n\treturn &GetCustomRuleParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "2880dc23814858fb8280b6b4e464d644", "score": "0.5201784", "text": "func NewGetWorkItemParams() *GetWorkItemParams {\n\tvar ()\n\treturn &GetWorkItemParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "03b6063ece1a7eabc43222358b8afe59", "score": "0.51925874", "text": "func NewEmailTemplateGetParams() *EmailTemplateGetParams {\n\tvar ()\n\treturn &EmailTemplateGetParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "1c3e008fe40e24a5fa1cb0f9a43f6b80", "score": "0.5168484", "text": "func (s ProxyClaimRequestRequest) NewLabel() (util.LocalizedText, error) {\n\tss, err := util.NewLocalizedText(s.Struct.Segment())\n\tif err != nil {\n\t\treturn util.LocalizedText{}, err\n\t}\n\terr = s.Struct.SetPtr(2, ss.Struct.ToPtr())\n\treturn ss, err\n}", "title": "" }, { "docid": "ef754cb99179ed80dbedfa207ea832b1", "score": "0.51430523", "text": "func NewGetOrderParams() *GetOrderParams {\n\tvar ()\n\treturn &GetOrderParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "9e5c1bac7eb4a0c5682eb68295fd659f", "score": "0.5097813", "text": "func NewGetIssueRequest(server string, projectId string, id string) (*http.Request, error) {\n\tvar err error\n\n\tvar pathParam0 string\n\n\tpathParam0, err = runtime.StyleParam(\"simple\", false, \"project_id\", projectId)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar pathParam1 string\n\n\tpathParam1, err = runtime.StyleParam(\"simple\", false, \"id\", id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryUrl := fmt.Sprintf(\"%s/projects/%s/issues/%s\", server, pathParam0, pathParam1)\n\n\treq, err := http.NewRequest(\"GET\", queryUrl, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "208c13e1fe8f0c4b91e98bb75e3058e0", "score": "0.50437677", "text": "func NewGetTreeParams() *GetTreeParams {\n\tvar ()\n\treturn &GetTreeParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "5e8eb9874dc3750712e872d24df14619", "score": "0.5040763", "text": "func (o *IssueGetLabelParams) WithRepo(repo string) *IssueGetLabelParams {\n\to.SetRepo(repo)\n\treturn o\n}", "title": "" }, { "docid": "12a709e3417af2c848b8220c9007f1ce", "score": "0.49986443", "text": "func (c *Client) NewCreateLabelRequest(ctx context.Context, path string, payload *CreateLabelPayload) (*http.Request, error) {\n\tvar body bytes.Buffer\n\terr := c.Encoder.Encode(payload, &body, \"*/*\")\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to encode body: %s\", err)\n\t}\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\tif c.JWTSigner != nil {\n\t\tc.JWTSigner.Sign(req)\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "ac07aad5b16a5aa53fae73048215af43", "score": "0.49845833", "text": "func (o *IssueGetLabelParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param id\n\tif err := r.SetPathParam(\"id\", swag.FormatInt64(o.ID)); err != nil {\n\t\treturn err\n\t}\n\n\t// path param owner\n\tif err := r.SetPathParam(\"owner\", o.Owner); err != nil {\n\t\treturn err\n\t}\n\n\t// path param repo\n\tif err := r.SetPathParam(\"repo\", o.Repo); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "17ca5f682e75b57fd1cdc30b98168c40", "score": "0.49829358", "text": "func (i *IssueRequest) GetLabels() []string {\n\tif i == nil || i.Labels == nil {\n\t\treturn nil\n\t}\n\treturn *i.Labels\n}", "title": "" }, { "docid": "8e69679df1046024faa79b997c5512c3", "score": "0.49791807", "text": "func NewNewIssueRequest(server string, projectId string, body NewIssue) (*http.Request, error) {\n\tvar bodyReader io.Reader\n\tbuf, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbodyReader = bytes.NewReader(buf)\n\treturn NewNewIssueRequestWithBody(server, projectId, \"application/json\", bodyReader)\n}", "title": "" }, { "docid": "779b39ca448ec0685c91108eb4863a84", "score": "0.49632564", "text": "func (b *Builder) WithLabelsNew(labels map[string]string) *Builder {\n\tif len(labels) == 0 {\n\t\tb.errs = append(\n\t\t\tb.errs,\n\t\t\terrors.New(\"failed to build PVC object: missing labels\"),\n\t\t)\n\t\treturn b\n\t}\n\n\t// copy of original map\n\tnewlbls := map[string]string{}\n\tfor key, value := range labels {\n\t\tnewlbls[key] = value\n\t}\n\n\t// override\n\tb.pvc.object.Labels = newlbls\n\treturn b\n}", "title": "" }, { "docid": "adede6d98ed4c507264374f4c3ead61e", "score": "0.4962999", "text": "func NewLabels() Labels {\n\tl := labels(sync.Map{})\n\treturn &l\n}", "title": "" }, { "docid": "bbd6f6694b743490658b36623723612c", "score": "0.4952388", "text": "func NewLabels(lmap map[string]int64) *Labels {\n\tvar labs Labels\n\tlabs.Reset(lmap)\n\treturn &labs\n}", "title": "" }, { "docid": "aa606a201a3d65f34a9e975d1e8af562", "score": "0.49411288", "text": "func NewLabels(api plugin.API) *Labels {\n\treturn &Labels{\n\t\tByID: make(map[string]*Label),\n\t\tapi: api,\n\t}\n}", "title": "" }, { "docid": "30b6ccefc676dc7f0e95c0711ccc4d0a", "score": "0.49370688", "text": "func (a ProblemAdapter) GetLabels() map[string]string {\n\treturn nil\n}", "title": "" }, { "docid": "dc3f141ae4cfc7f379b25c394af05e1f", "score": "0.49236587", "text": "func NewIssueRemoveLabelParamsWithTimeout(timeout time.Duration) *IssueRemoveLabelParams {\n\tvar ()\n\treturn &IssueRemoveLabelParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "title": "" }, { "docid": "73d35b4cc55199385975381db90d2e0e", "score": "0.49066588", "text": "func NewGetProjectMetricsParams() *GetProjectMetricsParams {\n\tvar ()\n\treturn &GetProjectMetricsParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "5fa3dbcab3b582d5e65778e4bf31c022", "score": "0.4904273", "text": "func NewGetFetchParams() GetFetchParams {\n\n\treturn GetFetchParams{}\n}", "title": "" }, { "docid": "9daa0ba1b52e53b1b036f29ee3f2ad3e", "score": "0.48788688", "text": "func NewCiIssuesGetInstanceRequest(server string, id string, params *CiIssuesGetInstanceParams) (*http.Request, error) {\n\tvar err error\n\n\tvar pathParam0 string\n\n\tpathParam0, err = runtime.StyleParamWithLocation(\"simple\", false, \"id\", runtime.ParamLocationPath, id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tserverURL, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\toperationPath := fmt.Sprintf(\"/v1/ciIssues/%s\", pathParam0)\n\tif operationPath[0] == '/' {\n\t\toperationPath = \".\" + operationPath\n\t}\n\n\tqueryURL, err := serverURL.Parse(operationPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryValues := queryURL.Query()\n\n\tif params.FieldsCiIssues != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", false, \"fields[ciIssues]\", runtime.ParamLocationQuery, *params.FieldsCiIssues); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tqueryURL.RawQuery = queryValues.Encode()\n\n\treq, err := http.NewRequest(\"GET\", queryURL.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "d65fb3b4ff7a30b4bdbfa7ff2e46a256", "score": "0.48450515", "text": "func NewGetPackageSearchParams() *GetPackageSearchParams {\n\tvar ()\n\treturn &GetPackageSearchParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "e0f398f4828d6ca10336c6820073f64b", "score": "0.4832799", "text": "func (o *IssueGetLabelParams) WithOwner(owner string) *IssueGetLabelParams {\n\to.SetOwner(owner)\n\treturn o\n}", "title": "" }, { "docid": "856a901a823c4a2aaa1cb3a314abb590", "score": "0.48113978", "text": "func NewLabel(name string) *Label {\n\treturn &Label{Name: name}\n}", "title": "" }, { "docid": "5dbc5c48b83f70ca9a6753719fd7c21f", "score": "0.48003197", "text": "func NewGetBundleByKeyParams() *GetBundleByKeyParams {\n\treturn &GetBundleByKeyParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "0c33cc62b0d4a5a45a72e8e28d35189e", "score": "0.4761463", "text": "func NewLabels(labels LabelMap) *Labels {\n\tl := &Labels{\n\t\tlabels: labels,\n\t\tkeys: make([]string, 0, len(labels)),\n\t}\n\tfor k := range labels {\n\t\tl.keys = append(l.keys, k)\n\t}\n\tsort.Strings(l.keys)\n\treturn l\n}", "title": "" }, { "docid": "f2536c482dd9ac24e00848851a23e045", "score": "0.4759392", "text": "func (a *Client) GetLabels(params *GetLabelsParams, opts ...ClientOption) (*GetLabelsOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetLabelsParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"GetLabels\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/get-labels\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &GetLabelsReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t}\n\tfor _, opt := range opts {\n\t\topt(op)\n\t}\n\n\tresult, err := a.transport.Submit(op)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*GetLabelsOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for GetLabels: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "6864bf4a53cdc267b8cce3f74c6669c2", "score": "0.47558695", "text": "func getLabels (labelsStr string) (map[string]string, derrors.Error) {\n\n\tlabels := make (map[string]string, 0)\n\tif labelsStr == \"\" {\n\t\treturn labels, nil\n\t}\n\n\tif labelsStr != \"\" {\n\t\tlabelsList := strings.Split(labelsStr, \",\")\n\t\tfor _, paramStr := range labelsList {\n\t\t\tparam := strings.Split(paramStr, \":\")\n\t\t\tif len(param) != 2 {\n\t\t\t\treturn nil, derrors.NewInvalidArgumentError(\"invalid labels format.\").WithParams(labelsStr)\n\t\t\t}\n\t\t\tlabels[param[0]] = param[1]\n\t\t}\n\t}\n\n\treturn labels, nil\n}", "title": "" }, { "docid": "d540ec7080c1e4e4939548fd4d364178", "score": "0.47508517", "text": "func (s *UserService) NewGetUserParams(userapikey string) *GetUserParams {\n\tp := &GetUserParams{}\n\tp.p = make(map[string]interface{})\n\tp.p[\"userapikey\"] = userapikey\n\treturn p\n}", "title": "" }, { "docid": "f4c5a944624b33672c75b02f572e947c", "score": "0.47454605", "text": "func NewGetAllPublicIPUsingGETParams() *GetAllPublicIPUsingGETParams {\n\tvar (\n\t\tpageDefault = int32(0)\n\t\ttotalDefault = int32(20)\n\t)\n\treturn &GetAllPublicIPUsingGETParams{\n\t\tPage: &pageDefault,\n\t\tTotal: &totalDefault,\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "bc7ea25770355b76957f128d5ca4e952", "score": "0.47365507", "text": "func (o *TppCertificateParams) GetLabel() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Label\n}", "title": "" }, { "docid": "f1c1fbe2febf1a26c7d54655e1f980d3", "score": "0.47321242", "text": "func (c *Client) NewListLabelRequest(ctx context.Context, path string, ifModifiedSince *string, ifNoneMatch *string) (*http.Request, error) {\n\tscheme := c.Scheme\n\tif scheme == \"\" {\n\t\tscheme = \"http\"\n\t}\n\tu := url.URL{Host: c.Host, Scheme: scheme, Path: path}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\theader := req.Header\n\tif ifModifiedSince != nil {\n\n\t\theader.Set(\"If-Modified-Since\", *ifModifiedSince)\n\t}\n\tif ifNoneMatch != nil {\n\n\t\theader.Set(\"If-None-Match\", *ifNoneMatch)\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "a1a32914bbbfb529c6acdd0cfd3df713", "score": "0.4707157", "text": "func NewGetExportParams() *GetExportParams {\n\tvar ()\n\treturn &GetExportParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "5a186922797508582d12d9e681a6cf2b", "score": "0.47034773", "text": "func NewListIssueGroupOfProjectVersionParams() *ListIssueGroupOfProjectVersionParams {\n\tvar (\n\t\tlimitDefault = int32(200)\n\t\tshowhiddenDefault = bool(false)\n\t\tshowremovedDefault = bool(false)\n\t\tshowshortfilenamesDefault = bool(false)\n\t\tshowsuppressedDefault = bool(false)\n\t\tstartDefault = int32(0)\n\t)\n\treturn &ListIssueGroupOfProjectVersionParams{\n\t\tLimit: &limitDefault,\n\t\tShowhidden: &showhiddenDefault,\n\t\tShowremoved: &showremovedDefault,\n\t\tShowshortfilenames: &showshortfilenamesDefault,\n\t\tShowsuppressed: &showsuppressedDefault,\n\t\tStart: &startDefault,\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "ce7092ce9d502a2472a181006e72cfed", "score": "0.47012886", "text": "func NewGetBootstrapParamsWithTimeout(timeout time.Duration) *GetBootstrapParams {\n\tvar ()\n\treturn &GetBootstrapParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "title": "" }, { "docid": "198acbd068d76d1ca43c93ae1c186928", "score": "0.46988663", "text": "func New(owner string, repo string, event string, id int, data *string) (*Labeler, error) {\n\ttoken, found := os.LookupEnv(\"GITHUB_TOKEN\")\n\tif !found {\n\t\treturn nil, errors.New(\"GITHUB_TOKEN environment variable is missing\")\n\t}\n\tctx := context.Background()\n\tts := oauth2.StaticTokenSource(\n\t\t&oauth2.Token{AccessToken: token},\n\t)\n\ttc := oauth2.NewClient(ctx, ts)\n\tclient := github.NewClient(tc)\n\tl := &Labeler{\n\t\tcontext: &ctx,\n\t\tclient: client,\n\t\tOwner: &owner,\n\t\tRepo: &repo,\n\t\tEvent: &event,\n\t\tID: &id,\n\t\tData: data,\n\t}\n\treturn l, nil\n}", "title": "" }, { "docid": "3b2f1912093ad461757a7b4978bab113", "score": "0.46985808", "text": "func NewGetRequest(payload *todo.GetPayload) *todopb.GetRequest {\n\tmessage := &todopb.GetRequest{\n\t\tId: payload.ID,\n\t}\n\treturn message\n}", "title": "" }, { "docid": "d5ce051debca38877c05676172dd8e71", "score": "0.4684292", "text": "func NewGetFyiSettingsParams() *GetFyiSettingsParams {\n\n\treturn &GetFyiSettingsParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "00409796dc281b7a42afeb9106930234", "score": "0.46677247", "text": "func NewGetMetricsParams() *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\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "a562acb8765cb81c54437d31b37dd948", "score": "0.4658658", "text": "func NewGetAttachmentParams() *GetAttachmentParams {\n\tvar ()\n\treturn &GetAttachmentParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "edefdf4a2be6c528d088224b9f4f394f", "score": "0.46541396", "text": "func New() *GetLoadbalancerInput {\n\tnet := &GetLoadbalancerInput{}\n\treturn net\n}", "title": "" }, { "docid": "544595475561782736bd3218f792c012", "score": "0.4641462", "text": "func NewGetJobEventsParams() *GetJobEventsParams {\n\tvar ()\n\treturn &GetJobEventsParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "e9c4d862f6793ccff6032b5867015fbf", "score": "0.46376094", "text": "func newUpdateProjectUpdateProjectRequest(ctx context.Context, f *Project, c *Client) (map[string]interface{}, error) {\n\treq := map[string]interface{}{}\n\n\tif v := f.Labels; !dcl.IsEmptyValueIndirect(v) {\n\t\treq[\"labels\"] = v\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "ae3d9f01ffe99977141ed1556bc8dbc3", "score": "0.46341568", "text": "func NewGetParamsWithTimeout(timeout time.Duration) *GetParams {\n\tvar (\n\t\tdeviceOSDefault = string(\"Android 9\")\n\t\tsendToEmailDefault = string(\"no\")\n\t)\n\treturn &GetParams{\n\t\tDeviceOS: &deviceOSDefault,\n\t\tSendToEmail: &sendToEmailDefault,\n\n\t\ttimeout: timeout,\n\t}\n}", "title": "" }, { "docid": "600860cf5148bfdb88366be5afe8ff3e", "score": "0.46338797", "text": "func NewGetReceiptsParams() *GetReceiptsParams {\n\tvar ()\n\treturn &GetReceiptsParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "c968eceed97141bb5306e66bd1478efe", "score": "0.46254992", "text": "func NewLabelCommand(k string, v string, NoExp bool) *LabelCommand {\n\tkvp := KeyValuePair{Key: k, Value: v}\n\tc := \"LABEL \"\n\tc += kvp.String()\n\tnc := withNameAndCode{code: c, name: \"label\"}\n\tcmd := &LabelCommand{\n\t\twithNameAndCode: nc,\n\t\tLabels: KeyValuePairs{\n\t\t\tkvp,\n\t\t},\n\t\tnoExpand: NoExp,\n\t}\n\treturn cmd\n}", "title": "" }, { "docid": "fa8a703d0c644805f879f90654e4a7a0", "score": "0.4621985", "text": "func NewConfigGetParams() *ConfigGetParams {\n\treturn &ConfigGetParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "e92e71d43ecb7fa070962acc9b133447", "score": "0.46148357", "text": "func NewLabelActionBase()(*LabelActionBase) {\n m := &LabelActionBase{\n }\n m.backingStore = ie8677ce2c7e1b4c22e9c3827ecd078d41185424dd9eeb92b7d971ed2d49a392e.BackingStoreFactoryInstance();\n m.SetAdditionalData(make(map[string]any))\n return m\n}", "title": "" }, { "docid": "93fe1b275a95cdd82b0d6ffcab77f63c", "score": "0.46070117", "text": "func NewOrgGetParams() *OrgGetParams {\n\tvar ()\n\treturn &OrgGetParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "6a8dc43e749c816ca19b3793ffd97fd8", "score": "0.46059895", "text": "func NewCapacityPoolGetParams() *CapacityPoolGetParams {\n\treturn &CapacityPoolGetParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "61a7b924754b6210175ae06acf5dbf53", "score": "0.460575", "text": "func NewGetGCParams() *GetGCParams {\n\treturn &GetGCParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "dedda5662904db3e99b0026e3ebbb430", "score": "0.4602632", "text": "func (c *Client) NewShowLabelRequest(ctx context.Context, path string, ifModifiedSince *string, ifNoneMatch *string) (*http.Request, error) {\n\tscheme := c.Scheme\n\tif scheme == \"\" {\n\t\tscheme = \"http\"\n\t}\n\tu := url.URL{Host: c.Host, Scheme: scheme, Path: path}\n\treq, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\theader := req.Header\n\tif ifModifiedSince != nil {\n\n\t\theader.Set(\"If-Modified-Since\", *ifModifiedSince)\n\t}\n\tif ifNoneMatch != nil {\n\n\t\theader.Set(\"If-None-Match\", *ifNoneMatch)\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "ab00289ad74ee6e5478f93f780551fea", "score": "0.45986503", "text": "func (w *ServerInterfaceWrapper) NewIssue(ctx echo.Context) error {\n\tvar err error\n\t// ------------- Path parameter \"project_id\" -------------\n\tvar projectId string\n\n\terr = runtime.BindStyledParameter(\"simple\", false, \"project_id\", ctx.Param(\"project_id\"), &projectId)\n\tif err != nil {\n\t\treturn echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf(\"Invalid format for parameter project_id: %s\", err))\n\t}\n\n\t// HasSecurity is set\n\n\tctx.Set(\"OpenId.Scopes\", []string{\"exitus/issue.write\"})\n\n\t// Invoke the callback with all the unmarshalled arguments\n\terr = w.Handler.NewIssue(ctx, projectId)\n\treturn err\n}", "title": "" }, { "docid": "4251acacadbab8ada6d28e3d46ec2047", "score": "0.45800033", "text": "func (o *TppCredentialsParams) GetLabel() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Label\n}", "title": "" }, { "docid": "7e0307e78695a20ec7220e8be7478bf4", "score": "0.45677364", "text": "func NewKdfParams(n, p, r int) *KdfParams {\n\n\treturn &KdfParams{\n\t\tN: n,\n\t\tP: p,\n\t\tR: r,\n\t}\n}", "title": "" }, { "docid": "0afbba0a3559a3f50b86ae60552f2762", "score": "0.4560675", "text": "func NewGetRuleChainParams() *GetRuleChainParams {\n\tvar ()\n\treturn &GetRuleChainParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "0b32b517de97140efe6c9da24c0c42ad", "score": "0.45558867", "text": "func NewGetIconParamsWithTimeout(timeout time.Duration) *GetIconParams {\n\treturn &GetIconParams{\n\t\ttimeout: timeout,\n\t}\n}", "title": "" }, { "docid": "9f427ecd04a1565ddd7c0ffde9a104c2", "score": "0.4555373", "text": "func (issue *Issue) GetLabels() []string {\n\treturn issue.Fields.Labels\n}", "title": "" }, { "docid": "51a7ac8458dafd4fa2c8162871fc4244", "score": "0.45525724", "text": "func NewLabels(component, name string) prometheus.Labels {\n\treturn prometheus.Labels{\n\t\t{Name: []byte(\"component\"), Value: []byte(component)},\n\t\t{Name: []byte(\"name\"), Value: []byte(name)},\n\t\t{Name: []byte(\"host\"), Value: []byte(hostname)},\n\t}\n}", "title": "" }, { "docid": "6ea0aaaa2eeab5e7cc14ee5dcf8853ce", "score": "0.4548791", "text": "func (mr *MockRerunClientMockRecorder) GetIssueLabels(org, repo, number interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetIssueLabels\", reflect.TypeOf((*MockRerunClient)(nil).GetIssueLabels), org, repo, number)\n}", "title": "" }, { "docid": "107cbe84d24094332e941a79c23c3d7c", "score": "0.45423603", "text": "func NewWithOptions(opts ...OptFn) (*Labeler, error) {\n\tl := Labeler{}\n\toptions := Opt{\n\t\ttoken: os.Getenv(\"GITHUB_TOKEN\"),\n\t\towner: os.Getenv(\"GITHUB_ACTOR\"),\n\t\trepo: os.Getenv(\"GITHUB_REPO\"),\n\t\tevent: os.Getenv(\"GITHUB_EVENT_NAME\"),\n\t\tid: -1,\n\t}\n\n\tfor _, opt := range opts {\n\t\topt(&options)\n\t}\n\n\t// validations\n\tif options.owner == \"\" && options.repo == \"\" {\n\t\treturn nil, errors.New(\"both a github and owner are required\")\n\t}\n\n\tif strings.Contains(options.repo, \"/\") {\n\t\treturn nil, errors.New(\"a repo must be just the repo name. Separate org/repo style into owner and repo options\")\n\t}\n\n\tif options.owner == \"\" {\n\t\treturn nil, errors.New(\"a github owner (user or org) is required\")\n\t}\n\n\tif options.repo == \"\" {\n\t\treturn nil, errors.New(\"a github repo is required\")\n\t}\n\n\tif options.id < 0 {\n\t\treturn nil, errors.New(\"the integer id of the issue or pull request is required\")\n\t}\n\n\tif options.ctx == nil {\n\t\toptions.ctx = context.Background()\n\t}\n\n\tif options.client == nil {\n\t\t// only validate the token when constructing this default client. Otherwise, assume the caller has property constructed a client\n\t\tif options.token == \"\" {\n\t\t\tisTest := false\n\t\t\t// hack: only apply this required token check if not in tests.\n\t\t\t// this isn't a concern if we construct with an empty token because the client will error at invocation\n\t\t\tfor _, arg := range os.Args {\n\t\t\t\tif strings.HasPrefix(arg, \"-test.v\") {\n\t\t\t\t\tisTest = true\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !isTest {\n\t\t\t\treturn nil, errors.New(\"github token (e.g. GITHUB_TOKEN environment variable) is required\")\n\t\t\t}\n\t\t}\n\n\t\toptions.client = github.NewClient(oauth2.NewClient(options.ctx, oauth2.StaticTokenSource(\n\t\t\t&oauth2.Token{AccessToken: options.token},\n\t\t)))\n\t}\n\n\t// assignment\n\tl.context = &options.ctx\n\tl.client = options.client\n\tl.Owner = &options.owner\n\tl.Repo = &options.repo\n\tl.Event = &options.event\n\tl.ID = &options.id\n\tif options.data != \"\" {\n\t\tl.Data = &options.data\n\t}\n\tl.configPath = options.configPath\n\n\treturn &l, nil\n}", "title": "" }, { "docid": "61d1b1d5ab9454698fc92a494edbfc66", "score": "0.45405278", "text": "func NewBarParams() *BarParams {\n\tvar ()\n\treturn &BarParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "d753e73183e0ea0b154e0d68d92304a8", "score": "0.45359716", "text": "func NewParams() (Params, error) {\n\treturn Params{\n\t\tBaseParams: codec.BaseParams{\n\t\t\tKeyFrameInterval: 60,\n\t\t},\n\t}, nil\n}", "title": "" }, { "docid": "e39f7709cff8bea26b82807102c1f73d", "score": "0.45273525", "text": "func (mr *MockIssueClientMockRecorder) GetIssueLabels(org, repo, number interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetIssueLabels\", reflect.TypeOf((*MockIssueClient)(nil).GetIssueLabels), org, repo, number)\n}", "title": "" }, { "docid": "f7c3a52aaa716b37c05f39b5d89bb4d0", "score": "0.45172897", "text": "func (mr *MockClientMockRecorder) GetIssueLabels(org, repo, number interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetIssueLabels\", reflect.TypeOf((*MockClient)(nil).GetIssueLabels), org, repo, number)\n}", "title": "" }, { "docid": "6c6b1b6f1b0b31044997dad376ecba9f", "score": "0.45133868", "text": "func (o *CreateOptions) GetLabels() map[string]string {\n\tif o.Labels == nil {\n\t\tvar z map[string]string\n\t\treturn z\n\t}\n\treturn o.Labels\n}", "title": "" }, { "docid": "e7483c93d071444aaf947fcb5641d5b4", "score": "0.4510251", "text": "func NewGetUIParamsWithTimeout(timeout time.Duration) *GetUIParams {\n\n\treturn &GetUIParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "title": "" }, { "docid": "aadde32a9627ece5b240aba72fdca0f9", "score": "0.45095998", "text": "func NewGetMessagesBadRequest() *GetMessagesBadRequest {\n\treturn &GetMessagesBadRequest{}\n}", "title": "" }, { "docid": "da3960c3879eab4388d95a5624a6919a", "score": "0.44961137", "text": "func (c *Client) NewUpdateLabelRequest(ctx context.Context, path string, payload *UpdateLabelPayload) (*http.Request, error) {\n\tvar body bytes.Buffer\n\terr := c.Encoder.Encode(payload, &body, \"*/*\")\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to encode body: %s\", err)\n\t}\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(\"PATCH\", 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\tif c.JWTSigner != nil {\n\t\tc.JWTSigner.Sign(req)\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "ecfeaa2c9518b2723c1155a878b1af87", "score": "0.44903338", "text": "func NewGetIconParamsWithHTTPClient(client *http.Client) *GetIconParams {\n\treturn &GetIconParams{\n\t\tHTTPClient: client,\n\t}\n}", "title": "" }, { "docid": "be7c67b6e9431097e451afe12e3ac207", "score": "0.44807887", "text": "func NewPcloudVolumegroupsGetBadRequest() *PcloudVolumegroupsGetBadRequest {\n\treturn &PcloudVolumegroupsGetBadRequest{}\n}", "title": "" }, { "docid": "5df97dd203c46b125cff8e62e5219eb5", "score": "0.4465622", "text": "func NewGetDomainUsingGETBadRequest() *GetDomainUsingGETBadRequest {\n\treturn &GetDomainUsingGETBadRequest{}\n}", "title": "" }, { "docid": "6ff6337f5f2dde32d833c1d3a47a56b7", "score": "0.44573995", "text": "func PullRequestWithLabels(prs []github.PullRequest, labels ...string) []github.PullRequest {\n\tprsWithLabel := make([]github.PullRequest, 0)\n\tfor i := range prs {\n\t\tpr := prs[i]\n\t\tif Contains(pr.Labels, labels...) {\n\t\t\tprsWithLabel = append(prsWithLabel, pr)\n\t\t}\n\t}\n\treturn prsWithLabel\n}", "title": "" }, { "docid": "58fbf5db0ee5af16bc21743071869593", "score": "0.44552818", "text": "func Init(repo *config.RepoConfig, opr *operator.Operator) *Label {\n\tn := Label{\n\t\towner: repo.Owner,\n\t\trepo: repo.Repo,\n\t\tready: false,\n\t\tcfg: repo,\n\t\topr: opr,\n\t}\n\treturn &n\n}", "title": "" }, { "docid": "e4248f5179590d97b383fa539cc08f6b", "score": "0.4449742", "text": "func NewGetModelNotFound() *GetModelNotFound {\n\treturn &GetModelNotFound{}\n}", "title": "" }, { "docid": "93796244c0eff86a59d44d125c75620f", "score": "0.4447132", "text": "func (rm *resourceManager) newDescribeRequestPayload(\n\tr *resource,\n) (*svcsdk.DescribeModelBiasJobDefinitionInput, error) {\n\tres := &svcsdk.DescribeModelBiasJobDefinitionInput{}\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": "95b89521994e05d6a4d1c698e19eea77", "score": "0.44451645", "text": "func defaultLabels(j *v1alpha1.Jira) map[string]string {\n\treturn map[string]string{\n\t\t\"app\": \"jira\",\n\t\t\"cluster\": j.Name,\n\t}\n}", "title": "" }, { "docid": "5e021b597b4bad81031659265b69b445", "score": "0.44436565", "text": "func NewNewIssueRequestWithBody(server string, projectId string, contentType string, body io.Reader) (*http.Request, error) {\n\tvar err error\n\n\tvar pathParam0 string\n\n\tpathParam0, err = runtime.StyleParam(\"simple\", false, \"project_id\", projectId)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryUrl := fmt.Sprintf(\"%s/projects/%s/issues\", server, pathParam0)\n\n\treq, err := http.NewRequest(\"POST\", queryUrl, body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Content-Type\", contentType)\n\treturn req, nil\n}", "title": "" }, { "docid": "96fc856796c573022b959e3c44ff8b6e", "score": "0.4442524", "text": "func NewGetPingDefault(code int) *GetPingDefault {\n\tif code <= 0 {\n\t\tcode = 500\n\t}\n\n\treturn &GetPingDefault{\n\t\t_statusCode: code,\n\t}\n}", "title": "" }, { "docid": "d64d1bbf47c3e1b5ca0306a51fa6f50b", "score": "0.4441636", "text": "func newUpdateImageSetLabelsRequest(ctx context.Context, f *Image, c *Client) (map[string]interface{}, error) {\n\treq := map[string]interface{}{}\n\n\tif v := f.Labels; !dcl.IsEmptyValueIndirect(v) {\n\t\treq[\"labels\"] = v\n\t}\n\tb, err := c.getImageRaw(ctx, f.urlNormalized())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar m map[string]interface{}\n\tif err := json.Unmarshal(b, &m); err != nil {\n\t\treturn nil, err\n\t}\n\trawLabelFingerprint, err := dcl.GetMapEntry(\n\t\tm,\n\t\t[]string{\"labelFingerprint\"},\n\t)\n\tif err != nil {\n\t\tc.Config.Logger.Warningf(\"Failed to fetch from JSON Path: %v\", err)\n\t} else {\n\t\treq[\"labelFingerprint\"] = rawLabelFingerprint.(string)\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "72d7de458547c2a7b4a190ab0a306f61", "score": "0.44327414", "text": "func NewHandleGetAboutUsingGETParams() *HandleGetAboutUsingGETParams {\n\treturn &HandleGetAboutUsingGETParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" } ]
56beafefb5c00ce4772f2724b6104730
start builds the paths to the watchers
[ { "docid": "50760963adba07a457e55bfc8a19f13f", "score": "0.5371361", "text": "func (rcvr *iisReceiver) start(ctx context.Context, host component.Host) error {\n\trcvr.watcherRecorders = []watcherRecorder{}\n\n\tvar errors scrapererror.ScrapeErrors\n\tfor _, pcr := range perfCounterRecorders {\n\t\tfor perfCounterName, recorder := range pcr.recorders {\n\t\t\tw, err := rcvr.newWatcher(pcr.object, pcr.instance, perfCounterName)\n\t\t\tif err != nil {\n\t\t\t\terrors.AddPartial(1, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\trcvr.watcherRecorders = append(rcvr.watcherRecorders, watcherRecorder{w, recorder})\n\t\t}\n\t}\n\n\treturn errors.Combine()\n}", "title": "" } ]
[ { "docid": "a67c6b397bb950b0963a534672ad7712", "score": "0.7178933", "text": "func (w *watcher) build() (err error) {\n\tif err = w.notify.Add(conf.sqlDirPath); err != nil {\n\t\treturn err\n\t}\n\n\terr = filepath.Walk(conf.sqlDirPath, func(path string, info os.FileInfo, err error) error {\n\t\tif isDir(path) {\n\t\t\tif err = w.notify.Add(path); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tw.watches = append(w.watches, path)\n\t\t}\n\n\t\treturn nil\n\t})\n\n\treturn\n}", "title": "" }, { "docid": "737e3863850d3faf43e2486edfbff2f0", "score": "0.6533543", "text": "func (s *Supervisor) startWatchers() {\n\tfor _, w := range s.watchers {\n\t\tgo w.Watch()\n\t}\n}", "title": "" }, { "docid": "c794521366925d87cfcc8517fb1651e9", "score": "0.6323803", "text": "func StartWatching() {\n\tgo StartWatchingGithubReleases()\n}", "title": "" }, { "docid": "9eb2561c11a33fc14b85381ee4d15eb0", "score": "0.6167822", "text": "func (idr *Indexer) startWatchers() {\n\tidr.logger.Info(\"Starting watchers\")\n\tidr.wg.Add(1)\n\tgo func() {\n\n\t\tdefer idr.wg.Done()\n\n\t\t// The following code snippet performs Select on a slice of channels\n\t\t// Initialize the SelectCase slice, with one channel per Kind and\n\t\t// and two additional channel to handle context cancellation and Done\n\t\tcases := make([]reflect.SelectCase, len(idr.channels)+2)\n\t\tapiGroupMappings := make([]string, len(idr.channels)+2)\n\n\t\t// Add the watcherDone and Ctx.Done() channels to initial offset of the slice\n\t\tcases[0] = reflect.SelectCase{Dir: reflect.SelectRecv, Chan: reflect.ValueOf(idr.watcherDone)}\n\t\tcases[1] = reflect.SelectCase{Dir: reflect.SelectRecv, Chan: reflect.ValueOf(idr.ctx.Done())}\n\n\t\t// Add the object watcher channels\n\t\t// Skip firewall log key from this allocation\n\t\ti := 2\n\t\tfor key, ch := range idr.channels {\n\t\t\tcases[i] = reflect.SelectCase{Dir: reflect.SelectRecv, Chan: reflect.ValueOf(ch)}\n\t\t\tapiGroupMappings[i] = key\n\t\t\tif strings.Contains(key, \"fwlogs\") {\n\t\t\t\tidr.logger.Infof(\"Assinging writer %d to key %s\", idr.maxOrderedWriters, \"fwlogs\")\n\t\t\t\t// fwlogs go to append only writer\n\t\t\t\tidr.writerMap[key] = &writerMapEntry{\n\t\t\t\t\t// the appendOnlyWriterStartId is the end of maxOrderedWritersId,\n\t\t\t\t\t// its 8 today\n\t\t\t\t\twriterID: idr.maxOrderedWriters,\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tidr.logger.Infof(\"Assinging writer %d to key %s\", (i-2)%idr.maxOrderedWriters, key)\n\t\t\t\tidr.writerMap[key] = &writerMapEntry{\n\t\t\t\t\twriterID: (i - 2) % idr.maxOrderedWriters,\n\t\t\t\t}\n\t\t\t}\n\t\t\ti++\n\t\t}\n\n\t\t// Handle event update on any of the channel\n\t\t// TODO: make this a utility function that can\n\t\t// be used by other services as well.\n\t\tfor {\n\t\t\tchosen, value, ok := reflect.Select(cases)\n\n\t\t\t// First handle special channels related to watcherDone and Ctx\n\t\t\tif chosen == 0 {\n\t\t\t\tidr.logger.Info(\"Exiting watcher, watcherDone event\")\n\t\t\t\tidr.stopWatchers()\n\t\t\t\treturn\n\t\t\t} else if chosen == 1 {\n\t\t\t\tidr.logger.Info(\"Exiting watcher, Ctx cancelled\")\n\t\t\t\tidr.stopWatchers()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Handle the events updates from object watchers\n\t\t\tif !ok {\n\t\t\t\t// If the indexer is stopped or is in the process of being\n\t\t\t\t// stopped, this is an expected condition and no recovery is\n\t\t\t\t// needed. In all other cases, it is a watcher error that\n\t\t\t\t// needs to be re-established.\n\t\t\t\tif idr.GetRunningStatus() == IndexerRunning {\n\t\t\t\t\terr := fmt.Errorf(\"Channel read not ok for API Group %s\", apiGroupMappings[chosen])\n\t\t\t\t\tidr.logger.Errorf(err.Error())\n\t\t\t\t\t// if its an error for objstore, we restart spyglass since we may have missed an event by the time we come back up\n\t\t\t\t\tif strings.Contains(apiGroupMappings[chosen], \"objstore\") {\n\t\t\t\t\t\tidr.SetRunningStatus(IndexerStopping)\n\t\t\t\t\t\tidr.stopWatchers()\n\t\t\t\t\t\tidr.doneCh <- err\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tidr.restartWatchers()\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// remove the channel that failed\n\t\t\t\tcases = append(cases[:chosen], cases[chosen+1:]...)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tidr.logger.Debugf(\"Reading from channel %d and received event: {%+v} %s\",\n\t\t\t\tchosen, value, value.String())\n\t\t\tapiGroup := apiGroupMappings[chosen]\n\t\t\tevent := value.Interface().(*kvstore.WatchEvent)\n\t\t\tidr.handleWatcherEvent(apiGroup, event.Type, event.Object)\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "f7b4e2752786913b3751f1e9bacdce5e", "score": "0.61583775", "text": "func (s *Scanner) startWatch() error {\n\tw, err := fsnotify.NewWatcher()\n\tif err != nil {\n\t\txlog.Error(\"fsnotify new watcher err\", xlog.String(\"msg\", err.Error()))\n\t\treturn err\n\t}\n\tif err := w.Add(s.confDir); err != nil {\n\t\txlog.Error(\"fsnotify add dir err\", xlog.String(\"msg\", err.Error()))\n\t\treturn nil\n\t}\n\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase ev, ok := <-w.Events:\n\t\t\t\tif !ok {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tif !strings.HasSuffix(ev.Name, \".conf\") {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\txlog.Debug(\"supervisorConfigChange\", xlog.String(\"events\", ev.String()))\n\t\t\t\tswitch ev.Op {\n\t\t\t\tcase fsnotify.Create:\n\t\t\t\t\tprogram, content, err := s.parseFile(ev.Name)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\txlog.Error(\"set status err\", xlog.String(\"msg\", err.Error()))\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\ts.chanProgram <- &ProgramExt{\n\t\t\t\t\t\tStatus: \"create\",\n\t\t\t\t\t\tProgram: program,\n\t\t\t\t\t\tContent: string(content),\n\t\t\t\t\t\tFileName: filepath.Base(ev.Name),\n\t\t\t\t\t\tFilePath: ev.Name,\n\t\t\t\t\t}\n\t\t\t\tcase fsnotify.Write:\n\t\t\t\t\tprogram, content, err := s.parseFile(ev.Name)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\txlog.Error(\"set status err\", xlog.String(\"msg\", err.Error()))\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\ts.chanProgram <- &ProgramExt{\n\t\t\t\t\t\tStatus: \"update\",\n\t\t\t\t\t\tProgram: program,\n\t\t\t\t\t\tContent: string(content),\n\t\t\t\t\t\tFileName: filepath.Base(ev.Name),\n\t\t\t\t\t\tFilePath: ev.Name,\n\t\t\t\t\t}\n\t\t\t\tcase fsnotify.Remove:\n\t\t\t\t\ts.chanProgram <- &ProgramExt{\n\t\t\t\t\t\tStatus: \"delete\",\n\t\t\t\t\t\tFileName: filepath.Base(ev.Name),\n\t\t\t\t\t\tFilePath: ev.Name,\n\t\t\t\t\t\tProgram: &Program{},\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tcase err, ok := <-w.Errors:\n\t\t\t\txlog.Error(\"watch err\", xlog.String(\"msg\", err.Error()))\n\t\t\t\tif !ok {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\tcase <-s.stop:\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn nil\n}", "title": "" }, { "docid": "0e83bb4ce47d91fe639ac4475a5f2dc2", "score": "0.6136444", "text": "func (p *Program) Start() error {\n\tvar err error\n\tif err = backend.Instance().Start(); err != nil {\n\t\tlog.Error(err)\n\t\treturn err\n\t}\n\n\tif err = frontend.Instance().Start(); err != nil {\n\t\tlog.Error(err)\n\t\treturn err\n\t}\n\t// frontend.Instance().AddMessageHook(frontend.CheckMessageCode())\n\n\t// TODO: 启动http服务\n\terr = p.httpServe.Start(global.ProjectConfig.Debug, global.ProjectConfig.Servers.Server)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn err\n\t}\n\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase event := <-p.w.Event:\n\t\t\t\tlog.Println(event) // Print the event's info.\n\t\t\tcase err := <-p.w.Error:\n\t\t\t\tlog.Fatalln(err)\n\t\t\tcase <-p.w.Closed:\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\t// Watch this folder for changes.\n\tif err := p.w.Add(\".\"); err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\t// Print a list of all of the files and folders currently\n\t// being watched and their paths.\n\tfor path, f := range p.w.WatchedFiles() {\n\t\tlog.Printf(\"%s: %s\\n\", path, f.Name())\n\t}\n\n\t// Watch test_folder recursively for changes.\n\tif err := p.w.AddRecursive(\"./conf/conf.json\"); err != nil {\n\t\tlog.Println(err)\n\t\treturn err\n\t}\n\n\t// Trigger 2 events after watcher started.\n\tgo func() {\n\t\tp.w.Wait()\n\t\tp.w.TriggerEvent(watcher.Create, nil)\n\t\tp.w.TriggerEvent(watcher.Remove, nil)\n\t}()\n\n\tgo func() {\n\t\t// Start the watching process - it'll check for changes every 100ms.\n\t\tif err := p.w.Start(time.Millisecond * 100); err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t}()\n\n\treturn nil\n}", "title": "" }, { "docid": "de93dd6a30f0acd0d56701c1d7df6322", "score": "0.61066973", "text": "func (w *watcherImpl) start() {\n\tdefer close(w.events)\n\tfor {\n\t\tselect {\n\t\tcase event, ok := <-w.fsWatcher.Events:\n\t\t\tif !ok {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif !isWatchedEvent(event) {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tfsEvent := newEvent(event)\n\t\t\tskip, err := w.filter(fsEvent)\n\t\t\tif err != nil {\n\t\t\t\tlogger.Printf(\n\t\t\t\t\t\"watcher filter error: event=%v, error=%v\\n\", fsEvent, err)\n\t\t\t} else if skip {\n\t\t\t\tlogger.Printf(\"watcher filter: ignoring event %v\\n\", fsEvent)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tw.events <- WatcherEvent{\n\t\t\t\tEvent: fsEvent,\n\t\t\t}\n\t\tcase err, ok := <-w.fsWatcher.Errors:\n\t\t\tif !ok {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tw.events <- WatcherEvent{\n\t\t\t\tError: err,\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "aba891efdbdd13f9d1555f0a69808c65", "score": "0.6046937", "text": "func startWatching(watcher *fsnotify.Watcher, args []string) {\n\tvar (\n\t\tlastModFile string\n\t\tlastModTime time.Time\n\t\tctx context.Context\n\t\tcancel context.CancelFunc\n\t)\n\nLOOP:\n\tfor {\n\t\tselect {\n\t\tcase e := <-watcher.Events:\n\t\t\tif skipChange(e, lastModFile, lastModTime) {\n\t\t\t\tcontinue LOOP\n\t\t\t}\n\t\t\tlog.Println(\"File changed:\", e.Name)\n\n\t\t\tlastModFile = e.Name\n\t\t\tlastModTime = time.Now()\n\t\t\tif cancel != nil {\n\t\t\t\tcancel()\n\t\t\t}\n\t\t\tctx, cancel = context.WithCancel(context.Background())\n\t\t\t// do not block loop\n\t\t\tgo runCmds(ctx, args)\n\n\t\tcase err := <-watcher.Errors:\n\t\t\tlog.Println(\"Error:\", err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ee2821c177fd8372a5d0b9ca9d431a41", "score": "0.59944844", "text": "func (w *Watcher) watch(sndch chan<- *Notification) {\n\tdefer func() {\n\t\trecover()\n\t}()\n\n\tfor {\n\t\t//fmt.Printf(\"updating watch info %s\\n\", time.Now())\n\t\t<-time.After(WatchDelay)\n\n\t\tfor _, wi := range w.paths {\n\t\t\t//fmt.Printf(\"cheecking %#v\\n\", wi.Path)\n\n\t\t\tif wi.Update() && w.shouldNotify(wi) {\n\t\t\t\tsndch <- wi.Notification()\n\t\t\t}\n\n\t\t\tif wi.LastEvent == NOEXIST && w.autoWatch {\n\t\t\t\tdelete(w.paths, wi.Path)\n\t\t\t}\n\n\t\t\tif len(w.paths) == 0 {\n\t\t\t\tw.Stop()\n\t\t\t}\n\t\t\t// if filepath.Base(wi.Path) == \"sub1.txt\" {\n\t\t\t// \tfmt.Printf(\"%s\\n\", wi.Path)\n\t\t\t// }\n\t\t}\n\t}\n}", "title": "" }, { "docid": "fa926d9ff923b5ca89255b05ce2252da", "score": "0.5991013", "text": "func (w *Watcher) Run() error {\n\tif err := w.Init(); err != nil {\n\t\treturn err\n\t}\n\n\tbaseDir := w.Dir\n\tif w.IsGB {\n\t\tbaseDir = filepath.Join(baseDir, \"src\")\n\t}\n\n\t// initialize the watchlist\n\terr := filepath.Walk(baseDir, func(path string, stat os.FileInfo, err error) error {\n\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\tif !stat.IsDir() {\n\t\t\treturn nil\n\t\t}\n\n\t\treturn w.AddPath(path)\n\t})\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase event := <-w.fs.Events:\n\t\t\t\t// if it's a directory add/remove it from the watchlist\n\t\t\t\terr = w.processDirEvent(event)\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\t// if it's a go file, find what package\n\t\t\t\terr := w.processGoEvent(event)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Fatal(err)\n\t\t\t\t}\n\n\t\t\tcase err := <-w.fs.Errors:\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Fatal(err)\n\t\t\t\t}\n\t\t\tcase <-time.After(w.Debounce):\n\t\t\t\tw.emit()\n\t\t\tcase <-w.done:\n\t\t\t\tclose(w.changes)\n\t\t\t\tlog.Println(\"closed package watcher\")\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn nil\n}", "title": "" }, { "docid": "5b9c962afa4e040d6415457460e1b511", "score": "0.5985293", "text": "func (w *watcher) start() (err error) {\n\terr = w.dw.Start()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"start: %w\", err)\n\t}\n\tif len(w.htmlg.htmlTemplate) > 0 {\n\t\t_, err = libio.NewWatcher(w.htmlg.htmlTemplate, 0, w.onChangeHtmlTemplate)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"start: %w\", err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d766ce55e2f74f1c778c425ee3d841cb", "score": "0.5974017", "text": "func (w *watcher) Start() {\n\tvar err error\n\tw.notify, err = fsnotify.NewWatcher()\n\tif err != nil {\n\t\tw.Error <- err\n\t\treturn\n\t}\n\tdefer w.notify.Close()\n\n\tw.build()\n\tw.loop()\n\n\treturn\n}", "title": "" }, { "docid": "fd0a3858aef5d52f376df6bd92821f3c", "score": "0.5953052", "text": "func (i *informers) start(ctx context.Context) {\n\tfor _, startable := range i.toStart {\n\t\tstartable.Start(ctx.Done())\n\t}\n}", "title": "" }, { "docid": "7bd5168662d50b7460de1ab67c00337a", "score": "0.59422374", "text": "func (g *Grid) watchingDirectory() {\n\tif g.watcher != nil {\n\t\tdefer g.watcher.Close()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase ev := <-g.watcher.Events:\n\t\t\t\t{\n\t\t\t\t\tif ev.Op&fsnotify.Create == fsnotify.Create {\n\t\t\t\t\t\twholePath := ev.Name\n\t\t\t\t\t\tinfos := strings.Split(wholePath, \"/\")\n\t\t\t\t\t\tsoName := infos[len(infos)-1]\n\t\t\t\t\t\tif g.isSoLibFile(soName) {\n\t\t\t\t\t\t\tif err := g.loadNewRuntime(soName); err != nil {\n\t\t\t\t\t\t\t\tfmt.Println(err.Error())\n\t\t\t\t\t\t\t\tcontinue\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\tcase err := <-g.watcher.Errors:\n\t\t\t\t{\n\t\t\t\t\tfmt.Println(\"error : \", err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfor {\n\t\t\t<-time.After(time.Millisecond * time.Duration(5000))\n\t\t\tif soName, err := g.selectTheRuntime(); err == nil {\n\t\t\t\tif g.runtime != soName {\n\t\t\t\t\tif err := g.loadNewRuntime(soName); err != nil {\n\t\t\t\t\t\tfmt.Println(err.Error())\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "71d34589481abc8380a05c749faa57a5", "score": "0.5916116", "text": "func (w *Watcher) Start() {\n\tw.mutex.Lock()\n\tif w.started {\n\t\tw.mutex.Unlock()\n\t\treturn\n\t} else {\n\t\tw.started = true\n\t\tw.mutex.Unlock()\n\t}\n\tfor kind := range w.watches {\n\t\tw.sync(kind)\n\t}\n\n\tfor _, watch := range w.watches {\n\t\twatch.invoke()\n\t}\n\n\tw.wg.Add(len(w.watches))\n\tfor _, watch := range w.watches {\n\t\tgo watch.runner()\n\t}\n}", "title": "" }, { "docid": "03ba2670bd9ecc080e540adbc5f77c49", "score": "0.57960457", "text": "func (s *Launcher) run() {\n\tscanTicker := time.NewTicker(s.scanPeriod)\n\tdefer scanTicker.Stop()\n\tfor {\n\t\tselect {\n\t\tcase source := <-s.addedSources:\n\t\t\ts.addSource(source)\n\t\tcase source := <-s.removedSources:\n\t\t\ts.removeSource(source)\n\t\tcase <-scanTicker.C:\n\t\t\t// check if there are new files to tail, tailers to stop and tailer to restart because of file rotation\n\t\t\ts.scan()\n\t\tcase <-s.stop:\n\t\t\t// no more file should be tailed\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "14344ffbef2436b4383e8271a46e7431", "score": "0.57919425", "text": "func watch(subl string, gitp string) {\n\n\tw := watcher.New()\n\tw.SetMaxEvents(1)\n\tw.FilterOps(watcher.Write, watcher.Create)\n\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase event := <-w.Event:\n\n\t\t\t\t// Name of file in corresponding git repo\n\t\t\t\tdst := strings.Replace(event.Path, subl, gitp, 1)\n\n\t\t\t\t// Update git file\n\t\t\t\terr := copy(event.Path, dst)\n\t\t\t\tif err != nil {\n\t\t\t\t\tfmt.Println(err)\n\t\t\t\t}\n\n\t\t\t\tcommitMsg := event.String()\n\n\t\t\t\tpush(gitp, commitMsg)\n\n\t\t\t\tfmt.Println(commitMsg)\n\n\t\t\tcase err := <-w.Error:\n\t\t\t\tlog.Fatalln(err)\n\n\t\t\tcase <-w.Closed:\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\t// Begin watching subl dir\n\terr := w.Add(subl)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\tfor path, f := range w.WatchedFiles() {\n\t\tfmt.Printf(\" Watching %s: %s\\n\", path, f.Name())\n\t}\n\n\tfmt.Println()\n\n\terr = w.Start(time.Millisecond * 100)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n}", "title": "" }, { "docid": "347b0b717fa19ac1e08830139795e981", "score": "0.5735065", "text": "func (u *Updater) Start() error {\n\tif u.started {\n\t\treturn fmt.Errorf(\"dflag: updater already started\")\n\t}\n\tif err := u.watcher.Add(u.parentPath); err != nil {\n\t\treturn fmt.Errorf(\"unable to add parent dir %v to watch: %v\", u.parentPath, err)\n\t}\n\tif err := u.watcher.Add(u.dirPath); err != nil { // add the dir itself.\n\t\treturn fmt.Errorf(\"unable to add config dir %v to watch: %v\", u.dirPath, err)\n\t}\n\tlog.Infof(\"Now watching %v and %v\", u.parentPath, u.dirPath)\n\tu.started = true\n\tu.done = make(chan bool)\n\tgo u.watchForUpdates()\n\treturn nil\n}", "title": "" }, { "docid": "d0e5d990cdc4313ea04fcd60984eda8f", "score": "0.5680968", "text": "func Start(ctx context.Context, logger *zap.Logger, storageSvcUrl string) error {\n\tbmLogger := logger.Named(\"builder_manager\")\n\n\tclientGen := crd.NewClientGenerator()\n\tfissionClient, err := clientGen.GetFissionClient()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to get fission client\")\n\t}\n\tkubernetesClient, err := clientGen.GetKubernetesClient()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to get kubernetes client\")\n\t}\n\n\terr = crd.WaitForCRDs(ctx, logger, fissionClient)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"error waiting for CRDs\")\n\t}\n\n\tfetcherConfig, err := fetcherConfig.MakeFetcherConfig(\"/packages\")\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"error making fetcher config\")\n\t}\n\n\tpodSpecPatch, err := util.GetSpecFromConfigMap(fv1.BuilderPodSpecPath)\n\tif err != nil {\n\t\tlogger.Warn(\"error reading data for pod spec patch\", zap.String(\"path\", fv1.BuilderPodSpecPath), zap.Error(err))\n\t}\n\n\tenvWatcher := makeEnvironmentWatcher(ctx, bmLogger, fissionClient, kubernetesClient, fetcherConfig, podSpecPatch)\n\tenvWatcher.Run(ctx)\n\n\tpkgWatcher := makePackageWatcher(bmLogger, fissionClient,\n\t\tkubernetesClient, storageSvcUrl,\n\t\tutils.GetK8sInformersForNamespaces(kubernetesClient, time.Minute*30, fv1.Pods),\n\t\tutils.GetInformersForNamespaces(fissionClient, time.Minute*30, fv1.PackagesResource))\n\tpkgWatcher.Run(ctx)\n\treturn nil\n}", "title": "" }, { "docid": "0ace225fd6348881d14d81d5f886376c", "score": "0.56737155", "text": "func Start(f func(string), shut chan struct{}) {\n\tsetupWatcher()\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase event := <-watchme.Event:\n\t\t\t\tswitch event.Op {\n\t\t\t\tcase watcher.Create:\n\t\t\t\t\tif event.IsDir() {\n\t\t\t\t\t\t// We got a new folder, add it.\n\t\t\t\t\t\tif err := watchDir(event.Path, false); err != nil {\n\t\t\t\t\t\t\tlogp.Err(\"%v\", err)\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// We got a new file, scan it. Ignore .gz\n\t\t\t\t\t\tif strings.HasSuffix(event.Name(), \".cdr\") {\n\t\t\t\t\t\t\tlogp.Info(\"scan file %s\", event.Path)\n\t\t\t\t\t\t\tf(event.Path)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\tcase watcher.Rename:\n\t\t\t\t\tlogp.Info(\"%v\", event)\n\t\t\t\tcase watcher.Move:\n\t\t\t\t\tlogp.Info(\"%v\", event)\n\t\t\t\tcase watcher.Remove:\n\t\t\t\t\tlogp.Info(\"%v\", event)\n\t\t\t\t}\n\n\t\t\tcase err := <-watchme.Error:\n\t\t\t\tlogp.Err(\"%v\", err)\n\t\t\t\t// We got a new folder, add it.\n\t\t\t\tif err := watchDir(config.Setting.WatchFolder, config.Setting.WatchRecursive); err != nil {\n\t\t\t\t\tlogp.Err(\"%v\", err)\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\tcase <-shut:\n\t\t\t\tlogp.Info(\"close watcher\")\n\t\t\t\twatchme.Close()\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\t// Start the watching process to check for changes every second.\n\tif err := watchme.Start(config.Setting.WatchTime); err != nil {\n\t\tlogp.Err(\"%v\", err)\n\t}\n}", "title": "" }, { "docid": "d8c7b5d5f0d72b0ff007655fbe570104", "score": "0.5673711", "text": "func (w *Weave) build() {\n\tbuildstr := \"cd \" + w.buildLocation + \" && \" + w.whichGo() + \" build && cp \" +\n\t\tw.binName() + \" \" + w.buildDir() + \"/.\"\n\n\to, err := exec.Command(\"bash\", \"-c\", buildstr).CombinedOutput()\n\tif err != nil {\n\t\tw.flog.Println(string(o))\n\t}\n\n}", "title": "" }, { "docid": "a6c47e2a7b7901a9efef1f0983636633", "score": "0.5670253", "text": "func (w *Watcher) Watch() error {\n\tblogger.Info().Command(\"watching\").Message(blogger.FormattedMessage(w.dir)).Log()\n\n\t// Do a first build\n\tokay := w.b.Build()\n\tif okay {\n\t\tif !w.buildOnly {\n\t\t\t// Do a first run.\n\t\t\tif re := w.r.Run(); re != nil {\n\t\t\t\tblogger.Error().Message(re.Error()).Log()\n\t\t\t}\n\t\t}\n\t\tce := w.r.RunCustom()\n\t\tif ce != nil {\n\t\t\tblogger.Error().Message(ce.Error()).Log()\n\t\t}\n\t}\n\tstopWatch := make(chan error)\n\tgo func() {\n\t\tticker := time.NewTicker(time.Millisecond * SLEEP_TIME)\n\t\tfor {\n\t\t\terr := filepath.Walk(w.dir, w.watchFunc)\n\t\t\tif err != nil && err != filepath.SkipDir {\n\t\t\t\tstopWatch <- err\n\t\t\t\tbreak\n\t\t\t}\n\t\t\t<-ticker.C\n\t\t}\n\t}()\n\treturn <-stopWatch\n}", "title": "" }, { "docid": "74fcca0faca0147619f3440a81941d94", "score": "0.56629", "text": "func (a *App) watch() {\n\tfor {\n\t\te, ok := <-a.Watcher.Events\n\t\tif !ok {\n\t\t\treturn\n\t\t}\n\t\tif e.Op&fsnotify.Create > 0 {\n\t\t\t// add new files to library\n\t\t\ta.Library.Add(e.Name)\n\t\t} else if e.Op&(fsnotify.Write|fsnotify.Chmod) > 0 {\n\t\t\t// writes and chmods should remove old file before adding again\n\t\t\ta.Library.Remove(e.Name)\n\t\t\ta.Library.Add(e.Name)\n\t\t} else if e.Op&(fsnotify.Remove|fsnotify.Rename) > 0 {\n\t\t\t// remove and rename just remove file\n\t\t\t// fsnotify will signal a Create event with the new file name\n\t\t\ta.Library.Remove(e.Name)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6c2f02583d245167a491e7f7303eeed8", "score": "0.56533754", "text": "func watcher(path string, run chan<- runRequest) {\n\tw, err := fsnotify.NewWatcher()\n\tif err != nil {\n\t\tdie(err)\n\t}\n\n\tinfo, err := os.Stat(path)\n\tif err != nil {\n\t\tdie(err)\n\t}\n\tif !info.IsDir() {\n\t\t// watchDeep is a no-op on regular files.\n\t\tif err := w.Watch(path); err != nil {\n\t\t\tdie(err)\n\t\t}\n\t} else {\n\t\twatchDeep(w, path)\n\t}\n\n\tdone := make(chan bool)\n\tfor {\n\t\tselect {\n\t\tcase ev := <-w.Event:\n\t\t\tif ev.IsCreate() {\n\t\t\t\twatchDeep(w, ev.Name)\n\t\t\t}\n\n\t\t\tinfo, err := os.Stat(ev.Name)\n\t\t\tfor os.IsNotExist(err) {\n\t\t\t\tdir, _ := filepath.Split(ev.Name)\n\t\t\t\tif dir == \"\" {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tinfo, err = os.Stat(dir)\n\t\t\t\tif dir == path && os.IsNotExist(err) {\n\t\t\t\t\tdie(errors.New(\"Watch point \" + path + \" deleted\"))\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\tdie(err)\n\t\t\t}\n\t\t\trun <- runRequest{info.ModTime(), done}\n\t\t\t<-done\n\n\t\tcase err := <-w.Error:\n\t\t\tdie(err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5dab8f0189325d7a7637004465d72194", "score": "0.56306225", "text": "func (shared *InotifyTracker) run() {\r\n\twatcher, err := fsnotify.NewWatcher()\r\n\tif err != nil {\r\n\t\tutil.Fatal(\"failed to create Watcher\")\r\n\t}\r\n\tshared.watcher = watcher\r\n\r\n\tfor {\r\n\t\tselect {\r\n\t\tcase winfo := <-shared.watch:\r\n\t\t\tshared.error <- shared.addWatch(winfo)\r\n\r\n\t\tcase winfo := <-shared.remove:\r\n\t\t\tshared.error <- shared.removeWatch(winfo)\r\n\r\n\t\tcase event, open := <-shared.watcher.Events:\r\n\t\t\tif !open {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t\tshared.sendEvent(event)\r\n\r\n\t\tcase err, open := <-shared.watcher.Errors:\r\n\t\t\tif !open {\r\n\t\t\t\treturn\r\n\t\t\t} else if err != nil {\r\n\t\t\t\tsysErr, ok := err.(*os.SyscallError)\r\n\t\t\t\tif !ok || sysErr.Err != syscall.EINTR {\r\n\t\t\t\t\tlogger.Printf(\"Error in Watcher Error channel: %s\", err)\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}", "title": "" }, { "docid": "9507736928bbfe0e7274ad0e1a6a3d9f", "score": "0.56105506", "text": "func Build(o Options, h http.Handler, paths []string, eh EventHandler) {\n\tif eh == nil {\n\t\teh = defaultEventHandler\n\t}\n\n\tvar wg sync.WaitGroup\n\n\tpathsChan := make(chan string)\n\n\tfor i := 0; i < o.Concurrency; i++ {\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tdefer wg.Done()\n\t\t\tbuildWorker(o, h, pathsChan, eh)\n\t\t}()\n\t}\n\n\tfor _, path := range paths {\n\t\tpathsChan <- path\n\t}\n\n\tclose(pathsChan)\n\n\twg.Wait()\n}", "title": "" }, { "docid": "a3e176b2a8d4377663d398aa5ad7b0dc", "score": "0.559589", "text": "func (agg *BinaryAggregator) start() error {\n\tif _, err := fileutil.EnsureDirExists(config.Aggregator.BinaryFuzzPath); err != nil {\n\t\treturn err\n\t}\n\tif _, err := fileutil.EnsureDirExists(config.Aggregator.ExecutablePath); err != nil {\n\t\treturn err\n\t}\n\tif err := common.BuildClangDM(\"Debug\", true); err != nil {\n\t\treturn err\n\t}\n\tif err := common.BuildClangDM(\"Release\", true); err != nil {\n\t\treturn err\n\t}\n\t// Set the wait groups to fresh\n\tagg.monitoringWaitGroup = &sync.WaitGroup{}\n\tagg.pipelineWaitGroup = &sync.WaitGroup{}\n\tagg.analysisCount = 0\n\tagg.uploadCount = 0\n\tagg.bugReportCount = 0\n\tagg.monitoringWaitGroup.Add(1)\n\tgo agg.scanForNewCandidates()\n\n\tnumAnalysisProcesses := config.Aggregator.NumAnalysisProcesses\n\tif numAnalysisProcesses <= 0 {\n\t\t// TODO(kjlubick): Actually make this smart based on the number of cores\n\t\tnumAnalysisProcesses = 20\n\t}\n\tfor i := 0; i < numAnalysisProcesses; i++ {\n\t\tagg.pipelineWaitGroup.Add(1)\n\t\tgo agg.waitForAnalysis(i, analyzeSkp)\n\t}\n\n\tnumUploadProcesses := config.Aggregator.NumUploadProcesses\n\tif numUploadProcesses <= 0 {\n\t\t// TODO(kjlubick): Actually make this smart based on the number of cores/number\n\t\t// of aggregation processes\n\t\tnumUploadProcesses = 5\n\t}\n\tfor i := 0; i < numUploadProcesses; i++ {\n\t\tagg.pipelineWaitGroup.Add(1)\n\t\tgo agg.waitForUploads(i)\n\t}\n\tagg.pipelineWaitGroup.Add(1)\n\tgo agg.waitForBugReporting()\n\tagg.pipelineShutdown = make(chan bool, numAnalysisProcesses+numUploadProcesses+1)\n\t// start background routine to monitor queue details\n\tagg.monitoringWaitGroup.Add(1)\n\tgo agg.monitorStatus(numAnalysisProcesses, numUploadProcesses)\n\treturn nil\n}", "title": "" }, { "docid": "e4ed35e65e3aabc2b47c62d755f0e5c4", "score": "0.5591528", "text": "func watch(dir string) error {\n\twatcher, err := fsnotify.NewWatcher()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer watcher.Close()\n\tdone := make(chan interface{})\n\tgo func() {\n\t\tfor {\n\t\t\tselect { // HL\n\t\t\tcase event := <-watcher.Event: // HL\n\t\t\t\tif event.IsCreate() {\n\t\t\t\t\tlog.Println(label.Info + \" New file: \" + event.Name)\n\t\t\t\t\tprocess(event.Name)\n\t\t\t\t}\n\t\t\tcase err := <-watcher.Error: // HL\n\t\t\t\tlog.Println(err)\n\t\t\t} // HL\n\t\t}\n\t}()\n\n\twatcher.Watch(dir)\n\tlog.Println(label.Info + \" Startup done. Waiting for events\")\n\t<-done\n\n\treturn nil\n}", "title": "" }, { "docid": "6b57eda8717ddd9b2a26ba5e11e68b91", "score": "0.55901384", "text": "func watch(workingDir string, changed chan struct{}, errored chan error, closed chan struct{}) {\n\tw := watcher.New()\n\tw.SetMaxEvents(2)\n\tw.IgnoreHiddenFiles(true)\n\n\tif err := w.AddRecursive(workingDir); err != nil {\n\t\terrored <- err\n\t}\n\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase event := <-w.Event:\n\t\t\t\tif !event.IsDir() {\n\t\t\t\t\tchanged <- struct{}{}\n\t\t\t\t}\n\t\t\tcase err := <-w.Error:\n\t\t\t\terrored <- err\n\t\t\tcase c := <-w.Closed:\n\t\t\t\tclosed <- c\n\t\t\t}\n\t\t}\n\t}()\n\n\tif err := w.Start(time.Millisecond * 200); err != nil {\n\t\terrored <- err\n\t}\n}", "title": "" }, { "docid": "b0982c6b20b1052d9381b922f8ce5fef", "score": "0.5585579", "text": "func (b *BuildBucketState) start(pollInterval, timeWindow time.Duration) error {\n\t// Create the channel that will receive the buildbot results.\n\tbuildsCh := make(chan *bb_api.ApiCommonBuildMessage)\n\tworkPermissions := make(chan bool, maxConcurrentWrites)\n\n\t// Process the builds produced by the poller.\n\tgo func() {\n\t\tfor build := range buildsCh {\n\t\t\t// Get work permission.\n\t\t\tworkPermissions <- true\n\n\t\t\tgo func(build *bb_api.ApiCommonBuildMessage) {\n\t\t\t\t// Give up work permission at the end.\n\t\t\t\tdefer func() { <-workPermissions }()\n\n\t\t\t\tif _, err := b.processBuild(build); err != nil {\n\t\t\t\t\tsklog.Errorf(\"Error processing build: %s\", err)\n\t\t\t\t}\n\t\t\t}(build)\n\t\t}\n\t}()\n\n\t// Start the poller.\n\tif err := b.startBuildPoller(buildsCh, pollInterval, timeWindow); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "35c840b10d5ad3d8197ebf47d3d14a49", "score": "0.554808", "text": "func (w *Watcher) Start() {\n\tl := w.Logger.WithFields(logrus.Fields{\n\t\t\"operation\": \"watcher.Start\",\n\t})\n\tl.Info(\"starting watcher\")\n\tw.Run = true\n\tsigchan := make(chan os.Signal)\n\tsignal.Notify(sigchan, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)\n\n\tticker := time.NewTicker(time.Duration(w.AutoScalingPeriod) * time.Second)\n\tdefer ticker.Stop()\n\n\tgo w.reportRoomsStatusesRoutine()\n\tstopKubeWatch := make(chan struct{})\n\tgo w.Informer.Run(stopKubeWatch)\n\tgo w.watchPods(stopKubeWatch)\n\n\tfor w.Run == true {\n\t\tl = w.Logger.WithFields(logrus.Fields{\n\t\t\t\"operation\": \"watcher.Start\",\n\t\t})\n\t\tselect {\n\t\tcase <-ticker.C:\n\t\t\t_ = w.watchRooms()\n\t\tcase sig := <-sigchan:\n\t\t\tl.Warnf(\"caught signal %v: terminating\\n\", sig)\n\t\t\tclose(stopKubeWatch)\n\t\t\tw.Run = false\n\t\t}\n\t}\n\textensions.GracefulShutdown(l, w.gracefulShutdown.wg, w.gracefulShutdown.timeout)\n}", "title": "" }, { "docid": "ad8a07bfe4593de9c6b2214bc221d7c4", "score": "0.55470234", "text": "func startWatch(stopCh <-chan struct{}, s cache.SharedIndexInformer, stream chan types.WorkflowEvent) {\n\tstartTime := time.Now().Unix()\n\thandlers := cache.ResourceEventHandlerFuncs{\n\t\tAddFunc: func(obj interface{}) {\n\t\t\tworkflowEventHandler(obj, \"ADD\", stream, startTime)\n\t\t},\n\t\tUpdateFunc: func(oldObj, obj interface{}) {\n\t\t\tworkflowEventHandler(obj, \"UPDATE\", stream, startTime)\n\t\t},\n\t\tDeleteFunc: func(obj interface{}) {\n\t\t\tworkflowEventHandler(obj, \"DELETE\", stream, startTime)\n\t\t},\n\t}\n\ts.AddEventHandler(handlers)\n\ts.Run(stopCh)\n}", "title": "" }, { "docid": "8b87470e35f63ef54e8c1734a42e16f8", "score": "0.554033", "text": "func buildAction(args argSet) {\n\tif !args.hasArg(1) {\n\t\tfmt.Println(\"Please specify the item to build.\")\n\t\treturn\n\t}\n\n\tdb := openAndCreateStorage()\n\n\tbuildInfo := getBuildInfo(db, args.getArg(1))\n\tsnapshotName := fmt.Sprintf(\"SNAP-%s-%s\",\n\t\tbuildInfo.Name, time.Now().Format(\"2006-01-02-150405\"))\n\n\tcloneAndCheckout(*buildInfo, snapshotName)\n\n\tsnapshotDir := path.Join(getStorageBase(), snapshotName)\n\tos.Chdir(snapshotDir)\n\n\tfiles, err := ioutil.ReadDir(\".\")\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\n\tif containsFile(dependencyFile, files) {\n\t\tfmt.Println(\"Starting services\")\n\t\tstartDependencies(dependencyFile)\n\t\t// If we start dependencies, wait some time for them to start\n\t\tfmt.Printf(\"Waiting one minute for services to start...\\n\")\n\t\ttime.Sleep(sleepTime(args.getArg(0)))\n\t}\n\n\tfor _, filename := range buildFiles {\n\t\tif containsFile(filename, files) {\n\t\t\trunner := shell\n\t\t\tif strings.HasSuffix(filename, \".py\") {\n\t\t\t\trunner = \"python\"\n\t\t\t}\n\n\t\t\tfmt.Printf(\"Running file: %s\\n\", filename)\n\t\t\tcmd := exec.Command(runner, fmt.Sprintf(\"./%s %s\", filename, buildInfo.AbsolutePath))\n\n\t\t\toutput, err := cmd.CombinedOutput()\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(string(output))\n\t\t\t\tfmt.Println(err)\n\t\t\t}\n\n\t\t\tif _, err := os.Stat(resultsFile); os.IsNotExist(err) {\n\t\t\t\tfmt.Printf(\"No file %s to take results from!\", resultsFile)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tsaveResults(db, buildInfo, resultsFile)\n\n\t\t\treturn\n\t\t}\n\t}\n\n\tfmt.Printf(\"No suitable nitely file found to build!\\n\")\n\n}", "title": "" }, { "docid": "63bd0250164f9a366272251c5c51ab19", "score": "0.5525792", "text": "func (w *watcher) Run(ctx context.Context) error {\n\t// TODO: Spawn goroutines for each repository\n\t// Pre-clone to cache the registered git repositories.\n\tfor _, r := range w.config.Repositories {\n\t\t// TODO: Clone repository another temporary destination\n\t\trepo, err := w.gitClient.Clone(ctx, r.RepoID, r.Remote, r.Branch, \"\")\n\t\tif err != nil {\n\t\t\tw.logger.Error(\"failed to clone repository\",\n\t\t\t\tzap.String(\"repo-id\", r.RepoID),\n\t\t\t\tzap.Error(err),\n\t\t\t)\n\t\t\treturn fmt.Errorf(\"failed to clone repository %s: %w\", r.RepoID, err)\n\t\t}\n\t\tw.gitRepos[r.RepoID] = repo\n\t}\n\n\tfor _, cfg := range w.config.ImageProviders {\n\t\tp, err := imageprovider.NewProvider(&cfg, w.logger)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to yield image provider %s: %w\", cfg.Name, err)\n\t\t}\n\n\t\tw.wg.Add(1)\n\t\tgo w.run(ctx, p, cfg.PullInterval.Duration())\n\t}\n\tw.wg.Wait()\n\treturn nil\n}", "title": "" }, { "docid": "b9e526d0f250a3e64c34fbc096c19374", "score": "0.5516373", "text": "func (m *gchookManager) startWorker() {\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-m.canceled:\n\t\t\t\treturn\n\n\t\t\tcase <-m.gc:\n\t\t\t\twg := &sync.WaitGroup{}\n\t\t\t\twg.Add(len(m.hooks))\n\t\t\t\tfor _, hook := range m.hooks {\n\t\t\t\t\tgo func(hook func()) {\n\t\t\t\t\t\thook()\n\t\t\t\t\t\twg.Done()\n\t\t\t\t\t}(hook)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "e71e5a3520e66e736871174e1d3e151a", "score": "0.55140054", "text": "func RunWith(watcher Watcher, sources ...string) {\n\t// Author's notes: Because rizla's Run is not allowed to be called more than once\n\t// the whole package works as it is, so the watcher here\n\t// is CHANGING THE UNEXPORTED PACKGE VARIABLE 'fsWatcher'.\n\t// We don't export the 'fsWatcher' directly because this may cause issues\n\t// if user tries to change it while it runs.\n\tfsWatcher = watcher\n\n\tif len(sources) > 0 {\n\t\tfor _, s := range sources {\n\t\t\tAdd(NewProject(s))\n\t\t}\n\t}\n\n\tfor _, p := range projects {\n\t\t// go build\n\t\tif err := buildProject(p); err != nil {\n\t\t\tp.Err.Dangerf(errBuild.Error())\n\t\t\tcontinue\n\t\t}\n\n\t\t// exec run the builded program\n\t\tif err := runProject(p); err != nil {\n\t\t\tp.Err.Dangerf(errRun.Error())\n\t\t\tcontinue\n\t\t}\n\n\t}\n\n\twatcher.OnError(func(err error) {\n\t\tOut.Dangerf(\"\\n Error:\" + err.Error())\n\t})\n\n\twatcher.OnChange(func(p *Project, filename string) {\n\t\tif time.Now().After(p.lastChange.Add(p.AllowReloadAfter)) {\n\t\t\tp.lastChange = time.Now()\n\t\t\tmatch := p.Matcher(filename)\n\n\t\t\tif match {\n\n\t\t\t\tp.OnReload(filename)\n\n\t\t\t\t// kill previous running instance\n\t\t\t\terr := killProcess(p.proc)\n\t\t\t\tif err != nil {\n\t\t\t\t\tp.Err.Dangerf(err.Error())\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// go build\n\t\t\t\terr = buildProject(p)\n\t\t\t\tif err != nil {\n\t\t\t\t\tp.Err.Dangerf(errBuild.Error())\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// exec run the builded program\n\t\t\t\terr = runProject(p)\n\t\t\t\tif err != nil {\n\t\t\t\t\tp.Err.Dangerf(errRun.Format(err.Error()).Error())\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tp.OnReloaded(filename)\n\n\t\t\t}\n\t\t}\n\t})\n\n\twatcher.Loop()\n}", "title": "" }, { "docid": "5d8a0f11b3fbe293c886bb32b5b76c39", "score": "0.5495156", "text": "func startServiceWatcher(services map[string][]string, conn *dbus.Conn, core map[string]string) {\n\t//NOTE: Does this func do to much?\n\tstatus := make(chan map[string]string)\n\tdata := make(chan []byte)\n\tduration, err := strconv.Atoi(core[\"check_duration\"])\n\tif err != nil {\n\t\tlog.Fatalf(\"[ERR] Error getting check_duration from settings.ini file: %v\\n\", err)\n\t}\n\tgo serviceRoutine(services, conn, status, duration)\n\tfor {\n\t\tgo parseMapToJSON(<-status, data)\n\t\tgo socketClient(core[\"sock_host\"], core[\"sock_port\"], data)\n\t\tfmt.Println(<-status)\n\t}\n}", "title": "" }, { "docid": "5f7da08bcee7d661ae21bfad88770436", "score": "0.5491732", "text": "func (s *Server) startWatcher(ctx context.Context) (*services.DatabaseWatcher, error) {\n\tif len(s.cfg.Selectors) == 0 {\n\t\ts.log.Debug(\"Not initializing database resource watcher.\")\n\t\treturn nil, nil\n\t}\n\ts.log.Debug(\"Initializing database resource watcher.\")\n\twatcher, err := services.NewDatabaseWatcher(ctx, services.DatabaseWatcherConfig{\n\t\tResourceWatcherConfig: services.ResourceWatcherConfig{\n\t\t\tComponent: teleport.ComponentDatabase,\n\t\t\tLog: s.log,\n\t\t\tClient: s.cfg.AccessPoint,\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\tgo func() {\n\t\tdefer watcher.Close()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase databases := <-watcher.DatabasesC:\n\t\t\t\tif err := s.reconciler.Reconcile(ctx, databases.AsResources()); err != nil {\n\t\t\t\t\ts.log.WithError(err).Errorf(\"Failed to reconcile %v.\", databases)\n\t\t\t\t} else if s.cfg.OnReconcile != nil {\n\t\t\t\t\ts.cfg.OnReconcile(s.getDatabases())\n\t\t\t\t}\n\t\t\tcase <-ctx.Done():\n\t\t\t\ts.log.Debug(\"Database resource watcher done.\")\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\treturn watcher, nil\n}", "title": "" }, { "docid": "80b1f26bc589256973de3f53967d73e3", "score": "0.54837507", "text": "func (s *Supervisor) setupWatchers() {\n\ts.watchers = []watcher.Watcher{\n\t\tlogwatcher.LogWatcher{Unit: \"bitcoind\", Events: s.events, Errors: s.errors},\n\t\tlogwatcher.LogWatcher{Unit: \"lightningd\", Events: s.events, Errors: s.errors},\n\t\tlogwatcher.LogWatcher{Unit: \"electrs\", Events: s.events, Errors: s.errors},\n\t\tlogwatcher.LogWatcher{Unit: \"bbbmiddleware\", Events: s.events, Errors: s.errors},\n\t\tprometheuswatcher.PrometheusWatcher{Unit: \"bitcoind\", PClient: s.prometheus, Expression: \"bitcoin_ibd\", Interval: 10 * time.Second, Trigger: trigger.PrometheusBitcoindIBD, Events: s.events, Errors: s.errors},\n\t}\n}", "title": "" }, { "docid": "7d5df92efa622e17c3c8358be6f35ab9", "score": "0.5477123", "text": "func (app *App) watchTargets() (err error) {\n\tvar targetURLs []string\n\tfor _, t := range app.targets {\n\t\tzap.L().Debug(\"assigned target\", zap.String(\"url\", t.RepoURL))\n\t\ttargetURLs = append(targetURLs, t.RepoURL)\n\t}\n\n\tif app.targetsWatcher != nil {\n\t\tapp.targetsWatcher.Close()\n\t}\n\tapp.targetsWatcher, err = gitwatch.New(\n\t\tapp.ctx,\n\t\ttargetURLs,\n\t\tapp.config.CheckInterval,\n\t\tapp.config.Directory,\n\t\tapp.ssh,\n\t\ttrue)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to watch targets\")\n\t}\n\tgo app.targetsWatcher.Run() //nolint:errcheck - no worthwhile errors returned\n\tzap.L().Debug(\"created targets watcher, awaiting setup\")\n\n\t<-app.targetsWatcher.InitialDone\n\tzap.L().Debug(\"targets initial setup done\")\n\n\treturn\n}", "title": "" }, { "docid": "6c089a0bc3a17cbb697751c78c03409c", "score": "0.5473307", "text": "func (bundler *Bundler) Watch() {\n\tbundler.options.Watch = &esbuild.WatchMode{\n\t\tOnRebuild: func(r esbuild.BuildResult) {\n\t\t\tif len(r.Errors) > 0 {\n\t\t\t\tfmt.Printf(\"watch build failed: %d errors\\n\", len(r.Errors))\n\t\t\t} else {\n\t\t\t\tfmt.Printf(\"watch build succeeded: %d warnings\\n\", len(r.Warnings))\n\t\t\t}\n\n\t\t\tbundler.writeResultsToFs(r)\n\t\t\tbundler.refresh <- true\n\t\t},\n\t}\n\n\tr := esbuild.Build(bundler.options)\n\tbundler.writeResultsToFs(r)\n}", "title": "" }, { "docid": "27171dd45318bbd586c39b3e38aeae5d", "score": "0.54547244", "text": "func newWatcher(dirNotify bool, initpaths ...string) (w *Watcher) {\n\tw = new(Watcher)\n\tw.autoWatch = dirNotify\n\tw.paths = make(map[string]*watchItem, 0)\n\tw.IgnorePathFn = ignorePathDefault\n\n\tvar paths []string\n\tfor _, path := range initpaths {\n\t\tmatches, err := filepath.Glob(path)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tpaths = append(paths, matches...)\n\t}\n\tif dirNotify {\n\t\tw.syncAddPaths(paths...)\n\t} else {\n\t\tfor _, path := range paths {\n\t\t\tw.paths[path] = watchPath(path)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "fc3fdd64abacdbc0c01570fffe9a825b", "score": "0.5453148", "text": "func (h *execWorker) start() {\n\tticker := h.clock.Tick(h.period)\n\th.readyCh <- struct{}{} // For testing.\n\n\tfor {\n\t\tselect {\n\t\t// If the command takes > period, the command runs continuously.\n\t\tcase <-ticker:\n\t\t\tlogf(\"Worker running %v to serve %v\", h.probeCmd, h.probePath)\n\t\t\toutput, err := h.exec.Command(\"sh\", \"-c\", h.probeCmd).CombinedOutput()\n\t\t\tts := h.clock.Now()\n\t\t\tfunc() {\n\t\t\t\th.mutex.Lock()\n\t\t\t\tdefer h.mutex.Unlock()\n\t\t\t\th.result = execResult{output, err, ts}\n\t\t\t}()\n\t\tcase <-h.stopCh:\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1fd340683a040360fbe6969dd37a4215", "score": "0.54526675", "text": "func (tw *TimeWheel) start() {\n\tfor {\n\t\tselect {\n\t\tcase <-tw.ticker.C:\n\t\t\ttw.tickHandler()\n\t\tcase task := <-tw.addTaskChan:\n\t\t\ttw.addTask(&task)\n\t\tcase taskID := <-tw.removeTaskChan:\n\t\t\ttw.removeTask(taskID)\n\t\tcase task := <-tw.moveTaskChan:\n\t\t\ttw.moveTask(task)\n\t\tcase <-tw.stopChan:\n\t\t\ttw.ticker.Stop()\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9befbe9f42d7ee376d72dc43764c9f48", "score": "0.5450798", "text": "func StartWatchingGithubReleases() {\n\tgithubRelease := make(chan events.DataEvent)\n\tevents.Queue.Subscribe(\"github.release\", githubRelease)\n\tfor {\n\t\tselect {\n\n\t\tcase d := <-githubRelease:\n\t\t\tgo handleGithubRelease(d.Data.(Webhook))\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e12c8641a5cb00ea17c4183af407b54b", "score": "0.5439517", "text": "func watchMode(path string, args []string) error {\n\tw := watcher.New()\n\n\t// SetMaxEvents to 1 to allow at most 1 event's to be received\n\t// on the Event channel per watching cycle.\n\t//\n\t// If SetMaxEvents is not set, the default is to send all events.\n\tw.SetMaxEvents(1)\n\n\t// Only notify rename and move events.\n\t// w.FilterOps(watcher.Rename, watcher.Move)\n\n\t// Only files that match the regular expression during file listings\n\t// will be watched.\n\tr := regexp.MustCompile(`\\.go$`)\n\tw.AddFilterHook(watcher.RegexFilterHook(r, false))\n\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase event := <-w.Event:\n\t\t\t\tfmt.Println(event) // Print the event's info.\n\t\t\t\tfmt.Println()\n\t\t\t\texecuteTests(path, args)\n\t\t\tcase err := <-w.Error:\n\t\t\t\tlog.Fatalln(err)\n\t\t\tcase <-w.Closed:\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\t// Watch recursively for changes.\n\tif err := w.AddRecursive(strings.Replace(path, \"...\", \"\", -1)); err != nil {\n\t\treturn err\n\t}\n\n\tfmt.Println()\n\n\t// Start the watching process - it'll check for changes every 100ms.\n\tif err := w.Start(time.Millisecond * 100); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "360d354645bc195486e32eb26756b8fd", "score": "0.54126555", "text": "func (l *Launcher) run(sourceProvider launchers.SourceProvider, pipelineProvider pipeline.Provider, registry auditor.Registry) {\n\t// if we're not logging containers, then there's nothing to do\n\tif l.cop.Wait(l.ctx) != containersorpods.LogContainers {\n\t\treturn\n\t}\n\n\tlog.Info(\"Starting Docker launcher\")\n\tl.pipelineProvider = pipelineProvider\n\tl.registry = registry\n\n\taddedSources, removedSources := sourceProvider.SubscribeForType(config.DockerType)\n\taddedServices := l.services.GetAddedServicesForType(config.DockerType)\n\tremovedServices := l.services.GetRemovedServicesForType(config.DockerType)\n\n\tfor {\n\t\tselect {\n\t\tcase service := <-addedServices:\n\t\t\t// detected a new container running on the host,\n\t\t\tdockerutil, err := dockerutilpkg.GetDockerUtil()\n\t\t\tif err != nil {\n\t\t\t\tlog.Warnf(\"Could not use docker client, logs for container %s won’t be collected: %v\", service.Identifier, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tdockerContainer, err := dockerutil.Inspect(context.TODO(), service.Identifier, false)\n\t\t\tif err != nil {\n\t\t\t\tlog.Warnf(\"Could not find container with id: %v\", err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcontainer := NewContainer(dockerContainer, service)\n\t\t\tsource := container.FindSource(l.activeSources)\n\t\t\tswitch {\n\t\t\tcase source != nil:\n\t\t\t\t// a source matches with the container, start a new tailer\n\t\t\t\tl.startTailer(container, source)\n\t\t\tdefault:\n\t\t\t\t// no source matches with the container but a matching source may not have been\n\t\t\t\t// emitted yet or the container may contain an autodiscovery identifier\n\t\t\t\t// so it's put in a cache until a matching source is found.\n\t\t\t\tl.pendingContainers[service.Identifier] = container\n\t\t\t}\n\t\tcase source := <-addedSources:\n\t\t\t// detected a new source that has been created either from a configuration file,\n\t\t\t// a docker label or a pod annotation.\n\t\t\tl.activeSources = append(l.activeSources, source)\n\t\t\tpendingContainers := make(map[string]*Container)\n\t\t\tfor _, container := range l.pendingContainers {\n\t\t\t\tif container.IsMatch(source) {\n\t\t\t\t\t// found a container matching the new source, start a new tailer\n\t\t\t\t\tl.startTailer(container, source)\n\t\t\t\t} else {\n\t\t\t\t\t// keep the container in cache until\n\t\t\t\t\tpendingContainers[container.service.Identifier] = container\n\t\t\t\t}\n\t\t\t}\n\t\t\t// keep the containers that have not found any source yet for next iterations\n\t\t\tl.pendingContainers = pendingContainers\n\t\tcase source := <-removedSources:\n\t\t\tfor i, src := range l.activeSources {\n\t\t\t\tif src == source {\n\t\t\t\t\t// no need to stop any tailer here, it will be stopped after receiving a\n\t\t\t\t\t// \"remove service\" event.\n\t\t\t\t\tl.activeSources = append(l.activeSources[:i], l.activeSources[i+1:]...)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\tcase service := <-removedServices:\n\t\t\t// detected that a container has been stopped.\n\t\t\tcontainerID := service.Identifier\n\t\t\tl.stopTailer(containerID)\n\t\t\tdelete(l.pendingContainers, containerID)\n\t\tcase containerID := <-l.erroredContainerID:\n\t\t\tgo l.restartTailer(containerID)\n\t\tcase <-l.ctx.Done():\n\t\t\t// no docker container should be tailed anymore\n\t\t\tlog.Info(\"Stopping Docker launcher\")\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ebae6d1a50e966f438015599e29091a3", "score": "0.53993016", "text": "func (tnt *TnTServer) FST_set_watch(dirname string, watcher *inotify.Watcher) {\n \n new_dirname := strings.TrimSuffix(dirname, \"/\")\n\n err := watcher.Watch(new_dirname)\n if err != nil {\n log.Fatal(err)\n }\n //fmt.Println(dirname)\n for name, fi := range tnt.Tree.MyTree {\n if(fi.IsDir == true && name != \"./\"){\n new_name := strings.TrimPrefix(strings.TrimSuffix(name, \"/\"), \"./\")\n\n //fmt.Println(\"in fst_set_watch\",dirname, name, tnt.root+new_name)\n err := watcher.Watch(tnt.root+new_name)\n if err != nil {\n log.Fatal(err)\n }\n }\n }\n}", "title": "" }, { "docid": "f05f3aec03cdc83c5a19779b56403ef8", "score": "0.53903675", "text": "func (man *Manager) startWorker(w *Worker) error {\n\t// man.runCmd([]string{\"command1\", \"command2\", \"command3\"})\n\treturn nil\n}", "title": "" }, { "docid": "4fa33b7b6dabf3dce83231e1857190f1", "score": "0.53746533", "text": "func watchAll(watcher *fsnotify.Watcher, path string) error {\n\treturn filepath.Walk(path, func(path string, info os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Apply filters.\n\t\t// TODO: Make this configurable.\n\t\tif info.IsDir() {\n\t\t\tif filepath.Base(path) == \"node_modules\" {\n\t\t\t\treturn filepath.SkipDir\n\t\t\t}\n\t\t\tif filepath.Base(path) == \".git\" {\n\t\t\t\treturn filepath.SkipDir\n\t\t\t}\n\t\t\tif err := watcher.Add(path); err != nil {\n\t\t\t\treturn fmt.Errorf(\"watcher: %w\", err)\n\t\t\t}\n\t\t\tfmt.Println(\"Watching:\", path)\n\t\t}\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "7a957b18ccb90f53d8f79c9a01794ccf", "score": "0.5363403", "text": "func (c *configuration) run() {\n\texpireTime = float64(c.Day) * 24 // number of days before the current day\n\ttoday = time.Now() // Store the current exec time stamp\n\n\t// To make sure all trash dir exists (\"images\", \"documents\", \"zip\", \"dir\", \"miscellaneous\")\n\tfor i := 0; i < len(dir); i++ {\n\t\terr := os.MkdirAll(c.AutoTrashDir+\"/\"+dir[i], 0755)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Failed @ dir creation\", err.Error())\n\t\t}\n\t\tfmt.Println(\"Created Dir:\", dir[i])\n\t}\n\n\t// loops through download directory\n\tfileINfo, readErr := ioutil.ReadDir(c.DownloadDir)\n\tif readErr != nil {\n\t\tpanic(fmt.Sprintf(\"Unable to read dir: %s, %s\", c.DownloadDir, readErr.Error()))\n\t}\n\n\t// validates each file's modification time against current exec time\n\tfor _, entry := range fileINfo {\n\t\tif !entry.IsDir() {\n\t\t\tfileName := entry.Name()\n\t\t\t// documents\n\t\t\tfor _, idoc := range doc {\n\t\t\t\tif strings.Contains(fileName, idoc) {\n\t\t\t\t\tif timeMachine(entry.ModTime()) {\n\t\t\t\t\t\tc.moveTo(fileName, \"documents\")\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\t// images\n\t\t\tfor _, image := range img {\n\t\t\t\tif strings.Contains(fileName, image) {\n\t\t\t\t\tif timeMachine(entry.ModTime()) {\n\t\t\t\t\t\tc.moveTo(fileName, \"images\")\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\t// zip\n\t\t\tfor _, izip := range zip {\n\t\t\t\tif strings.Contains(fileName, izip) {\n\t\t\t\t\tif timeMachine(entry.ModTime()) {\n\t\t\t\t\t\tc.moveTo(fileName, \"zip\")\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\t// miscellaneous\n\t\t\tif timeMachine(entry.ModTime()) {\n\t\t\t\tc.moveTo(fileName, \"miscellaneous\")\n\t\t\t}\n\t\t}\n\t}\n\tfmt.Println(\" - * End * -\")\n}", "title": "" }, { "docid": "256c55e2708658eb1b39d5b247e697f7", "score": "0.5358121", "text": "func (w *Watcher) Run(kubeClient *kube.Client) {\n\tlogFields := log.Fields{\n\t\t\"watcher\": w.Name,\n\t}\n\tlog.WithFields(logFields).Infof(\"Start watcher %s\", w.Name)\n\n\tp, err := parser.New(w.Name, w.Parser)\n\tif err != nil {\n\t\tlog.WithFields(logFields).WithError(err).Errorf(\"Could not create parser\")\n\t\treturn\n\t}\n\n\taddChan := make(chan string)\n\tgo kubeClient.WatchPods(w.Namespace, w.Selector, addChan, logFields)\n\n\tfor {\n\t\tselect {\n\t\tcase podName := <-addChan:\n\t\t\tlog.WithFields(logFields).Infof(\"Start watching %s\", podName)\n\t\t\tgo kubeClient.ProcessLogs(w.Namespace, podName, p, logFields)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "cf2a9b9f93fe6ee06b9192f5e249022b", "score": "0.5355373", "text": "func startProjectLoader() {\n\tdir, err := os.Open(filepath.Join(projectDir, enabledProjectDir))\n\tdefer func() {\n\t\tif cerr := dir.Close(); cerr != nil && err == nil {\n\t\t\terr = cerr\n\t\t}\n\t}()\n\n\tif err != nil {\n\t\tlog.Printf(\"Error in startProjectLoader opening the filepath %s: %s\\n\", projectDir, err)\n\t\treturn\n\t}\n\n\tfiles, err := dir.Readdir(0)\n\tif err != nil {\n\t\tlog.Printf(\"Error in startProjectLoader reading the dir %s: %s\\n\", projectDir, err)\n\t\treturn\n\t}\n\n\tnames := make([]string, len(files))\n\n\tfor i := range files {\n\t\tif !files[i].IsDir() && filepath.Ext(files[i].Name()) == \".json\" {\n\t\t\tnames[i] = files[i].Name()\n\t\t\tif _, ok := projects.get(projectID(files[i].Name())); !ok {\n\t\t\t\tprojects.add(files[i].Name())\n\t\t\t}\n\t\t}\n\t}\n\n\t//check for removed projects\n\tprojects.removeMissing(names)\n\n\ttime.AfterFunc(projectFilePoll, startProjectLoader)\n}", "title": "" }, { "docid": "7d7f45d4b22d6a44f25ffe7a7fa991b2", "score": "0.5335842", "text": "func (a *Adminz) Build() *Adminz {\n\t// start killfile checking loop\n\tif len(a.killfilePaths) > 0 {\n\t\tgo a.killfileLoop()\n\t} else {\n\t\tlog.Print(\"Not checking killfiles.\")\n\t}\n\n\thttp.HandleFunc(\"/healthz\", a.healthzHandler)\n\thttp.HandleFunc(\"/servicez\", a.servicezHandler)\n\n\tlog.Print(\"adminz registered\")\n\tlog.Print(\"Watching paths for killfile: \", a.killfilePaths)\n\treturn a\n}", "title": "" }, { "docid": "3f75cd0eebf4558834de26d7593abf3f", "score": "0.53183407", "text": "func (r *Registry) setupWatch() {\n\tc := r.client\n\tkey := r.servicesKey()\n\tr.L2(\"creating watch on %s\", key)\n\tr.watcher = c.Watch(context.Background(), key, etcd.WithPrefix())\n\tgo handleChanges(r)\n}", "title": "" }, { "docid": "f35dc400b3c86db970436545f7610613", "score": "0.53060985", "text": "func watch(name string,module string) {\n\twatcher, err := fsnotify.NewWatcher()\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\tfilelist, err := ioutil.ReadDir(name)\n\tif err != nil {\n\t\tfmt.Println(\"LIST FAIL\")\n\t\treturn\n\t}\n\tfor _, f := range filelist {\n\t\tn := f.Name()\n\t\tif strings.HasSuffix(n, \".py\") {\n\t\t\t//fmt.Println(n)\n\t\t\twatcher.Add(name + n)\n\t\t\t// TODO add to the model store\n\t\t}\n\t}\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase event := <-watcher.Events:\n\t\t\t\tfmt.Println(\"event\", event)\n\t\t\t\tif (event.Op&fsnotify.Remove == fsnotify.Remove) || (event.Op&fsnotify.Write == fsnotify.Write) {\n\t\t\t\t\tfmt.Println(\"removed file add again: \", event.Name)\n\t\t\t\t\twatcher.Add(event.Name)\n parts := strings.Split(event.Name,\"/\")\n name := strings.TrimSuffix(parts[len(parts)-1:len(parts)][0],\".py\")\n fmt.Println(name)\n\t\t\t\t\tfiles <- module+\".\"+name\n\t\t\t\t}\n\t\t\tcase err := <-watcher.Errors:\n\t\t\t\tfmt.Println(\"ERROR\", err)\n\t\t\t}\n\t\t\tfmt.Println(\"next\")\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "91050dc358dc5aa4a9ed4fd51805b14a", "score": "0.5297107", "text": "func (ws *watcherSyncer) run(ctx context.Context) {\n\tlog.Debug(\"Sending initial status event and starting watchers\")\n\tws.sendStatusUpdate(api.WaitForDatastore)\n\tfor _, wc := range ws.watcherCaches {\n\t\t// no need for ws.wgwc.Add(1), been set already\n\t\tgo func(wc *watcherCache) {\n\t\t\tdefer ws.wgwc.Done()\n\t\t\twc.run(ctx)\n\t\t\tlog.Debug(\"Watcher cache run completed\")\n\t\t}(wc)\n\t}\n\n\tlog.Info(\"Starting main event processing loop\")\n\tvar updates []api.Update\n\tfor result := range ws.results {\n\t\t// Process the data - this will append the data in subsequent calls, and action\n\t\t// it if we hit a non-update event.\n\t\tupdates := ws.processResult(updates, result)\n\n\t\t// Append results into the one update until we either flush the channel or we\n\t\t// hit our fixed limit per update.\n\tconsolidatationloop:\n\t\tfor ii := 0; ii < maxUpdatesToConsolidate; ii++ {\n\t\t\tselect {\n\t\t\tcase next := <-ws.results:\n\t\t\t\tupdates = ws.processResult(updates, next)\n\t\t\tdefault:\n\t\t\t\tbreak consolidatationloop\n\t\t\t}\n\t\t}\n\n\t\t// Perform final processing (pass in a nil result) before we loop and hit the blocking\n\t\t// call again.\n\t\tupdates = ws.sendUpdates(updates)\n\t}\n}", "title": "" }, { "docid": "0625c29ecc33e38ab2faca6d3b869abf", "score": "0.5296043", "text": "func (r *XactCopy) Run() error {\n\t// init\n\tavailablePaths, _ := fs.Mountpaths.Get()\n\tr.init(len(availablePaths))\n\n\t// start mpath joggers\n\tfor mpath, mpathInfo := range availablePaths {\n\t\tvar (\n\t\t\tmpathLC string\n\t\t\tjogger = &jogger{parent: r, mpathInfo: mpathInfo}\n\t\t)\n\t\tif r.Bislocal {\n\t\t\tmpathLC = fs.Mountpaths.MakePathLocal(mpath, fs.ObjectType)\n\t\t} else {\n\t\t\tmpathLC = fs.Mountpaths.MakePathCloud(mpath, fs.ObjectType)\n\t\t}\n\t\tr.joggers[mpathLC] = jogger\n\t\tgo jogger.jog()\n\t}\n\n\t// control loop\n\tfor {\n\t\tselect {\n\t\tcase lom := <-r.workCh:\n\t\t\tif jogger := r.loadBalance(lom); jogger != nil {\n\t\t\t\tjogger.workCh <- lom\n\t\t\t}\n\t\tcase <-r.ChanCheckTimeout():\n\t\t\tif r.Timeout() {\n\t\t\t\tr.stop()\n\t\t\t\treturn nil\n\t\t\t}\n\t\tcase <-r.ChanAbort():\n\t\t\tr.stop()\n\t\t\treturn fmt.Errorf(\"%s aborted, exiting\", r)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "469ec633a2f40b7d188e71f23f9fc88e", "score": "0.52947134", "text": "func (s *server) startController(controllers []controller.Controller) error {\n\t// start the informers\n\ts.sharedInformerFactory.Start(s.ctx.Done())\n\ts.veleroSharedInformerFactory.Start(s.ctx.Done())\n\n\ts.logger.Infof(\"Waiting for caches to sync\")\n\tfor informer, ok := range s.sharedInformerFactory.WaitForCacheSync(s.ctx.Done()) {\n\t\tif !ok {\n\t\t\treturn errors.Errorf(\"timed out waiting for caches to sync for informer=%v\", informer)\n\t\t}\n\t\ts.logger.WithField(\"informer\", informer).Infof(\"cache synced\")\n\t}\n\n\t// sync velero cache\n\tfor informer, ok := range s.veleroSharedInformerFactory.WaitForCacheSync(s.ctx.Done()) {\n\t\tif !ok {\n\t\t\treturn errors.Errorf(\"timed out waiting for caches to sync for informer=%v\", informer)\n\t\t}\n\t\ts.logger.WithField(\"informer\", informer).Infof(\"cache synced\")\n\t}\n\n\ts.logger.Infof(\"All informers cache synced\")\n\n\t// start all controllers\n\n\ts.logger.Info(\"starting all controllers\")\n\n\tvar wg sync.WaitGroup\n\tfor k := range controllers {\n\t\tc := controllers[k]\n\t\twg.Add(1)\n\n\t\tgo func() {\n\t\t\t_ = c.Run(s.ctx)\n\t\t\twg.Done()\n\t\t}()\n\t}\n\n\ts.logger.Infof(\"All controllers started\")\n\n\t<-s.ctx.Done()\n\n\ts.logger.Infof(\"Waiting for all controllers to stop gracefully\")\n\n\twg.Wait()\n\treturn nil\n}", "title": "" }, { "docid": "3109154fc5eec09bfcc2ade19556b863", "score": "0.5286371", "text": "func main() {\n\tflag.BoolVar(&config.Debug, \"d\", false, \"Debugging\")\n\tflag.BoolVar(&config.UseExistingInit, \"useinit\", false, \"If there is an existing init, don't replace it\")\n\tflag.BoolVar(&config.RemoveDir, \"removedir\", true, \"remove the directory when done -- cleared if test fails\")\n\tflag.StringVar(&config.InitialCpio, \"cpio\", \"\", \"An initial cpio image to build on\")\n\tflag.StringVar(&config.TempDir, \"tmpdir\", \"\", \"tmpdir to use instead of ioutil.TempDir\")\n\tflag.Parse()\n\tif config.Debug {\n\t\tdebug = log.Printf\n\t}\n\n\tvar err error\n\tdirs = make(map[string]bool)\n\tdeps = make(map[string]bool)\n\tgorootFiles = make(map[string]bool)\n\turootFiles = make(map[string]bool)\n\tguessgoarch()\n\tconfig.Go = \"\"\n\tconfig.Goos = \"linux\"\n\tguessgoroot()\n\tguessgopath()\n\tif config.Fail {\n\t\tlog.Fatal(\"Setup failed\")\n\t}\n\n\tpat := globlist(flag.Args()...)\n\n\tdebug(\"Initial glob is %v\", pat)\n\tfor _, v := range pat {\n\t\tg, err := filepath.Glob(v)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Glob error: %v\", err)\n\t\t}\n\t\t// We have a set of absolute paths in g. We can not\n\t\t// use absolute paths in go list, however, so we have\n\t\t// to adjust them.\n\t\tfor i := range g {\n\t\t\tr, err := filepath.Rel(filepath.Join(config.Gopath, \"src\"), g[i])\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatalf(\"Can't get rel path for %v: %v\", g, err)\n\t\t\t}\n\t\t\tg[i] = r\n\t\t}\n\t\tpkgList = append(pkgList, g...)\n\t}\n\n\tdebug(\"Initial pkgList is %v\", pkgList)\n\n\tif err := addGoFiles(); err != nil {\n\t\tlog.Fatalf(\"%v\", err)\n\t}\n\n\tif config.TempDir == \"\" {\n\t\tconfig.TempDir, err = ioutil.TempDir(\"\", \"u-root\")\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"%v\", err)\n\t\t}\n\t}\n\n\tdefer func() {\n\t\tif config.RemoveDir {\n\t\t\tlog.Printf(\"Removing %v\\n\", config.TempDir)\n\t\t\t// Wow, this one is *scary*\n\t\t\tcmd := exec.Command(\"sudo\", \"rm\", \"-rf\", config.TempDir)\n\t\t\tcmd.Stderr, cmd.Stdout = os.Stderr, os.Stdout\n\t\t\terr = cmd.Run()\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatalf(\"%v\", err)\n\t\t\t}\n\t\t}\n\t}()\n\n\tbuildToolChain()\n\n\tif config.InitialCpio != \"\" {\n\t\tf, err := ioutil.ReadFile(config.InitialCpio)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"%v\", err)\n\t\t}\n\n\t\tcmd := exec.Command(\"sudo\", \"cpio\", \"-i\", \"-v\")\n\t\tcmd.Dir = config.TempDir\n\t\t// Note: if you print Cmd out with %v after assigning cmd.Stdin, it will print\n\t\t// the whole cpio; so don't do that.\n\t\tif config.Debug {\n\t\t\tcmd.Stdout = os.Stdout\n\t\t}\n\t\tdebug(\"Run %v @ %v\", cmd, cmd.Dir)\n\n\t\t// There's a bit of a tough problem here. There's lots of stuff owned by root in\n\t\t// these directories. They probably have to stay that way. But how do we create init\n\t\t// and do other things? For now, we're going to set the modes of select places to\n\t\t// 666 and remove a few things we know need to be removed.\n\t\t// It's hard to say what else to do.\n\t\tcmd.Stdin = bytes.NewBuffer(f)\n\t\tcmd.Stderr = os.Stderr\n\t\terr = cmd.Run()\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Unpacking %v: %v\", config.InitialCpio, err)\n\t\t}\n\t}\n\n\tif !config.UseExistingInit {\n\t\tinit := filepath.Join(config.TempDir, \"init\")\n\t\t// Must move config.TempDir/init to inito if one is not there.\n\t\tinito := filepath.Join(config.TempDir, \"inito\")\n\t\tif _, err := os.Stat(inito); err != nil {\n\t\t\t// WTF? did Ron forget about rename? Yuck!\n\t\t\tif err := syscall.Rename(init, inito); err != nil {\n\t\t\t\tlog.Printf(\"%v\", err)\n\t\t\t}\n\t\t} else {\n\t\t\tlog.Printf(\"Not replacing %v because there is already one there.\", inito)\n\t\t}\n\n\t\t// Build init\n\t\tif standardgotool {\n\t\t\tcmd := exec.Command(\"go\", \"build\", \"-x\", \"-a\", \"-installsuffix\", \"cgo\", \"-ldflags\", \"'-s'\", \"-o\", init, \".\")\n\t\t\tcmd.Stderr = os.Stderr\n\t\t\tcmd.Stdout = os.Stdout\n\t\t\tcmd.Dir = filepath.Join(config.Gopath, \"src/github.com/u-root/u-root/cmds/init\")\n\n\t\t\terr = cmd.Run()\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatalf(\"%v\\n\", err)\n\t\t\t}\n\t\t} else {\n\t\t\tgobingo := filepath.Join(config.TempDir, \"go/bin/go\")\n\t\t\tif err := os.Link(gobingo, init); err != nil {\n\t\t\t\tlog.Fatalf(\"hard link of %v go %v failed: %v\", gobingo, init, err)\n\t\t\t}\n\t\t}\n\t}\n\n\tif err := cpiop(config.Goroot, \"go\", goList); err != nil {\n\t\tlog.Printf(\"Things went south. TempDir is %v\", config.TempDir)\n\t\tlog.Fatalf(\"Bailing out near line 666\")\n\t}\n\n\tif err := cpiop(config.Gopath, \"\", urootList); err != nil {\n\t\tlog.Printf(\"Things went south. TempDir is %v\", config.TempDir)\n\t\tlog.Fatalf(\"Bailing out near line 666\")\n\t}\n\tdebug(\"Done all cpio operations\")\n\n\tr, w, err := os.Pipe()\n\tif err != nil {\n\t\tlog.Fatalf(\"%v\\n\", err)\n\t}\n\n\tdebug(\"Creating initramf file\")\n\n\toname := fmt.Sprintf(\"/tmp/initramfs.%v_%v.cpio\", config.Goos, config.Arch)\n\n\tf, err := os.Create(oname)\n\tif err != nil {\n\t\tlog.Fatalf(\"%v\\n\", err)\n\t}\n\n\tif _, err := f.Write(devCPIO[:]); err != nil {\n\t\tlog.Fatalf(\"%v\\n\", err)\n\t}\n\n\tcmd := exec.Command(\"cpio\", \"-H\", \"newc\", \"-o\")\n\tcmd.Dir = config.TempDir\n\tcmd.Stdin = r\n\tcmd.Stderr = os.Stderr\n\tcmd.Stdout = f\n\tdebug(\"Run %v @ %v\", cmd, cmd.Dir)\n\terr = cmd.Start()\n\tif err != nil {\n\t\tlog.Fatalf(\"%v\\n\", err)\n\t}\n\tif err := lsr(config.TempDir, w); err != nil {\n\t\tlog.Fatalf(\"%v\\n\", err)\n\t}\n\tw.Close()\n\tdebug(\"Finished sending file list for initramfs cpio\")\n\terr = cmd.Wait()\n\tif err != nil {\n\t\tlog.Printf(\"%v\\n\", err)\n\t}\n\tdebug(\"cpio for initramfs is done\")\n\t// We do this defer in the event that some error messages\n\t// pop out during other processing. We want this message to come\n\t// last.\n\tdefer func() {\n\t\tlog.Printf(\"Output file is in %v\\n\", oname)\n\t}()\n}", "title": "" }, { "docid": "37aa7d477b8f58bd01c8a5b8bbaf47ac", "score": "0.5283362", "text": "func (o *Commander) start() (error) {\n\terr := o.initializeHue()\n\tif err != nil {\n\t\tlog.WithField(\"err\", err).Error(\"Unable to initialize hue, functionality will be disabled\")\n\t}\n\n\to.initializeLightShows()\n\n\to.tempLoggers = [2]RunnableIFC{\n\t\tnewInfluxDBLoggerRunnable(),\n\t\tnewDynamoDBLoggerRunnable(),\n\t}\n\tif o.Options.TemperatureLoggerEnabled {\n\t\to.EnableTemperatureLogging()\n\t}\n\n\tshow, err := o.getLightShow(o.Options.LightShow)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tp := lights.UpdateGrillLightsParams{\n\t\tName: o.Options.LightShow,\n\t\t// The period is in milliseconds so we need to divide\n\t\t// the time.Duration by 1000 because it is in nanoseconds\n\t\tPeriod: int64(show.tickable.getPeriod() / 1000),\n\t}\n\n\t_, err = o.UpdateGrillLights(&p)\n\n\tlog.Info(\"Commander up and running\")\n\n\treturn err\n}", "title": "" }, { "docid": "be42e7669963c78f16d8930884bd8b43", "score": "0.52770114", "text": "func watchFile(galleries map[string]*Gallery) {\n\tvar err error\n\twatcher, err = fsnotify.NewWatcher()\n\tcheck(err)\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\tgo filterFile(event)\n\t\t\tcase err = <-watcher.Errors:\n\t\t\t\tlog.Println(\"error:\", err)\n\t\t\t}\n\t\t}\n\t}()\n\n\terr = watcher.Add(galleryPath + \"config.yaml\")\n\tcheck(err)\n\n\tfor gallery := range galleries {\n\t\terr = watcher.Add(galleryPath + gallery + \"/\" + origImgDir)\n\t\tcheck(err)\n\t\terr = watcher.Add(galleryPath + gallery + \"/\" + featImgDir)\n\t\tcheck(err)\n\t}\n\t<-done\n}", "title": "" }, { "docid": "093ca14ebf08d55ff0bbfa4e157d714f", "score": "0.5270921", "text": "func watch(ctx context.Context, root string) (<-chan string, error) {\n\tif root == \"\" {\n\t\troot = \".\"\n\t}\n\n\twatcher, err := fsnotify.NewWatcher()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"watcher: %w\", err)\n\t}\n\n\tch := make(chan string, 1)\n\tgo func() {\n\t\tdefer watcher.Close()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase event := <-watcher.Events:\n\t\t\t\tswitch {\n\t\t\t\tcase event.Op&fsnotify.Create == fsnotify.Create:\n\t\t\t\t\tif err := watchAll(watcher, event.Name); err != nil {\n\t\t\t\t\t\tlog.Print(err)\n\t\t\t\t\t}\n\t\t\t\tcase event.Op&fsnotify.Remove == fsnotify.Remove:\n\t\t\t\tcase event.Op&fsnotify.Write == fsnotify.Write:\n\t\t\t\tcase event.Op&fsnotify.Rename == fsnotify.Rename:\n\t\t\t\tdefault:\n\t\t\t\t\t// Ignore other events.\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tif !strings.HasSuffix(event.Name, \".go\") {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tch <- event.Name\n\t\t\tcase err := <-watcher.Errors:\n\t\t\t\tlog.Print(err)\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\terr = watchAll(watcher, root)\n\treturn ch, err\n}", "title": "" }, { "docid": "4540b571004c0997e1e6a153abbc7df9", "score": "0.5267609", "text": "func (wc *watcher) watchLoop() {\n\t// When this loop exits, make sure we terminate the watcher resources.\n\tdefer wc.terminateWatcher()\n\n\t// If we are not watching a specific resource then this is a prefix watch.\n\tlogCxt := log.WithField(\"list\", wc.list)\n\tkey, opts := calculateListKeyAndOptions(logCxt, wc.list)\n\n\tlog.Debug(\"Starting watcher.watchLoop\")\n\tif wc.initialRev == 0 {\n\t\t// No initial revision supplied, so perform a list of current configuration\n\t\t// which will also get the current revision we will start our watch from.\n\t\tvar kvps *model.KVPairList\n\t\tvar err error\n\t\tif kvps, err = wc.listCurrent(); err != nil {\n\t\t\tlog.Errorf(\"failed to list current with latest state: %v\", err)\n\t\t\t// Error considered as terminating error, hence terminate watcher.\n\t\t\twc.sendError(err)\n\t\t\treturn\n\t\t}\n\n\t\t// If we're handling profiles, filter out the default-allow profile.\n\t\tif len(kvps.KVPairs) > 0 && (key == profilesKey || key == defaultAllowProfileKey) {\n\t\t\twc.removeDefaultAllowProfile(kvps)\n\t\t}\n\n\t\t// We are sending an initial sync of entries to the watcher to provide current\n\t\t// state. To the perspective of the watcher, these are added entries, so set the\n\t\t// event type to WatchAdded.\n\t\tlog.WithField(\"NumEntries\", len(kvps.KVPairs)).Debug(\"Sending create events for each existing entry\")\n\t\twc.sendAddedEvents(kvps)\n\t}\n\n\topts = append(opts, clientv3.WithRev(wc.initialRev+1), clientv3.WithPrevKV())\n\tlogCxt = logCxt.WithFields(log.Fields{\n\t\t\"etcdv3-etcdKey\": key,\n\t\t\"rev\": wc.initialRev,\n\t})\n\tlogCxt.Debug(\"Starting etcdv3 watch\")\n\twch := wc.client.etcdClient.Watch(wc.ctx, key, opts...)\n\tfor wres := range wch {\n\t\tif wres.Err() != nil {\n\t\t\t// A watch channel error is a terminating event, so exit the loop.\n\t\t\terr := wres.Err()\n\t\t\tlog.WithError(err).Warning(\"Watch channel error\")\n\t\t\twc.sendError(err)\n\t\t\treturn\n\t\t}\n\t\tfor _, e := range wres.Events {\n\t\t\t// Convert the etcdv3 event to the equivalent Watcher event. An error\n\t\t\t// parsing the event is returned as an error, but don't exit the watcher as\n\t\t\t// restarting the watcher is unlikely to fix the conversion error.\n\t\t\tif ae, err := convertWatchEvent(e, wc.list); ae != nil {\n\t\t\t\twc.sendEvent(ae)\n\t\t\t} else if err != nil {\n\t\t\t\twc.sendError(err)\n\t\t\t}\n\t\t}\n\t}\n\n\t// If we exit the loop, it means the watcher has closed for some reason.\n\tlog.Warn(\"etcdv3 watch channel closed\")\n}", "title": "" }, { "docid": "c67584259d10c23973fb2368bd4d2331", "score": "0.5266571", "text": "func (s *Service) StartWatchers() error {\n\n\tvar (\n\t\t// maps pool name -> contract address\n\t\taddresses = make(map[string]string)\n\t\t// maps pool name -> break percentage\n\t\tspotPriceBreakPercentages = make(map[string]float64)\n\t)\n\n\tfor _, pool := range s.pools {\n\t\taddresses[pool.Name] = pool.ContractAddress\n\t\tspotPriceBreakPercentages[pool.Name] = pool.SpotPriceBreakPercentage\n\t}\n\n\t// get the bindings\n\t// name -> contract\n\tbindings, err := s.ew.NewBindings(addresses)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\twatchers, err := s.ew.NewWatchedContracts(s.logger, s.ew.BC().EthClient(), bindings, s.minimumGwei, s.gasMultiplier)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar (\n\t\t// create a dedicated context for the contract watchers\n\t\t// this will allow us to easily cancel this context upon receiving an error\n\t\t// from one of the spawned watchers, allowing us to gracefully exit and restart\n\t\tctx, cancel = context.WithCancel(s.ctx)\n\t\t// this error channel will hold any errors returned from a single contract watcher\n\t\t// it will allow us to block until either a context is cancelled or an error is returned\n\t\t// we create a channel with a capacity equal to the number of watchers we will spawn\n\t\terrCh = make(chan error, len(watchers))\n\t)\n\n\ts.wg.Add(len(watchers))\n\n\tfor _, watcher := range watchers {\n\t\tgo func(wtchr *eventwatcher.WatchedContract, bkPercent float64) {\n\t\t\tdefer s.wg.Done()\n\t\t\tif err := wtchr.Listen(ctx, s.db, s.at, s.auther, bkPercent, s.ew.BC().EthClient()); err != nil {\n\t\t\t\terrCh <- err\n\t\t\t}\n\t\t}(watcher, spotPriceBreakPercentages[watcher.Name()])\n\t}\n\n\tselect {\n\tcase <-ctx.Done():\n\t\tcancel()\n\t\treturn nil\n\tcase err := <-errCh:\n\t\ts.logger.Error(\"encountered error from contract watcher, aborting...\", zap.Error(err))\n\t\tcancel()\n\t\treturn err\n\t}\n\n}", "title": "" }, { "docid": "8136e8748fcfc3c7ff92aacfb7302497", "score": "0.52623385", "text": "func Watcher() *cli.Command {\n\treturn &cli.Command{\n\t\tName: \"watcher\",\n\t\tUsage: \"start client file watcher\",\n\n\t\tBefore: func(c *cli.Context) error {\n\t\t\treturn nil\n\t\t},\n\n\t\tAction: func(c *cli.Context) error {\n\t\t\tcfg, err := config.New()\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatal().\n\t\t\t\t\tErr(err).\n\t\t\t\t\tMsg(\"config could not be loaded\")\n\t\t\t}\n\n\t\t\tlevel, err := zerolog.ParseLevel(cfg.Log.Level)\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatal().\n\t\t\t\t\tErr(err).\n\t\t\t\t\tMsg(\"parse log level failed\")\n\t\t\t}\n\t\t\tzerolog.SetGlobalLevel(level)\n\n\t\t\tlogFile, err := os.OpenFile(path.Join(cfg.General.Root, \"pagient.log\"), os.O_CREATE|os.O_APPEND|os.O_RDWR, 0666)\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatal().\n\t\t\t\t\tErr(err).\n\t\t\t\t\tMsg(\"logfile could not be opened\")\n\t\t\t}\n\n\t\t\tif cfg.Log.Pretty {\n\t\t\t\tlog.Logger = log.Output(\n\t\t\t\t\tzerolog.ConsoleWriter{\n\t\t\t\t\t\tOut: logFile,\n\t\t\t\t\t\tNoColor: !cfg.Log.Colored,\n\t\t\t\t\t},\n\t\t\t\t)\n\t\t\t} else {\n\t\t\t\tlog.Logger = log.Output(logFile)\n\t\t\t}\n\n\t\t\tvar gr run.Group\n\n\t\t\t{\n\t\t\t\tvar stop chan os.Signal\n\n\t\t\t\tgr.Add(func() error {\n\t\t\t\t\tstop = make(chan os.Signal, 1)\n\n\t\t\t\t\tsignal.Notify(stop, os.Interrupt)\n\n\t\t\t\t\t<-stop\n\n\t\t\t\t\treturn nil\n\t\t\t\t}, func(err error) {\n\t\t\t\t\tsignal.Stop(stop)\n\t\t\t\t\tclose(stop)\n\t\t\t\t})\n\t\t\t}\n\n\t\t\t// error chan for fileWatcher\n\t\t\tvar errChan chan error\n\t\t\t{\n\t\t\t\tgr.Add(func() error {\n\t\t\t\t\terrChan = make(chan error, 1)\n\n\t\t\t\t\treturn <-errChan\n\t\t\t\t}, func(reason error) {\n\t\t\t\t\tclose(errChan)\n\t\t\t\t})\n\t\t\t}\n\n\t\t\t{\n\t\t\t\tvar stop chan struct{}\n\n\t\t\t\t// Note: we don't use path.Dir here because it does not handle case\n\t\t\t\t//\t\t which path starts with two \"/\" in Windows: \"//psf/Home/...\"\n\t\t\t\tfile := strings.Replace(cfg.General.WatchFile, \"\\\\\", \"/\", -1)\n\t\t\t\tfileWatcher := watcher.NewFileWatcher(file)\n\n\t\t\t\tgr.Add(func() error {\n\t\t\t\t\tstop = make(chan struct{}, 1)\n\n\t\t\t\t\t// initialize backend connection\n\t\t\t\t\tclient := pagient.NewClient(cfg.Backend.URL)\n\t\t\t\t\ttoken, err := client.AuthLogin(cfg.Backend.User, cfg.Backend.Password)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tif pagient.IsUnauthorizedErr(err) {\n\t\t\t\t\t\t\treturn errors.New(\"wrong API credentials\")\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn errors.Wrap(err, \"login at api server\")\n\t\t\t\t\t}\n\t\t\t\t\tclient = pagient.NewTokenClient(cfg.Backend.URL, token.Token)\n\n\t\t\t\t\tfileHandler := handler.NewFileHandler(cfg, client)\n\n\t\t\t\t\tif err := fileWatcher.Run(fileHandler.OnFileWrite, stop, errChan); err != nil {\n\t\t\t\t\t\treturn errors.Wrap(err, \"start file watcher\")\n\t\t\t\t\t}\n\n\t\t\t\t\treturn nil\n\t\t\t\t}, func(reason error) {\n\t\t\t\t\tclose(stop)\n\t\t\t\t})\n\t\t\t}\n\n\t\t\t// auto restart loop\n\t\t\tfor {\n\t\t\t\tif err := gr.Run(); err != nil {\n\t\t\t\t\tif !isRecoverableErr(err) {\n\t\t\t\t\t\tlog.Error().\n\t\t\t\t\t\t\tErr(err).\n\t\t\t\t\t\t\tMsg(\"a non-recoverable error occurred => initiate graceful shutdown\")\n\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\n\t\t\t\t\tsleepDuration := time.Duration(cfg.General.RestartDelay) * time.Second\n\t\t\t\t\tlog.Warn().\n\t\t\t\t\t\tErr(err).\n\t\t\t\t\t\tMsgf(\"attempting to restart application in %s\", sleepDuration)\n\n\t\t\t\t\tstop := make(chan os.Signal, 1)\n\t\t\t\t\tsignal.Notify(stop, os.Interrupt)\n\n\t\t\t\t\tselect {\n\t\t\t\t\tcase <-time.After(sleepDuration):\n\t\t\t\t\t\tcontinue\n\t\t\t\t\tcase <-stop:\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlog.Info().\n\t\t\t\tMsg(\"file watcher stopped gracefully\")\n\n\t\t\treturn nil\n\t\t},\n\t}\n}", "title": "" }, { "docid": "3dabc93650a8d11f2f0f103ba26ce34a", "score": "0.52537644", "text": "func (w *watcher) Start() error {\n\tw.Info(\"starting watcher...\")\n\tif nodeName == \"\" {\n\t\treturn agentError(\"node name not set, NODE_NAME env variable should be set to match the name of this k8s Node\")\n\t}\n\n\tgo func() {\n\t\tw.watch()\n\t}()\n\treturn nil\n}", "title": "" }, { "docid": "1e97b725a528241f7042b104b2cbfbb0", "score": "0.52435803", "text": "func (w Workers) Start() {\n\tfor i := 0; i < w.count; i++ {\n\n\t}\n}", "title": "" }, { "docid": "417c74ab05dab1f11960808fa6e01670", "score": "0.5242712", "text": "func WatchCommand(args Args, done chan bool) {\n\tif isSingleEnvironment(args) {\n\t\targs.ThemeClients = []themekit.ThemeClient{args.ThemeClient}\n\t}\n\n\teventLog := args.EventLog\n\n\tfor _, client := range args.ThemeClients {\n\t\tconfig := client.GetConfiguration()\n\t\tconcurrency := config.Concurrency\n\t\tlogEvent(message(fmt.Sprintf(\"Spawning %d workers for %s\", concurrency, config.Domain)), eventLog)\n\n\t\targs.ThemeClient = client\n\t\twatchForChangesAndIssueWork(args, eventLog)\n\t}\n}", "title": "" }, { "docid": "c44eb0b09ba327ae33f8714654cb35bf", "score": "0.52407384", "text": "func (e *eventListener) open() {\n\t// Start a change watcher over changed config files.\n\tif e.configFilesChangedObserver == nil {\n\t\te.configFilesChangedObserver = new(observer.Observer)\n\t\te.configFilesChangedObserver.Open()\n\n\t\t// Buffer file change events, 1e6 ns == 1 ms\n\t\te.configFilesChangedObserver.SetBufferDuration(1 * time.Millisecond)\n\t}\n\n\t// Start a change watcher over loaded config files.\n\tif e.configFilesLoadedObserver == nil {\n\t\te.configFilesLoadedObserver = new(observer.Observer)\n\t\te.configFilesLoadedObserver.Open()\n\t}\n}", "title": "" }, { "docid": "77b8b86dd5c5fc3ed3167a06ab44a8f2", "score": "0.52383804", "text": "func (k JsSDK) Watch() error {\n\tmg.Deps(JsSDK.Deps, JsSDK.Definitions)\n\tif mg.Verbose() {\n\t\tfmt.Println(\"Building and watching JS SDK files\")\n\t}\n\treturn k.runYarnCommandV(\"build:watch\")\n}", "title": "" }, { "docid": "9ea6b4c7fc9842ef7b84f26c87e4dfe1", "score": "0.52194494", "text": "func (a *App) build() error {\n\treturn a.appPlugin.build(a.checkoutFolder)\n}", "title": "" }, { "docid": "b139d2de14a860c4cf78af6a7b205d6e", "score": "0.52155393", "text": "func (tnt *TnTServer) FST_watch_files(dirname string){\n //First initialize the watch\n\n watcher, err := inotify.NewWatcher()\n if err != nil {\n log.Fatal(err)\n }\n\n //Set watch on /tmp folder for transfers\n tnt.FST_set_watch(\"../roots/tmp\"+strconv.Itoa(tnt.me)+\"/\", watcher)\n tnt.FST_set_watch(dirname, watcher)\n\n fst := tnt.Tree.MyTree\n\n //fmt.Println(\"in FST_watch_files\", dirname)\n //fmt.Println(fst[dirname])\n var cur_file string\n var seq_count int = 0 //This is for creation and mods from text editors\n var mod_count int = 0 //This is for tracking modifications\n var move_count int = 0\n var old_path string\n var old_path_key string\n for {\n select {\n case ev := <-watcher.Event:\n \n //This if statement causes us to avoid taking into account swap files used to keep \n //track of file modifications\n if(!strings.Contains(ev.Name, \".swp\") && !strings.Contains(ev.Name, \".swx\") && !strings.Contains(ev.Name, \"~\") && !strings.Contains(ev.Name, \".goutputstream\") && !strings.Contains(ev.Name,\"roots/tmp\")){ \n fmt.Println(\"ev: \", ev)\n //fmt.Println(\"ev.Name: \", ev.Name)\n fi, _ := os.Lstat(ev.Name)\n key_path := \"./\"+strings.TrimPrefix(ev.Name,tnt.root)\n\n tnt.Tree.LogicalTime++\n\n tnt.UpdateTree(key_path)\n //fmt.Println(\"./\"+key_path)\n //trim_name := strings.TrimPrefix(ev.Name, tnt.root)\n \n // 1) Create a file/folder - add it to tree\n //Folder only command is IN_CREATE with name as path\n /*\n if(ev.Mask == IN_CREATE_ISDIR && fst[key_path] == nil && !strings.Contains(ev.Name,\"roots/tmp\")){\n fmt.Println(\"new folder\", ev.Name)\n err := watcher.Watch(ev.Name)\n if err != nil {\n log.Fatal(err)\n }\n\n tnt.Tree.LogicalTime++\n\n tnt.UpdateTree(key_path)\n /*\n fst[key_path] = new(FSnode)\n fst[key_path].Name = fi.Name()\n fst[key_path].Size = fi.Size()\n fst[key_path].IsDir = fi.IsDir()\n fst[key_path].LastModTime = fi.ModTime()\n fst[key_path].Creator = tnt.me\n fst[key_path].CreationTime = tnt.Tree.LogicalTime\n fst[key_path].Children = make(map[string]bool)\n\n fst[key_path].VerVect = make(map[int]int64)\n fst[key_path].SyncVect = make(map[int]int64)\n for i:=0; i<len(tnt.servers); i++ {\n fst[key_path].VerVect[i] = 0\n fst[key_path].SyncVect[i] = 0\n }\n fst[key_path].VerVect[tnt.me] = tnt.Tree.LogicalTime\n fst[key_path].SyncVect[tnt.me] = tnt.Tree.LogicalTime\n fst[key_path].Parent = parent(ev.Name)\n \n\n //fmt.Println(\"parent is \", fst[ev.Name].Parent)\n \n }\n\n //This is the sequence of commands when a file is created or modified in a text editor\n //fmt.Println(seq_count)\n if(ev.Mask == IN_CREATE && seq_count == 0 && !strings.Contains(ev.Name,\"/tmp\")){\n cur_file = ev.Name\n seq_count = 1\n }else if(ev.Mask == IN_OPEN && seq_count == 1){\n\n seq_count = 2\n } else if(ev.Mask == IN_MODIFY && seq_count == 2){\n\n seq_count = 3\n }else if(ev.Mask == IN_CLOSE && cur_file == ev.Name && seq_count == 3){\n seq_count = 0\n if(fst[key_path] == nil){\n fmt.Println(\"new file was created\", ev.Name)\n tnt.Tree.LogicalTime++\n fst[key_path] = new(FSnode)\n fst[key_path].Name = fi.Name()\n fst[key_path].Size = fi.Size()\n fst[key_path].IsDir = fi.IsDir()\n fst[key_path].LastModTime = fi.ModTime()\n fst[key_path].Creator = tnt.me\n fst[key_path].CreationTime = tnt.Tree.LogicalTime\n\n fst[key_path].VerVect = make(map[int]int64)\n fst[key_path].SyncVect = make(map[int]int64)\n for i:=0; i<len(tnt.servers); i++ {\n fst[key_path].VerVect[i] = 0\n fst[key_path].SyncVect[i] = 0\n }\n fst[key_path].VerVect[tnt.me] = tnt.Tree.LogicalTime\n fst[key_path].SyncVect[tnt.me] = tnt.Tree.LogicalTime\n fst[key_path].Parent = parent(ev.Name) \n\n }else{\n // 2) Modify a file - increment its modified vector by 1\n fmt.Println(\"file has been modified\", fst[key_path])\n tnt.Tree.LogicalTime++\n fst[key_path].LastModTime = fi.ModTime()\n fst[key_path].VerVect[tnt.me] = tnt.Tree.LogicalTime\n fst[key_path].SyncVect[tnt.me] = tnt.Tree.LogicalTime\n tnt.PropagateUp(fst[key_path].VerVect,fst[key_path].SyncVect,fst[key_path].Parent)\n\n }\n }else {\n seq_count = 0\n }\n\n //This is the events that occur when files modified from the command line\n if(ev.Mask == IN_MODIFY && mod_count == 0 && !strings.Contains(ev.Name,\"/tmp\")){\n cur_file = ev.Name\n mod_count = 1\n }else if(ev.Mask == IN_OPEN && mod_count == 1){\n\n mod_count = 2\n } else if(ev.Mask == IN_MODIFY && mod_count == 2){\n\n mod_count = 3\n }else if(ev.Mask == IN_CLOSE && cur_file == ev.Name && mod_count == 3){\n mod_count = 0\n\n // 2) Modify a file - increment its modified vector by 1\n //fmt.Println(\"file has been modified\", fst[key_path])\n tnt.Tree.LogicalTime++\n fst[key_path].LastModTime = fi.ModTime()\n fst[key_path].VerVect[tnt.me] = tnt.Tree.LogicalTime\n fst[key_path].SyncVect[tnt.me] = tnt.Tree.LogicalTime\n tnt.PropagateUp(fst[key_path].VerVect,fst[key_path].SyncVect,fst[key_path].Parent)\n fmt.Println(\"file has been modified\", fst[key_path])\n\n }else {\n mod_count = 0\n }\n\n\n // 3) Delete a file - indicate it has been removed, don't necessarily remove it from tree\n if(ev.Mask == IN_DELETE && fst[key_path] != nil){\n fmt.Println(\"file has been deleted\", fst[key_path])\n tnt.Tree.LogicalTime++\n\n fst[key_path].VerVect[tnt.me] = tnt.Tree.LogicalTime\n fst[key_path].SyncVect[tnt.me] = tnt.Tree.LogicalTime\n tnt.PropagateUp(fst[key_path].VerVect,fst[key_path].SyncVect,fst[key_path].Parent)\n\n tnt.DeleteTree(ev.Name)\n }\n // 6) Delete a directory, need to parse and remove children as well\n if(ev.Mask == IN_DELETE_ISDIR && fst[key_path] != nil){\n fmt.Println(\"folder has been deleted\", fst[key_path])\n tnt.Tree.LogicalTime++\n\n fst[key_path].VerVect[tnt.me] = tnt.Tree.LogicalTime\n fst[key_path].SyncVect[tnt.me] = tnt.Tree.LogicalTime\n tnt.PropagateUp(fst[key_path].VerVect,fst[key_path].SyncVect,fst[key_path].Parent)\n\n tnt.DeleteTree(ev.Name)\n }\n\n // 5) Do nothing when transferring files from tmp/ to the rest of the directory\n //fmt.Println(ev, move_count)\n \n if(ev.Mask == IN_MOVE_FROM && move_count == 0){\n fmt.Println(\"This is a move\")\n old_path = ev.Name\n old_path_key = \"./\"+strings.TrimPrefix(ev.Name,tnt.root)\n\n move_count = 1\n }else if( ev.Mask == IN_MOVE_TO && move_count == 1){\n fmt.Println(\"file has been moved\", old_path)\n\n if(strings.Contains(old_path,\"/tmp\")){\n fmt.Println(\"Moved thru transfer, do nothing\")\n }else{\n fmt.Println(\"Actual Move, do something\")\n //Need to delete previous path and create new path\n tnt.Tree.LogicalTime++\n\n fst[old_path_key].VerVect[tnt.me] = tnt.Tree.LogicalTime\n fst[old_path_key].SyncVect[tnt.me] = tnt.Tree.LogicalTime\n tnt.PropagateUp(fst[old_path_key].VerVect,fst[old_path_key].SyncVect,fst[old_path_key].Parent)\n\n tnt.DeleteTree(old_path)\n\n fst[key_path] = new(FSnode)\n fst[key_path].Name = fi.Name()\n fst[key_path].Size = fi.Size()\n fst[key_path].IsDir = fi.IsDir()\n fst[key_path].LastModTime = fi.ModTime()\n fst[key_path].Creator = tnt.me\n fst[key_path].CreationTime = tnt.Tree.LogicalTime\n\n fst[key_path].VerVect = make(map[int]int64)\n fst[key_path].SyncVect = make(map[int]int64)\n for i:=0; i<len(tnt.servers); i++ {\n fst[key_path].VerVect[i] = 0\n fst[key_path].SyncVect[i] = 0\n }\n fst[key_path].VerVect[tnt.me] = tnt.Tree.LogicalTime\n fst[key_path].SyncVect[tnt.me] = tnt.Tree.LogicalTime\n fst[key_path].Parent = parent(ev.Name)\n }\n\n move_count = 0\n }else if(ev.Mask == IN_MOVE_TO && fst[key_path] != nil && move_count == 0){\n //This is when a file has been modified\n fmt.Println(\"file has been modified\")\n tnt.Tree.LogicalTime++\n fst[key_path].LastModTime = fi.ModTime()\n fst[key_path].VerVect[tnt.me] = tnt.Tree.LogicalTime\n fst[key_path].SyncVect[tnt.me] = tnt.Tree.LogicalTime\n tnt.PropagateUp(fst[key_path].VerVect,fst[key_path].SyncVect,fst[key_path].Parent)\n\n }else if(ev.Mask == IN_MOVE_TO && fst[key_path] == nil && move_count == 0) {\n fmt.Println(\"file has been moved from outside directory, treat like new file\")\n tnt.Tree.LogicalTime++\n fst[key_path] = new(FSnode)\n fst[key_path].Name = fi.Name()\n fst[key_path].Size = fi.Size()\n fst[key_path].IsDir = fi.IsDir()\n fst[key_path].LastModTime = fi.ModTime()\n fst[key_path].Creator = tnt.me\n fst[key_path].CreationTime = tnt.Tree.LogicalTime\n\n fst[key_path].VerVect = make(map[int]int64)\n fst[key_path].SyncVect = make(map[int]int64)\n for i:=0; i<len(tnt.servers); i++ {\n fst[key_path].VerVect[i] = 0\n fst[key_path].SyncVect[i] = 0\n }\n fst[key_path].VerVect[tnt.me] = tnt.Tree.LogicalTime\n fst[key_path].SyncVect[tnt.me] = tnt.Tree.LogicalTime\n fst[key_path].Parent = parent(ev.Name)\n\n }else{\n move_count = 0\n }\n */ \n }\n\n case err := <-watcher.Error:\n log.Println(\"error:\", err)\n }\n }\n}", "title": "" }, { "docid": "d6572aef93ef8dfd90274c49eaba0760", "score": "0.5206938", "text": "func watchAndProcess(inFiles []string, outFile string, renderer Renderer) error {\n\twatcher, err := fsnotify.NewWatcher()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, inFile := range inFiles {\n\t\twatcher.Watch(inFile)\n\t}\n\n\tfor {\n\t\tselect {\n\t\tcase event := <-watcher.Event:\n\t\t\tif event.IsModify() {\n\t\t\t\tif err := processFile(event.Name, outFile, renderer); err == nil {\n\t\t\t\t\tlog.Println(\"Generating\", event.Name, \"->\", outFile)\n\t\t\t\t} else {\n\t\t\t\t\tlog.Println(event.Name, \"-\", err.Error())\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0d51850762623d75304e11932678c836", "score": "0.52050847", "text": "func (w *Watcher) Start(stopCh <-chan struct{}) error {\n\tklog.V(2).InfoS(\"Plugin Watcher Start\", \"path\", w.path)\n\n\t// Creating the directory to be watched if it doesn't exist yet,\n\t// and walks through the directory to discover the existing plugins.\n\tif err := w.init(); err != nil {\n\t\treturn err\n\t}\n\n\tfsWatcher, err := fsnotify.NewWatcher()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to start plugin fsWatcher, err: %v\", err)\n\t}\n\tw.fsWatcher = fsWatcher\n\n\t// Traverse plugin dir and add filesystem watchers before starting the plugin processing goroutine.\n\tif err := w.traversePluginDir(w.path); err != nil {\n\t\tklog.ErrorS(err, \"Failed to traverse plugin socket path\", \"path\", w.path)\n\t}\n\n\tgo func(fsWatcher *fsnotify.Watcher) {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase event := <-fsWatcher.Events:\n\t\t\t\t//TODO: Handle errors by taking corrective measures\n\t\t\t\tif event.Has(fsnotify.Create) {\n\t\t\t\t\terr := w.handleCreateEvent(event)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tklog.ErrorS(err, \"Error when handling create event\", \"event\", event)\n\t\t\t\t\t}\n\t\t\t\t} else if event.Has(fsnotify.Remove) {\n\t\t\t\t\tw.handleDeleteEvent(event)\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\tcase err := <-fsWatcher.Errors:\n\t\t\t\tif err != nil {\n\t\t\t\t\tklog.ErrorS(err, \"FsWatcher received error\")\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\tcase <-stopCh:\n\t\t\t\tw.fsWatcher.Close()\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}(fsWatcher)\n\n\treturn nil\n}", "title": "" }, { "docid": "465d19b7c8422ee92aa09036a6f34caa", "score": "0.520154", "text": "func initialScanAndUpdate() {\n\n\tlog.Info(\"Running startup update of RPM directories\")\n\n\tvar paths rpmPaths\n\n\t// recursively walk the top repo directory to search for RPMs\n\terr := filepath.Walk(RepoDir, paths.findRpms)\n\tcheckErrorAndLog(err)\n\n\tlog.Infof(\"%d directories found that contain RPMs, running update\", len(paths))\n\n\t// Create a channel that is buffered by the number of paths found\n\tch := make(chan string, len(paths))\n\tpaths.toChannel(ch)\n\tclose(ch)\n\n\tfor rpmPath := range ch {\n\t\tlog.Debugf(\"Creating go routine to update %s\", rpmPath)\n\t\tgo updateRepo(&rpmPath)\n\t}\n}", "title": "" }, { "docid": "1d27561314d7ff588b35915ec25e9431", "score": "0.51927596", "text": "func RunEnvironment(readyChan chan error) {\r\n\tinstallPath := \"/Dev/Apps\"\r\n\r\n\tvar err error\r\n\tquit := make(chan bool)\r\n\tc := color.New(color.FgRed)\r\n\r\n\tdat, _ := ioutil.ReadFile(installPath + \"/builder_running.txt\")\r\n\tif len(dat) != 0 {\r\n\t\tc.Println(\"Environment is already running\")\r\n\t\treadyChan <- nil\r\n\t\treturn\r\n\t}\r\n\r\n\ttxt := []byte(\"running\")\r\n\terr = ioutil.WriteFile(installPath+\"/builder_running.txt\", txt, 0777)\r\n\r\n\tif err != nil {\r\n\t\treadyChan <- err\r\n\t\treturn\r\n\t}\r\n\r\n\t// Cleanup\r\n\tdefer func() {\r\n\t\tif err = os.Remove(installPath + \"/builder_running.txt\"); err != nil {\r\n\t\t\treadyChan <- fmt.Errorf(\"Remove Failed %v\", err)\r\n\t\t}\r\n\t}()\r\n\r\n\tsignalCh := make(chan os.Signal, 1)\r\n\tsignal.Notify(signalCh, os.Interrupt)\r\n\tgo func() {\r\n\t\tfor _ = range signalCh {\r\n\t\t\tquit <- true\r\n\t\t}\r\n\t}()\r\n\r\n\tpackagesToBuild := []string{\r\n\t\t\"github.com\\\\someusername\\\\somepackage\",\r\n\t\t\"github.com\\\\someusername\\\\somepackage2\",\r\n\t}\r\n\r\n\tfmt.Println(\"Package Builder Start\")\r\n\r\n\tgoPathSRC := fmt.Sprintf(\"%s\\\\src\", os.Getenv(\"GOPATH\"))\r\n\r\n\t// change directory then build then run!\r\n\tfor _, pkg := range packagesToBuild {\r\n\t\tvar localErr error\r\n\t\tpackageDir := fmt.Sprintf(\"%s\\\\%s\", goPathSRC, pkg)\r\n\r\n\t\tif localErr = buildPackage(packageDir); localErr != nil {\r\n\t\t\tc.Printf(\"Build:\\t%s - Fail: %s\\n\", pkg, localErr)\r\n\t\t\treadyChan <- localErr\r\n\t\t\tbreak\r\n\t\t} else {\r\n\t\t\tfmt.Printf(\"Build:\\t%s - Success\\n\", pkg)\r\n\t\t}\r\n\r\n\t\tif len(quit) > 0 {\r\n\t\t\tbreak\r\n\t\t}\r\n\t\ttime.Sleep(time.Second * 2)\r\n\r\n\t\tgo func(packageDir, pkg string) {\r\n\t\t\tfmt.Printf(\"Run:\\t%s\\n\", pkg)\r\n\r\n\t\t\tif localErr := runProgram(packageDir); localErr != nil {\r\n\t\t\t\tc.Printf(\"Fail:\\t%s - %s\\n\", pkg, localErr)\r\n\t\t\t\treadyChan <- localErr\r\n\t\t\t}\r\n\t\t\tquit <- true\r\n\t\t}(packageDir, pkg)\r\n\r\n\t\tif len(quit) > 0 {\r\n\t\t\tbreak\r\n\t\t}\r\n\t\ttime.Sleep(time.Second)\r\n\t}\r\n\r\n\tfmt.Println(\"Waiting for interrupt\")\r\n\treadyChan <- nil\r\n\t<-quit\r\n\tfmt.Println(\"Package Builder End\")\r\n}", "title": "" }, { "docid": "7a9a83727d5627b2f8271ef05d7d7ff0", "score": "0.5192146", "text": "func TestWatch(t *testing.T) {\n fmt.Println(\"\\n\\n\\n\\n\")\n\n\t// Define which directory to watch\n\tvar watchDirs []string\n\tif len(paramWatchDir) != 0 {\n\t\twatchDirs = []string{ paramWatchDir }\n\n\t\tfmt.Println(\"Watching directory:\", paramWatchDir)\n\n\t\tscanner := NewDirScanner(watchDirs)\n\t\tfmt.Println(\"All watched subdirectories count:\", len(scanner.AllDirs))\n\n\t\tfmt.Println(\"\\n\\n\")\n\n\t} else {\n watchDirs = []string{\n \"data_test/dir-a\",\n \"data_test/dir-b\",\n }\n\t}\n\n\t// Create new watcher\n s, err := New(\n \"data_test/rsrc_tracker.csv\",\n\t\twatchDirs,\n onChange,\n )\n\n if err != nil {\n t.Errorf(\"Error in reseer: %v\", err)\n return\n }\n\n defer s.Stop()\n\n // Keep running for some time\n fmt.Println(\"Watching until Ctrl-C...\")\n\tdone := make(chan bool)\n\t<-done\n}", "title": "" }, { "docid": "1d3026409be851cc2696031367d466cf", "score": "0.5190547", "text": "func (b *BuildBucketState) startBuildPoller(buildsCh chan<- *bb_api.ApiCommonBuildMessage, interval, timeWindow time.Duration) error {\n\tif err := b.pollBuildBucket(buildsCh, timeWindow); err != nil {\n\t\treturn err\n\t}\n\tgo func() {\n\t\tfor range time.Tick(interval) {\n\t\t\tif err := b.pollBuildBucket(buildsCh, timeWindow); err != nil {\n\t\t\t\tsklog.Errorf(\"Error polling BuildBucket: %s\", err)\n\t\t\t}\n\t\t}\n\t}()\n\treturn nil\n}", "title": "" }, { "docid": "e6b897b6a27fc78842af37f531a12668", "score": "0.51707953", "text": "func (am *actormgr) start() {\n\tticker := time.NewTicker(1000 * time.Millisecond)\n\tfor {\n\t\tselect {\n\t\tcase <- ticker.C:\n\t\t\t//log.Printf(\"tick %v\", t)\n\t\t\t//TODO: reload each actor's state\n\t\tcase p := <- am.restartq:\n\t\t\tgo p.boot()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a75b039ea4e817c2f79855ba7f71edb9", "score": "0.51707226", "text": "func Watch(paths ...string) Watcher {\n\tevent := make(chan EventItem)\n\tfor _, p := range paths {\n\t\tregister(p)\n\t}\n\n\tlog.SetFlags(log.LstdFlags | log.Lshortfile)\n\n\tgo func() {\n\t\tcmd := exec.Command(\"fswatch\", paths...)\n\t\tvar (\n\t\t\tout bytes.Buffer\n\t\t\ti int\n\t\t)\n\t\tcmd.Stdout = &out\n\t\tcmd.Start()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-time.After(time.Second * 3):\n\t\t\t\tlines := out.String()\n\t\t\t\tc := strings.Count(lines, \"\\n\")\n\t\t\t\tif c != i {\n\t\t\t\t\tset := make(map[string]struct{})\n\t\t\t\t\tfor _, line := range strings.Split(lines, \"\\n\")[i:] {\n\t\t\t\t\t\tset[line] = struct{}{}\n\t\t\t\t\t}\n\t\t\t\t\tfor p := range set {\n\t\t\t\t\t\tif p == \"\" {\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tevent <- diff(p)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ti = c\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn Watcher{\n\t\tEvent: event,\n\t}\n}", "title": "" }, { "docid": "45daa3652981d7e87de9ceb4704b802f", "score": "0.51631826", "text": "func (l *LocalResolver) Start() {\n\tvar lastStat os.FileInfo\n\n\tfor {\n\t\trebuild := false\n\t\tif info, err := os.Stat(l.Path); err == nil {\n\t\t\tif lastStat == nil {\n\t\t\t\trebuild = true\n\t\t\t} else {\n\t\t\t\tif !lastStat.ModTime().Equal(info.ModTime()) {\n\t\t\t\t\trebuild = true\n\t\t\t\t}\n\t\t\t}\n\t\t\tlastStat = info\n\t\t}\n\n\t\tif rebuild {\n\t\t\tlog.Printf(\"Resolver rebuilding map\")\n\t\t\tl.rebuild()\n\t\t}\n\t\ttime.Sleep(time.Second * 3)\n\t}\n}", "title": "" }, { "docid": "4c967925b30e089b4e62897a03296078", "score": "0.51607823", "text": "func (w *Walker) worker(ctx context.Context, chPaths <-chan string) error {\n\tfor path := range chPaths {\n\t\tbaseInfo, err := os.Stat(path)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to get file info for base path %q: %v\", path, err)\n\t\t}\n\t\tbaseDev, err := fsstat.DevNumber(baseInfo)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to get file stat on base path %q: %v\", path, err)\n\t\t}\n\t\tif err := filepath.Walk(path, func(p string, info os.FileInfo, err error) error {\n\t\t\tp = NormalizePath(p, info.IsDir())\n\t\t\tif err != nil {\n\t\t\t\tmsg := fmt.Sprintf(\"failed to walk %q: %s\", p, err)\n\t\t\t\tlog.Printf(msg)\n\t\t\t\tw.addNotificationToWalk(fspb.Notification_WARNING, p, msg)\n\t\t\t\treturn nil // returning SkipDir on a file would skip the rest of the files in the dir\n\t\t\t}\n\n\t\t\t// Checking various exclusions based on flags in the walker policy.\n\t\t\tif w.isExcluded(p) {\n\t\t\t\tif w.Verbose {\n\t\t\t\t\tw.addNotificationToWalk(fspb.Notification_INFO, p, fmt.Sprintf(\"skipping %q: excluded\", p))\n\t\t\t\t}\n\t\t\t\tif info.IsDir() {\n\t\t\t\t\treturn filepath.SkipDir\n\t\t\t\t}\n\t\t\t\treturn nil // returning SkipDir on a file would skip the rest of the files in the dir\n\t\t\t}\n\t\t\tif w.pol.IgnoreIrregularFiles && !info.Mode().IsRegular() && !info.IsDir() {\n\t\t\t\tif w.Verbose {\n\t\t\t\t\tw.addNotificationToWalk(fspb.Notification_INFO, p, fmt.Sprintf(\"skipping %q: irregular file (mode: %s)\", p, info.Mode()))\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tf, err := w.convert(p, info)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif w.pol.MaxDirectoryDepth > 0 && info.IsDir() && w.relDirDepth(path, p) > w.pol.MaxDirectoryDepth {\n\t\t\t\tw.addNotificationToWalk(fspb.Notification_WARNING, p, fmt.Sprintf(\"skipping %q: more than %d into base path %q\", p, w.pol.MaxDirectoryDepth, path))\n\t\t\t\treturn filepath.SkipDir\n\t\t\t}\n\t\t\tif !w.pol.WalkCrossDevice && f.Stat != nil && baseDev != f.Stat.Dev {\n\t\t\t\tmsg := fmt.Sprintf(\"skipping %q: file is on different device\", p)\n\t\t\t\tlog.Printf(msg)\n\t\t\t\tif w.Verbose {\n\t\t\t\t\tw.addNotificationToWalk(fspb.Notification_INFO, p, msg)\n\t\t\t\t}\n\t\t\t\tif info.IsDir() {\n\t\t\t\t\treturn filepath.SkipDir\n\t\t\t\t}\n\t\t\t\treturn nil // returning SkipDir on a file would skip the rest of the files in the dir\n\t\t\t}\n\n\t\t\treturn w.process(ctx, f)\n\t\t}); err != nil {\n\t\t\treturn fmt.Errorf(\"error walking root include path %q: %v\", path, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "621ccdfabc0835a4b53fa72bc5c5a6d9", "score": "0.51595515", "text": "func spawnWatcher(cfg *Config) (*exec.Cmd, error) {\n\t// The current directory is going to be changed to the root directory\n\t// just before calling exec(2). If name is relative to the current\n\t// directory, convert to an absolute path so exec(2) can still find us.\n\tname, err := exec.LookPath(os.Args[0])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tname, err = filepath.Abs(name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tenv := Environment(os.Environ())\n\tenv.Set(RoleEnvironmentVariable, \"watcher\")\n\tenv.Set(\"PWD\", \"/\")\n\n\tcmd := exec.Command(name, os.Args[1:]...)\n\tcmd.Dir = \"/\"\n\tcmd.Env = []string(env)\n\n\treturn cmd, cmd.Start()\n}", "title": "" }, { "docid": "6b3fa4e8c081e91b64dd872ddfa387fd", "score": "0.5157522", "text": "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"build-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tpred := predicate.Funcs{\n\t\tUpdateFunc: func(e event.UpdateEvent) bool {\n\t\t\t// Ignore updates to CR status in which case metadata.Generation does not change\n\t\t\treturn e.MetaOld.GetGeneration() != e.MetaNew.GetGeneration()\n\t\t},\n\t\tDeleteFunc: func(e event.DeleteEvent) bool {\n\t\t\t// Evaluates to false if the object has been confirmed deleted.\n\t\t\treturn !e.DeleteStateUnknown\n\t\t},\n\t}\n\n\t// Watch for changes to primary resource Build\n\terr = c.Watch(&source.Kind{Type: &buildv1alpha1.Build{}}, &handler.EnqueueRequestForObject{}, pred)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch TaskRuns\n\terr = c.Watch(&source.Kind{Type: &taskv1.TaskRun{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &buildv1alpha1.Build{},\n\t})\n\n\treturn nil\n}", "title": "" }, { "docid": "514c2c9e2854be27776e97b47028b017", "score": "0.51544213", "text": "func start(c *cli.Context) error {\n\tif !isSystemRunning() {\n\t\treturn nil\n\t}\n\n\t_, _, _, controllers := getIPAddresses()\n\tsendCommandToControllers(controllers, \"StartReaders\", \"\")\n\tsendCommandToControllers(controllers, \"StartWriters\", \"\")\n\t//\tsendCommandToControllers(z, \"StartServers\", \"\")\n\treturn nil\n}", "title": "" }, { "docid": "0239f9c234a93aa826983f62ebc92d3e", "score": "0.5153346", "text": "func (b *ContinuousBuilder) Start(ctx context.Context) {\n\tgo func() {\n\t\tb.singleBuildLatest(ctx)\n\t\tfor range time.Tick(b.timeBetweenBuilds) {\n\t\t\tb.singleBuildLatest(ctx)\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "637a677a2dad75df812a8cf553ebfdea", "score": "0.5149384", "text": "func (d *Deployment) StartWatch(m metricsservice.MetricsSevrice) {\n\td.logger.Debug(\"Starting to Watch! Calling m.Run\")\n\td.Watching = true\n\td.metrics = m\n\tgo m.Start()\n}", "title": "" }, { "docid": "4e0610277b963d887ba005ed10ffca0f", "score": "0.5147403", "text": "func startWorkers(h *common.SampleHelper) {\n\t// Configure worker options.\n\tworkerOptions := worker.Options{\n\t\tMetricsScope: h.WorkerMetricScope,\n\t\tLogger: h.Logger,\n\t}\n\th.StartWorkers(h.Config.DomainName, ApplicationName, workerOptions)\n}", "title": "" }, { "docid": "6704a6e781d288a9db3fa078ae04027d", "score": "0.51439524", "text": "func startDependencies(filename string) {\n\tfile, err := os.Open(filename)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\tdefer file.Close()\n\n\tdb := openAndCreateStorage()\n\tdefer db.Close()\n\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tstartService(db, scanner.Text())\n\t}\n}", "title": "" }, { "docid": "48d4cb84d30bc131756a7d8078b6043a", "score": "0.5130378", "text": "func (s *Scheduler) initWatcher() error {\n\twatcher, err := w.NewWatcher()\n\ts.watcher = watcher\n\treturn err\n}", "title": "" }, { "docid": "1ed0fd8d8468807a58d34c00ef8f342a", "score": "0.51284045", "text": "func (o *FileWatcherOptions) runWatchdog(ctx context.Context) error {\n\twatchdogCtx, shutdown := context.WithCancel(ctx)\n\tdefer shutdown()\n\n\t// Handle watchdog shutdown\n\tgo func() {\n\t\tdefer shutdown()\n\t\t<-ctx.Done()\n\t}()\n\n\tpidObservedCh := make(chan int)\n\tgo o.runPidObserver(watchdogCtx, pidObservedCh)\n\n\t// Wait while we get the initial PID for the process\n\tklog.Infof(\"Waiting for process %q PID ...\", o.ProcessName)\n\tcurrentPID := <-pidObservedCh\n\n\t// Mutate path for specified files as '/proc/PID/root/<original path>'\n\t// This means side-car container don't have to duplicate the mounts from main container.\n\t// This require shared PID namespace feature.\n\tfilesToWatch := o.addProcPrefixToFilesFn(o.Files, currentPID)\n\tklog.Infof(\"Watching for changes in: %s\", spew.Sdump(filesToWatch))\n\n\t// Read initial file content. If shared PID namespace does not work, this will error.\n\tinitialContent, err := readInitialFileContent(filesToWatch)\n\tif err != nil {\n\t\t// TODO: remove this once we get aggregated logging\n\t\to.recorder.Warningf(\"FileChangeWatchdogFailed\", \"Reading initial file content failed: %v\", err)\n\t\treturn fmt.Errorf(\"unable to read initial file content: %v\", err)\n\t}\n\n\to.recorder.Eventf(\"FileChangeWatchdogStarted\", \"Started watching files for process %s[%d]\", o.ProcessName, currentPID)\n\n\tobserver, err := fileobserver.NewObserver(o.Interval)\n\tif err != nil {\n\t\to.recorder.Warningf(\"ObserverFailed\", \"Failed to start to file observer: %v\", err)\n\t\treturn fmt.Errorf(\"unable to start file observer: %v\", err)\n\t}\n\n\tobserver.AddReactor(func(file string, action fileobserver.ActionType) error {\n\t\t// We already signalled this PID to terminate and the process is being gracefully terminated now.\n\t\t// Do not duplicate termination process for PID we already terminated, but wait for the new PID to appear.\n\t\tif currentPID == o.lastTerminatedPid {\n\t\t\treturn nil\n\t\t}\n\n\t\to.lastTerminatedPid = currentPID\n\t\tdefer shutdown()\n\n\t\to.recorder.Eventf(\"FileChangeObserved\", \"Observed change in file %q, gracefully terminating process %s[%d]\", file, o.ProcessName, currentPID)\n\n\t\tif err := o.terminateGracefully(currentPID); err != nil {\n\t\t\to.recorder.Warningf(\"SignalFailed\", \"Failed to terminate process %s[%d] gracefully: %v\", o.ProcessName, currentPID, err)\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\t}, initialContent, filesToWatch...)\n\n\tgo observer.Run(watchdogCtx.Done())\n\n\t<-watchdogCtx.Done()\n\treturn nil\n}", "title": "" }, { "docid": "33f66ecada1739a6cb54783930b5ba93", "score": "0.51280147", "text": "func (m *Manager) StartContentWatcher() {\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-m.ctx.Done():\n\t\t\t\treturn\n\t\t\tcase meta := <-m.download:\n\t\t\t\tid := meta.Hash\n\t\t\t\tlog.Debugf(\"got %s\\n\", id.String())\n\t\t\t\tgo func() {\n\t\t\t\t\tmat := m.repo.Matrix()\n\t\t\t\t\tmat.NewContent(id.String())\n\t\t\t\t\tproviders := m.syncer.FindProviders(m.ctx, id)\n\t\t\t\t\tfor _, provider := range providers {\n\t\t\t\t\t\tmat.ContentAddProvider(id.String(), provider)\n\t\t\t\t\t}\n\t\t\t\t\t//_, err := m.syncer.GetFile(m.ctx, id)\n\t\t\t\t\t//if err != nil {\n\t\t\t\t\t//\tlog.Errorf(\"replication sync failed for %s, Err : %s\", id.String(), err.Error())\n\t\t\t\t\t//\treturn\n\t\t\t\t\t//}\n\t\t\t\t\tctx, cancel := context.WithCancel(m.ctx)\n\t\t\t\t\tcb := func() {\n\t\t\t\t\t\tmat.ContentDownloadFinished(id.String())\n\t\t\t\t\t\tsyncMtx.Lock()\n\t\t\t\t\t\tstate := m.repo.State().Add([]byte(meta.Tag))\n\t\t\t\t\t\tlog.Debugf(\"New State: %d\\n\", state)\n\t\t\t\t\t\terr := m.repo.SetState()\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tlog.Errorf(\"SetState failed %s\\n\", err.Error())\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsyncMtx.Unlock()\n\t\t\t\t\t}\n\t\t\t\t\tt := newDownloaderTask(ctx, cancel, meta, m.syncer, cb)\n\t\t\t\t\tdone, err := m.dlManager.Go(t)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Errorf(\"content watcher: unable to start downloader task for %s : %s\", meta.Name, err.Error())\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tmat.ContentDownloadStarted(meta.Tag, id.String(), meta.Size)\n\t\t\t\t\tselect {\n\t\t\t\t\tcase <-ctx.Done():\n\t\t\t\t\t\treturn\n\t\t\t\t\tcase <-done:\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": "da6d0f702a00828764dba921292f9c26", "score": "0.5125604", "text": "func (c *controller) run(stopCh <-chan struct{}) {\n\t// A Go panic which includes logging and terminating\n\tdefer utilruntime.HandleCrash()\n\t// Shutdown after all goroutines have done\n\tdefer c.queue.ShutDown()\n\tc.logger.Info(\"run: initiating\")\n\tc.handler.Init()\n\t// Run the informer to list and watch resources\n\tgo c.informer.Run(stopCh)\n\tgo c.nodeInformer.Run(stopCh)\n\tgo c.deplInformer.Run(stopCh)\n\tgo c.daemonInformer.Run(stopCh)\n\tgo c.stateInformer.Run(stopCh)\n\n\t// Synchronization to settle resources one\n\tif !cache.WaitForCacheSync(stopCh, c.informer.HasSynced, c.nodeInformer.HasSynced, c.deplInformer.HasSynced, c.daemonInformer.HasSynced, c.stateInformer.HasSynced) {\n\t\tutilruntime.HandleError(fmt.Errorf(\"Error syncing cache\"))\n\t\treturn\n\t}\n\tc.logger.Info(\"run: cache sync complete\")\n\t// Operate the runWorker\n\tgo wait.Until(c.runWorker, time.Second, stopCh)\n\n\t<-stopCh\n}", "title": "" }, { "docid": "582773ff45f8f516e2bdea39da6a0e6a", "score": "0.5119311", "text": "func (a *App) Start() {\n\n\n\tfor j := 1; j <= a.workers; j++ {\n\t\ta.Status.Workers ++\n\t\tgo newWorker(j,a.jobQueue)\n\t}\n}", "title": "" }, { "docid": "8444955e5b0ed07c8eba1d00e6890f2b", "score": "0.5115307", "text": "func startMonitoring() {\n\tlog.Println(\"Monitoring...\")\n\tfor {\n\t\tfor _, url := range config.Websites {\n\t\t\tcheckURL(url)\n\t\t}\n\t\ttime.Sleep(time.Duration(config.Interval) * time.Second)\n\t}\n}", "title": "" }, { "docid": "63512f479669946e1652dcfdbda5e3f6", "score": "0.51131827", "text": "func Watch(dir string) {\n\tticker := time.NewTicker(10 * 1000000000)\n\tlast := int64(0)\n\tfor {\n\t\tselect {\n\t\tcase t := <-ticker.C:\n\t\t\tif last > 0 {\n\t\t\t\tfilepath.Walk(dir, visitor(last), nil)\n\t\t\t}\n\t\t\tlast = t\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e6daaf7a0b31c96d961ff5f335280ea5", "score": "0.5111139", "text": "func main() {\n\tOrchestraVersion = fmt.Sprint(OrchestraVersion, \".\", OrchestraBuildVersion)\n\tif os.Getenv(OrchestraEnvVar) != \"\" {\n\t\t// Make sure the casing is what we expect too\n\t\tEnvironment = strings.ToLower(os.Getenv(OrchestraEnvVar))\n\t}\n\n\t// Setup the loggers\n\tSetupLoggers()\n\n\tInfo.Printf(\"Starting up Orchestra v.%s\\n\", OrchestraVersion)\n\tConfig = loadConfiguration(DefaultConfigName)\n\tInfo.Println(\"Starting up with config:\", Config)\n\n\tgo func() {\n\t\tif Config.Server.AcceptAddrHTTPS != \"\" {\n\t\t\tError.Fatal(http.ListenAndServeTLS(Config.Server.GetHTTPSUrl(),\n\t\t\t\t\"ssl/server.crt\", \"ssl/server.key\", buildMux()))\n\t\t}\n\t}()\n\n\tif !Config.Server.HTTPSOnly {\n\t\tgo func() {\n\t\t\tError.Fatal(http.ListenAndServe(Config.Server.AcceptAddr+Config.Server.Port, buildMux()))\n\t\t}()\n\t}\n\n\t// TODO: remove this when you have time, the channel isn't used anymore\n\tgo listenForProcessData()\n\n\tfor _, arg := range os.Args {\n\t\tif arg == \"--open\" {\n\t\t\tcmd := exec.Command(\"open\", \"http://localhost\"+Config.Server.Port)\n\t\t\tcmd.Start()\n\t\t}\n\t}\n\n\twaitForHalt()\n\n\tfor _, project := range Config.Projects {\n\t\tDebug.Println(\"Halting\", project.Name)\n\t\tif project.Running() {\n\t\t\tproject.Stop()\n\t\t}\n\t}\n\n\tInfo.Println(\"Shutting down...\")\n}", "title": "" }, { "docid": "0414e9e057773d3fbbc4476e6ac251c1", "score": "0.51103103", "text": "func (s *Server) watch(ctx context.Context) {\n\tfor {\n\t\t// Update list of maps regular, with some fuzzing.\n\t\tdelay := time.Duration(8000+rand.Int63n(2000)) * time.Millisecond\n\t\tselect {\n\t\tcase <-time.After(delay):\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\t\t}\n\t\ts.updateMux()\n\t}\n}", "title": "" }, { "docid": "9ebfabb3c256ff6a52f3408cc5a3b299", "score": "0.5106948", "text": "func doWatchFiles(files []string, parser func()) {\n\n\t// initially parse file at start up\n\tparser()\n\n\t// watch file for changes calling parser() again on change\n\twatcher, err := fsnotify.NewWatcher()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfileMap := make(map[string]bool)\n\tfor _, fn := range files {\n\t\tfileMap[path.Base(fn)] = true\n\t}\n\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase event, ok := <-watcher.Events:\n\t\t\t\tif !ok {\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif event.Op&fsnotify.Write == fsnotify.Write && fileMap[path.Base(event.Name)] == true {\n\t\t\t\t\tparser()\n\t\t\t\t}\n\t\t\tcase err, ok := <-watcher.Errors:\n\t\t\t\tif !ok {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tlog.Println(\"Error watching file:\", err)\n\t\t\t}\n\t\t}\n\t}()\n\n\tfor _, fn := range files {\n\t\terr = watcher.Add(filepath.Dir(fn))\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}\n}", "title": "" } ]
f4599db8f5764089f242831783e42556
Elapsed provides elapsed time decorator. If there're more than one bar, and you'd like to synchronize column width, conf param should have DwidthSync bit set.
[ { "docid": "d326d32d222cd70b762417865a7c316b", "score": "0.0", "text": "func ElapsedString(s *Statistics) string {\n\tstr := fmt.Sprint(time.Duration(s.TimeElapsed.Seconds()) * time.Second)\n\treturn str\n}", "title": "" } ]
[ { "docid": "e004186bac05b232e94347a54f284448", "score": "0.50652575", "text": "func (t Tick) Elapsed() int {\r\n\treturn t.t\r\n}", "title": "" }, { "docid": "281727ffa0ef27ba4e59080b61379ad3", "score": "0.48112", "text": "func (*A_VT) Duration() {}", "title": "" }, { "docid": "e5920d419ef831d8f99896eddf8624b9", "score": "0.48055694", "text": "func durationGetter(ctx context.Context, value *variable.IndexedValue, data interface{}) (string, error) {\n\tproxyBuffers := proxyBuffersByContext(ctx)\n\tinfo := proxyBuffers.info\n\n\treturn info.Duration().String(), nil\n}", "title": "" }, { "docid": "a51b5b53221e8d8cf5f0e56d83cdfcc6", "score": "0.47959358", "text": "func (bic *batchInfoCollector) getElapsedTime() time.Duration {\n\treturn bic.stopwatch.Elapsed()\n}", "title": "" }, { "docid": "70130307fa6eb463293499c033bb2b18", "score": "0.47768775", "text": "func (self *Timer) Elapsed() int{\n return self.Object.Get(\"elapsed\").Int()\n}", "title": "" }, { "docid": "ca6d997ff054d8d4453443fff091945a", "score": "0.476144", "text": "func (dc *DatadogCollector) Duration(name string, repo string, ref string, tags []string, d float64) error {\n\treturn dc.c.Histogram(name, d, append(dc.tags(repo, ref), tags...), 1)\n}", "title": "" }, { "docid": "70920eb5ae30feef2d39b68a91afab21", "score": "0.470534", "text": "func (c *cloudWatchStat) Timing(delta int64) error {\n\t// Most granular value for timing metrics in cloudwatch is microseconds\n\t// versus nanoseconds.\n\tc.appendValue(delta / 1000)\n\treturn nil\n}", "title": "" }, { "docid": "b0100f2097363a3de42cde30b6863040", "score": "0.46313792", "text": "func ElapsedTime (layer int, time int) int {\n\treturn 2*layer + time\n}", "title": "" }, { "docid": "11e69c7223354ceb9103b80ec0d21441", "score": "0.46265885", "text": "func (c *prometheusClient) Timing(name string, value time.Duration, rate float64) {\n\tdurationMs := value / time.Second\n\tc.Histogram(name, float64(durationMs), rate)\n}", "title": "" }, { "docid": "07fe81e7349443993880889aa54e06f7", "score": "0.46137217", "text": "func (t *Type) Timing(stat string, delta int) {\n\treadable := time.Duration(delta).String()\n\n\tt.Lock()\n\tt.flatMetrics[stat] = delta\n\tt.json.SetP(delta, stat)\n\tt.json.SetP(readable, stat+\"_readable\")\n\tt.Unlock()\n\n\tif t.riemannClient != nil {\n\t\tt.riemannClient.SendEvent(&Event{\n\t\t\tTags: []string{\"meter\"},\n\t\t\tMetric: delta,\n\t\t\tService: t.pathPrefix + stat,\n\t\t})\n\t}\n}", "title": "" }, { "docid": "567e46ecf7d0c0250798299272982720", "score": "0.45045665", "text": "func (b *Bar) renderRemaining(remaining time.Duration) (string, int) {\n\tvar result string\n\tvar min, sec int\n\n\td := int(remaining.Seconds())\n\n\tif d >= 60 {\n\t\tmin = d / 60\n\t\tsec = d % 60\n\t} else {\n\t\tsec = d\n\t}\n\n\tresult = fmt.Sprintf(\"%2d:%02d\", min, sec)\n\n\tif fmtc.DisableColors || b.settings.RemainingColorTag == \"\" {\n\t\treturn result, len(result)\n\t}\n\n\treturn b.settings.RemainingColorTag + result + \"{!}\", len(result)\n}", "title": "" }, { "docid": "56cb5cb079014d068ce0f14903a7237c", "score": "0.44856006", "text": "func (self *Timer) SetElapsedA(member int) {\n self.Object.Set(\"elapsed\", member)\n}", "title": "" }, { "docid": "48a488f2d4bcfac3dc56286b3c7c3efa", "score": "0.44616035", "text": "func (e TestEvent) ElapsedFormatted() string {\n\treturn fmt.Sprintf(\"(%.2fs)\", e.Elapsed)\n}", "title": "" }, { "docid": "44a2fc26d7ac553ed92b82636b841871", "score": "0.44542006", "text": "func (p *Prometheus) Timing(name string, tags [][2]string) func(v time.Duration) {\n\tlblNames, lbls := formatTags(tags, p.fqn)\n\tkey := createKey(name, lblNames)\n\n\tm, ok := p.timings.Load(key)\n\tif !ok {\n\t\tbuckets := p.getBuckets(name)\n\t\ttiming := prometheus.NewHistogramVec(\n\t\t\tprometheus.HistogramOpts{\n\t\t\t\tNamespace: p.namespace,\n\t\t\t\tName: p.fqn.Format(name),\n\t\t\t\tBuckets: buckets,\n\t\t\t\tHelp: name,\n\t\t\t},\n\t\t\tlblNames,\n\t\t)\n\n\t\tm, ok = p.timings.LoadOrStore(key, timing)\n\t\tif !ok {\n\t\t\t_ = p.reg.Register(m)\n\t\t}\n\t}\n\n\to := m.With(lbls)\n\treturn func(v time.Duration) {\n\t\to.Observe(v.Seconds())\n\t}\n}", "title": "" }, { "docid": "957be8f812d98c8a680cc534b91cba35", "score": "0.44524777", "text": "func (c *Component) updateTiming() {\n\t// Set the time over which the metric was gathered.\n\tif c.start.IsZero() {\n\t\tc.start = time.Now()\n\t\tc.Duration = Seconds{0}\n\t} else {\n\t\tc.Duration.Duration = time.Since(c.start)\n\t}\n}", "title": "" }, { "docid": "8006b99f31f05cdba1ece308b481b609", "score": "0.44520175", "text": "func (nf *numberFormat) elapsedDateTimesHandler(token nfp.Token) {\n\tif strings.Contains(strings.ToUpper(token.TValue), \"H\") {\n\t\tnf.result += fmt.Sprintf(\"%.f\", nf.t.Sub(excel1900Epoc).Hours())\n\t\treturn\n\t}\n\tif strings.Contains(strings.ToUpper(token.TValue), \"M\") {\n\t\tnf.result += fmt.Sprintf(\"%.f\", nf.t.Sub(excel1900Epoc).Minutes())\n\t\treturn\n\t}\n\tif strings.Contains(strings.ToUpper(token.TValue), \"S\") {\n\t\tnf.result += fmt.Sprintf(\"%.f\", nf.t.Sub(excel1900Epoc).Seconds())\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "091ba3622bbe2f1e48f3506187bd794d", "score": "0.44495648", "text": "func (self Timer)tickSecs()(float64){\n return float64(self.Ticks)/SECOND_IN_NS\n}", "title": "" }, { "docid": "899a8f924388385fd91cf5fa1ad3f80b", "score": "0.44450513", "text": "func (benchmark *Benchmark) TimeElapsed(units []ConversionType) {\n\n\tbenchmark.elapsed = time.Since(benchmark.currentTime)\n\tbenchmark.units = units\n\n\t// Parse the duration (time.Duration)\n\tduration, _ := time.ParseDuration(benchmark.elapsed.String())\n\n\tif len(units) == 0 {\n\t\tfmt.Println(\"Using default conversion type: Microseconds.\")\n\t\tbenchmark.convertedTypes[Micro] = fmt.Sprintf(\"%d microseconds\", duration.Microseconds())\n\t}\n\n\tfor _, ctype := range units {\n\n\t\tswitch ctype {\n\n\t\tcase Milli:\n\t\t\tbenchmark.convertedTypes[Milli] = fmt.Sprintf(\"%d milliseconds\", duration.Milliseconds())\n\t\tcase Micro:\n\t\t\tbenchmark.convertedTypes[Micro] = fmt.Sprintf(\"%d microseconds\", duration.Microseconds())\n\t\tcase Nano:\n\t\t\tbenchmark.convertedTypes[Nano] = fmt.Sprintf(\"%d nanoseconds\", duration.Nanoseconds())\n\t\tcase Sec:\n\t\t\tbenchmark.convertedTypes[Sec] = fmt.Sprintf(\"%f seconds\", duration.Seconds())\n\t\tcase Min:\n\t\t\tbenchmark.convertedTypes[Min] = fmt.Sprintf(\"%f minutes\", duration.Minutes())\n\t\tcase Hr:\n\t\t\tbenchmark.convertedTypes[Hr] = fmt.Sprintf(\"%f hours\", duration.Hours())\n\t\tdefault:\n\t\t\tbenchmark.convertedTypes[Micro] = fmt.Sprintf(\"%d microseconds\", duration.Microseconds())\n\t\t}\n\t}\n}", "title": "" }, { "docid": "509c42893b4021fa41d39dee4a58a843", "score": "0.4443787", "text": "func measure(f func()) {\n\tstart_time := time.Now()\n\tf()\n\telapsed := float64(time.Since(start_time).Nanoseconds()) / 1000000\n\tfmt.Println(\"elapsed time: \", elapsed, \"ms\")\n}", "title": "" }, { "docid": "9d3580190d13fc02922feaadca03b490", "score": "0.44348934", "text": "func (s *sender) Timing(stat string, value time.Duration, tags ...string) {\n}", "title": "" }, { "docid": "d0dea15844e1cbdee0214e0338cd7ce0", "score": "0.44289622", "text": "func Time(obs prometheus.Observer) (end func()) {\n\tif !config.GetMasterConfig().Observability.EnablePrometheus {\n\t\treturn func() {}\n\t}\n\n\tstart := time.Now()\n\treturn func() {\n\t\tobs.Observe(time.Since(start).Seconds())\n\t}\n}", "title": "" }, { "docid": "0321950333a64773830ee48f16cff779", "score": "0.44088012", "text": "func updateHelmMetrics(name string, startTime time.Time) {\n\thelmCommandDuration.WithLabelValues(\n\t\tname,\n\t).Set(\n\t\tfloat64(time.Since(startTime) / time.Millisecond),\n\t)\n\n\thelmCommandTotal.WithLabelValues(\n\t\tname,\n\t).Inc()\n}", "title": "" }, { "docid": "266c27b8ae76b360aef09b40d9d08c5c", "score": "0.43894666", "text": "func (c *TBCommon) Duration() time.Duration {\n\treturn c.FinishedAt.Sub(c.StartedAt)\n}", "title": "" }, { "docid": "1790dfdfe14f59f280dd456ffde28102", "score": "0.43629858", "text": "func (g *ShardGroup) Duration() time.Duration { return g.EndTime.Sub(g.StartTime) }", "title": "" }, { "docid": "5aa2962bb54117b0cabf5dec2f19e01a", "score": "0.4358356", "text": "func TimeElapsed(start time.Time, friendly bool) string {\n\telapsed := time.Since(start)\n\n\tif friendly {\n\t\telapsed = FriendlyDuration(elapsed)\n\t}\n\n\treturn elapsed.String()\n}", "title": "" }, { "docid": "6287fcf87bfafc22e4ae16cbf6852fc2", "score": "0.43543133", "text": "func (c Chord) TickDuration(quarter uint16) uint16 {\n\treturn c[0].TickDuration(quarter)\n}", "title": "" }, { "docid": "57add0886106506ea653fc996ae04a3c", "score": "0.43534115", "text": "func (t Tick) Delta() int { return t.delta }", "title": "" }, { "docid": "ac7ec1920fed75060e41acfd1bf8d004", "score": "0.43200696", "text": "func (d *DefaultMetricCollector) RunDuration() *rolling.Timing {\r\n\td.mutex.RLock()\r\n\tdefer d.mutex.RUnlock()\r\n\treturn d.runDuration\r\n}", "title": "" }, { "docid": "302ec3fc7dac7bddf14415431e16351b", "score": "0.43192303", "text": "func Timer(ctx context.Context, m *stats.Float64Measure) func() time.Duration {\n\tstart := time.Now()\n\treturn func() time.Duration {\n\t\tstats.Record(ctx, m.M(SinceInMilliseconds(start)))\n\t\treturn time.Since(start)\n\t}\n}", "title": "" }, { "docid": "d579fa6de4a89bb5517848885d0e53a4", "score": "0.43166417", "text": "func (*B_ArtisanTech) Duration() {}", "title": "" }, { "docid": "68201464f5958c095abacacd1a23ddc1", "score": "0.43065983", "text": "func (sc *Subcommand) Duration(assignmentVar *time.Duration, shortName string, longName string, description string) {\n\tsc.add(assignmentVar, shortName, longName, description)\n}", "title": "" }, { "docid": "88d5ca24e5e61422745940ef1653ba5d", "score": "0.4292369", "text": "func (c Chord) Duration(measure time.Duration) time.Duration {\n\treturn c[0].Duration(measure)\n}", "title": "" }, { "docid": "e607c4c5b21707f6bbefb53ee823bbb2", "score": "0.42917156", "text": "func (t Tick) Elapsedf() float64 {\r\n\treturn float64(t.Elapsed())\r\n}", "title": "" }, { "docid": "18e17a8679e04a9eed1546662a681936", "score": "0.4290904", "text": "func AfterMetric(ctx *router.Context) {\n\tstart, _ := ctx.Data[\"time\"].(time.Time)\n\tdur := time.Since(start)\n\t_ = dur\n\t// fmt.Fprintf(os.Stderr, \"%s %s [%s]\\n\", ctx.Request.Method, ctx.Request.URL, dur.String())\n}", "title": "" }, { "docid": "32363c21bb48f08ce1c64226d0fee3a1", "score": "0.42715546", "text": "func ElapsedTime(mode ModeFlag, startTime time.Time, p ...interface{}) {\n\tvar args []interface{}\n\tif len(p) == 0 {\n\t\targs = append(args, \"%s\\n\")\n\t} else {\n\t\tformat := p[0].(string) + \": %s\\n\"\n\t\targs = append(args, format)\n\t\targs = append(args, p[1:]...)\n\t}\n\targs = append(args, time.Since(startTime))\n\tFmt(mode, args...)\n}", "title": "" }, { "docid": "aacb20af01349e83a3f7ace9aab17d94", "score": "0.4267316", "text": "func (t *GuiChart) Update(a *app.App, deltaTime time.Duration) {}", "title": "" }, { "docid": "de92d24502e15e1e5c7871a50160b4ff", "score": "0.42589983", "text": "func responseReceivedDurationGetter(ctx context.Context, value *variable.IndexedValue, data interface{}) (string, error) {\n\tproxyBuffers := proxyBuffersByContext(ctx)\n\tinfo := proxyBuffers.info\n\n\treturn info.ResponseReceivedDuration().String(), nil\n}", "title": "" }, { "docid": "b50f7a10c0cacda2288ff6ebdf38f4b8", "score": "0.42512196", "text": "func (c *clientImpl) Duration(contextKey, key string, start time.Time, tags ...string) {\n\tc.stats.Timing(contextKey+\".\"+key, time.Now().Sub(start), c.enrichTags(tags), 1)\n}", "title": "" }, { "docid": "6efbe09492b5352c7f31241df4467cf5", "score": "0.42289305", "text": "func (this *MigrationContext) ElapsedTime() time.Duration {\n\treturn time.Since(this.StartTime)\n}", "title": "" }, { "docid": "f48ae753b9fa60e4523d743d72da5143", "score": "0.4227118", "text": "func (s *DirectSink) Timing(c *telemetry.Context, stat string, value float64) {\n\ts.writePoint(c, stat, value, \"timing\")\n}", "title": "" }, { "docid": "65bedf432fc6746a425ee64cff9ba548", "score": "0.42093465", "text": "func (t *Type) Decr(stat string, value int) {\n\tt.Lock()\n\ttotal, _ := t.flatMetrics[stat]\n\ttotal -= value\n\n\tt.flatMetrics[stat] = total\n\tt.json.SetP(total, stat)\n\tt.Unlock()\n\n\tif t.riemannClient != nil {\n\t\tt.riemannClient.SendEvent(&Event{\n\t\t\tTags: []string{\"meter\"},\n\t\t\tMetric: total,\n\t\t\tService: t.pathPrefix + stat,\n\t\t})\n\t}\n}", "title": "" }, { "docid": "b50ef511e303886a8c3b63ecf960aea5", "score": "0.42061827", "text": "func (b *Bucket) Timing(value int64) {\n\tworker.addCall(&delayedCall{\n\t\tcallType: ctTiming,\n\t\tbucket: b.prefix,\n\t\tvalue: value,\n\t})\n}", "title": "" }, { "docid": "d49fe05ed1fd8fd156f24e658776a523", "score": "0.41789106", "text": "func (cr *connector) duration() time.Duration {\n\treturn time.Since(cr.timestamp)\n}", "title": "" }, { "docid": "149850d0930450ce03bf42db69773025", "score": "0.41781548", "text": "func UpdateDuration(label FunctionLabel, duration time.Duration) {\n\tfunctionDuration.WithLabelValues(string(label)).Set(duration.Seconds())\n}", "title": "" }, { "docid": "179d0024da47e6dee8480fd3cdbeef69", "score": "0.41701233", "text": "func (p *Package) Elapsed() time.Duration {\n\treturn p.elapsed\n}", "title": "" }, { "docid": "1d28ae95616ea5d34964a06008dddab9", "score": "0.416626", "text": "func (e *ErrorEvent) Elapsed() time.Duration {\n\treturn e.elapsed\n}", "title": "" }, { "docid": "3661be341f8673d0a4d09ed1eb3fc991", "score": "0.4162869", "text": "func (c ConfigSection) GetTimeDuration(params ...string) time.Duration {\n\treturn time.Duration(c.GetInt64(params...))\n}", "title": "" }, { "docid": "0c06fca9b3f268e7bcb4142b32ac60f2", "score": "0.41536486", "text": "func (benchmark Benchmark) GetElapsedTime() time.Duration {\n\treturn benchmark.elapsed\n}", "title": "" }, { "docid": "3fc87bc89b77fee025e49e29c751c41a", "score": "0.41452792", "text": "func Duration(handler http.Handler, metrics MetricsClient, extraTags ...string) http.HandlerFunc {\n\treturn http.HandlerFunc(func(resp http.ResponseWriter, req *http.Request) {\n\t\tdefer metrics.Duration(\"api\", time.Now(), extraTags...)\n\n\t\thandler.ServeHTTP(resp, req)\n\t})\n}", "title": "" }, { "docid": "1685738c0bbdf01d438e0df6c4214b5d", "score": "0.41430596", "text": "func (ci *CachingIndexer) Describe(ch chan<- *prometheus.Desc) {\n\tci.indexDurations.Describe(ch)\n}", "title": "" }, { "docid": "669c2d12c658e666f2e33cae88ea41b6", "score": "0.41402644", "text": "func (coll PerflibExporter) Describe(ch chan<- *prometheus.Desc) {\n\tch <- scrapeDurationDesc\n\tch <- scrapeSuccessDesc\n}", "title": "" }, { "docid": "4661251f0c1e6f584d3006ab025eac4e", "score": "0.41401777", "text": "func receivedDurationGetter(ctx context.Context, value *variable.IndexedValue, data interface{}) (string, error) {\n\tproxyBuffers := proxyBuffersByContext(ctx)\n\tinfo := proxyBuffers.info\n\n\treturn info.RequestReceivedDuration().String(), nil\n}", "title": "" }, { "docid": "2580bb1b08d978b8e8099b68b1c6f52d", "score": "0.41288888", "text": "func (b *Bar) renderSpeed(speed float64) (string, int) {\n\tvar result string\n\n\tif b.settings.IsSize {\n\t\tresult = fmt.Sprintf(\"%9s/s\", fmtutil.PrettySize(speed, \" \"))\n\t} else {\n\t\tresult = formatSpeedNum(speed)\n\t}\n\n\tif fmtc.DisableColors || b.settings.SpeedColorTag == \"\" {\n\t\treturn result, len(result)\n\t}\n\n\treturn b.settings.SpeedColorTag + result + \"{!}\", len(result)\n}", "title": "" }, { "docid": "e99e4c725b27eda78deb17bf773a07a1", "score": "0.41270292", "text": "func (e *Execution) Elapsed() time.Duration {\n\treturn timeNow().Sub(e.started)\n}", "title": "" }, { "docid": "b9c191ce7b54654ee7719e70c5489712", "score": "0.41197234", "text": "func (w *NamedHistogram) tick(fn func(numOps int64, h *hdrhistogram.Histogram)) {\n\tw.mu.Lock()\n\tdefer w.mu.Unlock()\n\tm := w.mu.hist.Merge()\n\tw.mu.hist.Rotate()\n\tfn(w.mu.numOps, m)\n}", "title": "" }, { "docid": "51fef23b938c6950a9cb89f962e755d5", "score": "0.41182673", "text": "func (t *Timer) PrintElapsed(prefix string) {\n\tlog.Info(\"\\n\"+prefix, t.formatDuration(time.Since(t.start)))\n}", "title": "" }, { "docid": "15dd8bb042316d887b412ac879ea1084", "score": "0.41168106", "text": "func OptQueryElapsed(value time.Duration) QueryEventOption {\n\treturn func(e *QueryEvent) { e.Elapsed = value }\n}", "title": "" }, { "docid": "1fdec26a8075642db8a3cf679c971526", "score": "0.41093534", "text": "func (b *Bar) TickWidth() int {\n\twidth := TermWidth(b.Out)\n\tif width < 0 {\n\t\twidth = 80\n\t}\n\treturn width\n}", "title": "" }, { "docid": "88cebae1f69dcf76f09edba47104fda5", "score": "0.4107501", "text": "func (c *SweeperController) Duration() int {\n\treturn -1\n}", "title": "" }, { "docid": "b57aa3b70df9a049b827e79ae9156b31", "score": "0.41041607", "text": "func (t Tick) ElapsedRate() float64 {\r\n\treturn float64(t.Elapsed()) / float64(t.duration)\r\n}", "title": "" }, { "docid": "715dcca8e95d24f90348ed99645c8aeb", "score": "0.41033268", "text": "func Elapsed(j LoggableJob) int64 {\n\tnow := time.Now().UnixNano() / int64(time.Millisecond)\n\tcreated := int64(j.CreatedAt())\n\treturn now - created\n}", "title": "" }, { "docid": "c7d69687b93998f15a2f1b144212bc8e", "score": "0.41030765", "text": "func (span *Span) Duration() int64 {\n\treturn span.End - span.Begin\n}", "title": "" }, { "docid": "6ddc4c8471569adbab7d243e50cd23ab", "score": "0.4102628", "text": "func TimeTracker(start time.Time, info string) {\n\telapsed := time.Since(start)\n\tfmt.Println(\"=========\",info, \" is \",elapsed)\n}", "title": "" }, { "docid": "26069488eff40e76cdf257bd7d05f0b8", "score": "0.4101178", "text": "func timeElapse() func(tc *time.Duration) {\r\n\tstart := time.Now() // closure\r\n\treturn func(tc *time.Duration) {\r\n\t\t*tc = time.Since(start)\r\n\t}\r\n}", "title": "" }, { "docid": "fa46e7d89e76754c0e6c018ad6a547b8", "score": "0.41006655", "text": "func termdashValueFormatter(cfg model.Widget) (linechart.ValueFormatter, error) {\n\taxisUnit := cfg.Graph.Visualization.YAxis.Unit\n\taxisDecimals := cfg.Graph.Visualization.YAxis.Decimals\n\n\tf, err := unit.NewUnitFormatter(axisUnit)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// TODO(slok): auto decimals.\n\t// If units by default use default decimals.\n\tif axisUnit == \"\" && axisDecimals == 0 {\n\t\taxisDecimals = 2\n\t}\n\n\treturn func(value float64) string {\n\t\treturn f(value, axisDecimals)\n\t}, nil\n}", "title": "" }, { "docid": "905bc4331534ea2304b42ed31c46b92a", "score": "0.40994373", "text": "func Time(f func()) time.Duration {\n\tvar timer Timer\n\ttimer.Start()\n\tf()\n\treturn timer.Stop()\n}", "title": "" }, { "docid": "c47de2798659bc37484006ba51b043ce", "score": "0.40899467", "text": "func (eb *Bus) FramesElapsed() int {\n\treturn eb.framesElapsed\n}", "title": "" }, { "docid": "1cdec1841ab1911ec82fac9c32cea45b", "score": "0.40869027", "text": "func (this *FileLog) getFileStats() {\n this.perfs.Set(\n PERF_FLOG_CRASH_BYTES, \n fs.GetFileSize(filepath.Join(DEFAULT_LOG_DIR, CRASH_LOG_NAME)),\n )\n\n this.perfs.Set(\n PERF_FLOG_DEBUG_BYTES, \n fs.GetFileSize(filepath.Join(DEFAULT_LOG_DIR, DEBUG_LOG_NAME)),\n )\n\n this.perfs.Set(\n PERF_FLOG_ERROR_BYTES,\n fs.GetFileSize(filepath.Join(DEFAULT_LOG_DIR, ERROR_LOG_NAME)),\n )\n\n this.perfs.Set(\n PERF_FLOG_INFO_BYTES,\n fs.GetFileSize(filepath.Join(DEFAULT_LOG_DIR, INFO_LOG_NAME)),\n )\n\n stdtime.AfterFunc(1 * stdtime.Minute, this.getFileStats)\n}", "title": "" }, { "docid": "b28a88036365be9ebcb954441d1893d8", "score": "0.40842175", "text": "func (w *Log) Time(v ...interface{}) {\n\tw.l.Printf(\"[TIME] %s\", expand(v))\n}", "title": "" }, { "docid": "6e804fd7c04d45d4aee71b3c2fc9e684", "score": "0.4070445", "text": "func (self Duration) Duration() time.Duration { return time.Duration(self) }", "title": "" }, { "docid": "e85f05f428423aef12d0243e711dbfa3", "score": "0.40696004", "text": "func DurationStatus(handler http.Handler, metrics MetricsClient, extraTags ...string) http.HandlerFunc {\n\treturn http.HandlerFunc(func(resp http.ResponseWriter, req *http.Request) {\n\t\tstart := time.Now()\n\n\t\t// create a new response writer to catch the response code\n\t\tcrw := httputil.NewCustomResponseWriter(resp, false)\n\n\t\thandler.ServeHTTP(crw, req)\n\n\t\tmetrics.Duration(\"api\", start, append(extraTags, \"status:\"+strconv.Itoa(crw.Status()))...)\n\t})\n}", "title": "" }, { "docid": "5225b955d096a30d72b08e5aef620df8", "score": "0.4069594", "text": "func (ctx *rollDPoSCtx) calcDurationSinceLastBlock() (time.Duration, error) {\n\theight := ctx.chain.TipHeight()\n\tblk, err := ctx.chain.GetBlockByHeight(height)\n\tif err != nil {\n\t\treturn 0, errors.Wrapf(err, \"error when getting the block at height: %d\", height)\n\t}\n\treturn ctx.clock.Now().Sub(blk.Header.Timestamp()), nil\n}", "title": "" }, { "docid": "e2578e5261c5e4c562a2c6ce9e17395d", "score": "0.40678596", "text": "func (s *Stopwatch) Elapsed() time.Duration {\n\treturn s.t.Sub(time.Time{})\n}", "title": "" }, { "docid": "1693edf5bffb19445b7f1d824a45d759", "score": "0.4061327", "text": "func (si *SampleIndexer) Describe(ch chan<- *prometheus.Desc) {\n\tsi.indexDurations.Describe(ch)\n}", "title": "" }, { "docid": "4c91d52ee6676a6f432b2d3f53e7c20b", "score": "0.40525448", "text": "func Benchmark(start time.Time) {\n\tlog.Printf(\"Duration of %v(...) : %dms\", reflectUtil.GetCallerName(), time.Now().Nanosecond()/1e6-start.Nanosecond()/1e6)\n}", "title": "" }, { "docid": "c9c9aab8e283d324abc0bcfe7917223d", "score": "0.404924", "text": "func (xs *xstats) Timing(stat string, duration time.Duration, tags ...string) {\n\tif xs.s == nil {\n\t\treturn\n\t}\n\ttags = append(tags, xs.tags...)\n\txs.s.Timing(xs.prefix+stat, duration, tags...)\n}", "title": "" }, { "docid": "228fd1955f1e94422cf3fc30a2c8e355", "score": "0.40491793", "text": "func timeTrack(start time.Time, name string) {\r\n\telapsed := time.Since(start)\r\n\tlog.Printf(\"function %s took %s\", name, elapsed)\r\n}", "title": "" }, { "docid": "92d67812e071aabb492a092a8fe64804", "score": "0.40332428", "text": "func (*C_PhilosophersNotes) Duration() {}", "title": "" }, { "docid": "dbefcfaa3e3e03fedc4d35f21c45a727", "score": "0.40310523", "text": "func timed(name string) func() {\n\tif len(name) > 0 {\n\t\tfmt.Printf(\"%s... \", name)\n\t}\n\tstart := time.Now()\n\treturn func() {\n\t\tfmt.Println(time.Since(start))\n\t}\n}", "title": "" }, { "docid": "7a454faaf4dd90ffb2171786932ba9c5", "score": "0.40241492", "text": "func RTCounter(new NewCounterFn) rrOptSetter {\n\treturn func(r *RTMetrics) error {\n\t\tr.newCounter = new\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "851371f5ae4b375d0dc5749058b43659", "score": "0.40190727", "text": "func (facade *Facade) MeasureFunc(key string, subject func()) float64 {\n\tsw := common.StartNewStopwatch()\n\tsubject()\n\treturn facade.RecordElapsedTime(key, sw)\n}", "title": "" }, { "docid": "9b3a9cd17dbb05382944b71ad3ab4e91", "score": "0.40127057", "text": "func RegisterDurationMetrics(resolution time.Duration) {\n\ttickDuration = prometheus.NewHistogram(\n\t\tprometheus.HistogramOpts{\n\t\t\tNamespace: \"metrics_server\",\n\t\t\tSubsystem: \"manager\",\n\t\t\tName: \"tick_duration_seconds\",\n\t\t\tHelp: \"The total time spent collecting and storing metrics in seconds.\",\n\t\t\tBuckets: utilmetrics.BucketsForScrapeDuration(resolution),\n\t\t},\n\t)\n\tprometheus.MustRegister(tickDuration)\n}", "title": "" }, { "docid": "1ff929aca88862430c1c8a8ad234e0c8", "score": "0.4011991", "text": "func requestFinishedDurationGetter(ctx context.Context, value *variable.IndexedValue, data interface{}) (string, error) {\n\tproxyBuffers := proxyBuffersByContext(ctx)\n\tinfo := proxyBuffers.info\n\n\treturn info.RequestFinishedDuration().String(), nil\n}", "title": "" }, { "docid": "b543aee117a6bf84dbc1d75015d17a4c", "score": "0.40058324", "text": "func effiency(shoudWorkSeconds, realWorkSeconds int) int {\n\treturn realWorkSeconds * 100 / shoudWorkSeconds\n}", "title": "" }, { "docid": "c392d9e9377d03f0a7396a01efca2f41", "score": "0.40045953", "text": "func (c *Client) Timing(bucket string, value interface{}) {\n\tif c.skip() {\n\t\treturn\n\t}\n\tc.conn.metric(c.prefix, bucket, value, \"ms\", c.rate, c.tags)\n}", "title": "" }, { "docid": "7aa76ff86773020bf060627135e5186a", "score": "0.40041327", "text": "func (m *mockXstatsSender) Timing(stat string, value time.Duration, tags ...string) {\n\tvarargs := []interface{}{stat, value}\n\tfor _, a := range tags {\n\t\tvarargs = append(varargs, a)\n\t}\n\tm.ctrl.Call(m, \"Timing\", varargs...)\n}", "title": "" }, { "docid": "37bfdc1723105ce2b9ae4de9e2edbd6b", "score": "0.40038654", "text": "func latency(t1, t2 metav1.Time) string {\n\treturn fmt.Sprintf(\"%.0f sec\", t2.Time.Sub(t1.Time).Seconds())\n}", "title": "" }, { "docid": "af0e7068543bce704d9c231aa0e11d3d", "score": "0.400141", "text": "func (self *Timer) Duration() int{\n return self.Object.Get(\"duration\").Int()\n}", "title": "" }, { "docid": "1f0518a6e268dbd93cd49595cfedc1b1", "score": "0.39953426", "text": "func Reg() {\n\tcore.GetOperationFactory().Register(&DurationOverOperation{}, \"duration_over\") // time difference now gt\n}", "title": "" }, { "docid": "ce046cad0d106a63452a9bb9d5869eff", "score": "0.39952073", "text": "func Tick(cycles uint64) {\n\tdividerCounter += int(cycles)\n\tif dividerCounter >= 255 {\n\t\tdividerCounter -= 255\n\t\tmmu.RAM[dividerAddr]++\n\t}\n\tif isTimerRunning() {\n\t\ttimerCounter -= int(cycles)\n\t\tif timerCounter <= 0 {\n\t\t\ttimerCounter += getTimerFrequency()\n\t\t\tincrementTimer()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a615da06be48c10a0511dfe39764d373", "score": "0.39919055", "text": "func (c *ConfigList) GetTimeDuration(key string, params ...string) time.Duration {\n\treturn time.Duration(c.GetInt64(key, params...))\n}", "title": "" }, { "docid": "9bb40cda16d5076bcb92da0194266665", "score": "0.39875656", "text": "func (Fs) Chtimes(string, time.Time, time.Time) error {\n\treturn ErrNotSupported\n}", "title": "" }, { "docid": "5ae160ebefcdee1ff4423bc95bdf8802", "score": "0.3984159", "text": "func (c *Config) ObserveReqDuration(start *time.Time, test string) {\n\telapsed := float64(time.Since(*start)) / float64(time.Second)\n\tc.reqDuration.WithLabelValues(test).Observe(elapsed)\n}", "title": "" }, { "docid": "3fb96fef2daba4133c823f034ec02267", "score": "0.398301", "text": "func RaftHbeatTicks(h int) HiveOption { return HiveOption(raftHbeatTicks(h)) }", "title": "" }, { "docid": "6ac1cf153458e3d27878ff57f99445b4", "score": "0.39748505", "text": "func (mp *nullMeasuringPoint) AvgDuration() time.Duration { return 0 }", "title": "" }, { "docid": "0e3707fc2114444911f44b39cd30db29", "score": "0.3973598", "text": "func (d *DRPCInstance) statusUpdateTimeElapsed() bool {\n\treturn d.instance.Status.LastUpdateTime.Add(SanityCheckDelay).Before(time.Now())\n}", "title": "" }, { "docid": "0cbb5b70af844e60588b86fa6e95d555", "score": "0.39714006", "text": "func (c *Config) FlushTime(val time.Duration) {\n\tc.flush_time = val\n}", "title": "" }, { "docid": "3f0d315d8b818d23cb75ed8bc3b047d9", "score": "0.3966937", "text": "func (*ExprFDiv) MetadataNode() {}", "title": "" }, { "docid": "2bb86d07f35456dc22c2d07ac4a4f027", "score": "0.39611736", "text": "func (h DemoHeader) TickTime() time.Duration {\n\treturn time.Duration(h.PlaybackTime.Nanoseconds() / int64(h.PlaybackTicks))\n}", "title": "" }, { "docid": "7f0b26cf034631f916064bfa4f5ef746", "score": "0.3960684", "text": "func (dmc *datadogMetricsClient) ExternalDuration(direction, externalService, path string, value time.Duration) error {\n\tmetricTag := sanitizeTags([]string{\"direction:\" + direction, \"external_service:\" + externalService, \"path:\" + path})\n\n\treturn dmc.statsdClient.Timing(\"pbxx.external.duration\", value, metricTag, 1)\n}", "title": "" }, { "docid": "f057182dd325cc1a9ccd7648a3252acf", "score": "0.39597547", "text": "func (e *ResponseEvent) Elapsed() time.Duration {\n\treturn e.elapsed\n}", "title": "" } ]
e125cc53bcdc13ac46e3e8d4cf313e18
AsSalesforceMarketingCloudObjectDataset is the BasicDataset implementation for EloquaObjectDataset.
[ { "docid": "092fe49f7306be3ed04e6b7259a3719e", "score": "0.8101417", "text": "func (eod EloquaObjectDataset) AsSalesforceMarketingCloudObjectDataset() (*SalesforceMarketingCloudObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" } ]
[ { "docid": "d551fd7b4a2665e55dbc0fdf218bb92b", "score": "0.8053379", "text": "func (eod EloquaObjectDataset) AsSalesforceObjectDataset() (*SalesforceObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "75bfd0e954f5c30a3f634613fbe9d537", "score": "0.79340774", "text": "func (smcod SalesforceMarketingCloudObjectDataset) AsEloquaObjectDataset() (*EloquaObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "04482a5535ffede752f59950dcef4b51", "score": "0.78657275", "text": "func (hbod HBaseObjectDataset) AsSalesforceMarketingCloudObjectDataset() (*SalesforceMarketingCloudObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "47e0800493d4458ce249072a9a49cc64", "score": "0.7853292", "text": "func (smcod SalesforceMarketingCloudObjectDataset) AsSalesforceObjectDataset() (*SalesforceObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "69459b435a8376cecd980d337e99d7a1", "score": "0.7850085", "text": "func (cd CustomDataset) AsSalesforceObjectDataset() (*SalesforceObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "3600af697c33a521449493210ee407a5", "score": "0.78457355", "text": "func (hbod HBaseObjectDataset) AsSalesforceObjectDataset() (*SalesforceObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "a502caac78f566584523e2c3dab4eaf3", "score": "0.7844097", "text": "func (mod MarketoObjectDataset) AsSalesforceObjectDataset() (*SalesforceObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "5fe9de7a8e5936f61da18e7f44547a3a", "score": "0.7816331", "text": "func (mod MagentoObjectDataset) AsSalesforceMarketingCloudObjectDataset() (*SalesforceMarketingCloudObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "9bd30e4aff2241c34051de74c16f5a6a", "score": "0.78157043", "text": "func (mdcd MongoDbCollectionDataset) AsSalesforceObjectDataset() (*SalesforceObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "1f85f74153cd0d168364d38440941c2b", "score": "0.779832", "text": "func (mod MagentoObjectDataset) AsSalesforceObjectDataset() (*SalesforceObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "4226a7de0571f9fbb06f2e39f408a10d", "score": "0.77828187", "text": "func (hod HiveObjectDataset) AsSalesforceObjectDataset() (*SalesforceObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "eaeb6273ff71e47b24e47b63c2e25422", "score": "0.7782028", "text": "func (mod MarketoObjectDataset) AsSalesforceMarketingCloudObjectDataset() (*SalesforceMarketingCloudObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "420120c9dcdf8bf6e08b2f02dae0f87f", "score": "0.7776084", "text": "func (d Dataset) AsSalesforceObjectDataset() (*SalesforceObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "2a90d07c3cd3f2d0e3e3af5b1252c151", "score": "0.776827", "text": "func (ctd CouchbaseTableDataset) AsSalesforceObjectDataset() (*SalesforceObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "cf4009016ad1af25afaf57943703f3d4", "score": "0.77582616", "text": "func (sod SalesforceObjectDataset) AsEloquaObjectDataset() (*EloquaObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "83d5137b74179349bbcbcd209eb356c2", "score": "0.77484775", "text": "func (hod HiveObjectDataset) AsSalesforceMarketingCloudObjectDataset() (*SalesforceMarketingCloudObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "407904489092fbf2983da1b2842f8875", "score": "0.77247673", "text": "func (sod ShopifyObjectDataset) AsSalesforceMarketingCloudObjectDataset() (*SalesforceMarketingCloudObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "a9aa111b6993930344a485e665e1b1fc", "score": "0.7711369", "text": "func (d Dataset) AsSalesforceMarketingCloudObjectDataset() (*SalesforceMarketingCloudObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "f0a35da9ffccf0f61b3f5eb4ea3b8347", "score": "0.77106917", "text": "func (sod SalesforceObjectDataset) AsSalesforceMarketingCloudObjectDataset() (*SalesforceMarketingCloudObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "5701a0f94d763f4ac84eadd9b79afa61", "score": "0.7705169", "text": "func (smcod SalesforceMarketingCloudObjectDataset) AsShopifyObjectDataset() (*ShopifyObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "ebecc0965fc7781b64baf19a6aee9cc4", "score": "0.7697465", "text": "func (smcod SalesforceMarketingCloudObjectDataset) AsDataset() (*Dataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "f85e99092cebb23b33f86bc729080d16", "score": "0.76944745", "text": "func (sod ShopifyObjectDataset) AsSalesforceObjectDataset() (*SalesforceObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "e82545450d8fda3ac86d272881a08720", "score": "0.7678322", "text": "func (ctd CouchbaseTableDataset) AsSalesforceMarketingCloudObjectDataset() (*SalesforceMarketingCloudObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "cbebfd6b0ea05cd6d9e6ba19cc970181", "score": "0.76601434", "text": "func (atd AzureTableDataset) AsSalesforceObjectDataset() (*SalesforceObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "3b59e5c540b171e8ffc992379b161211", "score": "0.76562", "text": "func (sod SquareObjectDataset) AsSalesforceMarketingCloudObjectDataset() (*SalesforceMarketingCloudObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "e54ad12ad81b3f4b05ff037d7004d854", "score": "0.7641806", "text": "func (cod ConcurObjectDataset) AsSalesforceMarketingCloudObjectDataset() (*SalesforceMarketingCloudObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "0d4e2fd8b60b5027fc9675295f6b02d8", "score": "0.7639562", "text": "func (hod HubspotObjectDataset) AsSalesforceObjectDataset() (*SalesforceObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "49a47c1402ca59f675da5b5fcd5e7f42", "score": "0.7636791", "text": "func (astd AzureSQLTableDataset) AsSalesforceObjectDataset() (*SalesforceObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "09a15db1a664de9526759a04544eb92c", "score": "0.7631277", "text": "func (sod SquareObjectDataset) AsSalesforceObjectDataset() (*SalesforceObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "b34e0bd24ae9fc731d9c32549a4aec41", "score": "0.7621074", "text": "func (cd CustomDataset) AsSalesforceMarketingCloudObjectDataset() (*SalesforceMarketingCloudObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "ff1c511114fbd96bb937a62cf8ddf2b7", "score": "0.76175416", "text": "func (sstd SQLServerTableDataset) AsSalesforceObjectDataset() (*SalesforceObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "25a6de05b1b0a78bdd9288a47ec77945", "score": "0.76174134", "text": "func (ddcd DocumentDbCollectionDataset) AsSalesforceObjectDataset() (*SalesforceObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "a5dc69c15c4483fc65deab990f559eb7", "score": "0.76160216", "text": "func (sod SparkObjectDataset) AsSalesforceObjectDataset() (*SalesforceObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "24ff8b672190b54587e7911486f19320", "score": "0.7604251", "text": "func (hod HubspotObjectDataset) AsSalesforceMarketingCloudObjectDataset() (*SalesforceMarketingCloudObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "693a5b275ac1b7238e817ddbea642049", "score": "0.7602016", "text": "func (ctd CassandraTableDataset) AsSalesforceObjectDataset() (*SalesforceObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "031b9bacd56d3114741421717d7e6e0d", "score": "0.76013863", "text": "func (gtd GreenplumTableDataset) AsSalesforceObjectDataset() (*SalesforceObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "c773beb7c7673e801a3e5fd0ffabd5c3", "score": "0.7599922", "text": "func (pod PrestoObjectDataset) AsSalesforceObjectDataset() (*SalesforceObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "1447f36f52669943e01d596f1d8eef3b", "score": "0.7591109", "text": "func (cod ConcurObjectDataset) AsSalesforceObjectDataset() (*SalesforceObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "9f911524a94a405661ef4301ce26d41a", "score": "0.75873756", "text": "func (snod ServiceNowObjectDataset) AsSalesforceObjectDataset() (*SalesforceObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "c3a081b6270b7a194948ac52bfae503c", "score": "0.7585756", "text": "func (gbqod GoogleBigQueryObjectDataset) AsSalesforceObjectDataset() (*SalesforceObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "e0886568c4d4379ecde8e1c7e7c4541d", "score": "0.7579454", "text": "func (xod XeroObjectDataset) AsSalesforceMarketingCloudObjectDataset() (*SalesforceMarketingCloudObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "66232e8cbf61a92c6e8c50b8df9de161", "score": "0.75767934", "text": "func (ded DynamicsEntityDataset) AsSalesforceObjectDataset() (*SalesforceObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "cfe4b2984a0666d448aa69e0c95c6d6f", "score": "0.75741214", "text": "func (sod SparkObjectDataset) AsSalesforceMarketingCloudObjectDataset() (*SalesforceMarketingCloudObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "dcd5e4fe61a6fda9b96d36b02f1c5402", "score": "0.75704104", "text": "func (sstd SQLServerTableDataset) AsSalesforceMarketingCloudObjectDataset() (*SalesforceMarketingCloudObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "86aeb1af7af175bd8b2369d8201dee60", "score": "0.7569964", "text": "func (cd CustomDataset) AsEloquaObjectDataset() (*EloquaObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "8115fab554eb4f10f4fcd9a70f54f1ce", "score": "0.7565937", "text": "func (sod SalesforceObjectDataset) AsSalesforceObjectDataset() (*SalesforceObjectDataset, bool) {\n\treturn &sod, true\n}", "title": "" }, { "docid": "d7cca1a6699469a6f3fdea569f76d73f", "score": "0.75588953", "text": "func (qbod QuickBooksObjectDataset) AsSalesforceObjectDataset() (*SalesforceObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "0da168e1bfd8fb2d1c252f0a1f6c72c3", "score": "0.75586647", "text": "func (hd HTTPDataset) AsSalesforceMarketingCloudObjectDataset() (*SalesforceMarketingCloudObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "6b3ec46aa285cd186634b9e017380e0b", "score": "0.7556433", "text": "func (hd HTTPDataset) AsSalesforceObjectDataset() (*SalesforceObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "741b9fc32e0ea85e371b83e1b90e696e", "score": "0.75553864", "text": "func (asd AmazonS3Dataset) AsSalesforceObjectDataset() (*SalesforceObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "8f6c0f2fa72afe79a1ae725b6617bff5", "score": "0.7552678", "text": "func (zod ZohoObjectDataset) AsSalesforceMarketingCloudObjectDataset() (*SalesforceMarketingCloudObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "e77a958cdc6495755735a9410186d665", "score": "0.754878", "text": "func (mdcd MongoDbCollectionDataset) AsSalesforceMarketingCloudObjectDataset() (*SalesforceMarketingCloudObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "e2d686df0ecc6726a24238a14c4bf924", "score": "0.7546506", "text": "func (abd AzureBlobDataset) AsSalesforceObjectDataset() (*SalesforceObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "3d89413ca34e909f7eb7956fea87dba1", "score": "0.75443196", "text": "func (ctd CouchbaseTableDataset) AsEloquaObjectDataset() (*EloquaObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "88f8498b7760972cca2af1755daac3e5", "score": "0.7543366", "text": "func (snod ServiceNowObjectDataset) AsEloquaObjectDataset() (*EloquaObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "d0de1a34013a19c97eaef8f60eb6017b", "score": "0.75426173", "text": "func (snod ServiceNowObjectDataset) AsSalesforceMarketingCloudObjectDataset() (*SalesforceMarketingCloudObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "9932fb10527474540f2a083a29d12497", "score": "0.75412893", "text": "func (ded DynamicsEntityDataset) AsSalesforceMarketingCloudObjectDataset() (*SalesforceMarketingCloudObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "1f9c57ca08c34e83616982d88a22b25c", "score": "0.75410384", "text": "func (qbod QuickBooksObjectDataset) AsSalesforceMarketingCloudObjectDataset() (*SalesforceMarketingCloudObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "de80009ec5365913216a187b6d66f31d", "score": "0.7535823", "text": "func (dtd DrillTableDataset) AsSalesforceObjectDataset() (*SalesforceObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "96b891712c0519d775861861bf12b53e", "score": "0.75356287", "text": "func (smcod SalesforceMarketingCloudObjectDataset) AsMarketoObjectDataset() (*MarketoObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "2a383848ecdd603da985e96adc05d3bc", "score": "0.75300187", "text": "func (gtd GreenplumTableDataset) AsSalesforceMarketingCloudObjectDataset() (*SalesforceMarketingCloudObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "c4c39343eb3c906e7f80fb40691ba8d3", "score": "0.7528192", "text": "func (gbqod GoogleBigQueryObjectDataset) AsSalesforceMarketingCloudObjectDataset() (*SalesforceMarketingCloudObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "d7a63dffcae40347f255067cb036f6ea", "score": "0.75007313", "text": "func (ded DynamicsEntityDataset) AsEloquaObjectDataset() (*EloquaObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "adbc33629b86d2599ac61782971b3846", "score": "0.7500327", "text": "func (astd AzureSQLTableDataset) AsEloquaObjectDataset() (*EloquaObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "57853cff7fee5d4d36a811dbf9565f97", "score": "0.7499875", "text": "func (vtd VerticaTableDataset) AsSalesforceObjectDataset() (*SalesforceObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "397d5b35b55746d82420250c02888eb2", "score": "0.7499158", "text": "func (dtd DrillTableDataset) AsSalesforceMarketingCloudObjectDataset() (*SalesforceMarketingCloudObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "d11d894f802f542eeb2e890bbecc009a", "score": "0.74970937", "text": "func (pod PrestoObjectDataset) AsSalesforceMarketingCloudObjectDataset() (*SalesforceMarketingCloudObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "6a03b6a41c8df5433623b89e6706f9a8", "score": "0.74911153", "text": "func (mdtd MariaDBTableDataset) AsSalesforceObjectDataset() (*SalesforceObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "7bff8d1e2626f97f2da7b28c9a117ad7", "score": "0.74880433", "text": "func (ntd NetezzaTableDataset) AsSalesforceObjectDataset() (*SalesforceObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "ae6dd70768f1d4dc024d458078113d5e", "score": "0.7480702", "text": "func (zod ZohoObjectDataset) AsSalesforceObjectDataset() (*SalesforceObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "39e6548f52e7962f900ce90cc4797af3", "score": "0.74731314", "text": "func (asdtd AzureSQLDWTableDataset) AsSalesforceObjectDataset() (*SalesforceObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "0d6e203e378078443f103b0c0f0a394b", "score": "0.7469416", "text": "func (sstd SQLServerTableDataset) AsEloquaObjectDataset() (*EloquaObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "a81d1cfd73a55bebf55e97948c6e3407", "score": "0.746893", "text": "func (xod XeroObjectDataset) AsSalesforceObjectDataset() (*SalesforceObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "b13495eaa609b989c20400fdfd7be971", "score": "0.74669486", "text": "func (sod ShopifyObjectDataset) AsEloquaObjectDataset() (*EloquaObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "112b4816a4442862c9e82ff1454e841e", "score": "0.74662286", "text": "func (pod PhoenixObjectDataset) AsSalesforceMarketingCloudObjectDataset() (*SalesforceMarketingCloudObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "2a183b72171d4c266c77ed92cdf9ff7f", "score": "0.746603", "text": "func (ctd CassandraTableDataset) AsSalesforceMarketingCloudObjectDataset() (*SalesforceMarketingCloudObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "6e982e407e6bbb8a34be92a086a399e4", "score": "0.7465322", "text": "func (ddcd DocumentDbCollectionDataset) AsEloquaObjectDataset() (*EloquaObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "1245b2498e133c2390c9ed20363fdefb", "score": "0.7460423", "text": "func (atd AzureTableDataset) AsSalesforceMarketingCloudObjectDataset() (*SalesforceMarketingCloudObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "2c17b5550738fd9f0b478d986472b6d9", "score": "0.7452907", "text": "func (iod ImpalaObjectDataset) AsSalesforceObjectDataset() (*SalesforceObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "97f9f7a2b1b670cd50851859f70eeb58", "score": "0.7444975", "text": "func (sod SalesforceObjectDataset) AsDataset() (*Dataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "78d1416d7b3251ce268adde4d251fdf0", "score": "0.7440121", "text": "func (mdcd MongoDbCollectionDataset) AsEloquaObjectDataset() (*EloquaObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "6cb57c1a826aab740e35b226ea7c2b1c", "score": "0.74367195", "text": "func (pod PhoenixObjectDataset) AsSalesforceObjectDataset() (*SalesforceObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "41b1e2ce13efbf1f01c389e1decd0a02", "score": "0.7434007", "text": "func (wtd WebTableDataset) AsSalesforceObjectDataset() (*SalesforceObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "613ac5ecad2b549d36a3b41ab3308b5f", "score": "0.74296707", "text": "func (odrd ODataResourceDataset) AsSalesforceObjectDataset() (*SalesforceObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "29d82ecf25a67273c4a481bbe2dc5280", "score": "0.74263865", "text": "func (serd SapEccResourceDataset) AsSalesforceObjectDataset() (*SalesforceObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "b3f572754deedaa369d964914cace170", "score": "0.7424928", "text": "func (otd OracleTableDataset) AsSalesforceObjectDataset() (*SalesforceObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "97964103186ac077118903bd1cec9e7d", "score": "0.74224716", "text": "func (otd OracleTableDataset) AsSalesforceMarketingCloudObjectDataset() (*SalesforceMarketingCloudObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "40886eccdc9baa3c7b26976e0e1c2323", "score": "0.7418905", "text": "func (mod MarketoObjectDataset) AsEloquaObjectDataset() (*EloquaObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "4072f2c351dbaf78a43793acd73d9044", "score": "0.7418217", "text": "func (smcod SalesforceMarketingCloudObjectDataset) AsSalesforceMarketingCloudObjectDataset() (*SalesforceMarketingCloudObjectDataset, bool) {\n\treturn &smcod, true\n}", "title": "" }, { "docid": "421a3232f41e57a38e2746508d7972d7", "score": "0.7414766", "text": "func (ntd NetezzaTableDataset) AsSalesforceMarketingCloudObjectDataset() (*SalesforceMarketingCloudObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "d41fb31d1146c89454f7174d76ecb637", "score": "0.74141264", "text": "func (ddcd DocumentDbCollectionDataset) AsSalesforceMarketingCloudObjectDataset() (*SalesforceMarketingCloudObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "4f8061699847803263977bb93fdae53c", "score": "0.7413626", "text": "func (sod SalesforceObjectDataset) AsMarketoObjectDataset() (*MarketoObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "aef059e8593ef8de8427b116a3e9fd10", "score": "0.74110264", "text": "func (rtd RelationalTableDataset) AsSalesforceObjectDataset() (*SalesforceObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "b37ecbadbda42eab6d3e08303bf0a0d3", "score": "0.7410914", "text": "func (vtd VerticaTableDataset) AsSalesforceMarketingCloudObjectDataset() (*SalesforceMarketingCloudObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "7f27c826959447de98939fedb836bbed", "score": "0.7408581", "text": "func (d Dataset) AsEloquaObjectDataset() (*EloquaObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "69832521f0f83781dfca8980d89c7dba", "score": "0.74074", "text": "func (sod SparkObjectDataset) AsEloquaObjectDataset() (*EloquaObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "174d0d8e8e1e2e8bf71e4719aaf354e7", "score": "0.7406101", "text": "func (ctd CassandraTableDataset) AsEloquaObjectDataset() (*EloquaObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "ab6055900b92f0a4ec11c66671dd74ba", "score": "0.7403836", "text": "func (odrd ODataResourceDataset) AsSalesforceMarketingCloudObjectDataset() (*SalesforceMarketingCloudObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "8dee87371f369f39d0facebbca73be17", "score": "0.7401507", "text": "func (asd AmazonS3Dataset) AsSalesforceMarketingCloudObjectDataset() (*SalesforceMarketingCloudObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "a827c995da3b6ca14a627f3c30d890c0", "score": "0.73874366", "text": "func (asdtd AzureSQLDWTableDataset) AsEloquaObjectDataset() (*EloquaObjectDataset, bool) {\n\treturn nil, false\n}", "title": "" } ]
44979ea2429ed6f4f86d9ae55f25c794
NodePublishSecretRef is a reference to the secret object containing sensitive information to pass to the CSI driver to complete the CSI NodePublishVolume and NodeUnpublishVolume calls. This field is optional, and may be empty if no secret is required. If the secret object contains more than one secret, all secret references are passed.
[ { "docid": "00ac9666641182d88779d94aeaafd325", "score": "0.7670843", "text": "func (o CSIVolumeSourcePtrOutput) NodePublishSecretRef() LocalObjectReferencePtrOutput {\n\treturn o.ApplyT(func(v CSIVolumeSource) *LocalObjectReference { return v.NodePublishSecretRef }).(LocalObjectReferencePtrOutput)\n}", "title": "" } ]
[ { "docid": "ad6a59e0dd3b82c4c155fe1a78a405d6", "score": "0.7735603", "text": "func (o CSIVolumeSourceOutput) NodePublishSecretRef() LocalObjectReferencePtrOutput {\n\treturn o.ApplyT(func(v CSIVolumeSource) *LocalObjectReference { return v.NodePublishSecretRef }).(LocalObjectReferencePtrOutput)\n}", "title": "" }, { "docid": "1af2695d83db4785e4425d9d31836f3b", "score": "0.77181906", "text": "func (o CSIPersistentVolumeSourceOutput) NodePublishSecretRef() SecretReferencePtrOutput {\n\treturn o.ApplyT(func(v CSIPersistentVolumeSource) *SecretReference { return v.NodePublishSecretRef }).(SecretReferencePtrOutput)\n}", "title": "" }, { "docid": "d0b195fb3b396376173885960c220659", "score": "0.7670395", "text": "func (o CSIPersistentVolumeSourcePtrOutput) NodePublishSecretRef() SecretReferencePtrOutput {\n\treturn o.ApplyT(func(v CSIPersistentVolumeSource) *SecretReference { return v.NodePublishSecretRef }).(SecretReferencePtrOutput)\n}", "title": "" }, { "docid": "fe17c6d32f5552830b717eabdc34085a", "score": "0.704417", "text": "func (s k8sStore) GetNodePublishSecretRefSecret(name, namespace string) (*corev1.Secret, error) {\n\treturn s.listers.NodePublishSecretRefSecret.GetWithKey(fmt.Sprintf(\"%s/%s\", namespace, name))\n}", "title": "" }, { "docid": "6f83ff87dc5fd23de4260953382e2e00", "score": "0.6614833", "text": "func newNodePublishSecretRefSecretInformer(kubeClient kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {\n\treturn coreInformers.NewFilteredSecretInformer(\n\t\tkubeClient,\n\t\tcorev1.NamespaceAll,\n\t\tresyncPeriod,\n\t\tcache.Indexers{},\n\t\tusedFilterForSecret(),\n\t)\n}", "title": "" }, { "docid": "cd5382629027df3c69445d02ea96775b", "score": "0.6121211", "text": "func WithRequiresNodePublishVolumeSecrets() Option {\n\treturn func(o *opts) {\n\t\to.requiresNodePubVolSecrets = true\n\t}\n}", "title": "" }, { "docid": "3e771316d78756f6b668b9bc835f98a9", "score": "0.6031961", "text": "func (s *server) NodePublishVolume(\n\tctx context.Context,\n\treq *csi.NodePublishVolumeRequest) (\n\t*csi.NodePublishVolumeResponse, error) {\n\t// TODO\n}", "title": "" }, { "docid": "8d26c6b43092f5c881e75279fb122084", "score": "0.6014047", "text": "func (d *nodeService) NodePublishVolume(ctx context.Context, req *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error) {\n\t// WARNING: debug only, secrets included\n\t// klog.V(5).Infof(\"NodePublishVolume: called with args %+v\", req)\n\n\tvolumeID := req.GetVolumeId()\n\tklog.V(5).Infof(\"NodePublishVolume: volume_id is %s\", volumeID)\n\n\ttarget := req.GetTargetPath()\n\tif len(target) == 0 {\n\t\treturn nil, status.Error(codes.InvalidArgument, \"Target path not provided\")\n\t}\n\n\tvolCap := req.GetVolumeCapability()\n\tif volCap == nil {\n\t\treturn nil, status.Error(codes.InvalidArgument, \"Volume capability not provided\")\n\t}\n\tklog.V(5).Infof(\"NodePublishVolume: volume_capability is %s\", volCap)\n\n\tif !isValidVolumeCapabilities([]*csi.VolumeCapability{volCap}) {\n\t\treturn nil, status.Error(codes.InvalidArgument, \"Volume capability not supported\")\n\t}\n\n\tklog.V(5).Infof(\"NodePublishVolume: creating dir %s\", target)\n\tif err := os.MkdirAll(target, os.FileMode(0755)); err != nil {\n\t\treturn nil, status.Errorf(codes.Internal, \"Could not create dir %q: %v\", target, err)\n\t}\n\n\toptions := make(map[string]string)\n\tif req.GetReadonly() || req.VolumeCapability.AccessMode.GetMode() == csi.VolumeCapability_AccessMode_MULTI_NODE_READER_ONLY {\n\t\toptions[\"ro\"] = \"\"\n\t}\n\tif m := volCap.GetMount(); m != nil {\n\t\tfor _, f := range m.MountFlags {\n\t\t\toptions[f] = \"\"\n\t\t}\n\t}\n\n\tvolCtx := req.GetVolumeContext()\n\tklog.V(5).Infof(\"NodePublishVolume: volume context: %v\", volCtx)\n\n\tsecrets := req.Secrets\n\tmountOptions := []string{}\n\tif opts, ok := volCtx[\"mountOptions\"]; ok {\n\t\tmountOptions = strings.Split(opts, \",\")\n\t}\n\tfor k, v := range options {\n\t\tif v != \"\" {\n\t\t\tk = fmt.Sprintf(\"%s=%s\", k, v)\n\t\t}\n\t\tmountOptions = append(mountOptions, k)\n\t}\n\n\tklog.V(5).Infof(\"NodePublishVolume: mounting juicefs with secret %+v, options %v\", reflect.ValueOf(secrets).MapKeys(), mountOptions)\n\tjfs, err := d.juicefs.JfsMount(volumeID, target, secrets, volCtx, mountOptions, true)\n\tif err != nil {\n\t\treturn nil, status.Errorf(codes.Internal, \"Could not mount juicefs: %v\", err)\n\t}\n\n\tbindSource, err := jfs.CreateVol(volumeID, volCtx[\"subPath\"])\n\tif err != nil {\n\t\treturn nil, status.Errorf(codes.Internal, \"Could not create volume: %s, %v\", volumeID, err)\n\t}\n\tklog.V(5).Infof(\"NodePublishVolume: binding %s at %s with options %v\", bindSource, target, mountOptions)\n\tif err := d.juicefs.Mount(bindSource, target, fsTypeNone, []string{\"bind\"}); err != nil {\n\t\tos.Remove(target)\n\t\treturn nil, status.Errorf(codes.Internal, \"Could not bind %q at %q: %v\", bindSource, target, err)\n\t}\n\n\tklog.V(5).Infof(\"NodePublishVolume: mounted %s at %s with options %v\", volumeID, target, mountOptions)\n\treturn &csi.NodePublishVolumeResponse{}, nil\n}", "title": "" }, { "docid": "11ee2659cce04a7359bf406180b12554", "score": "0.579442", "text": "func (ns *node) NodePublishVolume(\n\tctx context.Context,\n\treq *csi.NodePublishVolumeRequest,\n) (*csi.NodePublishVolumeResponse, error) {\n\n\tvolumeID := req.GetVolumeId()\n\terr := addVolumeToTransitionList(volumeID, apis.CStorVolumeAttachmentStatusUninitialized)\n\tif err != nil {\n\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t}\n\tdefer removeVolumeFromTransitionList(volumeID)\n\n\tmountOptions := []string{\"bind\"}\n\tif req.GetReadonly() {\n\t\tmountOptions = append(mountOptions, \"ro\")\n\t}\n\tvol, err := utils.GetCStorVolumeAttachment(volumeID + \"-\" + utils.NodeIDENV)\n\tif err != nil {\n\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t}\n\tvol.Spec.Volume.TargetPath = req.GetTargetPath()\n\tif _, err = utils.UpdateCStorVolumeAttachmentCR(vol); err != nil {\n\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t}\n\n\tswitch mode := req.GetVolumeCapability().GetAccessType().(type) {\n\tcase *csi.VolumeCapability_Block:\n\t\tif err := ns.nodePublishVolumeForBlock(req, mountOptions); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\tcase *csi.VolumeCapability_Mount:\n\t\tif err := ns.nodePublishVolumeForFileSystem(req, mountOptions, mode); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn &csi.NodePublishVolumeResponse{}, nil\n}", "title": "" }, { "docid": "5f2c3ecf7abb765b770519b717a0c88f", "score": "0.5729731", "text": "func (s *Service) NodePublishVolume(ctx context.Context, req *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error) {\n\tlogFields := common.GetLogFields(ctx)\n\tvar ephemeralVolume bool\n\tephemeral, ok := req.VolumeContext[\"csi.storage.k8s.io/ephemeral\"]\n\tif ok {\n\t\tephemeralVolume = strings.ToLower(ephemeral) == \"true\"\n\t}\n\n\tif ephemeralVolume {\n\t\treturn s.ephemeralNodePublish(ctx, req)\n\t}\n\t// Get the VolumeID and validate against the volume\n\tid := req.GetVolumeId()\n\tif id == \"\" {\n\t\treturn nil, status.Error(codes.InvalidArgument, \"volume ID is required\")\n\t}\n\n\ttargetPath := req.GetTargetPath()\n\tif targetPath == \"\" {\n\t\treturn nil, status.Error(codes.InvalidArgument, \"targetPath is required\")\n\t}\n\n\tif req.GetVolumeCapability() == nil {\n\t\treturn nil, status.Error(codes.InvalidArgument, \"VolumeCapability is required\")\n\t}\n\n\tif req.GetStagingTargetPath() == \"\" {\n\t\treturn nil, status.Error(codes.InvalidArgument, \"stagingPath is required\")\n\t}\n\n\tid, _, protocol, _ := array.ParseVolumeID(ctx, id, s.DefaultArray(), req.VolumeCapability)\n\n\t// append additional path to be able to do bind mounts\n\tstagingPath := getStagingPath(ctx, req.GetStagingTargetPath(), id)\n\n\tisRO := req.GetReadonly()\n\tvolumeCapability := req.GetVolumeCapability()\n\n\tlogFields[\"ID\"] = id\n\tlogFields[\"TargetPath\"] = targetPath\n\tlogFields[\"StagingPath\"] = stagingPath\n\tlogFields[\"ReadOnly\"] = req.GetReadonly()\n\tctx = common.SetLogFields(ctx, logFields)\n\n\tlog.WithFields(logFields).Info(\"calling publish\")\n\n\tvar publisher VolumePublisher\n\n\tif protocol == \"nfs\" {\n\t\tif s.fileExists(filepath.Join(stagingPath, commonNfsVolumeFolder)) {\n\t\t\t// Assume root squashing is enabled\n\t\t\tstagingPath = filepath.Join(stagingPath, commonNfsVolumeFolder)\n\t\t}\n\n\t\tpublisher = &NFSPublisher{}\n\t} else {\n\t\tpublisher = &SCSIPublisher{\n\t\t\tisBlock: isBlock(req.VolumeCapability),\n\t\t}\n\t}\n\n\treturn publisher.Publish(ctx, logFields, s.Fs, volumeCapability, isRO, targetPath, stagingPath)\n}", "title": "" }, { "docid": "b2082830f5a719ead2e970df62fde7f2", "score": "0.56889814", "text": "func (p VolumePublisher) PublishSecrets(vaultmap *v1alpha1.VaultMap, clientset *kubernetes.Clientset, deployment *v1beta1.Deployment, secrets map[string]string) error {\n\tnamespace := deployment.Namespace\n\n\t// Resolve templates\n\tsecretName, err := ResolveTemplate(deployment, vaultmap.Spec.SecretNamePattern)\n\tif err != nil {\n\t\treturn err\n\t}\n\tsecretFilePath, err := ResolveTemplate(deployment, vaultmap.Spec.SecretsFilePathPattern)\n\tif err != nil {\n\t\treturn err\n\t}\n\tsecretFileName, err := ResolveTemplate(deployment, vaultmap.Spec.SecretsFileNamePattern)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Create full path to secret file\n\tsecretFullPath := path.Join(secretFilePath, secretFileName)\n\n\t// Create json in k8s secrets secrets\n\tjsonSecrets, err := json.Marshal(secrets)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsecret := corev1.Secret{}\n\tif secret.Data == nil {\n\t\tsecret.Data = make(map[string][]byte)\n\t}\n\tsecret.Data[secretFileName] = []byte(jsonSecrets)\n\tsecret.Type = corev1.SecretTypeOpaque\n\tsecret.Name = secretName\n\n\texists, err := secretExists(clientset, namespace, secretName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif exists {\n\t\tlog.Printf(\"Secret %s already exists in namespace %s\", secretName, namespace)\n\t} else {\n\t\tlog.Printf(\"Creating secret %s in namespace %s\", secretName, namespace)\n\t\t_, err = clientset.CoreV1().Secrets(namespace).Create(&secret)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Create volume pointing to secrets\n\tvolume := corev1.Volume{}\n\tvolume.Name = \"secrets\"\n\tvolume.Secret = &corev1.SecretVolumeSource{SecretName: secretName}\n\tdeployment.Spec.Template.Spec.Volumes = append(deployment.Spec.Template.Spec.Volumes, volume)\n\n\t// Add volume to container\n\n\tmount := corev1.VolumeMount{}\n\tmount.Name = \"secrets\"\n\tmount.MountPath = secretFullPath\n\tmount.ReadOnly = true\n\tmount.SubPath = secretFileName\n\tdeployment.Spec.Template.Spec.Containers[0].VolumeMounts = append(deployment.Spec.Template.Spec.Containers[0].VolumeMounts, mount)\n\n\treturn nil\n}", "title": "" }, { "docid": "d82f8bc9bfe8f57321862a905ad2b4cc", "score": "0.56360394", "text": "func (o CSIPersistentVolumeSourceOutput) ControllerPublishSecretRef() SecretReferencePtrOutput {\n\treturn o.ApplyT(func(v CSIPersistentVolumeSource) *SecretReference { return v.ControllerPublishSecretRef }).(SecretReferencePtrOutput)\n}", "title": "" }, { "docid": "f943f168ab4ff8ba3e47dcbf98cbc1ec", "score": "0.563397", "text": "func (s *serverSpecValidator) nodePublishVolume(\n\tctx context.Context,\n\treq *csi.NodePublishVolumeRequest) (\n\t*csi.NodePublishVolumeResponse, error) {\n\n\tif req.VolumeId == \"\" {\n\t\treturn ErrNodePublishVolume(\n\t\t\tcsi.Error_NodePublishVolumeError_INVALID_VOLUME_ID,\n\t\t\t\"volume id required\"), nil\n\t}\n\n\tif s.opts[VolumeAttributesRequired] && len(req.VolumeAttributes) == 0 {\n\t\treturn ErrNodePublishVolumeGeneral(\n\t\t\tcsi.Error_GeneralError_MISSING_REQUIRED_FIELD,\n\t\t\t\"volume attributes required\"), nil\n\t}\n\n\tif s.opts[PublishVolumeInfoRequired] && len(req.PublishVolumeInfo) == 0 {\n\t\treturn ErrNodePublishVolumeGeneral(\n\t\t\tcsi.Error_GeneralError_MISSING_REQUIRED_FIELD,\n\t\t\t\"publish volume info required\"), nil\n\t}\n\n\tif req.VolumeCapability == nil {\n\t\treturn ErrNodePublishVolumeGeneral(\n\t\t\tcsi.Error_GeneralError_MISSING_REQUIRED_FIELD,\n\t\t\t\"volume capability required\"), nil\n\t}\n\n\tif req.VolumeCapability.AccessMode == nil {\n\t\treturn ErrNodePublishVolumeGeneral(\n\t\t\tcsi.Error_GeneralError_MISSING_REQUIRED_FIELD,\n\t\t\t\"access mode required\"), nil\n\t}\n\tatype := req.VolumeCapability.GetAccessType()\n\tif atype == nil {\n\t\treturn ErrNodePublishVolumeGeneral(\n\t\t\tcsi.Error_GeneralError_MISSING_REQUIRED_FIELD,\n\t\t\t\"access type required\"), nil\n\t}\n\tswitch tatype := atype.(type) {\n\tcase *csi.VolumeCapability_Block:\n\t\tif tatype.Block == nil {\n\t\t\treturn ErrNodePublishVolumeGeneral(\n\t\t\t\tcsi.Error_GeneralError_MISSING_REQUIRED_FIELD,\n\t\t\t\t\"block type required\"), nil\n\t\t}\n\tcase *csi.VolumeCapability_Mount:\n\t\tif tatype.Mount == nil {\n\t\t\treturn ErrNodePublishVolumeGeneral(\n\t\t\t\tcsi.Error_GeneralError_MISSING_REQUIRED_FIELD,\n\t\t\t\t\"mount type required\"), nil\n\t\t}\n\tdefault:\n\t\treturn ErrNodePublishVolume(\n\t\t\tcsi.Error_NodePublishVolumeError_UNKNOWN,\n\t\t\tfmt.Sprintf(\"invalid access type: %T\", atype)), nil\n\t}\n\n\tif req.TargetPath == \"\" {\n\t\treturn ErrNodePublishVolumeGeneral(\n\t\t\tcsi.Error_GeneralError_MISSING_REQUIRED_FIELD,\n\t\t\t\"target path required\"), nil\n\t}\n\n\tif s.opts[NodePublishVolumeCredentialsRequired] &&\n\t\tlen(req.UserCredentials) == 0 {\n\n\t\treturn ErrNodePublishVolumeGeneral(\n\t\t\tcsi.Error_GeneralError_MISSING_REQUIRED_FIELD,\n\t\t\t\"user credentials required\"), nil\n\t}\n\n\treturn nil, nil\n}", "title": "" }, { "docid": "b3b5e351e712cb8a8de4236d39c67ecf", "score": "0.56191427", "text": "func (o CSIPersistentVolumeSourcePtrOutput) ControllerPublishSecretRef() SecretReferencePtrOutput {\n\treturn o.ApplyT(func(v CSIPersistentVolumeSource) *SecretReference { return v.ControllerPublishSecretRef }).(SecretReferencePtrOutput)\n}", "title": "" }, { "docid": "663050e9a69f9ba088c7ac225350963d", "score": "0.5525514", "text": "func (d *Driver) NodePublishVolume(ctx context.Context, req *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error) {\n\tif req.GetVolumeCapability() == nil {\n\t\treturn nil, status.Error(codes.InvalidArgument, \"Volume capability missing in request\")\n\t}\n\tif len(req.GetVolumeId()) == 0 {\n\t\treturn nil, status.Error(codes.InvalidArgument, \"Volume ID missing in request\")\n\t}\n\n\tsource := req.GetStagingTargetPath()\n\tif len(source) == 0 {\n\t\treturn nil, status.Error(codes.InvalidArgument, \"Staging target not provided\")\n\t}\n\n\ttarget := req.GetTargetPath()\n\tif len(target) == 0 {\n\t\treturn nil, status.Error(codes.InvalidArgument, \"Target path not provided\")\n\t}\n\n\tnotMnt, err := d.mounter.IsLikelyNotMountPoint(target)\n\tif err != nil && !os.IsNotExist(err) {\n\t\tklog.V(2).Infof(\"azureDisk - cannot validate mount point for on %s, error: %v\", target, err)\n\t\treturn nil, err\n\t}\n\n\tif !notMnt {\n\t\t// testing original mount point, make sure the mount link is valid\n\t\t_, err := ioutil.ReadDir(target)\n\t\tif err == nil {\n\t\t\tklog.V(2).Infof(\"azureDisk - already mounted to target %s\", target)\n\t\t\treturn &csi.NodePublishVolumeResponse{}, nil\n\t\t}\n\t\t// mount link is invalid, now unmount and remount later\n\t\tklog.Warningf(\"azureDisk - ReadDir %s failed with %v, unmount this directory\", target, err)\n\t\tif err := d.mounter.Unmount(target); err != nil {\n\t\t\tklog.Errorf(\"azureDisk - Unmount directory %s failed with %v\", target, err)\n\t\t\treturn nil, err\n\t\t}\n\t\t// notMnt = true\n\t}\n\n\tif runtime.GOOS != \"windows\" {\n\t\t// in windows, we will use mklink to mount, will MkdirAll in Mount func\n\t\tif err := os.MkdirAll(target, 0750); err != nil {\n\t\t\tklog.Errorf(\"azureDisk - mkdir failed on target: %s (%v)\", target, err)\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// todo: looks like here fsType is useless since we only use \"fsType\" in VolumeContext\n\tfsType := req.GetVolumeCapability().GetMount().GetFsType()\n\n\treadOnly := req.GetReadonly()\n\tvolumeID := req.GetVolumeId()\n\tattrib := req.GetVolumeContext()\n\tmountFlags := req.GetVolumeCapability().GetMount().GetMountFlags()\n\n\tklog.V(2).Infof(\"target %v\\nfstype %v\\n\\nreadonly %v\\nvolumeId %v\\nContext %v\\nmountflags %v\\n\",\n\t\ttarget, fsType, readOnly, volumeID, attrib, mountFlags)\n\n\tmountOptions := []string{\"bind\"}\n\tif req.GetReadonly() {\n\t\tmountOptions = append(mountOptions, \"ro\")\n\t}\n\tmountOptions = util.JoinMountOptions(mountFlags, mountOptions)\n\n\tklog.V(2).Infof(\"NodePublishVolume: creating dir %s\", target)\n\tif err := d.mounter.MakeDir(target); err != nil {\n\t\treturn nil, status.Errorf(codes.Internal, \"Could not create dir %q: %v\", target, err)\n\t}\n\n\tklog.V(2).Infof(\"NodePublishVolume: mounting %s at %s\", source, target)\n\tif err := d.mounter.Mount(source, target, \"ext4\", mountOptions); err != nil {\n\t\tos.Remove(target)\n\t\treturn nil, status.Errorf(codes.Internal, \"Could not mount %q at %q: %v\", source, target, err)\n\t}\n\tklog.V(2).Infof(\"NodePublishVolume: mount %s at %s successfully\", source, target)\n\n\treturn &csi.NodePublishVolumeResponse{}, nil\n}", "title": "" }, { "docid": "8f74ced5ba6472738dca55207f89220a", "score": "0.5488911", "text": "func (o CSIPersistentVolumeSourcePtrOutput) NodeStageSecretRef() SecretReferencePtrOutput {\n\treturn o.ApplyT(func(v CSIPersistentVolumeSource) *SecretReference { return v.NodeStageSecretRef }).(SecretReferencePtrOutput)\n}", "title": "" }, { "docid": "e5c06d4cd03db4fb4b168e6b0dd46e1a", "score": "0.54746777", "text": "func (o CSIPersistentVolumeSourceOutput) NodeStageSecretRef() SecretReferencePtrOutput {\n\treturn o.ApplyT(func(v CSIPersistentVolumeSource) *SecretReference { return v.NodeStageSecretRef }).(SecretReferencePtrOutput)\n}", "title": "" }, { "docid": "fa09f0de6f01c71e6745b479592525df", "score": "0.5214324", "text": "func (o GetContainerSecretRefOutput) SecretRef() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v GetContainerSecretRef) *string { return v.SecretRef }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "1bede9383c40146282fb9e63fa698d81", "score": "0.51265216", "text": "func (o ContainerV1SecretRefOutput) SecretRef() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ContainerV1SecretRef) string { return v.SecretRef }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "f08342394b3aef0fd676b6bdf8067c4c", "score": "0.503579", "text": "func (o ScaleIOPersistentVolumeSourcePtrOutput) SecretRef() SecretReferencePtrOutput {\n\treturn o.ApplyT(func(v ScaleIOPersistentVolumeSource) *SecretReference { return v.SecretRef }).(SecretReferencePtrOutput)\n}", "title": "" }, { "docid": "aa4e36d399adf4f583701789794871a4", "score": "0.4986448", "text": "func (o StorageOSPersistentVolumeSourcePtrOutput) SecretRef() ObjectReferencePtrOutput {\n\treturn o.ApplyT(func(v StorageOSPersistentVolumeSource) *ObjectReference { return v.SecretRef }).(ObjectReferencePtrOutput)\n}", "title": "" }, { "docid": "11765271352c56b4fa67564d21184947", "score": "0.4947536", "text": "func (o ScaleIOPersistentVolumeSourceOutput) SecretRef() SecretReferencePtrOutput {\n\treturn o.ApplyT(func(v ScaleIOPersistentVolumeSource) *SecretReference { return v.SecretRef }).(SecretReferencePtrOutput)\n}", "title": "" }, { "docid": "57f0bfabd3ffa4bf6fca9f93bc640ac1", "score": "0.49464262", "text": "func (s *Service) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpublishVolumeRequest) (*csi.NodeUnpublishVolumeResponse, error) {\n\tlogFields := common.GetLogFields(ctx)\n\tvar err error\n\n\ttargetPath := req.GetTargetPath()\n\tif targetPath == \"\" {\n\t\tlog.Error(\"target path required\")\n\t\treturn nil, status.Error(codes.InvalidArgument, \"target path required\")\n\t}\n\tvolID := req.GetVolumeId()\n\tif volID == \"\" {\n\t\treturn nil, status.Error(codes.InvalidArgument, \"volume ID is required\")\n\t}\n\n\tvar ephemeralVolume bool\n\tlockFile := ephemeralStagingMountPath + volID + \"/id\"\n\n\tif s.fileExists(lockFile) {\n\t\tephemeralVolume = true\n\t}\n\tlogFields[\"ID\"] = volID\n\tlogFields[\"TargetPath\"] = targetPath\n\tctx = common.SetLogFields(ctx, logFields)\n\tlog.WithFields(logFields).Info(\"calling unpublish\")\n\n\t_, found, err := getTargetMount(ctx, targetPath, s.Fs)\n\tif err != nil {\n\t\treturn nil, status.Errorf(codes.Internal,\n\t\t\t\"could not reliably determine existing mount status for path %s: %s\",\n\t\t\ttargetPath, err.Error())\n\t}\n\n\tif !found {\n\t\t// no mounts\n\t\tlog.WithFields(logFields).Infof(\"no mounts found\")\n\t\treturn &csi.NodeUnpublishVolumeResponse{}, nil\n\t}\n\n\tlog.WithFields(logFields).Infof(\"active mount exist\")\n\terr = s.Fs.GetUtil().Unmount(ctx, targetPath)\n\tif err != nil {\n\t\treturn nil, status.Errorf(codes.Internal,\n\t\t\t\"could not unmount dev %s: %s\",\n\t\t\ttargetPath, err.Error())\n\t}\n\n\tlog.WithFields(logFields).Info(\"unpublish complete\")\n\tlog.Debug(\"Checking for ephemeral after node unpublish\")\n\n\tif ephemeralVolume {\n\t\tlog.Info(\"Detected ephemeral\")\n\t\terr = s.ephemeralNodeUnpublish(ctx, req)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t}\n\n\treturn &csi.NodeUnpublishVolumeResponse{}, nil\n}", "title": "" }, { "docid": "971195fd75c1bf4fa94af2d8ef579962", "score": "0.49241117", "text": "func (c *Composite) SetWriteConnectionSecretToReference(ref *xpv1.SecretReference) {\n\t_ = fieldpath.Pave(c.Object).SetValue(\"spec.writeConnectionSecretToRef\", ref)\n}", "title": "" }, { "docid": "96b9840516ba4873948088d0680da928", "score": "0.49180773", "text": "func (o StorageOSPersistentVolumeSourceOutput) SecretRef() ObjectReferencePtrOutput {\n\treturn o.ApplyT(func(v StorageOSPersistentVolumeSource) *ObjectReference { return v.SecretRef }).(ObjectReferencePtrOutput)\n}", "title": "" }, { "docid": "8b94442242c31cb45de96ab6f04522e1", "score": "0.4907194", "text": "func (mg *VirtualNetworkRule) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) {\n\tmg.Spec.WriteConnectionSecretToReference = r\n}", "title": "" }, { "docid": "7cfbf5092ffb61c3c6a654a55200f8f5", "score": "0.4835531", "text": "func (n *NopPubSub) Publish(fromID, key string) error {\n\treturn nil\n}", "title": "" }, { "docid": "5a5bea3c3acc51df6e903ac60831250c", "score": "0.48268318", "text": "func (o RBDPersistentVolumeSourcePtrOutput) SecretRef() SecretReferencePtrOutput {\n\treturn o.ApplyT(func(v RBDPersistentVolumeSource) *SecretReference { return v.SecretRef }).(SecretReferencePtrOutput)\n}", "title": "" }, { "docid": "6c304461cbf6d770def2a729d62c4fbc", "score": "0.4824144", "text": "func (o FlexPersistentVolumeSourcePtrOutput) SecretRef() SecretReferencePtrOutput {\n\treturn o.ApplyT(func(v FlexPersistentVolumeSource) *SecretReference { return v.SecretRef }).(SecretReferencePtrOutput)\n}", "title": "" }, { "docid": "ae7806fce08a2f3e8db1e270c15066f8", "score": "0.48216048", "text": "func (b *Broker) Publish(signature *tasks.Signature) error {\n\treturn errors.New(\"Not implemented\")\n}", "title": "" }, { "docid": "2277501bc8488ace7598aad31707c81c", "score": "0.4817903", "text": "func (d *Driver) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpublishVolumeRequest) (*csi.NodeUnpublishVolumeResponse, error) {\n\tif len(req.GetVolumeId()) == 0 {\n\t\treturn nil, status.Error(codes.InvalidArgument, \"Volume ID missing in request\")\n\t}\n\tif len(req.GetTargetPath()) == 0 {\n\t\treturn nil, status.Error(codes.InvalidArgument, \"Target path missing in request\")\n\t}\n\ttargetPath := req.GetTargetPath()\n\tvolumeID := req.GetVolumeId()\n\n\tklog.V(2).Infof(\"NodeUnpublishVolume: unmounting volume %s on %s\", volumeID, targetPath)\n\terr := d.mounter.Unmount(req.GetTargetPath())\n\tif err != nil {\n\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t}\n\tklog.V(2).Infof(\"NodeUnpublishVolume: unmount volume %s on %s successfully\", volumeID, targetPath)\n\n\treturn &csi.NodeUnpublishVolumeResponse{}, nil\n}", "title": "" }, { "docid": "b0ba7c11414063bde13a9b8f16c01453", "score": "0.4816956", "text": "func (p *PubsubService) Publish(ctx context.Context, arg *String) (*String, error) {\n\tp.pub.Publish(arg.GetValue())\n\treturn &String{}, nil\n}", "title": "" }, { "docid": "16641c409bcd627c929fc76355c9ecf9", "score": "0.48131615", "text": "func (m *MockNodeSync) PublishNodeIPs(addresses contivconf.IPsWithNetworks, version contivconf.IPVersion) error {\n\treturn nil\n}", "title": "" }, { "docid": "7a7cd9b9a9187dcbc59b2e13f06ac09c", "score": "0.48126003", "text": "func (mg *FlexibleServerConfiguration) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) {\n\tmg.Spec.WriteConnectionSecretToReference = r\n}", "title": "" }, { "docid": "8ee9a0ae5c20311944b882447151b31a", "score": "0.480524", "text": "func (o CephFSPersistentVolumeSourcePtrOutput) SecretRef() SecretReferencePtrOutput {\n\treturn o.ApplyT(func(v CephFSPersistentVolumeSource) *SecretReference { return v.SecretRef }).(SecretReferencePtrOutput)\n}", "title": "" }, { "docid": "c6b7e3af62cb2722ea3ce60c2b593c54", "score": "0.48005268", "text": "func (mg *FlexibleServer) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) {\n\tmg.Spec.WriteConnectionSecretToReference = r\n}", "title": "" }, { "docid": "190f3b4dd96f080cecea65791b8deb46", "score": "0.47865698", "text": "func (local *Node) Publish(key string) (done chan bool, err error) {\n\tOut.Printf(\"Publishing key %s at %v\\n\", key, local)\n\n\t// get hash of key to use as ID\n\tkeyID := Hash(key)\n\n\terr = local.publishOnce(key, keyID)\n\tif err != nil {\n\t\tDebug.Printf(\"Initial object publish failed: %v\", err)\n\t\treturn nil, err\n\t}\n\n\t// create channel for indicating done, and then create a goroutine which\n\t// will publish until \"done\" is sent on that channel\n\tdone = make(chan bool)\n\tgo local.periodicallyPublish(key, keyID, done)\n\n\treturn done, nil\n}", "title": "" }, { "docid": "c18cad6245be0f74a138c2006741d073", "score": "0.4781917", "text": "func (o CinderPersistentVolumeSourcePtrOutput) SecretRef() SecretReferencePtrOutput {\n\treturn o.ApplyT(func(v CinderPersistentVolumeSource) *SecretReference { return v.SecretRef }).(SecretReferencePtrOutput)\n}", "title": "" }, { "docid": "b2aadcfe8e15af91ff93bebb002e028b", "score": "0.47758397", "text": "func (o *NotificationTriggerWebhookAllOf) SetSecret(v string) {\n\to.Secret = &v\n}", "title": "" }, { "docid": "da5d06273814f8c917d419aba2f8f572", "score": "0.47617328", "text": "func (o FlexPersistentVolumeSourceOutput) SecretRef() SecretReferencePtrOutput {\n\treturn o.ApplyT(func(v FlexPersistentVolumeSource) *SecretReference { return v.SecretRef }).(SecretReferencePtrOutput)\n}", "title": "" }, { "docid": "57e9ed882755f2c3b18cd83416426fb2", "score": "0.47592095", "text": "func (mg *Server) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) {\n\tmg.Spec.WriteConnectionSecretToReference = r\n}", "title": "" }, { "docid": "3536dc5bf4ae81ba7d93bc888fbf7784", "score": "0.47487885", "text": "func (o ISCSIPersistentVolumeSourcePtrOutput) SecretRef() SecretReferencePtrOutput {\n\treturn o.ApplyT(func(v ISCSIPersistentVolumeSource) *SecretReference { return v.SecretRef }).(SecretReferencePtrOutput)\n}", "title": "" }, { "docid": "35c72eaba7e285c9e879217e0f481684", "score": "0.47421747", "text": "func (o RBDPersistentVolumeSourceOutput) SecretRef() SecretReferencePtrOutput {\n\treturn o.ApplyT(func(v RBDPersistentVolumeSource) *SecretReference { return v.SecretRef }).(SecretReferencePtrOutput)\n}", "title": "" }, { "docid": "389874662bc85992d152f558b77b39dd", "score": "0.47381702", "text": "func (ns *NetworkServer) Publish(ctx context.Context, down *ttnpb.DownlinkMessage) error {\n\tclient := ttnpb.NewNsPbaClient(ns.LoopbackConn())\n\t_, err := client.PublishDownlink(ctx, down, ns.WithClusterAuth())\n\treturn err\n}", "title": "" }, { "docid": "b8daf08614e230c045b1679b4f2a0b96", "score": "0.47310507", "text": "func (o CinderPersistentVolumeSourceOutput) SecretRef() SecretReferencePtrOutput {\n\treturn o.ApplyT(func(v CinderPersistentVolumeSource) *SecretReference { return v.SecretRef }).(SecretReferencePtrOutput)\n}", "title": "" }, { "docid": "0e0c9fa9ee148fc8d6dde6324dba68e4", "score": "0.4730663", "text": "func (o CephFSPersistentVolumeSourceOutput) SecretRef() SecretReferencePtrOutput {\n\treturn o.ApplyT(func(v CephFSPersistentVolumeSource) *SecretReference { return v.SecretRef }).(SecretReferencePtrOutput)\n}", "title": "" }, { "docid": "c677f3774339f6b45c7d91b1d3963f60", "score": "0.47034585", "text": "func WithRequiresControllerPublishVolumeSecrets() Option {\n\treturn func(o *opts) {\n\t\to.requiresCtlrPubVolSecrets = true\n\t}\n}", "title": "" }, { "docid": "80be60712074142ee4473647b7d65270", "score": "0.47003287", "text": "func (i *PostgreSQLInstance) SetWriteConnectionSecretToReference(r corev1.LocalObjectReference) {\n\ti.Spec.WriteConnectionSecretToReference = r\n}", "title": "" }, { "docid": "fae502bae07d867465869dcabd67823b", "score": "0.46972698", "text": "func (mg *ServerKey) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) {\n\tmg.Spec.WriteConnectionSecretToReference = r\n}", "title": "" }, { "docid": "17f9ac8c2a1ead0017c2868f1e677894", "score": "0.4691311", "text": "func (d *nodeService) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpublishVolumeRequest) (*csi.NodeUnpublishVolumeResponse, error) {\n\tklog.V(4).Infof(\"NodeUnpublishVolume: called with args %+v\", req)\n\n\ttarget := req.GetTargetPath()\n\tif len(target) == 0 {\n\t\treturn nil, status.Error(codes.InvalidArgument, \"Target path not provided\")\n\t}\n\n\tvolumeId := req.GetVolumeId()\n\tklog.V(5).Infof(\"NodeUnpublishVolume: volume_id is %s\", volumeId)\n\n\texists, err := mount.PathExists(target)\n\tnotMnt, corruptedMnt := true, false\n\tif exists && err == nil {\n\t\tnotMnt, err = mount.IsNotMountPoint(d.juicefs, target)\n\t\tif err != nil {\n\t\t\treturn nil, status.Errorf(codes.Internal, \"Check target path is mountpoint failed: %q\", err)\n\t\t}\n\t\tif notMnt { // target exists but not a mountpoint\n\t\t\tklog.V(5).Infof(\"NodeUnpublishVolume: target %s not mounted\", target)\n\t\t}\n\t} else if err != nil {\n\t\tif corruptedMnt = mount.IsCorruptedMnt(err); !corruptedMnt {\n\t\t\treturn nil, status.Errorf(codes.Internal, \"Check target path %s failed: %q\", target, err)\n\t\t}\n\t\tklog.V(5).Infof(\"NodeUnpublishVolume: target %s is a corrupted mountpoint\", target)\n\t}\n\n\tif !notMnt || corruptedMnt {\n\t\tklog.V(5).Infof(\"NodeUnpublishVolume: unmounting %s\", target)\n\t\tfor {\n\t\t\t//err = d.juicefs.Unmount(target)\n\t\t\tout, err := exec.Command(\"umount\", target).CombinedOutput()\n\t\t\tif err == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif !strings.Contains(string(out), \"not mounted\") && !strings.Contains(string(out), \"mountpoint not found\") {\n\t\t\t\tklog.V(5).Infof(\"Unmount %s failed: %q, try to lazy unmount\", target, err)\n\t\t\t\toutput, err1 := exec.Command(\"umount\", \"-l\", target).CombinedOutput()\n\t\t\t\tif err1 != nil {\n\t\t\t\t\treturn nil, status.Errorf(codes.Internal, \"Could not lazy unmount %q: %v, output: %s\", target, err1, string(output))\n\t\t\t\t}\n\t\t\t}\n\t\t\tklog.V(5).Infof(\"umount:%s success\", target)\n\t\t\tbreak\n\t\t}\n\t}\n\t// Related issue: https://github.com/kubernetes/kubernetes/issues/60987\n\tif exists {\n\t\tklog.V(5).Infof(\"NodeUnpublishVolume: remove target %s\", target)\n\t\tif err = os.Remove(target); err != nil {\n\t\t\tklog.V(5).Infof(\"Remove target directory %s failed: %q\", target, err)\n\t\t}\n\t}\n\n\tmnt := podmount.NewPodMount(nil, d.k8sClient)\n\tif err := mnt.JUmount(volumeId, target); err != nil {\n\t\treturn &csi.NodeUnpublishVolumeResponse{}, err\n\t}\n\n\treturn &csi.NodeUnpublishVolumeResponse{}, nil\n}", "title": "" }, { "docid": "c87c9d9b095ce1c8bc6b497373750473", "score": "0.46880648", "text": "func (gs *GatewayServer) Publish(ctx context.Context, up *ttnpb.GatewayUplinkMessage) error {\n\tclient := ttnpb.NewGsPbaClient(gs.LoopbackConn())\n\t_, err := client.PublishUplink(ctx, up, gs.WithClusterAuth())\n\treturn err\n}", "title": "" }, { "docid": "85dcf1aa86190653b124824fddd8d308", "score": "0.46846065", "text": "func (c *Claim) SetWriteConnectionSecretToReference(ref *xpv1.LocalSecretReference) {\n\t_ = fieldpath.Pave(c.Object).SetValue(\"spec.writeConnectionSecretToRef\", ref)\n}", "title": "" }, { "docid": "611b4656a57b101c3b24ea3f488ab015", "score": "0.46822396", "text": "func (_options *ReplaceObjectOptions) SetPublish(publish *PublishObject) *ReplaceObjectOptions {\n\t_options.Publish = publish\n\treturn _options\n}", "title": "" }, { "docid": "53aaebac525afb06fa72b9b38f90a86f", "score": "0.46771818", "text": "func (mg *Configuration) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) {\n\tmg.Spec.WriteConnectionSecretToReference = r\n}", "title": "" }, { "docid": "00a7888199a30f23d6df72b67b66016b", "score": "0.46740404", "text": "func (n *OpenBazaarNode) Publish(done chan<- struct{}) {\n\tgo func() {\n\t\t<-n.initialBootstrapChan\n\t\tn.publishChan <- pubCloser{done}\n\t}()\n}", "title": "" }, { "docid": "78747acf194ca4a56573a96774803499", "score": "0.46738374", "text": "func (b *Broker) Publish(message string, data interface{}) error {\n\treturn b.PublishWithConfig(message, data, nsq.NewConfig())\n}", "title": "" }, { "docid": "6b2572acef4390476e910df797339d6b", "score": "0.4671682", "text": "func (mg *SourceRepresentationInstance) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) {\n\tmg.Spec.WriteConnectionSecretToReference = r\n}", "title": "" }, { "docid": "abdbb60512412b90d40509292de1dc02", "score": "0.46641138", "text": "func (mg *FlexibleServerFirewallRule) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) {\n\tmg.Spec.WriteConnectionSecretToReference = r\n}", "title": "" }, { "docid": "f4a0c55e9f03f6c83bec8e92848dbc74", "score": "0.46625522", "text": "func (o StorageOSVolumeSourcePtrOutput) SecretRef() LocalObjectReferencePtrOutput {\n\treturn o.ApplyT(func(v StorageOSVolumeSource) *LocalObjectReference { return v.SecretRef }).(LocalObjectReferencePtrOutput)\n}", "title": "" }, { "docid": "519cbb8e2939ad4be9d261818b0e2eb5", "score": "0.46622816", "text": "func (o ISCSIPersistentVolumeSourceOutput) SecretRef() SecretReferencePtrOutput {\n\treturn o.ApplyT(func(v ISCSIPersistentVolumeSource) *SecretReference { return v.SecretRef }).(SecretReferencePtrOutput)\n}", "title": "" }, { "docid": "d7d3162dd298a7455cfd3fa7d9a282c0", "score": "0.4662108", "text": "func (c *defaultControl) mayReleaseSecret(secretBindingNamespace, secretBindingName, secretNamespace, secretName string) (bool, error) {\n\tsecretBindingList, err := c.secretBindingLister.List(labels.Everything())\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tfor _, secretBinding := range secretBindingList {\n\t\tif secretBinding.Namespace == secretBindingNamespace && secretBinding.Name == secretBindingName {\n\t\t\tcontinue\n\t\t}\n\t\tif secretBinding.SecretRef.Namespace == secretNamespace && secretBinding.SecretRef.Name == secretName {\n\t\t\treturn false, nil\n\t\t}\n\t}\n\n\treturn true, nil\n}", "title": "" }, { "docid": "0c2b1bd32097dabd4539ca661b59ab10", "score": "0.46610117", "text": "func (t Nodejs) Publish(ctx context.Context, tag string) error {\n\tc, err := dagger.Connect(ctx, dagger.WithLogOutput(os.Stderr))\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer c.Close()\n\n\tc = c.Pipeline(\"sdk\").Pipeline(\"nodejs\").Pipeline(\"publish\")\n\n\tvar (\n\t\tversion = strings.TrimPrefix(tag, \"sdk/nodejs/v\")\n\t\ttoken, _ = util.WithSetHostVar(ctx, c.Host(), \"NPM_TOKEN\").Secret().Plaintext(ctx)\n\t)\n\n\tbuild := nodeJsBase(c).WithExec([]string{\"npm\", \"run\", \"build\"})\n\n\t// configure .npmrc\n\tnpmrc := fmt.Sprintf(`//registry.npmjs.org/:_authToken=%s\nregistry=https://registry.npmjs.org/\nalways-auth=true`, token)\n\tif err = os.WriteFile(\"sdk/nodejs/.npmrc\", []byte(npmrc), 0o600); err != nil {\n\t\treturn err\n\t}\n\n\t// set version & publish\n\t_, err = build.\n\t\tWithExec([]string{\"npm\", \"version\", version}).\n\t\tWithExec([]string{\"npm\", \"publish\", \"--access\", \"public\"}).\n\t\tExitCode(ctx)\n\n\treturn err\n}", "title": "" }, { "docid": "577621ac14f81d67b8214a8688466097", "score": "0.46595922", "text": "func (o OrderV1Output) SecretRef() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *OrderV1) pulumi.StringOutput { return v.SecretRef }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "68d910821fed308b736fb3a759ad7940", "score": "0.46464732", "text": "func (o StorageOSVolumeSourceOutput) SecretRef() LocalObjectReferencePtrOutput {\n\treturn o.ApplyT(func(v StorageOSVolumeSource) *LocalObjectReference { return v.SecretRef }).(LocalObjectReferencePtrOutput)\n}", "title": "" }, { "docid": "9ea6104382809d3e12fd3e55014a1338", "score": "0.46394777", "text": "func (o GetSecretResultOutput) SecretRef() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetSecretResult) string { return v.SecretRef }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "4be414596fbacebea8c15f6acf6c9ada", "score": "0.46211082", "text": "func (b *Broker) Publish(channel string, data interface{}) {\n\tb.dataChan <- &envData{false, nil, &Message{channel, data}}\n}", "title": "" }, { "docid": "2a332a38934888ba64187af4c8c58959", "score": "0.46011475", "text": "func (mg *SSLCert) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) {\n\tmg.Spec.WriteConnectionSecretToReference = r\n}", "title": "" }, { "docid": "12725a9c577da37264de3585bf52c1e9", "score": "0.4598315", "text": "func (o ScaleIOVolumeSourcePtrOutput) SecretRef() LocalObjectReferencePtrOutput {\n\treturn o.ApplyT(func(v ScaleIOVolumeSource) *LocalObjectReference { return v.SecretRef }).(LocalObjectReferencePtrOutput)\n}", "title": "" }, { "docid": "372558af92aaed754c671eba9ebc45e0", "score": "0.4595443", "text": "func (mg *FlexibleServerDatabase) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) {\n\tmg.Spec.WriteConnectionSecretToReference = r\n}", "title": "" }, { "docid": "201b19069f5280acb00492f1ae9f9fe6", "score": "0.45818654", "text": "func (mg *DatabaseInstance) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) {\n\tmg.Spec.WriteConnectionSecretToReference = r\n}", "title": "" }, { "docid": "c273abc040535e4cdf84e56615800f13", "score": "0.45692638", "text": "func (manager *connectionManager) ResolveSecret(provider plugin_v1.Provider, id string, value []byte) {\n\tlog.Printf(\"Example-plugin ConnectionManager: Resolve secret manager event: %s = %s\", id, string(value))\n}", "title": "" }, { "docid": "7c0251d87f2dadf788fc8746813e6539", "score": "0.45671588", "text": "func (mg *User) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) {\n\tmg.Spec.WriteConnectionSecretToReference = r\n}", "title": "" }, { "docid": "3c620800bc74ae48a36d609b754ad801", "score": "0.45667082", "text": "func (mg *FirewallRule) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) {\n\tmg.Spec.WriteConnectionSecretToReference = r\n}", "title": "" }, { "docid": "7ed871af078b7a33e743b061f2495d81", "score": "0.45618278", "text": "func (mg *ActiveDirectoryAdministrator) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) {\n\tmg.Spec.WriteConnectionSecretToReference = r\n}", "title": "" }, { "docid": "9c218782f9694420363be603e60b6c77", "score": "0.45436853", "text": "func TestPublish(t *testing.T) {\n\ttestPublish(t, data.ECDSAKey)\n\tif !testing.Short() {\n\t\ttestPublish(t, data.RSAKey)\n\t}\n}", "title": "" }, { "docid": "7e264a445f959a5d24198b1d03e8738b", "score": "0.45420125", "text": "func (c *Client) Publish(key string, value string) error {\n\tconn := c.pool.Get()\n\t_, err := conn.Do(\"PUBLISH\", key, value)\n\treturn err\n}", "title": "" }, { "docid": "a28ebeac945376534e666d72b910ce7c", "score": "0.45375836", "text": "func ConnSecretRef() reference.ExtractValueFn {\n\treturn func(mg resource.Managed) string {\n\t\tcr, ok := mg.(*rcv2.ResourceKey)\n\t\tif !ok {\n\t\t\treturn \"\"\n\t\t}\n\t\treturn namespacedNameToJSONString(cr.Spec.WriteConnectionSecretToReference.Namespace, cr.Spec.WriteConnectionSecretToReference.Name)\n\t}\n}", "title": "" }, { "docid": "b026001032043a6edd39e96ab6af1f4a", "score": "0.4528125", "text": "func (o ScaleIOVolumeSourceOutput) SecretRef() LocalObjectReferencePtrOutput {\n\treturn o.ApplyT(func(v ScaleIOVolumeSource) *LocalObjectReference { return v.SecretRef }).(LocalObjectReferencePtrOutput)\n}", "title": "" }, { "docid": "5bcf4a79a4d73ef61e36cfbb7e36318d", "score": "0.45264396", "text": "func (o *LinkTokenCreateRequest) SetSecret(v string) {\n\to.Secret = &v\n}", "title": "" }, { "docid": "bc89d5a3fdcf4d4e823d1ea977f41950", "score": "0.4524979", "text": "func (o *ExtrasWebhooksListParams) SetSecretn(secretn *string) {\n\to.Secretn = secretn\n}", "title": "" }, { "docid": "f61ccc614ca8d8e22f5e10e1982e9962", "score": "0.4522963", "text": "func (mg *Database) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) {\n\tmg.Spec.WriteConnectionSecretToReference = r\n}", "title": "" }, { "docid": "f61ccc614ca8d8e22f5e10e1982e9962", "score": "0.4522963", "text": "func (mg *Database) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) {\n\tmg.Spec.WriteConnectionSecretToReference = r\n}", "title": "" }, { "docid": "7fb69d4453e32870d87c5e6d679b4110", "score": "0.45128906", "text": "func (i *MySQLInstance) SetWriteConnectionSecretToReference(r corev1.LocalObjectReference) {\n\ti.Spec.WriteConnectionSecretToReference = r\n}", "title": "" }, { "docid": "a941c6bb18ebac3eda428d1b7a0da42c", "score": "0.45071352", "text": "func (o CephFSVolumeSourcePtrOutput) SecretRef() LocalObjectReferencePtrOutput {\n\treturn o.ApplyT(func(v CephFSVolumeSource) *LocalObjectReference { return v.SecretRef }).(LocalObjectReferencePtrOutput)\n}", "title": "" }, { "docid": "34a448a564e2d7c646483c51fe803142", "score": "0.45044696", "text": "func NewPublishWatcher(addr string, setters ...WatcherOption) (persist.Watcher, error) {\n\tw := &Watcher{\n\t\tclosed: make(chan struct{}),\n\t}\n\n\tw.options = WatcherOptions{\n\t\tChannel: \"/casbin\",\n\t\tProtocol: \"tcp\",\n\t}\n\n\tfor _, setter := range setters {\n\t\tsetter(&w.options)\n\t}\n\n\tif err := w.connect(addr); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// call destructor when the object is released\n\truntime.SetFinalizer(w, finalizer)\n\treturn w, nil\n}", "title": "" }, { "docid": "9cae3eeae1844390b9b2dc83563a352e", "score": "0.45020413", "text": "func (o EnvVarSourcePtrOutput) SecretKeyRef() SecretKeySelectorPtrOutput {\n\treturn o.ApplyT(func(v EnvVarSource) *SecretKeySelector { return v.SecretKeyRef }).(SecretKeySelectorPtrOutput)\n}", "title": "" }, { "docid": "f0985e9fdda03f173ecf7ab4c7ed6289", "score": "0.44930607", "text": "func (o FlexVolumeSourcePtrOutput) SecretRef() LocalObjectReferencePtrOutput {\n\treturn o.ApplyT(func(v FlexVolumeSource) *LocalObjectReference { return v.SecretRef }).(LocalObjectReferencePtrOutput)\n}", "title": "" }, { "docid": "81f1473b9c5d41a7933306de0b6cd712", "score": "0.44926718", "text": "func (o RBDVolumeSourcePtrOutput) SecretRef() LocalObjectReferencePtrOutput {\n\treturn o.ApplyT(func(v RBDVolumeSource) *LocalObjectReference { return v.SecretRef }).(LocalObjectReferencePtrOutput)\n}", "title": "" }, { "docid": "a3b05ae9b95634190bb455f41c4ce950", "score": "0.4492427", "text": "func (s *MqService) Publish(body string, exchangeName string, token string, routeKey string) (err error) {\n\tqMessage, err := container.Ctx.QMessage.GetMessageByName(exchangeName)\n\tif err != nil {\n\t\treturn\n\t}\n\tif qMessage.IsNeedToken && qMessage.Token != token {\n\t\treturn errors.New(\"token error\")\n\t}\n\n\trabbitMq, err := container.Ctx.RabbitMQPools.GetMQ()\n\tif err != nil {\n\t\treturn errors.New(\"rabbitmq pools failed: \" + err.Error())\n\t}\n\tdefer container.Ctx.RabbitMQPools.Recover(rabbitMq)\n\n\treturn rabbitMq.Publish(exchangeName, routeKey, body)\n}", "title": "" }, { "docid": "e04ab0a3db0d603272dafb57cac7ea05", "score": "0.44852373", "text": "func (messenger *MqttMessenger) Publish(address string, retained bool, message string) error {\n\tvar err error\n\n\tif messenger.pahoClient == nil || !messenger.pahoClient.IsConnected() {\n\t\tlogrus.Warnf(\"MqttMessenger.Publish: Unable to publish. No connection with server.\")\n\t\treturn errors.New(\"no connection with server\")\n\t}\n\tlogrus.Debugf(\"MqttMessenger.Publish []byte: address=%s, qos=%d, retained=%v\",\n\t\taddress, messenger.config.PubQos, retained)\n\ttoken := messenger.pahoClient.Publish(address, messenger.config.PubQos, retained, message)\n\n\terr = token.Error()\n\tif err != nil {\n\t\t// TODO: confirm that with qos=1 the message is sent after reconnect\n\t\tlogrus.Warnf(\"MqttMessenger.Publish: Error during publish on address %s: %v\", address, err)\n\t\t//return err\n\t}\n\treturn err\n}", "title": "" }, { "docid": "5416ccf05837b2f0af5329a899fce709", "score": "0.44833773", "text": "func NewPublishEndpoint(s Service) goa.Endpoint {\n\treturn func(ctx context.Context, req interface{}) (interface{}, error) {\n\t\tp := req.(*GcpPublishRequestType)\n\t\tres, err := s.Publish(ctx, p)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tvres := NewViewedPubsubGatewayGcpPublish(res, \"default\")\n\t\treturn vres, nil\n\t}\n}", "title": "" }, { "docid": "747389e4817b1a7c293367493f579221", "score": "0.44810486", "text": "func (m *Mqtt) Publish(topic string, msg interface{}) error {\n\tm.token = m.client.Publish(topic, 2, false, msg)\n\tm.token.Wait()\n\treturn m.token.Error()\n}", "title": "" }, { "docid": "eaaf3dd8cd4ab1b6f19e380f60a30d4c", "score": "0.44800124", "text": "func (c *annotatedValuePublisherClient) Publish(ctx context.Context, in *annotatedvalue.PublishRequest, opts ...grpc.CallOption) (*annotatedvalue.PublishResponse, error) {\n\treturn c.c.Publish(ctx, in, opts...)\n}", "title": "" }, { "docid": "1868d6399eb89040e0670bdfd4396068", "score": "0.44747812", "text": "func (_options *CreateObjectOptions) SetPublish(publish *PublishObject) *CreateObjectOptions {\n\t_options.Publish = publish\n\treturn _options\n}", "title": "" }, { "docid": "884af07d27a79db7b15533548f90bd71", "score": "0.44670126", "text": "func (cs *ControllerServer) publishVolume(volume *longhornclient.Volume, nodeID string, waitForResult func() error) (*csi.ControllerPublishVolumeResponse, error) {\n\tlogrus.Debugf(\"ControllerPublishVolume: volume %s is ready to be attached, and the requested node is %s\", volume.Name, nodeID)\n\tinput := &longhornclient.AttachInput{\n\t\tHostId: nodeID,\n\t\tDisableFrontend: false,\n\t}\n\n\tlogrus.Infof(\"ControllerPublishVolume: volume %s with accessMode %s requesting publishing to %s\", volume.Name, volume.AccessMode, nodeID)\n\tif _, err := cs.apiClient.Volume.ActionAttach(volume, input); err != nil {\n\t\t// TODO: JM process the returned error and return the correct error responses for kubernetes\n\t\t// i.e. FailedPrecondition if the RWO volume is already attached to a different node\n\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t}\n\n\tif err := waitForResult(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tlogrus.Infof(\"ControllerPublishVolume: volume %s with accessMode %s published to %s\", volume.Name, volume.AccessMode, nodeID)\n\treturn &csi.ControllerPublishVolumeResponse{}, nil\n}", "title": "" }, { "docid": "1b2ea616a7d584054b5b65b3527cca8e", "score": "0.4466178", "text": "func (b *MockBroker) Publish(topic string, payload string) (string, int, int64) {\n\tb.MsgList = append(b.MsgList, payload)\n\treturn \"ARGO.topic1\", 0, int64(len(b.MsgList))\n}", "title": "" }, { "docid": "dc9b52d7002b2817a1e582b0274b6470", "score": "0.44618845", "text": "func (a *MqttAdaptor) Publish(topic string, message []byte) bool {\n\tif a.client == nil {\n\t\treturn false\n\t}\n\ta.client.Publish(topic, 0, false, message)\n\treturn true\n}", "title": "" }, { "docid": "e74326ed1dafbf3ff4e87da9f669a79c", "score": "0.44588527", "text": "func (provider *StorageProvider) PublishVolume(id, hostUUID, accessProtocol string) (*model.PublishInfo, error) {\n\treturn &model.PublishInfo{\n\t\tSerialNumber: \"eui.fake\",\n\t}, nil\n}", "title": "" }, { "docid": "02386dabae2a434f7ec550fffa2988af", "score": "0.44523335", "text": "func (h *apiExecutor) Publish(ctx context.Context, cmd *apiproto.PublishRequest) *apiproto.PublishResponse {\n\tch := cmd.Channel\n\tdata := cmd.Data\n\n\tresp := &apiproto.PublishResponse{}\n\n\tif ch == \"\" || len(data) == 0 {\n\t\th.node.logger.log(newLogEntry(LogLevelError, \"channel and data required for publish\", nil))\n\t\tresp.Error = apiproto.ErrorBadRequest\n\t\treturn resp\n\t}\n\n\tchOpts, ok := h.node.ChannelOpts(ch)\n\tif !ok {\n\t\tresp.Error = apiproto.ErrorNamespaceNotFound\n\t\treturn resp\n\t}\n\n\tpub := &proto.Pub{\n\t\tData: cmd.Data,\n\t}\n\tif cmd.UID != \"\" {\n\t\tpub.UID = cmd.UID\n\t}\n\n\terr := <-h.node.publish(cmd.Channel, pub, &chOpts)\n\tif err != nil {\n\t\th.node.logger.log(newLogEntry(LogLevelError, \"error publishing message in engine\", map[string]interface{}{\"error\": err.Error()}))\n\t\tresp.Error = apiproto.ErrorInternal\n\t\treturn resp\n\t}\n\treturn resp\n}", "title": "" }, { "docid": "a10119648e0b132f0865d473e6196479", "score": "0.44503695", "text": "func ControllerPublishVolume(\n\tctx context.Context,\n\tc csi.ControllerClient,\n\tversion *csi.Version,\n\tvolumeID *csi.VolumeID,\n\tvolumeMetadata *csi.VolumeMetadata,\n\tnodeID *csi.NodeID,\n\treadonly bool,\n\tcallOpts ...grpc.CallOption) (\n\t*csi.PublishVolumeInfo, error) {\n\n\tif version == nil {\n\t\treturn nil, ErrVersionRequired\n\t}\n\n\tif volumeID == nil {\n\t\treturn nil, ErrVolumeIDRequired\n\t}\n\n\treq := &csi.ControllerPublishVolumeRequest{\n\t\tVersion: version,\n\t\tVolumeId: volumeID,\n\t\tVolumeMetadata: volumeMetadata,\n\t\tNodeId: nodeID,\n\t\tReadonly: readonly,\n\t}\n\n\tres, err := c.ControllerPublishVolume(ctx, req, callOpts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// check to see if there is a csi error\n\tif cerr := res.GetError(); cerr != nil {\n\t\tif err := cerr.GetControllerPublishVolumeError(); err != nil {\n\t\t\treturn nil, fmt.Errorf(\n\t\t\t\t\"error: ControllerPublishVolume failed: %d: %s\",\n\t\t\t\terr.GetErrorCode(),\n\t\t\t\terr.GetErrorDescription())\n\t\t}\n\t\tif err := cerr.GetGeneralError(); err != nil {\n\t\t\treturn nil, fmt.Errorf(\n\t\t\t\t\"error: ControllerPublishVolume failed: %d: %s\",\n\t\t\t\terr.GetErrorCode(),\n\t\t\t\terr.GetErrorDescription())\n\t\t}\n\t\treturn nil, errors.New(cerr.String())\n\t}\n\n\tresult := res.GetResult()\n\tif result == nil {\n\t\treturn nil, ErrNilResult\n\t}\n\n\tdata := result.GetPublishVolumeInfo()\n\tif data == nil {\n\t\treturn nil, ErrNilPublishVolumeInfo\n\t}\n\n\treturn data, nil\n}", "title": "" } ]
a28736ed03f02a36f66bbc2a233ace96
writeEndsStream reports whether w writes a frame that will transition the stream to a halfclosed local state. This returns false for RST_STREAM, which closes the entire stream (not just the local half).
[ { "docid": "2170b6331bdf3cf5b4464aae844c708a", "score": "0.81098413", "text": "func writeEndsStream(w writeFramer) bool {\n\tswitch v := w.(type) {\n\tcase *writeData:\n\t\treturn v.endStream\n\tcase *writeResHeaders:\n\t\treturn v.endStream\n\tcase nil:\n\t\t// This can only happen if the caller reuses w after it's\n\t\t// been intentionally nil'ed out to prevent use. Keep this\n\t\t// here to catch future refactoring breaking it.\n\t\tpanic(\"writeEndsStream called on nil writeFramer\")\n\t}\n\treturn false\n}", "title": "" } ]
[ { "docid": "19591f44748f4b180d8c8607bd38e3e0", "score": "0.6593598", "text": "func (st *stream) endStream() {\n\tsc := st.sc\n\tsc.serveG.check()\n\n\tif st.declBodyBytes != -1 && st.declBodyBytes != st.bodyBytes {\n\t\tst.body.CloseWithError(fmt.Errorf(\"request declared a Content-Length of %d but only wrote %d bytes\",\n\t\t\tst.declBodyBytes, st.bodyBytes))\n\t} else {\n\t\tst.body.closeWithErrorAndCode(io.EOF, st.copyTrailersToHandlerRequest)\n\t\tst.body.CloseWithError(io.EOF)\n\t}\n\tst.state = stateHalfClosedRemote\n}", "title": "" }, { "docid": "7c75347b0b09c9123bc275e97d4f72ca", "score": "0.62516046", "text": "func (br *BitReaderState) FinishStream(pos *int) bool {\n\t// Give back some bytes that we did not use.\n\tunused_bytes_left := br.bits_left_ >> 3\n\tfor unused_bytes_left > 0 {\n\t\tunused_bytes_left--\n\t\tbr.pos_--\n\t\t// If we give back a 0 byte, we need to check if it was a 0xff/0x00 escape\n\t\t// sequence, and if yes, we need to give back one more byte.\n\t\tif br.pos_ < br.next_marker_pos_ && br.data_[br.pos_] == 0 && br.data_[br.pos_-1] == 0xff {\n\t\t\tbr.pos_--\n\t\t}\n\t}\n\tif br.pos_ > br.next_marker_pos_ {\n\t\t// Data ran out before the scan was complete.\n\t\tfprintf(stderr, \"Unexpected end of scan.\\n\")\n\t\treturn false\n\t}\n\t*pos = br.pos_\n\treturn true\n}", "title": "" }, { "docid": "f42a09f2fb00cd369426f39f314bdff4", "score": "0.58921385", "text": "func isEndFrame(frame string) bool {\r\n\tif frame[1:2] == \"F\" {\r\n\t\treturn true\r\n\t}\r\n\treturn false\r\n}", "title": "" }, { "docid": "21024ab55506439c4c5adf48848c8879", "score": "0.57903504", "text": "func (recv *IOStream) IsClosed() bool {\n\tretC := C.g_io_stream_is_closed((*C.GIOStream)(recv.native))\n\tretGo := retC == C.TRUE\n\n\treturn retGo\n}", "title": "" }, { "docid": "3fc125384dab889c72a8eb6cefb68178", "score": "0.5789429", "text": "func (recv *OutputStream) IsClosed() bool {\n\tretC := C.g_output_stream_is_closed((*C.GOutputStream)(recv.native))\n\tretGo := retC == C.TRUE\n\n\treturn retGo\n}", "title": "" }, { "docid": "76c0b772c71e4071a397538c12ac82a1", "score": "0.5624076", "text": "func (recv *IOStream) CloseFinish(result *AsyncResult) (bool, error) {\n\tc_result := (*C.GAsyncResult)(result.ToC())\n\n\tvar cThrowableError *C.GError\n\n\tretC := C.g_io_stream_close_finish((*C.GIOStream)(recv.native), c_result, &cThrowableError)\n\tretGo := retC == C.TRUE\n\n\tvar goError error = nil\n\tif cThrowableError != nil {\n\t\tgoThrowableError := glib.ErrorNewFromC(unsafe.Pointer(cThrowableError))\n\t\tgoError = goThrowableError\n\n\t\tC.g_error_free(cThrowableError)\n\t}\n\n\treturn retGo, goError\n}", "title": "" }, { "docid": "5808f5430e4710f37af43123a41117ab", "score": "0.5555133", "text": "func IsEndStatus(s OpStatus) bool {\n\treturn firstEndStatus <= s && s < statusCount\n}", "title": "" }, { "docid": "78909a92d3133d979d92f5b9f79d045b", "score": "0.5468966", "text": "func (recv *OutputStream) CloseFinish(result *AsyncResult) (bool, error) {\n\tc_result := (*C.GAsyncResult)(result.ToC())\n\n\tvar cThrowableError *C.GError\n\n\tretC := C.g_output_stream_close_finish((*C.GOutputStream)(recv.native), c_result, &cThrowableError)\n\tretGo := retC == C.TRUE\n\n\tvar goError error = nil\n\tif cThrowableError != nil {\n\t\tgoThrowableError := glib.ErrorNewFromC(unsafe.Pointer(cThrowableError))\n\t\tgoError = goThrowableError\n\n\t\tC.g_error_free(cThrowableError)\n\t}\n\n\treturn retGo, goError\n}", "title": "" }, { "docid": "14a21b9e8fceb7b52abd597560495fa0", "score": "0.54063475", "text": "func (s *StreamState) ClosedHere() bool {\n\ts.RLock()\n\tdefer s.RUnlock()\n\treturn s.s == stateClosed || s.s == stateHalfClosedHere\n}", "title": "" }, { "docid": "0fa66fa972a24c67c0201b822b2e9cce", "score": "0.53543633", "text": "func (pis PointIteratorStream) Closed() bool {\n\treturn !pis.pi.Valid()\n}", "title": "" }, { "docid": "262dd94078341b78fd2c393d566d978d", "score": "0.5276767", "text": "func (s *StreamState) Closed() bool {\n\ts.RLock()\n\tdefer s.RUnlock()\n\treturn s.s == stateClosed\n}", "title": "" }, { "docid": "a062e90d2bc2946a7eb634513c8fdb48", "score": "0.5248588", "text": "func (s *StreamState) ClosedThere() bool {\n\ts.RLock()\n\tdefer s.RUnlock()\n\treturn s.s == stateClosed || s.s == stateHalfClosedThere\n}", "title": "" }, { "docid": "9c5a1e8e92f52650495ea3a11b1fb45b", "score": "0.521946", "text": "func (c *CommandContext) EndStream() {\n\tif !c.Streamed() {\n\t\treturn\n\t}\n\tc.ended = true\n}", "title": "" }, { "docid": "039f9114bf90347d1cdf0b88a72f41cc", "score": "0.52111715", "text": "func (recv *InputStream) CloseFinish(result *AsyncResult) (bool, error) {\n\tc_result := (*C.GAsyncResult)(result.ToC())\n\n\tvar cThrowableError *C.GError\n\n\tretC := C.g_input_stream_close_finish((*C.GInputStream)(recv.native), c_result, &cThrowableError)\n\tretGo := retC == C.TRUE\n\n\tvar goError error = nil\n\tif cThrowableError != nil {\n\t\tgoThrowableError := glib.ErrorNewFromC(unsafe.Pointer(cThrowableError))\n\t\tgoError = goThrowableError\n\n\t\tC.g_error_free(cThrowableError)\n\t}\n\n\treturn retGo, goError\n}", "title": "" }, { "docid": "480060bf36f66e7c7e290880530a68a7", "score": "0.52032346", "text": "func (stream *Stream) Close() error {\n\n\tstream.writingM.Lock()\n\tselect {\n\tcase <-stream.die:\n\t\tstream.writingM.Unlock()\n\t\treturn errors.New(\"Already Closed\")\n\tdefault:\n\t}\n\tstream.heliumMask.Do(func() { close(stream.die) })\n\n\t// Notify remote that this stream is closed\n\tprand.Seed(int64(stream.id))\n\tpadLen := int(math.Floor(prand.Float64()*200 + 300))\n\tpad := make([]byte, padLen)\n\tprand.Read(pad)\n\tf := &Frame{\n\t\tStreamID: stream.id,\n\t\tSeq: atomic.AddUint32(&stream.nextSendSeq, 1) - 1,\n\t\tClosing: 1,\n\t\tPayload: pad,\n\t}\n\ttlsRecord, _ := stream.session.obfs(f)\n\tstream.session.sb.send(tlsRecord)\n\n\tstream.session.delStream(stream.id)\n\tlog.Printf(\"%v actively closed\\n\", stream.id)\n\tstream.writingM.Unlock()\n\treturn nil\n}", "title": "" }, { "docid": "deaa11850455e9e454b51d87fd087d4f", "score": "0.5192856", "text": "func (recv *OutputStream) FlushFinish(result *AsyncResult) (bool, error) {\n\tc_result := (*C.GAsyncResult)(result.ToC())\n\n\tvar cThrowableError *C.GError\n\n\tretC := C.g_output_stream_flush_finish((*C.GOutputStream)(recv.native), c_result, &cThrowableError)\n\tretGo := retC == C.TRUE\n\n\tvar goError error = nil\n\tif cThrowableError != nil {\n\t\tgoThrowableError := glib.ErrorNewFromC(unsafe.Pointer(cThrowableError))\n\t\tgoError = goThrowableError\n\n\t\tC.g_error_free(cThrowableError)\n\t}\n\n\treturn retGo, goError\n}", "title": "" }, { "docid": "89cab9dd33561d2c7716caf96a518356", "score": "0.51837134", "text": "func (recv *FilterOutputStream) GetCloseBaseStream() bool {\n\tretC := C.g_filter_output_stream_get_close_base_stream((*C.GFilterOutputStream)(recv.native))\n\tretGo := retC == C.TRUE\n\n\treturn retGo\n}", "title": "" }, { "docid": "fe33991afa91719a18e43712ec150855", "score": "0.51301324", "text": "func (sc *serverConn) handleEndRequest(strm *Stream) {\n\tctx := strm.ctx\n\tctx.Request.Header.SetProtocolBytes(StringHTTP2)\n\n\tsc.h(ctx)\n\n\t// control the stack after the dispatch\n\t//\n\t// this recover is here just in case the sc.writer<-fr fails.\n\tdefer func() {\n\t\tif err := recover(); err != nil {\n\t\t\t// TODO: idk\n\t\t}\n\t}()\n\n\thasBody := len(ctx.Response.Body()) != 0\n\n\tfr := AcquireFrameHeader()\n\tfr.SetStream(strm.ID())\n\n\th := AcquireFrame(FrameHeaders).(*Headers)\n\th.SetEndHeaders(true)\n\th.SetEndStream(!hasBody)\n\n\tfr.SetBody(h)\n\n\tfasthttpResponseHeaders(h, sc.enc, &ctx.Response)\n\n\tsc.writer <- fr\n\n\tif hasBody {\n\t\tsc.writeData(strm, ctx.Response.Body())\n\t}\n}", "title": "" }, { "docid": "9848f6c264f1f1eddf02c0ef57b3b9e1", "score": "0.5105396", "text": "func streamClose(w *writer) (err error) {\n\t// Insert length of remaining data into index\n\tw.putUint64(uint64(math.MaxUint64))\n\tw.putUint64(uint64(w.maxSize - w.off))\n\n\tbuf := bytes.NewBuffer(w.cur[0:w.off])\n\tn, err := io.Copy(w.idx, buf)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif int(n) != w.off {\n\t\treturn errors.New(\"streamClose: r.cur short write\")\n\t}\n\tw.putUint64(0) // Stream continuation possibility, should be 0.\n\treturn nil\n}", "title": "" }, { "docid": "eab0907ac9fb96eedff0f1633c37478b", "score": "0.5098365", "text": "func (recv *InputStream) IsClosed() bool {\n\tretC := C.g_input_stream_is_closed((*C.GInputStream)(recv.native))\n\tretGo := retC == C.TRUE\n\n\treturn retGo\n}", "title": "" }, { "docid": "58e22248b930f0ab6833ac31df0eb999", "score": "0.5094898", "text": "func (f Flags) FINISH() bool {\n\treturn f&FLAG_FINISH != 0\n}", "title": "" }, { "docid": "de052c047e6865225e3ddf364989e100", "score": "0.5082902", "text": "func (b *LzwStreamShrinker) IsStream() bool {\n\treturn true\n}", "title": "" }, { "docid": "87b52742dd3136c09e7ee917b4aa6510", "score": "0.507108", "text": "func (recv *OutputStream) Close(cancellable *Cancellable) (bool, error) {\n\tc_cancellable := (*C.GCancellable)(C.NULL)\n\tif cancellable != nil {\n\t\tc_cancellable = (*C.GCancellable)(cancellable.ToC())\n\t}\n\n\tvar cThrowableError *C.GError\n\n\tretC := C.g_output_stream_close((*C.GOutputStream)(recv.native), c_cancellable, &cThrowableError)\n\tretGo := retC == C.TRUE\n\n\tvar goError error = nil\n\tif cThrowableError != nil {\n\t\tgoThrowableError := glib.ErrorNewFromC(unsafe.Pointer(cThrowableError))\n\t\tgoError = goThrowableError\n\n\t\tC.g_error_free(cThrowableError)\n\t}\n\n\treturn retGo, goError\n}", "title": "" }, { "docid": "d141fe77a8d05c396ba86a72acf4b0aa", "score": "0.5061073", "text": "func (sw *streamWriter) closeWriter() bool {\n\tsw.mu.Lock()\n\tdefer sw.mu.Unlock()\n\treturn sw.unsafeCloseWriter()\n}", "title": "" }, { "docid": "e63f05831d3e0d52c0a17ab7a96b0100", "score": "0.5059395", "text": "func (c *Ctx) Stream(step func(w io.Writer) bool) bool {\n\tw := c.W\n\tctx := c.Context\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn true\n\t\tdefault:\n\t\t\tkeepOpen := step(w)\n\t\t\tw.Flush()\n\t\t\tif !keepOpen {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "acc83ec717f496d9f0e52db5f3b132fd", "score": "0.5047189", "text": "func FIN() FlowFilterImplementation {\n\treturn TCPFlags(false, true, true, false)\n}", "title": "" }, { "docid": "e25a433e7c107a03cf5aabc9cf7a8690", "score": "0.5043826", "text": "func (s *Stream) Done() bool {\n\treturn s.next >= len(s.tokens)\n}", "title": "" }, { "docid": "dcc4c199f9e2a09c88a5cd90b1c6f1e1", "score": "0.50309855", "text": "func (recv *Socket) IsClosed() bool {\n\tretC := C.g_socket_is_closed((*C.GSocket)(recv.native))\n\tretGo := retC == C.TRUE\n\n\treturn retGo\n}", "title": "" }, { "docid": "7d539e4149dc019804ad0acf0a4a1647", "score": "0.5006575", "text": "func (dht *DHT) ClosedStream(s p2p.Stream) {\n\n}", "title": "" }, { "docid": "b8e8cc745e51de8b2079f629f447e4c0", "score": "0.49931395", "text": "func (sc *serverConn) wroteFrame(res frameWriteResult) {\n\tsc.serveG.check()\n\tif !sc.writingFrame {\n\t\tpanic(\"internal error: expected to be already writing a frame\")\n\t}\n\tsc.writingFrame = false\n\tsc.writingFrameAsync = false\n\n\twr := res.wr\n\n\tif writeEndsStream(wr.write) {\n\t\tst := wr.stream\n\t\tif st == nil {\n\t\t\tpanic(\"internal error: expecting non-nil stream\")\n\t\t}\n\t\tswitch st.state {\n\t\tcase stateOpen:\n\t\t\t// Here we would go to stateHalfClosedLocal in\n\t\t\t// theory, but since our handler is done and\n\t\t\t// the net/http package provides no mechanism\n\t\t\t// for closing a ResponseWriter while still\n\t\t\t// reading data (see possible TODO at top of\n\t\t\t// this file), we go into closed state here\n\t\t\t// anyway, after telling the peer we're\n\t\t\t// hanging up on them. We'll transition to\n\t\t\t// stateClosed after the RST_STREAM frame is\n\t\t\t// written.\n\t\t\tst.state = stateHalfClosedLocal\n\t\t\t// Section 8.1: a server MAY request that the client abort\n\t\t\t// transmission of a request without error by sending a\n\t\t\t// RST_STREAM with an error code of NO_ERROR after sending\n\t\t\t// a complete response.\n\t\t\tsc.resetStream(streamError(st.id, ErrCodeNo))\n\t\tcase stateHalfClosedRemote:\n\t\t\tsc.closeStream(st, errHandlerComplete)\n\t\t}\n\t} else {\n\t\tswitch v := wr.write.(type) {\n\t\tcase StreamError:\n\t\t\t// st may be unknown if the RST_STREAM was generated to reject bad input.\n\t\t\tif st, ok := sc.streams[v.StreamID]; ok {\n\t\t\t\tsc.closeStream(st, v)\n\t\t\t}\n\t\tcase handlerPanicRST:\n\t\t\tsc.closeStream(wr.stream, errHandlerPanicked)\n\t\t}\n\t}\n\n\t// Reply (if requested) to unblock the ServeHTTP goroutine.\n\twr.replyToWriter(res.err)\n\n\tsc.scheduleFrameWrite()\n}", "title": "" }, { "docid": "42bd872b69596927325cf07553159c86", "score": "0.49805027", "text": "func (s *Socket) IsClosed() bool {\n\treturn s.bs.IsClosed()\n}", "title": "" }, { "docid": "1a54dc5527272121ccb070f07f655b6c", "score": "0.4976886", "text": "func (w *Writer) WriteEnd() (int, error) {\n\tif w.chunked {\n\t\treturn w.dst.Write([]byte(\"\\n##\\n\"))\n\t}\n\treturn w.dst.Write([]byte(\"]]>]]>\"))\n}", "title": "" }, { "docid": "102d3ca2085228e5b7da437b1a445256", "score": "0.49764472", "text": "func (feed *Feed) PostStreamEnd(bucket string, m *mc.UprEvent) {\n\tvar respch chan []interface{}\n\tcmd := &controlStreamEnd{\n\t\tbucket: bucket,\n\t\topaque: m.Opaque,\n\t\tstatus: m.Status,\n\t\tvbno: m.VBucket,\n\t}\n\tc.FailsafeOp(feed.backch, respch, []interface{}{cmd}, feed.finch)\n}", "title": "" }, { "docid": "f4d9ddbd81e257a411022cc314579731", "score": "0.49704662", "text": "func (lc *LerpColor) IsEndFuncSet() bool {\n\treturn lc.isEndFuncSet\n}", "title": "" }, { "docid": "98182bdc8f7f3fc8730ee2927ef2bcfb", "score": "0.49670103", "text": "func IsEOS(err error) bool {\n\treturn errors.Is(err, errEndOfStream{})\n}", "title": "" }, { "docid": "516b4d1960e7caeeaca709a41fc9d848", "score": "0.49588275", "text": "func (recv *IOStream) Close(cancellable *Cancellable) (bool, error) {\n\tc_cancellable := (*C.GCancellable)(C.NULL)\n\tif cancellable != nil {\n\t\tc_cancellable = (*C.GCancellable)(cancellable.ToC())\n\t}\n\n\tvar cThrowableError *C.GError\n\n\tretC := C.g_io_stream_close((*C.GIOStream)(recv.native), c_cancellable, &cThrowableError)\n\tretGo := retC == C.TRUE\n\n\tvar goError error = nil\n\tif cThrowableError != nil {\n\t\tgoThrowableError := glib.ErrorNewFromC(unsafe.Pointer(cThrowableError))\n\t\tgoError = goThrowableError\n\n\t\tC.g_error_free(cThrowableError)\n\t}\n\n\treturn retGo, goError\n}", "title": "" }, { "docid": "cab3210dc77c475dbd65b21fa583eb15", "score": "0.4937976", "text": "func (bbi *Reader) End() bool {\n\treturn bbi.offs >= len(bbi.buf)\n}", "title": "" }, { "docid": "8fc6d0c56d57bf0de02e17e6b58d3a69", "score": "0.49318042", "text": "func (o *Led) HasEnd() bool {\n\tif o != nil && o.End.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "5a9268d8e801972272195275d2b7681b", "score": "0.49314407", "text": "func (sc *serverConn) writeFrame(wr FrameWriteRequest) {\n\tsc.serveG.check()\n\n\t// If true, wr will not be written and wr.done will not be signaled.\n\tvar ignoreWrite bool\n\n\t// We are not allowed to write frames on closed streams. RFC 7540 Section\n\t// 5.1.1 says: \"An endpoint MUST NOT send frames other than PRIORITY on\n\t// a closed stream.\" Our server never sends PRIORITY, so that exception\n\t// does not apply.\n\t//\n\t// The serverConn might close an open stream while the stream's handler\n\t// is still running. For example, the server might close a stream when it\n\t// receives bad data from the client. If this happens, the handler might\n\t// attempt to write a frame after the stream has been closed (since the\n\t// handler hasn't yet been notified of the close). In this case, we simply\n\t// ignore the frame. The handler will notice that the stream is closed when\n\t// it waits for the frame to be written.\n\t//\n\t// As an exception to this rule, we allow sending RST_STREAM after close.\n\t// This allows us to immediately reject new streams without tracking any\n\t// state for those streams (except for the queued RST_STREAM frame). This\n\t// may result in duplicate RST_STREAMs in some cases, but the client should\n\t// ignore those.\n\tif wr.StreamID() != 0 {\n\t\t_, isReset := wr.write.(StreamError)\n\t\tif state, _ := sc.state(wr.StreamID()); state == stateClosed && !isReset {\n\t\t\tignoreWrite = true\n\t\t}\n\t}\n\n\t// Don't send a 100-continue response if we've already sent headers.\n\t// See golang.org/issue/14030.\n\tswitch wr.write.(type) {\n\tcase *writeResHeaders:\n\t\twr.stream.wroteHeaders = true\n\tcase write100ContinueHeadersFrame:\n\t\tif wr.stream.wroteHeaders {\n\t\t\t// We do not need to notify wr.done because this frame is\n\t\t\t// never written with wr.done != nil.\n\t\t\tif wr.done != nil {\n\t\t\t\tpanic(\"wr.done != nil for write100ContinueHeadersFrame\")\n\t\t\t}\n\t\t\tignoreWrite = true\n\t\t}\n\t}\n\n\tif !ignoreWrite {\n\t\tif wr.isControl() {\n\t\t\tsc.queuedControlFrames++\n\t\t\t// For extra safety, detect wraparounds, which should not happen,\n\t\t\t// and pull the plug.\n\t\t\tif sc.queuedControlFrames < 0 {\n\t\t\t\tsc.conn.Close()\n\t\t\t}\n\t\t}\n\t\tsc.writeSched.Push(wr)\n\t}\n\tsc.scheduleFrameWrite()\n}", "title": "" }, { "docid": "50fc9c68c9a3907153a7ff2882c51b9c", "score": "0.49291545", "text": "func (sc *serverConn) handleStreams() {\n\tstrms := make(map[uint32]*Stream)\n\tclosedStrms := make(map[uint32]struct{})\n\tvar currentStrm uint32\n\n\tfor fr := range sc.reader {\n\t\tstrm, ok := strms[fr.Stream()]\n\t\tif !ok { // then create it\n\t\t\tif fr.Type() == FrameResetStream {\n\t\t\t\t// only send go away on idle stream not on already closed stream\n\t\t\t\tif _, ok = closedStrms[fr.Stream()]; !ok {\n\t\t\t\t\tsc.writeGoAway(fr.Stream(), ProtocolError, \"RST_STREAM on idle stream\")\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif _, ok = closedStrms[fr.Stream()]; ok && fr.Type() != FramePriority {\n\t\t\t\tsc.writeGoAway(fr.Stream(), StreamClosedError, \"frame on closed stream\")\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif len(strms) >= int(sc.st.maxStreams) {\n\t\t\t\tsc.writeReset(fr.Stream(), RefusedStreamError)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tstrm = NewStream(fr.Stream(), sc.clientStreamWindow)\n\t\t\tstrms[fr.Stream()] = strm\n\n\t\t\tif strm.ID() < sc.lastID {\n\t\t\t\tsc.writeGoAway(strm.ID(), ProtocolError, \"stream id too low\")\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tsc.lastID = strm.ID()\n\n\t\t\tsc.createStream(sc.c, strm)\n\t\t}\n\n\t\tif currentStrm != 0 && currentStrm != fr.Stream() {\n\t\t\tsc.writeError(strm, NewGoAwayError(ProtocolError, \"previous stream headers not ended\"))\n\t\t\tcontinue\n\t\t}\n\n\t\tif err := sc.handleFrame(strm, fr); err != nil {\n\t\t\tsc.writeError(strm, err)\n\t\t}\n\n\t\tif strm.headersFinished {\n\t\t\tcurrentStrm = 0\n\t\t}\n\n\t\thandleState(fr, strm)\n\n\t\tif strm.State() < StreamStateHalfClosed && sc.readTimeout > 0 {\n\t\t\tif time.Since(strm.startedAt) > sc.readTimeout {\n\t\t\t\tsc.writeGoAway(strm.ID(), StreamCanceled, \"timeout\")\n\t\t\t\tstrm.SetState(StreamStateClosed)\n\t\t\t}\n\t\t}\n\n\t\tswitch strm.State() {\n\t\tcase StreamStateHalfClosed:\n\t\t\tsc.handleEndRequest(strm)\n\t\tcase StreamStateClosed:\n\t\t\tctxPool.Put(strm.ctx)\n\t\t\tclosedStrms[strm.ID()] = struct{}{}\n\t\t\tdelete(strms, strm.ID())\n\t\t\tstreamPool.Put(strm)\n\t\tcase StreamStateOpen:\n\t\t\tcurrentStrm = strm.ID()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4c2fb4b58a2b962d9b8de20b8aec0284", "score": "0.49171185", "text": "func (aw *AckingWriter) Closed() bool {\n\treturn atomic.LoadInt32(&aw.closed) != 0\n}", "title": "" }, { "docid": "1d66adbe5d087c505f07eabe07ca6807", "score": "0.4913915", "text": "func (s *MuxedStream) receiveEOF() (closed bool) {\n\ts.writeLock.Lock()\n\tdefer s.writeLock.Unlock()\n\ts.receivedEOF = true\n\ts.CloseRead()\n\treturn s.writeEOF && s.writeBuffer.Len() == 0\n}", "title": "" }, { "docid": "f656f1d87f0609f75c121d3bdcfcd0e0", "score": "0.49134824", "text": "func (sc *serverConn) startFrameWrite(wr FrameWriteRequest) {\n\tsc.serveG.check()\n\tif sc.writingFrame {\n\t\tpanic(\"internal error: can only be writing one frame at a time\")\n\t}\n\n\tst := wr.stream\n\tif st != nil {\n\t\tswitch st.state {\n\t\tcase stateHalfClosedLocal:\n\t\t\tswitch wr.write.(type) {\n\t\t\tcase StreamError, handlerPanicRST, writeWindowUpdate:\n\t\t\t\t// RFC 7540 Section 5.1 allows sending RST_STREAM, PRIORITY, and WINDOW_UPDATE\n\t\t\t\t// in this state. (We never send PRIORITY from the server, so that is not checked.)\n\t\t\tdefault:\n\t\t\t\tpanic(fmt.Sprintf(\"internal error: attempt to send frame on a half-closed-local stream: %v\", wr))\n\t\t\t}\n\t\tcase stateClosed:\n\t\t\tpanic(fmt.Sprintf(\"internal error: attempt to send frame on a closed stream: %v\", wr))\n\t\t}\n\t}\n\tif wpp, ok := wr.write.(*writePushPromise); ok {\n\t\tvar err error\n\t\twpp.promisedID, err = wpp.allocatePromisedID()\n\t\tif err != nil {\n\t\t\tsc.writingFrameAsync = false\n\t\t\twr.replyToWriter(err)\n\t\t\treturn\n\t\t}\n\t}\n\n\tsc.writingFrame = true\n\tsc.needsFrameFlush = true\n\tif wr.write.staysWithinBuffer(sc.bw.Available()) {\n\t\tsc.writingFrameAsync = false\n\t\terr := wr.write.writeFrame(sc)\n\t\tsc.wroteFrame(frameWriteResult{wr: wr, err: err})\n\t} else if wd, ok := wr.write.(*writeData); ok {\n\t\t// Encode the frame in the serve goroutine, to ensure we don't have\n\t\t// any lingering asynchronous references to data passed to Write.\n\t\t// See https://go.dev/issue/58446.\n\t\tsc.framer.startWriteDataPadded(wd.streamID, wd.endStream, wd.p, nil)\n\t\tsc.writingFrameAsync = true\n\t\tgo sc.writeFrameAsync(wr, wd)\n\t} else {\n\t\tsc.writingFrameAsync = true\n\t\tgo sc.writeFrameAsync(wr, nil)\n\t}\n}", "title": "" }, { "docid": "1972d7ac4bf56595ff2db4590aeabd14", "score": "0.48991913", "text": "func (r *Buffer) Closed() bool {\n\treturn r.closed.Load()\n}", "title": "" }, { "docid": "5b49c394da154c18c2fe6603e56eef8a", "score": "0.48981065", "text": "func (recv *FilterInputStream) GetCloseBaseStream() bool {\n\tretC := C.g_filter_input_stream_get_close_base_stream((*C.GFilterInputStream)(recv.native))\n\tretGo := retC == C.TRUE\n\n\treturn retGo\n}", "title": "" }, { "docid": "6fd0e53d5f1556dc01a733a26ac3ed1f", "score": "0.4871448", "text": "func TestStreamHalfClose2(t *testing.T) {\n\tclient, server := testClientServer()\n\tdefer client.Close()\n\tdefer server.Close()\n\n\twait := make(chan struct{})\n\n\tgo func() {\n\t\tstream, err := server.AcceptStream()\n\t\tif err != nil {\n\t\t\tt.Error(err)\n\t\t}\n\t\t<-wait\n\t\t_, err = stream.Write([]byte(\"asdf\"))\n\t\tif err != nil {\n\t\t\tt.Error(err)\n\t\t}\n\t\tstream.Close()\n\t\twait <- struct{}{}\n\t}()\n\n\tstream, err := client.OpenStream()\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\n\tstream.Close()\n\twait <- struct{}{}\n\n\tbuf, err := ioutil.ReadAll(stream)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tif !bytes.Equal(buf, []byte(\"asdf\")) {\n\t\tt.Fatalf(\"didn't get expected data\")\n\t}\n\t<-wait\n}", "title": "" }, { "docid": "8246e9f6dff5c5da22e47a4798f34625", "score": "0.4823674", "text": "func (m *Mjpegproxy) CloseStream() {\n\tm.setRunning(false)\n}", "title": "" }, { "docid": "802440e97813d05459c751a5a31d9774", "score": "0.48225495", "text": "func (context *Context) IsEnd() bool {\n\treturn context.breakFlag\n}", "title": "" }, { "docid": "c076d6f571531e57f567c659482e9fcc", "score": "0.4821368", "text": "func PixbufSaveToStreamFinish(asyncResult *gio.AsyncResult) (bool, error) {\n\tc_async_result := (*C.GAsyncResult)(asyncResult.ToC())\n\n\tvar cThrowableError *C.GError\n\n\tretC := C.gdk_pixbuf_save_to_stream_finish(c_async_result, &cThrowableError)\n\tretGo := retC == C.TRUE\n\n\tvar goError error = nil\n\tif cThrowableError != nil {\n\t\tgoThrowableError := glib.ErrorNewFromC(unsafe.Pointer(cThrowableError))\n\t\tgoError = goThrowableError\n\n\t\tC.g_error_free(cThrowableError)\n\t}\n\n\treturn retGo, goError\n}", "title": "" }, { "docid": "0083fe1ef3b52e2e2a0281bfb0602f8b", "score": "0.48190287", "text": "func (p PortACK) IsClosed() bool {\n\treturn p.RST && !p.SYN\n}", "title": "" }, { "docid": "41bd69a88443cd0da7a0e18fa03b4d3a", "score": "0.48154306", "text": "func (nl *NetListener) isClosed() bool {\n\treturn atomic.LoadInt32(&nl.closed) > 0\n}", "title": "" }, { "docid": "0cb5e6175f3f06fdf38f77b4c4110976", "score": "0.48082885", "text": "func (w *bodyWriter) finishFragment(last bool) error {\n\tw.fragment.endChunk()\n\tif err := w.fragments.flushFragment(w.fragment, last); err != nil {\n\t\tw.fragment = nil\n\t\treturn err\n\t}\n\n\tw.fragment = nil\n\treturn nil\n}", "title": "" }, { "docid": "22f4733db9215488bf13f04ccfefe54a", "score": "0.47972414", "text": "func (n *notifee) ClosedStream(network p2pnet.Network, stream p2pnet.Stream) {}", "title": "" }, { "docid": "e07a112590781d7c545cf5abbb20a51f", "score": "0.4795351", "text": "func (t *WebSocketTransport) Closed() bool {\n\tval := t.closed.Load()\n\tif val == nil {\n\t\treturn false\n\t}\n\treturn val.(bool)\n}", "title": "" }, { "docid": "06acd43539cdb59a07c0a9203a4418a3", "score": "0.47930914", "text": "func (s *BasicColumnEncryptionSetting) IsEndMasking() bool {\n\treturn s.PlaintextSide == maskingCommon.PlainTextSideLeft\n}", "title": "" }, { "docid": "1bf17c05220b6650a59448bc240c4277", "score": "0.47922197", "text": "func (engine *Engine) StreamEndData(\n\tvbno uint16, vbuuid, seqno uint64) interface{} {\n\n\treturn engine.evaluator.StreamEndData(vbno, vbuuid, seqno)\n}", "title": "" }, { "docid": "1c89cd2030a2f52ad0f41e845a4c5ef6", "score": "0.47858742", "text": "func (recv *OutputStream) Flush(cancellable *Cancellable) (bool, error) {\n\tc_cancellable := (*C.GCancellable)(C.NULL)\n\tif cancellable != nil {\n\t\tc_cancellable = (*C.GCancellable)(cancellable.ToC())\n\t}\n\n\tvar cThrowableError *C.GError\n\n\tretC := C.g_output_stream_flush((*C.GOutputStream)(recv.native), c_cancellable, &cThrowableError)\n\tretGo := retC == C.TRUE\n\n\tvar goError error = nil\n\tif cThrowableError != nil {\n\t\tgoThrowableError := glib.ErrorNewFromC(unsafe.Pointer(cThrowableError))\n\t\tgoError = goThrowableError\n\n\t\tC.g_error_free(cThrowableError)\n\t}\n\n\treturn retGo, goError\n}", "title": "" }, { "docid": "f569e0d840e9ae413ab4877485367464", "score": "0.4778947", "text": "func (b *Builder) IsClosed() bool {\n\treturn b.stack.IsEmpty()\n}", "title": "" }, { "docid": "4d837690f41a39a66e67e60afa8eadf2", "score": "0.47767934", "text": "func (js *jetStream) isShuttingDown() bool {\n\tjs.mu.RLock()\n\tdefer js.mu.RUnlock()\n\treturn js.shuttingDown\n}", "title": "" }, { "docid": "0a79f6fc943f67fdcbd2af64e6b74eeb", "score": "0.47736508", "text": "func (t *WebsocketTransport) ReceivedStreamClose() {\n\treturn\n}", "title": "" }, { "docid": "2691eb48d02a132a0faef93db718fbc7", "score": "0.47453374", "text": "func (s LineString) IsClosed() bool {\n\treturn !s.IsEmpty() && s.seq.GetXY(0) == s.seq.GetXY(s.seq.Length()-1)\n}", "title": "" }, { "docid": "077cbf1e457bab6305448d9d876a41ac", "score": "0.47448552", "text": "func (f *outFragment) chunkOpen() bool { return len(f.chunkStart) > 0 }", "title": "" }, { "docid": "583dd4fc4b87355504cb37b1f2d4fb4b", "score": "0.47411644", "text": "func (p *Petri) IsEnd() bool {\n\tcount := 0\n\tfor i := range p.allBacteria {\n\t\tif p.IsAlive(i) == false {\n\t\t\tcount++\n\t\t}\n\t}\n\tif count == len(p.allBacteria) {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "1fcbe47f66bd906017939cfcdfe3924a", "score": "0.47321352", "text": "func (w *Worker) closed() bool {\n\tselect {\n\tcase <-w.shutdown:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "457add1854e39f2876570a5bab3d72e9", "score": "0.47316936", "text": "func IsWSClosedErr(err error) (closedErr bool) {\n\tif err != nil && strings.Contains(err.Error(), ErrWsClosed) {\n\t\tclosedErr = true\n\t}\n\treturn\n}", "title": "" }, { "docid": "dd7e9afb59b41f425d19e13c41582056", "score": "0.47313014", "text": "func (w *Writer) Close() error {\n\t// If stream is already closed, it is reported by `writeChunk`.\n\t_, err := w.writeChunk(nil, operationFinish)\n\tw.dst = nil\n\treturn err\n}", "title": "" }, { "docid": "bc104a1800223eb455ab5dcea47d59d9", "score": "0.47210947", "text": "func finished(ts *tokenStream, end, mid string) bool {\n\tif ts.token == end {\n\t\tts.next()\n\t\treturn true\n\t}\n\tif ts.token == mid {\n\t\tts.next()\n\t}\n\treturn false\n}", "title": "" }, { "docid": "4143c62c7e87b35512e064ff028af26f", "score": "0.47139266", "text": "func (b *binheader) IsClosed() bool {\n\treturn !(b.closed == 0)\n}", "title": "" }, { "docid": "831e62c2e229930a267909777d10d0ea", "score": "0.4712197", "text": "func (c *LogtailClient) streamBroken() bool {\n\tselect {\n\tcase <-c.broken:\n\t\treturn true\n\tdefault:\n\t}\n\treturn false\n}", "title": "" }, { "docid": "a922dbb11a4bef9b4e95950324a182b6", "score": "0.47081736", "text": "func (s *s5Handler) finalResponse() bool {\n\tvar msg = []byte{5, 0, 0, 1, 0, 0, 0, 0, 0, 0}\n\tif s.err != nil {\n\t\t// handshake error feedback\n\t\tif ex, y := s.err.(*exception.Exception); y {\n\t\t\tmsg[1] = byte(ex.Code())\n\t\t} else {\n\t\t\tmsg[1] = 0x1\n\t\t}\n\t\tsetWTimeout(s.conn)\n\t\ts.conn.Write(msg)\n\t\treturn true\n\t}\n\t// accept\n\tsetWTimeout(s.conn)\n\t_, err := s.conn.Write(msg)\n\tif err != nil {\n\t\tlog.Warningln(err)\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "86e7604f6cd50a963fd771d199300e71", "score": "0.46904343", "text": "func (w *Writer) Closed() bool {\n\tw.mu.RLock()\n\tdefer w.mu.RUnlock()\n\treturn w.closed\n}", "title": "" }, { "docid": "8c3637073dd9c504cb67ce373b9bf93d", "score": "0.46853423", "text": "func (s *Server) IsClosing() bool {\n\tswitch ss := s.state.Load().(type) {\n\tcase int:\n\t\treturn ss == stateClosing\n\tcase nil:\n\t\t// The state has not been set yet(= not closing)\n\t\treturn false\n\tdefault:\n\t\tpanic(fmt.Errorf(\"serv: invalid Server.state type: %T\", ss))\n\t}\n}", "title": "" }, { "docid": "1050f143b46887866a6a1df0c4b4a5d7", "score": "0.4684323", "text": "func (l *Lexer) IsAtEnd() bool {\n\treturn l.currentPos > len(l.input)-1\n}", "title": "" }, { "docid": "c4039766cddaf7512bafd21c35628d82", "score": "0.4679089", "text": "func (f *Sink) ShutdownEndpoint(server string) bool {\n\tendpoint := f.FindEndpoint(server)\n\tif endpoint == nil || endpoint.IsClosing() {\n\t\treturn false\n\t}\n\n\tif endpoint.IsActive() {\n\t\tf.readyList.Remove(&endpoint.readyElement)\n\t} else if endpoint.IsFailed() {\n\t\tf.failedList.Remove(&endpoint.failedElement)\n\t}\n\n\tendpoint.mutex.Lock()\n\tendpoint.status = endpointStatusClosing\n\tendpoint.mutex.Unlock()\n\n\t// If we still have pending payloads wait for them to finish\n\tif endpoint.NumPending() != 0 {\n\t\treturn true\n\t}\n\n\tif endpoint.timeoutFunc != nil {\n\t\tf.timeoutList.Remove(&endpoint.timeoutElement)\n\t}\n\n\tendpoint.shutdownTransport()\n\n\treturn true\n}", "title": "" }, { "docid": "0b772e3e0af1f4729b6832f604c3cfb2", "score": "0.46742582", "text": "func (d Decoder) EOF() bool {\n\treturn len(d) == 0\n}", "title": "" }, { "docid": "06351fd0b882cf87ff2a8129359c9d36", "score": "0.46685126", "text": "func (w *File) Closed() bool {\n\tif w.tempFile == nil || w.file == nil {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "1d38654712b5cf88019a429f6b1e46c2", "score": "0.46646824", "text": "func (s *stream) IsTombstoned() bool {\n\ts.mu.RLock()\n\tdefer s.mu.RUnlock()\n\treturn s.tombstone\n}", "title": "" }, { "docid": "6da4929afcdcffb79df24ad4528eae76", "score": "0.46631455", "text": "func (s *Server) FinishStream(ctx context.Context, streamUUID string) error {\n\t_, ok := s.streams.Load(streamUUID)\n\tif !ok {\n\t\treturn fmt.Errorf(\"could not find running stream by UUID %s\", streamUUID)\n\t}\n\n\ts.killStream(ctx, streamUUID)\n\n\treturn nil\n}", "title": "" }, { "docid": "ba6912d71587e02ef843295856676fd1", "score": "0.4654423", "text": "func (ui UserInterface) WindowClosed() bool {\n\tif ui.window.Closed() {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "cd27b28d7d46ba47217bb936103a647b", "score": "0.4647511", "text": "func (s *Stream) Close() error {\n\th := frameHeader{\n\t\tid: s.id,\n\t\tflags: flagFinal,\n\t}\n\terr := s.m.bufferFrame(h, nil, s.wd)\n\tif err == ErrPeerClosedStream {\n\t\terr = nil\n\t}\n\n\t// cancel outstanding Read/Write calls\n\t//\n\t// NOTE: Read calls will be interrupted immediately, but Write calls will\n\t// finish sending their current frame before seeing the error. This is ok:\n\t// the peer will discard any of this Stream's frames that arrive after the\n\t// flagFinal frame.\n\ts.cond.L.Lock()\n\tdefer s.cond.L.Unlock()\n\ts.err = ErrClosedStream\n\ts.cond.Broadcast()\n\treturn err\n}", "title": "" }, { "docid": "55bbdef59b99af75a7bbad89ea6c826e", "score": "0.46385172", "text": "func (w *EsWorker) IsClosed() bool {\n\tselect {\n\tcase <-w.done:\n\t\treturn true\n\n\tdefault:\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "1e6f410422bbf3f5b8f6c1c4875e5d09", "score": "0.46335632", "text": "func (r *Response) IsStream() bool {\n\tif err := r.parseMediaType(); err != nil {\n\t\treturn false\n\t}\n\n\tif !strings.Contains(r.mimeType, \"multipart\") {\n\t\treturn false\n\t}\n\treturn r.mimeParams[\"boundary\"] != \"\"\n}", "title": "" }, { "docid": "d73751ecac2ca233dd12732ae0c0a926", "score": "0.46326387", "text": "func (v *TextIter) IsEnd() bool {\n\treturn gobool(C.gtk_text_iter_is_end(v.native()))\n}", "title": "" }, { "docid": "cf448d61a475e4603850b47b7f5f0290", "score": "0.46314052", "text": "func (cm *ConnManager) ClosedStream(network inet.Network, stream inet.Stream) {\n\tpid := stream.Conn().RemotePeer()\n\n\tcm.mutex.Lock()\n\ttagInfo, ok := cm.tagInfos[pid]\n\tif ok {\n\t\tif tagInfo.Value > 0 {\n\t\t\ttagInfo.Value--\n\t\t}\n\t}\n\tcm.mutex.Unlock()\n}", "title": "" }, { "docid": "b9b5b9c26d687847655b410d90c97015", "score": "0.4622925", "text": "func (l *link) wclose() bool {\n\treturn l.wbuf.Close()\n}", "title": "" }, { "docid": "6536c7b740183f4eafa7f4c4143af43a", "score": "0.4622082", "text": "func (w *watcher) isClosed() bool {\n\treturn atomic.LoadInt32(&w.closed) == 1\n}", "title": "" }, { "docid": "39784ad8a7578e2b04f02f2619b2ce2a", "score": "0.461904", "text": "func (sw *SlidingWindow) TurnClose() bool {\n\tsw.mu.RLock()\n\tdefer sw.mu.RUnlock()\n\treturn sw.prevState == Open && sw.State == Closing\n}", "title": "" }, { "docid": "b01f7592f3e1a163c5b166e6e4713206", "score": "0.46177155", "text": "func (ndt NamedDataType) IsStream() bool {\n\treturn ndt.supportsStreaming\n}", "title": "" }, { "docid": "d8d75ae1fec7af74e76da7d9bd2da5af", "score": "0.4612774", "text": "func (display *Display) Closed() bool {\n\treturn display.window.Closed()\n}", "title": "" }, { "docid": "74fc2bcab8ae052f95f17e7f7c2afe68", "score": "0.46071717", "text": "func (hc *healthChecker) isClosing() bool {\n\tselect {\n\tcase <-hc.done:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "7e74a2a1b8885dd3e7bff37af6451328", "score": "0.4605308", "text": "func (h *healSequence) hasEnded() bool {\n\th.currentStatus.updateLock.RLock()\n\tsummary := h.currentStatus.Summary\n\th.currentStatus.updateLock.RUnlock()\n\treturn summary == healStoppedStatus || summary == healFinishedStatus\n}", "title": "" }, { "docid": "68c35956244efef68f38963cc14c4497", "score": "0.45983994", "text": "func (notifee *Notifee) ClosedStream(network.Network, network.Stream) {}", "title": "" }, { "docid": "3190e4f3de49f9395ed9fbcdfeaf5852", "score": "0.45854595", "text": "func (b *body) bodyRemains() bool {\n\tb.mu.Lock()\n\tdefer b.mu.Unlock()\n\treturn !b.sawEOF\n}", "title": "" }, { "docid": "6440e64cf0831dcd085e9ddd336632ba", "score": "0.4580233", "text": "func (m *MethodExpr) IsPayloadStreaming() bool {\n\treturn m.Stream == ClientStreamKind || m.Stream == BidirectionalStreamKind\n}", "title": "" }, { "docid": "5ed082248cde124e11652db118aae506", "score": "0.45759982", "text": "func (bd *bidi) maybeFinish() {\n\tswitch {\n\tcase bd.a == nil:\n\t\tlog.Fatalf(\"[%v] a should always be non-nil, since it's set when bidis are created\", bd.key)\n\tcase !bd.a.done:\n\t\tlog.Printf(\"[%v] still waiting on first stream\", bd.key)\n\tcase bd.b == nil:\n\t\tlog.Printf(\"[%v] no second stream yet\", bd.key)\n\tcase !bd.b.done:\n\t\tlog.Printf(\"[%v] still waiting on second stream\", bd.key)\n\tdefault:\n\t\tlog.Printf(\"[%v] FINISHED, bytes: %d tx, %d rx\", bd.key, bd.a.bytes, bd.b.bytes)\n\t}\n}", "title": "" }, { "docid": "35e6fe2f30abf472b1884007b0330804", "score": "0.45672885", "text": "func (s *MuxedStream) IsRPCStream() bool {\n\trpcHeaders := RPCHeaders()\n\tif len(s.Headers) != len(rpcHeaders) {\n\t\treturn false\n\t}\n\t// The headers order matters, so RPC stream should be opened with OpenRPCStream method and let MuxWriter serializes the headers.\n\tfor i, rpcHeader := range rpcHeaders {\n\t\tif s.Headers[i] != rpcHeader {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "b46db63111fc2946c7f6dcf63fc6dd12", "score": "0.45636824", "text": "func (c *Decoder) IsFinished() bool {\n\treturn c.remainedRows == 0\n}", "title": "" }, { "docid": "b91dfc6bb364b2cdc00acc47d5df7753", "score": "0.45495403", "text": "func (d *Dictionary) IsStream() (bool, error) {\n\treturn false, nil\n}", "title": "" }, { "docid": "c08078f7886f1a73e2f7f7aec9971dfa", "score": "0.45456204", "text": "func (r RpcStream) isEOFErr(err error) bool {\n\treturn err == io.EOF || strings.Contains(strings.ToLower(err.Error()), \"wsarecv:\")\n}", "title": "" }, { "docid": "9f76f4c654f20a798ff6094f70a8c9b5", "score": "0.45359412", "text": "func (this FmtLogger) Closed() bool {\n\treturn true\n}", "title": "" } ]
ac810e8d965b0c76ae4e562ad9021b8b
Perform final modifications before synthesis. This method can be implemented by derived constructs in order to perform final changes before synthesis. prepare() will be called after child constructs have been prepared. This is an advanced framework feature. Only use this if you understand the implications. Experimental.
[ { "docid": "153a53718fa6730a32843355df6ccbdd", "score": "0.46828374", "text": "func (c *jsiiProxy_CfnPreset) Prepare() {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"prepare\",\n\t\tnil, // no parameters\n\t)\n}", "title": "" } ]
[ { "docid": "5bcd916e82552ed45329910f5508d5a2", "score": "0.57962006", "text": "func (c *Command) Prepare() {}", "title": "" }, { "docid": "6241c48b7210c5062f75dffbf2c62820", "score": "0.5701614", "text": "func (b *BaseBuild) Prepare() error {\n\treturn nil\n}", "title": "" }, { "docid": "142c32a8de81e8c47f8384b284ef60bc", "score": "0.5697907", "text": "func (t *Trader) Prepare() {\n}", "title": "" }, { "docid": "d3f59352ac45e3c5e5de5bb1f0e4a0b9", "score": "0.56951314", "text": "func (o *ObjectContents) Prepare() {\n}", "title": "" }, { "docid": "87848657c65b5d0e134f3141925fa355", "score": "0.56072515", "text": "func (e *engineImpl) Prepare(chain engine.ChainReader, header *block.Header) error {\n\t// TODO: implement prepare method\n\treturn nil\n}", "title": "" }, { "docid": "3f8e2972cf3dc5d4e7fd709e97ecf043", "score": "0.54681265", "text": "func (c *Controller) Prepare() {}", "title": "" }, { "docid": "e97978e70767a2d9673fac11b07957e8", "score": "0.5396798", "text": "func (c *Controller) Prepare() {\n\n}", "title": "" }, { "docid": "8d884b2f732a3910f6af53fd31694319", "score": "0.53718036", "text": "func (b *ByteArray) prepare() {\n\tif b.rootChunk == emptyLocation {\n\t\tb.rootChunk = grabChunk()\n\t\tb.readPos = b.seek(b.readPos, 0, SEEK_SET)\n\t\tb.writePos = b.seek(b.writePos, 0, SEEK_SET)\n\t}\n}", "title": "" }, { "docid": "49fbb0804295afd8d5873ec8528a43ba", "score": "0.5295688", "text": "func (c *CharacterBind) Prepare() {\n}", "title": "" }, { "docid": "584cd737a7d7a2d5b9c635d169106a4d", "score": "0.52454907", "text": "func (kf *HybridKF) Prepare(Φ, Htilde *mat64.Dense) {\n\tkf.Φ = Φ\n\tkf.Htilde = Htilde\n\tkf.locked = false\n}", "title": "" }, { "docid": "fa5f308ab533c2776864e6697f7ec91e", "score": "0.52443117", "text": "func (rs *RenderSystem) prepare() {\n\tgl.Enable(gl.CULL_FACE)\n\tgl.CullFace(gl.BACK)\n\tgl.Enable(gl.DEPTH_TEST)\n\tgl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT)\n\tgl.ClearColor(rs.BaseColour.R, rs.BaseColour.G, rs.BaseColour.B, rs.BaseColour.A)\n\tif rs.drawPolygon {\n\t\tgl.PolygonMode(gl.FRONT_AND_BACK, gl.LINE)\n\t} else {\n\t\tgl.PolygonMode(gl.FRONT_AND_BACK, gl.FILL)\n\t}\n}", "title": "" }, { "docid": "a1a103336d83e1194d1811137f8472bd", "score": "0.5238312", "text": "func (s *SpellBuckets) Prepare() {\n}", "title": "" }, { "docid": "e9d70f6e2f2293cf1fdd13f13cdd3a2d", "score": "0.5207482", "text": "func (i *InteractiveMode) Prepare(congress *lassie.Client, app lassie.Application, gw lassie.Gateway) error {\n\t// Nothing to do here\n\ti.congress = congress\n\treturn nil\n}", "title": "" }, { "docid": "a52c352011aada635c223115c0b6066f", "score": "0.52056", "text": "func (p *preImpl) Prepare(ctx context.Context, s *testing.State) interface{} {\n\tctx, st := timing.Start(ctx, \"prepare_\"+p.name)\n\tdefer st.End()\n\n\tif p.arc != nil {\n\t\tpre, err := func() (interface{}, error) {\n\t\t\tctx, cancel := context.WithTimeout(ctx, resetTimeout)\n\t\t\tdefer cancel()\n\t\t\tctx, st := timing.Start(ctx, \"reset_\"+p.name)\n\t\t\tdefer st.End()\n\t\t\tpkgs, err := p.installedPackages(ctx)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.Wrap(err, \"failed to get installed packages\")\n\t\t\t}\n\t\t\tif err := p.checkUsable(ctx, pkgs); err != nil {\n\t\t\t\treturn nil, errors.Wrap(err, \"existing Chrome or ARC connection is unusable\")\n\t\t\t}\n\t\t\tif err := p.resetState(ctx, pkgs); err != nil {\n\t\t\t\treturn nil, errors.Wrap(err, \"failed resetting existing Chrome or ARC session\")\n\t\t\t}\n\t\t\tif err := p.arc.setLogcatFile(filepath.Join(s.OutDir(), logcatName)); err != nil {\n\t\t\t\treturn nil, errors.Wrap(err, \"failed to update logcat output file\")\n\t\t\t}\n\t\t\treturn PreData{p.cr, p.arc}, nil\n\t\t}()\n\t\tif err == nil {\n\t\t\ts.Log(\"Reusing existing ARC session\")\n\t\t\treturn pre\n\t\t}\n\t\ts.Log(\"Failed to reuse existing ARC session: \", err)\n\t\tlocked = false\n\t\tchrome.Unlock()\n\t\tp.closeInternal(ctx, s)\n\t}\n\n\t// Revert partial initialization.\n\tshouldClose := true\n\tdefer func() {\n\t\tif shouldClose {\n\t\t\tp.closeInternal(ctx, s)\n\t\t}\n\t}()\n\n\tfunc() {\n\t\tctx, cancel := context.WithTimeout(ctx, chrome.LoginTimeout)\n\t\tdefer cancel()\n\t\tvar err error\n\t\tif p.cr, err = chrome.New(ctx, chrome.ARCEnabled()); err != nil {\n\t\t\ts.Fatal(\"Failed to start Chrome: \", err)\n\t\t}\n\t}()\n\n\tfunc() {\n\t\tctx, cancel := context.WithTimeout(ctx, BootTimeout)\n\t\tdefer cancel()\n\t\tvar err error\n\t\tif p.arc, err = New(ctx, s.OutDir()); err != nil {\n\t\t\ts.Fatal(\"Failed to start ARC: \", err)\n\t\t}\n\t\tif p.origInitPID, err = InitPID(); err != nil {\n\t\t\ts.Fatal(\"Failed to get initial init PID: \", err)\n\t\t}\n\t\tif p.origPackages, err = p.installedPackages(ctx); err != nil {\n\t\t\ts.Fatal(\"Failed to list initial packages: \", err)\n\t\t}\n\t}()\n\n\t// Prevent the arc and chrome package's New and Close functions from\n\t// being called while this precondition is active.\n\tlocked = true\n\tchrome.Lock()\n\n\tshouldClose = false\n\treturn PreData{p.cr, p.arc}\n}", "title": "" }, { "docid": "275662f2fe0fe3037f60a5d9f387d97e", "score": "0.5194828", "text": "func (p *Petitions) Prepare() {\n}", "title": "" }, { "docid": "52982db07f3b53c02d272c27a8a27bec", "score": "0.51824427", "text": "func (g *Grid) Prepare() {\n}", "title": "" }, { "docid": "3f9081e9547af039ba043d23ad7ad46b", "score": "0.51387644", "text": "func (this *baseController) Prepare() {\n\t// Reset language option.\n\tthis.Lang = \"\" // This field is from i18n.Locale.\n\n\t// 1. Get language information from 'Accept-Language'.\n\tal := this.Ctx.Request.Header.Get(\"Accept-Language\")\n\tif len(al) > 4 {\n\t\tal = al[:5] // Only compare first 5 letters.\n\t\tif i18n.IsExist(al) {\n\t\t\tthis.Lang = al\n\t\t}\n\t}\n\n\t// 2. Default language is English.\n\tif len(this.Lang) == 0 {\n\t\tthis.Lang = \"en-US\"\n\t}\n\n\t// Set template level language option.\n\tthis.Data[\"Lang\"] = this.Lang\n}", "title": "" }, { "docid": "dbb515ee94220767d115373f0ddbe296", "score": "0.5103371", "text": "func (c *jsiiProxy_CfnMaster) Prepare() {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"prepare\",\n\t\tnil, // no parameters\n\t)\n}", "title": "" }, { "docid": "c5b3f27b830b134dc9210640e7e4cf9e", "score": "0.5081656", "text": "func (lp *ChargerHandler) Prepare() {\n\t// read initial enabled state\n\tenabled, err := lp.charger.Enabled()\n\tif err == nil {\n\t\tlp.enabled = enabled\n\t\tlp.log.INFO.Printf(\"charger %sd\", status[lp.enabled])\n\n\t\t// prevent immediately disabling charger\n\t\tif lp.enabled {\n\t\t\tlp.guardUpdated = lp.clock.Now()\n\t\t}\n\t} else {\n\t\tlp.log.ERROR.Printf(\"charger error: %v\", err)\n\t}\n\n\t// set current to known value\n\tif err = lp.setTargetCurrent(lp.MinCurrent); err != nil {\n\t\tlp.log.ERROR.Println(err)\n\t}\n\tlp.bus.Publish(evChargeCurrent, lp.MinCurrent)\n}", "title": "" }, { "docid": "60af986ca81883951223ca3c2309a2e1", "score": "0.508139", "text": "func (u *FileController) Prepare() {\n\tu.Name = \"file_operator\"\n\tu.Controller.Prepare()\n}", "title": "" }, { "docid": "ee4643cff4887ad0110ac1fc62b2002b", "score": "0.50677127", "text": "func (p *pbft) handlePrePrepare(content []byte) {\n\tfmt.Println(\"This node has received the PrePrepare message from the primary node.\")\n\t//The Request structure is parsed using JSON\n\tpp := new(PrePrepare)\n\terr := json.Unmarshal(content, pp)\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\t//to get the public key of the master node for digital signature verification\n\tprimaryNodePubKey := p.getPubKey(\"N0\")\n\tdigestByte, _ := hex.DecodeString(pp.Digest)\n\tif digest := getDigest(pp.RequestMessage); digest != pp.Digest {\n\t\tfmt.Println(\"The digest is not correct. Deny sending Prepare messages.\")\n\t} else if p.sequenceID+1 != pp.SequenceID {\n\t\tfmt.Println(\"ID is not correct. Deny sending Prepare messages.\")\n\t} else if !p.RsaVerySignWithSha256(digestByte, pp.Sign, primaryNodePubKey) {\n\t\tfmt.Println(\"The signiture of primary node is not valid! Deny sending Prepare messages.\")\n\t} else {\n\t\t\n\t\tp.sequenceID = pp.SequenceID\n\t\t\n\t\tfmt.Println(\"The PrePrepare message has been stored into the temporary message pool.\")\n\t\tp.messagePool[pp.Digest] = pp.RequestMessage\n\t\t\n\t\tsign := p.RsaSignWithSha256(digestByte, p.node.rsaPrivKey)\n\t\t\n\t\tpre := Prepare{pp.Digest, pp.SequenceID, p.node.nodeID, sign}\n\t\tbPre, err := json.Marshal(pre)\n\t\tif err != nil {\n\t\t\tlog.Panic(err)\n\t\t}\n\t\t\n\t\tfmt.Println(\"sending Prepare messages to other nodes...\")\n\t\tp.broadcast(cPrepare, bPre)\n\t\tfmt.Println(\"Prepare is done.\")\n\t}\n}", "title": "" }, { "docid": "e236b8f6e4b2c645f1ba96ccb69acd55", "score": "0.5037368", "text": "func (c *jsiiProxy_CfnStudioComponent) Prepare() {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"prepare\",\n\t\tnil, // no parameters\n\t)\n}", "title": "" }, { "docid": "33704f3529c55102d2a35d5e3799a63c", "score": "0.49998927", "text": "func (p *PetsEquipmentsetEntries) Prepare() {\n}", "title": "" }, { "docid": "4cc0d10c007f61e025e00a4529cf0d53", "score": "0.49981177", "text": "func (c *jsiiProxy_CfnStudio) Prepare() {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"prepare\",\n\t\tnil, // no parameters\n\t)\n}", "title": "" }, { "docid": "59217fd5011b7006e42b11a9ab663c05", "score": "0.4984171", "text": "func (c *ArithmeticController) Prepare() {\n\tc.configurer = &ContentNegotiation{}\n}", "title": "" }, { "docid": "934b3edb366e22c7696f55cb6a0a278c", "score": "0.49558014", "text": "func (s *Executor) prepare(tx *model.LaunchTransaction) error {\n\tif tx.Nonce == nil {\n\t\treturn errors.New(\"missing nonce\")\n\t}\n\n\tlimit := conf.Conf.GasLimit\n\ttx.GasLimit = &limit\n\tprice := s.gasMonitor.GasPriceGwei().BigInt().Uint64()\n\ttx.GasPrice = &price\n\treturn nil\n}", "title": "" }, { "docid": "644725946750f8158d2bfe9c5d6cd22a", "score": "0.49555016", "text": "func (ec *ExecutionContext) Prepare() error {\n\tvar op errors.Op = \"cli.ExecutionContext.Prepare\"\n\t// set the command name\n\tcmdName := os.Args[0]\n\tif len(cmdName) == 0 {\n\t\tcmdName = \"hasura\"\n\t}\n\tec.CMDName = cmdName\n\n\tec.IsTerminal = term.IsTerminal(int(os.Stdout.Fd()))\n\n\t// set spinner\n\tec.setupSpinner()\n\n\t// set logger\n\tec.setupLogger()\n\n\t// populate version\n\tec.setVersion()\n\n\t// setup global config\n\terr := ec.setupGlobalConfig()\n\tif err != nil {\n\t\treturn errors.E(op, fmt.Errorf(\"setting up global config failed: %w\", err))\n\t}\n\n\tif !ec.proPluginVersionValidated {\n\t\tec.validateProPluginVersion()\n\t\tec.proPluginVersionValidated = true\n\t}\n\n\tec.LastUpdateCheckFile = filepath.Join(ec.GlobalConfigDir, LastUpdateCheckFileName)\n\n\t// initialize a blank server config\n\tif ec.Config == nil {\n\t\tec.Config = &Config{}\n\t}\n\n\t// generate an execution id\n\tif ec.ID == \"\" {\n\t\tid := \"00000000-0000-0000-0000-000000000000\"\n\t\tu, err := uuid.NewV4()\n\t\tif err == nil {\n\t\t\tid = u.String()\n\t\t} else {\n\t\t\tec.Logger.Debugf(\"generating uuid for execution ID failed, %v\", err)\n\t\t}\n\t\tec.ID = id\n\t\tec.Logger.Debugf(\"execution id: %v\", ec.ID)\n\t}\n\tec.Telemetry.ExecutionID = ec.ID\n\n\treturn nil\n}", "title": "" }, { "docid": "93cbd1c2cf3dbec067eac11f2f39ddbe", "score": "0.4946512", "text": "func (c *jsiiProxy_CfnLayer) Prepare() {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"prepare\",\n\t\tnil, // no parameters\n\t)\n}", "title": "" }, { "docid": "9461bb96ea39c7f9d3314bdda410ac9e", "score": "0.4942861", "text": "func (h *pardo) PrepareTransform(tid string, t *pipepb.PTransform, comps *pipepb.Components) (*pipepb.Components, []string) {\n\n\t// ParDos are a pain in the butt.\n\t// Combines, by comparison, are dramatically simpler.\n\t// This is because for ParDos, how they are handled, and what kinds of transforms are in\n\t// and around the ParDo, the actual shape of the graph will change.\n\t// At their simplest, it's something a DoFn will handle on their own.\n\t// At their most complex, they require intimate interaction with the subgraph\n\t// bundling process, the data layer, state layers, and control layers.\n\t// But unlike combines, which have a clear urn for composite + special payload,\n\t// ParDos have the standard URN for composites with the standard payload.\n\t// So always, we need to first unmarshal the payload.\n\n\tpardoPayload := t.GetSpec().GetPayload()\n\tpdo := &pipepb.ParDoPayload{}\n\tif err := (proto.UnmarshalOptions{}).Unmarshal(pardoPayload, pdo); err != nil {\n\t\tpanic(fmt.Sprintf(\"unable to decode ParDoPayload for transform[%v]\", t.GetUniqueName()))\n\t}\n\n\t// Lets check for and remove anything that makes things less simple.\n\tif pdo.OnWindowExpirationTimerFamilySpec == \"\" &&\n\t\t!pdo.RequestsFinalization &&\n\t\t!pdo.RequiresStableInput &&\n\t\t!pdo.RequiresTimeSortedInput &&\n\t\tlen(pdo.StateSpecs) == 0 &&\n\t\tlen(pdo.TimerFamilySpecs) == 0 &&\n\t\tpdo.RestrictionCoderId == \"\" {\n\t\t// Which inputs are Side inputs don't change the graph further,\n\t\t// so they're not included here. Any nearly any ParDo can have them.\n\n\t\t// At their simplest, we don't need to do anything special at pre-processing time, and simply pass through as normal.\n\t\treturn &pipepb.Components{\n\t\t\tTransforms: map[string]*pipepb.PTransform{\n\t\t\t\ttid: t,\n\t\t\t},\n\t\t}, nil\n\t}\n\n\t// Side inputs add to topology and make fusion harder to deal with\n\t// (side input producers can't be in the same stage as their consumers)\n\t// But we don't have fusion yet, so no worries.\n\n\t// State, Timers, Stable Input, Time Sorted Input, and some parts of SDF\n\t// Are easier to deal including a fusion break. But We can do that with a\n\t// runner specific transform for stable input, and another for timesorted\n\t// input.\n\n\t// SplittableDoFns have 3 required phases and a 4th optional phase.\n\t//\n\t// PAIR_WITH_RESTRICTION which pairs elements with their restrictions\n\t// Input: element; := INPUT\n\t// Output: KV(element, restriction) := PWR\n\t//\n\t// SPLIT_AND_SIZE_RESTRICTIONS splits the pairs into sub element ranges\n\t// and a relative size for each, in a float64 format.\n\t// Input: KV(element, restriction) := PWR\n\t// Output: KV(KV(element, restriction), float64) := SPLITnSIZED\n\t//\n\t// PROCESS_SIZED_ELEMENTS_AND_RESTRICTIONS actually processes the\n\t// elements. This is also where splits need to be handled.\n\t// In particular, primary and residual splits have the same format as the input.\n\t// Input: KV(KV(element, restriction), size) := SPLITnSIZED\n\t// Output: DoFn's output. := OUTPUT\n\t//\n\t// TRUNCATE_SIZED_RESTRICTION is how the runner has an SDK turn an\n\t// unbounded transform into a bound one. Not needed until the pipeline\n\t// is told to drain.\n\t// Input: KV(KV(element, restriction), float64) := synthetic split results from above\n\t// Output: KV(KV(element, restriction), float64). := synthetic, truncated results sent as Split n Sized\n\t//\n\t// So with that, we can figure out the coders we need.\n\t//\n\t// cE - Element Coder (same as input coder)\n\t// cR - Restriction Coder\n\t// cS - Size Coder (float64)\n\t// ckvER - KV<Element, Restriction>\n\t// ckvERS - KV<KV<Element, Restriction>, Size>\n\t//\n\t// There could be a few output coders, but the outputs can be copied from\n\t// the original transform directly.\n\n\t// First lets get the parallel input coder ID.\n\tvar pcolInID, inputLocalID string\n\tfor localID, globalID := range t.GetInputs() {\n\t\t// The parallel input is the one that isn't a side input.\n\t\tif _, ok := pdo.SideInputs[localID]; !ok {\n\t\t\tinputLocalID = localID\n\t\t\tpcolInID = globalID\n\t\t\tbreak\n\t\t}\n\t}\n\tinputPCol := comps.GetPcollections()[pcolInID]\n\tcEID := inputPCol.GetCoderId()\n\tcRID := pdo.RestrictionCoderId\n\tcSID := \"c\" + tid + \"size\"\n\tckvERID := \"c\" + tid + \"kv_ele_rest\"\n\tckvERSID := ckvERID + \"_size\"\n\n\tcoder := func(urn string, componentIDs ...string) *pipepb.Coder {\n\t\treturn &pipepb.Coder{\n\t\t\tSpec: &pipepb.FunctionSpec{\n\t\t\t\tUrn: urn,\n\t\t\t},\n\t\t\tComponentCoderIds: componentIDs,\n\t\t}\n\t}\n\n\tcoders := map[string]*pipepb.Coder{\n\t\tckvERID: coder(urns.CoderKV, cEID, cRID),\n\t\tcSID: coder(urns.CoderDouble),\n\t\tckvERSID: coder(urns.CoderKV, ckvERID, cSID),\n\t}\n\n\t// PCollections only have two new ones.\n\t// INPUT -> same as ordinary DoFn\n\t// PWR, uses ckvER\n\t// SPLITnSIZED, uses ckvERS\n\t// OUTPUT -> same as ordinary outputs\n\n\tnPWRID := \"n\" + tid + \"_pwr\"\n\tnSPLITnSIZEDID := \"n\" + tid + \"_splitnsized\"\n\n\tpcol := func(name, coderID string) *pipepb.PCollection {\n\t\treturn &pipepb.PCollection{\n\t\t\tUniqueName: name,\n\t\t\tCoderId: coderID,\n\t\t\tIsBounded: inputPCol.GetIsBounded(),\n\t\t\tWindowingStrategyId: inputPCol.GetWindowingStrategyId(),\n\t\t}\n\t}\n\n\tpcols := map[string]*pipepb.PCollection{\n\t\tnPWRID: pcol(nPWRID, ckvERID),\n\t\tnSPLITnSIZEDID: pcol(nSPLITnSIZEDID, ckvERSID),\n\t}\n\n\t// PTransforms have 3 new ones, with process sized elements and restrictions\n\t// taking the brunt of the complexity, consuming the inputs\n\n\tePWRID := \"e\" + tid + \"_pwr\"\n\teSPLITnSIZEDID := \"e\" + tid + \"_splitnsize\"\n\teProcessID := \"e\" + tid + \"_processandsplit\"\n\n\ttform := func(name, urn, in, out string) *pipepb.PTransform {\n\t\treturn &pipepb.PTransform{\n\t\t\tUniqueName: name,\n\t\t\tSpec: &pipepb.FunctionSpec{\n\t\t\t\tUrn: urn,\n\t\t\t\tPayload: pardoPayload,\n\t\t\t},\n\t\t\tInputs: map[string]string{\n\t\t\t\tinputLocalID: in,\n\t\t\t},\n\t\t\tOutputs: map[string]string{\n\t\t\t\t\"i0\": out,\n\t\t\t},\n\t\t\tEnvironmentId: t.GetEnvironmentId(),\n\t\t}\n\t}\n\n\tnewInputs := maps.Clone(t.GetInputs())\n\tnewInputs[inputLocalID] = nSPLITnSIZEDID\n\n\ttforms := map[string]*pipepb.PTransform{\n\t\tePWRID: tform(ePWRID, urns.TransformPairWithRestriction, pcolInID, nPWRID),\n\t\teSPLITnSIZEDID: tform(eSPLITnSIZEDID, urns.TransformSplitAndSize, nPWRID, nSPLITnSIZEDID),\n\t\teProcessID: {\n\t\t\tUniqueName: eProcessID,\n\t\t\tSpec: &pipepb.FunctionSpec{\n\t\t\t\tUrn: urns.TransformProcessSizedElements,\n\t\t\t\tPayload: pardoPayload,\n\t\t\t},\n\t\t\tInputs: newInputs,\n\t\t\tOutputs: t.GetOutputs(),\n\t\t\tEnvironmentId: t.GetEnvironmentId(),\n\t\t},\n\t}\n\n\treturn &pipepb.Components{\n\t\tCoders: coders,\n\t\tPcollections: pcols,\n\t\tTransforms: tforms,\n\t}, t.GetSubtransforms()\n}", "title": "" }, { "docid": "fcc50548b39ccb07d066368cbb148988", "score": "0.49316454", "text": "func (l *Listener) Prepare() {\n\tl.loader = l.initLoader()\n}", "title": "" }, { "docid": "82bd0257700cf184d101908bacf016eb", "score": "0.49195835", "text": "func (r *jsiiProxy_RepositoryBase) Prepare() {\n\t_jsii_.InvokeVoid(\n\t\tr,\n\t\t\"prepare\",\n\t\tnil, // no parameters\n\t)\n}", "title": "" }, { "docid": "cbc69078206294064a1133fa9628d69a", "score": "0.49153927", "text": "func (e *engine) prepareContext(w http.ResponseWriter, r *http.Request) *Context {\n\tctx := acquireContext()\n\tctx.Req = ahttp.AcquireRequest(r)\n\tctx.Res = ahttp.AcquireResponseWriter(w)\n\tctx.reply = acquireReply()\n\tctx.subject = security.AcquireSubject()\n\treturn ctx\n}", "title": "" }, { "docid": "599b6cf4057e3dd1db27db01528c1236", "score": "0.49068612", "text": "func (s *PBFTServer) PrePrepare(args PrePrepareArgs, reply *PrePrepareReply) error {\n\t// Verify message signature and digest\n\n\ts.lock.Lock()\n\n\ts.stopTimer()\n\n\tif !s.changing && s.view == args.View && s.h <= args.Seq && args.Seq < s.H {\n\t\tUtil.Dprintf(\"%s[R/PrePrepare]:Args:%+v\", s, args)\n\n\t\tent := s.getEntry(entryID{args.View, args.Seq})\n\t\ts.lock.Unlock()\n\n\t\tent.lock.Lock()\n\t\tif ent.pp == nil || (ent.pp.Digest == args.Digest && ent.pp.Seq == args.Seq) {\n\t\t\tpArgs := PrepareArgs{\n\t\t\t\tView: args.View,\n\t\t\t\tSeq: args.Seq,\n\t\t\t\tDigest: args.Digest,\n\t\t\t\tRid: s.id,\n\t\t\t}\n\t\t\tent.pp = &args\n\n\t\t\tUtil.Dprintf(\"%s[B/Prepare]:Args:%+v\", s, pArgs)\n\n\t\t\ts.broadcast(false, true, \"PBFTServer.Prepare\", pArgs, &PrepareReply{})\n\t\t}\n\t\tent.lock.Unlock()\n\t} else {\n\t\ts.lock.Unlock()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "fb55f483f847da37cc65dbc92fb26f08", "score": "0.4904622", "text": "func (t *TRIAGEZIP) Prepare() {\n}", "title": "" }, { "docid": "d19e655a61a62a337fdd125f3d8c3441", "score": "0.4903018", "text": "func (controller *Controller) Prepare() {\n\tcontroller.Controller.Prepare()\n\tcontroller.SetTemplatePath(\"developer/tools\")\n\tcontroller.RegisterCaptchaAction(\"tools\")\n}", "title": "" }, { "docid": "58dabc5648b2193d71c23c3c933fe82f", "score": "0.48969445", "text": "func (update *expandFolderUpdate) prepare(manager *storageManager, target uint8) (err error) {\n\tupdate.batch = manager.db.newBatch()\n\tswitch target {\n\tcase targetNormal:\n\t\terr = update.prepareNormal(manager)\n\t\tif manager.disruptor.disrupt(\"expand folder prepare normal\") {\n\t\t\treturn errDisrupted\n\t\t}\n\t\tif manager.disruptor.disrupt(\"expand folder prepare normal stop\") {\n\t\t\treturn errStopped\n\t\t}\n\tcase targetRecoverCommitted:\n\t\terr = update.prepareCommitted(manager)\n\tdefault:\n\t\terr = errors.New(\"invalid target\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "1f904c5efb6f02353418ce33a34fa3aa", "score": "0.48968613", "text": "func (update *expandFolderUpdate) prepareNormal(manager *storageManager) (err error) {\n\t// Update the memory folder\n\tupdate.folder.numSectors = update.targetNumSectors\n\tupdate.folder.usage = expandUsage(update.folder.usage, update.targetNumSectors)\n\t// update the db batch\n\tif update.batch, err = manager.db.saveStorageFolderToBatch(update.batch, update.folder); err != nil {\n\t\treturn err\n\t}\n\t// Finished initialization of the transaction\n\tif <-update.txn.InitComplete; update.txn.InitErr != nil {\n\t\treturn update.txn.InitErr\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2f932b8130660a5d50c5972dc0b81b3c", "score": "0.4893961", "text": "func (r *jsiiProxy_Repository) Prepare() {\n\t_jsii_.InvokeVoid(\n\t\tr,\n\t\t\"prepare\",\n\t\tnil, // no parameters\n\t)\n}", "title": "" }, { "docid": "254660360cf149fedeff850b5ded4960", "score": "0.48931533", "text": "func (l *Lfguild) Prepare() {\n}", "title": "" }, { "docid": "52c34f91ee403787c054bdff8444dd81", "score": "0.48804325", "text": "func (yb *yanglibBuilder) prepare() error {\n\tyb.yangDir = GetYangPath()\n\n\t// Yang schema URL base will be set only if we can resolve a management IP\n\t// for this device. Otherwise we wil not advertise the schema URL.\n\tif ip := findAManagementIP(); ip != \"\" {\n\t\tyb.baseURL = \"https://\" + ip + \"/models/yang/\"\n\t}\n\n\tglog.Infof(\"yanglibBuilder.prepare: yangDir = %s\", yb.yangDir)\n\tglog.Infof(\"yanglibBuilder.prepare: baseURL = %s\", yb.baseURL)\n\n\t// Load supported model information\n\tyb.implModules = make(map[string]bool)\n\tfor _, m := range getModels() {\n\t\tyb.implModules[m.Name] = true\n\t}\n\n\tyb.ygotModules = &ocbinds.IETFYangLibrary_ModulesState{}\n\treturn nil\n}", "title": "" }, { "docid": "9742ac8a369dd20479d184e28be8712d", "score": "0.48796207", "text": "func (e *NestedLoopJoinExec) prepare() error {\n\terr := e.SmallExec.Open()\n\tif err != nil {\n\t\treturn errors.Trace(err)\n\t}\n\tdefer e.SmallExec.Close()\n\te.innerRows = e.innerRows[:0]\n\te.prepared = true\n\tfor {\n\t\trow, err := e.SmallExec.Next()\n\t\tif err != nil {\n\t\t\treturn errors.Trace(err)\n\t\t}\n\t\tif row == nil {\n\t\t\treturn nil\n\t\t}\n\n\t\tmatched, err := expression.EvalBool(e.SmallFilter, row.Data, e.Ctx)\n\t\tif err != nil {\n\t\t\treturn errors.Trace(err)\n\t\t}\n\t\tif matched {\n\t\t\te.innerRows = append(e.innerRows, row)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7a362dfedafabb79966c6d756848a7d7", "score": "0.4854588", "text": "func (px *Paxos) Prepare(args PrepareArgs, reply *PrepareReply) error {\n\tpx.mu.Lock()\n\tdefer px.mu.Unlock()\n\n\tvar pi PaxosInstance\n\tif pii, ok := px.instances[args.Seq]; ok {\n\t\tpi = pii\n\t} else {\n\t\tpi = PaxosInstance{-1, -1, nil, false}\n\t}\n\n\t// acceptor's prepare(n) handler:\n\t// if n > n_p\n\tif args.N > pi.N_p {\n\t\t// n_p = n\n\t\tinstance := PaxosInstance{args.N, pi.N_a, pi.V_a, pi.Decided}\n\t\tpx.updatePaxos(args.Seq, instance)\n\n\t\t// reply prepare_ok(n_a, v_a)\n\t\treply.N = pi.N_a\n\t\treply.V = pi.V_a\n\t} else {\n\t\t// else reply prepare_reject\n\t\treply.Reject = true\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6452ff6f0bff32e034c1f82d9b22c1a7", "score": "0.4848896", "text": "func (l *Loottable) Prepare() {\n}", "title": "" }, { "docid": "5d7734f555c1ecdf7afc8cc3fe97393b", "score": "0.48464364", "text": "func (controller *Controller) Prepare() {\n\tcontroller.Controller.Prepare()\n\tcontroller.SetTemplatePath(\"admin/developers/data\")\n\tcontroller.loadTable()\n}", "title": "" }, { "docid": "1bac6f9ffbdb9053ee2ab7138e948897", "score": "0.48441258", "text": "func (r *jsiiProxy_RepositoryBase) OnPrepare() {\n\t_jsii_.InvokeVoid(\n\t\tr,\n\t\t\"onPrepare\",\n\t\tnil, // no parameters\n\t)\n}", "title": "" }, { "docid": "ecd8237e70343c3ce814631b912de060", "score": "0.4843537", "text": "func (c Composition) PrepareForBuild(manifest *TestPlanManifest) (*Composition, error) {\n\t// override the composition plan name with what's in the manifest\n\t// rationale: composition.Global.Plan will be a path relative to\n\t// $TESTGROUND_HOME/plans; the server doesn't care about our local\n\t// paths.\n\tc.Global.Plan = manifest.Name\n\n\t// Is the builder supported?\n\tif manifest.Builders == nil || len(manifest.Builders) == 0 {\n\t\treturn nil, fmt.Errorf(\"plan supports no builders; review the manifest\")\n\t}\n\tbuilders := make([]string, 0, len(manifest.Builders))\n\tfor k := range manifest.Builders {\n\t\tbuilders = append(builders, k)\n\t}\n\tsort.Strings(builders)\n\tif sort.SearchStrings(builders, c.Global.Builder) == len(builders) {\n\t\treturn nil, fmt.Errorf(\"plan does not support builder %s; supported: %v\", c.Global.Builder, builders)\n\t}\n\n\t// Apply manifest-mandated build configuration.\n\tif bcfg, ok := manifest.Builders[c.Global.Builder]; ok {\n\t\tif c.Global.BuildConfig == nil {\n\t\t\tc.Global.BuildConfig = make(map[string]interface{})\n\t\t}\n\t\tfor k, v := range bcfg {\n\t\t\t// Apply parameters that are not explicitly set in the Composition.\n\t\t\tif _, ok := c.Global.BuildConfig[k]; !ok {\n\t\t\t\tc.Global.BuildConfig[k] = v\n\t\t\t}\n\t\t}\n\t}\n\treturn &c, nil\n}", "title": "" }, { "docid": "4714fbbb27f375cfd1a07da4308ad9ae", "score": "0.4841946", "text": "func (c *SeaterController) Prepare() {\n\tmodel, err := models.NewModel()\n\tif err != nil {\n\t\tc.TraceServerError(errors.Annotatef(err, \"failed to init model\"))\n\t}\n\tif err = model.Begin(); err != nil {\n\t\tc.TraceServerError(errors.Annotatef(err, \"failed to begin database transaction\"))\n\t}\n\tc.model = model\n\tc.orm = model.Orm()\n\tc.pagingResult = models.NewQueryParams()\n}", "title": "" }, { "docid": "b70354ddeb9dc3187385ed6913ff2925", "score": "0.48412272", "text": "func (dbi *DB) Prepare(sqls string, arg ...string) {\r\n\tif dbi.status == false {\r\n\t\treturn\r\n\t}\r\n\r\n\tdbi.createOperation(\"DB_PREPARE\")\r\n\t// bind variables\r\n\tdbi.data.reqSql = sqls\r\n\tdbi.data.inVar = arg\r\n\t// data\r\n\tdbi.data.commPrepare()\r\n\t// communicate\r\n\tif dbi.data.comm() == false {\r\n\t\tdbi.Close()\r\n\t}\r\n\t// parse\r\n\tdbi.data.commParse()\r\n}", "title": "" }, { "docid": "4955fb83e51537656e23d7c098e626b8", "score": "0.48292", "text": "func (p *Preparer) Prepare(fullInfo chan resource.Resource, done chan bool, mapWg *sync.WaitGroup) {\n\tmapWg.Wait()\n\n\tvar wg sync.WaitGroup\n\n\tidentifierSend := false\n\n\tfor data := range fullInfo {\n\t\tif !identifierSend {\n\t\t\terr := p.prep.SendIdentifier()\n\t\t\tif err != nil {\n\t\t\t\tlog.WithFields(log.Fields{\"error\": err}).Fatal(\"error send identifier\")\n\t\t\t}\n\t\t\tidentifierSend = true\n\t\t}\n\t\twg.Add(1)\n\t\tgo p.prep.Preparation(data, &wg)\n\t}\n\n\twg.Wait()\n\n\t// If the identifier was not sent, there is no resource to prepare and send,\n\t// a gRPC connection was not open and no finishing and closing of a connection are needed.\n\tif identifierSend {\n\t\tp.prep.Finish()\n\t}\n\n\tdone <- true\n}", "title": "" }, { "docid": "cfa41cf8d31787a848145b7f88495658", "score": "0.48242503", "text": "func (db *DB) Prepare(query string) (*sql.Stmt, error) {\n\treturn db.master.Prepare(query)\n}", "title": "" }, { "docid": "6d934831a4bca3e27752340f5a2a576f", "score": "0.48189792", "text": "func execPrepareStmt(prepStmt string) {\n\tif db == nil {\n\t\tdb = getDB()\n\t}\n\n\tstmt, err := db.Prepare(prepStmt)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t_, err = stmt.Exec()\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "79dc229bf8f5ce418039edf091f06306", "score": "0.48031586", "text": "func (c *jsiiProxy_CfnStack) Prepare() {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"prepare\",\n\t\tnil, // no parameters\n\t)\n}", "title": "" }, { "docid": "8bd42a03edd1568e24c96cbe44773fa3", "score": "0.4802494", "text": "func (c *jsiiProxy_CfnJobTemplate) Prepare() {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"prepare\",\n\t\tnil, // no parameters\n\t)\n}", "title": "" }, { "docid": "2ad326b7962db3e1debad15c6d75e0de", "score": "0.4801336", "text": "func (round *presign1) prepare() error {\n\ti := round.PartyID().Index\n\n\txi := round.key.Xi\n\tks := round.key.Ks\n\tBigXs := round.key.BigXj\n\n\t// adding the key derivation delta to the xi's\n\t// Suppose x has shamir shares x_0, x_1, ..., x_n\n\t// So x + D has shamir shares x_0 + D, x_1 + D, ..., x_n + D\n\tmod := common.ModInt(round.Params().EC().Params().N)\n\txi = mod.Add(round.temp.keyDerivationDelta, xi)\n\tround.key.Xi = xi\n\n\tif round.Threshold()+1 > len(ks) {\n\t\treturn fmt.Errorf(\"t+1=%d is not satisfied by the key count of %d\", round.Threshold()+1, len(ks))\n\t}\n\tif wi, BigWs, err := PrepareForSigning(round.Params().EC(), i, len(ks), xi, ks, BigXs); err != nil {\n\t\treturn err\n\t} else {\n\t\tround.temp.w = wi\n\t\tround.temp.BigWs = BigWs\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "67a83c74b4c3e6bd8592ca4c9b889d6d", "score": "0.47983432", "text": "func (detailsStrategy) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) {\n\tnewBuild := obj.(*buildapi.Build)\n\toldBuild := old.(*buildapi.Build)\n\n\t// ignore phase updates unless the caller is updating the build to\n\t// a completed phase.\n\tphase := oldBuild.Status.Phase\n\tstages := newBuild.Status.Stages\n\tif buildinternalhelpers.IsBuildComplete(newBuild) {\n\t\tphase = newBuild.Status.Phase\n\t}\n\trevision := newBuild.Spec.Revision\n\tmessage := newBuild.Status.Message\n\treason := newBuild.Status.Reason\n\toutputTo := newBuild.Status.Output.To\n\t*newBuild = *oldBuild\n\tnewBuild.Status.Phase = phase\n\tnewBuild.Status.Stages = stages\n\tnewBuild.Spec.Revision = revision\n\tnewBuild.Status.Reason = reason\n\tnewBuild.Status.Message = message\n\tnewBuild.Status.Output.To = outputTo\n}", "title": "" }, { "docid": "2bdeaa7cd5f1f8bdb4140512933f3ac0", "score": "0.47952545", "text": "func (c *jsiiProxy_CfnStudio) OnPrepare() {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"onPrepare\",\n\t\tnil, // no parameters\n\t)\n}", "title": "" }, { "docid": "4497850f1fa54b10091403c60b178b91", "score": "0.4793831", "text": "func (this *BaseController) Prepare() {\r\n\tthis.Layout = \"home/layout/layout.html\"\r\n\tthis.Data[\"D\"] = time.Now()\r\n\tthis.Data[\"Menus\"] = this.getMenuItems()\r\n\tthis.Data[\"PageTitle\"] = \"Tsun Blog\"\r\n}", "title": "" }, { "docid": "78bcab74f40acc3cbbf0f67c63b05f79", "score": "0.47876218", "text": "func (r *jsiiProxy_Repository) OnPrepare() {\n\t_jsii_.InvokeVoid(\n\t\tr,\n\t\t\"onPrepare\",\n\t\tnil, // no parameters\n\t)\n}", "title": "" }, { "docid": "8d62ab94c5071f8c19224f9448791a81", "score": "0.47783676", "text": "func Prepare(p Preparer, query string) (st *sql.Stmt, err error) {\n\tst, err = p.Prepare(query)\n\terr = interpretError(err)\n\treturn\n}", "title": "" }, { "docid": "c340be324c4a7caf97957b22976f4d82", "score": "0.4767975", "text": "func (i *Installer) prepareForRaw(d Device) error {\n\treturn d.Dismount()\n}", "title": "" }, { "docid": "2076c552425afaedfb6c0d2887e6a269", "score": "0.47677118", "text": "func (b *BOOKINGTRIAGETRACKER) Prepare() {\n}", "title": "" }, { "docid": "5b0b4c85375b475673a0c1d5e597def6", "score": "0.47637978", "text": "func (c *jsiiProxy_CfnStack) OnPrepare() {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"onPrepare\",\n\t\tnil, // no parameters\n\t)\n}", "title": "" }, { "docid": "60c591f3f796d903813c38d11a2127e8", "score": "0.475264", "text": "func (sd *SelectDataset) Prepared(prepared bool) *SelectDataset {\n\tret := sd.copy(sd.clauses)\n\tret.isPrepared = prepared\n\treturn ret\n}", "title": "" }, { "docid": "9c6ca8b4d3981828e1d8c874ba8c1460", "score": "0.47502896", "text": "func (px *Paxos) Prepare(args *PrepareArgs, reply *PrepareReply) error {\n\tseq, n, from, done := args.Seq, args.N, args.FromPeer, args.Done\n\n\tpx.mu.Lock()\n\tdefer px.mu.Unlock()\n\n\tif px.instances[seq] == nil {\n\t\tpx.CreateInstance(seq)\n\t}\n\tif px.instances[seq].decided {\n\t\treply.Err = ErrDecided\n\t\treply.Na = px.instances[seq].na\n\t\treply.Va = px.instances[seq].va\n\t} else if n > px.instances[seq].np {\n\t\tpx.instances[seq].np = n\n\t\treply.Err = OK\n\t\treply.N = n\n\t\treply.Na = px.instances[seq].na\n\t\treply.Va = px.instances[seq].va\n\t} else {\n\t\treply.Err = ErrPrepareRejected\n\t\t//used to help proposer find new highest np\n\t\treply.Np = px.instances[seq].np\n\t}\n\n\tpx.UpdatePeersDone(from, done)\n\treply.Done = px.peersDone[px.me]\n\tpx.ForgetDone()\n\treturn nil\n}", "title": "" }, { "docid": "81afd9bd59b10106645dc7a36fe3e97b", "score": "0.47341505", "text": "func (self *PhysicsP2) PreUpdate() {\n self.Object.Call(\"preUpdate\")\n}", "title": "" }, { "docid": "7c058bebadb0333e8ea59cc7a9164d11", "score": "0.47313532", "text": "func (controller *Controller) Prepare() {\n\tcontroller.Controller.Prepare()\n\tcontroller.SetTemplatePath(\"admin/repositories/repository\")\n\tcontroller.loadRepository()\n}", "title": "" }, { "docid": "c404d38e234b0a8e16bfefc5c49b1676", "score": "0.4730552", "text": "func (c *jsiiProxy_CfnStudioComponent) OnPrepare() {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"onPrepare\",\n\t\tnil, // no parameters\n\t)\n}", "title": "" }, { "docid": "23f74173fa9e13f75a530bb66e93e163", "score": "0.47276926", "text": "func (c *Conn) Prepare(query string) (driver.Stmt, error) {\n\ttransformed, _, err := c.transform(context.Background(), query)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn c.ctxConn.Prepare(transformed)\n}", "title": "" }, { "docid": "c7179182f34e67834e6869ab8d1d72fc", "score": "0.47269896", "text": "func (con *dbAccess) prepareDatabase() {\n\tcon.createCommandListTable()\n\tcon.createAmharicWordsTable()\n\tcon.truncateCommandListTable()\n\tcon.truncateAmharicWordsTable()\n\tcon.insertCommandList()\n\tcon.insertAmharicWords()\n\n}", "title": "" }, { "docid": "00739bc1841acf9642a5d45600920f36", "score": "0.47206503", "text": "func (r *Route) prepare() {\n\tif r.middlewareHandlers != nil {\n\t\tr.hasMiddleware = true\n\t}\n\tconvertedMiddleware := MiddlewareHandlerFunc(func(ctx *Context, next Handler) {\n\t\tr.handler.Serve(ctx)\n\t\t//except itself\n\t\tif r.middlewareHandlers != nil && len(r.middlewareHandlers) > 1 {\n\t\t\tnext.Serve(ctx)\n\t\t}\n\t})\n\n\tr.Use(convertedMiddleware)\n\n}", "title": "" }, { "docid": "37f19da19bd2f48b7c87718d4eced85f", "score": "0.47195923", "text": "func Prepare() error {\n\n\t// log.Println(\"Preparing work...\")\n\n\t// commands := [][]string{\n\t// \t[]string{\"yum\", \"update\", \"-y\"},\n\t// \t[]string{\"yum\", \"install\", \"-y\", \"docker\"},\n\t// \t[]string{\"service\", \"docker\", \"start\"},\n\t// \t[]string{\"docker\", \"pull\", \"tnolet/scraper:0.1.0\"},\n\t// }\n\n\t// for _, command := range commands {\n\t// \tout, err := exec.Command(command).Output()\n\n\t// \tif err != nil {\n\t// \t\tlog.Printf(\"Prepare command unsuccessful: %v, %v\", err.Error(), out)\n\t// \t\treturn err\n\t// \t}\n\n\t// \tlog.Printf(\"Succesfully executed preparation: %v\", out)\n\t// }\n\treturn nil\n\n}", "title": "" }, { "docid": "91e2c9d73c6323a4eb376b8029e73fdc", "score": "0.47165763", "text": "func (kf *HybridKF) PreparePNT(Γ *mat64.Dense) {\n\tkf.Γ = Γ\n\tkf.sncEnabled = true\n}", "title": "" }, { "docid": "3342601ea98a89c9cbea23b47ab9b336", "score": "0.4712551", "text": "func (c *jsiiProxy_CfnMaster) OnPrepare() {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"onPrepare\",\n\t\tnil, // no parameters\n\t)\n}", "title": "" }, { "docid": "189bbe44ecd66ed6bf0ea58174b14b79", "score": "0.47083107", "text": "func (consensus *Consensus) Prepare(chain ChainReader, header *types.Header) error {\n\t// TODO: implement prepare method\n\treturn nil\n}", "title": "" }, { "docid": "1802c5fe78abad6bddcbbf51c63dbead", "score": "0.46993402", "text": "func (t *explainTablet) CommitPrepared(ctx context.Context, target *querypb.Target, dtid string) (err error) {\n\tt.mu.Lock()\n\tt.currentTime = t.vte.batchTime.Wait()\n\tt.mu.Unlock()\n\treturn t.tsv.CommitPrepared(ctx, target, dtid)\n}", "title": "" }, { "docid": "5d23628678bf9e72f044c9f896891bf2", "score": "0.46985033", "text": "func (c *jsiiProxy_CfnInstance) Prepare() {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"prepare\",\n\t\tnil, // no parameters\n\t)\n}", "title": "" }, { "docid": "00b64e5d974065d3295bfb7dfeb4e1cd", "score": "0.46972135", "text": "func (i *Inventory) Prepare() {\n}", "title": "" }, { "docid": "9875397ef529a8fb97cb39e9259570ac", "score": "0.46840227", "text": "func (tx *Tx) Prepare(ctx context.Context, name, sql string) (*pgconn.StatementDescription, error) {\n\treturn tx.t.Prepare(ctx, name, sql)\n}", "title": "" }, { "docid": "4c9231d426a91b7689f23e78b6d594d7", "score": "0.46829093", "text": "func (j *ReplayJob) Prepare() error {\n\tif err := j.saveReplay(); err != nil {\n\t\treturn err\n\t}\n\tif err := j.getBeatmap(); err != nil {\n\t\treturn err\n\t}\n\tif err := j.downloadSkin(); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "edbb961b8b9d75ab22287dfc79b4134a", "score": "0.4682416", "text": "func (c *jsiiProxy_CfnRepository) Prepare() {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"prepare\",\n\t\tnil, // no parameters\n\t)\n}", "title": "" }, { "docid": "f971620823f9e48075359e5448245442", "score": "0.468151", "text": "func (db *EdDb) buildPreparedStatements() (err error) {\n\n\tfor title, sqlCommand := range db.preparedStatements() {\n\t\tdb.statements[title], err = db.dbConn.PrepareNamed(sqlCommand)\n\t\tif err != nil {\n\t\t\tlog.Fatal(fmt.Sprint(\"buildPreparedStatement:\", title, \" \", err))\n\t\t\treturn\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "800e2f6ebdff97dc2b7048184d319762", "score": "0.46799377", "text": "func (s *Msg) Prepare(queryPrepared string) error {\n\ts.QueryPrepared = OrString(queryPrepared, s.QueryPrepared)\n\treturn s.CallDtm(&s.MsgData, \"prepare\")\n}", "title": "" }, { "docid": "631d1bf3a8b8582616065b61c38a474e", "score": "0.4678157", "text": "func (s *PBFTServer) Prepare(args PrepareArgs, reply *PrepareReply) error {\n\n\ts.lock.Lock()\n\n\ts.stopTimer()\n\n\tif !s.changing && s.view == args.View && s.h <= args.Seq && args.Seq < s.H {\n\t\tent := s.getEntry(entryID{args.View, args.Seq})\n\t\ts.lock.Unlock()\n\n\t\tent.lock.Lock()\n\n\t\tUtil.Dprintf(\"%s[R/Prepare]:Args:%+v\", s, args)\n\t\tent.p = append(ent.p, &args)\n\t\tif ent.pp != nil && (ent.sendCommit || s.prepared(ent)) {\n\t\t\ts.lock.Lock()\n\t\t\t// Update sequence map and follower's sequence\n\t\t\tcid, cseq := ent.pp.Message.Id, ent.pp.Message.Seq\n\t\t\ts.seqmap[entryID{cid, cseq}] = args.Seq\n\t\t\tif s.view%len(s.replicas) != s.id {\n\t\t\t\tif cseq > s.seq[cid] {\n\t\t\t\t\ts.seq[cid] = cseq\n\t\t\t\t}\n\t\t\t}\n\t\t\ts.lock.Unlock()\n\n\t\t\tcArgs := CommitArgs{\n\t\t\t\tView: args.View,\n\t\t\t\tSeq: ent.pp.Seq,\n\t\t\t\tDigest: ent.pp.Digest,\n\t\t\t\tRid: s.id,\n\t\t\t}\n\t\t\tent.sendCommit = true\n\n\t\t\tUtil.Dprintf(\"%s[B/Commit]:Args:%+v\", s, cArgs)\n\n\t\t\ts.broadcast(false, true, \"PBFTServer.Commit\", cArgs, &CommitReply{})\n\t\t}\n\t\tent.lock.Unlock()\n\t} else {\n\t\ts.lock.Unlock()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "23ac7e309ef81126f2c2d0246dd8847e", "score": "0.46729115", "text": "func (ngram *nGram) Prepare(db *Database) error {\n\treturn nil\n}", "title": "" }, { "docid": "285aa4c5592deae053c7ea995661948a", "score": "0.46711832", "text": "func (px *Paxos) Prepare(args *PrepareArgs, reply *PrepareReply) error {\n\tpx.mu.Lock()\n\tpx.maxSeq = max(px.maxSeq, args.Seq)\n\treply.Seq = px.doneSeq[px.me]\n\tpx.mu.Unlock()\n\n\tpx.acceptorMgr.mu.Lock()\n\tacceptor, ok := px.acceptorMgr.acceptors[args.Seq]\n\tif !ok {\n\t\tacceptor = &Acceptor{mu: sync.Mutex{}, nP: 0, nA: 0, vA: nil}\n\t\tpx.acceptorMgr.acceptors[args.Seq] = acceptor\n\t}\n\tpx.acceptorMgr.mu.Unlock()\n\n\tacceptor.mu.Lock()\n\tdefer acceptor.mu.Unlock()\n\tif args.N > acceptor.nP {\n\t\tacceptor.nP = args.N\n\t\treply.N = args.N\n\t\treply.Na = acceptor.nA\n\t\treply.Va = acceptor.vA\n\t\treply.Fail = false\n\t} else {\n\t\treply.Fail = true\n\t\treply.N = acceptor.nP\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "94870458ad8651896d65e82c051f4d7d", "score": "0.46690634", "text": "func (l *jsiiProxy_LustreFileSystem) OnPrepare() {\n\t_jsii_.InvokeVoid(\n\t\tl,\n\t\t\"onPrepare\",\n\t\tnil, // no parameters\n\t)\n}", "title": "" }, { "docid": "9416f43815fd02fe0da0ab039a7665fb", "score": "0.46611002", "text": "func (i *Impl) Precompute(ctx context.Context) error {\n\treturn nil\n}", "title": "" }, { "docid": "435ffe0385737168d76d524e62ad6200", "score": "0.4660282", "text": "func (p *Project) Prepare() {\n\tp.ProjectName = p.GetName()\n\tp.Status = p.GetStatus()\n}", "title": "" }, { "docid": "32770336be5267cc9fdb8d690dbbe342", "score": "0.46583807", "text": "func (c *jsiiProxy_CfnEnvironment) Prepare() {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"prepare\",\n\t\tnil, // no parameters\n\t)\n}", "title": "" }, { "docid": "e6029020847083c7e1951f4c4948298c", "score": "0.46574932", "text": "func (sb *spdkBackend) Prepare(req storage.BdevPrepareRequest) (*storage.BdevPrepareResponse, error) {\n\tsb.log.Debugf(\"spdk backend prepare (script call): %+v\", req)\n\treturn sb.prepare(req, DetectVMD, cleanHugepages)\n}", "title": "" }, { "docid": "30f31752c90ca51a75adcd7a88a19196", "score": "0.46553162", "text": "func (t *explainTablet) Prepare(ctx context.Context, target *querypb.Target, transactionID int64, dtid string) (err error) {\n\tt.mu.Lock()\n\tt.currentTime = t.vte.batchTime.Wait()\n\tt.mu.Unlock()\n\treturn t.tsv.Prepare(ctx, target, transactionID, dtid)\n}", "title": "" }, { "docid": "e24ec385e4dcddfbb35106e3f76f7220", "score": "0.46549833", "text": "func (p *templateDecoder) prepareResource(obj runtime.Object) error {\n\tmeta.AddLabel(obj, meta.LabelChartName, p.config.Name)\n\n\tif meta.HasGroupKind(obj, statefulSetGK) {\n\t\treturn statefulset.AddOwnerLabels(obj)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a620f8968b29754f5de60b93e6deefc8", "score": "0.46495762", "text": "func Prepare(f func(Initiator)) {\n\tprepares = append(prepares, f)\n}", "title": "" }, { "docid": "e879e1457c39e557b328f77dd0a74764", "score": "0.46477547", "text": "func (c *jsiiProxy_CfnJobTemplate) OnPrepare() {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"onPrepare\",\n\t\tnil, // no parameters\n\t)\n}", "title": "" }, { "docid": "2b4e8f14e39177226ff7a3fc3af004fb", "score": "0.46473116", "text": "func (vm *VirtualMachine) Prepare(args *DomainXML, reply *bool) error {\n\t// Passing the false parameter to ensure the prepare vm task is not added to waitgroup if there is pending signal termination on rpc\n\t_, err := proc.AddTask(false)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"rpc/server:Prepare() Could not add task for vm prepare\")\n\t}\n\tdefer proc.TaskDone()\n\tlog.Trace(\"rpc/server:Prepare() Entering\")\n\tdefer log.Trace(\"rpc/server:Prepare() Leaving\")\n\n\twlaMtx.Lock()\n\tdefer wlaMtx.Unlock()\n\n\tif err = validation.ValidateXMLString(args.XML); err != nil {\n\t\tsecLog.Errorf(\"rpc:server() Prepare: %s, Invalid domain XML format\", message.InvalidInputBadParam)\n\t\treturn nil\n\t}\n\n\t// pass in vm.Watcher to get the instance to the File System Watcher\n\t*reply = wlavm.Prepare(args.XML, vm.Watcher)\n\treturn nil\n}", "title": "" }, { "docid": "23d32b3ada01be168306b5e86cd24952", "score": "0.46456593", "text": "func (f *jsiiProxy_FileSystemBase) Prepare() {\n\t_jsii_.InvokeVoid(\n\t\tf,\n\t\t\"prepare\",\n\t\tnil, // no parameters\n\t)\n}", "title": "" }, { "docid": "b4ec7274f1ca9c82e40fa75c5bbc4025", "score": "0.46456474", "text": "func (consensus *Consensus) constructPreparedMessage() ([]byte, *bls.Sign) {\n\tmessage := &msg_pb.Message{\n\t\tServiceType: msg_pb.ServiceType_CONSENSUS,\n\t\tType: msg_pb.MessageType_PREPARED,\n\t\tRequest: &msg_pb.Message_Consensus{\n\t\t\tConsensus: &msg_pb.ConsensusRequest{},\n\t\t},\n\t}\n\n\tconsensusMsg := message.GetConsensus()\n\tconsensus.populateMessageFields(consensusMsg)\n\t// add block content in prepared message for slow validators to catchup\n\tconsensusMsg.Block = consensus.block\n\n\t//// Payload\n\tbuffer := bytes.NewBuffer([]byte{})\n\n\t// 96 bytes aggregated signature\n\taggSig := bls_cosi.AggregateSig(consensus.Decider.ReadAllSignatures(quorum.Prepare))\n\tbuffer.Write(aggSig.Serialize())\n\n\t// Bitmap\n\tbuffer.Write(consensus.prepareBitmap.Bitmap)\n\n\tconsensusMsg.Payload = buffer.Bytes()\n\t//// END Payload\n\n\tmarshaledMessage, err := consensus.signAndMarshalConsensusMessage(message)\n\tif err != nil {\n\t\tutils.Logger().Error().Err(err).Msg(\"Failed to sign and marshal the Prepared message\")\n\t}\n\treturn proto.ConstructConsensusMessage(marshaledMessage), aggSig\n}", "title": "" }, { "docid": "a7acd93eaef5e1ea86c6fb349e27f885", "score": "0.46425945", "text": "func (c *jsiiProxy_CfnLayer) OnPrepare() {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"onPrepare\",\n\t\tnil, // no parameters\n\t)\n}", "title": "" }, { "docid": "9c3c6049d5249fa5b733987f817118d6", "score": "0.4638716", "text": "func (db *DB) PrepareContext(ctx context.Context, query string) (*sql.Stmt, error) {\n\treturn db.master.PrepareContext(ctx, query)\n}", "title": "" }, { "docid": "41b7e7aafda94dcda4d05ec7f7b9c288", "score": "0.4621372", "text": "func (s *Scheduler) prepareAndExec(r gaia.PipelineRun) {\n\t// Mark the scheduled run as running\n\tr.Status = gaia.RunRunning\n\tr.StartDate = time.Now()\n\n\t// Update entry in store\n\terr := s.storeService.PipelinePutRun(&r)\n\tif err != nil {\n\t\tgaia.Cfg.Logger.Debug(\"could not put pipeline run into store during executing work\", \"error\", err.Error())\n\t\treturn\n\t}\n\n\t// Get related pipeline from pipeline run\n\tpipeline, _ := s.storeService.PipelineGet(r.PipelineID)\n\n\t// Check if this pipeline has jobs declared\n\tif len(r.Jobs) == 0 {\n\t\t// Finish pipeline run\n\t\ts.finishPipelineRun(&r, gaia.RunSuccess)\n\t\treturn\n\t}\n\n\t// Check if circular dependency exists\n\tfor _, job := range r.Jobs {\n\t\tif _, err := s.checkCircularDep(job, []*gaia.Job{}, []*gaia.Job{}); err != nil {\n\t\t\tgaia.Cfg.Logger.Info(\"circular dependency detected\", \"pipeline\", pipeline)\n\t\t\tgaia.Cfg.Logger.Info(\"information\", \"info\", err.Error())\n\n\t\t\t// Update store\n\t\t\ts.finishPipelineRun(&r, gaia.RunFailed)\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Create logs folder for this run\n\tpath := filepath.Join(gaia.Cfg.WorkspacePath, strconv.Itoa(r.PipelineID), strconv.Itoa(r.ID), gaia.LogsFolderName)\n\terr = os.MkdirAll(path, 0700)\n\tif err != nil {\n\t\tgaia.Cfg.Logger.Error(\"cannot create pipeline run folder\", \"error\", err.Error(), \"path\", path)\n\t}\n\n\t// Create the start command for the pipeline\n\tc := createPipelineCmd(pipeline)\n\tif c == nil {\n\t\tgaia.Cfg.Logger.Debug(\"cannot create pipeline start command\", \"error\", errCreateCMDForPipeline.Error())\n\t\ts.finishPipelineRun(&r, gaia.RunFailed)\n\t\treturn\n\t}\n\n\t// Create new plugin instance\n\tpS := s.pluginSystem.NewPlugin(s.ca)\n\n\t// Init the plugin\n\tpath = filepath.Join(path, gaia.LogsFileName)\n\tif err := pS.Init(c, &path); err != nil {\n\t\tgaia.Cfg.Logger.Debug(\"cannot initialize the plugin\", \"error\", err.Error(), \"pipeline\", pipeline)\n\t\ts.finishPipelineRun(&r, gaia.RunFailed)\n\t\treturn\n\t}\n\n\t// Validate the plugin(pipeline)\n\tif err := pS.Validate(); err != nil {\n\t\tgaia.Cfg.Logger.Debug(\"cannot validate pipeline\", \"error\", err.Error(), \"pipeline\", pipeline)\n\t\ts.finishPipelineRun(&r, gaia.RunFailed)\n\t\treturn\n\t}\n\tdefer pS.Close()\n\n\t// Schedule jobs and execute them.\n\t// Also update the run in the store.\n\ts.executeScheduledJobs(r, pS)\n}", "title": "" } ]
dd5f72bd4950f50c3d9d330744679e82
Create a new decimal from the given float value
[ { "docid": "8842fd358d8f7c8825087ec556cd98ff", "score": "0.761001", "text": "func DecimalFromFloat(value float64) Decimal {\n result := decimal.NewFromFloat(value)\n return Decimal{result}\n}", "title": "" } ]
[ { "docid": "2c86f05145c3caadced6430166152365", "score": "0.7134993", "text": "func NewFromFloat(value float64) Decimal {\n\tif value == 0 {\n\t\treturn New(0, 0)\n\t}\n\tdec, err := NewFromString(strconv.FormatFloat(value, 'f', -1, 64))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn dec\n}", "title": "" }, { "docid": "a79bb3a819ae9f6808d9be6e10351077", "score": "0.65634006", "text": "func NewFloat(v Float) *Float { return &v }", "title": "" }, { "docid": "0a108978818cfcb021933e46c9ee315c", "score": "0.62442124", "text": "func NewFromFloat(f float64) *Fraction {\n\tn := 1\n\t// math.Trunc returns the integer form of the provided float64\n\tfor f != math.Trunc(f) {\n\t\tf *= 10\n\t\tn *= 10\n\t}\n\tfrac := New(int64(f), int64(n))\n\tfrac.Simplify()\n\treturn frac\n}", "title": "" }, { "docid": "0e38c462495958e5728a9a3ae0297d73", "score": "0.6173935", "text": "func DecimalFromString(value string) Decimal {\n result, _ := decimal.NewFromString(value)\n return Decimal{result}\n}", "title": "" }, { "docid": "9f83c965700d4b56695c41011ee00f6c", "score": "0.6136249", "text": "func Float(value string) *scalar.Dnumber {\n\treturn scalar.NewDnumber(value)\n}", "title": "" }, { "docid": "f92919d100d35870af889b1c4e049954", "score": "0.60921973", "text": "func ToFloat(f float64, precision int) Float {\n\tfloatingLength := int64(math.Trunc(math.Pow(10, float64(precision))))\n\trounded := math.Round(f * float64(floatingLength))\n\n\treturn Float{\n\t\tinteger: int64(rounded) / floatingLength,\n\t\tdecimal: int64(rounded) % floatingLength,\n\t\tprecision: precision,\n\t}\n}", "title": "" }, { "docid": "eb3123abff8b77c57dfe8c9d7f57ab49", "score": "0.6036708", "text": "func newFloat(x float64) *big.Float {\n\treturn big.NewFloat(0).SetPrec(precision).SetFloat64(x)\n}", "title": "" }, { "docid": "5ac595b2a6273eaf326525ef4dc115d6", "score": "0.597933", "text": "func NewFloat(prec uint) *big.Float {\n\tv := new(big.Float).SetPrec(prec)\n\tv.Add(largeFloat, largeFloat)\n\tv.SetInt64(0)\n\treturn v\n}", "title": "" }, { "docid": "34193acf6ef47bd787f347289992b497", "score": "0.59372073", "text": "func ToFloat(x constant.Value,) constant.Value", "title": "" }, { "docid": "340595ffa2c5240350f31b6f29f366cb", "score": "0.5929295", "text": "func NewDecimal(x float64) *Decimal {\n\t// TODO: implement\n\tif math.IsNaN(x) {\n\t\tpanic(\"nan\")\n\t}\n\treturn new(Decimal).SetFloat64(x)\n}", "title": "" }, { "docid": "2cd85d681846e3f5125290f8efad4539", "score": "0.5872025", "text": "func (v Value) Float() float64", "title": "" }, { "docid": "ad876ee498a187ae87e3622faaf70711", "score": "0.5813091", "text": "func toFixed(num float64, precision int) float64 {\n\toutput := math.Pow(10, float64(precision))\n\treturn float64(int64(num*output)) / output\n}", "title": "" }, { "docid": "8715f9fb158bf8b4bb23f197a706ce43", "score": "0.57980645", "text": "func parseFloat(value string) float64 {\n\tprecio, _ := strconv.ParseFloat(value, 64)\n\n\treturn precio\n}", "title": "" }, { "docid": "4df23c3d490d499e9cca42cf1cfe0c37", "score": "0.5749304", "text": "func NewDecimal(value, scale int64) Decimal {\n\tv := big.NewInt(value)\n\treturn Decimal{\n\t\tvalue: *v,\n\t\tScale: scale,\n\t}\n}", "title": "" }, { "docid": "7ec9a2a7dbb92d55cf4b3c533052e7ed", "score": "0.57378227", "text": "func NewFloat(f float64) *Float {\n\treturn &Float{f: f}\n}", "title": "" }, { "docid": "34dd274db7f759da731739d5aced96c1", "score": "0.5709012", "text": "func NewFloat(raw string) *Float {\n\treturn &Float{common: common{name: \"Float\", raw: raw}}\n}", "title": "" }, { "docid": "568a31b3765a32976d937d02d8183725", "score": "0.5688431", "text": "func (c *ValueConverter) Float() *FloatConverter {\n\tvar (\n\t\tvalue float64\n\t\terr error\n\t)\n\n\tinV := reflect.Indirect(c.reflectValue)\n\tif inV.IsValid() {\n\t\tinT := inV.Type()\n\t\toutT := reflect.TypeOf(value)\n\t\tif inT.ConvertibleTo(outT) {\n\t\t\tvalue = inV.Convert(outT).Interface().(float64)\n\t\t} else if inT.Kind() == reflect.String {\n\t\t\tvalue, err = strconv.ParseFloat(inV.Interface().(string), 64)\n\t\t} else if inT.Kind() == reflect.Bool {\n\t\t\tif inV.Interface().(bool) == true {\n\t\t\t\tvalue = 1\n\t\t\t}\n\t\t} else {\n\t\t\terr = ErrUnsupportedType\n\t\t}\n\t} else {\n\t\terr = ErrInvalidValue\n\t}\n\n\tif err != nil {\n\t\terr = c.wrapConvertError(c.value, reflect.ValueOf((*float64)(nil)).Type().Elem(), err)\n\t}\n\treturn &FloatConverter{baseConverter: c.baseConverter, value: value, err: err}\n}", "title": "" }, { "docid": "1d43380effdd7354e5052414925d5ccb", "score": "0.5667208", "text": "func (me TcgFixed) ToXsdtFloat() xsdt.Float { return xsdt.Float(me) }", "title": "" }, { "docid": "c147bdeaa903fe43deaf4a4fcfb03a10", "score": "0.5661773", "text": "func FromFloat64(f float64) Decimal {\n\tscale := decimalPlaces(fmt.Sprintf(\"%v\", f))\n\tus := int64(f * math.Pow(10, float64(scale)))\n\treturn NewDecimal(us, int64(scale))\n}", "title": "" }, { "docid": "9ef49ee45217146b59012671888aa351", "score": "0.5655907", "text": "func (me TcgFixed1) ToXsdtFloat() xsdt.Float { return xsdt.Float(me) }", "title": "" }, { "docid": "3adf4753bbdf1af69e7b64fa58fa0a77", "score": "0.55979675", "text": "func Float(value float64) SdlValue {\n\treturn SdlValue{tag: tFloat, vFloat: value}\n}", "title": "" }, { "docid": "271b17dea2558187d2f4005de2783b9c", "score": "0.5591143", "text": "func (e *Entry) Float(key string, val float64) *Entry {\n\tif e != nil {\n\t\te.kvs = append(e.kvs, KeyValue{\n\t\t\tVtype: KvFloat64,\n\t\t\tKey: key,\n\t\t\tVf64: val,\n\t\t})\n\t}\n\treturn e\n}", "title": "" }, { "docid": "0a3c9ab6f6725d7d6d998cf2a9691f8c", "score": "0.55866927", "text": "func Float() Parser {\n\treturn Token(`[+-]?([0-9]+\\.[0-9]*|\\.[0-9]+)`, \"FLOAT\")\n}", "title": "" }, { "docid": "be39a4b2342b7bfc9e7694c7d6470501", "score": "0.55547446", "text": "func NewFromInt(value int64) Decimal {\n\treturn Decimal{\n\t\tvalue: big.NewInt(value),\n\t\texp: 0,\n\t}\n}", "title": "" }, { "docid": "5f2445ff20e4e3dcdd5a29b379814bf4", "score": "0.5543412", "text": "func Float(tk obj.Token, args []oop.Var) oop.Val {\n\treturn oop.Val{\n\t\tData: fmt.Sprintf(fract.FloatFormat, str.Conv(args[0].Val.String())),\n\t\tType: oop.Float,\n\t}\n}", "title": "" }, { "docid": "cbeb27099d5aa64d798e1bf33f60562a", "score": "0.55354345", "text": "func CreateOmaSettingFloatingPointFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {\n return NewOmaSettingFloatingPoint(), nil\n}", "title": "" }, { "docid": "7c888c8266b2a96a328546ed883082e7", "score": "0.55331135", "text": "func CreateQuoteFromFloat(value float64) Quote {\n\tunits, fraction := math.Modf(value)\n\treturn Quote{\n\t\tuint32(units),\n\t\tuint32(math.Trunc(fraction * 100)),\n\t}\n}", "title": "" }, { "docid": "9a1fdd0ab685a5ffae38655f13e84589", "score": "0.5532753", "text": "func toFloat(length int, vr ValueReader, isNegative bool, value reflect.Value) error {\n\tbuf, err := vr.ReadBytes(length, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar f float64\n\tif length == 4 {\n\t\tf = float64(Numeric.BytesToFloat32(buf, isNegative))\n\t} else {\n\t\tf = Numeric.BytesToFloat64(buf, isNegative)\n\t}\n\tvalue.SetFloat(f)\n\treturn nil\n}", "title": "" }, { "docid": "fc3d755587b432e223627123a8d75d67", "score": "0.5530548", "text": "func parseFloat(v reflect.Value, s string) error {\n\tvar bitSize int\n\tswitch v.Kind() {\n\tcase reflect.Float32:\n\t\tbitSize = 32\n\tcase reflect.Float64:\n\t\tbitSize = 64\n\tdefault:\n\t\tpanic(\"not a float\")\n\t}\n\tp, err := strconv.ParseFloat(s, bitSize)\n\tif err != nil {\n\t\treturn parseError(s, v.Type(), err)\n\t}\n\tv.SetFloat(p)\n\treturn nil\n}", "title": "" }, { "docid": "1f9203fafceeaf19018972bc24c974db", "score": "0.5481786", "text": "func MakeFloat(val float64) *PdfObjectFloat {\n\tnum := PdfObjectFloat(val)\n\treturn &num\n}", "title": "" }, { "docid": "1c021a6da4fb02c51c43ffdb0e16723e", "score": "0.54539156", "text": "func newNumber(f float64) number {\n\treturn number{f}\n}", "title": "" }, { "docid": "c989430d1a0f4c065dee121f87369906", "score": "0.54478884", "text": "func (v Value) SetFloat(x float64)", "title": "" }, { "docid": "61d44e8e509aa88b7ce120c853a2fffb", "score": "0.5419356", "text": "func floatPrecision(f float64, prec int) float64 {\n\treturn math.Round(f*math.Pow10(prec)) / math.Pow10(prec)\n}", "title": "" }, { "docid": "5cb0287be1dd1375f53cbd49e802b9bd", "score": "0.5418234", "text": "func (v *Float) Clone() Value { return NewFloat(*v.valPtr) }", "title": "" }, { "docid": "d0ba47e0345e7280bb41f8d4ca7ce2e5", "score": "0.5396454", "text": "func NewFloat(val float64) *Float {\n\tvalPtr := new(float64)\n\t*valPtr = val\n\n\treturn &Float{valPtr: valPtr}\n}", "title": "" }, { "docid": "4c7ce622da514892e4209abd56be1743", "score": "0.53807867", "text": "func (fm *FinalModelDecimal) Set(value Decimal) (int, error) {\n if (fm.buffer.Offset() + fm.FBEOffset() + fm.FBESize()) > fm.buffer.Size() {\n return 0, errors.New(\"model is broken\")\n }\n\n // Extract decimal parts\n negative := value.IsNegative()\n number := value.Coefficient()\n scale := -value.Exponent()\n\n // Check for decimal number overflow\n bits := number.BitLen()\n if (bits < 0) || (bits > 96) {\n // Value too big for .NET Decimal (bit length is limited to [0, 96])\n WriteCount(fm.buffer.Data(), fm.buffer.Offset() + fm.FBEOffset(), 0, fm.FBESize())\n return fm.FBESize(), errors.New(\"value too big for .NET Decimal (bit length is limited to [0, 96])\")\n }\n\n // Check for decimal scale overflow\n if (scale < 0) || (scale > 28) {\n // Value scale exceeds .NET Decimal limit of [0, 28]\n WriteCount(fm.buffer.Data(), fm.buffer.Offset() + fm.FBEOffset(), 0, fm.FBESize())\n return fm.FBESize(), errors.New(\"value scale exceeds .NET Decimal limit of [0, 28]\")\n }\n\n // Write unscaled value to bytes 0-11\n bytes := number.Bytes()\n for i := range bytes {\n WriteByte(fm.buffer.Data(), fm.buffer.Offset() + fm.FBEOffset() + i, bytes[len(bytes) - i - 1])\n }\n WriteCount(fm.buffer.Data(), fm.buffer.Offset() + fm.FBEOffset() + len(bytes), 0, 12 - len(bytes))\n\n // Write scale at byte 14\n WriteByte(fm.buffer.Data(), fm.buffer.Offset() + fm.FBEOffset() + 14, byte(scale))\n\n // Write signum at byte 15\n if negative {\n WriteByte(fm.buffer.Data(), fm.buffer.Offset() + fm.FBEOffset() + 15, 0x80)\n } else {\n WriteByte(fm.buffer.Data(), fm.buffer.Offset() + fm.FBEOffset() + 15, 0)\n }\n return fm.FBESize(), nil\n}", "title": "" }, { "docid": "37184c8eb06e6adfda74df6d9d244610", "score": "0.53696114", "text": "func (v Value) Float() float64 {\n\tf, err := cfgconv.Float(v.value)\n\tif err != nil && v.eh != nil {\n\t\tv.eh(err)\n\t}\n\treturn f\n}", "title": "" }, { "docid": "7a5d03c839c2bf35bf06f934b09f7001", "score": "0.5367955", "text": "func NewDecimalColumn(name string, tagmap map[string]string, isPointer bool) SDecimalColumn {\n\ttagmap, v, ok := utils.TagPop(tagmap, TAG_PRECISION)\n\tif !ok {\n\t\tpanic(fmt.Sprintf(\"Field %q of float misses precision tag\", name))\n\t}\n\tprec, err := strconv.Atoi(v)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"Field precision of %q shoud be integer (%q)\", name, v))\n\t}\n\treturn SDecimalColumn{\n\t\tSBaseWidthColumn: NewBaseWidthColumn(name, \"DECIMAL\", tagmap, isPointer),\n\t\tPrecision: prec,\n\t}\n}", "title": "" }, { "docid": "ea2c6682f16e170f474da597b4feb967", "score": "0.5360591", "text": "func NewFromString(value string) (Decimal, error) {\n\toriginalInput := value\n\tvar intString string\n\tvar exp int64\n\n\t// Check if number is using scientific notation\n\teIndex := strings.IndexAny(value, \"Ee\")\n\tif eIndex != -1 {\n\t\texpInt, err := strconv.ParseInt(value[eIndex+1:], 10, 32)\n\t\tif err != nil {\n\t\t\tif e, ok := err.(*strconv.NumError); ok && e.Err == strconv.ErrRange {\n\t\t\t\treturn Decimal{}, fmt.Errorf(\"can't convert %s to decimal: fractional part too long\", value)\n\t\t\t}\n\t\t\treturn Decimal{}, fmt.Errorf(\"can't convert %s to decimal: exponent is not numeric\", value)\n\t\t}\n\t\tvalue = value[:eIndex]\n\t\texp = expInt\n\t}\n\n\tpIndex := -1\n\tvLen := len(value)\n\tfor i := 0; i < vLen; i++ {\n\t\tif value[i] == '.' {\n\t\t\tif pIndex > -1 {\n\t\t\t\treturn Decimal{}, fmt.Errorf(\"can't convert %s to decimal: too many .s\", value)\n\t\t\t}\n\t\t\tpIndex = i\n\t\t}\n\t}\n\n\tif pIndex == -1 {\n\t\t// There is no decimal point, we can just parse the original string as\n\t\t// an int\n\t\tintString = value\n\t} else {\n\t\tif pIndex+1 < vLen {\n\t\t\tintString = value[:pIndex] + value[pIndex+1:]\n\t\t} else {\n\t\t\tintString = value[:pIndex]\n\t\t}\n\t\texpInt := -len(value[pIndex+1:])\n\t\texp += int64(expInt)\n\t}\n\n\tvar dValue *big.Int\n\t// strconv.ParseInt is faster than new(big.Int).SetString so this is just a shortcut for strings we know won't overflow\n\tif len(intString) <= 18 {\n\t\tparsed64, err := strconv.ParseInt(intString, 10, 64)\n\t\tif err != nil {\n\t\t\treturn Decimal{}, fmt.Errorf(\"can't convert %s to decimal\", value)\n\t\t}\n\t\tdValue = big.NewInt(parsed64)\n\t} else {\n\t\tdValue = new(big.Int)\n\t\t_, ok := dValue.SetString(intString, 10)\n\t\tif !ok {\n\t\t\treturn Decimal{}, fmt.Errorf(\"can't convert %s to decimal\", value)\n\t\t}\n\t}\n\n\tif exp < math.MinInt32 || exp > math.MaxInt32 {\n\t\t// NOTE(vadim): I doubt a string could realistically be this long\n\t\treturn Decimal{}, fmt.Errorf(\"can't convert %s to decimal: fractional part too long\", originalInput)\n\t}\n\n\treturn Decimal{\n\t\tvalue: dValue,\n\t\texp: int32(exp),\n\t}, nil\n}", "title": "" }, { "docid": "3a0f97497cceb3ccae27a31d1a0f9675", "score": "0.5360485", "text": "func F(n float64, v uint64) (f int64) {\n\n\ts := strconv.FormatFloat(n-float64(int64(n)), 'f', int(v), 64)\n\n\t// with either be '0' or '0.xxxx', so if 1 then f will be zero\n\t// otherwise need to parse\n\tif len(s) != 1 {\n\n\t\t// ignoring error, because it can't fail as we generated\n\t\t// the string internally from a real number\n\t\tf, _ = strconv.ParseInt(s[2:], 10, 64)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "90f2504809f13ff90f92b7cd3d5ac4ef", "score": "0.5357254", "text": "func New(value int64, exp int32) Decimal {\n\treturn Decimal{\n\t\tvalue: big.NewInt(value),\n\t\texp: exp,\n\t}\n}", "title": "" }, { "docid": "c85ea52cebbc9cdc973f8df9c73ab18c", "score": "0.53549284", "text": "func FloatToDecimal(bin string) (string, error) {\n\tif len(bin) != 32 {\n\t\treturn \"\", errors.New(\"Bit string must be 32 bits long\")\n\t}\n\tbits := []rune(bin)\n\tsignBit := bits[0]\n\tvar sign int\n\tif signBit == '0' {\n\t\tsign = 1\n\t} else {\n\t\tsign = -1\n\t}\n\texponent, err := BinToDec(string(bits[1:9]), false)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\texponent -= bias\n\tmantisaBits := bits[9:32]\n\tmantisa := calculateMantisaValue(mantisaBits)\n\tfraction := mantisa * float64(sign)\n\treturn fmt.Sprintf(\"%f * 2^%d\", fraction, exponent), nil\n}", "title": "" }, { "docid": "1cd0ce34fd35926262dfd7aa06ffca19", "score": "0.53270817", "text": "func (v Value) Float() float64 {\n\tf, _ := strconv.ParseFloat(string(v), 64)\n\treturn f\n}", "title": "" }, { "docid": "3c0e9f087aec8e1a1b4c8526cd91214d", "score": "0.53203154", "text": "func (s *Scope) FloatValf(template string, args ...interface{}) *FloatVal {\n\treturn s.FloatVal(fmt.Sprintf(template, args...))\n}", "title": "" }, { "docid": "e6075e784cde358ffd770d414a00ec8e", "score": "0.5319902", "text": "func ToFloat(v Value) (Float, bool) {\n\tswitch v := v.(type) {\n\tcase String:\n\t\tf, ok := str2float(string(v))\n\t\treturn Float(f), ok\n\tcase Float:\n\t\treturn v, true\n\tcase Int:\n\t\treturn Float(v), true\n\t}\n\treturn 0, false\n}", "title": "" }, { "docid": "d5d0d62943222ac4c10b5824f8e7322e", "score": "0.5307061", "text": "func (fs *FlagSet) Float(\n\tname string,\n\tdefaultValue float64,\n\tusage string,\n\textractors ...Extractor,\n) *float64 {\n\tv := new(float64)\n\tfs.FloatVar(v, name, defaultValue, usage, extractors...)\n\treturn v\n}", "title": "" }, { "docid": "2242820b97abf35a03a3a3e3fd3a5db2", "score": "0.5295081", "text": "func Float(f float64) dgo.Float {\n\treturn floatVal(f)\n}", "title": "" }, { "docid": "f7e2abf3fcf5e47c6542832a2830820c", "score": "0.52698344", "text": "func CtoF(c float64) float64 {\n\treturn c*1.8 + 32\n}", "title": "" }, { "docid": "4112dee9129963faa5bd8f7b796def29", "score": "0.52566475", "text": "func (v *Float) Set(value float64)", "title": "" }, { "docid": "3184c48f02ce0b75cc2a751e05b9939a", "score": "0.5252402", "text": "func NumberFloatVal(v float64) Value {\n\treturn NumberVal(new(big.Float).SetFloat64(v))\n}", "title": "" }, { "docid": "cc05bfaf3ba379abe8967c500d3c1712", "score": "0.52420163", "text": "func (t *Trade) PriceFloat() float64 {\n\tp, _ := strconv.ParseFloat(t.Price, 64)\n\treturn p\n}", "title": "" }, { "docid": "5f80cee8c8c57ba5b62965e21f0e2724", "score": "0.5225972", "text": "func ToDecimal(raw interface{}) string {\n\tvar s string\n\n\tswitch t := raw.(type) {\n\tcase float64:\n\t\ts = strconv.FormatFloat(t, 'f', 2, 64)\n\tcase interface{}:\n\t\ts = replace(raw.(string), \"float\")\n\tdefault:\n\t\ts = \"\"\n\t}\n\n\tif len(s) > 0 {\n\t\tvar f, l string\n\n\t\tf = s[0 : len(s)-3]\n\t\tl = s[len(s)-2:]\n\n\t\tif len(f) > 3 {\n\t\t\tt := ToThousand(f, false)\n\t\t\tfmt.Println(\"t:\", t)\n\n\t\t\ts = t + \".\" + l\n\t\t}\n\t}\n\n\treturn s\n}", "title": "" }, { "docid": "5bde42b854545bb6c4bfb874e952caaf", "score": "0.52243376", "text": "func setFloat(field reflect.Value, value string, bitSize int) error {\n\tif value == \"\" {\n\t\tvalue = \"0.0\"\n\t}\n\n\tval, err := strconv.ParseFloat(value, bitSize)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfield.SetFloat(val)\n\n\treturn nil\n}", "title": "" }, { "docid": "9c7d41a2da8727482a57d62e39a9f3a6", "score": "0.52190965", "text": "func (v Value) Float() float64 {\n\treturn v.v\n}", "title": "" }, { "docid": "17baf92e5b9e41f3966d4287f537d2fc", "score": "0.5211944", "text": "func SetValueFloat(homeID uint32, valueID uint64, value float32) error {\n\tcvalueid := C.valueid_create(C.uint32_t(homeID), C.uint64_t(valueID))\n\tdefer C.valueid_free(cvalueid)\n\tok := bool(C.manager_setValueFloat(cmanager, cvalueid, C.float(value)))\n\tif ok == false {\n\t\treturn fmt.Errorf(\"value is not of decimal type\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9897792a0d5d8af0eaff2d3acd5dc167", "score": "0.5198111", "text": "func Float64ToDecimal(f float64) (Decimal, error) {\r\n\treturn Float64ToDecimalScale(f, autoScale)\r\n}", "title": "" }, { "docid": "5274b3b205a7a1f19bdfac95bc026041", "score": "0.51965415", "text": "func (me TcgFloat1) ToXsdtFloat() xsdt.Float { return xsdt.Float(me) }", "title": "" }, { "docid": "d6da9da30b751ae65a249bb1601b479c", "score": "0.5191584", "text": "func ValueFloat(prefix string, v float32, floatFormat string) {\n\tprefix = safeString(prefix)\n\tcprefix, _ := unpackPCharString(prefix)\n\tcv, _ := (C.float)(v), cgoAllocsUnknown\n\tfloatFormat = safeString(floatFormat)\n\tcfloatFormat, _ := unpackPCharString(floatFormat)\n\tC.igValueFloat(cprefix, cv, cfloatFormat)\n\truntime.KeepAlive(floatFormat)\n\truntime.KeepAlive(prefix)\n}", "title": "" }, { "docid": "b64a535e7c8f2db21bfe9fa0119ad05c", "score": "0.5183188", "text": "func (me TcgFloat) ToXsdtFloat() xsdt.Float { return xsdt.Float(me) }", "title": "" }, { "docid": "0fd24227e6dd91e62f95afb7119da6c5", "score": "0.5182927", "text": "func (this *ot_record) FloatValue() (float64, error) {\n\t// Check data length\n\tif int(this.datasize) != len(this.data) {\n\t\treturn 0, gopi.ErrOutOfOrder\n\t}\n\t// Convert fixed point into floating point\n\tswitch this.datatype {\n\tcase sensors.OT_DATATYPE_UDEC_0:\n\t\tvalue, err := this.uintValue()\n\t\treturn float64(value), err\n\tcase sensors.OT_DATATYPE_UDEC_8:\n\t\tvalue, err := this.uintValue()\n\t\treturn float64(value) / float64(1<<8), err\n\tcase sensors.OT_DATATYPE_DEC_8:\n\t\tvalue, err := this.intValue()\n\t\treturn float64(value) / float64(1<<8), err\n\tdefault:\n\t\treturn 0, gopi.ErrBadParameter\n\t}\n}", "title": "" }, { "docid": "9fef66702fd84738ee0dfcb5ccbb2fd2", "score": "0.51821065", "text": "func NewDecimal(d *decimal.Big) Decimal {\n\treturn Decimal{Big: d}\n}", "title": "" }, { "docid": "93d06b57b905d454fa70c0652dab37e9", "score": "0.5174677", "text": "func CtoF(cel float64) float64{\nreturn ((9*cel + 160)/5)\n}", "title": "" }, { "docid": "133e42d70d6b63f2ff2f880867b6d0cc", "score": "0.5169799", "text": "func BigToFloat(b *big.Int, decimal int64) float64 {\n\tf := new(big.Float).SetInt(b)\n\tpower := new(big.Float).SetInt(new(big.Int).Exp(\n\t\tbig.NewInt(10), big.NewInt(decimal), nil,\n\t))\n\tres := new(big.Float).Quo(f, power)\n\tresult, _ := res.Float64()\n\treturn result\n}", "title": "" }, { "docid": "bdc22044b712674f96132dedbf6a1305", "score": "0.5168033", "text": "func Float(in string) (out T.Float, err error) {\n\tvar i float64\n\ti, err = strconv.ParseFloat(in, 64)\n\treturn T.Float(i), err\n}", "title": "" }, { "docid": "0f9a995c83846ba5c9ce8a384205b04e", "score": "0.5162593", "text": "func Float(symbols *symbols.SymbolTable, args []interface{}) (interface{}, error) {\n\tv := util.Coerce(args[0], 1.0)\n\tif v == nil {\n\t\treturn nil, errors.ErrInvalidType.Context(\"float\")\n\t}\n\treturn v.(float64), nil\n}", "title": "" }, { "docid": "5c6e4dea472d5df49e0943a7097c1f5e", "score": "0.51598185", "text": "func FloatPrecision(num float64, precision int) float64 {\n\tm := \"1\" + strings.Repeat(\"0\", precision)\n\tmx, _ := strconv.Atoi(m)\n\treturn float64(int(num*float64(mx))) / float64(mx)\n}", "title": "" }, { "docid": "f3c840cebfa41f67859fee8308a18c00", "score": "0.5151494", "text": "func floatToDollar(amount float64) int64 {\n\tamount = amount * 100\n\tval, _ := strconv.ParseInt(fmt.Sprintf(\"%0.0f\", amount), 10, 64)\n\treturn val\n}", "title": "" }, { "docid": "3c6dc201f97116f83a3bc962a40b526a", "score": "0.51491004", "text": "func (f FloatXMR) Decimal() string {\n\treturn fmt.Sprintf(\"%.12f\", f)\n}", "title": "" }, { "docid": "d3f0cd405e7d5dbeb5da93840d778521", "score": "0.5143687", "text": "func GetValueFloatPrecision(homeID uint32, valueID uint64) (uint8, error) {\n\tcvalueid := C.valueid_create(C.uint32_t(homeID), C.uint64_t(valueID))\n\tdefer C.valueid_free(cvalueid)\n\tvar cprecision C.uint8_t\n\tok := bool(C.manager_getValueFloatPrecision(cmanager, cvalueid, &cprecision))\n\tif ok == false {\n\t\treturn uint8(cprecision), fmt.Errorf(\"value is not of decimal type\")\n\t}\n\treturn uint8(cprecision), nil\n}", "title": "" }, { "docid": "79b458b21cd94ac3dcbd97860ea4717d", "score": "0.5140962", "text": "func (ss SeatSeconds) ToFloat() float64 {\n\treturn float64(ss) / ssScale\n}", "title": "" }, { "docid": "32a3cd6954f49bf4c99db22ec26af7ae", "score": "0.5123997", "text": "func (me TcgHalf1) ToXsdtFloat() xsdt.Float { return xsdt.Float(me) }", "title": "" }, { "docid": "d4b614bf29c80a45451bf6f926cb474c", "score": "0.5121811", "text": "func NewFloat(typ *types.FloatType, x float64) *Float {\n\tif math.IsNaN(x) {\n\t\tf := &Float{Typ: typ, X: &big.Float{}, NaN: true}\n\t\t// Store sign of NaN.\n\t\tif math.Signbit(x) {\n\t\t\tf.X.SetFloat64(-1)\n\t\t}\n\t\treturn f\n\t}\n\treturn &Float{Typ: typ, X: big.NewFloat(x)}\n}", "title": "" }, { "docid": "5ec21278becfee93fc129ca1621c6895", "score": "0.51181793", "text": "func (me TglAlphaValueType) ToXsdtFloat() xsdt.Float { return xsdt.Float(me) }", "title": "" }, { "docid": "cfb49b978a69595be4e6cc5f4987a322", "score": "0.51150554", "text": "func ProduceFloatWithSpecifiedTp(f float64, target *FieldType, sc *stmtctx.StatementContext) (_ float64, err error) {\n\t// For float and following double type, we will only truncate it for float(M, D) format.\n\t// If no D is set, we will handle it like origin float whether M is set or not.\n\tif target.Flen != UnspecifiedLength && target.Decimal != UnspecifiedLength {\n\t\tf, err = TruncateFloat(f, target.Flen, target.Decimal)\n\t\tif err = sc.HandleOverflow(err, err); err != nil {\n\t\t\treturn f, errors.Trace(err)\n\t\t}\n\t}\n\tif mysql.HasUnsignedFlag(target.Flag) && f < 0 {\n\t\treturn 0, overflow(f, target.Tp)\n\t}\n\treturn f, nil\n}", "title": "" }, { "docid": "fee453b80ec0ef763e31db9bda6a5fe8", "score": "0.5110497", "text": "func (t Throughput) Float() float64 {\n\treturn math.Round(float64(t)*10) / 10\n}", "title": "" }, { "docid": "470af36ce483066ea11cc0d19a76fbcc", "score": "0.5109699", "text": "func intToFloat(amount int64) float64 {\n\tvalue := float64(amount) * 0.01\n\trr := fmt.Sprintf(\"%0.2f\", value)\n\tdollar, _ := strconv.ParseFloat(rr, 64)\n\treturn dollar\n}", "title": "" }, { "docid": "b9e000e025fcbf3e9a796ddc83f55436", "score": "0.50935906", "text": "func (this *IniValue) GetValFloat(offset int, defVal float32) float32 {\n if offset >= len(this.Values) {\n return defVal\n }\n\n fVal, err := strconv.ParseFloat(this.Values[offset], 32)\n if err != nil {\n return defVal\n }\n\n return float32(fVal)\n}", "title": "" }, { "docid": "93df8bd90172d9c231fa68b1826303b1", "score": "0.5085448", "text": "func parseFloatValue(input string) (res float64) {\n\tvar err error\n\n\tres, err = strconv.ParseFloat(input, 64)\n\tif err != nil {\n\t\t// negative values must be dropped here\n\t\treturn\n\t}\n\n\tif res < 0 {\n\t\treturn 0\n\t}\n\treturn\n}", "title": "" }, { "docid": "69f06c1d9d0bf379c7b09d06d5daf261", "score": "0.50765276", "text": "func ToFloat(value interface{}) (v float64, ok bool) {\n\tok = true\n\tswitch value := value.(type) {\n\tcase floatVal:\n\t\tv = float64(value)\n\tcase float64:\n\t\tv = value\n\tcase float32:\n\t\tv = float64(value)\n\tdefault:\n\t\tok = false\n\t}\n\treturn\n}", "title": "" }, { "docid": "219ece971952a2c7f6d6504bf082b2c5", "score": "0.5073571", "text": "func TruncateFloat(f float64, precision uint) float64 {\n\tx := math.Pow(10, float64(precision))\n\treturn float64(int(f*x)) / x\n}", "title": "" }, { "docid": "df40be3a828b382b97350506c0c20683", "score": "0.50632906", "text": "func (p *Parser) AddFloat(value float64, path ...string) error {\n\treturn p.Add([]byte(strconv.FormatFloat(value, 'e', -1, 64)), path...)\n}", "title": "" }, { "docid": "2823f681a847c36705f77d4dd980c39b", "score": "0.50605744", "text": "func AppendFixedPointDecimal(b []byte, v int64, p int) []byte {\n\tif v == 0 {\n\t\treturn append(b, '0')\n\t}\n\n\tif p == 0 {\n\t\treturn strconv.AppendInt(b, v, 10)\n\t}\n\n\tif v < 0 {\n\t\tv = -v\n\t\tb = append(b, '-')\n\t}\n\n\ts := len(b)\n\tb = strconv.AppendInt(b, v, 10)\n\n\tif len(b)-s > p {\n\t\ti := len(b) - p\n\t\tb = append(b, 0)\n\t\tcopy(b[i+1:], b[i:])\n\t\tb[i] = '.'\n\t} else {\n\t\ti := 2 + p - (len(b) - s)\n\t\tfor j := 0; j < i; j++ {\n\t\t\tb = append(b, 0)\n\t\t}\n\t\tcopy(b[s+i:], b[s:])\n\t\tcopy(b[s:], []byte(zeroPrefix[:i]))\n\t}\n\n\treturn b\n}", "title": "" }, { "docid": "4a60fb2f96b46f68c80f428adb6c2318", "score": "0.50586516", "text": "func Float64ToDecimalScale(f float64, scale uint8) (Decimal, error) {\r\n\tvar dec Decimal\r\n\tif math.IsNaN(f) {\r\n\t\treturn dec, errors.New(\"NaN\")\r\n\t}\r\n\tif math.IsInf(f, 0) {\r\n\t\treturn dec, errors.New(\"Infinity can't be converted to decimal\")\r\n\t}\r\n\tdec.positive = f >= 0\r\n\tif !dec.positive {\r\n\t\tf = math.Abs(f)\r\n\t}\r\n\tif f > 3.402823669209385e+38 {\r\n\t\treturn dec, errors.New(\"Float value is out of range\")\r\n\t}\r\n\tdec.prec = 20\r\n\tvar integer float64\r\n\tfor dec.scale = 0; dec.scale <= scale; dec.scale++ {\r\n\t\tinteger = f * scaletblflt64[dec.scale]\r\n\t\t_, frac := math.Modf(integer)\r\n\t\tif frac == 0 && scale == autoScale {\r\n\t\t\tbreak\r\n\t\t}\r\n\t}\r\n\tfor i := 0; i < 4; i++ {\r\n\t\tmod := math.Mod(integer, 0x100000000)\r\n\t\tinteger -= mod\r\n\t\tinteger /= 0x100000000\r\n\t\tdec.integer[i] = uint32(mod)\r\n\t\tif mod-math.Trunc(mod) >= 0.5 {\r\n\t\t\tdec.integer[i] = uint32(mod) + 1\r\n\t\t}\r\n\t}\r\n\treturn dec, nil\r\n}", "title": "" }, { "docid": "71b6223551240ccc25d008716f3288ba", "score": "0.5055579", "text": "func (p Parameters) SetFloat(name string, f float64) { p[name] = strconv.FormatFloat(f, 'g', -1, 64) }", "title": "" }, { "docid": "bb1b43d234f67ad50b40eacf435fb508", "score": "0.5052043", "text": "func (v *Vec3) DivideFloat(divisor float64) (*Vec3, error) {\n\tif divisor == 0 {\n\t\treturn nil, errors.New(\"cannot divide by 0\")\n\t}\n\treturn &Vec3{\n\t\tX: v.X / divisor,\n\t\tY: v.Y / divisor,\n\t\tZ: v.Z / divisor,\n\t}, nil\n}", "title": "" }, { "docid": "9ce157f7fcb1d5ec7b69d26032c5cad2", "score": "0.5050166", "text": "func (b BPS) Float() float64 {\n\treturn float64(b)\n}", "title": "" }, { "docid": "32b139b671a79bf8854de23af3c6c48e", "score": "0.50488", "text": "func (fm *FinalModelDecimal) Get() (Decimal, int, error) {\n if (fm.buffer.Offset() + fm.FBEOffset() + fm.FBESize()) > fm.buffer.Size() {\n return DecimalZero(), 0, errors.New(\"model is broken\")\n }\n\n // Read decimal parts\n low := ReadUInt32(fm.buffer.Data(), fm.buffer.Offset() + fm.FBEOffset())\n mid := ReadUInt32(fm.buffer.Data(), fm.buffer.Offset() + fm.FBEOffset() + 4)\n high := ReadUInt32(fm.buffer.Data(), fm.buffer.Offset() + fm.FBEOffset() + 8)\n flags := ReadUInt32(fm.buffer.Data(), fm.buffer.Offset() + fm.FBEOffset() + 12)\n\n // Calculate decimal value\n negative := (flags & 0x80000000) != 0\n scale := (flags & 0x7FFFFFFF) >> 16\n result := decimal.New(int64(high), 0).Mul(lowScaleFinal)\n result = result.Add(decimal.New(int64(mid), 0).Mul(midScaleFinal))\n result = result.Add(decimal.New(int64(low), 0))\n result = result.Shift(-int32(scale))\n if negative {\n result = result.Neg()\n }\n\n return Decimal{result}, fm.FBESize(), nil\n}", "title": "" }, { "docid": "9f37cf492016b0323a126f69dda2cbc9", "score": "0.50471056", "text": "func (f Float) Copy() PropValue {\n\treturn f\n}", "title": "" }, { "docid": "af65b9c525320a1e81dba665463317b7", "score": "0.50469583", "text": "func (f FIXFloat) Float64() float64 { return float64(f) }", "title": "" }, { "docid": "bde4dff29697e37fece59ef02ce0031e", "score": "0.5043755", "text": "func (me TcgHalf) ToXsdtFloat() xsdt.Float { return xsdt.Float(me) }", "title": "" }, { "docid": "d5ee94b2ba6230bc7179736038d3126a", "score": "0.504121", "text": "func Float(key string, opts ...schema.SchemaOption) schema.Conv {\n\treturn schema.SetOptions(schema.Conv{Key: key, Func: toFloat}, opts)\n}", "title": "" }, { "docid": "bd766aae43f5934c9e93db293bf6373a", "score": "0.50368065", "text": "func GetValueAsFloat(homeID uint32, valueID uint64) (float32, error) {\n\tcvalueid := C.valueid_create(C.uint32_t(homeID), C.uint64_t(valueID))\n\tdefer C.valueid_free(cvalueid)\n\tvar cfloat C.float\n\tok := bool(C.manager_getValueAsFloat(cmanager, cvalueid, &cfloat))\n\tif ok == false {\n\t\treturn float32(cfloat), fmt.Errorf(\"value is not of decimal type\")\n\t}\n\treturn float32(cfloat), nil\n}", "title": "" }, { "docid": "4fb47150f1aef733af49bab7680685bd", "score": "0.50302213", "text": "func (f Float) Divide(x Float) Float {\n\tif x.Float64() == 0 {\n\t\treturn ToFloat(0, 0)\n\t}\n\tmax := getMaxPrecision(f.precision, x.precision)\n\tdev := f.Float64() / x.Float64()\n\treturn ToFloat(dev, max)\n}", "title": "" }, { "docid": "8e21b411e133845b30e42f8d2219ed35", "score": "0.5028039", "text": "func (me TglslFloat) ToXsdtFloat() xsdt.Float { return xsdt.Float(me) }", "title": "" }, { "docid": "c93f4240f4818d07a72d6e2e7727b6fc", "score": "0.502401", "text": "func StringDecimalSwitchFloat(decimalChar, inString string) float64 {\n\tif inString == \"\" {\n\t\tinString = \"0\"\n\t}\n\tswitch decimalChar {\n\tcase \",\":\n\t\tf, _ := strconv.ParseFloat(strings.Replace(inString, \",\", \".\", 1), 64)\n\t\treturn f\n\tcase \".\":\n\t\tf, _ := strconv.ParseFloat(inString, 64)\n\t\treturn f\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "111a04d2944c2af344eb0924f3008344", "score": "0.5017222", "text": "func AsFloat(source interface{}, state data.Map) (interface{}, error) {\n\treturn toolbox.AsFloat(source), nil\n}", "title": "" }, { "docid": "4f3c031079b0cccb3e6f9e125292e435", "score": "0.50164926", "text": "func (d *Decoder) convertFloat(out []byte, typeBytePos int, buf []byte) ([]byte, error) {\n\tn, err := strconv.ParseFloat(string(buf), 64)\n\tif err != nil {\n\t\treturn nil, d.parseError(nil, fmt.Sprintf(\"float conversion: %v\", err))\n\t}\n\n\toverwriteTypeByte(out, typeBytePos, bsonDouble)\n\tvar x [8]byte\n\txs := x[0:8]\n\tbinary.LittleEndian.PutUint64(xs, math.Float64bits(n))\n\tout = append(out, xs...)\n\treturn out, nil\n}", "title": "" }, { "docid": "ebb4b9c91ac94cabf4d4f3ddf0e6b5b1", "score": "0.5013599", "text": "func (e *ERC20) FloatToBigInt(v float64) *big.Int {\n\tif e.decimals == 18 {\n\t\treturn big.NewInt(int64(v * 1e18))\n\t}\n\t// v * math.Pow(10, float64(e.decimals))\n\tfor i := 0; i < e.decimals; i++ {\n\t\tv *= 10\n\t}\n\treturn big.NewInt(int64(v))\n}", "title": "" }, { "docid": "cf0c13a6562e156979909e423f8c2c21", "score": "0.49905995", "text": "func (mrb *MrbState) Float(val MrbValue) (Value, error) {\n\treturn mrb.EnsureFloatType(val)\n}", "title": "" }, { "docid": "209ebbe007315a33a5dd95da689d34ea", "score": "0.49889424", "text": "func NewFractional(s string) *Fractional {\n\tvar stake, payout *big.Float\n\tvar err error\n\n\tss := strings.Split(s, \"/\")\n\tn := ss[0]\n\td := ss[1]\n\n\tstake = new(big.Float)\n\tpayout = new(big.Float)\n\n\tstake, _, err = stake.Parse(d, 10)\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\tpayout, _, err = payout.Parse(n, 10)\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\tpayout.Add(payout, stake)\n\n\treturn &Fractional{\n\t\tprob: stake.Quo(stake, payout),\n\t}\n}", "title": "" } ]
f4b49196e8d03f56e6f9e7fd79f4d5c7
creates child and abandons it afterwards
[ { "docid": "16bd7ac948d3efe931e14ed233c155c6", "score": "0.0", "text": "func restartProgram(args ...string) {\n\tlog.Print(\"PoELogoutReplay restart...\")\n\tcmd := exec.Command(EXE, args...)\n\terr := cmd.Start()\n\tif err != nil {\n\t\tlog.Printf(\"gracefulRestart: Failed to launch, error: %v\", err)\n\t\treturn\n\t}\n\ttime.Sleep(1 * time.Second)\n\tonExit()\n}", "title": "" } ]
[ { "docid": "a0ea7ca193ec74dfa41da7a412eaa5dc", "score": "0.66296273", "text": "func (li *line) makeChild() *line {\n\t// Length of new line should be 60-90% of parent length\n\tlength := (rand.Float64()*3/10 + 0.6) * float64(li.length())\n\n\t// Get angle of original line:\n\tangle := math.Atan2(float64(li.End.Y-li.Start.Y), float64(li.End.X-li.Start.X))\n\t// New line should be within 60 degrees (pi/3) in either direction.\n\tangle = angle - math.Pi/3 + rand.Float64()*math.Pi*2/3\n\n\t// So now we have direction and length of the new line, but we need to figure\n\t// out the actual point. The easiest way I know of to do this is to get the\n\t// unit vector in the direction we want, multiply it by the desired length,\n\t// and add the scaled up vector to the point we want to start from.\n\treturn &line{\n\t\tStart: li.End,\n\t\tEnd: point{li.End.X + float32(length*math.Cos(angle)), li.End.Y + float32(length*math.Sin(angle))},\n\t\tMaxChildren: int(rand.Int31n(5)),\n\t\tDepth: li.Depth + 1,\n\t}\n}", "title": "" }, { "docid": "48c066638690274aecc35b2dfb77a9ae", "score": "0.65348786", "text": "func (n *Node) CreateChild(edge string, child tree.Node) {\n\tn.children[edge] = child\n}", "title": "" }, { "docid": "f21c0914d7bccf8bcdb1f233c05a7b6f", "score": "0.6382365", "text": "func (n *Node) CreateChild() *Node {\n\treturn New(n)\n}", "title": "" }, { "docid": "b9726d9b0b8f46100f6f5ec24881a287", "score": "0.6328297", "text": "func (n *Node) newChild(ctx context.Context, st *syscall.Stat_t, out *fuse.EntryOut) *fs.Inode {\n\trn := n.rootNode()\n\t// Get stable inode number based on underlying (device,ino) pair\n\t// (or set to zero in case of `-sharestorage`)\n\trn.inoMap.TranslateStat(st)\n\tout.Attr.FromStat(st)\n\t// Create child node\n\tid := fs.StableAttr{\n\t\tMode: uint32(st.Mode),\n\t\tGen: 1,\n\t\tIno: st.Ino,\n\t}\n\tnode := &Node{}\n\treturn n.NewInode(ctx, node, id)\n}", "title": "" }, { "docid": "4c23dcb4cacd643bac2e347bb765fb08", "score": "0.6060104", "text": "func (s *Span) CreateChild(ctx context.Context) (context.Context, *Span) {\n\treturn s.createChildSpan(ctx, false)\n}", "title": "" }, { "docid": "fe618f64ad583625c7c1af487388c4da", "score": "0.6029761", "text": "func (b Block) GenerateChild(data string) Block {\n nextIndex := b.Index + 1\n nextTimestamp := time.Now()\n\n return Block{\n Index: nextIndex,\n PreviousHash: b.Hash,\n Timestamp: nextTimestamp,\n Data: data,\n Hash: b.CreateHash(nextIndex, b.Hash, nextTimestamp, data),\n }\n}", "title": "" }, { "docid": "2d174667b18708c1d2be6037f7f12151", "score": "0.6014477", "text": "func newChildProcess() *childProcess {\n\tact := newActor()\n\tcmd := exec.Command(os.Args[0])\n\n\t// Show the output of our child processes on the dispatcher's terminal.\n\tcmd.Stdout = os.Stdout\n\tcmd.Stderr = os.Stderr\n\n\t// To make a long story short: Go's multithreaded nature forbids using\n\t// plain fork. So we have to use fork + exec instead. This starts\n\t// a completely new process. We use an envirnment variable to tell this\n\t// process that it is a child, not a dispatcher. To allow communication,\n\t// we pass the already created pipes as ExtraFiles to the new process.\n\t// The child process inherits these ExtraFiles as already open files.\n\tcmd.Env = os.Environ()\n\tcmd.Env = append(cmd.Env, \"SPAWN_WORKER=yes\")\n\n\t// Child receives the same command-line arguments as the dispatcher.\n\tcmd.Args = os.Args\n\n\t// Child inherites these file descriptors as already opened files.\n\tcmd.ExtraFiles = make([]*os.File, 0, 8)\n\tcmd.ExtraFiles = append(cmd.ExtraFiles, self.getFiles()...)\n\tcmd.ExtraFiles = append(cmd.ExtraFiles, act.getFiles()...)\n\n\t// Encoder is used to send tasks to child processes.\n\t// Decoder is used to receive finished tasks from child processes.\n\tenc := gob.NewEncoder(act.input.writeEnd)\n\tdec := gob.NewDecoder(act.output.readEnd)\n\n\treturn &childProcess{act, cmd, enc, dec}\n}", "title": "" }, { "docid": "61260d992dcb327bbefac2761123c27a", "score": "0.59859234", "text": "func (self *Stage) AddChild(child *DisplayObject) *DisplayObject{\n return &DisplayObject{self.Object.Call(\"addChild\", child)}\n}", "title": "" }, { "docid": "a596cf532f02cce922e14618efb4912b", "score": "0.59349984", "text": "func (_Parent *ParentTransactor) GenerateChild(opts *bind.TransactOpts, i *big.Int) (*types.Transaction, error) {\n\treturn _Parent.contract.Transact(opts, \"generateChild\", i)\n}", "title": "" }, { "docid": "f49b9ae6e4323805482b868312f98256", "score": "0.58788234", "text": "func (n *NodeDef) NewChild(name String, classuri *url.URL) *NodeDef {\n\tchild := NewNodeDef(name, n, classuri)\n\tn.Children = append(n.Children, child)\n\t//if name.Cmp(ValueString) == 0 {\n\t//\tn.Value = child\n\t//}\n\treturn child\n}", "title": "" }, { "docid": "015f4ff51433ef31c853a4033621b8eb", "score": "0.58276236", "text": "func addChild(parent *Tree, child *Tree) {\n parent.Children = append(parent.Children, child)\n}", "title": "" }, { "docid": "f124508f8822027cd8968a079279ae18", "score": "0.57983387", "text": "func (h *spanHook) OnCreateChild(parent, child *tracing.Span) error {\n\tchild.AddHooks(newSpanHook(h.metrics, child))\n\treturn nil\n}", "title": "" }, { "docid": "93d1af2e58790311be102babded27660", "score": "0.57620484", "text": "func appendChild(p Node, c Node) Node {\n\t// if the child is already in the tree somewhere,\n\t// remove it before reparenting\n\tif c.ParentNode() != nil {\n\t\tremoveChild(c.ParentNode(), c)\n\t}\n\ti := p.ChildNodes().Length()\n\tp.insertChildAt(c, i)\n\tc.setParent(p)\n\treturn c\n}", "title": "" }, { "docid": "9e1e8787bdb5417b58a58250887b3892", "score": "0.5749616", "text": "func (v *TextBuffer) CreateChildAnchor(iter *TextIter) (*TextChildAnchor, error) {\n\tc := C.gtk_text_buffer_create_child_anchor(v.native(), iter.native())\n\tif c == nil {\n\t\treturn nil, nilPtrErr\n\t}\n\n\tobj := glib.Take(unsafe.Pointer(c))\n\treturn wrapTextChildAnchor(obj), nil\n}", "title": "" }, { "docid": "fae730c72face31c48fdf71ec9b133ba", "score": "0.5745727", "text": "func (s *SafeInjector) Child() *SafeInjector {\n\tc := SafeNew()\n\tc.parent = s\n\treturn c\n}", "title": "" }, { "docid": "e37453750fc6a1ec108d87a97e5173f7", "score": "0.57398266", "text": "func (_IUniverse *IUniverseTransactor) CreateChildUniverse(opts *bind.TransactOpts, _parentPayoutNumerators []*big.Int, _invalid bool) (*types.Transaction, error) {\n\treturn _IUniverse.contract.Transact(opts, \"createChildUniverse\", _parentPayoutNumerators, _invalid)\n}", "title": "" }, { "docid": "64dbd2dcdf8b396c45e4809a688b54ac", "score": "0.57192725", "text": "func (_Universe *UniverseTransactor) CreateChildUniverse(opts *bind.TransactOpts, _parentPayoutNumerators []*big.Int, _parentInvalid bool) (*types.Transaction, error) {\n\treturn _Universe.contract.Transact(opts, \"createChildUniverse\", _parentPayoutNumerators, _parentInvalid)\n}", "title": "" }, { "docid": "9a9ed15313b8ed5308ec156cd89cfd7d", "score": "0.57009685", "text": "func (m ModuleInstance) Child(name string, key InstanceKey) ModuleInstance {\n\tret := make(ModuleInstance, 0, len(m)+1)\n\tret = append(ret, m...)\n\treturn append(ret, ModuleInstanceStep{\n\t\tName: name,\n\t\tInstanceKey: key,\n\t})\n}", "title": "" }, { "docid": "91233a9a7ea901668ed2d4865375915e", "score": "0.5685835", "text": "func (_Parent *ParentTransactorSession) GenerateChild(i *big.Int) (*types.Transaction, error) {\n\treturn _Parent.Contract.GenerateChild(&_Parent.TransactOpts, i)\n}", "title": "" }, { "docid": "c8753d59abefcb5ade0b39630daf14da", "score": "0.56313974", "text": "func (s *Span) CreateAsyncChild(ctx context.Context) (context.Context, *Span) {\n\treturn s.createChildSpan(ctx, true)\n}", "title": "" }, { "docid": "93e981adc76a36805425ec007d44b024", "score": "0.5626453", "text": "func (s *Span) NewChild(name string) platform.Span {\n\tchild := &Span{\n\t\tName: name,\n\t\tStartTime: time.Now(),\n\t}\n\ts.childListMu.Lock()\n\ts.childList = append(s.childList, child)\n\ts.childListMu.Unlock()\n\treturn child\n}", "title": "" }, { "docid": "d31eb4208b1ab2d179a2e9d129891aa3", "score": "0.55987006", "text": "func (_Parent *ParentSession) GenerateChild(i *big.Int) (*types.Transaction, error) {\n\treturn _Parent.Contract.GenerateChild(&_Parent.TransactOpts, i)\n}", "title": "" }, { "docid": "9af4e7d58848043866962247623311d3", "score": "0.55707586", "text": "func (self *Stage) AddChildAt(child *DisplayObject, index int) *DisplayObject{\n return &DisplayObject{self.Object.Call(\"addChildAt\", child, index)}\n}", "title": "" }, { "docid": "6fb9e782e91955acdd5bfb01c02eb718", "score": "0.55274725", "text": "func (pc *parentController) onChildAdd(obj interface{}) {\n\tchild := obj.(*unstructured.Unstructured)\n\n\tif child.GetDeletionTimestamp() != nil {\n\t\tpc.onChildDelete(child)\n\t\treturn\n\t}\n\n\t// If it has a ControllerRef, that's all that matters.\n\tif controllerRef := metav1.GetControllerOf(child); controllerRef != nil {\n\t\tparent := pc.resolveControllerRef(child.GetNamespace(), controllerRef)\n\t\tif parent == nil {\n\t\t\t// The controllerRef isn't a parent we know about.\n\t\t\treturn\n\t\t}\n\t\tglog.V(4).Infof(\n\t\t\t\"%s %s: child %s %s/%s created or updated\",\n\t\t\tpc.parentResource.Kind,\n\t\t\tparent.GetName(),\n\t\t\tchild.GetKind(),\n\t\t\tchild.GetNamespace(),\n\t\t\tchild.GetName(),\n\t\t)\n\t\tpc.enqueueParentObject(parent)\n\t\treturn\n\t}\n\n\t// Otherwise, it's an orphan. Get a list of all matching parents\n\t// and sync them to see if anyone wants to adopt it.\n\tparents := pc.findPotentialParents(child)\n\tif len(parents) == 0 {\n\t\treturn\n\t}\n\tglog.V(4).Infof(\n\t\t\"%s: orphan child %s %s/%s created or updated\",\n\t\tpc.parentResource.Kind,\n\t\tchild.GetKind(),\n\t\tchild.GetNamespace(),\n\t\tchild.GetName(),\n\t)\n\tfor _, parent := range parents {\n\t\tpc.enqueueParentObject(parent)\n\t}\n}", "title": "" }, { "docid": "1d3361b372c3980a21f5a168b0ca5faf", "score": "0.5515077", "text": "func Child(parent *Context) *Context {\n\tif parent == nil {\n\t\treturn &Context{}\n\t}\n\n\tchild := &Context{\n\t\tParent: parent,\n\t\tName: parent.Name,\n\t\tModule: parent.Module,\n\t\tAtom: parent.Atom,\n\t\tZap: parent.Zap,\n\t}\n\n\tparent.Children = append(parent.Children, child)\n\treturn child\n}", "title": "" }, { "docid": "6f657cd1d334a9d2a963247591d085c9", "score": "0.5500368", "text": "func (p *Playground) createOffspring(parentScores []BrainScore) *DNA {\n\tchild := NewDNA(p.source)\n\n\tseenEdges := make(IDSet, p.source.Synapses.nextID)\n\tfor v := 0; v < p.source.NeuronIDs[SENSE].Length(); v++ {\n\t\tvisionID := p.source.NeuronIDs[SENSE].GetID(v)\n\n\t\t// Add the vision neuron to the child first.\n\t\tparentIndex := p.randomParentGene(parentScores)\n\t\tchild.SetNeuron(visionID, p.codes[parentScores[parentIndex].id].Neurons[visionID])\n\n\t\tp.traverseEdges(visionID, parentScores, child, seenEdges)\n\t}\n\n\treturn child\n}", "title": "" }, { "docid": "24bc79b266b1ce20cd85c874a6f4388d", "score": "0.54959893", "text": "func (cs *ChildService) Child(ctx context.Context, id string) (*goparent.Child, error) {\n\n\terr := cs.DB.GetConnection()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tres, err := gorethink.Table(\"children\").Get(id).Run(cs.DB.Session)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer res.Close()\n\tvar child goparent.Child\n\terr = res.One(&child)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &child, nil\n}", "title": "" }, { "docid": "64a6eb61fd1d66f96b7cae76259c80f2", "score": "0.54686886", "text": "func (s *Service) DynamicChild(c context.Context, plat int8, rid, tid, build int, mid int64, mobiApp string, now time.Time) (res *region.Show) {\n\tvar (\n\t\tisOsea = model.IsOverseas(plat) //is overseas\n\t\tbangumiType = 0\n\t\tresCache *region.Show\n\t\tmax = 20\n\t)\n\ts.prmobi.Incr(\"region_dynamic_child_plat_\" + mobiApp)\n\tif _, isBangumi := _bangumiRids[rid]; isBangumi {\n\t\tif (plat == model.PlatIPhone && build > 6050) || (plat == model.PlatAndroid && build > 512007) {\n\t\t\tbangumiType = _bangumiEpisodeID\n\t\t} else {\n\t\t\tbangumiType = _bangumiSeasonID\n\t\t}\n\t}\n\tif tid == 0 {\n\t\tif bangumiType != 0 {\n\t\t\tvar (\n\t\t\t\thotTmp, newTmp []*region.ShowItem\n\t\t\t\taids []int64\n\t\t\t\thotOk, newOk bool\n\t\t\t)\n\t\t\tif aids, hotOk = s.childHotAidsCache[rid]; hotOk {\n\t\t\t\tif len(aids) > max {\n\t\t\t\t\taids = aids[:max]\n\t\t\t\t}\n\t\t\t\thotTmp = s.fromAidsOsea(c, aids, false, isOsea, bangumiType)\n\t\t\t}\n\t\t\tif aids, newOk = s.childNewAidsCache[rid]; newOk {\n\t\t\t\tif len(aids) > max {\n\t\t\t\t\taids = aids[:max]\n\t\t\t\t}\n\t\t\t\tnewTmp = s.fromAidsOsea(c, aids, false, isOsea, bangumiType)\n\t\t\t}\n\t\t\tif len(hotTmp) > 0 && len(newTmp) > 0 {\n\t\t\t\tresCache, _ = s.mergeChildShow(hotTmp, newTmp)\n\t\t\t}\n\t\t}\n\t\tif resCache == nil {\n\t\t\tif !isOsea {\n\t\t\t\tif resCache = s.childShowCache[rid]; resCache == nil {\n\t\t\t\t\tresCache = _emptyShow\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif resCache = s.childShowOseaCache[rid]; resCache == nil {\n\t\t\t\t\tresCache = _emptyShow\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else {\n\t\tresCache = s.mergeTagShow(c, rid, tid, bangumiType, isOsea, now)\n\t}\n\tif resCache == nil {\n\t\tresCache = _emptyShow\n\t}\n\tif dyn, err := s.feedRegionDynamic(c, plat, rid, tid, bangumiType, false, true, 0, mid, nil, now); err == nil && dyn != nil {\n\t\tres = dyn\n\t\ts.pHit.Incr(\"feed_region_dynamic\")\n\t} else {\n\t\tres = resCache\n\t\ts.pMiss.Incr(\"feed_region_dynamic\")\n\t}\n\tif res != nil {\n\t\tif tid == 0 {\n\t\t\tif tags, ok := s.regionTagCache[rid]; ok {\n\t\t\t\tres.TopTag = tags\n\t\t\t}\n\t\t} else if mid > 0 {\n\t\t\tvar err error\n\t\t\tif res.Tag, err = s.tag.TagInfo(c, mid, tid, now); err != nil {\n\t\t\t\tlog.Error(\"s.tag.TagInfo(%d, %d) error(%v)\", mid, tid, err)\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "cc3ab54f68300097c2e6f9a519e32769", "score": "0.5446588", "text": "func (n *Node) addChild(child *Node) {\n\tn.Children = append(n.Children, child)\n}", "title": "" }, { "docid": "ff4f03e1c4f5a855c958cd0ba364cb26", "score": "0.544278", "text": "func child() {\n\tfmt.Printf(\"Running %v\\n\", os.Args[2:])\n\n\tcmd := exec.Command(os.Args[2], os.Args[3:]...)\n\tbindStd(cmd)\n\n\tsetUpHostName()\n\tchroot()\n\tmountProc()\n\tdefer unmountProc()\n\tmountTmp()\n\tdefer unmountTmp()\n\n\torPanic(cmd.Run())\n}", "title": "" }, { "docid": "dd643ef7a681c4d736d5ecfc7db75503", "score": "0.5426338", "text": "func (s *Scope) Child(i int) *Scope", "title": "" }, { "docid": "ac26055e1bd0620922c96e35719efccd", "score": "0.54159135", "text": "func (x *V) addChild(c *V) {\n\tchildList, exist := x.children[c.name]\n\tif false == exist {\n\t\tchildList = []*V{c}\n\t\tx.children[c.name] = childList\n\t} else {\n\t\tchildList = append(childList, c)\n\t\tx.children[c.name] = childList\n\t}\n\n\t// done\n\treturn\n}", "title": "" }, { "docid": "160300c46025530706219a4679f5e564", "score": "0.53992635", "text": "func (n *Node) addChild(child *Node) {\n\tn.children = append(n.children, child)\n}", "title": "" }, { "docid": "e9545751189ed3723a89a502c5d11503", "score": "0.5391872", "text": "func start_child(cmd string) {\n\tlog.Println(\"Starting\", cmd)\n\tchild = exec.Command(cmd)\n\tsend_to_child, _ = child.StdinPipe()\n\tread_from_child, _ = child.StdoutPipe()\n\tchild.Start()\n}", "title": "" }, { "docid": "c6b1efca775be007e3dac41f49f2c87e", "score": "0.539155", "text": "func ExecuteChild() (err error) {\n\tsessionID := strings.TrimSpace(os.Getenv(\"SKEWER_SESSION\"))\n\tif len(sessionID) == 0 {\n\t\treturn fmt.Errorf(\"empty session ID\")\n\t}\n\tringSecretPipe := os.NewFile(uintptr(len(base.Handles)+3), \"ringsecretpipe\")\n\tvar ringSecret *memguard.LockedBuffer\n\tbuf := make([]byte, 32)\n\t_, err = ringSecretPipe.Read(buf)\n\tif err != nil {\n\t\treturn err\n\t}\n\tringSecret, err = memguard.NewImmutableFromBytes(buf)\n\tif err != nil {\n\t\treturn err\n\t}\n\tcreds := kring.RingCreds{Secret: ringSecret, SessionID: utils.MyULID(ulid.MustParse(sessionID))}\n\tring := kring.GetRing(creds)\n\tsecret, err := ring.GetBoxSecret()\n\tif err != nil {\n\t\treturn err\n\t}\n\tch, err := newServeChild(ring)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"fatal error initializing main child: %s\", err)\n\t}\n\terr = ch.init()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"fatal error initializing Serve: %s\", err)\n\t}\n\tdefer func() {\n\t\tch.cleanup()\n\t\tsecret.Destroy()\n\t}()\n\terr = ch.Serve()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"fatal error executing Serve: %s\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "00869fbed0b13a153a0c026266432f7e", "score": "0.53901654", "text": "func (n *Node) InitChild(edge string) {\n\tn.children[edge] = NewNode()\n}", "title": "" }, { "docid": "643c438cc77d7c733bc4ba41873c5231", "score": "0.5375445", "text": "func (st *ScopeTree) NewChild(node *builder.Node) *ScopeTree {\n\t// On a new child, it might be needed, we could either COPY everything from the other scope ...\n\t// \tOR\n\t// (easier) Just defer to recursing up in the Get\n\treturn &ScopeTree{\n\t\tlock: &sync.RWMutex{},\n\t\tnode: node,\n\t\tvars: map[string]*builder.Node{},\n\t\tparent: st,\n\t\tglobal: st.global,\n\t}\n}", "title": "" }, { "docid": "f6c0a0009b2a32a3b1f698fba99719b1", "score": "0.5335794", "text": "func (tc *treeCache) newParent(leftNode, rightNode *PathElement, writePos int) {\n\t// Write PathElement to cache\n\ttc.nodeCache[writePos] = ParentPathElement((writePos%2 == 0), leftNode, rightNode, tc.hash)\n}", "title": "" }, { "docid": "eb4a94a7de554157f6386554aa966a4f", "score": "0.53189206", "text": "func (parent *scope) child() scope {\n\tctx, cancel := context.WithCancel(parent.ctx)\n\treturn scope{ctx, cancel}\n}", "title": "" }, { "docid": "e63409a556c7a6ebd64effbbfbeb5637", "score": "0.5317532", "text": "func (_IUniverse *IUniverseTransactorSession) CreateChildUniverse(_parentPayoutNumerators []*big.Int, _invalid bool) (*types.Transaction, error) {\n\treturn _IUniverse.Contract.CreateChildUniverse(&_IUniverse.TransactOpts, _parentPayoutNumerators, _invalid)\n}", "title": "" }, { "docid": "d9945da740003a9241cd5a83359f5123", "score": "0.531724", "text": "func (env *Env) Child(out, err io.Writer, cmd string, args ...string) error {\n\tfor idx := range args {\n\t\targs[idx] = env.Expand(args[idx])\n\t}\n\n\tc := exec.Command(cmd, args...)\n\tc.Env = env.Environ()\n\tc.Stdin = os.Stdin\n\tc.Stdout = out\n\tc.Stderr = err\n\n\treturn c.Run()\n}", "title": "" }, { "docid": "e2218c7a55abee17aa21eb3e5f91d9e4", "score": "0.53158957", "text": "func (_IUniverse *IUniverseSession) CreateChildUniverse(_parentPayoutNumerators []*big.Int, _invalid bool) (*types.Transaction, error) {\n\treturn _IUniverse.Contract.CreateChildUniverse(&_IUniverse.TransactOpts, _parentPayoutNumerators, _invalid)\n}", "title": "" }, { "docid": "aad9d063deb04401d69ce8128760e8b4", "score": "0.52855647", "text": "func (rt *reachabilityManager) addChild(stagingArea *model.StagingArea, node, child, reindexRoot *externalapi.DomainHash) error {\n\tremaining, err := rt.remainingIntervalAfter(stagingArea, node)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Set the parent-child relationship\n\terr = rt.stageAddChild(stagingArea, node, child)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = rt.stageParent(stagingArea, child, node)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// No allocation space left at parent -- reindex\n\tif intervalSize(remaining) == 0 {\n\n\t\t// Initially set the child's interval to the empty remaining interval.\n\t\t// This is done since in some cases, the underlying algorithm will\n\t\t// allocate space around this point and call intervalIncreaseEnd or\n\t\t// intervalDecreaseStart making for intervalSize > 0\n\t\terr = rt.stageInterval(stagingArea, child, remaining)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\trc := newReindexContext(rt)\n\n\t\treindexStartTime := time.Now()\n\t\terr := rc.reindexIntervals(stagingArea, child, reindexRoot)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treindexTimeElapsed := time.Since(reindexStartTime)\n\t\tlog.Tracef(\"Reachability reindex triggered for \"+\n\t\t\t\"block %s. Took %dms.\",\n\t\t\tnode, reindexTimeElapsed.Milliseconds())\n\n\t\treturn nil\n\t}\n\n\t// Allocate from the remaining space\n\tallocated, _, err := intervalSplitInHalf(remaining)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn rt.stageInterval(stagingArea, child, allocated)\n}", "title": "" }, { "docid": "5792463129a92ed4db6398470c593fa6", "score": "0.52796626", "text": "func (e *dataUsageEntry) addChild(hash dataUsageHash) {\n\tif _, ok := e.Children[hash]; ok {\n\t\treturn\n\t}\n\tif e.Children == nil {\n\t\te.Children = make(dataUsageHashMap, 1)\n\t}\n\te.Children[hash] = struct{}{}\n}", "title": "" }, { "docid": "0f527f889d752c0a5a9cda706f325958", "score": "0.5274149", "text": "func (_Universe *UniverseTransactorSession) CreateChildUniverse(_parentPayoutNumerators []*big.Int, _parentInvalid bool) (*types.Transaction, error) {\n\treturn _Universe.Contract.CreateChildUniverse(&_Universe.TransactOpts, _parentPayoutNumerators, _parentInvalid)\n}", "title": "" }, { "docid": "79be0c97b4ad4fb33cd1c08395dffc46", "score": "0.5262322", "text": "func installChildReaper() {\n\t// assume responsibilities of init process if running as init process for Linux\n\tif runtime.GOOS != \"linux\" || os.Getpid() != 1 {\n\t\treturn\n\t}\n\n\tvar sigs = make(chan os.Signal, 1)\n\tsignal.Notify(sigs, syscall.SIGCHLD)\n\n\t// we run this forever and leak a go routine. As init, we must\n\t// reap our children until the very end, so this is OK.\n\tgo func() {\n\t\tfor {\n\t\t\t<-sigs\n\t\t\tfor {\n\t\t\t\tvar status syscall.WaitStatus\n\t\t\t\tvar rusage syscall.Rusage\n\n\t\t\t\tpid, err := syscall.Wait4(-1, &status, syscall.WNOHANG, &rusage)\n\t\t\t\t// no children\n\t\t\t\tif pid <= 0 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\tlogrus.Infof(\"Child terminated pid=%d err=%v status=%v usage=%v\", pid, err, status, rusage)\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "64356279a34e0b3704bb29885f7f6bc3", "score": "0.526184", "text": "func (a *Api) CreateChildUser(res http.ResponseWriter, req *http.Request) {\n\n\tif usrDetails := getUserDetail(req); usrDetails != nil {\n\n\t\tif usr, err := models.NewChildUser(usrDetails, a.Config.Salt); err == nil {\n\t\t\tlog.Printf(\"CreateChildUser adding [%v] \", usr)\n\t\t\ta.addUserAndSendStatus(usr, res, req)\n\t\t\treturn\n\t\t} else {\n\t\t\tlog.Printf(\"CreateChildUser %s \", err.Error())\n\t\t}\n\t}\n\t//incoming details were missing\n\tlog.Printf(\"CreateChildUser %s \", STATUS_MISSING_USR_DETAILS)\n\tsendModelAsResWithStatus(res, status.NewStatus(http.StatusBadRequest, STATUS_MISSING_USR_DETAILS), http.StatusBadRequest)\n\treturn\n}", "title": "" }, { "docid": "3e76d91cc23d74282948c83d9e117dd6", "score": "0.5249927", "text": "func (injector *Injector) Child() (*Injector, error) {\n\tif injector == nil {\n\t\treturn nil, errors.New(\"can not create a child of an uninitialized injector\")\n\t}\n\n\tnewInjector, err := NewInjector()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnewInjector.parent = injector\n\tnewInjector.Bind(Injector{}).ToInstance(newInjector)\n\tnewInjector.BindScope(NewChildSingletonScope()) // bind a new child-singleton\n\n\treturn newInjector, nil\n}", "title": "" }, { "docid": "079d5b63de4b5df2903f9e774552c644", "score": "0.5241754", "text": "func AddNewChild(father *Node, child *Node) {\n\tfather.children[father.size] = child\n\tfather.size++\n}", "title": "" }, { "docid": "344e1679a23b787deac7695770c9273a", "score": "0.52372795", "text": "func (_Universe *UniverseSession) CreateChildUniverse(_parentPayoutNumerators []*big.Int, _parentInvalid bool) (*types.Transaction, error) {\n\treturn _Universe.Contract.CreateChildUniverse(&_Universe.TransactOpts, _parentPayoutNumerators, _parentInvalid)\n}", "title": "" }, { "docid": "84e543190241c784cb611e9998542681", "score": "0.5198805", "text": "func (vdom *Vdom) AppendChild(parent *html.Node, node *html.Node) error {\n var ids []int\n var err error\n var hasPreviousSibling bool\n // get identifier from last child element node\n if parent.LastChild != nil {\n el := findLastChildElement(parent)\n // might have children but no element nodes!\n if el != nil {\n ids, err = vdom.FindId(el)\n if err != nil {\n return err\n }\n // increment for the new id\n ids[len(ids) - 1]++\n hasPreviousSibling = true\n }\n }\n\n // get identifier from parent and start child index at zero\n if parent.LastChild == nil || !hasPreviousSibling {\n ids, err = vdom.FindId(parent)\n // now the new first child\n ids = append(ids, 0)\n\n if err != nil {\n return err\n }\n }\n id := intSliceToString(ids)\n vdom.AttrSet(node, html.Attribute{Key: idAttribute, Val: id})\n parent.AppendChild(node)\n vdom.Map[id] = node\n return err\n}", "title": "" }, { "docid": "cbf1a1d1a1d86fd3b258cae3b9d44843", "score": "0.51957875", "text": "func (n *node) child(name string) *node {\n\tif c, ok := n.children[name]; ok {\n\t\treturn c\n\t}\n\tif n.children == nil {\n\t\tn.children = make(map[string]*node, 1)\n\t}\n\tc := &node{path: n.path + name + \"/\"}\n\tn.children[name] = c\n\treturn c\n}", "title": "" }, { "docid": "1026dd672326d7a32c9d452b2351416d", "score": "0.51915586", "text": "func createChildren(pulse models.Pulse, jetID string, depth int) []models.JetDrop {\n\tif depth == 0 {\n\t\treturn nil\n\t}\n\tdrops := make([]models.JetDrop, 2)\n\tleft, right := jetID+\"0\", jetID+\"1\"\n\n\tjDropLeft, jDropRight := InitJetDropDB(pulse), InitJetDropDB(pulse)\n\tjDropLeft.JetID, jDropRight.JetID = left, right\n\tdrops[0], drops[1] = jDropLeft, jDropRight\n\n\tdrops = append(drops, createChildren(pulse, left, depth-1)...)\n\tdrops = append(drops, createChildren(pulse, right, depth-1)...)\n\treturn drops\n}", "title": "" }, { "docid": "a383f6950a1c28f962dbac090de02b23", "score": "0.5178156", "text": "func (o *Child) createDiff(n *Child) *ChildDiff {\n\ti := &ChildDiff{}\n\tif n.DateOfBirth != o.DateOfBirth {\n\t\ti.DateOfBirth = &n.DateOfBirth\n\t}\n\tif n.NotInAdapter != o.NotInAdapter {\n\t\ti.NotInAdapter = &n.NotInAdapter\n\t}\n\tif i.empty() {\n\t\treturn nil\n\t}\n\treturn i\n}", "title": "" }, { "docid": "b59158adbb0e15e17b58e968f2c082d6", "score": "0.51769125", "text": "func send_cmd_to_child(cmd string) {\n\t// log.Println(\"Sending \", cmd)\n\t_, err := send_to_child.Write([]byte(cmd + \"\\n\"))\n\tif err != nil {\n\t\tlog.Println(\"Error sending command:\", cmd, \" -\", err)\n\t}\n}", "title": "" }, { "docid": "366d1d770e71429498bb39128b6633e6", "score": "0.5163988", "text": "func (c *Client) GroupsCreateChild(channel string) (*GroupsCreateChildResponse, error) {\n\tr := &GroupsCreateChildResponse{}\n\targs := url.Values{}\n\targs.Set(\"channel\", channel)\n\terr := c.Do(GroupsCreateChildMethod, args, r)\n\treturn r, err\n}", "title": "" }, { "docid": "0c72cf19e9f608aae01025022522c48f", "score": "0.51465756", "text": "func (s *Span) NewChild(name string) *Span {\n\tif s != nil && s.span != nil {\n\t\treturn NewChildSpan(s, name)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "32fd53c6a8665d78e3321b40cc799ef3", "score": "0.51430905", "text": "func GenerateChild(params *oaque.Params, key StarWaveKey, uri URIPath, time TimePath) StarWaveKey {\n\tattrs := AttributeSetFromPaths(uri, time)\n\tt, err := oaque.RandomInZp(rand.Reader)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tqualified, err := oaque.QualifyKey(t, params, key.Key, attrs)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn StarWaveKey{\n\t\tKey: qualified,\n\t\tUriPath: uri,\n\t\tTimePath: time,\n\t}\n}", "title": "" }, { "docid": "885d3ae7386c6582fbefe3e26a12cac4", "score": "0.514135", "text": "func (cvs *Canvas) ForChild(pm PositionalModel) Canvas {\n\tx, y := cvs.relToAbs(pm.Position().X(), pm.Position().Y())\n\treturn Canvas{\n\t\tX: x,\n\t\tY: y,\n\t\tW: pm.Width().Value(),\n\t\tH: pm.Height().Value(),\n\t}\n}", "title": "" }, { "docid": "96b65e600e91530d130a67a60a9fd164", "score": "0.5134596", "text": "func (d *Dot) getChild(key string) *Dot {\n\tvar c *Dot\n\n\tif x, ok := d.lookupDot(key); !ok || x == nil {\n\t\tc = New(key) // new child\n\t\tc.home = d.home // inherit home - never changes\n\t\tc.p = d // set me as it's parent\n\t\td.Assign(key, c) // assign it to key\n\t} else {\n\t\tc = x\n\t}\n\treturn c\n}", "title": "" }, { "docid": "a22aa3d5b62db8104c2b6173e846ea4e", "score": "0.51319176", "text": "func (c *ControlBase) addChildControl(child ControlI) {\n\tif c.children == nil {\n\t\tc.children = make([]ControlI, 0)\n\t}\n\tc.children = append(c.children, child)\n}", "title": "" }, { "docid": "5b58fb7ea1603c17e0f97b469fe78422", "score": "0.5124325", "text": "func (n *node) add(name string) *node {\n\tchild := &node{\n\t\tidentity: golibs.UUID(),\n\t\tname: name,\n\t\tchanged: n.changed,\n\t}\n\tn.children = append(n.children, child)\n\tn.changed()\n\treturn child\n}", "title": "" }, { "docid": "6255222abe28b15469f18adefefd55b3", "score": "0.51151854", "text": "func (key *Key) Child(childIdx uint32) (*Key, error) {\n\t// Fail early if trying to create hardned child from public key\n\tif !key.IsPrivate && childIdx >= FirstHardenedChild {\n\t\treturn nil, ErrHardnedChildPublicKey\n\t}\n\n\tintermediary, err := key.getIntermediary(childIdx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Create child Key with data common to all both scenarios\n\tchildKey := &Key{\n\t\tChildNumber: uint32Bytes(childIdx),\n\t\tChainCode: intermediary[32:],\n\t\tDepth: key.Depth + 1,\n\t\tIsPrivate: key.IsPrivate,\n\t}\n\n\t// Bip32 CKDpriv\n\tif key.IsPrivate {\n\t\tchildKey.Version = key.Version\n\t\tfingerprint, err := hash160(publicKeyForPrivateKey(key.Key))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tchildKey.FingerPrint = fingerprint[:4]\n\t\tchildKey.Key = addPrivateKeys(intermediary[:32], key.Key)\n\n\t\t// Validate key\n\t\terr = validatePrivateKey(childKey.Key)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t// Bip32 CKDpub\n\t} else {\n\t\tkeyBytes := publicKeyForPrivateKey(intermediary[:32])\n\n\t\t// Validate key\n\t\terr := validateChildPublicKey(keyBytes)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tchildKey.Version = key.Version\n\t\tfingerprint, err := hash160(key.Key)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tchildKey.FingerPrint = fingerprint[:4]\n\t\tchildKey.Key = addPublicKeys(keyBytes, key.Key)\n\t}\n\n\treturn childKey, nil\n}", "title": "" }, { "docid": "d57e66f0b50f6e56a3a25b98f71f3d72", "score": "0.5111649", "text": "func (n *inode) Create(ctx context.Context, name string, flags uint32, mode uint32,\n\tout *fuse.EntryOut) (*fs.Inode, fs.FileHandle, uint32, syscall.Errno) {\n\tnewPath := file.Join(n.path, name)\n\tchildNode := &inode{\n\t\tpath: newPath,\n\t\tent: fuse.DirEntry{\n\t\t\tName: name,\n\t\t\tIno: getIno(newPath),\n\t\t\tMode: getModeBits(false)}}\n\tchildInode := n.NewInode(ctx, childNode, fs.StableAttr{\n\t\tMode: childNode.ent.Mode,\n\t\tIno: childNode.ent.Ino,\n\t})\n\tfh := newHandle(childNode, syscall.O_WRONLY|syscall.O_CREAT|syscall.O_TRUNC)\n\tfh.requestedSize = 0\n\tlog.Debug.Printf(\"create %s: (mode %x)\", n.path, mode)\n\tout.Attr = newAttr(n.ent.Ino, n.ent.Mode, 0, time.Time{})\n\treturn childInode, fh, 0, 0\n}", "title": "" }, { "docid": "4f0885c39865e51afd4bbd809b035496", "score": "0.51043946", "text": "func (l *Logger) StartChild() {\n\tl.exportEnviron()\n\n\t// Create a pty and start the child command.\n\tutil.Debugf(\"Executing: %s\", l.Config.StartCommand)\n\tl.child = exec.Command(\"/bin/sh\", \"-c\",\n\t\tenvs.ZenlogSignature+\n\t\t\tfmt.Sprintf(\"=\\\"$(tty)\\\":%s \", shell.Escape(Signature()))+\n\t\t\tl.Config.StartCommand)\n\tvar err error\n\tl.master, err = pty.Start(l.child)\n\tutil.Check(err, \"Unable to create pty or execute /bin/sh\")\n\n\tutil.PropagateTerminalSize(os.Stdin, l.master)\n}", "title": "" }, { "docid": "e2efea126dfd622b343bae7485069635", "score": "0.5104104", "text": "func (o *NSGateway) CreateCommand(child *Command) *bambou.Error {\n\n\treturn bambou.CurrentSession().CreateChild(o, child)\n}", "title": "" }, { "docid": "cc4f7b4cad8fb698effa385ceea6ec55", "score": "0.51004624", "text": "func (v *Vue) AddChild(options js.M) {\r\n\tv.Call(\"$addChild\", options)\r\n}", "title": "" }, { "docid": "4a9221f0ff1a67cad707f9c7e5025801", "score": "0.5099134", "text": "func (arn autogitRootNode) WrapChild(child libkbfs.Node) libkbfs.Node {\n\tchild = arn.Node.WrapChild(child)\n\tvar tlfType tlf.Type\n\tswitch child.GetBasename() {\n\tcase public:\n\t\ttlfType = tlf.Public\n\tcase private:\n\t\ttlfType = tlf.Private\n\tcase team:\n\t\ttlfType = tlf.SingleTeam\n\tdefault:\n\t\treturn child\n\t}\n\treturn &tlfTypeNode{\n\t\tNode: child,\n\t\tam: arn.am,\n\t\ttlfType: tlfType,\n\t}\n}", "title": "" }, { "docid": "7f450aa7dda3c5692c4ab24c3047afe7", "score": "0.50878525", "text": "func (dt *DecisionTree) creatNode(parent *Node, data *container.Tensor, label []string) *Node {\n\tvar r *Node\n\ttmp := label[0]\n\tleafFlag := true\n\tfor _, v := range label {\n\t\tif !strings.EqualFold(tmp, v) {\n\t\t\tleafFlag = false\n\t\t\tbreak\n\t\t}\n\t}\n\tif leafFlag {\n\t\tr = NewNode(fmt.Sprintf(\"%d\", -1))\n\t\t// glog.Infof(\"leaf: %s\", label[0])\n\t\tr.Attributes.Put(ClassificationLableKey, label[0])\n\t\tr.Attributes.Put(AttributeLabelKey, \"-1\")\n\t\tif parent == nil {\n\t\t\tdt.Root = r\n\t\t} else {\n\t\t\tr.parent = parent\n\t\t}\n\t\treturn r\n\t}\n\t// glog.Infof(\"%v \\n %v\", data.SliceString(), label)\n\tindex, eg, freq := chooseBestAttribute(data, label)\n\t// glog.Infof(\"best attribute: %s\", data.Get(index).Label)\n\t// glog.Infof(\"%v\", freq)\n\tr = NewNode(fmt.Sprintf(\"%d\", index))\n\tr.Attributes.Put(EntropyGainKey, eg)\n\n\tif parent == nil {\n\t\tdt.Root = r\n\t} else {\n\t\tr.parent = parent\n\t}\n\n\tr.Attributes.Put(AttributeLabelKey, data.Get(index).Label)\n\t//creat edges\n\tdt.creatEdge(r, index, data, label, freq)\n\t// }\n\n\treturn r\n\n}", "title": "" }, { "docid": "c994d2c82c47516f4fb9c707ded9e5ff", "score": "0.5083094", "text": "func (e *BasicEntity) AppendChild(child *BasicEntity) {\n\tchild.parent = e\n\te.children = append(e.children, child)\n}", "title": "" }, { "docid": "483489ff28fb932274dd4759d00ffabc", "score": "0.5062979", "text": "func (self *Stage) AddChildI(args ...interface{}) *DisplayObject{\n return &DisplayObject{self.Object.Call(\"addChild\", args)}\n}", "title": "" }, { "docid": "ab08252b76dc291abc13f85f52edfe22", "score": "0.5048382", "text": "func (mm *ChainDIDManager) AddChild(caller, childID string) *boltvm.Response {\n\tmr := mm.getChainDIDRegistry()\n\n\tcallerDID := bitxid.DID(caller)\n\tif mm.Caller() != callerDID.GetAddress() {\n\t\treturn boltvm.Error(callerNotMatchError(mm.Caller(), caller))\n\t}\n\tif !mr.Registry.HasAdmin(callerDID) { // require Admin\n\t\treturn boltvm.Error(\"caller(\" + string(callerDID) + \") has no permission\")\n\t}\n\n\tmr.ChildIDs = append(mr.ChildIDs, bitxid.DID(childID))\n\n\tmm.SetObject(ChainDIDRegistryKey, mr)\n\treturn boltvm.Success(nil)\n}", "title": "" }, { "docid": "827fbd453a1feca336cba3ab3971ea2e", "score": "0.5047618", "text": "func (n absNode) AppendChild(aChild Node) Node {\n\treturn absNode{n.val.Call(\"appendChild\", aChild.Unwrap())}\n}", "title": "" }, { "docid": "f8131521f8b6aad35afb480520ec018c", "score": "0.503983", "text": "func newTask(ctx context.Context, parentTask Task) (*task, error) {\n\tvar (\n\t\tchildContext context.Context\n\t\tcancel context.CancelFunc\n\t\tgeneration uint\n\t)\n\n\tif ctx == nil {\n\t\treturn nil, fail.InvalidParameterError(\"ctx\", \"cannot be nil, use context.TODO() instead\")\n\t}\n\n\tif parentTask == nil {\n\t\tif ctx == context.TODO() {\n\t\t\tchildContext, cancel = context.WithCancel(context.Background())\n\t\t} else {\n\t\t\tchildContext, cancel = context.WithCancel(ctx)\n\t\t}\n\t} else {\n\t\tpTask := parentTask.(*task)\n\t\tchildContext, cancel = context.WithCancel(parentTask.(*task).ctx)\n\t\tgeneration = pTask.generation + 1\n\t}\n\tt := task{\n\t\tctx: childContext,\n\t\tcancel: cancel,\n\t\tstatus: READY,\n\t\tgeneration: generation,\n\t\t// abortCh: make(chan bool, 1),\n\t\t// doneCh: make(chan bool, 1),\n\t\t// finishCh: make(chan struct{}, 1),\n\t}\n\n\ttid, _ := t.GetID() // FIXME: Later\n\tt.sig = fmt.Sprintf(\"{task %s}\", tid)\n\n\treturn &t, nil\n}", "title": "" }, { "docid": "b9e741e0d4911fb529aeea9ae337030d", "score": "0.50359726", "text": "func (w *HDWallet) Child(i uint32) (*HDWallet,error) {\n var fingerprint, I , newkey []byte\n switch {\n case bytes.Compare(w.Vbytes, Private) == 0, bytes.Compare(w.Vbytes, TestPrivate) == 0:\n pub := privToPub(w.Key)\n mac := hmac.New(sha512.New, w.Chaincode)\n if i >= uint32(0x80000000) {\n mac.Write(append(w.Key,uint32ToByte(i)...))\n } else {\n mac.Write(append(pub,uint32ToByte(i)...))\n }\n I = mac.Sum(nil)\n iL := new(big.Int).SetBytes(I[:32])\n if iL.Cmp(curve.N) >= 0 || iL.Sign() == 0 {\n return &HDWallet{}, errors.New(\"Invalid Child\")\n }\n newkey = addPrivKeys(I[:32], w.Key)\n fingerprint = hash160(privToPub(w.Key))[:4]\n\n case bytes.Compare(w.Vbytes, Public) == 0, bytes.Compare(w.Vbytes, TestPublic) == 0:\n mac := hmac.New(sha512.New, w.Chaincode)\n if i >= uint32(0x80000000) {\n return &HDWallet{}, errors.New(\"Can't do Private derivation on Public key!\")\n }\n mac.Write(append(w.Key,uint32ToByte(i)...))\n I = mac.Sum(nil)\n iL := new(big.Int).SetBytes(I[:32])\n if iL.Cmp(curve.N) >= 0 || iL.Sign() == 0 {\n return &HDWallet{}, errors.New(\"Invalid Child\")\n }\n newkey = addPubKeys(privToPub(I[:32]), w.Key)\n fingerprint = hash160(w.Key)[:4]\n }\n return &HDWallet{w.Vbytes, w.Depth + 1, fingerprint, uint32ToByte(i), I[32:], newkey}, nil\n}", "title": "" }, { "docid": "888ac18344aeb162709b9e1d8dec148f", "score": "0.5022414", "text": "func (s *subprocess) createStub() (*thread, error) {\n\t// There's no need to lock the runtime thread here, as this can only be\n\t// called from a context that is already locked.\n\tcurrentTID := int32(hosttid.Current())\n\tt := s.syscallThreads.lookupOrCreate(currentTID, s.newThread)\n\n\t// Pass the expected PPID to the child via R15.\n\tregs := t.initRegs\n\tinitChildProcessPPID(&regs, t.tgid)\n\n\t// Call fork in a subprocess.\n\t//\n\t// The new child must set up PDEATHSIG to ensure it dies if this\n\t// process dies. Since this process could die at any time, this cannot\n\t// be done via instrumentation from here.\n\t//\n\t// Instead, we create the child untraced, which will do the PDEATHSIG\n\t// setup and then SIGSTOP itself for our attach below.\n\t//\n\t// See above re: SIGKILL.\n\tpid, err := t.syscallIgnoreInterrupt(\n\t\t&regs,\n\t\tunix.SYS_CLONE,\n\t\tarch.SyscallArgument{Value: uintptr(unix.SIGKILL | unix.CLONE_FILES)},\n\t\tarch.SyscallArgument{Value: 0},\n\t\tarch.SyscallArgument{Value: 0},\n\t\tarch.SyscallArgument{Value: 0},\n\t\tarch.SyscallArgument{Value: 0},\n\t\tarch.SyscallArgument{Value: 0})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"creating stub process: %v\", err)\n\t}\n\n\t// Wait for child to enter group-stop, so we don't stop its\n\t// bootstrapping work with t.attach below.\n\t//\n\t// We unfortunately don't have a handy part of memory to write the wait\n\t// status. If the wait succeeds, we'll assume that it was the SIGSTOP.\n\t// If the child actually exited, the attach below will fail.\n\t_, err = t.syscallIgnoreInterrupt(\n\t\t&t.initRegs,\n\t\tunix.SYS_WAIT4,\n\t\tarch.SyscallArgument{Value: uintptr(pid)},\n\t\tarch.SyscallArgument{Value: 0},\n\t\tarch.SyscallArgument{Value: unix.WALL | unix.WUNTRACED},\n\t\tarch.SyscallArgument{Value: 0},\n\t\tarch.SyscallArgument{Value: 0},\n\t\tarch.SyscallArgument{Value: 0})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"waiting on stub process: %v\", err)\n\t}\n\n\tchildT := &thread{\n\t\ttgid: int32(pid),\n\t\ttid: int32(pid),\n\t\tcpu: ^uint32(0),\n\t}\n\tchildT.attach()\n\n\treturn childT, nil\n}", "title": "" }, { "docid": "2665f80fcb6c4fd3d5f865bb38c02428", "score": "0.5016016", "text": "func (b *Builder) Create() AnyComponent {\n\tb.main.Extra = append(b.main.Extra, Wrap(b.cur))\n\tb.cur = nil\n\treturn Wrap(b.main)\n}", "title": "" }, { "docid": "1e090d9a3486995b0aa73704944d13dc", "score": "0.5014985", "text": "func (r *storeImpl) AddChild(ctx context.Context, child model.Child) (*model.Child, error) {\n\n\tresult := r.writer.Create(&child)\n\tif result.Error != nil {\n\t\tlogger.ErrorContext(ctx, \"store.children.addchild\", result.Error.Error())\n\t\treturn nil, model.NewError(http.StatusInternalServerError, result.Error.Error(), child)\n\t}\n\treturn &child, nil\n\n}", "title": "" }, { "docid": "6ff3f6d60d7b2daaae9bc70d01942e8c", "score": "0.49963242", "text": "func (n *Node) add(child *Node, updateSize bool) {\n\tn.Children = append(n.Children, child)\n\tchild.Parent = n\n\tchild.SortChildren = n.SortChildren\n\tn.sortChildren()\n\tif updateSize {\n\t\tn.addSize(child.Info.Size, true)\n\t}\n}", "title": "" }, { "docid": "4e3e543bb53e73258fc84ec0aca28a0a", "score": "0.49943623", "text": "func (d *Dao) AddNewChildIndex(c context.Context, rp *model.Reply) (err error) {\n\tkey := keyNewRootIdx(rp.Root)\n\tconn := d.redis.Get(c)\n\tdefer conn.Close()\n\tif err = conn.Send(\"ZADD\", key, rp.Floor, rp.ID); err != nil {\n\t\tlog.Error(\"conn.Send error(%v)\", err)\n\t\treturn\n\t}\n\tif err = conn.Send(\"EXPIRE\", key, d.redisExpire); err != nil {\n\t\tlog.Error(\"conn.Send error(%v)\", err)\n\t\treturn\n\t}\n\tif err = conn.Flush(); err != nil {\n\t\tlog.Error(\"conn.Flush error(%v)\", err)\n\t\treturn\n\t}\n\tif _, err = conn.Receive(); err != nil {\n\t\tlog.Error(\"conn.Receive() error(%v)\", err)\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "08ed4e5b6b24dd5af6c0b527fd3b2e36", "score": "0.49942303", "text": "func (s *BaseECLListener) EnterChildof(ctx *ChildofContext) {}", "title": "" }, { "docid": "1915e96992ea583e56a4ac3fbd7754aa", "score": "0.49933842", "text": "func (n RawNode) SetChild(idx int, c Node) {\n\tpanic(\"no children\")\n}", "title": "" }, { "docid": "e54efc5acdbdf29f0802ff9faf000394", "score": "0.49863705", "text": "func newPipe() (parent, child *os.File, err error) {\n\tfds, err := unix.Socketpair(unix.AF_LOCAL, unix.SOCK_STREAM|unix.SOCK_CLOEXEC, 0)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\treturn os.NewFile(uintptr(fds[1]), \"parent\"), os.NewFile(uintptr(fds[0]), \"child\"), nil\n}", "title": "" }, { "docid": "5de310b5a4372fcad6c632b14f470ca2", "score": "0.49852234", "text": "func (e *Entry) AddChild(newE *Entry) {\n\tif e.child == nil {\n\t\t//Slot is available, directly add the child\n\t\te.child, newE.parent = newE, e\n\t} else {\n\t\t//Slot is unavailable, figure out where the child belongs among peer siblings\n\t\te.child.addSibling(newE)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "eb7f1731453d492eab1e7b55d8dfc36d", "score": "0.4982686", "text": "func (m ModuleInstance) ChildCall(name string) AbsModuleCall {\n\treturn AbsModuleCall{\n\t\tModule: m,\n\t\tCall: ModuleCall{Name: name},\n\t}\n}", "title": "" }, { "docid": "d84f0268caa09a7375d57e69d12e24df", "score": "0.49822292", "text": "func (pm *processmgr) spawn(owner *actor, conf *SpawnConfig) (*Process, error) {\n p, err := newprocess(owner, conf)\n if err != nil {\n \tlog.Printf(\"spawn: %v\", err)\n \treturn nil, err\n }\n\tdefer pm.pmtx.Unlock()\n\tpm.pmtx.Lock()\n\tpm.processes[p.Id] = p\n\tlog.Printf(\"spawn: %v\", p.Id)\n\treturn p, nil\n}", "title": "" }, { "docid": "d8528c2ec91d708f4b2b347d35e3d6fa", "score": "0.49811628", "text": "func TextChildAnchorNew() (*TextChildAnchor, error) {\n\tc := C.gtk_text_child_anchor_new()\n\tif c == nil {\n\t\treturn nil, nilPtrErr\n\t}\n\n\tobj := glib.Take(unsafe.Pointer(c))\n\treturn wrapTextChildAnchor(obj), nil\n}", "title": "" }, { "docid": "63bb5814fe38260a70c243bb6464fbcb", "score": "0.49725896", "text": "func (g *RouterGroup) Child(path string, descs ...string) *RouterGroup {\n\treturn g.group(path, true, descs)\n}", "title": "" }, { "docid": "51895acc7c65ff5b7d476b691ca68cb3", "score": "0.49682996", "text": "func (a *Action) AddChild(child *Action) *Action {\n\ta.Children = append(a.Children, *child)\n\treturn child\n}", "title": "" }, { "docid": "7b7b4be2ff26add6a1ffd68f471d7a99", "score": "0.4965663", "text": "func (key *Key) NewChildKey(childIdx uint32) (*Key, error) {\n\thardenedChild := childIdx >= FirstHardenedChild\n\tchildIndexBytes := uint32Bytes(childIdx)\n\n\t// Fail early if trying to create hardned child from public key\n\tif !key.IsPrivate && hardenedChild {\n\t\treturn nil, errors.New(\"Can't create hardened child for public key\")\n\t}\n\n\t// Get intermediary to create key and chaincode from\n\t// Hardened children are based on the private key\n\t// NonHardened children are based on the public key\n\tvar data []byte\n\tif hardenedChild {\n\t\tdata = append([]byte{0x0}, key.Key...)\n\t} else if key.IsPrivate {\n\t\tdata = publicKeyForPrivateKey(key.Key)\n\t} else {\n\t\tdata = key.Key\n\t}\n\tdata = append(data, childIndexBytes...)\n\n\thmac := hmac.New(sha512.New, key.ChainCode)\n\t_, err := hmac.Write(data)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tintermediary := hmac.Sum(nil)\n\n\t// Create child Key with data common to all both scenarios\n\tchildKey := &Key{\n\t\tChildNumber: childIndexBytes,\n\t\tChainCode: intermediary[32:],\n\t\tDepth: key.Depth + 1,\n\t\tIsPrivate: key.IsPrivate,\n\t}\n\n\t// Bip32 CKDpriv\n\tif key.IsPrivate {\n\t\tchildKey.Version = PrivateWalletVersion\n\t\tchildKey.FingerPrint = hash160(publicKeyForPrivateKey(key.Key))[:4]\n\t\tchildKey.Key = addPrivateKeys(intermediary[:32], key.Key)\n\n\t\t// Validate key\n\t\terr := validatePrivateKey(childKey.Key)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t// Bip32 CKDpub\n\t} else {\n\t\tkeyBytes := publicKeyForPrivateKey(intermediary[:32])\n\t\t// Validate key\n\t\terr := validateChildPublicKey(keyBytes)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tchildKey.Version = PublicWalletVersion\n\t\tchildKey.FingerPrint = hash160(key.Key)[:4]\n\t\tchildKey.Key = addPublicKeys(keyBytes, key.Key)\n\t}\n\n\treturn childKey, nil\n}", "title": "" }, { "docid": "7fe2e8e4a94ab03979637661af4759a7", "score": "0.49623102", "text": "func (d *dentry) createAndOpenChildLocked(ctx context.Context, rp *vfs.ResolvingPath, opts *vfs.OpenOptions) (*vfs.FileDescription, error) {\n\tif err := d.checkPermissions(rp.Credentials(), vfs.MayWrite, true); err != nil {\n\t\treturn nil, err\n\t}\n\tif d.isDeleted() {\n\t\treturn nil, syserror.ENOENT\n\t}\n\tmnt := rp.Mount()\n\tif err := mnt.CheckBeginWrite(); err != nil {\n\t\treturn nil, err\n\t}\n\tdefer mnt.EndWrite()\n\n\t// 9P2000.L's lcreate takes a fid representing the parent directory, and\n\t// converts it into an open fid representing the created file, so we need\n\t// to duplicate the directory fid first.\n\t_, dirfile, err := d.file.walk(ctx, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcreds := rp.Credentials()\n\tname := rp.Component()\n\tfdobj, openFile, createQID, _, err := dirfile.create(ctx, name, (p9.OpenFlags)(opts.Flags), (p9.FileMode)(opts.Mode), (p9.UID)(creds.EffectiveKUID), (p9.GID)(creds.EffectiveKGID))\n\tif err != nil {\n\t\tdirfile.close(ctx)\n\t\treturn nil, err\n\t}\n\t// Then we need to walk to the file we just created to get a non-open fid\n\t// representing it, and to get its metadata. This must use d.file since, as\n\t// explained above, dirfile was invalidated by dirfile.Create().\n\twalkQID, nonOpenFile, attrMask, attr, err := d.file.walkGetAttrOne(ctx, name)\n\tif err != nil {\n\t\topenFile.close(ctx)\n\t\tif fdobj != nil {\n\t\t\tfdobj.Close()\n\t\t}\n\t\treturn nil, err\n\t}\n\t// Sanity-check that we walked to the file we created.\n\tif createQID.Path != walkQID.Path {\n\t\t// Probably due to concurrent remote filesystem mutation?\n\t\tctx.Warningf(\"gofer.dentry.createAndOpenChildLocked: created file has QID %v before walk, QID %v after (interop=%v)\", createQID, walkQID, d.fs.opts.interop)\n\t\tnonOpenFile.close(ctx)\n\t\topenFile.close(ctx)\n\t\tif fdobj != nil {\n\t\t\tfdobj.Close()\n\t\t}\n\t\treturn nil, syserror.EAGAIN\n\t}\n\n\t// Construct the new dentry.\n\tchild, err := d.fs.newDentry(ctx, nonOpenFile, createQID, attrMask, &attr)\n\tif err != nil {\n\t\tnonOpenFile.close(ctx)\n\t\topenFile.close(ctx)\n\t\tif fdobj != nil {\n\t\t\tfdobj.Close()\n\t\t}\n\t\treturn nil, err\n\t}\n\t// Incorporate the fid that was opened by lcreate.\n\tuseRegularFileFD := child.fileType() == linux.S_IFREG && !d.fs.opts.regularFilesUseSpecialFileFD\n\tif useRegularFileFD {\n\t\tchild.handleMu.Lock()\n\t\tchild.handle.file = openFile\n\t\tif fdobj != nil {\n\t\t\tchild.handle.fd = int32(fdobj.Release())\n\t\t}\n\t\tchild.handleReadable = vfs.MayReadFileWithOpenFlags(opts.Flags)\n\t\tchild.handleWritable = vfs.MayWriteFileWithOpenFlags(opts.Flags)\n\t\tchild.handleMu.Unlock()\n\t}\n\t// Take a reference on the new dentry to be held by the new file\n\t// description. (This reference also means that the new dentry is not\n\t// eligible for caching yet, so we don't need to append to a dentry slice.)\n\tchild.refs = 1\n\t// Insert the dentry into the tree.\n\td.IncRef() // reference held by child on its parent d\n\td.vfsd.InsertChild(&child.vfsd, name)\n\tif d.fs.opts.interop != InteropModeShared {\n\t\td.touchCMtime(ctx)\n\t\tdelete(d.negativeChildren, name)\n\t\td.dirents = nil\n\t}\n\n\t// Finally, construct a file description representing the created file.\n\tvar childVFSFD *vfs.FileDescription\n\tmnt.IncRef()\n\tif useRegularFileFD {\n\t\tfd := &regularFileFD{}\n\t\tif err := fd.vfsfd.Init(fd, opts.Flags, mnt, &child.vfsd, &vfs.FileDescriptionOptions{\n\t\t\tAllowDirectIO: true,\n\t\t}); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tchildVFSFD = &fd.vfsfd\n\t} else {\n\t\tfd := &specialFileFD{\n\t\t\thandle: handle{\n\t\t\t\tfile: openFile,\n\t\t\t\tfd: -1,\n\t\t\t},\n\t\t}\n\t\tif fdobj != nil {\n\t\t\tfd.handle.fd = int32(fdobj.Release())\n\t\t}\n\t\tif err := fd.vfsfd.Init(fd, opts.Flags, mnt, &child.vfsd, &vfs.FileDescriptionOptions{}); err != nil {\n\t\t\tfd.handle.close(ctx)\n\t\t\treturn nil, err\n\t\t}\n\t\tchildVFSFD = &fd.vfsfd\n\t}\n\treturn childVFSFD, nil\n}", "title": "" }, { "docid": "fad3338ea53f731c1bdc594c886b8614", "score": "0.4953455", "text": "func (o *BGPNeighbor) CreateMetadata(child *Metadata) *bambou.Error {\n\n\treturn bambou.CurrentSession().CreateChild(o, child)\n}", "title": "" }, { "docid": "3c4abe316e583933c11fde0d0b62c3d8", "score": "0.49522328", "text": "func (n *node) appendChild(c *node) {\n\tif c.parent != nil || c.prevSibling != nil || c.nextSibling != nil {\n\t\tpanic(\"node: appendChild called for an attached child Node\")\n\t}\n\tlast := n.lastChild\n\tif last != nil {\n\t\tlast.nextSibling = c\n\t} else {\n\t\tn.firstChild = c\n\t}\n\tn.lastChild = c\n\tc.parent = n\n\tc.prevSibling = last\n}", "title": "" }, { "docid": "54ba315fa7189319dda9f8162af4b51e", "score": "0.49397987", "text": "func (st *StandardTask) AddChild(child Task) {\n\tst.children = append(st.children, child)\n}", "title": "" }, { "docid": "3425795b25b54de187a8c2084c3a84dd", "score": "0.49397543", "text": "func (w *Window) AddChild(c base.TComponent) {\n\tw.view.AddChild(c)\n}", "title": "" }, { "docid": "d00561c78ef36f8fc84c78f7e50176bf", "score": "0.49372247", "text": "func CreateChildTask(ctx context.Context, sessionUserName string, parentTaskID string) (string, error) {\n\tconn, errConn := ODIMService.Client(Tasks)\n\tif errConn != nil {\n\t\treturn \"\", fmt.Errorf(\"Failed to create client connection: %s\", errConn.Error())\n\t}\n\tdefer conn.Close()\n\ttaskService := taskproto.NewGetTaskServiceClient(conn)\n\treqCtx := common.CreateNewRequestContext(ctx)\n\treqCtx = common.CreateMetadata(reqCtx)\n\tresponse, err := taskService.CreateChildTask(\n\t\treqCtx, &taskproto.CreateTaskRequest{\n\t\t\tUserName: sessionUserName,\n\t\t\tParentTaskID: parentTaskID,\n\t\t},\n\t)\n\tif err != nil && response == nil {\n\t\treturn \"\", fmt.Errorf(\"rpc error while creating the child task: %s\", err.Error())\n\t}\n\treturn response.TaskURI, err\n}", "title": "" }, { "docid": "09fee891461c84cc12eee055961d0a03", "score": "0.49350223", "text": "func createEdges(parent *Node, children ...*Node) {\n\tfor _, child := range children {\n\t\tedge := &Edge{\n\t\t\tSrc: parent,\n\t\t\tDest: child,\n\t\t}\n\t\tparent.Out[child] = edge\n\t\tchild.In[parent] = edge\n\t}\n}", "title": "" }, { "docid": "6e13e616e66c9fa7b686b8f04a64724e", "score": "0.49316835", "text": "func (self *Endpoint) addChild(provider *Spliter) (*Endpoint, error) {\n\tepName, err := provider.Next()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif epName == nil {\n\t\treturn self, nil\n\t}\n\n\tvar legalRunes *_LegalRunes\n\tif self.casesensitive {\n\t\tlegalRunes = _LEGAL_RUNES_CASESENSITIVE\n\t} else {\n\t\tlegalRunes = _LEGAL_RUNES_NON_CASESENSITIVE\n\t}\n\n\t/*********************** dynamic endpoint *******************/\n\tif epName[0] == ':' {\n\t\tepName = epName[1:]\n\n\t\tfor _, r := range epName {\n\t\t\tif !legalRunes.isLegal(r) {\n\t\t\t\treturn nil, _IlegalRuneErr\n\t\t\t}\n\t\t}\n\n\t\t// current endpoint has no child\n\t\tif self.child == nil {\n\t\t\t// create a new endpoint\n\t\t\tnewEndpoint := self.NewEndpoint()\n\t\t\tnewEndpoint.name = epName\n\t\t\tnewEndpoint.dynamic = true\n\t\t\tnewEndpoint.parent = self\n\t\t\t// the target is the endpoint that will register handlers or middlewares with\n\t\t\ttarget, err := newEndpoint.addChild(provider)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\t// make the new endpoint as the child of current one\n\t\t\tself.child = newEndpoint\n\t\t\treturn target, nil\n\t\t}\n\n\t\t// current endpoint has children\n\t\tif !self.child.dynamic || bytes.Compare(self.child.name, epName) != 0 {\n\t\t\t// current endpoint has a static child\n\t\t\t// or current endpoint has a dynamic child with different name from new endpoint\n\t\t\t// return error\n\t\t\treturn nil, _DynamicEpSingletonErr\n\t\t}\n\n\t\treturn self.child.addChild(provider)\n\n\t}\n\n\t/********************* static endpoint done *****************/\n\tfor _, r := range epName {\n\t\tif !legalRunes.isLegal(r) {\n\t\t\treturn nil, _IlegalRuneErr\n\t\t}\n\t}\n\n\t// current endpoint has no child\n\tif self.child == nil {\n\t\t// create a new endpoint\n\t\tnewEndpoint := self.NewEndpoint()\n\t\tnewEndpoint.name = epName\n\t\tnewEndpoint.parent = self\n\t\t// the target is the endpoint that will register handlers or middlewares with\n\t\ttarget, err := newEndpoint.addChild(provider)\n\t\tif err == nil {\n\t\t\t// make the new endpoint as the child of current one\n\t\t\tself.child = newEndpoint\n\t\t}\n\t\treturn target, nil\n\t}\n\n\t// current endpoint has children\n\t// find the position that the new one shall be inserted at\n\tpredictedPosition, found := self.child.findSiblin(epName)\n\tif found {\n\t\treturn predictedPosition.addChild(provider)\n\t}\n\n\tnewEndpoint := self.NewEndpoint()\n\tnewEndpoint.name = epName\n\tnewEndpoint.parent = self\n\n\ttarget, err := newEndpoint.addChild(provider)\n\n\tif err == nil {\n\t\tif predictedPosition == nil {\n\t\t\tnewEndpoint.siblin = self.child\n\t\t\tself.child = newEndpoint\n\t\t} else {\n\t\t\tnewEndpoint.siblin = predictedPosition.siblin\n\t\t\tpredictedPosition.siblin = newEndpoint\n\t\t}\n\t}\n\n\treturn target, err\n}", "title": "" }, { "docid": "137ce8681ba2f6d15157ebffd59de84d", "score": "0.49179757", "text": "func (self *Stage) RemoveChild(child *DisplayObject) *DisplayObject{\n return &DisplayObject{self.Object.Call(\"removeChild\", child)}\n}", "title": "" }, { "docid": "10d861623ff7249be31afac7697af981", "score": "0.4910023", "text": "func (xprv XPrv) Child(sel []byte, hardened bool) XPrv {\n\tif hardened {\n\t\treturn xprv.hardenedChild(sel)\n\t}\n\treturn xprv.nonhardenedChild(sel)\n}", "title": "" }, { "docid": "a603d6987f3fe726c5b56843e40ef897", "score": "0.49081585", "text": "func attachChildOutputToParent(childProcess *exec.Cmd) {\n\t// Note: Stdout could also be routed to something else, say a log file, in the future if logs become too cumbersome\n\t// For now, each server has its logging prefix, which is organized enough\n\tchildProcess.Stdout = os.Stdout\n\tchildProcess.Stderr = os.Stderr\n}", "title": "" } ]
5b23596daa555ec1f2cccf66436d7a88
WithSubject specifies that expected subject value. If not specified, the value of subject is not verified at all.
[ { "docid": "ff53501addf9f5bb08d46943a81370ab", "score": "0.7549137", "text": "func WithSubject(s string) ValidateOption {\n\treturn WithValidator(ClaimValueIs(SubjectKey, s))\n}", "title": "" } ]
[ { "docid": "c7450deb53691aff78a331f618b0a109", "score": "0.68539214", "text": "func (v *Validator) SetSubject(sub string) {\n\tv.expect()\n\tv.Expected.Set(\"sub\", sub)\n}", "title": "" }, { "docid": "d813e4f70e461557d0a7fec5d174a9c9", "score": "0.67083824", "text": "func (m *Msg) AssertSubject(subject string) *Msg {\n\tAssertEqualJSON(m.c.t, \"subject\", m.Subject, subject)\n\treturn m\n}", "title": "" }, { "docid": "1b155ba06888821d453a4896f3ddd091", "score": "0.65324855", "text": "func (b *Builder) Subject(subject string) *Builder {\n\tb.subject = subject\n\treturn b\n}", "title": "" }, { "docid": "9c9b8b261a5aec509ef78c0ee7173b59", "score": "0.6308825", "text": "func NewSubject(model map[string]string) *Subject {\n\n\tm := Subject{NewResourceAttributes(model),\n\t\t\"\",\n\t\t\"\",\n\t\t\"\",\n\t\t\"\",\n\t\ttrue,\n\t}\n\n\t// The subject match criteria across consumers / \"consumer\" match\n\tm.ConsumerMatch = model[\"consMatchT\"]\n\n\t// The priority level of a sub application running behind an endpoint group, such as an Exchange server.\n\tm.Priority = model[\"prio\"]\n\n\t// The subject match criteria across consumers / \"provider\" match\n\tm.ProviderMatch = model[\"provMatchT\"]\n\n\t// Enables the filter to apply on both ingress and egress traffic.\n\tm.ReverseFilterPorts = m.ParseBool(model[\"revFltPorts\"])\n\n\t// The target differentiated services code point (DSCP) of the path attached to the layer 3 outside profile.\n\tm.DSCP = model[\"targetDscp\"]\n\n\treturn &m\n}", "title": "" }, { "docid": "9687f0e490d99750d91861bbf7855acd", "score": "0.6247065", "text": "func Subject(value pkix.Name) Option {\n\treturn func(c *configuration) {\n\t\tc.subject = &value\n\t}\n}", "title": "" }, { "docid": "20db7685c52e725b19df849e8daceac1", "score": "0.62224615", "text": "func (cq *CourseclassQuery) WithSubject(opts ...func(*SubjectQuery)) *CourseclassQuery {\n\tquery := &SubjectQuery{config: cq.config}\n\tfor _, opt := range opts {\n\t\topt(query)\n\t}\n\tcq.withSubject = query\n\treturn cq\n}", "title": "" }, { "docid": "ebfafc82df5683229bc2f75627080e8c", "score": "0.61294985", "text": "func (t TemplateData) SetSubject(v Subject) {\n\tt.Set(SubjectKey, v)\n}", "title": "" }, { "docid": "05d4a08be6c90075cc68c0199d48090b", "score": "0.6046268", "text": "func (u ArticleUpdater) SetSubject(subject string) ArticleUpdater {\n\tu.fields[string(ArticleDBSchema.Subject)] = subject\n\treturn u\n}", "title": "" }, { "docid": "cfd934c33a74cd24dab5df4e6a9d6953", "score": "0.6022693", "text": "func (o *OAuth2LogoutRequest) SetSubject(v string) {\n\to.Subject = &v\n}", "title": "" }, { "docid": "86c19a01eeb7fe6b1a7b9cfec3f9a943", "score": "0.5999289", "text": "func (this *JWT) FromSubject(user Authenticatable) (string, error) {\n\tpayload := this.MakePayload(user, time.Now().Add(time.Hour*2))\n\treturn this.encode(payload)\n}", "title": "" }, { "docid": "f1e26e49f57232b53f3cbfa85cb3f8db", "score": "0.5984853", "text": "func (o *ListVersionsParams) SetSubject(subject string) {\n\to.Subject = subject\n}", "title": "" }, { "docid": "da8dec894bed6d3b5515e2e5f500daa5", "score": "0.59126306", "text": "func NewWithSubject(ctx context.Context, keydata []byte, subject string, scope ...string) (*http.Client, error) {\n\tconf, err := google.JWTConfigFromJSON(keydata, scope...)\n\tif err != nil {\n\t\treturn nil, jwtError(err)\n\t}\n\tconf.Subject = subject\n\treturn conf.Client(ctx), nil\n}", "title": "" }, { "docid": "e0193e06bfc846ed07868b78f856894d", "score": "0.57401097", "text": "func (m *Mail) Subject(subject string) *Builder {\n\treturn acquireBuilder(m).Subject(subject)\n}", "title": "" }, { "docid": "4d8dcbffa0b635c4b039b05144a5c9aa", "score": "0.5735556", "text": "func subject(t *testing.T, id tlsca.Identity) pkix.Name {\n\ts, err := id.Subject()\n\trequire.NoError(t, err)\n\t// ExtraNames get moved to Names when generating a real x509 cert.\n\t// Since we're just mimicking certs in memory, move manually.\n\ts.Names = s.ExtraNames\n\treturn s\n}", "title": "" }, { "docid": "376ca70f6b3b79b46466dc21fe9d7ac1", "score": "0.57230645", "text": "func (s *StartEngagementInput) SetSubject(v string) *StartEngagementInput {\n\ts.Subject = &v\n\treturn s\n}", "title": "" }, { "docid": "dc6d8c26dc47a107bb276740e8406560", "score": "0.5717702", "text": "func (this *EM) Subject(s string) *EM {\n\tthis.Message.Subject = s\n\treturn this\n}", "title": "" }, { "docid": "9d46863e002cb6dc6617b1512fb7a95a", "score": "0.5677921", "text": "func (o *GetRelationTuplesParams) SetSubject(subject *string) {\n\to.Subject = subject\n}", "title": "" }, { "docid": "462aa18dc2f8f6e5f6d55bec41a77d6d", "score": "0.56694645", "text": "func (o *CaConfig) SetSubject(v string) {\n\to.Subject = &v\n}", "title": "" }, { "docid": "0e0424714065a64d3ee1527bbb7d9d33", "score": "0.56678575", "text": "func (s *DescribePageOutput) SetSubject(v string) *DescribePageOutput {\n\ts.Subject = &v\n\treturn s\n}", "title": "" }, { "docid": "925cb9aafb6b95a07bf0f789efb5bfa1", "score": "0.5645441", "text": "func (s *DescribeEngagementOutput) SetSubject(v string) *DescribeEngagementOutput {\n\ts.Subject = &v\n\treturn s\n}", "title": "" }, { "docid": "5202940d5f1df71ed48ef3a3abfadb00", "score": "0.564031", "text": "func (o *MicrosoftGraphScheduleItem) SetSubject(v string) {\n\to.Subject = &v\n}", "title": "" }, { "docid": "507d8c29327fda8eeda6abe2ab53304d", "score": "0.56177825", "text": "func (g GrantsType) Subject(subject SubjectType) ResourceGrantsType {\n\tif !subject.IsZero() && g[subject] == nil {\n\t\tg[subject] = make(ResourceGrantsType)\n\t}\n\treturn g[subject]\n}", "title": "" }, { "docid": "f6b672a2bb085abc95d0487017d8e0a4", "score": "0.55892605", "text": "func (s SIPHeader) SetSubject(subject string) {\n\ts.SetFirstHeader(\"subject\", subject)\n}", "title": "" }, { "docid": "9ec74b5c776b775b87ecd3335f7e9c62", "score": "0.5574819", "text": "func NewClientWithSubject() *Client {\n\treturn &Client{\n\t\tsub: &RealSubject{},\n\t}\n}", "title": "" }, { "docid": "ed399732c9c5858d3d4384a487ffb175", "score": "0.55078095", "text": "func (m *mmsCampaign) SetSubject(val *string) {\n\tm.subjectField = val\n}", "title": "" }, { "docid": "29b09a77db1f8ac916263326822e7fdc", "score": "0.55010194", "text": "func (m *Task) AddSubject(subject *Metadata) *Task {\n\tm.Subjects = append(m.Subjects, subject)\n\treturn m\n}", "title": "" }, { "docid": "242609ecf5e25ec11f2a0cea1eca5c88", "score": "0.5480477", "text": "func (s *Service) Subject(c context.Context, oid int64, tp int8) (*model.Subject, error) {\n\tsubject, err := s.dao.Subject(c, oid, tp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif subject.State == model.SubStateForbid {\n\t\treturn nil, ecode.RequestErr\n\t}\n\treturn subject, nil\n}", "title": "" }, { "docid": "788814ac03bd766cf29e2cea8f0d1e13", "score": "0.5413997", "text": "func (m *MessageSecurityState) SetMessageSubject(value *string)() {\n m.messageSubject = value\n}", "title": "" }, { "docid": "a10b08ed4ea00097bd31e53902c3240a", "score": "0.5397089", "text": "func (sc *StandardClaims) IsSubject(subject string) bool {\n\treturn constTimeEqual(sc.Subject, subject)\n}", "title": "" }, { "docid": "b7bd8f6f067db22fa405570e6b7fc292", "score": "0.5393262", "text": "func (m *Message) SetSubject(subject ...string) {\n\tm.encodeHeader(subject)\n\tm.header[\"Subject\"] = subject\n}", "title": "" }, { "docid": "109936be6745a4bec5e0232ed6762727", "score": "0.53779954", "text": "func FromSubject(subject pkix.Name, expires time.Time) (*Identity, error) {\n\tid := &Identity{\n\t\tUsername: subject.CommonName,\n\t\tGroups: subject.Organization,\n\t\tUsage: subject.OrganizationalUnit,\n\t\tPrincipals: subject.Locality,\n\t\tExpires: expires,\n\t}\n\tif len(subject.StreetAddress) > 0 {\n\t\tid.RouteToCluster = subject.StreetAddress[0]\n\t}\n\tif len(subject.PostalCode) > 0 {\n\t\terr := wrappers.UnmarshalTraits([]byte(subject.PostalCode[0]), &id.Traits)\n\t\tif err != nil {\n\t\t\treturn nil, trace.Wrap(err)\n\t\t}\n\t}\n\n\tfor _, attr := range subject.Names {\n\t\tswitch {\n\t\tcase attr.Type.Equal(SystemRolesASN1ExtensionOID):\n\t\t\tval, ok := attr.Value.(string)\n\t\t\tif ok {\n\t\t\t\tid.SystemRoles = append(id.SystemRoles, val)\n\t\t\t}\n\t\tcase attr.Type.Equal(KubeUsersASN1ExtensionOID):\n\t\t\tval, ok := attr.Value.(string)\n\t\t\tif ok {\n\t\t\t\tid.KubernetesUsers = append(id.KubernetesUsers, val)\n\t\t\t}\n\t\tcase attr.Type.Equal(KubeGroupsASN1ExtensionOID):\n\t\t\tval, ok := attr.Value.(string)\n\t\t\tif ok {\n\t\t\t\tid.KubernetesGroups = append(id.KubernetesGroups, val)\n\t\t\t}\n\t\tcase attr.Type.Equal(KubeClusterASN1ExtensionOID):\n\t\t\tval, ok := attr.Value.(string)\n\t\t\tif ok {\n\t\t\t\tid.KubernetesCluster = val\n\t\t\t}\n\t\tcase attr.Type.Equal(AppSessionIDASN1ExtensionOID):\n\t\t\tval, ok := attr.Value.(string)\n\t\t\tif ok {\n\t\t\t\tid.RouteToApp.SessionID = val\n\t\t\t}\n\t\tcase attr.Type.Equal(AppPublicAddrASN1ExtensionOID):\n\t\t\tval, ok := attr.Value.(string)\n\t\t\tif ok {\n\t\t\t\tid.RouteToApp.PublicAddr = val\n\t\t\t}\n\t\tcase attr.Type.Equal(AppClusterNameASN1ExtensionOID):\n\t\t\tval, ok := attr.Value.(string)\n\t\t\tif ok {\n\t\t\t\tid.RouteToApp.ClusterName = val\n\t\t\t}\n\t\tcase attr.Type.Equal(AppNameASN1ExtensionOID):\n\t\t\tval, ok := attr.Value.(string)\n\t\t\tif ok {\n\t\t\t\tid.RouteToApp.Name = val\n\t\t\t}\n\t\tcase attr.Type.Equal(AppAWSRoleARNASN1ExtensionOID):\n\t\t\tval, ok := attr.Value.(string)\n\t\t\tif ok {\n\t\t\t\tid.RouteToApp.AWSRoleARN = val\n\t\t\t}\n\t\tcase attr.Type.Equal(AWSRoleARNsASN1ExtensionOID):\n\t\t\tval, ok := attr.Value.(string)\n\t\t\tif ok {\n\t\t\t\tid.AWSRoleARNs = append(id.AWSRoleARNs, val)\n\t\t\t}\n\t\tcase attr.Type.Equal(AppAzureIdentityASN1ExtensionOID):\n\t\t\tval, ok := attr.Value.(string)\n\t\t\tif ok {\n\t\t\t\tid.RouteToApp.AzureIdentity = val\n\t\t\t}\n\t\tcase attr.Type.Equal(AzureIdentityASN1ExtensionOID):\n\t\t\tval, ok := attr.Value.(string)\n\t\t\tif ok {\n\t\t\t\tid.AzureIdentities = append(id.AzureIdentities, val)\n\t\t\t}\n\t\tcase attr.Type.Equal(AppGCPServiceAccountASN1ExtensionOID):\n\t\t\tval, ok := attr.Value.(string)\n\t\t\tif ok {\n\t\t\t\tid.RouteToApp.GCPServiceAccount = val\n\t\t\t}\n\t\tcase attr.Type.Equal(GCPServiceAccountsASN1ExtensionOID):\n\t\t\tval, ok := attr.Value.(string)\n\t\t\tif ok {\n\t\t\t\tid.GCPServiceAccounts = append(id.GCPServiceAccounts, val)\n\t\t\t}\n\t\tcase attr.Type.Equal(RenewableCertificateASN1ExtensionOID):\n\t\t\tval, ok := attr.Value.(string)\n\t\t\tif ok {\n\t\t\t\tid.Renewable = val == types.True\n\t\t\t}\n\t\tcase attr.Type.Equal(TeleportClusterASN1ExtensionOID):\n\t\t\tval, ok := attr.Value.(string)\n\t\t\tif ok {\n\t\t\t\tid.TeleportCluster = val\n\t\t\t}\n\t\tcase attr.Type.Equal(MFAVerifiedASN1ExtensionOID):\n\t\t\tval, ok := attr.Value.(string)\n\t\t\tif ok {\n\t\t\t\tid.MFAVerified = val\n\t\t\t}\n\t\tcase attr.Type.Equal(PreviousIdentityExpiresASN1ExtensionOID):\n\t\t\tval, ok := attr.Value.(string)\n\t\t\tif ok {\n\t\t\t\tasTime, err := time.Parse(time.RFC3339, val)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, trace.Wrap(err)\n\t\t\t\t}\n\t\t\t\tid.PreviousIdentityExpires = asTime\n\t\t\t}\n\t\tcase attr.Type.Equal(LoginIPASN1ExtensionOID):\n\t\t\tval, ok := attr.Value.(string)\n\t\t\tif ok {\n\t\t\t\tid.LoginIP = val\n\t\t\t}\n\t\tcase attr.Type.Equal(DatabaseServiceNameASN1ExtensionOID):\n\t\t\tval, ok := attr.Value.(string)\n\t\t\tif ok {\n\t\t\t\tid.RouteToDatabase.ServiceName = val\n\t\t\t}\n\t\tcase attr.Type.Equal(DatabaseProtocolASN1ExtensionOID):\n\t\t\tval, ok := attr.Value.(string)\n\t\t\tif ok {\n\t\t\t\tid.RouteToDatabase.Protocol = val\n\t\t\t}\n\t\tcase attr.Type.Equal(DatabaseUsernameASN1ExtensionOID):\n\t\t\tval, ok := attr.Value.(string)\n\t\t\tif ok {\n\t\t\t\tid.RouteToDatabase.Username = val\n\t\t\t}\n\t\tcase attr.Type.Equal(DatabaseNameASN1ExtensionOID):\n\t\t\tval, ok := attr.Value.(string)\n\t\t\tif ok {\n\t\t\t\tid.RouteToDatabase.Database = val\n\t\t\t}\n\t\tcase attr.Type.Equal(DatabaseNamesASN1ExtensionOID):\n\t\t\tval, ok := attr.Value.(string)\n\t\t\tif ok {\n\t\t\t\tid.DatabaseNames = append(id.DatabaseNames, val)\n\t\t\t}\n\t\tcase attr.Type.Equal(DatabaseUsersASN1ExtensionOID):\n\t\t\tval, ok := attr.Value.(string)\n\t\t\tif ok {\n\t\t\t\tid.DatabaseUsers = append(id.DatabaseUsers, val)\n\t\t\t}\n\t\tcase attr.Type.Equal(ImpersonatorASN1ExtensionOID):\n\t\t\tval, ok := attr.Value.(string)\n\t\t\tif ok {\n\t\t\t\tid.Impersonator = val\n\t\t\t}\n\t\tcase attr.Type.Equal(ActiveRequestsASN1ExtensionOID):\n\t\t\tval, ok := attr.Value.(string)\n\t\t\tif ok {\n\t\t\t\tid.ActiveRequests = append(id.ActiveRequests, val)\n\t\t\t}\n\t\tcase attr.Type.Equal(DisallowReissueASN1ExtensionOID):\n\t\t\tval, ok := attr.Value.(string)\n\t\t\tif ok {\n\t\t\t\tid.DisallowReissue = val == types.True\n\t\t\t}\n\t\tcase attr.Type.Equal(GenerationASN1ExtensionOID):\n\t\t\t// This doesn't seem to play nice with int types, so we'll parse it\n\t\t\t// from a string.\n\t\t\tval, ok := attr.Value.(string)\n\t\t\tif ok {\n\t\t\t\tgeneration, err := strconv.ParseUint(val, 10, 64)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, trace.Wrap(err)\n\t\t\t\t}\n\t\t\t\tid.Generation = generation\n\t\t\t}\n\t\tcase attr.Type.Equal(AllowedResourcesASN1ExtensionOID):\n\t\t\tallowedResourcesStr, ok := attr.Value.(string)\n\t\t\tif ok {\n\t\t\t\tallowedResourceIDs, err := types.ResourceIDsFromString(allowedResourcesStr)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, trace.Wrap(err)\n\t\t\t\t}\n\t\t\t\tid.AllowedResourceIDs = allowedResourceIDs\n\t\t\t}\n\t\tcase attr.Type.Equal(PrivateKeyPolicyASN1ExtensionOID):\n\t\t\tval, ok := attr.Value.(string)\n\t\t\tif ok {\n\t\t\t\tid.PrivateKeyPolicy = keys.PrivateKeyPolicy(val)\n\t\t\t}\n\t\tcase attr.Type.Equal(ConnectionDiagnosticIDASN1ExtensionOID):\n\t\t\tval, ok := attr.Value.(string)\n\t\t\tif ok {\n\t\t\t\tid.ConnectionDiagnosticID = val\n\t\t\t}\n\t\tcase attr.Type.Equal(DeviceIDExtensionOID):\n\t\t\tif val, ok := attr.Value.(string); ok {\n\t\t\t\tid.DeviceExtensions.DeviceID = val\n\t\t\t}\n\t\tcase attr.Type.Equal(DeviceAssetTagExtensionOID):\n\t\t\tif val, ok := attr.Value.(string); ok {\n\t\t\t\tid.DeviceExtensions.AssetTag = val\n\t\t\t}\n\t\tcase attr.Type.Equal(DeviceCredentialIDExtensionOID):\n\t\t\tif val, ok := attr.Value.(string); ok {\n\t\t\t\tid.DeviceExtensions.CredentialID = val\n\t\t\t}\n\t\tcase attr.Type.Equal(PinnedIPASN1ExtensionOID):\n\t\t\tif val, ok := attr.Value.(string); ok {\n\t\t\t\tid.PinnedIP = val\n\t\t\t}\n\t\t}\n\t}\n\n\tif err := id.CheckAndSetDefaults(); err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\treturn id, nil\n}", "title": "" }, { "docid": "a2955fb33662fec4ff975d710bc009a3", "score": "0.53564847", "text": "func (s *Subscription) SetSubject(v string) *Subscription {\n\ts.Subject = &v\n\treturn s\n}", "title": "" }, { "docid": "d28a248e2caa2c13165c1dfd662af4c1", "score": "0.5324079", "text": "func (t *Tracker) UpdateSubject(subject Subject) {\n\tt.Subject = subject\n}", "title": "" }, { "docid": "445fefc569cefae962f9f63cf51a4a02", "score": "0.528205", "text": "func (m *WindowsInformationProtectionDataRecoveryCertificate) SetSubjectName(value *string)() {\n m.subjectName = value\n}", "title": "" }, { "docid": "c05911d4d6e2c6cdb47c15803634e9bd", "score": "0.5281694", "text": "func (c *SubjectError) Subject() interface{} {\n\treturn c.subject\n}", "title": "" }, { "docid": "182d36d255f470e86bac9b71656675d6", "score": "0.5253535", "text": "func WithNatsSubject(queue string) Option {\n\treturn func(s *serverImpl) error {\n\t\ts.subject = queue\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "e073807f021053067495400ec83b2b0c", "score": "0.52534646", "text": "func NewSubject(kind, name string) rbac.Subject {\n\treturn rbac.Subject{\n\t\tKind: kind,\n\t\tName: name,\n\t\tAPIGroup: rbac.GroupName,\n\t}\n}", "title": "" }, { "docid": "ba42ef0a8a1e7996cddda8e793dbec39", "score": "0.52452904", "text": "func (o *OAuth2LogoutRequest) HasSubject() bool {\n\tif o != nil && o.Subject != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "bc06a5c6e48dc30419bada4beca5e767", "score": "0.52378815", "text": "func VerifySubject(requiredSubject, tokenSubjects string, evalTenant func(tenant, subjects string) bool) bool {\n\tfor _, v := range strings.Split(tokenSubjects, \",\") {\n\t\tif util.StrContains(util.SuperRoles, v) {\n\t\t\treturn true\n\t\t}\n\t\tif requiredSubject == v {\n\t\t\treturn true\n\t\t}\n\t\tif evalTenant(requiredSubject, v) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "da5337323a2569e8cc0a114976a39773", "score": "0.52137166", "text": "func (d *dao) AddCacheSubject(c context.Context, id int64, val *model.Subject, tp int8) (err error) {\n\tif val == nil {\n\t\treturn\n\t}\n\tkey := keySub(id, tp)\n\titem := &memcache.Item{Key: key, Object: val, Expiration: d.demoExpire, Flags: memcache.FlagJSON}\n\tif err = d.mc.Set(c, item); err != nil {\n\t\tlog.Errorv(c, log.KV(\"AddCacheSubject\", fmt.Sprintf(\"%+v\", err)), log.KV(\"key\", key))\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "9ecbf241eb4e316cf33356bd984e474d", "score": "0.5206196", "text": "func AddSubject(c *gin.Context) {\r\n\tname := c.PostForm(\"SubName\")\r\n\tgrade := c.PostForm(\"Grade\")\r\n\tstmt, err := config.Db.Prepare(\"insert into subject (SubName,Grade) values(?,?);\")\r\n\tif err != nil {\r\n\t\tfmt.Print(err.Error())\r\n\t}\r\n\t_, err = stmt.Exec(name, grade)\r\n\r\n\tif err != nil {\r\n\t\tfmt.Print(err.Error())\r\n\t}\r\n\tdefer stmt.Close()\r\n\tc.JSON(http.StatusOK, gin.H{\r\n\t\t\"message\": fmt.Sprintf(\"Subject %s successfully created\", name),\r\n\t})\r\n}", "title": "" }, { "docid": "4ae35e682f911529e6576fc9c3d68dd1", "score": "0.52013505", "text": "func (t Token) Subject() string {\n\tif v, ok := t.Get(SubjectKey); ok {\n\t\treturn v.(string)\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "df1db6fce8bc9ece358b519670662d6f", "score": "0.51711094", "text": "func (qs ArticleQuerySet) SubjectEq(subject string) ArticleQuerySet {\n\treturn qs.w(qs.db.Where(\"subject = ?\", subject))\n}", "title": "" }, { "docid": "bae5b5d719ed4512b21a9b9e1b0fbb39", "score": "0.5123203", "text": "func (o SubjectDescriptionResponseOutput) Subject() SubjectResponseOutput {\n\treturn o.ApplyT(func(v SubjectDescriptionResponse) SubjectResponse { return v.Subject }).(SubjectResponseOutput)\n}", "title": "" }, { "docid": "3471950817143c3ef2b874941579d2ab", "score": "0.5115385", "text": "func (o *CaConfig) HasSubject() bool {\n\tif o != nil && o.Subject != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "caccd590f32e25289ad5519d7a5f8c7b", "score": "0.51083386", "text": "func buildSubjectGet(t *testing.T, subject *Test) (*Test, error) {\n\tdata := schema.TestResourceDataRaw(t, SchemaTest, fixture)\n\terr := GetTest(subject, data)\n\treturn subject, err\n}", "title": "" }, { "docid": "e529cdae1b6146ec4dfadf7e156f4ae3", "score": "0.50928575", "text": "func (qs ArticleQuerySet) SubjectNotIn(subject ...string) ArticleQuerySet {\n\tif len(subject) == 0 {\n\t\tqs.db.AddError(errors.New(\"must at least pass one subject in SubjectNotIn\"))\n\t\treturn qs.w(qs.db)\n\t}\n\treturn qs.w(qs.db.Where(\"subject NOT IN (?)\", subject))\n}", "title": "" }, { "docid": "68c28bd1adced103136dd627d1d1e913", "score": "0.5085089", "text": "func (o *ListVersionsParams) WithSubject(subject string) *ListVersionsParams {\n\to.SetSubject(subject)\n\treturn o\n}", "title": "" }, { "docid": "3dba293357e6fa475ae023db4712175f", "score": "0.50842404", "text": "func (o SubjectConfigResponseOutput) Subject() SubjectResponseOutput {\n\treturn o.ApplyT(func(v SubjectConfigResponse) SubjectResponse { return v.Subject }).(SubjectResponseOutput)\n}", "title": "" }, { "docid": "39dbf901e739426f670a01acec6944f9", "score": "0.507078", "text": "func (o AuthorityConfigSubjectConfigOutput) Subject() AuthorityConfigSubjectConfigSubjectOutput {\n\treturn o.ApplyT(func(v AuthorityConfigSubjectConfig) AuthorityConfigSubjectConfigSubject { return v.Subject }).(AuthorityConfigSubjectConfigSubjectOutput)\n}", "title": "" }, { "docid": "60f36b88775d5314ce2d69837e1ed7b9", "score": "0.5060935", "text": "func (o *MicrosoftGraphScheduleItem) HasSubject() bool {\n\tif o != nil && o.Subject != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "8c3bdc1f792b227e61b34d2a2b81882b", "score": "0.50450397", "text": "func (h Hash) Subject() sexprs.Sexp {\n\tfmt.Println(\"subject for\", h)\n\treturn sexprs.List{sexprs.Atom{Value: []byte(\"subject\")}, h.Sexp()}\n}", "title": "" }, { "docid": "d53cf86386062cdfcd286da56fc9ba51", "score": "0.50428617", "text": "func (o *MicrosoftGraphScheduleItem) GetSubjectOk() (string, bool) {\n\tif o == nil || o.Subject == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Subject, true\n}", "title": "" }, { "docid": "8ac9d002e2ace15486a6b7feba17f989", "score": "0.50249565", "text": "func (c Cert) MustSubjectID() string {\n\tif subj, err := c.SubjectID(); err != nil {\n\t\tpanic(err)\n\t} else {\n\t\treturn subj\n\t}\n}", "title": "" }, { "docid": "6d9e9dbf3b5673fb191b52e0b740eee0", "score": "0.5017577", "text": "func (j *JWTTokenRequest) GetSubject() string {\n\treturn j.Subject\n}", "title": "" }, { "docid": "11366ac395ba761f95a515187009e818", "score": "0.50139165", "text": "func (o *CaConfig) GetSubjectOk() (*string, bool) {\n\tif o == nil || o.Subject == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Subject, true\n}", "title": "" }, { "docid": "d4b9571d26778ef3fdf2569deb5796e4", "score": "0.50134057", "text": "func (s *EmailTemplateRequest) SetSubject(v string) *EmailTemplateRequest {\n\ts.Subject = &v\n\treturn s\n}", "title": "" }, { "docid": "da1c35a328a5312e1bb071883f69af40", "score": "0.50000817", "text": "func (o *OAuth2LogoutRequest) GetSubjectOk() (*string, bool) {\n\tif o == nil || o.Subject == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Subject, true\n}", "title": "" }, { "docid": "8366ede324497f11d4c835e23e556706", "score": "0.49974492", "text": "func AltSubjectMatch(sans []string) Option {\n\treturn func(c *ConfigFactory) {\n\t\tc.wpaeapOps = append(c.wpaeapOps, wpaeap.AltSubjectMatch(sans))\n\t}\n}", "title": "" }, { "docid": "a7b03d6062acb03365d0c02c1522b8bc", "score": "0.4988377", "text": "func (api *ArchivesSpaceAPI) CreateSubject(subject *Subject) (*ResponseMsg, error) {\n\tapi.UpdateCallPath(\"/subjects\")\n\tsubject.LockVersion = \"0\"\n\treturn api.CreateAPI(api.CallURL.String(), subject)\n}", "title": "" }, { "docid": "c4e582c22ce7756ddc5a46300c49e375", "score": "0.498572", "text": "func (api *ArchivesSpaceAPI) UpdateSubject(subject *Subject) (*ResponseMsg, error) {\n\tapi.UpdateCallPath(subject.URI)\n\treturn api.UpdateAPI(api.CallURL.String(), subject)\n}", "title": "" }, { "docid": "8de69d9cf150e2d71728bbfac271a874", "score": "0.4978249", "text": "func NewSubjectClient(c config) *SubjectClient {\n\treturn &SubjectClient{config: c}\n}", "title": "" }, { "docid": "dbcee8170e0a570d4afd0ee6c81e8df7", "score": "0.49752396", "text": "func subjectToBytes(subject interface{}) ([]byte, error) {\n\tif subject == nil {\n\t\treturn nil, nil\n\t}\n\n\tswitch s := subject.(type) {\n\tcase string:\n\t\treturn json.Marshal(s)\n\n\tcase []map[string]interface{}:\n\t\tif len(s) == 1 {\n\t\t\treturn json.Marshal(s[0])\n\t\t}\n\n\t\treturn json.Marshal(s)\n\n\tcase map[string]interface{}:\n\t\treturn subjectMapToRaw(s)\n\n\tcase Subject:\n\t\treturn s.MarshalJSON()\n\n\tcase []Subject:\n\t\tif len(s) == 1 {\n\t\t\treturn s[0].MarshalJSON()\n\t\t}\n\n\t\treturn json.Marshal(s)\n\n\tdefault:\n\t\treturn subjectStructToRaw(subject)\n\t}\n}", "title": "" }, { "docid": "d9c7df000eb4d2274362fcfcd500452a", "score": "0.4971706", "text": "func (m *GovernanceRoleAssignmentItemRequestBuilder) Subject()(*ItemSubjectRequestBuilder) {\n return NewItemSubjectRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)\n}", "title": "" }, { "docid": "520aa2315412b9b4cf3a96ba8bc7c967", "score": "0.49562386", "text": "func (o SubjectConfigOutput) Subject() SubjectOutput {\n\treturn o.ApplyT(func(v SubjectConfig) Subject { return v.Subject }).(SubjectOutput)\n}", "title": "" }, { "docid": "cb59841ef1a4c33029b11bfde6b8d30c", "score": "0.49454883", "text": "func (s *EmailTemplateResponse) SetSubject(v string) *EmailTemplateResponse {\n\ts.Subject = &v\n\treturn s\n}", "title": "" }, { "docid": "656e397db78a75d049a02fca0da8addb", "score": "0.49444556", "text": "func (api *ArchivesSpaceAPI) DeleteSubject(subject *Subject) (*ResponseMsg, error) {\n\tapi.UpdateCallPath(subject.URI)\n\treturn api.DeleteAPI(api.CallURL.String(), subject)\n}", "title": "" }, { "docid": "5233d2f86a497bdbae57f053f49af130", "score": "0.49374428", "text": "func VerifySubject(requiredSubject, tokenSubjects string) bool {\n\tfor _, v := range strings.Split(tokenSubjects, \",\") {\n\t\tif util.StrContains(util.SuperRoles, v) {\n\t\t\treturn true\n\t\t}\n\t\tsubCase1, subCase2 := ExtractTenant(v)\n\t\treturn requiredSubject == subCase1 || requiredSubject == subCase2\n\t}\n\treturn false\n}", "title": "" }, { "docid": "052400268d325c3dd2302a74bb576e03", "score": "0.49258414", "text": "func (in *Subject) DeepCopy() *Subject {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Subject)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "052400268d325c3dd2302a74bb576e03", "score": "0.49258414", "text": "func (in *Subject) DeepCopy() *Subject {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Subject)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "d91dfe747ca1064f445a44816d974eba", "score": "0.4910761", "text": "func (client *SchemaRegistryClient) DeleteSubject(subject string, permanent bool) error {\n\turi := \"/subjects/\" + subject\n\t_, err := client.httpRequest(\"DELETE\", uri, nil)\n\tif err != nil || !permanent {\n\t\treturn err\n\t}\n\n\turi += \"?permanent=true\"\n\t_, err = client.httpRequest(\"DELETE\", uri, nil)\n\treturn err\n}", "title": "" }, { "docid": "c3b81b224f4fd2169f8940fdbc728005", "score": "0.49099785", "text": "func (c *CompilerRego) compileSubject(sub ast.Subject) (string, error) {\n\tif types.IsNilInterface(sub) {\n\t\treturn \"\", compiler_error.ErrEmptySubject\n\t}\n\n\tswitch t := sub.(type) {\n\tcase *ast.SubjectGroup:\n\t\treturn fmt.Sprintf(\" seal_list_contains(input.subject.groups, `%s`)\", t.Group), nil\n\tcase *ast.SubjectUser:\n\t\treturn fmt.Sprintf(\" input.subject.email == `%s`\", t.User), nil\n\t}\n\n\treturn \"\", compiler_error.ErrInvalidSubject\n}", "title": "" }, { "docid": "703ddd8c2617cc75334a98f4fd834b37", "score": "0.4886852", "text": "func GetSubject(c *gin.Context) string {\n\treturn c.GetString(contextKeySubject)\n}", "title": "" }, { "docid": "00dab97aef953cedbe831729df7cfaf0", "score": "0.4886628", "text": "func (m *Msg) Equals(subject string, payload interface{}) *Msg {\n\tm.AssertSubject(subject)\n\tm.AssertPayload(payload)\n\treturn m\n}", "title": "" }, { "docid": "2fb3cc86c2b75fdd5788720bb25e1b95", "score": "0.48793253", "text": "func (o CertificateConfigSubjectConfigOutput) Subject() CertificateConfigSubjectConfigSubjectOutput {\n\treturn o.ApplyT(func(v CertificateConfigSubjectConfig) CertificateConfigSubjectConfigSubject { return v.Subject }).(CertificateConfigSubjectConfigSubjectOutput)\n}", "title": "" }, { "docid": "248b46b7f7525cfd661e7cd98fa52a5c", "score": "0.48621392", "text": "func (o CertificateAuthorityOutput) Subject() CertificateAuthoritySubjectOutput {\n\treturn o.ApplyT(func(v *CertificateAuthority) CertificateAuthoritySubjectOutput { return v.Subject }).(CertificateAuthoritySubjectOutput)\n}", "title": "" }, { "docid": "11a15fec3adcdbef091a63891e215e4e", "score": "0.48515117", "text": "func (k *Kairos) RemoveSubject(removeSubjectRequest *RemoveSubjectRequest) (*ResponseRemoveSubject, error) {\n\t_, err := removeSubjectRequest.IsValid()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tp := map[string]interface{}{\n\t\t\"gallery_name\": removeSubjectRequest.GalleryName,\n\t\t\"subject_id\": removeSubjectRequest.SubjectID,\n\t}\n\n\tif removeSubjectRequest.FaceID != \"\" {\n\t\tp[\"face_id\"] = removeSubjectRequest.FaceID\n\t}\n\n\tresp, err := k.makeRequest(\"POST\", \"gallery/remove_subject\", p)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tre := &ResponseRemoveSubject{}\n\n\tuErr := json.Unmarshal(resp, &re)\n\tif uErr != nil {\n\t\treturn nil, uErr\n\t}\n\n\tre.RawResponse = resp\n\treturn re, nil\n}", "title": "" }, { "docid": "b54b18eb65d651685d82da18d26d0cdc", "score": "0.48380464", "text": "func (o CertificateInformationResponseOutput) Subject() pulumi.StringOutput {\n\treturn o.ApplyT(func(v CertificateInformationResponse) string { return v.Subject }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "cbc89bb9e7f24961a20d3d92a4f3e206", "score": "0.4829576", "text": "func (o SubjectConfigPtrOutput) Subject() SubjectPtrOutput {\n\treturn o.ApplyT(func(v *SubjectConfig) *Subject {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Subject\n\t}).(SubjectPtrOutput)\n}", "title": "" }, { "docid": "2eb4442fdeda261f6af851a7c945635c", "score": "0.4817359", "text": "func NewSubjectHandler(config *config.Config, authentication security.AuthenticationService, service bbq.SubjectService) infrastructure.ApiHandler {\n\treturn &subjectHandler{service: service, authentication: authentication, config: config}\n}", "title": "" }, { "docid": "32215968d08fc891c327105382a4ed3d", "score": "0.47734216", "text": "func OptSrcSubjectAt(key string) SrcOption {\n\treturn func(s *Source) {\n\t\ts.subjectAt = key\n\t}\n}", "title": "" }, { "docid": "96959eb3dbf3716c9207bca0ce6ad3bc", "score": "0.477016", "text": "func (o CertificateInformationOutput) Subject() pulumi.StringOutput {\n\treturn o.ApplyT(func(v CertificateInformation) string { return v.Subject }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "ae4e9dc00ab494b4e547d6580738bb2a", "score": "0.47671473", "text": "func NewSubject(ID string) (*Subject, error) {\n\tsubject := &Subject{}\n\tfieldList := \"`id`, `name`\"\n\tsql := \"SELECT \" + fieldList + \" FROM `subject_area` WHERE id=? \"\n\tquery, err := database.Connection.Prepare(sql)\n\tif err != nil {\n\t\treturn subject, err\n\t}\n\tquery.QueryRow(ID).Scan(&subject.id, &subject.name)\n\treturn subject, nil\n}", "title": "" }, { "docid": "24dca1966f941b76b39166128386dcc4", "score": "0.4764073", "text": "func setDefaults_Subject(obj *rbacv1.Subject) {\n\tif len(obj.APIGroup) == 0 {\n\t\tswitch obj.Kind {\n\t\tcase rbacv1.ServiceAccountKind:\n\t\t\tobj.APIGroup = \"\"\n\t\tcase rbacv1.UserKind:\n\t\t\tobj.APIGroup = rbacv1.GroupName\n\t\tcase rbacv1.GroupKind:\n\t\t\tobj.APIGroup = rbacv1.GroupName\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d35a8504fe09c4ca431a1b39a7108af6", "score": "0.4754658", "text": "func (qs ArticleQuerySet) SubjectIn(subject ...string) ArticleQuerySet {\n\tif len(subject) == 0 {\n\t\tqs.db.AddError(errors.New(\"must at least pass one subject in SubjectIn\"))\n\t\treturn qs.w(qs.db)\n\t}\n\treturn qs.w(qs.db.Where(\"subject IN (?)\", subject))\n}", "title": "" }, { "docid": "1da5e04f80765ed27e6272383fad5057", "score": "0.47441012", "text": "func (m *mmsCampaign) Subject() *string {\n\treturn m.subjectField\n}", "title": "" }, { "docid": "d00c4c0d6b29bfa6f4bb76a939184786", "score": "0.47410253", "text": "func (c ClaimsContext) GetSubject() string {\n\treturn c.GetAsString(\"sub\")\n}", "title": "" }, { "docid": "d17a921d7592930d84b2424c69a18374", "score": "0.47399798", "text": "func (cq *CourseclassQuery) QuerySubject() *SubjectQuery {\n\tquery := &SubjectQuery{config: cq.config}\n\tquery.path = func(ctx context.Context) (fromU *sql.Selector, err error) {\n\t\tif err := cq.prepareQuery(ctx); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(courseclass.Table, courseclass.FieldID, cq.sqlQuery()),\n\t\t\tsqlgraph.To(subject.Table, subject.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, courseclass.SubjectTable, courseclass.SubjectColumn),\n\t\t)\n\t\tfromU = sqlgraph.SetNeighbors(cq.driver.Dialect(), step)\n\t\treturn fromU, nil\n\t}\n\treturn query\n}", "title": "" }, { "docid": "988397523ccaffeadb9753214bb4145d", "score": "0.4734875", "text": "func (e *Enforcer) AddSubjectAttributeFunction(function func(args ...interface{}) (interface{}, error)) {\n\te.fm.AddFunction(\"subAttr\", function)\n}", "title": "" }, { "docid": "e04ec7bebfa872fe4dd944489ad98718", "score": "0.47321177", "text": "func (c *Client) SubjectFilterBothAdd(tenant, contract, subject, filter string) error {\n\n\tme := \"SubjectFilterBothAdd\"\n\n\tdnS := dnSubject(tenant, contract, subject)\n\n\tapi := \"/api/node/mo/uni/\" + dnS + \".json\"\n\n\turl := c.getURL(api)\n\n\tj := fmt.Sprintf(`{\"vzRsSubjFiltAtt\":{\"attributes\":{\"tnVzFilterName\":\"%s\",\"status\":\"created,modified\"}}}`,\n\t\tfilter)\n\n\tc.debugf(\"%s: url=%s json=%s\", me, url, j)\n\n\tbody, errPost := c.post(url, contentTypeJSON, bytes.NewBufferString(j))\n\tif errPost != nil {\n\t\treturn fmt.Errorf(\"%s: %v\", me, errPost)\n\t}\n\n\tc.debugf(\"%s: reply: %s\", me, string(body))\n\n\treturn parseJSONError(body)\n}", "title": "" }, { "docid": "883432bcea38c6108eb770ae1c3083d9", "score": "0.47293076", "text": "func (m *LifecycleWorkflowsWorkflowsItemUserProcessingResultsUserProcessingResultItemRequestBuilder) Subject()(*LifecycleWorkflowsWorkflowsItemUserProcessingResultsItemSubjectRequestBuilder) {\n return NewLifecycleWorkflowsWorkflowsItemUserProcessingResultsItemSubjectRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)\n}", "title": "" }, { "docid": "8be23fb56908964ad41d088ac7eeae7c", "score": "0.47137475", "text": "func lenientCanonicalizeSubject(ctx context.Context, subject string) (string, error) {\n\tif strings.Index(subject, \":\") < 0 {\n\t\t// assume default 'github:' prefix (then canonicalize the GitHub username in\n\t\t// canonicalizeSubject)\n\t\tsubject = authclient.GitHubPrefix + subject\n\t}\n\treturn canonicalizeSubject(ctx, subject)\n}", "title": "" }, { "docid": "78953a259c02d37ff9c436ccd7a98767", "score": "0.47102723", "text": "func (c *mockclient) DeleteSubject(subject string, permanent bool) (deleted []int, err error) {\n\tc.schemaToIdCacheLock.Lock()\n\tfor key, value := range c.schemaToIdCache {\n\t\tif key.subject == subject && (!value.softDeleted || permanent) {\n\t\t\tc.deleteID(key, value.id, permanent)\n\t\t}\n\t}\n\tc.schemaToIdCacheLock.Unlock()\n\tc.schemaToVersionCacheLock.Lock()\n\tfor key, value := range c.schemaToVersionCache {\n\t\tif key.subject == subject && (!value.softDeleted || permanent) {\n\t\t\tc.deleteVersion(key, value.version, permanent)\n\t\t\tdeleted = append(deleted, value.version)\n\t\t}\n\t}\n\tc.schemaToVersionCacheLock.Unlock()\n\tc.compatibilityCacheLock.Lock()\n\tdelete(c.compatibilityCache, subject)\n\tc.compatibilityCacheLock.Unlock()\n\tif permanent {\n\t\tc.idToSchemaCacheLock.Lock()\n\t\tfor key := range c.idToSchemaCache {\n\t\t\tif key.subject == subject {\n\t\t\t\tdelete(c.idToSchemaCache, key)\n\t\t\t}\n\t\t}\n\t\tc.idToSchemaCacheLock.Unlock()\n\t}\n\treturn deleted, nil\n}", "title": "" }, { "docid": "12fa945ae10752df52cf44573e422c49", "score": "0.46750802", "text": "func (sr SubjectRepo) Add(subj *domain.Subject) error {\n\n\teid, err := uuid.NewV4()\n\tif err != nil {\n\t\treturn err\n\t}\n\tquery := `\n\t\tINSERT INTO subjects (eid, name, email, password_hash, active)\n\t\tVALUES ($1, $2, $3, $4, $5)\n\t\tRETURNING iid, created_at, version\n\t`\n\targs := []interface{}{eid.String(), subj.Name, subj.Email, subj.Password.Hash, subj.Active}\n\n\tctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)\n\tdefer cancel()\n\n\terr = sr.DB.QueryRowContext(ctx, query, args...).Scan(&subj.IID, &subj.CreatedAt, &subj.Version)\n\tif err != nil {\n\t\tswitch {\n\t\tcase err.Error() == `pq: duplicate key value violates unique constraint \"subjects_email_key\"`:\n\t\t\treturn app.ErrDuplicateEmail\n\t\tdefault:\n\t\t\treturn err\n\t\t}\n\t}\n\tsubj.EID = eid.String()\n\treturn nil\n}", "title": "" }, { "docid": "b9f4437e9301d45ce7de21faa04e7ed2", "score": "0.4656281", "text": "func subjectsEqual(a, b string) bool {\n\treturn a == b\n}", "title": "" }, { "docid": "4f7dd3add11bf16bc756d85dc6a9fd8e", "score": "0.4644954", "text": "func (o *PostCheckPermissionBody) HasSubjectId() bool {\n\tif o != nil && o.SubjectId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "feb8a86af19535f873b2a75a62d65abd", "score": "0.463576", "text": "func (s *SimpleEmail) SetSubject(v *SimpleEmailPart) *SimpleEmail {\n\ts.Subject = v\n\treturn s\n}", "title": "" }, { "docid": "ae38e36c780da311892759d87c3dbf64", "score": "0.46287555", "text": "func (o LookupEmailCustomizationResultOutput) Subject() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupEmailCustomizationResult) string { return v.Subject }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "2bb06f3978bb67fca77063c587901555", "score": "0.4628406", "text": "func (r *CasbinRoleService) AddSubjectToRole(subject, roleName string) error {\n\tif ok := r.enforcer.AddRoleForUser(subject, roleName); !ok {\n\t\treturn ErrAddSubjectToRole\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "feac4abd0b0fdbc12542da4e92d8997e", "score": "0.4621564", "text": "func (self *TransportPolicySubject) Validate() error {\n\tif self.DomainName == \"\" {\n\t\treturn fmt.Errorf(\"TransportPolicySubject.domainName is missing but is a required field\")\n\t} else {\n\t\tval := rdl.Validate(MSDSchema(), \"TransportPolicySubjectDomainName\", self.DomainName)\n\t\tif !val.Valid {\n\t\t\treturn fmt.Errorf(\"TransportPolicySubject.domainName does not contain a valid TransportPolicySubjectDomainName (%v)\", val.Error)\n\t\t}\n\t}\n\tif self.ServiceName == \"\" {\n\t\treturn fmt.Errorf(\"TransportPolicySubject.serviceName is missing but is a required field\")\n\t} else {\n\t\tval := rdl.Validate(MSDSchema(), \"TransportPolicySubjectServiceName\", self.ServiceName)\n\t\tif !val.Valid {\n\t\t\treturn fmt.Errorf(\"TransportPolicySubject.serviceName does not contain a valid TransportPolicySubjectServiceName (%v)\", val.Error)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" } ]
7e6ca9b7bbd00c0e82ad1a65acd72cb1
/ Execute executes the request
[ { "docid": "343c57550edefd65ec8874139d642b5a", "score": "0.0", "text": "func (a *DefaultApiService) DeleteItemExecute(r ApiDeleteItemRequest) (*_nethttp.Response, GenericOpenAPIError) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodDelete\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\texecutionError GenericOpenAPIError\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"DefaultApiService.DeleteItem\")\n\tif err != nil {\n\t\texecutionError.error = err.Error()\n\t\treturn nil, executionError\n\t}\n\n\tlocalVarPath := localBasePath + \"/items/{itemId}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"itemId\"+\"}\", _neturl.PathEscape(parameterToString(r.itemId, \"\")), -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{}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\texecutionError.error = err.Error()\n\t\treturn nil, executionError\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\texecutionError.error = err.Error()\n\t\treturn localVarHTTPResponse, executionError\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\texecutionError.error = err.Error()\n\t\treturn localVarHTTPResponse, executionError\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\treturn localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarHTTPResponse, executionError\n}", "title": "" } ]
[ { "docid": "ff9862d4843e5915777b7bc10b90795c", "score": "0.77509993", "text": "func (c *Client) Execute(req request.Request) (resp *request.Results, err error) {\n\tresp, err = c.Client.Execute(context.Background(), &req)\n\treturn resp, err\n}", "title": "" }, { "docid": "11d081ca95b03cce0afe05c5049b5693", "score": "0.7291259", "text": "func (c *Client) Execute(ctx context.Context, req *Request) (string, error) {\n\tif req.URL == \"\" {\n\t\treturn \"\", errors.New(\"missing request url\")\n\t}\n\tbody, contentType := req.body()\n\tdigestBody, err := url.QueryUnescape(body)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\thttpReq, err := http.NewRequest(http.MethodPost, req.URL, strings.NewReader(body))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\thttpReq.Header.Add(\"Content-Type\", contentType)\n\thttpReq.Header.Add(\"x-companyid\", c.props.companyID)\n\thttpReq.Header.Add(\"x-datadigest\", Digest(digestBody+c.props.key))\n\n\tresp, err := c.opts.httpClient.Do(httpReq.WithContext(ctx))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer resp.Body.Close()\n\n\tif st := resp.StatusCode; st >= http.StatusBadRequest {\n\t\treturn \"\", fmt.Errorf(\"%d %s\", st, http.StatusText(st))\n\t}\n\tbodyBytes, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(bodyBytes), nil\n}", "title": "" }, { "docid": "80b6576e2d6f2e4c8b3f7096f876c4bd", "score": "0.7130954", "text": "func Execute(req *http.Request) (string, error) {\n\tresp, err := app.Http().Do(req)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif resp == nil {\n\t\treturn \"\", errors.New(\"no response\")\n\t}\n\n\t// close response\n\tdefer func() {\n\t\t_ = resp.Body.Close()\n\t}()\n\n\treturn DefaultAdapter.StringifyResponse(resp)\n}", "title": "" }, { "docid": "ad3c6d728eac5a240fab2ab16669750c", "score": "0.70972586", "text": "func (h *Handler) Execute(req *Request, res *Response) (err error) {\n\tif req.Action == \"\" {\n\t\terr = errors.New(\"A action must be specified\")\n\t\treturn\n\t}\n\n\tif handler, OK := h.Actions[req.Action]; OK {\n\t\terr = handler(req, res)\n\t\treturn\n\t}\n\n\terr = errors.New(\"Action[\" + req.Action + \"] is not found\")\n\treturn\n}", "title": "" }, { "docid": "f4669a0bb977dfd679990ff7f3e901f1", "score": "0.708566", "text": "func (self *Endpoint) Execute(ctx context.Context, requester Requester) (httpStatus int, responseBody []byte) {\n\tspan, ctx := opentracing.StartSpanFromContext(ctx, \"Execute()\")\n\tdefer span.Finish()\n\n\tctx = context.Localize(ctx)\n\n\t// Every invocation of an endpoint creates its own logger instance.\n\tctx = log.WithContext(ctx, self.Config.LogConfig)\n\n\tvar responseMimeType *MimeTypeHandler\n\n\t// Defer recover at this point so that logging and context has been initialized.\n\tdefer func() {\n\t\tif err := errors.Recover(recover()); err != nil {\n\t\t\tlog.Error(ctx, \"panic: %+v\", err)\n\t\t\t// Convert the panic error to an internal server error. Never expose panics directly.\n\t\t\terr = errors.Wrap(err, ErrInternalServerError)\n\t\t\thttpStatus, responseBody = self.processErrorResponse(ctx, requester, responseMimeType, http.StatusInternalServerError, err)\n\t\t}\n\t}()\n\n\trequester.SetResponseHeader(\"X-Request-Id\", requester.RequestId())\n\n\t// Setup log.\n\t{\n\t\tlogSpan, ctx := opentracing.StartSpanFromContext(ctx, \"setup log\")\n\n\t\tlog.Tag(ctx, \"request_id\", requester.RequestId())\n\t\tlog.Tag(ctx, \"method\", string(requester.Method()))\n\t\tlog.Tag(ctx, \"route\", requester.MatchedPath())\n\t\tlog.Tag(ctx, \"path\", string(requester.Path()))\n\t\tlog.Tag(ctx, \"action\", self.Name())\n\n\t\t// Each path parameter is added as a log tag.\n\t\t// Note: It helps if the path parameter name is descriptive.\n\t\tfor param := range self.handlerData.pathParameters {\n\t\t\tif value, ok := requester.PathParam(param); ok {\n\t\t\t\tlog.Tag(ctx, param, value)\n\t\t\t}\n\t\t}\n\n\t\tlogSpan.Finish()\n\t}\n\n\tlog.Trace(ctx, \"executing endpoint\")\n\n\tvar err error\n\n\t// Content-Type and Accept\n\tvar requestMimeType *MimeTypeHandler\n\t{\n\t\tmimeTypeSpan, ctx := opentracing.StartSpanFromContext(ctx, \"setup mime types\")\n\n\t\tvar ok bool\n\n\t\tif self.handlerData.hasRequestBody {\n\t\t\tlog.Trace(ctx, \"processing request body mime type\")\n\n\t\t\tcontentType := requester.ContentType()\n\t\t\tif len(contentType) == 0 {\n\t\t\t\tlog.Debug(ctx, \"header Content-Type not found\")\n\t\t\t\tmimeTypeSpan.Finish()\n\n\t\t\t\treturn self.processErrorResponse(ctx, requester, responseMimeType, http.StatusUnsupportedMediaType, errors.Wrap(ErrInvalidMimeType, errors.New(\"Content-Type MIME type not provided\")))\n\t\t\t}\n\n\t\t\trequestMimeType, ok = self.Config.MimeTypeHandlers.Get(contentType, self.handlerData.requestMimeTypes)\n\t\t\tif !ok {\n\t\t\t\tlog.Debug(ctx, \"mime type handler not available: %s\", contentType)\n\t\t\t\tmimeTypeSpan.Finish()\n\n\t\t\t\treturn self.processErrorResponse(ctx, requester, responseMimeType, http.StatusUnsupportedMediaType, errors.Wrap(ErrInvalidMimeType, errors.New(\"Content-Type MIME type not supported: %s\", contentType)))\n\t\t\t}\n\n\t\t\tlog.Trace(ctx, \"found request mime type handler: %s\", contentType)\n\t\t}\n\n\t\t// Always process the Accept header since an error may be returned even if there is no response body.\n\t\tlog.Trace(ctx, \"processing response body mime type\")\n\n\t\taccept := requester.Accept()\n\t\tif len(accept) == 0 {\n\t\t\tlog.Debug(ctx, \"header Accept not found\")\n\t\t\tmimeTypeSpan.Finish()\n\n\t\t\treturn self.processErrorResponse(ctx, requester, responseMimeType, http.StatusUnsupportedMediaType, errors.Wrap(ErrInvalidMimeType, errors.New(\"Accept MIME type not provided\")))\n\t\t}\n\n\t\tresponseMimeType, ok = self.Config.MimeTypeHandlers.Get(accept, self.handlerData.responseMimeTypes)\n\t\tif !ok {\n\t\t\tlog.Debug(ctx, \"mime type handler not available: %s\", accept)\n\t\t\tmimeTypeSpan.Finish()\n\n\t\t\treturn self.processErrorResponse(ctx, requester, responseMimeType, http.StatusUnsupportedMediaType, errors.Wrap(ErrInvalidMimeType, errors.New(\"Accept MIME type not supported: %s\", accept)))\n\t\t}\n\t\t// All responses after this must be marshalable to the mime type.\n\t\trequester.SetResponseContentType(responseMimeType.MimeType)\n\n\t\tlog.Trace(ctx, \"found response mime type handler: %s\", accept)\n\n\t\tmimeTypeSpan.Finish()\n\t}\n\n\tlog.Trace(ctx, \"allocating handler\")\n\n\tallocSpan, ctx := opentracing.StartSpanFromContext(ctx, \"handler allocation\")\n\n\thandlerAlloc := self.handlerData.allocateHandler()\n\tif err = self.handlerData.setResources(handlerAlloc.handlerValue, self.Config.Resources); err != nil {\n\t\tlog.Debug(ctx, \"failed to set resources\")\n\t\tallocSpan.Finish()\n\n\t\treturn self.processErrorResponse(ctx, requester, responseMimeType, http.StatusInternalServerError, errors.Wrap(err, ErrInternalServerError))\n\t}\n\tif err = self.handlerData.setPathParameters(handlerAlloc.handlerValue, requester); err != nil {\n\t\tlog.Debug(ctx, \"failed to set path parameters\")\n\t\tallocSpan.Finish()\n\n\t\treturn self.processErrorResponse(ctx, requester, responseMimeType, http.StatusBadRequest, errors.Wrap(err, ErrBadRequest))\n\t}\n\tif err = self.handlerData.setQueryParameters(handlerAlloc.handlerValue, requester); err != nil {\n\t\tlog.Debug(ctx, \"failed to set query parameters\")\n\t\tallocSpan.Finish()\n\n\t\treturn self.processErrorResponse(ctx, requester, responseMimeType, http.StatusBadRequest, errors.Wrap(err, ErrBadRequest))\n\t}\n\n\tallocSpan.Finish()\n\n\t// Authentication\n\t{\n\t\tauthSpan, ctx := opentracing.StartSpanFromContext(ctx, \"authorization\")\n\n\t\tif handlerAlloc.auth != nil {\n\t\t\tlog.Trace(ctx, \"processing auth handler\")\n\n\t\t\tif asAuthorizer, ok := handlerAlloc.auth.(Authorizer); ok {\n\t\t\t\thttpStatus, err = asAuthorizer.Authorization(ctx, requester.PeekHeader)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Debug(ctx, \"authorization failed\")\n\t\t\t\t\tauthSpan.Finish()\n\n\t\t\t\t\treturn self.processErrorResponse(ctx, requester, responseMimeType, httpStatus, err)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tlog.Debug(ctx, \"authorization object does not implement Authorizer\")\n\t\t\t\tauthSpan.Finish()\n\n\t\t\t\treturn self.processErrorResponse(ctx, requester, responseMimeType, httpstatus.InternalServerError, errors.Wrap(err, ErrInternalServerError))\n\t\t\t}\n\t\t}\n\n\t\tauthSpan.Finish()\n\t}\n\n\t// Handle Request Body\n\t{\n\t\trequestBodySpan, ctx := opentracing.StartSpanFromContext(ctx, \"process request body\")\n\n\t\tif self.handlerData.hasRequestBody {\n\t\t\tlog.Trace(ctx, \"processing request body\")\n\n\t\t\trequestBodyBytes := requester.RequestBody()\n\n\t\t\terr = self.setHandlerRequestBody(ctx, requestMimeType, handlerAlloc.requestBody, requestBodyBytes)\n\t\t\tif err != nil {\n\t\t\t\tlog.Debug(ctx, \"failed processing request body\")\n\t\t\t\trequestBodySpan.Finish()\n\n\t\t\t\treturn self.processErrorResponse(ctx, requester, responseMimeType, http.StatusBadRequest, err)\n\t\t\t}\n\n\t\t\tif self.Config.RequestValidator != nil && self.handlerData.shouldValidateRequest {\n\t\t\t\tlog.Trace(ctx, \"processing validation handler\")\n\n\t\t\t\tvar validationFailure error\n\t\t\t\thttpStatus, validationFailure = self.Config.RequestValidator.ValidateRequest(ctx, requestBodyBytes)\n\t\t\t\tif validationFailure != nil {\n\t\t\t\t\tlog.Debug(ctx, \"failed request body validation\")\n\n\t\t\t\t\t// Validation failures are not hard errors and should be passed through to the error handler.\n\t\t\t\t\t// The failure is passed through since it is assumed this error contains information to be returned in the response.\n\t\t\t\t\trequestBodySpan.Finish()\n\n\t\t\t\t\treturn self.processErrorResponse(ctx, requester, responseMimeType, httpStatus, validationFailure)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\trequestBodySpan.Finish()\n\t}\n\n\tif !ShouldContinue(ctx) {\n\t\tlog.Debug(ctx, \"request canceled or timed out\")\n\n\t\treturn self.processErrorResponse(ctx, requester, responseMimeType, http.StatusRequestTimeout, ErrRequestTimeout)\n\t}\n\n\t// Run the endpoint handler.\n\tlog.Trace(ctx, \"running endpoint handler\")\n\n\thandlerSpan, ctx := opentracing.StartSpanFromContext(ctx, \"Handle()\")\n\thttpStatus, err = handlerAlloc.handler.Handle(ctx)\n\thandlerSpan.Finish()\n\n\tlog.Trace(ctx, \"completed endpoint handler\")\n\tif err != nil {\n\t\tlog.Debug(ctx, \"handler error\")\n\n\t\treturn self.processErrorResponse(ctx, requester, responseMimeType, httpStatus, err)\n\t}\n\n\tif !ShouldContinue(ctx) {\n\t\tlog.Debug(ctx, \"request canceled or timed out\")\n\n\t\treturn self.processErrorResponse(ctx, requester, responseMimeType, http.StatusRequestTimeout, ErrRequestTimeout)\n\t}\n\n\t// Handle Response Body\n\t{\n\t\tresponseBodySpan, ctx := opentracing.StartSpanFromContext(ctx, \"process response body\")\n\n\t\tresponseBody, err = self.getHandlerResponseBody(ctx, requester, responseMimeType, handlerAlloc.responseBody)\n\t\tif err != nil {\n\t\t\tlog.Debug(ctx, \"failed processing response\")\n\t\t\tresponseBodySpan.Finish()\n\n\t\t\treturn self.processErrorResponse(ctx, requester, responseMimeType, http.StatusInternalServerError, err)\n\t\t}\n\n\t\tif self.Config.ResponseValidator != nil && self.handlerData.shouldValidateResponse {\n\t\t\tlog.Trace(ctx, \"processing response validation handler\")\n\n\t\t\tvar validationFailure error\n\t\t\thttpStatus, validationFailure = self.Config.ResponseValidator.ValidateResponse(ctx, httpStatus, responseBody)\n\t\t\tif validationFailure != nil {\n\t\t\t\tlog.Debug(ctx, \"failed response validation\")\n\t\t\t\t// Validation failures are not hard errors and should be passed through to the error handler.\n\t\t\t\t// The failure is passed through since it is assumed this error contains information to be returned in the response.\n\t\t\t\tresponseBodySpan.Finish()\n\n\t\t\t\treturn self.processErrorResponse(ctx, requester, responseMimeType, httpStatus, validationFailure)\n\t\t\t}\n\t\t}\n\n\t\tresponseBodySpan.Finish()\n\t}\n\n\tlog.Debug(ctx, \"success response: %d %s\", httpStatus, responseBody)\n\n\tif self.handlerData.eTagEnabled {\n\t\tlog.Trace(ctx, \"eTagEnabled, handling etag\")\n\n\t\treturn HandleETag(ctx, requester, self.handlerData.maxAgeSeconds, httpStatus, responseBody)\n\t}\n\n\treturn httpStatus, responseBody\n}", "title": "" }, { "docid": "91e5a1bdcb3354e1e3a2234ee2f077de", "score": "0.68982273", "text": "func (c *Client) Execute(name string) (msg string, err error) {\n\tvar (\n\t\trequest = &core.Request{Name: name}\n\t\tresponse = new(core.Response)\n\t)\n\n\terr = c.client.Call(core.HandlerName, request, response)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tmsg = response.Message\n\treturn\n\n}", "title": "" }, { "docid": "62ea5fcb102a66d77519912c9c46de39", "score": "0.6896732", "text": "func Execute(customerID string, apiKey string, httpTimeout int,\n\treq *http.Request, resource string, body string, resParser responseParser) (Response, error) {\n\tnonce, _ := uuid.NewRandom()\n\tsigData := buildSignature(time.Now(), nonce.String(), req.Method, resource,\n\t\treq.Header.Get(\"Content-Type\"), body)\n\tsig := fmt.Sprintf(\"TSA %s:%s\", customerID, createSignature(apiKey, sigData))\n\n\treq.Header.Add(\"User-Agent\", userAgent)\n\treq.Header.Add(\"X-TS-Auth-Method\", authMethod)\n\treq.Header.Add(\"Authorization\", sig)\n\treq.Header.Add(\"X-TS-Nonce\", sigData.Nonce)\n\treq.Header.Add(\"Date\", sigData.Date)\n\n\tclient := getClient(httpTimeout)\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trespBody, _ := ioutil.ReadAll(resp.Body)\n\n\t// fmt.Println(string(respBody))\n\n\treturn resParser(resp.StatusCode, respBody)\n}", "title": "" }, { "docid": "0336ce115187aa622daccfa28eef7b41", "score": "0.6850316", "text": "func (c *DefaultClient) execute(req *http.Request, responsePtr interface{}) error {\n\tlog.Debug(fmt.Sprintf(\"[Xignite API] request url=%v\", req.URL))\n\n\t// execute the HTTP request\n\tresp, err := c.httpClient.Do(req)\n\tif err != nil {\n\t\treturn errors.Wrap(err, fmt.Sprintf(\"failed to execute HTTP request. request=%v\", req))\n\t}\n\tdefer func() {\n\t\tif cerr := resp.Body.Close(); err == nil {\n\t\t\terr = errors.Wrap(cerr, fmt.Sprintf(\"failed to close HTTP response. resp=%v\", resp))\n\t\t}\n\t}()\n\n\t// read the response body and parse to a json\n\tb, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn errors.Wrap(err, fmt.Sprintf(\"failed to read the response body. resp=%v\", resp))\n\t}\n\t// API response body is too big to output...\n\t// log.Debug(fmt.Sprintf(\"[Xignite API response] url=%v, response= %v\", req.URL, string(b)))\n\n\tif err := json.Unmarshal(b, responsePtr); err != nil {\n\t\treturn errors.Wrap(err, fmt.Sprintf(\"failed to json_parse the response body. resp.Body=%v\", string(b)))\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3423046e7fced44736778f747d9c929b", "score": "0.68480206", "text": "func ExecuteHTTPRequest(\n\tctx context.Context,\n\tclient common.HTTPClient,\n\turl string,\n\tmethod string,\n\theaders map[string]string,\n\tbody io.Reader,\n) (*http.Response, error) {\n\treturn ExecuteHTTPRequestWithQuery(ctx, client, url, nil, method, headers, body)\n}", "title": "" }, { "docid": "3373d91d3eef7f6e3ab389e9a41450c1", "score": "0.68183416", "text": "func (c *BotCommand) Execute(request *Request, response ResponseWriter) {\n\tc.handler(request, response)\n}", "title": "" }, { "docid": "431cbc43c309fb9a1164d16bfdd06767", "score": "0.67533594", "text": "func (tu *Utils) ExecuteRequest(method, endpoint string) <-chan *httptest.ResponseRecorder {\n\treturn tu.ExecuteRequestWithParameters(method, endpoint, nil)\n}", "title": "" }, { "docid": "0d7907ebf117016f9ab011c5f18670cc", "score": "0.67252874", "text": "func (h *HTTP) Execute() error {\n\treq, err := http.NewRequest(h.method, h.url, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tresp, err := h.client.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif resp.StatusCode != h.code {\n\t\treturn fmt.Errorf(\"HTTP/HTTPS health check expected %v, got %v\", h.code, resp.StatusCode)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "cb60c13d0ebf48e0c9c4eb36f515c2e1", "score": "0.6687895", "text": "func (c *Client) execute(req *http.Request) (*Response, error) {\n\tresp, err := c.client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresponse := newResponse(resp)\n\n\terr = CheckResponse(resp)\n\t// even though there was an error, we still return the response\n\t// in case the caller wants to inspect it further\n\treturn response, err\n}", "title": "" }, { "docid": "8c85a4ad74cd0c5e48be87124e40558a", "score": "0.6675558", "text": "func (c *SPClient) Execute(req *http.Request) (*http.Response, error) {\n\n\t// Read stored creds and config\n\tif c.ConfigPath != \"\" && c.AuthCnfg.GetSiteURL() == \"\" {\n\t\tc.AuthCnfg.ReadConfig(c.ConfigPath)\n\t}\n\tif c.AuthCnfg.GetSiteURL() == \"\" {\n\t\tres := &http.Response{\n\t\t\tStatus: \"400 Bad Request\",\n\t\t\tStatusCode: 400,\n\t\t\tRequest: req,\n\t\t}\n\t\treturn res, fmt.Errorf(\"client initialization error, no siteUrl is provided\")\n\t}\n\n\t// Wrap SharePoint authentication\n\terr := c.AuthCnfg.SetAuth(req, c)\n\tif err != nil {\n\t\tres := &http.Response{\n\t\t\tStatus: \"401 Unauthorized\",\n\t\t\tStatusCode: 401,\n\t\t\tRequest: req,\n\t\t}\n\t\treturn res, err\n\t}\n\n\t// Inject X-RequestDigest header when needed\n\tdigestIsRequired := req.Method == \"POST\" &&\n\t\t!strings.Contains(strings.ToLower(req.URL.Path), \"/_api/contextinfo\") &&\n\t\treq.Header.Get(\"X-RequestDigest\") == \"\"\n\n\tif digestIsRequired {\n\t\tdigest, err := GetDigest(c)\n\t\tif err != nil {\n\t\t\tres := &http.Response{\n\t\t\t\tStatus: \"400 Bad Request\",\n\t\t\t\tStatusCode: 400,\n\t\t\t\tRequest: req,\n\t\t\t}\n\t\t\treturn res, err\n\t\t}\n\t\treq.Header.Add(\"X-RequestDigest\", digest)\n\t}\n\n\tresp, err := c.Do(req)\n\n\tif err == nil && !(resp.StatusCode >= 200 && resp.StatusCode < 300) {\n\t\terr = fmt.Errorf(\"%s\", resp.Status)\n\t}\n\n\treturn resp, err\n}", "title": "" }, { "docid": "0a3a959e575c2fb48f0092ee96efbe8b", "score": "0.66272306", "text": "func (c *Client) Execute(req *Request, successData, errorData interface{}) (bool, error) {\n\tresp, err := c.Do(req.Request)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tdefer func() {\n\t\tif err := resp.Body.Close(); err != nil {\n\t\t\t// TODO: what is the best thing to do here?\n\t\t\tlog.Print(err)\n\t\t}\n\t}()\n\n\tif resp.StatusCode >= 400 {\n\t\tif errorData != nil {\n\t\t\tif err := json.NewDecoder(resp.Body).Decode(&errorData); err != nil {\n\t\t\t\treturn false, err\n\t\t\t}\n\t\t\treturn false, nil\n\t\t}\n\t\treturn false, fmt.Errorf(\"%d:%s\", resp.StatusCode, resp.Body)\n\t}\n\n\tif successData != nil {\n\t\tif err := json.NewDecoder(resp.Body).Decode(&successData); err != nil {\n\t\t\treturn true, err\n\t\t}\n\t}\n\n\treturn true, nil\n}", "title": "" }, { "docid": "8f4713ad044b1ea6c090126d9e6806d2", "score": "0.6581271", "text": "func (c *Client) executeRequest(message *internal.RequestWrapper) (*internal.ResponseWrapper, error) {\n\trefId, err := c.sendMessage(message)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn c.waitForResponse(refId)\n}", "title": "" }, { "docid": "2ae07f36828a210fbf3b8e40f2d33d90", "score": "0.6517868", "text": "func (srv *Server) Execute(ctx context.Context, req Request) Response {\n\tquery := req.ValidatedQuery\n\tif query == nil {\n\t\tvar errs []*ResponseError\n\t\tquery, errs = srv.schema.Validate(req.Query)\n\t\tif len(errs) > 0 {\n\t\t\treturn Response{Errors: errs}\n\t\t}\n\t} else if query.schema != srv.schema {\n\t\treturn Response{\n\t\t\tErrors: []*ResponseError{\n\t\t\t\t{Message: \"query validated with a schema different from the server\"},\n\t\t\t},\n\t\t}\n\t}\n\treturn srv.executeValidated(ctx, Request{\n\t\tValidatedQuery: query,\n\t\tOperationName: req.OperationName,\n\t\tVariables: req.Variables,\n\t})\n}", "title": "" }, { "docid": "edf561f4df337428e808979883fee8bb", "score": "0.6478267", "text": "func Execute() {\n\tif err := makeHTTPCmd().Execute(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "79da49e7334abade77107d7dd184c9dd", "score": "0.64479244", "text": "func (sq *Query) execute(path string, output string) (*http.Response, error) {\n\tquery := url.Values{}\n\tfor k, v := range sq.parameter {\n\t\tquery.Add(k, v)\n\t}\n\tquery.Add(\"source\", \"go\")\n\tquery.Add(\"output\", output)\n\tendpoint := \"https://serpapi.com\" + path + \"?\" + query.Encode()\n\tvar client = &http.Client{\n\t\tTimeout: time.Second * 60,\n\t}\n\trsp, err := client.Get(endpoint)\n\treturn rsp, err\n}", "title": "" }, { "docid": "3c46256b1505175dc2b637f872f3bbf1", "score": "0.64280903", "text": "func (p *appsec) Exec(r *http.Request, out interface{}, in ...interface{}) (*http.Response, error) {\n\treturn p.Session.Exec(r, out, in...)\n}", "title": "" }, { "docid": "3fe722be6aea33aeb7082294e3a7be8e", "score": "0.6400326", "text": "func Exec(l hclog.Logger, a Authenticator) int {\n\tr, err := reqFromEnvironment()\n\tif err != nil {\n\t\tl.Debug(\"Error constructing request\", \"error\", err)\n\t\treturn 1\n\t}\n\tif err := r.getSecret(); err != nil {\n\t\tl.Debug(\"Error reading secret\", \"error\", err)\n\t\treturn 2\n\t}\n\n\ta.SetServiceName(r.service)\n\tif err := a.AuthEntity(context.Background(), r.entity, r.secret); err != nil {\n\t\tl.Debug(\"Authentication failed\", \"error\", err)\n\t\treturn 1\n\t}\n\n\treturn 0\n}", "title": "" }, { "docid": "90dfbabea5106a0733d85b71a92e26cc", "score": "0.63662493", "text": "func (c *Client) executeRequest(req *http.Request, respModel interface{}) error {\n\thttpClient := &http.Client{\n\t\tTimeout: c.ReqTimeout,\n\t}\n\tif !c.IsEnvProduction {\n\t\thttpClient.Transport = &http.Transport{\n\t\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: true},\n\t\t}\n\t}\n\n\tif c.LogLevel > 1 {\n\t\tc.Logger.Println(PaymentName, \" Request \", req.Method, \": \", req.URL.Host, req.URL.Path)\n\t}\n\n\tres, err := httpClient.Do(req)\n\tif err != nil {\n\t\tif c.LogLevel > 0 {\n\t\t\tc.Logger.Println(PaymentName, \" Cannot send request: \", err)\n\t\t}\n\t\treturn err\n\t}\n\tdefer res.Body.Close()\n\n\tresBody, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\tif c.LogLevel > 0 {\n\t\t\tc.Logger.Println(PaymentName, \" Cannot read response body: \", err)\n\t\t}\n\t\treturn err\n\t}\n\n\tif c.LogLevel > 2 {\n\t\tc.Logger.Println(PaymentName, \" Response: \", string(resBody))\n\t}\n\n\t// why? total different struct response on recurring\n\tif res.StatusCode == http.StatusUnauthorized && strings.Contains(fmt.Sprintf(\"%s%s\", req.URL.Host, req.URL.Path), \"recurring\") {\n\t\treturn fmt.Errorf(\"%w: HTTP Status %d\\nResp Body: %s\", ErrUnauthorize, res.StatusCode, string(resBody))\n\t}\n\n\tif err = json.Unmarshal(resBody, respModel); err != nil {\n\t\tif c.LogLevel > 0 {\n\t\t\tc.Logger.Println(PaymentName, \" Cannot unmarshal response body: \", err)\n\t\t}\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a9d029adebd5d18210f24db108577bee", "score": "0.6361669", "text": "func (h *networkRequestSelContained) Execute(filePath string) error {\n\tts := testutils.NewTCPServer(nil, defaultStaticPort, func(conn net.Conn) {\n\t\tdefer conn.Close()\n\n\t\t_, _ = conn.Write([]byte(\"Authentication successful\"))\n\t})\n\tdefer ts.Close()\n\tresults, err := testutils.RunNucleiTemplateAndGetResults(filePath, \"\", debug)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn expectResultsCount(results, 1)\n}", "title": "" }, { "docid": "fa251275cb4f029c2bd9c907d54bfedd", "score": "0.63568616", "text": "func (c *Controller) Execute(ctx context.Context) error {\n\treturn nil\n}", "title": "" }, { "docid": "ed0e46fff171db8c1292e0d6468152ba", "score": "0.6345296", "text": "func (t *Test) Execute(host string) {\n\tt.Executed = true\n\n\tt.URL = \"http\" + \"://\" + path.Join(host, t.Path)\n\n\tdata := strings.Join(t.Data, \"\")\n\treq, err := http.NewRequest(t.Method, t.URL, strings.NewReader(data))\n\tif err != nil {\n\t\tt.Err = err\n\t\treturn\n\t}\n\n\tfor k, v := range t.Headers {\n\t\treq.Header.Set(k, v)\n\t}\n\n\tclient := &http.Client{Timeout: time.Second * 2}\n\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tt.Err = err\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\n\tt.StatusCode = resp.StatusCode\n\tt.Status = resp.Status\n}", "title": "" }, { "docid": "04ad5c3ab4e85f6c1bd64e9ebf9e3a9e", "score": "0.6339996", "text": "func executeRequest(ta App, req *http.Request) *httptest.ResponseRecorder {\n\trr := httptest.NewRecorder()\n\tta.server.Router.ServeHTTP(rr, req)\n\treturn rr\n}", "title": "" }, { "docid": "1bc2e35a5d7b7ae99c3e713357c4daf7", "score": "0.6304752", "text": "func (fn *FunctionInvoker) Execute(event interface{}, context events.ExecutionContext) (string, error) {\n\treqBody := CoreRuntimeRequest{\n\t\tEvent: event,\n\t\tContext: context,\n\t\tHandlerName: fn.HandlerName,\n\t\tHandlerPath: fn.HandlerFilePath,\n\t}\n\n\tres, err := fn.streamRequest(reqBody)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tresponseBody, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\tlog.Printf(\"Read response body error, %v\", err)\n\t\treturn \"\", err\n\t}\n\n\t// If an error occured in sub-runtime\n\tif res.StatusCode == http.StatusInternalServerError {\n\t\t// Error message is the response body\n\t\treturn \"\", handlerExecutionError(string(responseBody))\n\t}\n\n\treturn string(responseBody), nil\n}", "title": "" }, { "docid": "fd3cce753e8ff2255d0e7843af8e68f4", "score": "0.6299258", "text": "func (c *Client) Perform(req *http.Request) (*http.Response, error) {\n\tvar (\n\t\tdupReqBody io.Reader\n\t)\n\n\t// Get URL from the Selector\n\t//\n\tu, err := c.getURL()\n\tif err != nil {\n\t\t// TODO(karmi): Log error\n\t\treturn nil, fmt.Errorf(\"cannot get URL: %s\", err)\n\t}\n\n\t// Update request\n\t//\n\tc.setURL(u, req)\n\tc.setUserAgent(req)\n\tc.setAuthorization(u, req)\n\n\t// Duplicate request body for logger\n\t//\n\tif c.logger != nil && c.logger.RequestBodyEnabled() {\n\t\tif req.Body != nil && req.Body != http.NoBody {\n\t\t\tdupReqBody, req.Body, _ = duplicateBody(req.Body)\n\t\t}\n\t}\n\n\t// Set up time measures and execute the request\n\t//\n\tstart := time.Now().UTC()\n\tres, err := c.transport.RoundTrip(req)\n\tdur := time.Since(start)\n\n\t// Log request and response\n\t//\n\tif c.logger != nil {\n\t\tc.logRoundTrip(req, res, dupReqBody, err, start, dur)\n\t}\n\n\t// TODO(karmi): Wrap error\n\treturn res, err\n}", "title": "" }, { "docid": "d3693f28c6d3c262dea8ab46079461d9", "score": "0.62770116", "text": "func (r apiGetAPITestResultRequest) Execute() (SyntheticsAPITestResultFull, *_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 SyntheticsAPITestResultFull\n\t)\n\n\tlocalBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, \"SyntheticsApiService.GetAPITestResult\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/synthetics/tests/{public_id}/results/{result_id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"public_id\"+\"}\", _neturl.PathEscape(parameterToString(r.publicId, \"\")), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"result_id\"+\"}\", _neturl.PathEscape(parameterToString(r.resultId, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\n\t// Set Operation-ID header for telemetry\n\tlocalVarHeaderParams[\"DD-OPERATION-ID\"] = \"GetAPITestResult\"\n\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif auth, ok := auth[\"apiKeyAuth\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif auth.Prefix != \"\" {\n\t\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = auth.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"DD-API-KEY\"] = key\n\t\t\t}\n\t\t}\n\t}\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif auth, ok := auth[\"appKeyAuth\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif auth.Prefix != \"\" {\n\t\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = auth.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"DD-APPLICATION-KEY\"] = key\n\t\t\t}\n\t\t}\n\t}\n\treq, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := r.apiService.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = r.apiService.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": "d7acf8ee151f7c16b330690d679779c4", "score": "0.6255708", "text": "func (r *Request) Run() {\n\tdefer r.wg.Done() // finished processing\n\n\tObject, err := r.action()\n\n\tr.Respond = Object // Stored the result of the action\n\tr.err = err // Stored the error of the action\n}", "title": "" }, { "docid": "244af534cae8d45c685f1937d5274c12", "score": "0.62424964", "text": "func (r apiGetTestRequest) Execute() (SyntheticsTestDetails, *_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 SyntheticsTestDetails\n\t)\n\n\tlocalBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, \"SyntheticsApiService.GetTest\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/synthetics/tests/{public_id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"public_id\"+\"}\", _neturl.PathEscape(parameterToString(r.publicId, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\n\t// Set Operation-ID header for telemetry\n\tlocalVarHeaderParams[\"DD-OPERATION-ID\"] = \"GetTest\"\n\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif auth, ok := auth[\"apiKeyAuth\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif auth.Prefix != \"\" {\n\t\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = auth.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"DD-API-KEY\"] = key\n\t\t\t}\n\t\t}\n\t}\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif auth, ok := auth[\"appKeyAuth\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif auth.Prefix != \"\" {\n\t\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = auth.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"DD-APPLICATION-KEY\"] = key\n\t\t\t}\n\t\t}\n\t}\n\treq, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := r.apiService.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = r.apiService.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": "117131c6dc050fe13d0a0638353deef1", "score": "0.6241237", "text": "func (s *Service) Execute(a *Action) (*Response, error) {\n\tif s.actions == nil {\n\t\ts.actions = make([]*Action, 0)\n\t}\n\tif s.Modules == nil || s.Modules[a.Module] == nil {\n\t\treturn nil, errors.New(\"invalid module provided by action\")\n\t}\n\tm := s.Modules[a.Module]\n\tc, err := m.Command(a.Command)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tres, err := c.Execute(a.Arguments)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ts.actions = append(s.actions, a)\n\treturn &Response{\n\t\tAction: a,\n\t\tValue: res.Value,\n\t}, nil\n}", "title": "" }, { "docid": "d81911a58b72b9d1a92db68f577cf174", "score": "0.6237411", "text": "func (c *Client) Execute(ctx context.Context, req *repb.ExecuteRequest) (res regrpc.Execution_ExecuteClient, err error) {\n\treturn c.execution.Execute(ctx, req, c.RPCOpts()...)\n}", "title": "" }, { "docid": "c45221b0320cb1eb6b66f0ab0a7cf9b6", "score": "0.62308586", "text": "func (cb *CircuitBreaker) Execute(req func() (interface{}, error)) (interface{}, error) {\n\treturn cb.currentState.execute(req)\n}", "title": "" }, { "docid": "b19be6c2e40b784bc0feb6259aecf309", "score": "0.6223373", "text": "func (r FindStructure) Perform(ctx context.Context) (*http.Response, error) {\n\treq, err := r.HttpRequest(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tres, err := r.transport.Perform(req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"an error happened during the FindStructure query execution: %w\", err)\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "ab3af0473a84e7445f9aa85f679a6100", "score": "0.6202319", "text": "func (vtg *VTGate) Execute(ctx context.Context, request *pb.ExecuteRequest) (response *pb.ExecuteResponse, err error) {\n\tdefer vtg.server.HandlePanic(&err)\n\tctx = callerid.NewContext(callinfo.GRPCCallInfo(ctx),\n\t\trequest.CallerId,\n\t\tcallerid.NewImmediateCallerID(\"grpc client\"))\n\treply := new(proto.QueryResult)\n\tbv, err := tproto.Proto3ToBindVariables(request.Query.BindVariables)\n\tif err != nil {\n\t\treturn nil, vterrors.ToGRPCError(err)\n\t}\n\texecuteErr := vtg.server.Execute(ctx, string(request.Query.Sql), bv, request.TabletType, request.Session, request.NotInTransaction, reply)\n\tresponse = &pb.ExecuteResponse{\n\t\tError: vtgate.RPCErrorToVtRPCError(reply.Err),\n\t}\n\tif executeErr != nil {\n\t\treturn nil, vterrors.ToGRPCError(executeErr)\n\t}\n\tresponse.Result = mproto.QueryResultToProto3(reply.Result)\n\tresponse.Session = reply.Session\n\treturn response, nil\n}", "title": "" }, { "docid": "153f9f82093b14abd9ea7661b5f226ec", "score": "0.6194755", "text": "func executeRequest(req *http.Request) *httptest.ResponseRecorder {\n\trr := httptest.NewRecorder()\n\tRouter().ServeHTTP(rr, req)\n\treturn rr\n}", "title": "" }, { "docid": "e544392eb4a3356f24ec8c497e8ab1e2", "score": "0.6189235", "text": "func (s *Server) Execute(req string, res *Response) error {\n\tif req == \"disable\" {\n\t\tif *s.IsRunning {\n\t\t\ts.Stop()\n\t\t\tres.Message = \"disabled\"\n\t\t\treturn nil\n\t\t}\n\t\tres.Message = \"service is already disabled\"\n\t\treturn nil\n\t}\n\tif req == \"enable\" {\n\t\tif !*s.IsRunning {\n\t\t\tgo s.Start()\n\t\t\tres.Message = \"enabled\"\n\t\t\treturn nil\n\t\t}\n\t\tres.Message = \"service already enabled/running\"\n\t\treturn nil\n\t}\n\tif req == \"status\" {\n\t\tif *s.IsRunning {\n\t\t\tres.Message = \"enabled\"\n\t\t\treturn nil\n\t\t}\n\t\tres.Message = \"disabled\"\n\t\treturn nil\n\t}\n\tif req == \"quit\" {\n\t\tgo func() {\n\t\t\ttime.Sleep(100 * time.Millisecond)\n\t\t\ts.Quit()\n\t\t}()\n\t\tres.Message = \"quit\"\n\t\treturn nil\n\t}\n\tres.Message = \"invalid\"\n\treturn errors.New(\"invalid command\")\n}", "title": "" }, { "docid": "bd5f34ddcee85b506c7d34ae5baf0444", "score": "0.6178679", "text": "func (r *RunsServerTransport) Do(req *http.Request) (*http.Response, error) {\n\trawMethod := req.Context().Value(runtime.CtxAPINameKey{})\n\tmethod, ok := rawMethod.(string)\n\tif !ok {\n\t\treturn nil, nonRetriableError{errors.New(\"unable to dispatch request, missing value for CtxAPINameKey\")}\n\t}\n\n\tvar resp *http.Response\n\tvar err error\n\n\tswitch method {\n\tcase \"RunsClient.BeginCancel\":\n\t\tresp, err = r.dispatchBeginCancel(req)\n\tcase \"RunsClient.Get\":\n\t\tresp, err = r.dispatchGet(req)\n\tcase \"RunsClient.GetLogSasURL\":\n\t\tresp, err = r.dispatchGetLogSasURL(req)\n\tcase \"RunsClient.NewListPager\":\n\t\tresp, err = r.dispatchNewListPager(req)\n\tcase \"RunsClient.BeginUpdate\":\n\t\tresp, err = r.dispatchBeginUpdate(req)\n\tdefault:\n\t\terr = fmt.Errorf(\"unhandled API %s\", method)\n\t}\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "5381d46c9549d71852dfc746a4d8640a", "score": "0.61602545", "text": "func (middleware *PrepareUploadRequest) Execute(next http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tf, header, err := r.FormFile(\"file\")\n\t\tif err != nil {\n\t\t\te := kerr.NewErr(\n\t\t\t\tkerr.ErrLvlError,\n\t\t\t\tErrorDomain,\n\t\t\t\tFormFileErrorCode,\n\t\t\t\tfmt.Errorf(\"request form error\"),\n\t\t\t\tnil)\n\n\t\t\t_ = presenter.JsonError(w, e, 402)\n\t\t\treturn\n\t\t}\n\n\t\ttags := r.MultipartForm.Value[\"tags\"]\n\n\t\tcmd := file.UploadFileCommand{\n\t\t\tFile: f,\n\t\t\tHeader: header,\n\t\t\tTags: tags,\n\t\t\tNodeId: middleware.cfg.Id,\n\t\t}\n\n\t\tctx := context.WithValue(r.Context(), \"command\", cmd)\n\t\tnext.ServeHTTP(w, r.WithContext(ctx))\n\t})\n}", "title": "" }, { "docid": "6796d26eb8335199bd07437d1724c8da", "score": "0.6160197", "text": "func (c *Client) exec(timestamp, method, path string, body []byte, qp *QueryParams, v interface{}) error {\n\treq, sig, err := c.createAndSignReq(timestamp, method, path, body, qp)\n\tif err != nil {\n\t\treturn err\n\t}\n\tres, err := c.do(timestamp, sig, req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer res.Body.Close()\n\tif err := json.NewDecoder(res.Body).Decode(&v); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8ee5f3250ef29cceb5c9433c6a13fbe5", "score": "0.6148328", "text": "func (s *CustomMetadataServer) Execute(ctx context.Context, req *thunderpb.ExecuteRequest) (*thunderpb.ExecuteResponse, error) {\n\tmd, _ := metadata.FromOutgoingContext(ctx)\n\tfor k, v := range md {\n\t\tctx = context.WithValue(ctx, k, v[0])\n\t}\n\n\treturn ExecuteRequest(ctx, req, s.schema, s.localExecutor)\n}", "title": "" }, { "docid": "be473dbc34892c4e8222288647c2b61d", "score": "0.61432105", "text": "func (c *Client) Exec(req *Request, v interface{}) (*Response, error) {\n\treturn c.Result(c.Do(req), &v)\n}", "title": "" }, { "docid": "6913d580c86d85e26b897e7b9848d14b", "score": "0.613441", "text": "func (r apiGetBrowserTestRequest) Execute() (SyntheticsTestDetails, *_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 SyntheticsTestDetails\n\t)\n\n\tlocalBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, \"SyntheticsApiService.GetBrowserTest\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/synthetics/tests/browser/{public_id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"public_id\"+\"}\", _neturl.PathEscape(parameterToString(r.publicId, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\n\t// Set Operation-ID header for telemetry\n\tlocalVarHeaderParams[\"DD-OPERATION-ID\"] = \"GetBrowserTest\"\n\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif auth, ok := auth[\"apiKeyAuth\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif auth.Prefix != \"\" {\n\t\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = auth.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"DD-API-KEY\"] = key\n\t\t\t}\n\t\t}\n\t}\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif auth, ok := auth[\"appKeyAuth\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif auth.Prefix != \"\" {\n\t\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = auth.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"DD-APPLICATION-KEY\"] = key\n\t\t\t}\n\t\t}\n\t}\n\treq, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := r.apiService.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = r.apiService.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": "eba8c3429d96852badf76fbe15d99e8e", "score": "0.6106647", "text": "func (apr *APResponse) Execute(w *http.ResponseWriter) error {\n\tvar err error\n\n\t//Pull in our template\n\tt := template.Must(template.New(\"response\").Parse(responseTemplate))\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t//Execute the response template, and write to the response\n\terr = t.Execute(*w, *apr)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t//return nil; no news is good news.\n\treturn nil\n}", "title": "" }, { "docid": "6fa8f0f51d6e01f5a56f3d4c8c443f98", "score": "0.61022604", "text": "func (r *Response) Execute(w http.ResponseWriter) error {\n\tvar err error\n\n\t//Pull in our template\n\tt := template.Must(template.New(\"response\").Parse(responseTemplate))\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t//Execute the response template, and write to the response\n\terr = t.Execute(w, *r)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t//return nil; no news is good news.\n\treturn nil\n}", "title": "" }, { "docid": "497e314af8edc558247a714975a33430", "score": "0.60831755", "text": "func (g *Gateway) Execute(ctx *RequestContext, plans QueryPlanList) (map[string]interface{}, error) {\n\t// the plan we mean to execute\n\tvar plan *QueryPlan\n\n\t// if there is only one plan (one operation) then use it\n\tif len(plans) == 1 {\n\t\tplan = plans[0]\n\t} else {\n\t\t// if we weren't given an operation name then we don't know which one to send\n\t\tif ctx.OperationName == \"\" {\n\t\t\treturn nil, errors.New(\"please provide an operation name\")\n\t\t}\n\n\t\t// find the plan for the right operation\n\t\toperationPlan, err := plans.ForOperation(ctx.OperationName)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// use the one for the operation\n\t\tplan = operationPlan\n\t}\n\n\t// build up the execution context\n\texecutionContext := &ExecutionContext{\n\t\tlogger: g.logger,\n\t\tRequestContext: ctx.Context,\n\t\tRequestMiddlewares: g.requestMiddlewares,\n\t\tPlan: plan,\n\t\tVariables: ctx.Variables,\n\t}\n\n\t// TODO: handle plans of more than one query\n\t// execute the plan and return the results\n\tresult, err := g.executor.Execute(executionContext)\n\tif err != nil {\n\t\tif len(result) == 0 {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn result, err\n\t}\n\n\t// now that we have our response, throw it through the list of middlewarse\n\tfor _, ware := range g.responseMiddlewares {\n\t\tif err := ware(executionContext, result); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// we're done here\n\treturn result, nil\n}", "title": "" }, { "docid": "51bbd9a47a65068f82248fdc2194369d", "score": "0.6080002", "text": "func (c *DefaultLWM2MClient) handleExecuteRequest(req canopus.Request) canopus.Response {\n\tlog.Println(\"Execute Request\")\n\tattrResource := req.GetAttribute(\"rsrc\")\n\tobjectID := req.GetAttributeAsInt(\"obj\")\n\tinstanceID := req.GetAttributeAsInt(\"inst\")\n\n\tvar resourceID = -1\n\n\tif attrResource != \"\" {\n\t\tresourceID = req.GetAttributeAsInt(\"rsrc\")\n\t}\n\n\tt := LWM2MObjectType(objectID)\n\tobj := c.GetObject(t)\n\tenabler := obj.GetEnabler()\n\n\tmsg := canopus.NewMessageOfType(canopus.MessageAcknowledgment, req.GetMessage().GetMessageId(), canopus.NewEmptyPayload()).(*canopus.CoapMessage)\n\tmsg.Token = req.GetMessage().GetToken()\n\n\tif enabler != nil {\n\t\tmodel := obj.GetDefinition()\n\t\tresource := model.GetResource(LWM2MResourceType(resourceID))\n\t\tif resource == nil {\n\t\t\tmsg.Code = canopus.CoapCodeNotFound\n\t\t}\n\n\t\tif !IsExecutableResource(resource) {\n\t\t\tmsg.Code = canopus.CoapCodeMethodNotAllowed\n\t\t} else {\n\t\t\tlwReq := Default(req, OPERATIONTYPE_EXECUTE)\n\t\t\tresponse := enabler.OnExecute(instanceID, resourceID, lwReq)\n\t\t\tmsg.Code = response.GetResponseCode()\n\t\t}\n\t} else {\n\t\tmsg.Code = canopus.CoapCodeNotFound\n\t}\n\treturn canopus.NewResponseWithMessage(msg)\n}", "title": "" }, { "docid": "0fd7435b308e74866e4242582295bf26", "score": "0.60669225", "text": "func Do(command string) {\n\trequest.Method = command\n\trequest.verbose = verbLevel\n\n\tresp, err := request.Perform()\n\tif err != nil {\n\t\tlog.Println(\"error making request:\", err)\n\t\tif resp != nil {\n\t\t\tlog.Println(resp.Body)\n\t\t\tresp.Body.Close()\n\t\t}\n\t\tos.Exit(1)\n\t}\n\n\tresponse.verbose = verbLevel\n\tif err := response.Load(resp, request.Settings); err != nil {\n\t\tlog.Println(\"error displaying result:\", err)\n\t\tos.Exit(1)\n\t}\n\n\tfmt.Println(response)\n\n\tos.Exit(response.ExitCode())\n}", "title": "" }, { "docid": "d2aaa8c57c646e8c31b30dee40cfdb22", "score": "0.6062784", "text": "func (a *Application) Execute() {\n\thost := configuration.Instance.GetServiceHost()\n\twelcome := \"Starting to service \" + host + \" with root path as \" + configuration.Instance.Service.Path\n\tlog.Println(welcome)\n\n\tcrossKeyLength := len(configuration.Instance.Service.Cross.Key)\n\n\tif crossKeyLength > 0 {\n\t\tif crossKeyLength == 32 {\n\t\t\tlog.Println(\"Using Cross-site Request Authentication Key\")\n\t\t\tif len(configuration.Instance.Service.Cross.Trusted) > 0 {\n\t\t\t\tfor _, origin := range configuration.Instance.Service.Cross.Trusted {\n\t\t\t\t\tlog.Println(\"Adding '\" + origin + \"' as trusted origin\")\n\t\t\t\t}\n\t\t\t\ttrusted := csrf.TrustedOrigins(configuration.Instance.Service.Cross.Trusted)\n\t\t\t\tprotection := csrf.Protect([]byte(\"32-byte-long-auth-key\"), trusted)\n\t\t\t\tlog.Fatal(http.ListenAndServe(host, protection(a.Handler.Router)))\n\t\t\t} else {\n\t\t\t\tprotection := csrf.Protect([]byte(\"32-byte-long-auth-key\"), csrf.SameSite(csrf.SameSiteNoneMode))\n\t\t\t\tlog.Fatal(http.ListenAndServe(host, protection(a.Handler.Router)))\n\t\t\t}\n\t\t} else {\n\t\t\tlog.Fatal(\"The Cross-site Request Authentication Key is not 32 byte long\")\n\t\t}\n\t} else {\n\t\tlog.Fatal(http.ListenAndServe(host, a.Handler.Router))\n\t}\n}", "title": "" }, { "docid": "6595adfd184470c08a1a902232dcdbf9", "score": "0.6060503", "text": "func (s *Service) Exec(ctx context.Context, r *criapi.ExecRequest) (*criapi.ExecResponse, error) {\n\tlog.Debugf(\"Exec for %v\", r)\n\treturn s.stockRuntimeClient.Exec(ctx, r)\n}", "title": "" }, { "docid": "793e318d4c9853c83ad29f56f85780e7", "score": "0.60507184", "text": "func (a *Agent) execHandler(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != http.MethodPut && r.Method != http.MethodPost {\n\t\thttp.Error(w, \"Only PUT or POST methods are supported\", http.StatusMethodNotAllowed)\n\t\treturn\n\t}\n\tdefer r.Body.Close()\n\tvar cmd Command\n\tif err := json.NewDecoder(r.Body).Decode(&cmd); err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\tid := a.registerNewCmd()\n\tctx, cancel := context.WithTimeout(context.Background(), 20*time.Second)\n\tgo a.execute(ctx, &cmd, id)\n\tif cmd.Sync {\n\t\tdefer cancel() // Can not cancel if the command is async\n\t\tvar completed bool\n\t\tvar res CommandExec\n\t\tfor !completed {\n\t\t\ta.mu.Lock()\n\t\t\tres = a.executions[id]\n\t\t\tcompleted = res.Status != inprogress\n\t\t\ta.mu.Unlock()\n\t\t\ttime.Sleep(1 * time.Second)\n\t\t}\n\t\tif err := json.NewEncoder(w).Encode(&res); err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\t\treturn\n\t}\n\tres := CommandID{ID: id}\n\tif err := json.NewEncoder(w).Encode(&res); err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\tcancel()\n\t\treturn\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n}", "title": "" }, { "docid": "53d5fd8c23d718939388e59925c9ff94", "score": "0.6047678", "text": "func (r apiUpdateTestRequest) Execute() (SyntheticsTestDetails, *_nethttp.Response, 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 SyntheticsTestDetails\n\t)\n\n\tlocalBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, \"SyntheticsApiService.UpdateTest\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/synthetics/tests/{public_id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"public_id\"+\"}\", _neturl.PathEscape(parameterToString(r.publicId, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif r.body == nil {\n\t\treturn localVarReturnValue, nil, reportError(\"body is required and must be specified\")\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\n\t// Set Operation-ID header for telemetry\n\tlocalVarHeaderParams[\"DD-OPERATION-ID\"] = \"UpdateTest\"\n\n\t// body params\n\tlocalVarPostBody = r.body\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif auth, ok := auth[\"apiKeyAuth\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif auth.Prefix != \"\" {\n\t\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = auth.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"DD-API-KEY\"] = key\n\t\t\t}\n\t\t}\n\t}\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif auth, ok := auth[\"appKeyAuth\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif auth.Prefix != \"\" {\n\t\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = auth.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"DD-APPLICATION-KEY\"] = key\n\t\t\t}\n\t\t}\n\t}\n\treq, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := r.apiService.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = r.apiService.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": "f7bdb6578ccd06edc464e2206c273406", "score": "0.60432184", "text": "func (a ApiCommand) Execute(args []string) error {\n\tlog.Info(\"Opening url store\")\n\tdb, err := api.OpenDB()\n\tif err != nil {\n\t\treturn err\n\t}\n\turlStore, err := api.NewUrlStore(db)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tlog.Info(\"Url store open. Initializing API\")\n\tr := mux.NewRouter()\n\tr.Handle(\"/add\", &add_url.Handler{Store: urlStore}).Methods(http.MethodPut)\n\tr.Handle(\"/favicon.ico\", http.NotFoundHandler())\n\tr.Handle(\"/{hash}\", &redirect.Handler{Store: urlStore}).Methods(http.MethodGet)\n\n\tlog.Info(\"API initialized. Waiting for requests...\")\n\treturn http.ListenAndServe(\":\"+os.Getenv(\"URLSHORTENER_PORT\"), r)\n}", "title": "" }, { "docid": "8516e483e97b50759d3ddfe762c9f86c", "score": "0.6025771", "text": "func (r *loadDataInteractor) Execute(ctx context.Context, req InportRequest) (*InportResponse, error) {\n\n\tres := &InportResponse{}\n\n\t// use transaction here\n\terr := service.ExecuteTransaction(ctx, r.outport, func(dbCtx context.Context) error {\n\n\t\t// read data from file\n\t\terr := r.outport.ReadJSONData(ctx, service.ReadJSONDataServiceRequest{\n\t\t\tFilename: req.Filename,\n\t\t\tReadDataPerline: func(data entity.RawData) error {\n\t\t\t\terr := r.outport.SaveData(ctx, &data)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "2456faf26a302929e7e9da3a0fea3b9c", "score": "0.60060835", "text": "func (b *sendFileBuilder) Execute() (*PNSendFileResponse, StatusResponse, error) {\n\trawJSON, status, err := executeRequest(b.opts)\n\tif err != nil {\n\t\treturn emptySendFileResponse, status, err\n\t}\n\n\treturn newPNSendFileResponse(rawJSON, b.opts, status)\n}", "title": "" }, { "docid": "812004ed31b4a30d9247330cbf84daf2", "score": "0.6000477", "text": "func (g *GRPC) Execute() (err error) {\n\n\tg.Response = GRPCResponse{}\n\n\topts := []grpc.DialOption{}\n\tlog.Debug(\"enableTLS: \", g.Request.EnableTLS)\n\tif strings.Compare(g.Request.EnableTLS, \"true\") == 0 {\n\t\tlog.Debug(\"ClientCert: \", g.Request.ClientCert)\n\t\tcreds, err := credentials.NewClientTLSFromFile(g.Request.ClientCert, \"\")\n\t\tif err != nil {\n\t\t\tlog.Error(err)\n\t\t}\n\n\t\topts = []grpc.DialOption{grpc.WithTransportCredentials(creds)}\n\n\t} else {\n\t\topts = []grpc.DialOption{grpc.WithInsecure()}\n\t}\n\n\tconn, err := getConnection(g.Request.HostURL, opts)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer releaseConnection(g.Request.HostURL)\n\n\tlog.Debug(\"operating mode: \", g.Request.OperatingMode)\n\n\tswitch g.Request.OperatingMode {\n\tcase \"grpc-to-grpc\":\n\t\treturn gRPCTogRPCHandler(g, conn)\n\tcase \"rest-to-grpc\":\n\t\treturn restTogRPCHandler(g, conn)\n\t}\n\n\tlog.Error(\"Invalid use of service , OperatingMode not recognised\")\n\treturn errors.New(\"Invalid use of service , OperatingMode not recognised\")\n}", "title": "" }, { "docid": "9eaa606e1325539876f482fe5969ea9d", "score": "0.59976596", "text": "func (r apiGetAPITestLatestResultsRequest) Execute() (SyntheticsGetAPITestLatestResultsResponse, *_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 SyntheticsGetAPITestLatestResultsResponse\n\t)\n\n\tlocalBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, \"SyntheticsApiService.GetAPITestLatestResults\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/synthetics/tests/{public_id}/results\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"public_id\"+\"}\", _neturl.PathEscape(parameterToString(r.publicId, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif r.fromTs != nil {\n\t\tlocalVarQueryParams.Add(\"from_ts\", parameterToString(*r.fromTs, \"\"))\n\t}\n\tif r.toTs != nil {\n\t\tlocalVarQueryParams.Add(\"to_ts\", parameterToString(*r.toTs, \"\"))\n\t}\n\tif r.probeDc != nil {\n\t\tt := *r.probeDc\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"probe_dc\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"probe_dc\", parameterToString(t, \"multi\"))\n\t\t}\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\n\t// Set Operation-ID header for telemetry\n\tlocalVarHeaderParams[\"DD-OPERATION-ID\"] = \"GetAPITestLatestResults\"\n\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif auth, ok := auth[\"apiKeyAuth\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif auth.Prefix != \"\" {\n\t\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = auth.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"DD-API-KEY\"] = key\n\t\t\t}\n\t\t}\n\t}\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif auth, ok := auth[\"appKeyAuth\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif auth.Prefix != \"\" {\n\t\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = auth.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"DD-APPLICATION-KEY\"] = key\n\t\t\t}\n\t\t}\n\t}\n\treq, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := r.apiService.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = r.apiService.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": "db1fc747cdb05efc793d98943ca20e63", "score": "0.5983998", "text": "func (p *Pool) Execute(query string, bindings, rebindings map[string]string) (resp []Response, err error) {\n\treturn p.ExecuteCtx(context.Background(), query, bindings, rebindings)\n}", "title": "" }, { "docid": "f882463706ba7d6e844c6fd41f20b015", "score": "0.5980442", "text": "func (r apiScanOriginRequest) Execute() (CdnScanOriginResponse, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPost\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue CdnScanOriginResponse\n\t)\n\n\tlocalBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, \"InfrastructureApiService.ScanOrigin\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/cdn/v1/origins/scan\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\t\n\tif r.cdnScanOriginRequest == nil {\n\t\treturn localVarReturnValue, nil, reportError(\"cdnScanOriginRequest is required and must be specified\")\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = r.cdnScanOriginRequest\n\treq, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := r.apiService.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v ApiStatus\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 500 {\n\t\t\tvar v ApiStatus\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\t\tvar v ApiStatus\n\t\t\terr = r.apiService.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 = r.apiService.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": "843a27920b010307d168246914ecf10f", "score": "0.59803593", "text": "func (r apiGetBrowserTestLatestResultsRequest) Execute() (SyntheticsGetBrowserTestLatestResultsResponse, *_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 SyntheticsGetBrowserTestLatestResultsResponse\n\t)\n\n\tlocalBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, \"SyntheticsApiService.GetBrowserTestLatestResults\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/synthetics/tests/browser/{public_id}/results\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"public_id\"+\"}\", _neturl.PathEscape(parameterToString(r.publicId, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif r.fromTs != nil {\n\t\tlocalVarQueryParams.Add(\"from_ts\", parameterToString(*r.fromTs, \"\"))\n\t}\n\tif r.toTs != nil {\n\t\tlocalVarQueryParams.Add(\"to_ts\", parameterToString(*r.toTs, \"\"))\n\t}\n\tif r.probeDc != nil {\n\t\tt := *r.probeDc\n\t\tif reflect.TypeOf(t).Kind() == reflect.Slice {\n\t\t\ts := reflect.ValueOf(t)\n\t\t\tfor i := 0; i < s.Len(); i++ {\n\t\t\t\tlocalVarQueryParams.Add(\"probe_dc\", parameterToString(s.Index(i), \"multi\"))\n\t\t\t}\n\t\t} else {\n\t\t\tlocalVarQueryParams.Add(\"probe_dc\", parameterToString(t, \"multi\"))\n\t\t}\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\n\t// Set Operation-ID header for telemetry\n\tlocalVarHeaderParams[\"DD-OPERATION-ID\"] = \"GetBrowserTestLatestResults\"\n\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif auth, ok := auth[\"apiKeyAuth\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif auth.Prefix != \"\" {\n\t\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = auth.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"DD-API-KEY\"] = key\n\t\t\t}\n\t\t}\n\t}\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif auth, ok := auth[\"appKeyAuth\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif auth.Prefix != \"\" {\n\t\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = auth.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"DD-APPLICATION-KEY\"] = key\n\t\t\t}\n\t\t}\n\t}\n\treq, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := r.apiService.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = r.apiService.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": "b467f37e01ef4926412fd36a246f8214", "score": "0.59795845", "text": "func (h *TargetHandler) Execute(ctxt context.Context, commandType cdp.MethodType, params easyjson.Marshaler, res easyjson.Unmarshaler) error {\n\tvar paramsBuf easyjson.RawMessage\n\tif params == nil {\n\t\tparamsBuf = emptyObj\n\t} else {\n\t\tvar err error\n\t\tparamsBuf, err = easyjson.Marshal(params)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tid := h.next()\n\n\t// save channel\n\tch := make(chan *cdp.Message, 1)\n\th.resrw.Lock()\n\th.res[id] = ch\n\th.resrw.Unlock()\n\n\t// queue message\n\th.qcmd <- &cdp.Message{\n\t\tID: id,\n\t\tMethod: commandType,\n\t\tParams: paramsBuf,\n\t}\n\n\terrch := make(chan error, 1)\n\tgo func() {\n\t\tdefer close(errch)\n\n\t\tselect {\n\t\tcase msg := <-ch:\n\t\t\tswitch {\n\t\t\tcase msg == nil:\n\t\t\t\terrch <- cdp.ErrChannelClosed\n\n\t\t\tcase msg.Error != nil:\n\t\t\t\terrch <- msg.Error\n\n\t\t\tcase res != nil:\n\t\t\t\terrch <- easyjson.Unmarshal(msg.Result, res)\n\t\t\t}\n\n\t\tcase <-ctxt.Done():\n\t\t\terrch <- ctxt.Err()\n\t\t}\n\n\t\th.resrw.Lock()\n\t\tdefer h.resrw.Unlock()\n\n\t\tdelete(h.res, id)\n\t}()\n\n\treturn <-errch\n}", "title": "" }, { "docid": "ecc85f88c9bad0630972d53aed6dd3e0", "score": "0.59674525", "text": "func (r apiGetBrowserTestResultRequest) Execute() (SyntheticsBrowserTestResultFull, *_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 SyntheticsBrowserTestResultFull\n\t)\n\n\tlocalBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, \"SyntheticsApiService.GetBrowserTestResult\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/synthetics/tests/browser/{public_id}/results/{result_id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"public_id\"+\"}\", _neturl.PathEscape(parameterToString(r.publicId, \"\")), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"result_id\"+\"}\", _neturl.PathEscape(parameterToString(r.resultId, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\n\t// Set Operation-ID header for telemetry\n\tlocalVarHeaderParams[\"DD-OPERATION-ID\"] = \"GetBrowserTestResult\"\n\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif auth, ok := auth[\"apiKeyAuth\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif auth.Prefix != \"\" {\n\t\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = auth.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"DD-API-KEY\"] = key\n\t\t\t}\n\t\t}\n\t}\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif auth, ok := auth[\"appKeyAuth\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif auth.Prefix != \"\" {\n\t\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = auth.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"DD-APPLICATION-KEY\"] = key\n\t\t\t}\n\t\t}\n\t}\n\treq, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := r.apiService.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = r.apiService.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": "4dd0683819de325966070a5356648343", "score": "0.596348", "text": "func (device *Device) Execute(cmds ...string) (*routeros.Reply, error) {\n\treturn device.Conn.RunArgs(cmds)\n}", "title": "" }, { "docid": "6eb79f1b9d3e111f8e7d8386d3806b80", "score": "0.59630144", "text": "func (b *grantBuilder) Execute() (*GrantResponse, StatusResponse, error) {\n\trawJSON, status, err := executeRequest(b.opts)\n\tif err != nil {\n\t\treturn emptyGrantResponse, status, err\n\t}\n\n\treturn newGrantResponse(rawJSON, status)\n}", "title": "" }, { "docid": "85456215df2b44b9eaecb88bc6b812c2", "score": "0.59455955", "text": "func performRequest(ctx context.Context, httpClient *http.Client, config *ClientConfig, method string, path string, queryParams interface{}, body interface{}, successV, failureV interface{}) (*http.Response, error) {\n\t// Marshal payload\n\tpayload, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// Generate Request Url with query params\n\tqueryValues, err := goquery.Values(queryParams)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tqueryString := queryValues.Encode()\n\turl := fmt.Sprintf(\"%v/api/v2/%v\", config.Endpoint, path)\n\tif queryString != \"\" {\n\t\turl = strings.Join([]string{url, queryString}, \"?\")\n\t}\n\t// Create Request\n\treq, err := http.NewRequest(method, url, bytes.NewBuffer(payload))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq = req.WithContext(ctx)\n\n\t// Set Headers\n\treq.Header.Add(\"Accept\", \"application/json; charset=utf-8\")\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"User-Agent\", userAgent)\n\treq.SetBasicAuth(config.UserName, config.Password)\n\t// Perform request\n\tresponse, err := httpClient.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// when err is nil, resp contains a non-nil resp.Body which must be closed\n\tdefer response.Body.Close()\n\tif successV != nil || failureV != nil {\n\t\terr = decodeResponseJSON(response, successV, failureV)\n\t}\n\treturn response, err\n}", "title": "" }, { "docid": "671d9fa9d3a8d8648da6b14aa481363f", "score": "0.5931284", "text": "func (c *Client) execute(call func() (*http.Response, error), target interface{}) (interface{}, error) {\n\tresp, err := call()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif resp.StatusCode > 299 {\n\t\tbody, err := ioutil.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, fmt.Errorf(\"Server responded with status %v body %v\", resp.Status, string(body))\n\t}\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = json.Unmarshal(body, target)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn target, nil\n}", "title": "" }, { "docid": "a7d31c5d8e242e3570c2d4339e7d07d8", "score": "0.5920427", "text": "func (r apiEnableRequest) Execute() (*_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPost\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\t\n\t)\n\n\tlocalBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, \"MonitorsApiService.Enable\")\n\tif err != nil {\n\t\treturn nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/monitoring/v2/stacks/{stack_id}/enable\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"stack_id\"+\"}\", _neturl.QueryEscape(parameterToString(r.stackId, \"\")) , -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\t\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\treq, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := r.apiService.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v StackpathapiStatus\n\t\t\terr = r.apiService.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 localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 500 {\n\t\t\tvar v StackpathapiStatus\n\t\t\terr = r.apiService.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 localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarHTTPResponse, newErr\n\t\t}\n\t\t\tvar v StackpathapiStatus\n\t\t\terr = r.apiService.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 localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\treturn localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "01c6ffc4dd5df18cb0ae0db65fc40e1c", "score": "0.58980083", "text": "func executeRequest(client *http.Client, url *url.URL, headers Headers) (*http.Response, error) {\n\tmirrors := FlibustaMirrors\n\tenvHost := getEnvHost()\n\tif envHost != \"\" {\n\t\tmirrors = append(mirrors, envHost)\n\t}\n\tresult := make(chan *ResponseResult)\n\tfor _, host := range mirrors {\n\t\treq, err := buildRequest(host, url, headers)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tgo func(r *http.Request, h string, out chan *ResponseResult) {\n\t\t\tresp, err := client.Do(r)\n\t\t\tout <- &ResponseResult{\n\t\t\t\tHost: h,\n\t\t\t\tResponse: resp,\n\t\t\t\tError: err,\n\t\t\t}\n\t\t}(req, host, result)\n\t}\n\tfor i := 0; i < len(mirrors); i++ {\n\t\trr := <-result\n\t\tif rr.Error != nil {\n\t\t\tlog.Println(rr.Error)\n\t\t} else if rr.Response.StatusCode != 200 {\n\t\t\t// TODO: should handle this?\n\t\t\tbodyBytes, _ := io.ReadAll(rr.Response.Body)\n\t\t\tbody := string(bodyBytes)\n\t\t\tlog.Println(body)\n\t\t\tdefer rr.Response.Body.Close()\n\t\t} else {\n\t\t\treturn rr.Response, nil\n\t\t}\n\t}\n\treturn nil, fmt.Errorf(\"All request attempts failed. Maybe you want to use some proxy? For example:\\n\\n\\t%s\", TorproxySuggest)\n}", "title": "" }, { "docid": "73e4ffd962fa9ede67c50d96cb52023d", "score": "0.58940613", "text": "func Execute(query string, schema graphql.Schema) *graphql.Result {\n\n\tresult := graphql.Do(graphql.Params{\n\t\tSchema: schema,\n\t\tRequestString: query,\n\t})\n\t//check errors associated with result\n\tif len(result.Errors)>0 {\n\t\tfmt.Printf(\"Unexpected errors inside Execute: %v\", result.Errors)\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "444e684a06b8e4c7018c00db2a48233b", "score": "0.58924377", "text": "func Execute() {\n\thub := internal.NewHub()\n\tgo hub.Run()\n\thttp.HandleFunc(\"/test\", func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Write([]byte(\"OK\"))\n\t})\n\n\thttp.HandleFunc(\"/\", serveHome)\n\thttp.HandleFunc(\"/ws\", func(w http.ResponseWriter, r *http.Request) {\n\t\tlog.Println(\">> New Connection from: \", GetIP(r))\n\t\tinternal.ServeWs(hub, w, r)\n\t})\n\tadd := fmt.Sprintf(\"%s:%s\", cfg.Cfg.Server.IP, cfg.Cfg.Server.Port)\n\tfmt.Println(\"Listening at: \", add)\n\terr := http.ListenAndServe(\":8000\", nil)\n\tif err != nil {\n\t\tlog.Fatal(\"ListenAndServe: \", err)\n\t}\n}", "title": "" }, { "docid": "8f6edbbcd8a56a1c79c57d1f90fe5ae9", "score": "0.58923906", "text": "func (c *Client) Execute(ctx context.Context, query string, opts ...grpc.CallOption) (*flight.FlightInfo, error) {\n\tcmd := pb.CommandStatementQuery{Query: query}\n\treturn flightInfoForCommand(ctx, c, &cmd, opts...)\n}", "title": "" }, { "docid": "5d263ff97617f47ebb73217e2967a8b8", "score": "0.5886807", "text": "func (a *Action) Run(ctx context.Context, input map[string]interface{}) (map[string]interface{}, error) {\n\tcode, mData, err := core.Execute(a.id, input, a.microgateway, a.IOMetadata(), a.logger)\n\toutput := make(map[string]interface{}, 8)\n\toutput[\"code\"] = code\n\toutput[\"data\"] = mData\n\n\treturn output, err\n}", "title": "" }, { "docid": "8e1dca09116d2e4840961e1da9cd01ae", "score": "0.5882895", "text": "func (r apiGetMetricsRequest) Execute() (CdnGetMetricsResponse, *_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 CdnGetMetricsResponse\n\t)\n\n\tlocalBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, \"MetricsApiService.GetMetrics\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/cdn/v1/stacks/{stack_id}/metrics\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"stack_id\"+\"}\", _neturl.QueryEscape(parameterToString(r.stackId, \"\")) , -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\t\n\t\t\t\t\t\t\t\t\t\n\tif r.startDate != nil {\n\t\tlocalVarQueryParams.Add(\"start_date\", parameterToString(*r.startDate, \"\"))\n\t}\n\tif r.endDate != nil {\n\t\tlocalVarQueryParams.Add(\"end_date\", parameterToString(*r.endDate, \"\"))\n\t}\n\tif r.granularity != nil {\n\t\tlocalVarQueryParams.Add(\"granularity\", parameterToString(*r.granularity, \"\"))\n\t}\n\tif r.platforms != nil {\n\t\tlocalVarQueryParams.Add(\"platforms\", parameterToString(*r.platforms, \"\"))\n\t}\n\tif r.pops != nil {\n\t\tlocalVarQueryParams.Add(\"pops\", parameterToString(*r.pops, \"\"))\n\t}\n\tif r.billingRegions != nil {\n\t\tlocalVarQueryParams.Add(\"billing_regions\", parameterToString(*r.billingRegions, \"\"))\n\t}\n\tif r.sites != nil {\n\t\tlocalVarQueryParams.Add(\"sites\", parameterToString(*r.sites, \"\"))\n\t}\n\tif r.groupBy != nil {\n\t\tlocalVarQueryParams.Add(\"group_by\", parameterToString(*r.groupBy, \"\"))\n\t}\n\tif r.siteTypeFilter != nil {\n\t\tlocalVarQueryParams.Add(\"site_type_filter\", parameterToString(*r.siteTypeFilter, \"\"))\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\treq, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := r.apiService.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v ApiStatus\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 500 {\n\t\t\tvar v ApiStatus\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\t\tvar v ApiStatus\n\t\t\terr = r.apiService.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 = r.apiService.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": "d653aa8558b7d725ecdedd560b24b421", "score": "0.58724004", "text": "func (c *Client) Perform(req *http.Request) (*http.Response, error) {\n\treturn c.Transport.Perform(req)\n}", "title": "" }, { "docid": "be7b1d9e823238b7013cabdde2ec9ea5", "score": "0.5871379", "text": "func (p *Peer) Execute(req *installpb.ExecuteRequest, stream installpb.Agent_ExecuteServer) (err error) {\n\tp.WithField(\"req\", req).Info(\"Execute.\")\n\tif req.HasSpecificPhase() {\n\t\t// Execute the operation step with a new dispatcher\n\t\treturn p.executeConcurrentStep(req, stream)\n\t}\n\tp.submit(req)\n\tfor {\n\t\tselect {\n\t\tcase event := <-p.dispatcher.Chan():\n\t\t\terr := stream.Send(event)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\tcase req := <-p.closeC:\n\t\t\terr := stream.Send(req.resp)\n\t\t\tclose(req.doneC)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\tcase result := <-p.execDoneC:\n\t\t\tif result.Error != nil {\n\t\t\t\t// Phase finished with an error.\n\t\t\t\t// See https://github.com/grpc/grpc-go/blob/v1.22.0/codes/codes.go#L78\n\t\t\t\treturn status.Error(codes.Aborted, install.FormatAbortError(result.Error))\n\t\t\t}\n\t\t\tif result.CompletionEvent != nil {\n\t\t\t\terr := stream.Send(result.CompletionEvent.AsProgressResponse())\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\treturn nil\n\t\t}\n\t}\n}", "title": "" }, { "docid": "78fccbe7004b8f460915f60d95a371e1", "score": "0.586678", "text": "func (r apiCreateTestRequest) Execute() (SyntheticsTestDetails, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPost\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue SyntheticsTestDetails\n\t)\n\n\tlocalBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, \"SyntheticsApiService.CreateTest\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/synthetics/tests\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif r.body == nil {\n\t\treturn localVarReturnValue, nil, reportError(\"body is required and must be specified\")\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\n\t// Set Operation-ID header for telemetry\n\tlocalVarHeaderParams[\"DD-OPERATION-ID\"] = \"CreateTest\"\n\n\t// body params\n\tlocalVarPostBody = r.body\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif auth, ok := auth[\"apiKeyAuth\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif auth.Prefix != \"\" {\n\t\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = auth.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"DD-API-KEY\"] = key\n\t\t\t}\n\t\t}\n\t}\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif auth, ok := auth[\"appKeyAuth\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif auth.Prefix != \"\" {\n\t\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = auth.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"DD-APPLICATION-KEY\"] = key\n\t\t\t}\n\t\t}\n\t}\n\treq, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := r.apiService.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 402 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = r.apiService.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": "f06b698ae62cd4fdcfdf8bfee737dd87", "score": "0.5858034", "text": "func (r apiListLocationsRequest) Execute() (SyntheticsLocations, *_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 SyntheticsLocations\n\t)\n\n\tlocalBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, \"SyntheticsApiService.ListLocations\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/synthetics/locations\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\n\t// Set Operation-ID header for telemetry\n\tlocalVarHeaderParams[\"DD-OPERATION-ID\"] = \"ListLocations\"\n\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif auth, ok := auth[\"apiKeyAuth\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif auth.Prefix != \"\" {\n\t\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = auth.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"DD-API-KEY\"] = key\n\t\t\t}\n\t\t}\n\t}\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif auth, ok := auth[\"appKeyAuth\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif auth.Prefix != \"\" {\n\t\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = auth.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"DD-APPLICATION-KEY\"] = key\n\t\t\t}\n\t\t}\n\t}\n\treq, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := r.apiService.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = r.apiService.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": "30d6c2e73f985b8fa8922c4d61639213", "score": "0.5847311", "text": "func (sq *SqlQuery) Execute(context Context, query *proto.Query, reply *mproto.QueryResult) (err error) {\n\tlogStats := newSqlQueryStats(\"Execute\", context, sq.config.SensitiveMode)\n\tallowShutdown := (query.TransactionId != 0)\n\tif err = sq.startRequest(query.SessionId, allowShutdown); err != nil {\n\t\treturn err\n\t}\n\tdefer sq.endRequest()\n\tdefer handleExecError(query, &err, logStats)\n\n\t*reply = *sq.qe.Execute(logStats, query)\n\treturn nil\n}", "title": "" }, { "docid": "608bd6727dfb9e814f2e6436f191ffa7", "score": "0.5846542", "text": "func (r apiAuthenticateUserRequest) Execute() (models.UserLoginResponse, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPost\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue models.UserLoginResponse\n\t)\n\n\tlocalBasePath, err := r.client.cfg.ServerURLWithContext(r.ctx, \"LoginApiService.AuthenticateUser\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/1/login/auth\"\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{\"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 r.customAllowedOriginHeader1 != nil {\n\t\tlocalVarHeaderParams[\"Custom-Allowed-Origin-Header-1\"] = parameterToString(*r.customAllowedOriginHeader1, \"\")\n\t}\n\t// body params\n\tlocalVarPostBody = r.inlineObject6\n\treq, err := r.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := r.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 200 {\n\t\t\tvar v models.UserLoginResponse\n\t\t\terr = r.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 {\n\t\t\tvar v models.Status\n\t\t\terr = r.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v models.Status\n\t\t\terr = r.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = r.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": "10052781bf065dcb6466412cffc1f54d", "score": "0.5845631", "text": "func (r apiGetClosestPopsRequest) Execute() (CdnGetClosestPopsResponse, *_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 CdnGetClosestPopsResponse\n\t)\n\n\tlocalBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, \"InfrastructureApiService.GetClosestPops\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/cdn/v1/pops/closest\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\t\n\tif r.url != nil {\n\t\tlocalVarQueryParams.Add(\"url\", parameterToString(*r.url, \"\"))\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\treq, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := r.apiService.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v ApiStatus\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 500 {\n\t\t\tvar v ApiStatus\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\t\tvar v ApiStatus\n\t\t\terr = r.apiService.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 = r.apiService.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": "3b2918ff850488e0880dbe492fbb6905", "score": "0.58446985", "text": "func (c *Client) do(method string, urlpath string, query url.Values, body io.Reader, v interface{}) error {\n\t// add application id if defined:\n\tnewQuery := url.Values{}\n\tif c.appID != \"\" {\n\t\tif query == nil {\n\t\t\tquery = newQuery\n\t\t}\n\t\tquery.Set(\"app_id\", c.appID)\n\t}\n\n\tresp, err := c.raw(method, urlpath, query, body)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error making request: %s\", err)\n\t}\n\tdecode := json.NewDecoder(resp.Body)\n\tif err = decode.Decode(&v); err != nil {\n\t\treturn fmt.Errorf(\"cannot decode json: %s\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "15168a3f97f3e361f748dc66390cc637", "score": "0.58373076", "text": "func ExecutePostRequest() http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\n\t\t// get the data in the request's body and creates a []byte called body\n\t\tbody, err := ioutil.ReadAll(r.Body)\n\t\tif err != nil {\n\t\t\tfmt.Println(w, \"Error reading request body\", err)\n\t\t\thttp.Error(w, \"Error reading request body\", http.StatusBadRequest)\n\t\t}\n\n\t\tvar t = &server.BodyRequest{}\n\t\terr = json.Unmarshal(body, t)\n\t\tif err != nil {\n\t\t\tfmt.Println(w, \"Error Unmarshall bodyRequest\", err)\n\t\t\thttp.Error(w, \"Error Unmarshall bodyRequest\", http.StatusInternalServerError)\n\t\t}\n\n\t\t// get domain field of request\n\t\tvar domainToAnalyze = t.DomainRequestParam\n\t\tdomainQuery, err := utils.ValidateQuery(domainToAnalyze)\n\n\t\t// handle if there is an error in domain typed by user\n\t\tif err != nil {\n\n\t\t\t// if the domain is not valid, stop and send StatusBadRequest\n\t\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\n\t\t// Analyze domain and creates a new Domain struct\n\t\tnewDomain, err := server.AnalyzeDomain(domainQuery)\n\n\t\t// handle if there is an error in domain typed by user\n\t\tif err != nil {\n\t\t\t// if the domain is not valid, stop and send StatusBadRequest\n\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\tnewDomain, err = database.CheckDomain(newDomain)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\n\t\t}\n\n\t\tfmt.Println(\"\")\n\t\tfmt.Println(\"serversDescription >>>>\")\n\t\tfmt.Println(newDomain)\n\t\tjson.NewEncoder(w).Encode(newDomain)\n\t\tw.WriteHeader(http.StatusOK)\n\n\t}\n}", "title": "" }, { "docid": "dcec6c83e7130f7db115bca4672a64d1", "score": "0.5834628", "text": "func (s *EtcdServer) Do(ctx context.Context, r pb.Request) (Response, error) {\n\t// edit by puyangsky\n\tprintAccesssVector(r.Path, r.Method, getSubject(2, 30))\n\tr.ID = s.reqIDGen.Next()\n\tif r.Method == \"GET\" && r.Quorum {\n\t\tr.Method = \"QGET\"\n\t}\n\tv2api := (v2API)(&v2apiStore{s})\n\tswitch r.Method {\n\tcase \"POST\":\n\t\treturn v2api.Post(ctx, &r)\n\tcase \"PUT\":\n\t\treturn v2api.Put(ctx, &r)\n\tcase \"DELETE\":\n\t\treturn v2api.Delete(ctx, &r)\n\tcase \"QGET\":\n\t\treturn v2api.QGet(ctx, &r)\n\tcase \"GET\":\n\t\treturn v2api.Get(ctx, &r)\n\tcase \"HEAD\":\n\t\treturn v2api.Head(ctx, &r)\n\t}\n\treturn Response{}, ErrUnknownMethod\n}", "title": "" }, { "docid": "2dd5b1605c34a78c238721b55b262b6f", "score": "0.5819812", "text": "func (base *Base) Execute(action interface{}) {\n\tcontentType := render.Negotiate(base.Ctx, base.R)\n\n\tswitch contentType {\n\tcase render.MimeHal, render.MimeJSON:\n\t\taction, ok := action.(JSON)\n\n\t\tif !ok {\n\t\t\tgoto NotAcceptable\n\t\t}\n\n\t\taction.JSON()\n\n\t\tif base.Err != nil {\n\t\t\tproblem.Render(base.Ctx, base.W, base.Err)\n\t\t\treturn\n\t\t}\n\n\tcase render.MimeEventStream:\n\t\taction, ok := action.(SSE)\n\t\tif !ok {\n\t\t\tgoto NotAcceptable\n\t\t}\n\n\t\tstream := sse.NewStream(base.Ctx, base.W, base.R)\n\n\t\tfor {\n\t\t\taction.SSE(stream)\n\n\t\t\tif base.Err != nil {\n\t\t\t\t// in the case that we haven't yet sent an event, is also means we\n\t\t\t\t// havent sent the preamble, meaning we should simply return the normal\n\t\t\t\t// error.\n\t\t\t\tif stream.SentCount() == 0 {\n\t\t\t\t\tproblem.Render(base.Ctx, base.W, base.Err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tstream.Err(base.Err)\n\t\t\t}\n\n\t\t\tselect {\n\t\t\tcase <-base.Ctx.Done():\n\t\t\t\treturn\n\t\t\tcase <-sse.Pumped():\n\t\t\t\t//no-op, continue onto the next iteration\n\t\t\t}\n\t\t}\n\tcase render.MimeRaw:\n\t\taction, ok := action.(Raw)\n\n\t\tif !ok {\n\t\t\tgoto NotAcceptable\n\t\t}\n\n\t\taction.Raw()\n\n\t\tif base.Err != nil {\n\t\t\tproblem.Render(base.Ctx, base.W, base.Err)\n\t\t\treturn\n\t\t}\n\tdefault:\n\t\tgoto NotAcceptable\n\t}\n\treturn\n\nNotAcceptable:\n\tproblem.Render(base.Ctx, base.W, problem.NotAcceptable)\n\treturn\n}", "title": "" }, { "docid": "da8df21128b40384cc25be078eb65b79", "score": "0.58193934", "text": "func (r apiListTestsRequest) Execute() (SyntheticsListTestsResponse, *_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 SyntheticsListTestsResponse\n\t)\n\n\tlocalBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, \"SyntheticsApiService.ListTests\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/synthetics/tests\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif r.checkType != nil {\n\t\tlocalVarQueryParams.Add(\"check_type\", parameterToString(*r.checkType, \"\"))\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\n\t// Set Operation-ID header for telemetry\n\tlocalVarHeaderParams[\"DD-OPERATION-ID\"] = \"ListTests\"\n\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif auth, ok := auth[\"apiKeyAuth\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif auth.Prefix != \"\" {\n\t\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = auth.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"DD-API-KEY\"] = key\n\t\t\t}\n\t\t}\n\t}\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif auth, ok := auth[\"appKeyAuth\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif auth.Prefix != \"\" {\n\t\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = auth.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"DD-APPLICATION-KEY\"] = key\n\t\t\t}\n\t\t}\n\t}\n\treq, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := r.apiService.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v APIErrorResponse\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = r.apiService.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": "4c1113a0c9e55802bcc74079c8bcdf24", "score": "0.5818994", "text": "func (c *Client) Execute(code string) (b []byte) {\n\tvar ner ErrorResponse\n\tvalues := url.Values{}\n\tvalues.Set(\"code\", code)\n\treq, _ := c.MakeRequest(\"execute\", values)\n\tres, doErr := c.Do(req)\n\tif doErr != nil {\n\t\treturn []byte{}\n\t}\n\tb, _ = ioutil.ReadAll(res.Body)\n\tif !res.Close {\n\t\tres.Body.Close()\n\t}\n\terr := json.Unmarshal(b, &ner)\n\tif ner.Err.Code == 6 {\n\t\treturn c.Execute(code)\n\t}\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn []byte{}\n\t}\n\treturn b\n}", "title": "" }, { "docid": "ccedf060fc8a4b91527507cd51dc5dbf", "score": "0.581565", "text": "func (o *JobGetIterRequest) ExecuteUsing(zr *ZapiRunner) (*JobGetIterResponse, error) {\n\treturn o.executeWithIteration(zr)\n}", "title": "" }, { "docid": "a9a239c3a8e79b3cdb807d3d740f92a0", "score": "0.58006924", "text": "func (w *worker) Execute(ctx context.Context, req *Request) <-chan Response {\n\tch := make(chan Response, 1)\n\tw.wg.Add(1)\n\tgo func() {\n\t\tdefer w.wg.Done()\n\t\tch <- w.workDoCmd(ctx, req)\n\t}()\n\treturn ch\n}", "title": "" }, { "docid": "58f27c32413ab2121b9139c2f414e43b", "score": "0.578302", "text": "func (ks3 *KS3) run(req *request, resp interface{}) (*http.Response, error) {\n\tif debug {\n\t\tlog.Printf(\"Running KS3 request: %#v\", req)\n\t}\n\n\threq, err := ks3.setupHttpRequest(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn ks3.doHttpRequest(hreq, resp)\n}", "title": "" }, { "docid": "1b43899677d92a9c321e20b221a8cf15", "score": "0.5778874", "text": "func (c *ServeCmd) Execute(args []string) error {\n\tvar (\n\t\tmemStore = appdash.NewMemoryStore()\n\t\tStore = appdash.Store(memStore)\n\t\tQueryer = memStore\n\t)\n\n\tif c.StoreFile != \"\" {\n\t\tf, err := os.Open(c.StoreFile)\n\t\tif err != nil && !os.IsNotExist(err) {\n\t\t\treturn err\n\t\t}\n\t\tif f != nil {\n\t\t\tif n, err := memStore.ReadFrom(f); err == nil {\n\t\t\t\tlog.Printf(\"Read %d traces from file %s\", n, c.StoreFile)\n\t\t\t} else if err != nil {\n\t\t\t\tf.Close()\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err := f.Close(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tif c.PersistInterval != 0 {\n\t\t\tgo func() {\n\t\t\t\tif err := appdash.PersistEvery(memStore, c.PersistInterval, c.StoreFile); err != nil {\n\t\t\t\t\tlog.Fatal(err)\n\t\t\t\t}\n\t\t\t}()\n\t\t}\n\t}\n\n\tif c.DeleteAfter > 0 {\n\t\tStore = &appdash.RecentStore{\n\t\t\tMinEvictAge: c.DeleteAfter,\n\t\t\tDeleteStore: memStore,\n\t\t\tDebug: true,\n\t\t}\n\t}\n\n\tapp := traceapp.New(nil)\n\tapp.Store = Store\n\tapp.Queryer = Queryer\n\n\tvar h http.Handler\n\tif c.BasicAuth != \"\" {\n\t\tparts := strings.SplitN(c.BasicAuth, \":\", 2)\n\t\tif len(parts) != 2 {\n\t\t\tlog.Fatalf(\"Basic auth must be specified as 'user:passwd'.\")\n\t\t}\n\t\tuser, passwd := parts[0], parts[1]\n\t\tif user == \"\" || passwd == \"\" {\n\t\t\tlog.Fatalf(\"Basic auth user and passwd must both be nonempty.\")\n\t\t}\n\t\tlog.Printf(\"Requiring HTTP Basic auth\")\n\t\th = newBasicAuthHandler(user, passwd, app)\n\t} else {\n\t\th = app\n\t}\n\n\tif c.SampleData {\n\t\tsampleData(Store)\n\t}\n\n\tvar l net.Listener\n\tvar proto string\n\tif c.TLSCert != \"\" || c.TLSKey != \"\" {\n\t\tcertBytes, err := ioutil.ReadFile(c.TLSCert)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tkeyBytes, err := ioutil.ReadFile(c.TLSKey)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\tvar tc tls.Config\n\t\tcert, err := tls.X509KeyPair(certBytes, keyBytes)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\ttc.Certificates = []tls.Certificate{cert}\n\t\tl, err = tls.Listen(\"tcp\", c.CollectorAddr, &tc)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tproto = fmt.Sprintf(\"TLS cert %s, key %s\", c.TLSCert, c.TLSKey)\n\t} else {\n\t\tvar err error\n\t\tl, err = net.Listen(\"tcp\", c.CollectorAddr)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tproto = \"plaintext TCP (no security)\"\n\t}\n\tlog.Printf(\"appdash collector listening on %s (%s)\", c.CollectorAddr, proto)\n\tcs := appdash.NewServer(l, appdash.NewLocalCollector(Store))\n\tcs.Debug = c.Debug\n\tcs.Trace = c.Trace\n\tgo cs.Start()\n\n\tif c.TLSCert != \"\" || c.TLSKey != \"\" {\n\t\tlog.Printf(\"appdash HTTPS server listening on %s (TLS cert %s, key %s)\", c.HTTPAddr, c.TLSCert, c.TLSKey)\n\t\treturn http.ListenAndServeTLS(c.HTTPAddr, c.TLSCert, c.TLSKey, h)\n\t}\n\n\tlog.Printf(\"appdash HTTP server listening on %s\", c.HTTPAddr)\n\treturn http.ListenAndServe(c.HTTPAddr, h)\n}", "title": "" }, { "docid": "12bf7c6ec330f90b11cf19f81ab1b233", "score": "0.5778713", "text": "func (c *Client) Run(ctx context.Context, request *Request, response interface{}) error {\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\tdefault:\n\t}\n\tvar requestBody bytes.Buffer\n\twriter := multipart.NewWriter(&requestBody)\n\tif err := writer.WriteField(\"query\", request.q); err != nil {\n\t\treturn errors.Wrap(err, \"write query field\")\n\t}\n\tif len(request.vars) > 0 {\n\t\tvariablesField, err := writer.CreateFormField(\"variables\")\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"create variables field\")\n\t\t}\n\t\tif err := json.NewEncoder(variablesField).Encode(request.vars); err != nil {\n\t\t\treturn errors.Wrap(err, \"encode variables\")\n\t\t}\n\t}\n\tfor i := range request.files {\n\t\tfilename := fmt.Sprintf(\"file-%d\", i+1)\n\t\tif i == 0 {\n\t\t\t// just use \"file\" for the first one\n\t\t\tfilename = \"file\"\n\t\t}\n\t\tpart, err := writer.CreateFormFile(filename, request.files[i].Name)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"create form file\")\n\t\t}\n\t\tif _, err := io.Copy(part, request.files[i].R); err != nil {\n\t\t\treturn errors.Wrap(err, \"preparing file\")\n\t\t}\n\t}\n\tif err := writer.Close(); err != nil {\n\t\treturn errors.Wrap(err, \"close writer\")\n\t}\n\tvar graphResponse = struct {\n\t\tData interface{}\n\t\tErrors []graphErr\n\t}{\n\t\tData: response,\n\t}\n\treq, err := http.NewRequest(http.MethodPost, c.endpoint, &requestBody)\n\tif err != nil {\n\t\treturn err\n\t}\n\treq.Header.Set(\"Content-Type\", writer.FormDataContentType())\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treq = req.WithContext(ctx)\n\tres, err := c.httpClient.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer res.Body.Close()\n\tvar buf bytes.Buffer\n\tif _, err := io.Copy(&buf, res.Body); err != nil {\n\t\treturn errors.Wrap(err, \"reading body\")\n\t}\n\tif err := json.NewDecoder(&buf).Decode(&graphResponse); err != nil {\n\t\treturn errors.Wrap(err, \"decoding response\")\n\t}\n\tif len(graphResponse.Errors) > 0 {\n\t\t// return first error\n\t\treturn graphResponse.Errors[0]\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "24895b2cf061ffa122b80b3e498ac073", "score": "0.5776786", "text": "func (g *GetItemOp) Execute(out interface{}) error {\n\tif g.err != nil {\n\t\treturn g.err\n\t}\n\treturn g.ExecuteWithCtx(g.client.Ctx(), out)\n}", "title": "" }, { "docid": "1f0286c1f8c3de87030d69a92918d837", "score": "0.5776757", "text": "func (tu *Utils) ExecuteRequestWithParameters(method, endpoint string, parameters interface{}) <-chan *httptest.ResponseRecorder {\n\tvar reader io.Reader\n\n\tif parameters != nil {\n\t\tpayload, _ := json.Marshal(parameters)\n\t\treader = bytes.NewReader(payload)\n\t}\n\n\treq, _ := http.NewRequest(method, endpoint, reader)\n\treq.Header.Add(\"Authorization\", getFakeToken())\n\treq.Header.Add(\"Accept\", \"application/json\")\n\n\tresponse := make(chan *httptest.ResponseRecorder)\n\tgo func() {\n\t\trr := httptest.NewRecorder()\n\t\trouter.NewServer(\"anyClusterName\", NewKubeUtilMock(tu.client, tu.radixclient, tu.secretproviderclient), tu.controllers...).ServeHTTP(rr, req)\n\t\tresponse <- rr\n\t\tclose(response)\n\t}()\n\n\treturn response\n\n}", "title": "" }, { "docid": "e3a64230437e3efd808f39f06e3d7ce5", "score": "0.57642376", "text": "func (s *SecurityRulesServerTransport) Do(req *http.Request) (*http.Response, error) {\n\trawMethod := req.Context().Value(runtime.CtxAPINameKey{})\n\tmethod, ok := rawMethod.(string)\n\tif !ok {\n\t\treturn nil, nonRetriableError{errors.New(\"unable to dispatch request, missing value for CtxAPINameKey\")}\n\t}\n\n\tvar resp *http.Response\n\tvar err error\n\n\tswitch method {\n\tcase \"SecurityRulesClient.BeginCreateOrUpdate\":\n\t\tresp, err = s.dispatchBeginCreateOrUpdate(req)\n\tcase \"SecurityRulesClient.BeginDelete\":\n\t\tresp, err = s.dispatchBeginDelete(req)\n\tcase \"SecurityRulesClient.Get\":\n\t\tresp, err = s.dispatchGet(req)\n\tcase \"SecurityRulesClient.NewListPager\":\n\t\tresp, err = s.dispatchNewListPager(req)\n\tdefault:\n\t\terr = fmt.Errorf(\"unhandled API %s\", method)\n\t}\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "46da9cac193a8b9be6b5e32f040a4dc3", "score": "0.5760383", "text": "func (r apiGetUserRequest) Execute() (IdentityGetUserResponse, *_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 IdentityGetUserResponse\n\t)\n\n\tlocalBasePath, err := r.apiService.client.cfg.ServerURLWithContext(r.ctx, \"UsersApiService.GetUser\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/identity/v1/users/{user_id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"user_id\"+\"}\", _neturl.QueryEscape(parameterToString(r.userId, \"\")) , -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\t\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\treq, err := r.apiService.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := r.apiService.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v StackpathapiStatus\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v StackpathapiStatus\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 500 {\n\t\t\tvar v StackpathapiStatus\n\t\t\terr = r.apiService.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\t\tvar v StackpathapiStatus\n\t\t\terr = r.apiService.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 = r.apiService.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": "4db2dba1038a045fc31454cf782b7c65", "score": "0.57599574", "text": "func (d *dropOffHandler) Execute(w http.ResponseWriter, r *http.Request) {\n\tlog.Println(\"DropOffsHandler actived\")\n\tcontentType := r.Header.Get(\"Content-type\")\n\tif contentType != \"application/x-www-form-urlencoded\" {\n\t\tlog.Println(fmt.Errorf(\"Content Type is not valid\"))\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\terr := r.ParseForm()\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tvar input usecase.DropOffInput\n\n\terr = d.Schema.NewDecoder()\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\terr = d.Schema.Decode(&input, r.PostForm)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tif err := d.validate(input); err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tstatusHTTP, err := d.DropOffUsecase.DropOff(input)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tlog.Println(fmt.Sprintf(\"DropOff created\"))\n\tw.WriteHeader(statusHTTP)\n\treturn\n}", "title": "" }, { "docid": "e5307e2fcde5ab38436efadffaf49a50", "score": "0.57449716", "text": "func (u *Task) Run(ctx context.Context, req *proto.RunRequest, rsp *proto.RunResponse) error {\n\tlog.Printf(\"Received Task.Run with method: %s\", req.Method)\n\n\tswitch req.Method {\n\tcase \"GET\":\n\t\trsp.StatusCode = proto.RunResponse_OK\n\tcase \"POST\":\n\t\trsp.StatusCode = proto.RunResponse_CREATED\n\tdefault:\n\t\trsp.StatusCode = proto.RunResponse_FAILED\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0970b6fdff7a828201073a0327998448", "score": "0.57378966", "text": "func performRequest(method string, URL string, values url.Values) (*http.Response, error) {\n\tvar response *http.Response\n\tvar err error\n\tswitch method {\n\tcase \"GET\":\n\t\tresponse, err = http.Get(URL + \"?\" + values.Encode())\n\tcase \"POST\":\n\t\tresponse, err = http.PostForm(URL, values)\n\tdefault:\n\t\t// Fail silently\n\t\treturn nil, nil\n\t}\n\treturn response, err\n}", "title": "" }, { "docid": "219e88cd38d3e8fc0e090dec30825c8d", "score": "0.57313704", "text": "func Do(url, method string, args *openstack.Args) error {\n\tmessage, err := json.EncodeClientRequest(method, args)\n\tcheckErr(err)\n\n\treq, err := http.NewRequest(\"POST\", url, bytes.NewBuffer(message))\n\tcheckErr(err)\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tclient := new(http.Client)\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tlog.Printf(\"Error in sending request to %s. %s\", url, err)\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\terr = json.DecodeClientResponse(resp.Body, &result)\n\tif err != nil {\n\t\tlog.Printf(\"Couldn't decode response. %s\", err)\n\t\treturn err\n\t}\n\tlog.Printf(\"url: %s, method: %s, args: %s\", url, method, args)\n\n\treturn nil\n}", "title": "" }, { "docid": "680377ee5d60674ea9b679738c640af7", "score": "0.57293206", "text": "func (d Dispatch) Execute(ctx context.Context) error {\n\treturn d.Handler.Handle(ctx, d.EventType, d.DeliveryID, d.Payload)\n}", "title": "" } ]
9b827612e9222fd0bf687957dbbd181e
Start starts the sampling of systemctl state for the configured services
[ { "docid": "dc71f38e325750c4374d589af78569c4", "score": "0.69091046", "text": "func (s *Systemctl) Start(acc telegraf.Accumulator) {\n\ts.mux.Lock()\n\tdefer s.mux.Unlock()\n\tif s.running {\n\t\treturn\n\t}\n\n\tgo s.CollectSamples(s.done, s.collect, s.out)\n\ts.running = true\n}", "title": "" } ]
[ { "docid": "1f5e524d5e6db3cd8a1ec6a0a1c62dfe", "score": "0.7234996", "text": "func (m *ControllerSystemd) InitStart(services []*service.Service) error {\n\tfor _, s := range services {\n\t\tif s.IsInitStart && !s.Disable && !s.OnlyHealthCheck {\n\t\t\tfileName := fmt.Sprintf(\"/etc/systemd/system/%s.service\", s.Name)\n\t\t\t//init start can not read cluster endpoint.\n\t\t\t//so do not change the configuration file as much as possible\n\t\t\t_, err := os.Open(fileName)\n\t\t\tif err != nil && os.IsNotExist(err) {\n\t\t\t\tcontent := ToConfig(s)\n\t\t\t\tif content == \"\" {\n\t\t\t\t\terr := fmt.Errorf(\"can not generate config for service %s\", s.Name)\n\t\t\t\t\tfmt.Println(err)\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\t//init service start before etcd ready. so it can not set\n\t\t\t\t//content = m.manager.InjectConfig(content)\n\t\t\t\tif err := ioutil.WriteFile(fileName, []byte(content), 0644); err != nil {\n\t\t\t\t\tfmt.Printf(\"Generate config file %s: %v\", fileName, err)\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := m.run(\"start\", s.Name); err != nil {\n\t\t\t\treturn fmt.Errorf(\"systemctl start %s error:%s\", s.Name, err.Error())\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "17eb75ea71e90817d07e8cfc62ab44ec", "score": "0.6439613", "text": "func (sysd WindowsInitSystem) ServiceStart(service string) error {\n\tm, err := mgr.Connect()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer m.Disconnect()\n\n\ts, err := m.OpenService(service)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"could not access service %s\", service)\n\t}\n\tdefer s.Close()\n\n\t// Check if service is already started\n\tstatus, err := s.Query()\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"could not query service %s\", service)\n\t}\n\n\tif status.State != svc.Stopped && status.State != svc.StopPending {\n\t\treturn nil\n\t}\n\n\ttimeout := time.Now().Add(10 * time.Second)\n\tfor status.State != svc.Stopped {\n\t\tif timeout.Before(time.Now()) {\n\t\t\treturn errors.Errorf(\"timeout waiting for %s service to stop\", service)\n\t\t}\n\t\ttime.Sleep(300 * time.Millisecond)\n\t\tstatus, err = s.Query()\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"could not retrieve %s service status\", service)\n\t\t}\n\t}\n\n\t// Start the service\n\terr = s.Start(\"is\", \"manual-started\")\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"could not start service %s\", service)\n\t}\n\n\t// Check that the start was successful\n\tstatus, err = s.Query()\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"could not query service %s\", service)\n\t}\n\ttimeout = time.Now().Add(10 * time.Second)\n\tfor status.State != svc.Running {\n\t\tif timeout.Before(time.Now()) {\n\t\t\treturn errors.Errorf(\"timeout waiting for %s service to start\", service)\n\t\t}\n\t\ttime.Sleep(300 * time.Millisecond)\n\t\tstatus, err = s.Query()\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"could not retrieve %s service status\", service)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "eb037f09adffc253c8eabe5b9baaedca", "score": "0.6398138", "text": "func (cp *sysfsProbe) Start() {}", "title": "" }, { "docid": "6df6f1e583de20216673b70153914c14", "score": "0.6367581", "text": "func (s *ServiceImpl) Start(opt ...ServiceOptions) int {\n\ts.controller.Runner().PrintOutputToEventLog(Env.PrintOutputToEventLog)\n\t\n\t// Only start tests if run as a test job\n\tswitch runAs := config.RunAs(Env); runAs {\n\tcase config.RunAsJob:\n\t\ts.controller.SetPrintToStdout(true)\n\t\tresult := s.controller.RunAll()\n\t\tfmt.Println(\"\\n\" + result)\n\t\treturn 0\n\tcase config.RunAsLocal:\n\t\tfallthrough\n\tdefault:\n\t\treturn s.controller.RunLocal()\n\t}\n}", "title": "" }, { "docid": "ae5a7ee82ff725a140788ce0c151951e", "score": "0.6250003", "text": "func (s *ServerImpl) Start() error {\n\ts.logger.Info(\"Starting server for services\", tag.Value(s.so.serviceNames))\n\ts.logger.Debug(s.so.config.String())\n\n\tvar err error\n\n\terr = initSystemNamespaces(\n\t\t&s.persistenceConfig,\n\t\ts.clusterMetadata.CurrentClusterName,\n\t\ts.so.persistenceServiceResolver,\n\t\ts.logger,\n\t\ts.so.customDataStoreFactory)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to initialize system namespace: %w\", err)\n\t}\n\n\tfor _, svcMeta := range s.servicesMetadata {\n\t\ttimeoutCtx, cancelFunc := context.WithTimeout(context.Background(), serviceStartTimeout)\n\t\tsvcMeta.App.Start(timeoutCtx)\n\t\tcancelFunc()\n\t}\n\n\tif s.so.blockingStart {\n\t\t// If s.so.interruptCh is nil this will wait forever.\n\t\tinterruptSignal := <-s.so.interruptCh\n\t\ts.logger.Info(\"Received interrupt signal, stopping the server.\", tag.Value(interruptSignal))\n\t\ts.Stop()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1a39b4a3ff0e75c7a30fbf1c24c046e9", "score": "0.62132365", "text": "func (s *SystemService) Start() error {\n\tunit := newUnitFile(s)\n\n\tlogger.Log(\"loading unit file with systemd\")\n\n\t_, err := runSystemCtlCommand(\"start\", unit.Label)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlogger.Log(\"enabling unit file with systemd\")\n\n\t_, err = runSystemCtlCommand(\"enable\", unit.Label)\n\n\tif err != nil {\n\t\te := err.Error()\n\t\tif strings.Contains(e, \"Created symlink\") {\n\t\t\treturn nil\n\t\t}\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "07a25a41b92f11ce3c81b0342ee6bba1", "score": "0.61473906", "text": "func Start(host string, init chan error, stop <-chan os.Signal) {\n\n\tisErr := false\n\n\tinitModErr := module.InitializeDefaultModules()\n\n\tif initModErr != nil {\n\t\tinit <- initModErr\n\t\tisErr = true\n\t\tlog.Error(\"default module(s) failed to initialize\")\n\n\t} else {\n\n\t\tstartModErr := module.StartDefaultModules()\n\t\tif startModErr != nil {\n\t\t\tinit <- startModErr\n\t\t\tisErr = true\n\t\t\tlog.Error(\"default module(s) failed to start\")\n\t\t}\n\n\t}\n\n\tlog.Info(\"service sent registered modules start signals\")\n\n\t// if there is a channel receiving initialization errors go ahead and\n\t// close it so that callers reading this channel will know that the\n\t// initialization of the daemon is complete\n\tif init != nil {\n\t\tclose(init)\n\t}\n\n\t// if there were initialization errors go ahead and return instead of\n\t// waiting for a stop signal\n\tif isErr {\n\t\tlog.Error(\"service initialized failed\")\n\t\treturn\n\t}\n\n\tlog.Info(\"service successfully initialized, waiting on stop signal\")\n\n\t// if a channel to receive a stop signal is provided then block until\n\t// a stop signal is received\n\tif stop != nil {\n\t\t<-stop\n\t\tlog.Info(\"Service received stop signal\")\n\t}\n}", "title": "" }, { "docid": "3b056a88b90549b7da839e3f11787843", "score": "0.605831", "text": "func startService() {\n\tc := exec.Command(etcdStart)\n\n\tc.Start()\n}", "title": "" }, { "docid": "d62e7d673d9a7de2cabfd4f639c53c7b", "score": "0.60203075", "text": "func (s *Service) StartService() {\n\tlog.Info(\"Start Staking Service\")\n\ts.Init()\n\ts.Run()\n}", "title": "" }, { "docid": "a3a4eb16bb64f02660be7253fdd142c8", "score": "0.6019877", "text": "func StartServices() {\n\t// Work target by target, one mutex waitgroup per target, one after another\n\tfor _, target := range OrderedTargets {\n\t\twg := sync.WaitGroup{}\n\n\t\twg.Add(len(OrderedServices[target])) // Add the number of services in this target to the waitgroup\n\n\t\t// For each service, start them\n\t\tfor _, serviceName := range OrderedServices[target] {\n\t\t\tservice := LoadedServices[serviceName] // this is the service to start\n\n\t\t\tgo func(s *Service) {\n\t\t\t\t// TODO: This should ensure that Requires are satisfiable instead of getting into an\n\t\t\t\t// infiniteloop when they're not.\n\t\t\t\t// (TODO(2): Prove N=NP (P=NP no ?) in order to do the above efficiently.)\n\t\t\t\tfor satisfied, tries := false, 0; satisfied == false && tries < 60; tries++ {\n\t\t\t\t\tsatisfied = s.RequiredSatisfied()\n\t\t\t\t\ttime.Sleep(2 * time.Second)\n\t\t\t\t}\n\n\t\t\t\tif s.State == NotStarted && s.AutoStart {\n\t\t\t\t\t// Start the service\n\t\t\t\t\tif s.Type == \"oneshot\" || s.Type == \"forking\" {\n\t\t\t\t\t\tif err := s.Start(); err != nil {\n\t\t\t\t\t\t\tclog.Error(2, err.Error())\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if s.Type == \"simple\" {\n\t\t\t\t\t\tgo s.StartSimple()\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// What are you doing here ?\n\t\t\t\t\t\tclog.Warn(\"I don't know why but I'm asked to start %s with type %s\", s.Name, s.Type)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\twg.Done()\n\t\t\t}(service)\n\t\t}\n\t\twg.Wait() // Wait until all services are started in this target\n\t}\n}", "title": "" }, { "docid": "1f404bab8f5f443f443856cc7f123610", "score": "0.5953332", "text": "func Start(m *testing.M, opt ...ServiceOptions) int {\n\tservice := NewService(m)\n\treturn service.Start(opt...)\n}", "title": "" }, { "docid": "78dd123e9d3b872652e96284aaa3d98e", "score": "0.5936135", "text": "func (a *HostAgent) startService(conn *zk.Conn, procFinished chan<- int, ssStats *zk.Stat, service *dao.Service, serviceState *dao.ServiceState) (bool, error) {\n\tglog.V(2).Infof(\"About to start service %s with name %s\", service.Id, service.Name)\n\tclient, err := NewControlClient(a.master)\n\tif err != nil {\n\t\tglog.Errorf(\"Could not start ControlPlane client %v\", err)\n\t\treturn false, err\n\t}\n\tdefer client.Close()\n\n\t//get this service's tenantId for env injection\n\tvar tenantId string\n\terr = client.GetTenantId(service.Id, &tenantId)\n\tif err != nil {\n\t\tglog.Errorf(\"Failed getting tenantId for service: %s, %s\", service.Id, err)\n\t}\n\n\tportOps := \"\"\n\tif service.Endpoints != nil {\n\t\tglog.V(1).Info(\"Endpoints for service: \", service.Endpoints)\n\t\tfor _, endpoint := range service.Endpoints {\n\t\t\tif endpoint.Purpose == \"export\" { // only expose remote endpoints\n\t\t\t\tportOps += fmt.Sprintf(\" -p %d\", endpoint.PortNumber)\n\t\t\t}\n\t\t}\n\t}\n\n\tvolumeOpts := \"\"\n\tif len(tenantId) == 0 && len(service.Volumes) > 0 {\n\t\t// FIXME: find a better way of handling this error condition\n\t\tglog.Fatalf(\"Could not get tenant ID and need to mount a volume, service state: %s, service id: %s\", serviceState.Id, service.Id)\n\t}\n\tfor _, volume := range service.Volumes {\n\n\t\tbtrfsVolume, err := getSubvolume(a.varPath, service.PoolId, tenantId)\n\t\tif err != nil {\n\t\t\tglog.Fatal(\"Could not create subvolume: %s\", err)\n\t\t} else {\n\n\t\t\tresourcePath := path.Join(btrfsVolume.Dir(), volume.ResourcePath)\n\t\t\tif err = os.MkdirAll(resourcePath, 0770); err != nil {\n\t\t\t\tglog.Fatal(\"Could not create resource path: %s, %s\", resourcePath, err)\n\t\t\t}\n\n\t\t\tif err := createVolumeDir(resourcePath, volume.ContainerPath, service.ImageId, volume.Owner, volume.Permission); err != nil {\n\t\t\t\tglog.Fatalf(\"Error creating resource path: %v\", err)\n\t\t\t}\n\t\t\tvolumeOpts += fmt.Sprintf(\" -v %s:%s\", resourcePath, volume.ContainerPath)\n\t\t}\n\t}\n\n\tdir, binary, err := ExecPath()\n\tif err != nil {\n\t\tglog.Errorf(\"Error getting exec path: %v\", err)\n\t\treturn false, err\n\t}\n\tvolumeBinding := fmt.Sprintf(\"%s:/serviced\", dir)\n\n\tif err := injectContext(service, client); err != nil {\n\t\tglog.Errorf(\"Error injecting context: %s\", err)\n\t\treturn false, err\n\t}\n\n\t// config files\n\tconfigFiles := \"\"\n\tfor filename, config := range service.ConfigFiles {\n\t\tprefix := fmt.Sprintf(\"cp_%s_%s_\", service.Id, strings.Replace(filename, \"/\", \"__\", -1))\n\t\tf, err := writeConfFile(prefix, service.Id, filename, config.Content)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\n\t\tfileChowned := chownConfFile(f, service.Id, filename, config.Owner)\n\t\tif fileChowned == false {\n\t\t\tcontinue\n\t\t}\n\n\t\t// everything worked!\n\t\tconfigFiles += fmt.Sprintf(\" -v %s:%s \", f.Name(), filename)\n\t}\n\n\t// if this container is going to produce any logs, bind mount the following files:\n\t// logstash-forwarder, sslCertificate, sslKey, logstash-forwarder conf\n\t// FIX ME: consider moving this functionality to its own function...\n\tlogstashForwarderMount := \"\"\n\tif len(service.LogConfigs) > 0 {\n\t\tlogstashForwarderLogConf := `\n {\n \t\"paths\": [ \"%s\" ],\n \t\"fields\": { \"type\": \"%s\" }\n }`\n\t\tlogstashForwarderLogConf = fmt.Sprintf(logstashForwarderLogConf, service.LogConfigs[0].Path, service.LogConfigs[0].Type)\n\t\tfor _, logConfig := range service.LogConfigs[1:] {\n\t\t\tlogstashForwarderLogConf = logstashForwarderLogConf + `,\n\t\t\t\t{\n\t\t\t\t\t\"paths\": [ \"%s\" ],\n\t\t\t\t\t\"fields\": { \"type\": \"%s\" }\n\t\t\t\t}`\n\t\t\tlogstashForwarderLogConf = fmt.Sprintf(logstashForwarderLogConf, logConfig.Path, logConfig.Type)\n\t\t}\n\n\t\tcontainerDefaultGatewayAndLogstashForwarderPort := \"172.17.42.1:5043\"\n\t\t// *********************************************************************************************\n\t\t// ***** FIX ME the following 3 variables are defined in serviced/proxy.go as well! ************\n\t\tcontainerLogstashForwarderDir := \"/usr/local/serviced/resources/logstash\"\n\t\tcontainerLogstashForwarderBinaryPath := containerLogstashForwarderDir + \"/logstash-forwarder\"\n\t\tcontainerLogstashForwarderConfPath := containerLogstashForwarderDir + \"/logstash-forwarder.conf\"\n\t\t// *********************************************************************************************\n\t\tcontainerSSLCertificatePath := containerLogstashForwarderDir + \"/logstash-forwarder.crt\"\n\t\tcontainerSSLKeyPath := containerLogstashForwarderDir + \"/logstash-forwarder.key\"\n\n\t\tlogstashForwarderShipperConf := `\n\t\t\t{\n\t\t\t\t\"network\": {\n\t\t\t \t\"servers\": [ \"%s\" ],\n\t\t\t\t\t\"ssl certificate\": \"%s\",\n\t\t\t\t\t\"ssl key\": \"%s\",\n\t\t\t\t\t\"ssl ca\": \"%s\",\n\t\t\t \t\"timeout\": 15\n\t\t\t \t},\n\t\t\t \t\"files\": [\n\t\t\t\t\t%s\n\t\t\t \t]\n\t\t\t}`\n\t\tlogstashForwarderShipperConf = fmt.Sprintf(logstashForwarderShipperConf, containerDefaultGatewayAndLogstashForwarderPort, containerSSLCertificatePath, containerSSLKeyPath, containerSSLCertificatePath, logstashForwarderLogConf)\n\n\t\tfilename := service.Name + \"_logstash_forwarder_conf\"\n\t\tprefix := fmt.Sprintf(\"cp_%s_%s_\", service.Id, strings.Replace(filename, \"/\", \"__\", -1))\n\t\tf, err := writeConfFile(prefix, service.Id, filename, logstashForwarderShipperConf)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\n\t\tlogstashPath := resourcesDir() + \"/logstash\"\n\t\thostLogstashForwarderPath := logstashPath + \"/logstash-forwarder\"\n\t\thostLogstashForwarderConfPath := f.Name()\n\t\thostSSLCertificatePath := logstashPath + \"/logstash-forwarder.crt\"\n\t\thostSSLKeyPath := logstashPath + \"/logstash-forwarder.key\"\n\n\t\tlogstashForwarderBinaryMount := \" -v \" + hostLogstashForwarderPath + \":\" + containerLogstashForwarderBinaryPath\n\t\tlogstashForwarderConfFileMount := \" -v \" + hostLogstashForwarderConfPath + \":\" + containerLogstashForwarderConfPath\n\t\tsslCertificateMount := \" -v \" + hostSSLCertificatePath + \":\" + containerSSLCertificatePath\n\t\tsslKeyMount := \" -v \" + hostSSLKeyPath + \":\" + containerSSLKeyPath\n\n\t\tlogstashForwarderMount = logstashForwarderBinaryMount + sslCertificateMount + sslKeyMount + logstashForwarderConfFileMount\n\t}\n\n\t// add arguments to mount requested directory (if requested)\n\trequestedMount := \"\"\n\tfor _, bindMountString := range a.mount {\n\t\tsplitMount := strings.Split(bindMountString, \":\")\n\t\tif len(splitMount) == 3 {\n\t\t\trequestedImage := splitMount[0]\n\t\t\thostPath := splitMount[1]\n\t\t\tcontainerPath := splitMount[2]\n\t\t\tif requestedImage == service.ImageId {\n\t\t\t\trequestedMount += \" -v \" + hostPath + \":\" + containerPath\n\t\t\t}\n\t\t} else {\n\t\t\tglog.Warningf(\"Could not bind mount the following: %s\", bindMountString)\n\t\t}\n\t}\n\n\t// add arguments for environment variables\n\tenvironmentVariables := \"-e CONTROLPLANE=1\"\n\tenvironmentVariables = environmentVariables + \" -e CONTROLPLANE_SERVICE_ID=\" + service.Id\n\tenvironmentVariables = environmentVariables + \" -e CONTROLPLANE_TENANT_ID=\" + tenantId\n\tenvironmentVariables = environmentVariables + \" -e CONTROLPLANE_CONSUMER_WS=ws://localhost:8444/ws/metrics/store\"\n\tenvironmentVariables = environmentVariables + \" -e CONTROLPLANE_CONSUMER_URL=http://localhost:8444/ws/metrics/store\"\n\n\tproxyCmd := fmt.Sprintf(\"/serviced/%s proxy %s '%s'\", binary, service.Id, service.Startup)\n\t// 01 02 03 04 05 06 07 08 09 10 01 02 03 04 05 06 07 08 09 10\n\tcmdString := fmt.Sprintf(\"docker run %s -rm -name=%s %s -v %s %s %s %s %s %s %s\", portOps, serviceState.Id, environmentVariables, volumeBinding, requestedMount, logstashForwarderMount, volumeOpts, configFiles, service.ImageId, proxyCmd)\n\tglog.V(0).Infof(\"Starting: %s\", cmdString)\n\n\ta.dockerTerminate(serviceState.Id)\n\ta.dockerRemove(serviceState.Id)\n\n\tcmd := exec.Command(\"bash\", \"-c\", cmdString)\n\n\tgo a.waitForProcessToDie(conn, cmd, procFinished, serviceState)\n\n\tglog.V(2).Info(\"Process started in goroutine\")\n\treturn true, nil\n}", "title": "" }, { "docid": "56993a244aedbd945e7ca611697d5f51", "score": "0.593517", "text": "func (ds *DCOSStatsd) Start(acc telegraf.Accumulator) error {\n\t// if ds.containers was not properly initiated, we can have issues with\n\t// assignment to null map\n\tif ds.containers == nil {\n\t\tds.containers = map[string]containers.Container{}\n\t}\n\trouter := api.NewRouter(ds)\n\tds.apiServer = &http.Server{\n\t\tHandler: router,\n\t\tAddr: ds.Listen,\n\t\tWriteTimeout: ds.Timeout.Duration,\n\t\tReadTimeout: ds.Timeout.Duration,\n\t}\n\n\t// default to 10,000 allowed pending messages per statsd server\n\tif ds.AllowedPendingMessages == 0 {\n\t\tds.AllowedPendingMessages = 10000\n\t}\n\n\tif ds.ContainersDir != \"\" {\n\t\t// Check that dir exists\n\t\tif _, err := os.Stat(ds.ContainersDir); os.IsNotExist(err) {\n\t\t\tlog.Printf(\"I! %s does not exist and will be created now\", ds.ContainersDir)\n\t\t\tos.MkdirAll(ds.ContainersDir, 0666)\n\t\t}\n\t\t// We fail early if something is up with the containers dir\n\t\t// (eg bad permissions)\n\t\tif err := ds.loadContainers(); err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\t// We set ContainersDir in init(). If it's not set, it's either been\n\t\t// explicitly unset, or we're inside a test\n\t\tlog.Println(\"I! No containers_dir was set; state will not persist\")\n\t}\n\n\tif ds.SystemdSocketName != \"\" {\n\t\t// Listen on the socket from systemd that has the name we're configured to use.\n\t\tlisteners, err := dcosutil.ListenersWithNames()\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"E! Could not find systemd socket: %s\", err)\n\t\t}\n\t\tl, ok := listeners[ds.SystemdSocketName]\n\t\tif !ok || len(l) < 1 {\n\t\t\tlog.Fatalf(\"E! Could not find systemd socket: %s\", ds.SystemdSocketName)\n\t\t}\n\t\tln := l[0]\n\n\t\tgo func() {\n\t\t\terr := ds.apiServer.Serve(ln)\n\t\t\tlog.Printf(\"I! dcos_statsd API server closed: %s\", err)\n\t\t}()\n\t\tlog.Printf(\"I! dcos_statsd API server listening on %s\", ln.Addr().String())\n\t} else {\n\t\t// Use the listen param to decide where to listen.\n\t\tgo func() {\n\t\t\tif strings.Contains(ds.Listen, \":\") {\n\t\t\t\terr := ds.apiServer.ListenAndServe()\n\t\t\t\tlog.Printf(\"I! dcos_statsd API server closed: %s\", err)\n\t\t\t} else {\n\t\t\t\tln, err := net.Listen(\"unix\", ds.Listen)\n\t\t\t\tif err != nil {\n\t\t\t\t\t// we use fatal advisedly; this plugin is useless if it can't run its\n\t\t\t\t\t// command server\n\t\t\t\t\tlog.Fatalf(\"E! Could not listen on unix socket %s\", ds.Listen)\n\t\t\t\t}\n\n\t\t\t\tdefer func() {\n\t\t\t\t\tif r := recover(); r != nil {\n\t\t\t\t\t\tds.Stop()\n\t\t\t\t\t\tlog.Fatalf(\"dcos_statsd API server crashed unrecoverably: %v\", r)\n\t\t\t\t\t}\n\t\t\t\t}()\n\n\t\t\t\terr = ds.apiServer.Serve(ln)\n\t\t\t\tlog.Printf(\"I! dcos_statsd API server closed: %s\", err)\n\t\t\t}\n\n\t\t}()\n\t\tlog.Printf(\"I! dcos_statsd API server listening on %s\", ds.Listen)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "336f394387863eea2acb6c8165337b42", "score": "0.5860481", "text": "func (d *Service) Start() error {\n\n\t// config := config.Get()\n\td.logger.Printf(\"Started listening on %s %s ...\\n\",\n\t\td.GetInterface(), d.GetPath())\n\n\t// ToDo match with proper interface & path\n\td.conn.BusObject().Call(\"org.freedesktop.DBus.AddMatch\", 0,\n\t\t\"type='signal',path='/org/freedesktop/DBus',interface='org.freedesktop.DBus',sender='org.freedesktop.DBus'\")\n\n\tc := make(chan *dbus.Signal, 10)\n\td.conn.Signal(c)\n\tfor v := range c {\n\t\tfmt.Println(v)\n\t}\n\n\tselect {}\n}", "title": "" }, { "docid": "d47260a5215091847b68d019ab6c3297", "score": "0.585531", "text": "func run(ctx *cli.Context) error {\n\t/* Set logging level (verbosity) */\n\tlog.SetLevel(log.Level(uint32(ctx.Int(\"log-level\"))))\n\n\tlog.Info(\"Starting CMD as a Service\")\n\n\t/* Start framework service client */\n\tc, err := framework.StartServiceClientManaged(\n\t\tctx.String(\"framework-server\"),\n\t\tctx.String(\"mqtt-server\"),\n\t\tctx.String(\"service-id\"),\n\t\tctx.String(\"service-token\"),\n\t\t\"Unexpected disconnect!\",\n\t\tNewDevice)\n\tif err != nil {\n\t\tlog.Error(\"Failed to StartServiceClient: \", err)\n\t\treturn cli.NewExitError(nil, 1)\n\t}\n\n\t/* Parse given command arguments as CSV */\n\tcmdArgs, err := utils.ParseCSVConfig(ctx.String(\"cmd-args\"))\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to parse CMD args: %v\", err)\n\t\treturn cli.NewExitError(nil, 1)\n\t}\n\n\tcmd = NewCommand(ctx.String(\"cmd-path\"), cmdArgs)\n\n\t// /* Setup and start the command */\n\tif err := cmd.Start(); err != nil {\n\t\tlog.Errorf(\"Failed to start cmd: %v\", err)\n\t\treturn cli.NewExitError(nil, 1)\n\t}\n\n\tlog.Info(\"Started service\")\n\n\t/* Post service's global status */\n\tif err := c.SetStatus(\"Starting\"); err != nil {\n\t\tlog.Error(\"Failed to publish service status: \", err)\n\t\treturn cli.NewExitError(nil, 1)\n\t}\n\tlog.Info(\"Published Service Status\")\n\n\t/* Setup signal channel */\n\tsignals := make(chan os.Signal, 1)\n\tsignal.Notify(signals, os.Interrupt, syscall.SIGTERM)\n\n\t/* Post service status indicating I started */\n\tif err := c.SetStatus(\"Started\"); err != nil {\n\t\tlog.Error(\"Failed to publish service status: \", err)\n\t\treturn cli.NewExitError(nil, 1)\n\t}\n\tlog.Info(\"Published Service Status\")\n\n\t/* Wait on a signal */\n\tsig := <-signals\n\tlog.Info(\"Received signal \", sig)\n\tlog.Warning(\"Shutting down\")\n\n\t/* Post service's global status */\n\tif err := c.SetStatus(\"Shutting down\"); err != nil {\n\t\tlog.Error(\"Failed to publish service status: \", err)\n\t}\n\tlog.Info(\"Published service status\")\n\n\t/* Stop framework */\n\tc.StopClient()\n\n\t/* End cmd */\n\tif err := cmd.Stop(); err != nil {\n\t\tlog.Errorf(\"Failed to end process: %v\", err)\n\t\treturn cli.NewExitError(nil, 1)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "12ee2d40eab908a83fd90c272b3661e9", "score": "0.5835788", "text": "func (sd *ServiceDiffer) Start() {\n\tsd.serviceSet = make(map[services.ID]services.Endpoint)\n\tsd.stop = make(chan struct{})\n\n\tticker := time.NewTicker(time.Duration(sd.IntervalSeconds) * time.Second)\n\n\t// Do discovery immediately so that services can be monitored ASAP\n\tsd.runDiscovery()\n\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-sd.stop:\n\t\t\t\tclose(sd.stop)\n\t\t\t\tsd.stop = nil\n\t\t\t\tticker.Stop()\n\t\t\t\treturn\n\t\t\tcase <-ticker.C:\n\t\t\t\tsd.runDiscovery()\n\t\t\t}\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "021e87d610702c6a9a461086f5a53751", "score": "0.5820994", "text": "func (s Service) Start() error {\n\tLoadedServicesMu.Lock()\n\tdefer LoadedServicesMu.Unlock()\n\n\tif s.State != NotStarted {\n\t\treturn fmt.Errorf(\"Service %v is %v\", s.Name, s.State.String())\n\t}\n\ts.State = Starting\n\tLoadedServices[s.Name].State = Starting\n\tLoadedServices[s.Name].LastActionAt = time.Now().UTC().Unix()\n\tLoadedServices[s.Name].LastAction = Start\n\n\tif s.ExecPreStart != \"\" {\n\t\tLoadedServices[s.Name].LastActionAt = time.Now().UTC().Unix()\n\t\tLoadedServices[s.Name].LastAction = PreStart\n\n\t\terr := justExecACommand(s.ExecPreStart.String())\n\t\tif err != nil {\n\t\t\tclog.Error(2, \"error in %s ExecPreStart: %s\", s.Name, err.Error())\n\t\t\treturn err\n\t\t}\n\t}\n\n\tcmd := exec.Command(\"sh\", \"-c\", s.Startup.String())\n\tcmd.Stderr = os.Stderr\n\tcmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}\n\n\tif err := cmd.Run(); err != nil {\n\t\tif err.Error() == errWaitNoChild || err.Error() == errWaitIDNoChild {\n\t\t\t// Process exited cleanly\n\t\t\ts.State = Started\n\t\t\tLoadedServices[s.Name].State = Started\n\t\t\tLoadedServices[s.Name].LastActionAt = time.Now().UTC().Unix()\n\t\t\tLoadedServices[s.Name].LastAction = Start\n\n\t\t\tclog.Info(\"[lutra] Started service %s\", s.Name)\n\n\t\t\treturn nil\n\t\t}\n\n\t\ts.State = Errored\n\t\tLoadedServices[s.Name].State = Errored\n\t\tLoadedServices[s.Name].LastActionAt = time.Now().UTC().Unix()\n\t\tLoadedServices[s.Name].LastAction = Start\n\n\t\tclog.Error(2, \"[lutra] Error starting service %s: %s\", s.Name, err.Error())\n\n\t\treturn err\n\t}\n\n\tif s.ExecPostStart != \"\" {\n\t\tLoadedServices[s.Name].LastActionAt = time.Now().UTC().Unix()\n\t\tLoadedServices[s.Name].LastAction = PostStart\n\n\t\terr := justExecACommand(s.ExecPostStart.String())\n\t\tif err != nil {\n\t\t\tclog.Error(2, \"error in %s ExecPostStart: %s\", s.Name, err.Error())\n\t\t\treturn err\n\t\t}\n\t}\n\n\ts.State = Started\n\tLoadedServices[s.Name].State = Started\n\tLoadedServices[s.Name].LastActionAt = time.Now().UTC().Unix()\n\tLoadedServices[s.Name].LastAction = Start\n\n\tclog.Info(\"[lutra] Started service %s\", s.Name)\n\n\treturn nil\n}", "title": "" }, { "docid": "83f9dc30325d67efc0838d3e92572c36", "score": "0.58190876", "text": "func Start(ctx context.Context, dataChan chan *metrics.EventMetrics, interval time.Duration, envVarsName string) {\n\tvars := Vars()\n\tfor k, v := range parseEnvVars(envVarsName) {\n\t\tvars[k] = v\n\t}\n\t// Add reset timestamp (Unix epoch corresponding to when Cloudprober was started)\n\tvars[\"start_timestamp\"] = strconv.FormatInt(startTime.Unix(), 10)\n\n\tvar varsKeys []string\n\tfor k := range vars {\n\t\tvarsKeys = append(varsKeys, k)\n\t}\n\tsort.Strings(varsKeys)\n\n\tfor ts := range time.Tick(interval) {\n\t\t// Don't run another probe if context is canceled already.\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\t\tdefault:\n\t\t}\n\n\t\tem := metrics.NewEventMetrics(ts).\n\t\t\tAddLabel(\"ptype\", \"sysvars\").\n\t\t\tAddLabel(\"probe\", \"sysvars\")\n\t\tem.Kind = metrics.GAUGE\n\t\tfor _, k := range varsKeys {\n\t\t\tem.AddMetric(k, metrics.NewString(vars[k]))\n\t\t}\n\t\tdataChan <- em\n\t\tl.Info(em.String())\n\n\t\truntimeVars(dataChan, l)\n\t}\n}", "title": "" }, { "docid": "77f30541a518191571ccb9bcab2e09ec", "score": "0.58160776", "text": "func Start(ctx *context.T, args Args) ([]naming.Endpoint, func(), error) {\n\t// Is this binary compatible with the state on disk?\n\tif err := versioning.CheckCompatibility(ctx, args.Device.ConfigState.Root); err != nil {\n\t\treturn nil, nil, err\n\t}\n\t// In test mode, we skip writing the info file to disk, and we skip\n\t// attempting to start the claimable service: the device must have been\n\t// claimed already to enable updates anyway, and checking for perms in\n\t// NewClaimableDispatcher needlessly prints a perms signature\n\t// verification error to the logs.\n\tif args.Device.TestMode {\n\t\tcleanup, err := startClaimedDevice(ctx, args)\n\t\treturn nil, cleanup, err\n\t}\n\n\t// TODO(caprita): use some mechanism (a file lock or presence of entry\n\t// in mounttable) to ensure only one device manager is running in an\n\t// installation?\n\tmi := &impl.ManagerInfo{\n\t\tPid: os.Getpid(),\n\t}\n\tif err := impl.SaveManagerInfo(filepath.Join(args.Device.ConfigState.Root, \"device-manager\"), mi); err != nil {\n\t\treturn nil, nil, verror.New(errCantSaveInfo, ctx, err)\n\t}\n\n\t// If the device has not yet been claimed, start the mounttable and\n\t// claimable service and wait for it to be claimed.\n\t// Once a device is claimed, close any previously running servers and\n\t// start a new mounttable and device service.\n\tclaimable, claimed := claim.NewClaimableDispatcher(ctx, impl.PermsDir(args.Device.ConfigState), args.Device.PairingToken, security.AllowEveryone())\n\tif claimable == nil {\n\t\t// Device has already been claimed, bypass claimable service\n\t\t// stage.\n\t\tcleanup, err := startClaimedDevice(ctx, args)\n\t\treturn nil, cleanup, err\n\t}\n\teps, stopClaimable, err := startClaimableDevice(ctx, claimable, args)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tstop := make(chan struct{})\n\tstopped := make(chan struct{})\n\tgo waitToBeClaimedAndStartClaimedDevice(ctx, stopClaimable, claimed, stop, stopped, args)\n\treturn eps, func() {\n\t\tclose(stop)\n\t\t<-stopped\n\t}, nil\n}", "title": "" }, { "docid": "0cc7590cc76be2fa78509ffc336c6818", "score": "0.5802995", "text": "func (s *Server) Start() error {\n\tfor _, r := range s.Services {\n\t\tr.Start()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1342e9769ae2e7e4135f78a8749f3eb6", "score": "0.5754834", "text": "func (m *Monitoring) Start() error {\n\tlogger.Debug.Println(\"starting monitoring...\")\n\t// Get configuration from Service Discovery K/V store\n\tmonitors, err := m.getSDConfig()\n\tif err != nil {\n\t\tm.err = err\n\t\treturn err\n\t}\n\tmonitors = append(m.conf.Monitors, monitors...)\n\t// Now, create all of our monitors.\n\tfor i := 0; i < len(monitors); i++ {\n\t\t// Get monitor configuration\n\t\tmConfig := monitors[i]\n\t\tif mConfig.Disable {\n\t\t\tcontinue\n\t\t}\n\t\t// Apply global configuration\n\t\tmConfig.Healthcheck = config.MergeHealthcheckConfig(m.conf.Healthcheck, mConfig.Healthcheck)\n\t\t// Apply proxy configuration\n\t\tif mConfig.Proxy == \"\" {\n\t\t\tmConfig.Proxy = m.conf.Proxy\n\t\t}\n\t\t// Create new monitor\n\t\tmonitor, err := NewMonitor(i+1, mConfig)\n\t\tif err != nil {\n\t\t\tlogger.Error.Println(\"unable to create monitor\", err)\n\t\t\tcontinue\n\t\t}\n\t\t// Start the monitor\n\t\tmonitor.Start()\n\t\tm.monitors = append(m.monitors, monitor)\n\t}\n\tm.err = nil\n\treturn nil\n}", "title": "" }, { "docid": "6ec47f0c647e53ba916628452d1bb8e5", "score": "0.5752311", "text": "func (s *FakeJujuService) Start() {\n\ts.watcher = s.state.Watch()\n\tgo s.watch()\n}", "title": "" }, { "docid": "67d50a92dca3c49f328d681b3f6e0610", "score": "0.5728892", "text": "func (s *Server) Start(v service.Service) error {\n\ts.logInfo(\"Service starting\")\n\n\ts.regList = make(map[string]*ZCServer)\n\n\t// Make sure the working directory is the same as the application exe\n\tap, err := os.Executable()\n\tif err != nil {\n\t\ts.logError(\"Error getting the executable path.\", err.Error())\n\t} else {\n\t\twd, err := os.Getwd()\n\t\tif err != nil {\n\t\t\ts.logError(\"Error getting current working directory.\", err.Error())\n\t\t} else {\n\t\t\tad := filepath.Dir(ap)\n\t\t\ts.logInfo(\"Current application path is\", ad)\n\t\t\tif ad != wd {\n\t\t\t\tif err := os.Chdir(ad); err != nil {\n\t\t\t\t\ts.logError(\"Error chaning working directory.\", err.Error())\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Create a channel that will be used to block until the Stop signal is received\n\ts.exit = make(chan struct{})\n\tgo s.run()\n\treturn nil\n}", "title": "" }, { "docid": "c5583b162d764a2d769004eb54b63831", "score": "0.56831247", "text": "func (l *LCLService) StartService(ctx context.Context, logger log.Logger, rootView viewer) {\n\t// COLLECTION AGGREGATE to hold Lclog and Faultlist: /redfish/v1/Managers/CMC.Integrated.1/LogServices\n\t// AGGREGATE: /redfish/v1/Managers/CMC.Integrated.1/LogServices/Lclog\n\t// COLLECTION AGGREGATE: /redfish/v1/Managers/CMC.Integrated.1/Logs/Lclog.json <-- lets save this for last\n\t//\t\t^--- need a new feature: autoexpand - put this into the aggregate. Test the feature in redfish_handler and auto expand\n\t// COLLECTION MEMBER AGGREGATE: /redfish/v1/Managers/CMC.Integrated.1/Logs/Lclog/66.json\n\t//\n\t// SKIP FOR NOW (implement after LCL done) __redfish__v1__Managers__CMC.Integrated.1__Logs__FaultList.json\n\tlcLogUri := rootView.GetURI() + \"/Logs/Lclog\"\n\tlclLogger := logger.New(\"module\", \"LCL\")\n\n\t// Start up goroutine that listens for log-specific events and creates log aggregates\n\tl.manageLcLogs(ctx, lclLogger, lcLogUri)\n}", "title": "" }, { "docid": "f3f933a15d5767aa90544b6d314a916f", "score": "0.5672235", "text": "func (app *App) Start() (final error) {\n\tf := func() (err error) {\n\t\tselect {\n\t\tcase <-app.configWatcher.Events:\n\t\t\terr = app.reconfigure()\n\n\t\tcase event := <-app.targetsWatcher.Events:\n\t\t\te := app.handle(event)\n\t\t\tif e != nil {\n\t\t\t\tzap.L().Error(\"failed to handle event\",\n\t\t\t\t\tzap.String(\"url\", event.URL),\n\t\t\t\t\tzap.Error(e))\n\t\t\t}\n\n\t\tcase e := <-errorMultiplex(app.configWatcher.Errors, app.targetsWatcher.Errors):\n\t\t\tzap.L().Error(\"git error\",\n\t\t\t\tzap.Error(e))\n\t\t}\n\t\treturn\n\t}\n\n\tzap.L().Debug(\"starting service daemon\")\n\n\tfor {\n\t\tfinal = f()\n\t\tif final != nil {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "f62b9b0dbc0d2bce99df3eaab77b2576", "score": "0.56710124", "text": "func RunServerStart(ctx context.Context, opts *ServerStartOptions, version string) error {\n\tconfig, err := conf.Init(opts.config)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_ = logger.Init(logger.Settings{\n\t\tLevel: config.LogLevel,\n\t\tFilename: \"./data/royal.log\",\n\t})\n\n\t// database.Init\n\tvar (\n\t\tbaseDb *gorm.DB\n\t\tmessageDb *gorm.DB\n\t)\n\tbaseDb, err = database.InitDb(config.Driver, config.BaseDb)\n\tif err != nil {\n\t\treturn err\n\t}\n\tmessageDb, err = database.InitDb(config.Driver, config.MessageDb)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_ = baseDb.AutoMigrate(&database.Group{}, &database.GroupMember{})\n\t_ = messageDb.AutoMigrate(&database.MessageIndex{}, &database.MessageContent{})\n\n\tif config.NodeID == 0 {\n\t\tconfig.NodeID = int64(HashCode(config.ServiceID))\n\t}\n\tidgen, err := database.NewIDGenerator(config.NodeID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trdb, err := conf.InitRedis(config.RedisAddrs, \"\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tns, err := consul.NewNaming(config.ConsulURL)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_ = ns.Register(&naming.DefaultService{\n\t\tId: config.ServiceID,\n\t\tName: wire.SNService, // service name\n\t\tAddress: config.PublicAddress,\n\t\tPort: config.PublicPort,\n\t\tProtocol: \"http\",\n\t\tTags: config.Tags,\n\t\tMeta: map[string]string{\n\t\t\tconsul.KeyHealthURL: fmt.Sprintf(\"http://%s:%d/health\", config.PublicAddress, config.PublicPort),\n\t\t},\n\t})\n\tdefer func() {\n\t\t_ = ns.Deregister(config.ServiceID)\n\t}()\n\tserviceHandler := handler.ServiceHandler{\n\t\tBaseDb: baseDb,\n\t\tMessageDb: messageDb,\n\t\tIdgen: idgen,\n\t\tCache: rdb,\n\t}\n\n\tac := conf.MakeAccessLog()\n\tdefer ac.Close()\n\n\tapp := newApp(&serviceHandler)\n\tapp.UseRouter(ac.Handler)\n\tapp.UseRouter(setAllowedResponses)\n\n\t// Start server\n\treturn app.Listen(config.Listen, iris.WithOptimizations)\n}", "title": "" }, { "docid": "a525fca692c7fb5278766120da26a402", "score": "0.5660469", "text": "func (a *Adapter) Start(stop <-chan struct{}) error {\n\tklog.Info(\"start adapter\")\n\n\t// Start registry client\n\tif err := a.registryClient.Start(); err != nil {\n\t\tklog.Errorf(\"Start a registry center's client has an error: %v\", err)\n\t\treturn err\n\t}\n\tklog.Info(\"Registry client started.\")\n\n\t// Start configuration client\n\tif err := a.configClient.Start(); err != nil {\n\t\tklog.Errorf(\"Start a configuration center's client has an error: %v\", err)\n\t\treturn err\n\t}\n\tklog.Info(\"Configuration client started.\")\n\n\t// Prometheus HTTP server\n\thttp.Handle(\"/metrics\", promhttp.Handler())\n\tgo http.ListenAndServe(constant.HTTPPort, nil)\n\tklog.Infof(\"Started HTTP server for providing some features such as exposing metrics and pprof on port: %s\", constant.HTTPPort)\n\n\t// Using an accelerator can improve the efficient of interacting with k8s api server\n\taccelerator := accelerate.NewAccelerator(a.opt.EventHandlers.AcceleratorSize, stop)\n\tklog.Infof(\"Initializing an accelerator with a channels size %d\", a.opt.EventHandlers.AcceleratorSize)\n\n\tfor {\n\t\tselect {\n\t\tcase se := <-a.registryClient.ServiceEvents():\n\t\t\tklog.V(6).Infof(\"Registry component which has been received by adapter: %s, type: %v\", se.Service.Name, se.EventType)\n\t\t\tswitch se.EventType {\n\t\t\tcase types.ServiceAdded:\n\t\t\t\tfor _, h := range a.eventHandlers {\n\t\t\t\t\th.AddService(se)\n\t\t\t\t}\n\t\t\tcase types.ServiceDeleted:\n\t\t\t\tfor _, h := range a.eventHandlers {\n\t\t\t\t\th.DeleteService(se)\n\t\t\t\t}\n\t\t\tcase types.ServiceInstanceAdded:\n\t\t\t\tfor _, h := range a.eventHandlers {\n\t\t\t\t\th.AddInstance(se)\n\t\t\t\t}\n\t\t\tcase types.ServiceInstancesReplace:\n\t\t\t\tfor _, h := range a.eventHandlers {\n\t\t\t\t\thandler := h\n\t\t\t\t\taccelerator.Accelerate(func() {\n\t\t\t\t\t\thandler.ReplaceInstances(se)\n\t\t\t\t\t}, se.Service.Name)\n\t\t\t\t}\n\t\t\tcase types.ServiceInstanceDeleted:\n\t\t\t\tfor _, h := range a.eventHandlers {\n\t\t\t\t\th.DeleteInstance(se)\n\t\t\t\t}\n\t\t\t}\n\t\tcase ae := <-a.registryClient.AccessorEvents():\n\t\t\tklog.V(6).Infof(\"Accessor which has been received by adapter: %v\", ae)\n\t\t\tswitch ae.EventType {\n\t\t\tcase types.ServiceInstancesReplace:\n\t\t\t\tfor _, h := range a.eventHandlers {\n\t\t\t\t\thandler := h\n\t\t\t\t\taccelerator.Accelerate(func() {\n\t\t\t\t\t\thandler.ReplaceAccessorInstances(ae, a.registryClient.GetCachedScopedMapping)\n\t\t\t\t\t}, ae.Service.Name)\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\tklog.Warningf(\"The event with %v type has not been support yet.\", ae.EventType)\n\t\t\t}\n\t\tcase ce := <-a.configClient.Events():\n\t\t\tklog.V(6).Infof(\"Configuration component which has been received by adapter: %v\", ce)\n\t\t\tswitch ce.EventType {\n\t\t\tcase types.ConfigEntryAdded:\n\t\t\t\tfor _, h := range a.eventHandlers {\n\t\t\t\t\th.AddConfigEntry(ce)\n\t\t\t\t}\n\t\t\tcase types.ConfigEntryChanged:\n\t\t\t\tfor _, h := range a.eventHandlers {\n\t\t\t\t\th.ChangeConfigEntry(ce)\n\t\t\t\t}\n\t\t\tcase types.ConfigEntryDeleted:\n\t\t\t\tfor _, h := range a.eventHandlers {\n\t\t\t\t\th.DeleteConfigEntry(ce)\n\t\t\t\t}\n\t\t\t}\n\t\tcase <-stop:\n\t\t\ta.registryClient.Stop()\n\t\t\ta.configClient.Stop()\n\t\t\treturn nil\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6d55dac0055d449c42ddd831d80ca599", "score": "0.56560665", "text": "func Run(ctx context.Context) {\n\tif flags.Version {\n\t\tfmt.Println(version.AgentVersion)\n\t\treturn\n\t}\n\n\tcfg, err := cmdconfig.LoadConfigFile(flags.ConfigPath)\n\tif err != nil {\n\t\tfmt.Println(err) // TODO: remove me\n\t\tif err == config.ErrMissingAPIKey {\n\t\t\tfmt.Println(config.ErrMissingAPIKey)\n\n\t\t\t// a sleep is necessary to ensure that supervisor registers this process as \"STARTED\"\n\t\t\t// If the exit is \"too quick\", we enter a BACKOFF->FATAL loop even though this is an expected exit\n\t\t\t// http://supervisord.org/subprocess.html#process-states\n\t\t\ttime.Sleep(5 * time.Second)\n\n\t\t\t// Don't use os.Exit() method here, even with os.Exit(0) the Service Control Manager\n\t\t\t// on Windows will consider the process failed and log an error in the Event Viewer and\n\t\t\t// attempt to restart the process.\n\t\t\treturn\n\t\t}\n\t\tosutil.Exitf(\"%v\", err)\n\t}\n\terr = info.InitInfo(cfg) // for expvar & -info option\n\tif err != nil {\n\t\tosutil.Exitf(\"%v\", err)\n\t}\n\n\tif flags.Info {\n\t\tif err := info.Info(os.Stdout, cfg); err != nil {\n\t\t\tosutil.Exitf(\"Failed to print info: %s\", err)\n\t\t}\n\t\treturn\n\t}\n\n\tif err := coreconfig.SetupLogger(\n\t\tcoreconfig.LoggerName(\"TRACE\"),\n\t\tcoreconfig.Datadog.GetString(\"log_level\"),\n\t\tcfg.LogFilePath,\n\t\tcoreconfig.GetSyslogURI(),\n\t\tcoreconfig.Datadog.GetBool(\"syslog_rfc\"),\n\t\tcoreconfig.Datadog.GetBool(\"log_to_console\"),\n\t\tcoreconfig.Datadog.GetBool(\"log_format_json\"),\n\t); err != nil {\n\t\tosutil.Exitf(\"Cannot create logger: %v\", err)\n\t}\n\ttracelog.SetLogger(corelogger{})\n\tdefer log.Flush()\n\n\tif !cfg.Enabled {\n\t\tlog.Info(messageAgentDisabled)\n\n\t\t// a sleep is necessary to ensure that supervisor registers this process as \"STARTED\"\n\t\t// If the exit is \"too quick\", we enter a BACKOFF->FATAL loop even though this is an expected exit\n\t\t// http://supervisord.org/subprocess.html#process-states\n\t\ttime.Sleep(5 * time.Second)\n\t\treturn\n\t}\n\n\tdefer watchdog.LogOnPanic()\n\n\tif flags.CPUProfile != \"\" {\n\t\tf, err := os.Create(flags.CPUProfile)\n\t\tif err != nil {\n\t\t\tlog.Error(err)\n\t\t}\n\t\tpprof.StartCPUProfile(f) //nolint:errcheck\n\t\tlog.Info(\"CPU profiling started...\")\n\t\tdefer pprof.StopCPUProfile()\n\t}\n\n\tif flags.PIDFilePath != \"\" {\n\t\terr := pidfile.WritePID(flags.PIDFilePath)\n\t\tif err != nil {\n\t\t\tlog.Criticalf(\"Error writing PID file, exiting: %v\", err)\n\t\t\tos.Exit(1)\n\t\t}\n\n\t\tlog.Infof(\"PID '%d' written to PID file '%s'\", os.Getpid(), flags.PIDFilePath)\n\t\tdefer os.Remove(flags.PIDFilePath)\n\t}\n\n\tif err := util.SetupCoreDump(); err != nil {\n\t\tlog.Warnf(\"Can't setup core dumps: %v, core dumps might not be available after a crash\", err)\n\t}\n\n\terr = manager.ConfigureAutoExit(ctx)\n\tif err != nil {\n\t\tosutil.Exitf(\"Unable to configure auto-exit, err: %v\", err)\n\t\treturn\n\t}\n\n\terr = metrics.Configure(cfg, []string{\"version:\" + version.AgentVersion})\n\tif err != nil {\n\t\tosutil.Exitf(\"cannot configure dogstatsd: %v\", err)\n\t}\n\tdefer metrics.Flush()\n\tdefer timing.Stop()\n\n\tmetrics.Count(\"datadog.trace_agent.started\", 1, nil, 1)\n\n\trand.Seed(time.Now().UTC().UnixNano())\n\n\tremoteTagger := coreconfig.Datadog.GetBool(\"apm_config.remote_tagger\")\n\tif remoteTagger {\n\t\ttagger.SetDefaultTagger(remote.NewTagger())\n\t\tif err := tagger.Init(ctx); err != nil {\n\t\t\tlog.Infof(\"starting remote tagger failed. falling back to local tagger: %s\", err)\n\t\t\tremoteTagger = false\n\t\t}\n\t}\n\n\t// starts the local tagger if apm_config says so, or if starting the\n\t// remote tagger has failed.\n\tif !remoteTagger {\n\t\tstore := workloadmeta.GetGlobalStore()\n\t\tstore.Start(ctx)\n\n\t\ttagger.SetDefaultTagger(local.NewTagger(store))\n\t\tif err := tagger.Init(ctx); err != nil {\n\t\t\tlog.Errorf(\"failed to start the tagger: %s\", err)\n\t\t}\n\t}\n\n\tdefer func() {\n\t\terr := tagger.Stop()\n\t\tif err != nil {\n\t\t\tlog.Error(err)\n\t\t}\n\t}()\n\n\tif coreconfig.Datadog.GetBool(\"remote_configuration.enabled\") {\n\t\tclient, err := grpc.GetDDAgentSecureClient(context.Background())\n\t\tif err != nil {\n\t\t\tosutil.Exitf(\"could not instantiate the tracer remote config client: %v\", err)\n\t\t}\n\t\ttoken, err := security.FetchAuthToken()\n\t\tif err != nil {\n\t\t\tosutil.Exitf(\"could obtain the auth token for the tracer remote config client: %v\", err)\n\t\t}\n\t\tapi.AttachEndpoint(api.Endpoint{\n\t\t\tPattern: \"/v0.7/config\",\n\t\t\tHandler: func(r *api.HTTPReceiver) http.Handler { return remoteConfigHandler(r, client, token, cfg) },\n\t\t})\n\t}\n\n\tapi.AttachEndpoint(api.Endpoint{\n\t\tPattern: \"/config/set\",\n\t\tHandler: func(r *api.HTTPReceiver) http.Handler {\n\t\t\treturn cmdconfig.SetHandler()\n\t\t},\n\t})\n\n\tagnt := agent.NewAgent(ctx, cfg)\n\tlog.Infof(\"Trace agent running on host %s\", cfg.Hostname)\n\tif pcfg := profilingConfig(cfg); pcfg != nil {\n\t\tif err := profiling.Start(*pcfg); err != nil {\n\t\t\tlog.Warn(err)\n\t\t} else {\n\t\t\tlog.Infof(\"Internal profiling enabled: %s.\", pcfg)\n\t\t}\n\t\tdefer profiling.Stop()\n\t}\n\tagnt.Run()\n\n\t// collect memory profile\n\tif flags.MemProfile != \"\" {\n\t\tf, err := os.Create(flags.MemProfile)\n\t\tif err != nil {\n\t\t\tlog.Error(\"Could not create memory profile: \", err)\n\t\t}\n\n\t\t// get up-to-date statistics\n\t\truntime.GC()\n\t\t// Not using WriteHeapProfile but instead calling WriteTo to\n\t\t// make sure we pass debug=1 and resolve pointers to names.\n\t\tif err := pprof.Lookup(\"heap\").WriteTo(f, 1); err != nil {\n\t\t\tlog.Error(\"Could not write memory profile: \", err)\n\t\t}\n\t\tf.Close()\n\t}\n}", "title": "" }, { "docid": "11d36f182799dc2cf4b1ad1949fcdadf", "score": "0.5654778", "text": "func (s *DefaultServer) Start() error {\n\tlog.Println(\"server:\", \"starting\")\n\tif !s.headlessStart {\n\t\tif err := s.api.Login(); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := s.refreshSettings(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\ts.stats.FilesTotal = s.db.Count()\n\ts.stats.Started = time.Now()\n\ts.stats.Uptime = 0\n\n\ts.stop = make(chan bool)\n\tgo s.stopNotificator()\n\n\t// starting event loop\n\ts.wg.Add(1)\n\tgo s.eventLoop()\n\n\t// starting lastUsage update loop\n\ts.wg.Add(1)\n\tgo s.useLoop()\n\n\t// starting removal loop\n\ts.wg.Add(1)\n\tgo s.removeLoop()\n\n\t// starting still alive loop\n\ts.wg.Add(1)\n\tgo s.stillAliveLoop()\n\n\t// starting register loop\n\ts.wg.Add(1)\n\tgo s.registerLoop()\n\n\ts.started = true\n\tlog.Println(\"server:\", \"started\")\n\treturn nil\n}", "title": "" }, { "docid": "890117391aecbfb9def0b1314a29ba0c", "score": "0.56513447", "text": "func (s *Service) Start() {\n\n\tvar params = s.params\n\tvar log = params.Logger\n\n\tlog.Info(\"starting\", tag.Service(common.MatchingServiceName))\n\n\tbase := service.New(params)\n\n\tpConfig := params.PersistenceConfig\n\tpConfig.SetMaxQPS(pConfig.DefaultStore, s.config.PersistenceMaxQPS())\n\tpFactory := client.NewFactory(&pConfig, params.ClusterMetadata.GetCurrentClusterName(), base.GetMetricsClient(), log)\n\n\ttaskPersistence, err := pFactory.NewTaskManager()\n\tif err != nil {\n\t\tlog.Fatal(\"failed to create task persistence\", tag.Error(err))\n\t}\n\n\tmetadata, err := pFactory.NewMetadataManager()\n\tif err != nil {\n\t\tlog.Fatal(\"failed to create metadata manager\", tag.Error(err))\n\t}\n\n\thandler := NewHandler(base, s.config, taskPersistence, metadata)\n\thandler.RegisterHandler()\n\n\t// must start base service first\n\tbase.Start()\n\terr = handler.Start()\n\tif err != nil {\n\t\tlog.Fatal(\"Matching handler failed to start\", tag.Error(err))\n\t}\n\n\tlog.Info(\"started\", tag.Service(common.MatchingServiceName))\n\t<-s.stopC\n\tbase.Stop()\n}", "title": "" }, { "docid": "876d0ea42ca21ed49972daca2ae52056", "score": "0.5645684", "text": "func StartService(tb testing.TB) (*Service, lifxlan.Device) {\n\ttb.Helper()\n\n\ts := &Service{\n\t\tTB: tb,\n\t\tHandlers: make(map[lifxlan.MessageType]HandlerFunc),\n\t\tHandleAcks: true,\n\t}\n\treturn s, s.Start()\n}", "title": "" }, { "docid": "5a9f6f9768653234c228016ebf1c7481", "score": "0.56403923", "text": "func (s *server) Start(srv service.Service) error {\n\t// Start should not block. Do the actual work async.\n\tlog.Info(\"Starting...\")\n\tgo s.run()\n\treturn nil\n}", "title": "" }, { "docid": "cd0d7a8a87619a565d17d1df6124c1bf", "score": "0.5637138", "text": "func (sm *Manager) Start() error {\n\n\t// listen for interrupts or the Linux SIGTERM signal and cancel\n\t// our context, which the leader election code will observe and\n\t// step down\n\tsm.signalChan = make(chan os.Signal, 1)\n\t// Add Notification for Userland interrupt\n\tsignal.Notify(sm.signalChan, syscall.SIGINT)\n\n\t// Add Notification for SIGTERM (sent from Kubernetes)\n\tsignal.Notify(sm.signalChan, syscall.SIGTERM)\n\n\t// Add Notification for SIGKILL (sent from Kubernetes)\n\tsignal.Notify(sm.signalChan, syscall.SIGKILL)\n\n\t// If BGP is enabled then we start a server instance that will broadcast VIPs\n\tif sm.config.EnableBGP {\n\n\t\t// If Annotations have been set then we will look them up\n\t\terr := sm.parseAnnotations()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tlog.Infoln(\"Starting Kube-vip Manager with the BGP engine\")\n\t\tlog.Infof(\"Namespace [%s], Hybrid mode [%t]\", sm.config.Namespace, sm.config.EnableControlPane && sm.config.EnableServices)\n\t\treturn sm.startBGP()\n\t}\n\n\t// If ARP is enabled then we start a LeaderElection that will use ARP to advertise VIPs\n\tif sm.config.EnableARP {\n\t\tlog.Infoln(\"Starting Kube-vip Manager with the ARP engine\")\n\t\tlog.Infof(\"Namespace [%s], Hybrid mode [%t]\", sm.config.Namespace, sm.config.EnableControlPane && sm.config.EnableServices)\n\t\treturn sm.startARP()\n\t}\n\n\tlog.Infoln(\"Prematurely exiting Load-balancer as neither Layer2 or Layer3 is enabled\")\n\treturn nil\n}", "title": "" }, { "docid": "eae53eaae2fd38b65219f5ee8a963c49", "score": "0.5623154", "text": "func Start(name string) {\n\tlog.Printf(\"Noop %s srv is running\", name)\n}", "title": "" }, { "docid": "91ee31c8bbff9d2442bec095ca08af70", "score": "0.56203055", "text": "func (s *OtfLevelService) Start() {\n\n\taddress := fmt.Sprintf(\"%s:%d\", s.serviceHost, s.servicePort)\n\tgo func(addr string) {\n\t\tif err := s.e.Start(addr); err != nil {\n\t\t\ts.e.Logger.Info(\"error starting server: \", err, \", shutting down...\")\n\t\t\t// attempt clean shutdown by raising sig int\n\t\t\tp, _ := os.FindProcess(os.Getpid())\n\t\t\tp.Signal(os.Interrupt)\n\t\t}\n\t}(address)\n\n}", "title": "" }, { "docid": "6aa187cadccb44aca0832eaa433cd616", "score": "0.561385", "text": "func (dman *DevManager) Start() (err error) {\n\tlog.Info(\"Initializing tap device...\\n\")\n\n\teuid := os.Geteuid()\n\tif euid != 0 {\n\t\tlog.Info(\"WARNING: effective uid (%d) is not root: you may have not enough privileges...\\n\", euid)\n\t}\n\n\tdman.tun, err = tuntap.NewTAP(\"\")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"%s\", err)\n\t}\n\tlog.Info(\"... tap device: %s\\n\", dman.tun.Name())\n\n\t// Adding routines to workgroup and running then\n\tfor i := 0; i < dman.numWorkers; i++ {\n\t\tdman.wg.Add(1)\n\t\tgo dman.packetProcessor()\n\t}\n\n\tgo dman.devReader()\n\treturn nil\n}", "title": "" }, { "docid": "2a05c32054cbb33a13b4608ac6c1680d", "score": "0.56039906", "text": "func (p *program) Start(s service.Service) error {\n\tgo p.run()\n\treturn nil\n}", "title": "" }, { "docid": "a99970ca17a788a40b9fab47bf76f5c5", "score": "0.560302", "text": "func (s Service) StartSimple() {\n\tLoadedServicesMu.Lock()\n\ts.State = Starting\n\tLoadedServices[s.Name].State = Starting\n\tLoadedServices[s.Name].LastActionAt = time.Now().UTC().Unix()\n\tLoadedServices[s.Name].LastAction = Start\n\tLoadedServices[s.Name].LastKnownPID = 0\n\tLoadedServicesMu.Unlock()\n\n\tif s.ExecPreStart != \"\" {\n\t\tLoadedServicesMu.Lock()\n\t\tLoadedServices[s.Name].LastActionAt = time.Now().UTC().Unix()\n\t\tLoadedServices[s.Name].LastAction = PreStart\n\t\tLoadedServicesMu.Unlock()\n\n\t\terr := justExecACommand(s.ExecPreStart.String())\n\t\tif err != nil {\n\t\t\tclog.Error(2, \"error in %s ExecPreStart: %s\", s.Name, err.Error())\n\t\t\treturn\n\t\t}\n\t}\n\n\tcmd := exec.Command(\"sh\", \"-c\", s.Startup.String())\n\tcmd.Stderr = os.Stderr\n\tif err := cmd.Start(); err != nil {\n\t\tclog.Error(2, \"[lutra] Service %s exited with error: %s\", s.Name, err.Error())\n\t\tLoadedServicesMu.Lock()\n\t\ts.State = Errored\n\t\tLoadedServices[s.Name].State = Errored\n\t\tLoadedServices[s.Name].LastMessage = err.Error()\n\t\tLoadedServices[s.Name].LastKnownPID = 0\n\t\tLoadedServicesMu.Unlock()\n\t\treturn\n\t}\n\t// Waiting for the command to finish\n\tLoadedServicesMu.Lock()\n\ts.State = Started\n\tLoadedServices[s.Name].State = Started\n\tLoadedServices[s.Name].LastKnownPID = cmd.Process.Pid\n\tLoadedServicesMu.Unlock()\n\tclog.Info(\"[lutra] Started service %s\", s.Name)\n\n\terr := cmd.Wait()\n\tif err != nil {\n\t\tclog.Error(2, \"[lutra] Service %s finished with error: %s\", s.Name, err.Error())\n\t\tLoadedServicesMu.Lock()\n\t\ts.State = Stopped\n\t\tLoadedServices[s.Name].State = Stopped\n\t\tLoadedServices[s.Name].LastMessage = err.Error()\n\t\tLoadedServices[s.Name].LastKnownPID = 0\n\t\tLoadedServicesMu.Unlock()\n\t} else {\n\t\tLoadedServicesMu.Lock()\n\t\ts.State = Stopped\n\t\tclog.Info(\"[lutra] Service stopped:\t %s\", s.Name)\n\t\tLoadedServices[s.Name].State = Stopped\n\t\tLoadedServices[s.Name].LastKnownPID = 0\n\t\tLoadedServices[s.Name].LastActionAt = time.Now().UTC().Unix()\n\t\tLoadedServices[s.Name].LastAction = Stop\n\t\tLoadedServicesMu.Unlock()\n\t}\n\n\tif s.ExecPostStart != \"\" {\n\t\tLoadedServicesMu.Lock()\n\t\tLoadedServices[s.Name].LastActionAt = time.Now().UTC().Unix()\n\t\tLoadedServices[s.Name].LastAction = PostStart\n\t\tLoadedServicesMu.Unlock()\n\n\t\terr := justExecACommand(s.ExecPostStart.String())\n\t\tif err != nil {\n\t\t\tclog.Error(2, \"error in %s ExecPostStart: %s\", s.Name, err.Error())\n\t\t\treturn\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "58a8ee0349ba49ec3f04c62f99b9f4ac", "score": "0.56010884", "text": "func Start() error {\n\terr := srv()\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn err\n\t}\n\tDiscoveryPacket = EncodeDiscoveryPacket(Port)\n\tDecodeDiscoveryPackets(DiscoveryChannel)\n\tprintBucket()\n\treturn nil\n}", "title": "" }, { "docid": "87667437222afa55789ff30e954c5bee", "score": "0.55941343", "text": "func startManagement() {\n\tnaConfig.WorkloadOpts = handler.Options{\n\t\tPathPrefix: CfgWldAPIUdsHome,\n\t\tSockFile: CfgWldSockFile,\n\t\tRegAPI: wlapi.RegisterGrpc,\n\t}\n\tccfg := &naConfig.CAClientConfig\n\tpc, err := platform.NewClient(ccfg.Env, ccfg.RootCertFile, ccfg.KeyFile, ccfg.CertChainFile, ccfg.CAAddress)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create platform client env %v err %v\", ccfg.Env, err)\n\t}\n\tdialOpts, err := pc.GetDialOptions()\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to get dial options %v\", err)\n\t}\n\tgrpcConn, err := protocol.NewGrpcConnection(ccfg.CAAddress, dialOpts)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create create gRPC connection to CA %v %v\", ccfg.CAAddress, err)\n\t}\n\tcaClient, err := caclient.NewCAClient(pc, grpcConn, ccfg.CSRMaxRetries, ccfg.CSRInitialRetrialInterval)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create CAClient %v\", err)\n\t}\n\tmgmtServer, err := registry.New(&naConfig, caClient)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create node agent management server %v\", err)\n\t}\n\tsigc := make(chan os.Signal, 1)\n\tsignal.Notify(sigc, os.Interrupt, syscall.SIGTERM)\n\tgo func(s *registry.Server, c chan os.Signal) {\n\t\t<-c\n\t\ts.Stop()\n\t\ts.WaitDone()\n\t\tos.Exit(1)\n\t}(mgmtServer, sigc)\n\n\tmgmtServer.Serve(CfgMgmtAPIPath)\n}", "title": "" }, { "docid": "37e9e9571170b0971864feaf7fc5b83a", "score": "0.55864704", "text": "func (processCtx *context) Start(msg *wssapi.Msg) (err error) {\n\t//if false {\n\truntime.GOMAXPROCS(runtime.NumCPU())\n\t//}\n\t//httpmux.Start() //remove Logic Design to Start All Service Once\n\tprocessCtx.servicesRWMutex.RLock()\n\tdefer processCtx.servicesRWMutex.RUnlock()\n\n\tif len(processCtx.services) < 1 {\n\t\tlogger.LOGI(\"no service avaiable\")\n\t\treturn errors.New(\"no service avaiable\")\n\t}\n\n\tfor k, v := range processCtx.services {\n\t\t//v.SetParent(processCtx)\n\t\terr = v.Start(nil)\n\t\tif err != nil {\n\t\t\tlogger.LOGE(\"start \" + k + \" failed:\" + err.Error())\n\t\t\tcontinue\n\t\t}\n\t\tlogger.LOGI(\"start \" + k + \" successed \")\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "3a8e77c7999aa51091b06c02e06d6594", "score": "0.556951", "text": "func (s *Service) Start() error {\n\t_, err := s.Commander.Run(\"s6-svc\", \"-u\", s.servicePath())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9361bc3318c53f16680202906a81b7d3", "score": "0.5564091", "text": "func (self *Globule) initServices() {\n\tlog.Println(\"Initialyse services\")\n\n\t// Each service contain a file name config.json that describe service.\n\t// I will keep services info in services map and also it running process.\n\tbasePath, _ := filepath.Abs(filepath.Dir(os.Args[0]))\n\tfilepath.Walk(basePath, func(path string, info os.FileInfo, err error) error {\n\t\tif err == nil && info.Name() == \"config.json\" {\n\t\t\t// println(path, info.Name())\n\t\t\t// So here I will read the content of the file.\n\t\t\ts := make(map[string]interface{})\n\t\t\tconfig, err := ioutil.ReadFile(path)\n\t\t\tif err == nil {\n\t\t\t\t// Read the config file.\n\t\t\t\tjson.Unmarshal(config, &s)\n\t\t\t\tif s[\"Protocol\"].(string) == \"grpc\" {\n\n\t\t\t\t\tpath_ := path[:strings.LastIndex(path, string(os.PathSeparator))]\n\t\t\t\t\tservicePath := path_ + string(os.PathSeparator) + s[\"Name\"].(string)\n\t\t\t\t\tif string(os.PathSeparator) == \"\\\\\" {\n\t\t\t\t\t\tservicePath += \".exe\" // in case of windows.\n\t\t\t\t\t}\n\n\t\t\t\t\t// Start the process.\n\t\t\t\t\tlog.Println(\"try to start process \", s[\"Name\"].(string))\n\t\t\t\t\tif s[\"Name\"].(string) == \"file\" {\n\t\t\t\t\t\ts[\"Process\"] = exec.Command(servicePath, Utility.ToString(s[\"Port\"]), globule.webRoot)\n\t\t\t\t\t} else {\n\t\t\t\t\t\ts[\"Process\"] = exec.Command(servicePath, Utility.ToString(s[\"Port\"]))\n\t\t\t\t\t}\n\n\t\t\t\t\terr = s[\"Process\"].(*exec.Cmd).Start()\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Println(\"Fail to start service: \", s[\"Name\"].(string), \" at port \", s[\"Port\"], \" with error \", err)\n\t\t\t\t\t}\n\n\t\t\t\t\t// Now I will start the proxy that will be use by javascript client.\n\t\t\t\t\tproxyPath := self.path + string(os.PathSeparator) + \"bin\" + string(os.PathSeparator) + \"grpcwebproxy\"\n\t\t\t\t\tif string(os.PathSeparator) == \"\\\\\" {\n\t\t\t\t\t\tproxyPath += \".exe\" // in case of windows.\n\t\t\t\t\t}\n\n\t\t\t\t\t// This is the grpc service to connect with the proxy\n\t\t\t\t\tproxyBackendAddress := \"localhost:\" + Utility.ToString(s[\"Port\"])\n\t\t\t\t\tproxyAllowAllOrgins := Utility.ToString(s[\"AllowAllOrigins\"])\n\n\t\t\t\t\t// start the proxy service.\n\t\t\t\t\ts[\"ProxyProcess\"] = exec.Command(proxyPath, \"--backend_addr=\"+proxyBackendAddress, \"--server_http_debug_port=\"+Utility.ToString(s[\"Proxy\"]), \"--run_tls_server=false\", \"--allow_all_origins=\"+proxyAllowAllOrgins)\n\t\t\t\t\terr = s[\"ProxyProcess\"].(*exec.Cmd).Start()\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Println(\"Fail to start grpcwebproxy: \", s[\"Name\"].(string), \" at port \", s[\"Proxy\"], \" with error \", err)\n\t\t\t\t\t}\n\n\t\t\t\t\tself.services[s[\"Name\"].(string)] = s\n\n\t\t\t\t\ts_ := make(map[string]interface{})\n\n\t\t\t\t\t// export public service values.\n\t\t\t\t\ts_[\"Proxy\"] = s[\"Proxy\"]\n\t\t\t\t\ts_[\"Port\"] = s[\"Port\"]\n\n\t\t\t\t\tself.Services[s[\"Name\"].(string)] = s_\n\t\t\t\t\tself.saveConfig()\n\n\t\t\t\t\tlog.Println(\"Service \", s[\"Name\"].(string), \"is running at port\", s[\"Port\"], \"it's proxy port is\", s[\"Proxy\"])\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "ba428cdd2001c493045b26ebf396bf9b", "score": "0.55639", "text": "func (c *ControlService) Setup() (err error) {\n\tif err = c.nvme.Setup(); err != nil {\n\t\treturn\n\t}\n\tif err = c.scm.Setup(); err != nil {\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "21a0fc89e35e1a28bebc945e2f8df1bf", "score": "0.55627394", "text": "func Start() {\n\n\tinitAgent()\n\n\t//serve REST endpoints used by Console\n\tsetupHttpServer()\n\n\t//search for peer or enable secondary RHs to find it\n\tgo discovery.Monitor()\n\n\t//restart containers that got stopped not by user\n\tgo container.StateRestore()\n\n\t//wait till Console is loaded\n\tfor !consol.IsReady() {\n\t\ttime.Sleep(time.Second * 3)\n\t}\n\n\t//wait till RH gets registered with Console\n\tfor !consol.CheckRegistration() {\n\t\ttime.Sleep(time.Second * 5)\n\t}\n\n\t//below routines should start only when registration with Console is established\n\tgo monitor.Collect()\n\n\t//start sending periodic heartbeats to Console\n\tgo consol.Heartbeats()\n\n\t//todo refactor below\n\tfor {\n\t\tcli.CheckSshTunnels()\n\t\ttime.Sleep(30 * time.Second)\n\t}\n}", "title": "" }, { "docid": "1ab77f005abc15f00e2bff1b9e18d2ab", "score": "0.555065", "text": "func (t *Tunnel) startService() error {\n\tsupervised, err := t.Service.IsSupervised()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !supervised {\n\t\tlog.Infof(\"Registering tunnel %s\", t.Config.Hostname)\n\n\t\terr := t.Service.Supervise()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t}\n\n\trunning, err := t.Service.IsRunning()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif running {\n\t\tlog.Infof(\"Restarting tunnel %s\", t.Config.Hostname)\n\n\t\terr := t.Service.Restart()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tlog.Infof(\"Starting tunnel %s\", t.Config.Hostname)\n\n\t\terr := t.Service.Start()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b9fff0e203ae893cce990959c81854d7", "score": "0.5541507", "text": "func (s *Service) Start() {\n\ts.Running = make(chan bool)\n}", "title": "" }, { "docid": "1c2b8501838b9baa3d63dc24a1445595", "score": "0.55274683", "text": "func start() {\n log.Printf(\"Starting...\")\n daemon.NotifyState(daemon.STATE_STARTING)\n\n args = parseArguments()\n settings = loadConfig(args.ConfigFile)\n\n initApps(settings.DatabaseFile)\n initDevices(settings.DatabaseFile)\n initTriggers(settings.DatabaseFile)\n initDaemon(network.SocketInfo{settings.Socket.Type, settings.Socket.Address})\n\n daemon.NotifyState(daemon.STATE_STARTED)\n log.Printf(\"Started\")\n}", "title": "" }, { "docid": "df22c97732e884a1fa72a48198255621", "score": "0.55253255", "text": "func (p *program) Start(s service.Service) error {\n\t// Start should not block. Do the actual work async.\n\targs := options{runningAsService: true}\n\tgo run(args)\n\treturn nil\n}", "title": "" }, { "docid": "d4ad6f22d43b17cdb0d185cb30cbfba6", "score": "0.5514068", "text": "func (s *TestHttpService) Start() error {\n\tif err := s.startMaster(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := s.startPod(); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "59f991acc4f04020eb306767bf7f6c80", "score": "0.5510886", "text": "func Start(ctx context.Context, path string, port uint, host string, debug bool) {\n\tif err := logutil.SetLevel(\"fatal\"); err != nil {\n\t\tlog.Error(err)\n\t}\n\n\tregisterStores()\n\tregisterMetrics()\n\tloadConfig()\n\n\tcfg.Log.Level = log.GetLevel().String()\n\n\t// cfg.Security.SkipGrantTable = true\n\tif debug {\n\t\tcfg.Log.Level = \"error\"\n\t\thost = \"0.0.0.0\"\n\t}\n\n\tcfg.Path = path\n\tcfg.Store = \"mocktikv\"\n\n\tif host == \"\" {\n\t\thost = \"localhost\"\n\t}\n\n\tcfg.Host = host\n\tcfg.Port = port\n\tcfg.Status.ReportStatus = false\n\n\tvalidateConfig()\n\tsetGlobalVars()\n\tsetupTracing()\n\n\tif debug {\n\t\tprintInfo()\n\t}\n\n\tsetupBinlogClient()\n\t// setupMetrics()\n\tcreateStoreAndDomain()\n\tcreateServer()\n\tgo runServer()\n\n\t<-ctx.Done()\n\tserverShutdown(true)\n\tcleanup()\n\tlog.Info(\"tidb server shutdown complete\")\n}", "title": "" }, { "docid": "980fcaaec37e57b61f41a911dc90741f", "score": "0.55064094", "text": "func Start() error {\n\tlog.Infoln(\"Starting any http load balancing services\")\n\tfor i := range config.Services {\n\t\tif config.Services[i].ServiceType == \"http\" {\n\t\t\tlog.Debugf(\"Starting service [%s]\", config.Services[i].Name)\n\t\t\tcreateHTTPHander(&config.Services[i])\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cd5cee563d6ac3dcff88d4d35ceb5884", "score": "0.55048805", "text": "func Start() {\n\tgo serviceproxy.StartServiceProxy()\n\tgo proxier.StartProxier()\n\tgo dns.StartDNS()\n}", "title": "" }, { "docid": "783465b6c0236faabf8462fc9821593b", "score": "0.55001634", "text": "func Start() {\n\tconfig, err := parseConfig()\n\tif err != nil {\n\t\t_, _ = fmt.Fprintln(os.Stderr, err)\n\n\t\tflag.PrintDefaults()\n\t\tos.Exit(1)\n\t}\n\n\tconfigLogLevel(config.LogLevel)\n\n\tvos.LoadUserEnv()\n\n\t// stop exist servers first\n\tStopLogtail()\n\n\tgo StartLogtail(config)\n\n\tgo func() {\n\t\tif err := http.ListenAndServe(fmt.Sprintf(\":%d\", config.Port), &httpHandler{}); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}()\n\n\thandleSignal()\n}", "title": "" }, { "docid": "b1684be82187ea61537c88499a76ba1a", "score": "0.5499244", "text": "func SystemStart(ctx context.Context, rpcClient UnaryInvoker, req *SystemStartReq) (*SystemStartResp, error) {\n\tif req == nil {\n\t\treturn nil, errors.Errorf(\"nil %T request\", req)\n\t}\n\n\tpbReq := new(mgmtpb.SystemStartReq)\n\tpbReq.Hosts = req.Hosts.String()\n\tpbReq.Ranks = req.Ranks.String()\n\tpbReq.Sys = req.getSystem(rpcClient)\n\n\treq.setRPC(func(ctx context.Context, conn *grpc.ClientConn) (proto.Message, error) {\n\t\treturn mgmtpb.NewMgmtSvcClient(conn).SystemStart(ctx, pbReq)\n\t})\n\n\trpcClient.Debugf(\"DAOS system start request: %s\", pbUtil.Debug(pbReq))\n\tur, err := rpcClient.InvokeUnaryRPC(ctx, req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := new(SystemStartResp)\n\treturn resp, convertMSResponse(ur, resp)\n}", "title": "" }, { "docid": "d3bfeb8ff0ca8981dd8e2f8a16699110", "score": "0.5495253", "text": "func Run(service Service) error {\n\tenv := environment{}\n\tif err := service.Init(env); err != nil {\n\t\treturn err\n\t}\n\n\tif err := service.Start(); err != nil {\n\t\treturn err\n\t}\n\n\tsignalChan := make(chan os.Signal, 1)\n\tsignalNotify(signalChan, os.Interrupt, os.Kill)\n\t<-signalChan\n\n\treturn service.Stop()\n}", "title": "" }, { "docid": "8fe4c41d25b7fada61baec2ea1a66dd1", "score": "0.54929835", "text": "func (d *Driver) Start() error {\n\ts, err := d.GetState()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"get kic state\")\n\t}\n\tif s == state.Stopped {\n\t\tcmd := exec.Command(d.OciBinary, \"start\", d.MachineName)\n\t\tif err := cmd.Run(); err != nil {\n\t\t\treturn errors.Wrapf(err, \"starting a stopped kic node %s\", d.MachineName)\n\t\t}\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"cant start a not-stopped (%s) kic node\", s)\n}", "title": "" }, { "docid": "80b1ceae36fd1495de05204dd32b30f7", "score": "0.5491227", "text": "func StartServices() {\n\tconfig, err := config.FromEnv()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tapi := master.NewCursorMaster(config)\n\tgrpcServer := master.CreateGRPCServer(api)\n\n\tmaster.InitGRPCService(config, grpcServer)\n}", "title": "" }, { "docid": "dea95436f1890aa04532d8217afd0152", "score": "0.5478997", "text": "func (s *Service) StartService() {\n\terr := s.Init()\n\tif err != nil {\n\t\tutils.Logger().Error().Err(err).Msg(\"Service Init Failed\")\n\t\treturn\n\t}\n\ts.Run()\n\ts.started = true\n}", "title": "" }, { "docid": "132168d22fcb96324b8cfef90a6af1a2", "score": "0.5473799", "text": "func (s *Service) StartService() {\n\ts.stopChan = make(chan struct{})\n\ts.stoppedChan = make(chan struct{})\n\ts.DRand.WaitForEpochBlock(s.DRand.ConfirmedBlockChannel, s.stopChan, s.stoppedChan)\n}", "title": "" }, { "docid": "23d758b4fb372807eea5a7130a1e2281", "score": "0.54706985", "text": "func (computeSystem *System) Start(ctx context.Context) (err error) {\n\toperation := \"hcs::System::Start\"\n\n\t// hcsStartComputeSystemContext is an async operation. Start the outer span\n\t// here to measure the full start time.\n\tctx, span := trace.StartSpan(ctx, operation)\n\tdefer span.End()\n\tdefer func() { oc.SetSpanStatus(span, err) }()\n\tspan.AddAttributes(trace.StringAttribute(\"cid\", computeSystem.id))\n\n\tcomputeSystem.handleLock.RLock()\n\tdefer computeSystem.handleLock.RUnlock()\n\n\tif computeSystem.handle == 0 {\n\t\treturn makeSystemError(computeSystem, operation, ErrAlreadyClosed, nil)\n\t}\n\n\tresultJSON, err := vmcompute.HcsStartComputeSystem(ctx, computeSystem.handle, \"\")\n\tevents, err := processAsyncHcsResult(ctx, err, resultJSON, computeSystem.callbackNumber, hcsNotificationSystemStartCompleted, &timeout.SystemStart)\n\tif err != nil {\n\t\treturn makeSystemError(computeSystem, operation, err, events)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "539a45de77c60901b68efc68c086bdc8", "score": "0.54605734", "text": "func (s *Stream) Start(shutdown chan struct{}) {\n\tdefer func() {\n\t\tif err := recover(); err != nil {\n\t\t\tmisc.PrintStack(false)\n\t\t\tVLogger.Fatal(\"Stream fatal error \", zap.Error(err.(error)))\n\t\t}\n\t}()\n\n\tpprofStart()\n\n\ts.controller.Start()\n\n\ts.alarmer.Start()\n\n\tgo s.grpc.Start()\n\n\t// start plugins service\n\tfor _, c := range Conf.Inputs {\n\t\tc.Start(s.stopPluginsChan, s.metricChan)\n\t}\n\n\tfor _, c := range Conf.Outputs {\n\t\tif err := c.Output.Start(); err != nil {\n\t\t\tVLogger.Panic(\"Output\", zap.String(\"@Name\", c.Name), zap.Error(err))\n\t\t}\n\t}\n\n\tfor _, c := range Conf.Chains {\n\t\tc.Start(s.stopPluginsChan)\n\t}\n\n\tfor _, c := range Conf.MetricOutputs {\n\t\tc.Start(s.stopPluginsChan)\n\t}\n}", "title": "" }, { "docid": "eb9edf0581fe7a4a3949a134c040db28", "score": "0.54579026", "text": "func (ddm *DummyDeviceManager) Start() error {\n\terr := ddm.cleanup()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsock, err := net.Listen(\"unix\", ddm.socket)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tddm.server = grpc.NewServer([]grpc.ServerOption{}...)\n\tpluginapi.RegisterDevicePluginServer(ddm.server, ddm)\n\n\tgo ddm.server.Serve(sock)\n\n\t// Wait for server to start by launching a blocking connection\n\tconn, err := grpc.Dial(ddm.socket, grpc.WithInsecure(), grpc.WithBlock(),\n\t\tgrpc.WithTimeout(5*time.Second),\n\t\tgrpc.WithDialer(func(addr string, timeout time.Duration) (net.Conn, error) {\n\t\t\treturn net.DialTimeout(\"unix\", addr, timeout)\n\t\t}),\n\t)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tconn.Close()\n\n\tgo ddm.healthcheck()\n\n\treturn nil\n}", "title": "" }, { "docid": "18c808a8d433db4847b15d332640d57e", "score": "0.54541445", "text": "func Run() {\n\tprocessContext.Init(nil)\n\tprocessContext.createAllService(nil)\n\tprocessContext.Start(nil)\n}", "title": "" }, { "docid": "3d75a13be3e1ac8358b899dedd20b23a", "score": "0.54512817", "text": "func (c context) start(wait time.Duration, delay time.Duration) error {\n\tprocPaths, err := c.lookupProcessPaths()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := OpenAppDarwin(procPaths.appPath, c.log); err != nil {\n\t\tc.log.Warningf(\"Error opening app: %s\", err)\n\t}\n\n\t// Check to make sure processes started\n\tc.log.Debugf(\"Checking processes: %#v\", procPaths)\n\tserviceProcErr := c.checkProcess(procPaths.serviceProcPath, wait, delay)\n\tkbfsProcErr := c.checkProcess(procPaths.kbfsProcPath, wait, delay)\n\tappProcErr := c.checkProcess(procPaths.appProcPath, wait, delay)\n\n\treturn util.CombineErrors(serviceProcErr, kbfsProcErr, appProcErr)\n}", "title": "" }, { "docid": "c29fb5e0ae6194388bba213a0c1e1328", "score": "0.5450238", "text": "func startHTTPService(d *Dumper) error {\n\tconf := d.conf\n\tif conf.StatusAddr != \"\" {\n\t\tgo func() {\n\t\t\terr := startDumplingService(d.tctx, conf.StatusAddr)\n\t\t\tif err != nil {\n\t\t\t\td.L().Info(\"meet error when stopping dumpling http service\", log.ShortError(err))\n\t\t\t}\n\t\t}()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4f61722c9a308d23e8a301ac811014b5", "score": "0.54462653", "text": "func (mp *mountProbe) Start() {}", "title": "" }, { "docid": "a4cf9ab68b7699ff93ee7d91597ece5e", "score": "0.54359466", "text": "func TestStart(t *testing.T) {\n\ts := SetUpSuite(t)\n\n\t// Fetch the services.App that the service heartbeat.\n\tservers, err := s.authServer.AuthServer.GetApplicationServers(s.closeContext, defaults.Namespace)\n\trequire.NoError(t, err)\n\n\t// Check that the services.Server sent via heartbeat is correct. For example,\n\t// check that the dynamic labels have been evaluated.\n\tappFoo := s.appFoo.Copy()\n\tappAWS := s.appAWS.Copy()\n\n\tappFoo.SetDynamicLabels(map[string]types.CommandLabel{\n\t\tdynamicLabelName: &types.CommandLabelV2{\n\t\t\tPeriod: dynamicLabelPeriod,\n\t\t\tCommand: dynamicLabelCommand,\n\t\t\tResult: \"4\",\n\t\t},\n\t})\n\n\tserverFoo, err := types.NewAppServerV3FromApp(appFoo, \"test\", s.hostUUID)\n\trequire.NoError(t, err)\n\tserverAWS, err := types.NewAppServerV3FromApp(appAWS, \"test\", s.hostUUID)\n\trequire.NoError(t, err)\n\n\tsort.Sort(types.AppServers(servers))\n\trequire.Empty(t, cmp.Diff([]types.AppServer{serverAWS, serverFoo}, servers,\n\t\tcmpopts.IgnoreFields(types.Metadata{}, \"ID\", \"Expires\")))\n\n\t// Check the expiry time is correct.\n\tfor _, server := range servers {\n\t\trequire.True(t, s.clock.Now().Before(server.Expiry()))\n\t\trequire.True(t, s.clock.Now().Add(2*defaults.ServerAnnounceTTL).After(server.Expiry()))\n\t}\n}", "title": "" }, { "docid": "6f9b2d3cf74cadbcf32ad70ed01bfc72", "score": "0.542448", "text": "func (s *state) Start() {\n\ts.ctxt.WaitGroup.Done()\n}", "title": "" }, { "docid": "b2edf3566fcaea8d5b8dab472d9993eb", "score": "0.54235554", "text": "func StartStakepooldService(c chan struct{}, server *grpc.Server) {\n\tpb.RegisterStakepooldServiceServer(server, &stakepooldServer{\n\t\tc: c,\n\t})\n}", "title": "" }, { "docid": "2c5173e638e8fc944515bccc61e83bcf", "score": "0.5419434", "text": "func (d *golangInstallerInUbuntu) Start() error {\n\tfmt.Println(\"not supported yet\")\n\treturn nil\n}", "title": "" }, { "docid": "bedd3d231a2fa73929493ab9eaff1b14", "score": "0.5418999", "text": "func (s *ThriftServer) Start(clientCreator thriftClientCreator, sw switcher, registerTProcessor processorRegister) {\n\tlog.Info(\"Starting Turbo...\")\n\ts.Initializer.InitService(s)\n\ts.thriftServer = s.startThriftServiceInternal(registerTProcessor, false)\n\ttime.Sleep(time.Second * 1)\n\ts.httpServer = s.startThriftHTTPServerInternal(clientCreator, sw)\n\twatchConfigReload(s)\n}", "title": "" }, { "docid": "f07f8d4ca19494c8f979b1eed27c0cf6", "score": "0.5418654", "text": "func (s *server) Start() {\n\tfmt.Printf(\" * VERSION = %+v\\n\", s.version)\n\ts.metrics.promVersion.With(prometheus.Labels{\"version\": string(s.version)})\n\n\t// Start the error kernel that will do all the error handling\n\t// that is not done within a process.\n\ts.errorKernel = newErrorKernel(s.ctx)\n\n\tgo func() {\n\t\terr := s.errorKernel.start(s.newMessagesCh)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"%v\\n\", err)\n\t\t}\n\t}()\n\n\t// Start collecting the metrics\n\tgo func() {\n\t\terr := s.metrics.start()\n\t\tif err != nil {\n\t\t\tlog.Printf(\"%v\\n\", err)\n\t\t\tos.Exit(1)\n\t\t}\n\t}()\n\n\t// Start the checking the input socket for new messages from operator.\n\tgo s.readSocket()\n\n\t// Check if we should start the tcp listener for new messages from operator.\n\tif s.configuration.TCPListener != \"\" {\n\t\tgo s.readTCPListener()\n\t}\n\n\t// Check if we should start the http listener for new messages from operator.\n\tif s.configuration.HTTPListener != \"\" {\n\t\tgo s.readHttpListener()\n\t}\n\n\t// Start up the predefined subscribers.\n\t//\n\t// Since all the logic to handle processes are tied to the process\n\t// struct, we need to create an initial process to start the rest.\n\t//\n\t// NB: The context of the initial process are set in processes.Start.\n\tsub := newSubject(REQInitial, s.nodeName)\n\tp := newProcess(context.TODO(), s.metrics, s.natsConn, s.processes, s.newMessagesCh, s.configuration, sub, s.errorKernel.errorCh, \"\", nil)\n\t// Start all wanted subscriber processes.\n\ts.processes.Start(p)\n\n\ttime.Sleep(time.Second * 1)\n\ts.processes.printProcessesMap()\n\n\t// Start exposing the the data folder via HTTP if flag is set.\n\tif s.configuration.ExposeDataFolder != \"\" {\n\t\tlog.Printf(\"info: Starting expose of data folder via HTTP\\n\")\n\t\tgo s.exposeDataFolder(s.ctx)\n\t}\n\n\t// Start the processing of new messages from an input channel.\n\ts.routeMessagesToProcess(\"./incomingBuffer.db\")\n\n}", "title": "" }, { "docid": "4a020ec38e80c5a2fd13ca55b8699653", "score": "0.5417822", "text": "func (s *Server) Start(cmd *cobra.Command, args []string) {\n\tStart(s.Config, s.Metrics)\n\treturn\n\n}", "title": "" }, { "docid": "b74bf2a35c174d2dbd1384e4eea03a8f", "score": "0.54153955", "text": "func (s *Service) Start(url string, opts *Options) {\n\ts.mutex.Lock()\n\tdefer s.mutex.Unlock()\n\n\t// return if already started\n\tif s.state.get() == serviceStarted {\n\t\treturn\n\t}\n\n\t// set state\n\ts.state.set(serviceStarted)\n\n\t// save configuration\n\ts.broker = url\n\ts.options = opts\n\n\t// initialize backoff\n\ts.backoff = &backoff.Backoff{\n\t\tMin: s.MinReconnectDelay,\n\t\tMax: s.MaxReconnectDelay,\n\t\tFactor: 2,\n\t}\n\n\t// mark future store as protected\n\ts.futureStore.protect(true)\n\n\t// create new tomb\n\ts.tomb = &tomb.Tomb{}\n\n\t// start supervisor\n\ts.tomb.Go(s.supervisor)\n}", "title": "" }, { "docid": "eb741ec9099cc51c3c4cfe8b8b91760b", "score": "0.5413245", "text": "func StartSystem(path, composeFile string, services map[string]dockerCompose.Service, mocked []IServer, log log.ILog, systemLogs bool) (ISystem, error) {\n\tfile := dockerCompose.File{\n\t\tVersion: \"2.2\",\n\t\tServices: services,\n\t}\n\n\tvar mockedServers []*server\n\tfor _, item := range mocked {\n\t\tmockedServer, ok := item.(*server)\n\t\tif ok {\n\t\t\tmockedServers = append(mockedServers, mockedServer)\n\t\t}\n\t}\n\n\tvar composeFilePath = fmt.Sprintf(\"%s/%s\", path, composeFile)\n\n\tvar err error\n\tfor _, mockedServer := range mockedServers {\n\t\tfile.Services[mockedServer.name], err = mockedServer.buildComposeService(path)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tif err := file.SaveFile(composeFilePath); err != nil {\n\t\treturn nil, err\n\t}\n\n\tcompose := dockerCompose.CreateFile(composeFilePath)\n\n\tlog.Printf(\"Starting up %s\", composeFilePath)\n\tif err := compose.Up(); err != nil {\n\t\terr := os.Remove(composeFilePath)\n\t\tif err != nil {\n\t\t\tlog.Error(err)\n\t\t}\n\n\t\treturn nil, err\n\t}\n\n\tif systemLogs {\n\t\t// Attach to Docker images loggers\n\t\tlog.Printf(\"Connecting to logging up %s\", composeFilePath)\n\t\tfor key := range services {\n\t\t\tif err := compose.LogService(key); err != nil {\n\t\t\t\terr := compose.Down()\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Error(err)\n\t\t\t\t}\n\n\t\t\t\terr = os.Remove(composeFilePath)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Error(err)\n\t\t\t\t}\n\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\n\tfor _, servers := range mockedServers {\n\t\terr := servers.attachToLogs(compose)\n\t\tif err != nil {\n\t\t\tlog.Error(err)\n\t\t}\n\t}\n\n\t<-time.After(10 * time.Second) // give some time for the servers to start up\n\n\treturn &system{compose, mockedServers, composeFilePath, log}, nil\n}", "title": "" }, { "docid": "19146c0857ea886b8451e43a76f6bce2", "score": "0.5410249", "text": "func (s *Service) Start() error {\n\ts.instances = make([]*ServiceInstance, s.Count)\n\tfor i := 0; i < s.Count; i++ {\n\t\tinstance, err := startServiceInstance(s, fmt.Sprintf(\"%s-%d\", s.Name, i))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\ts.instances[i] = instance\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1911b8d465b38b6247352239e7e5c85a", "score": "0.5408967", "text": "func main() {\n\tvar s service\n\ts.configure()\n\n\terr := s.init()\n\tif err != nil {\n\t\ts.logger.Crit(\"initializing\", \"err\", err)\n\t\tos.Exit(1)\n\t}\n\n\tctx, cancel := context.WithCancel(context.Background())\n\tgo func() {\n\t\tsignals := make(chan os.Signal, 2)\n\t\tsignal.Notify(signals, os.Interrupt, os.Kill)\n\t\t<-signals\n\t\tcancel()\n\t}()\n\n\ts.run(ctx)\n}", "title": "" }, { "docid": "f2163fcd066c575c35bb6288fbd16d5e", "score": "0.54028606", "text": "func (k2c *Kube2Consul) Start() {\n\tgo k2c.endpointsController.Run(wait.NeverStop)\n\tgo k2c.serviceController.Run(wait.NeverStop)\n\tk2c.waitForKubernetesService()\n}", "title": "" }, { "docid": "be4f550e30e00ceb54a04cbc423f1b8f", "score": "0.5395699", "text": "func (vm *VM) Start() error {\n\ts, err := vm.getService()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn s.start()\n}", "title": "" }, { "docid": "dc464c7642af17ab5501d27d63aa3ebd", "score": "0.53913754", "text": "func StartServer(connParams sqldb.ConnParams, schemaOverrides []tabletserver.SchemaOverride) error {\n\tdbcfgs := dbconfigs.DBConfigs{\n\t\tApp: dbconfigs.DBConfig{\n\t\t\tConnParams: connParams,\n\t\t\tKeyspace: \"vttest\",\n\t\t\tShard: \"0\",\n\t\t},\n\t}\n\n\tmysqld := mysqlctl.NewMysqld(\n\t\t\"Dba\",\n\t\t\"App\",\n\t\t&mysqlctl.Mycnf{},\n\t\t&dbcfgs.Dba,\n\t\t&dbcfgs.App.ConnParams,\n\t\t&dbcfgs.Repl)\n\n\tBaseConfig = tabletserver.DefaultQsConfig\n\tBaseConfig.RowCache.Enabled = true\n\tBaseConfig.RowCache.Binary = vttest.MemcachedPath()\n\tBaseConfig.RowCache.Socket = path.Join(os.TempDir(), \"memcache.sock\")\n\tBaseConfig.RowCache.Connections = 100\n\tBaseConfig.EnableAutoCommit = true\n\tBaseConfig.StrictTableAcl = true\n\n\tTarget = querypb.Target{\n\t\tKeyspace: \"vttest\",\n\t\tShard: \"0\",\n\t\tTabletType: topodatapb.TabletType_MASTER,\n\t}\n\n\tServer = tabletserver.NewTabletServer(BaseConfig)\n\tServer.Register()\n\terr := Server.StartService(Target, dbcfgs, schemaOverrides, mysqld)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not start service: %v\\n\", err)\n\t}\n\n\t// Start http service.\n\tln, err := net.Listen(\"tcp\", \":0\")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not start listener: %v\\n\", err)\n\t}\n\tServerAddress = fmt.Sprintf(\"http://%s\", ln.Addr().String())\n\tgo http.Serve(ln, nil)\n\tfor {\n\t\ttime.Sleep(10 * time.Millisecond)\n\t\tresponse, err := http.Get(fmt.Sprintf(\"%s/debug/vars\", ServerAddress))\n\t\tif err == nil {\n\t\t\tresponse.Body.Close()\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1cfe27aee236c946485fd90117e1c4d7", "score": "0.5388401", "text": "func (d *Dummy) Start() error {\n\tlog.Printf(\"Starting dummy light %s controller\\n\", d.Name)\n\treturn nil\n}", "title": "" }, { "docid": "27b85c428480233d0a5959147796b0b4", "score": "0.5373994", "text": "func (s *Server) Start(stop <-chan struct{}) {\n\taerakiLog.Info(\"Staring Aeraki Server\")\n\n\tgo func() {\n\t\taerakiLog.Infof(\"Starting Envoy Filter Controller\")\n\t\ts.envoyFilterController.Run(stop)\n\t}()\n\n\tgo func() {\n\t\taerakiLog.Infof(\"Watching xDS resource changes at %s\", s.args.IstiodAddr)\n\t\ts.configController.Run(stop)\n\t}()\n\n\tctx, cancel := context.WithCancel(context.Background())\n\ts.stopCRDController = cancel\n\tgo func() {\n\t\t_ = s.crdController.Start(ctx)\n\t}()\n\n\ts.waitForShutdown(stop)\n}", "title": "" }, { "docid": "7d23f262534fe2db35e88c6787bb3a3b", "score": "0.53719866", "text": "func (ts *testServerImpl) Start() error {\n\tts.mu.Lock()\n\tif ts.serverState != stateNew {\n\t\tts.mu.Unlock()\n\t\tswitch ts.serverState {\n\t\tcase stateRunning:\n\t\t\treturn nil // No-op if server is already running.\n\t\tcase stateStopped, stateFailed:\n\t\t\t// Start() can only be called once.\n\t\t\treturn errors.New(\n\t\t\t\t\"`Start()` cannot be used to restart a stopped or failed server. \" +\n\t\t\t\t\t\"Please use NewTestServer()\")\n\t\t}\n\t}\n\tts.serverState = stateRunning\n\tts.mu.Unlock()\n\n\tfor i := 0; i < ts.serverArgs.numNodes; i++ {\n\t\tif err := ts.StartNode(i); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif ts.serverArgs.numNodes > 1 {\n\t\terr := ts.CockroachInit()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5a4ab3ef19748619486a171650099e58", "score": "0.5366623", "text": "func runService(control Control, service Service) {\n\tdefer control.close()\n\tdefer recoveryStopper(control)\n\tcontrol.status <- Status{Starting, nil, time.Now()}\n\tdetail := service.Run(control)\n\tcontrol.status <- Status{Stopped, detail, time.Now()}\n}", "title": "" }, { "docid": "eafa2e0c616a8b28ad063bf3aeab7280", "score": "0.5359659", "text": "func EnableAndStartCommandHints(sf ServiceDefinition) string {\n\tmaybeUserArg := func() string {\n\t\tif sf.userService {\n\t\t\treturn \" --user\"\n\t\t} else {\n\t\t\treturn \"\"\n\t\t}\n\t}()\n\n\tfilePath, err := unitfilePath(sf)\n\tif err != nil { // shouldn't, because this is usually called after successful Install()\n\t\treturn fmt.Sprintf(\"ERROR: %s\", err.Error())\n\t}\n\n\treturn strings.Join([]string{\n\t\t\"Wrote unit file to \" + filePath,\n\t\t\"Run to enable on boot & to start (--)now:\",\n\t\t\"\t$ systemctl\" + maybeUserArg + \" enable --now \" + sf.serviceName,\n\t\t\"Verify successful start:\",\n\t\t\"\t$ systemctl\" + maybeUserArg + \" status \" + sf.serviceName,\n\t}, \"\\n\")\n}", "title": "" }, { "docid": "109eb1a1f3a9ff811f287af8b0415d4a", "score": "0.53554213", "text": "func (w *Worker) Start() {\n\tw.stopCh = make(chan interface{})\n\n\tfor {\n\t\tselect {\n\t\tcase <-w.stopCh:\n\t\t\treturn\n\n\t\tcase services := <-w.serviceCh:\n\t\t\tlog.Info(\"Got services\")\n\n\t\t\tclusters := make([]Cluster, 0)\n\n\t\t\tfor name := range services {\n\t\t\t\tclusters = append(clusters, Cluster{\n\t\t\t\t\tName: name,\n\t\t\t\t\tServiceName: name,\n\t\t\t\t\tType: \"sds\",\n\t\t\t\t\tLBtype: \"least_request\",\n\t\t\t\t\tConnectTimeoutMS: 3 * time.Minute,\n\t\t\t\t\tOutlierDetection: &OutlierDetection{},\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tw.response = Response{Clusters: clusters}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0bba21dfaf1fd97e94178fef78242bda", "score": "0.53538066", "text": "func (ds *DiscoveryService) Start(shutdownSignal <-chan struct{}) {\n\tds.host.Network().Notify((*dsNotifiee)(ds))\n\t// if you look very close, you can see that Bootstrap doesn't even use the context,\n\t// genius, isn't it?\n\tif err := ds.dht.Bootstrap(context.Background()); err != nil {\n\t\tpanic(err)\n\t}\n\ttimeutil.NewTicker(ds.discover, ds.opts.AdvertiseInterval, shutdownSignal)\n\tds.dhtCtxCancel()\n\tds.host.Network().StopNotify((*dsNotifiee)(ds))\n}", "title": "" }, { "docid": "2146919d65ef7fa1e239604a89120dba", "score": "0.53491634", "text": "func (bas *BaseService) Start() error {\n\tif bas.started {\n\t\treturn errors.New(bas.name + \" has already been started\")\n\t} else if bas.stopped {\n\t\treturn errors.New(bas.name + \" has been stopped\")\n\t}\n\tbas.started = true\n\tgo bas.processRequests()\n\treturn bas.service.OnStart()\n}", "title": "" }, { "docid": "bc0675221a5d3de5d6ac44aa2b46c963", "score": "0.5349124", "text": "func Start(config *config.Config, metrics *metrics.Metrics) {\n\tconfig.Server.EnableLogging()\n\n\tconfig.Log.Debugf(\"internal.app.cmd.server.Start called with -> config(%+v) and metrics->(%+v)\", config, metrics)\n\tl := config.Log.WithFields(log.Fields{\n\t\t\"docroot\": config.Server.RootFolder,\n\t\t\"cache\": config.Server.CacheFolder,\n\t\t\"port\": config.Server.ListenPort,\n\t})\n\n\ts := server.NewServer(config, metrics)\n\n\ts.EnableDefaultRouter()\n\n\tgo func() {\n\t\tfor {\n\t\t\ttime.Sleep(15 * time.Minute)\n\t\t\tconfig.Server.DumpMetrics()\n\t\t}\n\t}()\n\n\tl.Info(\"starting server\")\n\t_ = s.ListenAndServe()\n\tl.Info(\"server stopped.\")\n\n\tl.Info(\"dumping metrics for server\")\n\tconfig.Server.DumpMetrics()\n\n\treturn\n}", "title": "" }, { "docid": "7ac69f11b2dac2e749e7980a78a825a9", "score": "0.5346711", "text": "func (a *Agent) Start() error {\n\tlog.Println(\"Registering the agent service with Consul...\")\n\terr := a.registerConsulService()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"could not register consul service\")\n\t}\n\tlog.Println(\"Consul service registered.\")\n\n\tdefer func() {\n\t\tlog.Println(\"De-registering the agent service with Consul...\")\n\t\terr := a.consul.Agent().ServiceDeregister(a.cfg.InstanceName)\n\t\tif err != nil {\n\t\t\tlog.Println(\"An error occurred while trying to deregisterConsulService the agent service with Consul:\", err)\n\t\t} else {\n\t\t\tlog.Println(\"Consul service de-registered.\")\n\t\t}\n\t}()\n\n\tvar wg sync.WaitGroup\n\n\twg.Add(1)\n\n\tgo func(wg *sync.WaitGroup) {\n\t\tlog.Println(\"Starting Discover loop...\")\n\t\tdefer wg.Done()\n\t\ta.startDiscoverTicker()\n\t\tlog.Println(\"Discover loop stopped.\")\n\t}(&wg)\n\n\twg.Add(1)\n\tgo func(wg *sync.WaitGroup) {\n\t\tlog.Println(\"Starting consul-template loop...\")\n\t\tdefer wg.Done()\n\t\ta.startConsulTemplate()\n\t\tlog.Println(\"consul-template loop stopped.\")\n\t}(&wg)\n\n\tstoreAgentMetadata(a.consul, version.Version)\n\n\twg.Wait()\n\n\treturn nil\n}", "title": "" }, { "docid": "dad38b33b846a39620cf43a617521917", "score": "0.5344739", "text": "func Start(opts ...Option) error {\n\tc := newConfig(opts...)\n\tif c.MeterProvider == nil {\n\t\tc.MeterProvider = otel.GetMeterProvider()\n\t}\n\tmeter := c.MeterProvider.Meter(\n\t\tLibraryName,\n\t)\n\n\tr := newBuiltinRuntime(meter, metrics.All, metrics.Read)\n\treturn r.register(expectRuntimeMetrics())\n}", "title": "" }, { "docid": "0677a6bdb1801a17d9fb003d7df1aeeb", "score": "0.5343342", "text": "func TestStart(t *testing.T) {\n\tgb := New()\n\n\tgo func() {\n\t\ttime.Sleep(1000 * time.Millisecond)\n\t\tgb.Stop()\n\t}()\n\n\tgb.Start(\":3010\")\n}", "title": "" }, { "docid": "8b08572104136bab6fb89a74cf866bd8", "score": "0.53406024", "text": "func (d *Driver) Start() error {\n\tif len(d.VMID) < 1 {\n\t\treturn errors.New(\"invalid VMID\")\n\t}\n\n\terr := d.connectAPI()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// sanity check the UUID\n\tconfig, err := d.driver.GetConfig(d.Node, d.VMID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcVMMUUID := getUUIDFromSmbios1(config.Data.Smbios1)\n\tif len(d.VMUUID) > 1 && d.VMUUID != cVMMUUID {\n\t\treturn fmt.Errorf(\"UUID mismatch - %s (stored) vs %s (current)\", d.VMUUID, cVMMUUID)\n\t}\n\n\ttaskid, err := d.driver.NodesNodeQemuVMIDStatusStartPost(d.Node, d.VMID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = d.driver.WaitForTaskToComplete(d.Node, taskid)\n\n\treturn err\n}", "title": "" }, { "docid": "86f03888c16d4bc4aac00db038de0178", "score": "0.53365946", "text": "func main() {\n\tif err := readConfig(); err != nil {\n\t\tif _, ok := err.(viper.ConfigFileNotFoundError); ok {\n\t\t\t// Config file not found; ignore error if desired\n\t\t\tclog.Output(1, \"Start using default setings\")\n\t\t} else {\n\t\t\tclog.Fatal(err)\n\t\t\treturn\n\t\t}\n\t}\n\n\tsvcConfig := &service1.Config{\n\t\tName: \"Cycle\",\n\t\tDisplayName: \"Cycle Service\",\n\t\tDescription: \"Helper service for PhotoCycle\",\n\t}\n\tprg := &program{}\n\ts, err := service1.New(prg, svcConfig)\n\tif err != nil {\n\t\tclog.Fatal(err)\n\t}\n\tif len(os.Args) > 1 {\n\t\terr = service1.Control(s, os.Args[1])\n\t\tif err != nil {\n\t\t\tclog.Fatal(err)\n\t\t}\n\t\treturn\n\t}\n\tdLogger, err = s.Logger(nil)\n\tif err != nil {\n\t\tclog.Fatal(err)\n\t}\n\terr = s.Run()\n\tif err != nil {\n\t\tdLogger.Error(err)\n\t}\n}", "title": "" }, { "docid": "b068219b7d3725b2740ee9a66a249ff4", "score": "0.53284156", "text": "func (core *coreService) Start() error {\n\tif err := core.bc.AddSubscriber(core.readCache); err != nil {\n\t\treturn errors.Wrap(err, \"failed to add readCache\")\n\t}\n\tif err := core.bc.AddSubscriber(core.chainListener); err != nil {\n\t\treturn errors.Wrap(err, \"failed to add chainListener\")\n\t}\n\tif err := core.chainListener.Start(); err != nil {\n\t\treturn errors.Wrap(err, \"failed to start blockchain listener\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4451a7b79ddb616a52480ca835e4c7bc", "score": "0.5324819", "text": "func (s Simulator) Start() {\n\ts.lock.RLock()\n\ts.Log().Info(s.state)\n\tswitch s.state {\n\tcase Interrupted, Finished, Fatal:\n\t\ts.Log().Info(\"Simulator already Interrupted | Fatal | Finished\")\n\t\tbreak\n\tcase Active:\n\t\ts.Log().Info(\"Simulator already Active\")\n\t\tbreak\n\tdefault:\n\t\ts.stateChan <- Active\n\t}\n\ts.lock.RUnlock()\n}", "title": "" }, { "docid": "ef96c7017695830ca6e227c52579e637", "score": "0.5318646", "text": "func (m *Manager) Start(ctx context.Context) {\n\tm.Status(ctx).Log()\n}", "title": "" }, { "docid": "623198444cde0f41a6dbc95901d68012", "score": "0.5317715", "text": "func (c *client) start(configuration []Configuration, namespace Namespace) {\n\tif Disabled() {\n\t\treturn\n\t}\n\tif c.started {\n\t\tlog(\"attempted to start telemetry client when client has already started - ignoring attempt\")\n\t\treturn\n\t}\n\t// Don't start the telemetry client if there is some error configuring the client with fallback\n\t// options, e.g. an API key was not found but agentless telemetry is expected.\n\tif err := c.fallbackOps(); err != nil {\n\t\tlog(err.Error())\n\t\treturn\n\t}\n\n\tc.started = true\n\tc.metrics = make(map[Namespace]map[string]*metric)\n\tc.debug = internal.BoolEnv(\"DD_INSTRUMENTATION_TELEMETRY_DEBUG\", false)\n\n\tproductInfo := Products{\n\t\tAppSec: ProductDetails{\n\t\t\tVersion: version.Tag,\n\t\t\tEnabled: appsec.Enabled(),\n\t\t},\n\t}\n\tproductInfo.Profiler = ProductDetails{\n\t\tVersion: version.Tag,\n\t\t// if the profiler is the one starting the telemetry client,\n\t\t// then profiling is enabled\n\t\tEnabled: namespace == NamespaceProfilers,\n\t}\n\tpayload := &AppStarted{\n\t\tConfiguration: configuration,\n\t\tProducts: productInfo,\n\t}\n\tappStarted := c.newRequest(RequestTypeAppStarted)\n\tappStarted.Body.Payload = payload\n\tc.scheduleSubmit(appStarted)\n\n\tif collectDependencies() {\n\t\tvar depPayload Dependencies\n\t\tif deps, ok := debug.ReadBuildInfo(); ok {\n\t\t\tfor _, dep := range deps.Deps {\n\t\t\t\tdepPayload.Dependencies = append(depPayload.Dependencies,\n\t\t\t\t\tDependency{\n\t\t\t\t\t\tName: dep.Path,\n\t\t\t\t\t\tVersion: strings.TrimPrefix(dep.Version, \"v\"),\n\t\t\t\t\t},\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t\tdep := c.newRequest(RequestTypeDependenciesLoaded)\n\t\tdep.Body.Payload = depPayload\n\t\tc.scheduleSubmit(dep)\n\t}\n\n\tif len(contribPackages) > 0 {\n\t\treq := c.newRequest(RequestTypeAppIntegrationsChange)\n\t\treq.Body.Payload = IntegrationsChange{Integrations: contribPackages}\n\t\tc.scheduleSubmit(req)\n\t}\n\n\tc.flush()\n\n\theartbeat := internal.IntEnv(\"DD_TELEMETRY_HEARTBEAT_INTERVAL\", defaultHeartbeatInterval)\n\tif heartbeat < 1 || heartbeat > 3600 {\n\t\tlog(\"DD_TELEMETRY_HEARTBEAT_INTERVAL=%d not in [1,3600] range, setting to default of %d\", heartbeat, defaultHeartbeatInterval)\n\t\theartbeat = defaultHeartbeatInterval\n\t}\n\tc.heartbeatInterval = time.Duration(heartbeat) * time.Second\n\tc.heartbeatT = time.AfterFunc(c.heartbeatInterval, c.backgroundHeartbeat)\n}", "title": "" }, { "docid": "328d09bc57506646533622689944c7ad", "score": "0.5315518", "text": "func (m *SGXLKLManager) Start() error {\n\tglog.Infof(\"SGX-LKL device plugin: Start\")\n\terr := m.cleanup()\n\tif err != nil {\n\t\treturn err\n\t}\n\tsock, err := net.Listen(\"unix\", socketPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tm.server = grpc.NewServer([]grpc.ServerOption{}...)\n\tpluginapi.RegisterDevicePluginServer(m.server, m)\n\tgo m.server.Serve(sock)\n\n\treturn nil\n}", "title": "" } ]
dbad71174b8e0f639152bb7907782272
MarshalJSON supports json.Marshaler interface
[ { "docid": "3de24f756f34774422d78e47baed60c9", "score": "0.0", "text": "func (v CrossOriginOpenerPolicyStatus) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonC5a4559bEncodeGithubComChromedpCdprotoNetwork82(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" } ]
[ { "docid": "48c01db1b04bdcf1175109cc12b3d4fd", "score": "0.7722398", "text": "func (j JSON) Marshal(value interface{}) ([]byte, error) {\n\treturn json.Marshal(value)\n}", "title": "" }, { "docid": "ba72d333200edafb25149f59540c91e3", "score": "0.76170653", "text": "func MarshalJson(in interface{}) ([]byte, error) {\n\treturn Marshal(Json, in)\n}", "title": "" }, { "docid": "9578794d7de101bd204700da557325d2", "score": "0.7551867", "text": "func jsonMarshal() starlark.Callable {\n\treturn starlark.NewBuiltin(\"json.marshal\", fnJsonMarshal)\n}", "title": "" }, { "docid": "81bded7879aec4cc1cbb3c1addc52dd5", "score": "0.7521967", "text": "func (j *JSONBuiltin) 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": "f54adaef3c81524b35ad8222b7006919", "score": "0.748076", "text": "func Marshal(v interface{}) ([]byte, error) {\n\treturn JSON.Marshal(v)\n}", "title": "" }, { "docid": "b900d90d9164dcfd9493f6a5cb6b2cbf", "score": "0.74576825", "text": "func Marshal(value interface{}) (jsonStr []byte,err error) {\n if jsonStr,err = json.Marshal(value);err != nil {\n logHelper.DebugNoContext(\"JsonEncodeFailed:%v\",err)\n return nil,err\n }\n return jsonStr,nil\n}", "title": "" }, { "docid": "5b58f4626c256a17931fb21f1a7fbbbf", "score": "0.7260543", "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": "9be6ba02fcc1b24b2e4da76f7b4617f8", "score": "0.7236883", "text": "func Marshal(x interface{}) []byte {\n\tm, _ := json.Marshal(x)\n\treturn m\n}", "title": "" }, { "docid": "be774b4a9c27e965242dcf9280282f4a", "score": "0.7221593", "text": "func jsonMarshal(v interface{}) string {\n\tbytes, _ := json.Marshal(v)\n\treturn string(bytes)\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": "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": "88f52ff989158bdd629ae66853896b87", "score": "0.7210187", "text": "func (codec *JSONCodec) Marshal(s interface{}) (bb []byte, err error) {\n\tbb, err = json.Marshal(s)\n\treturn bb, err\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": "ac0fbbcf1ce4433287bd0e74213a9640", "score": "0.7180257", "text": "func jsonMarshal(ctx *fasthttp.RequestCtx, v interface{}) {\n\tctx.SetContentType(\"application/json; charset=utf-8\")\n\n\terr := json.NewEncoder(ctx).Encode(v)\n\tif err != nil {\n\t\t//Log Error\n\t}\n}", "title": "" }, { "docid": "6f567425b7c7309066fd6abe4d6343de", "score": "0.7174813", "text": "func (s *JSONCodec) Marshal(v interface{}) ([]byte, error) {\n\treturn json.Marshal(v)\n}", "title": "" }, { "docid": "7b54b1737655a5c51175022be7db30e7", "score": "0.7102933", "text": "func JSONMarshal(t interface{}, indent string, escapeHTML bool) ([]byte, error) {\n\tbuffer := &bytes.Buffer{}\n\tencoder := json.NewEncoder(buffer)\n\tif len(indent) > 0 {\n\t\tencoder.SetIndent(\"\", indent)\n\t}\n\tencoder.SetEscapeHTML(escapeHTML)\n\terr := encoder.Encode(t)\n\tjsonBytes := buffer.Bytes()\n\tif len(jsonBytes) > 0 && jsonBytes[len(jsonBytes)-1] == '\\n' {\n\t\tjsonBytes = jsonBytes[0 : len(jsonBytes)-1]\n\t}\n\treturn jsonBytes, err\n}", "title": "" }, { "docid": "00552f30c2d22414c75975fd5f52ff95", "score": "0.7049712", "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": "d9f331ea1e2eab0b2af42bf5d7b6c89f", "score": "0.70257443", "text": "func (j *HexJSON) Marshal(v interface{}) ([]byte, error) {\n\treturn json.Marshal(v)\n}", "title": "" }, { "docid": "2a2d522e695945d56ad15280712e076d", "score": "0.7016493", "text": "func (m *JsonMarshaller) Marshal(name string, msg interface{}) ([]byte, error) {\n\treturn json.Marshal(msg)\n}", "title": "" }, { "docid": "c0fe274592ba24289cbacaa1e4b5d354", "score": "0.699401", "text": "func jsonEncode(p interface{}) []byte {\n\tr, _ := json.Marshal(p)\n\treturn r\n}", "title": "" }, { "docid": "ca48adde7eaef8226e08ee7b67988e87", "score": "0.6915537", "text": "func Marshal(or interface{}) string {\n\tb, err := json.Marshal(or)\n\tif err != nil {\n\t\tfmt.Printf(\"Error: %s\", err)\n\t\treturn \"0\"\n\t}\n\t//fmt.Println(string(b))\n\n\treturn string(b)\n}", "title": "" }, { "docid": "5b81ae2c273f5a233404a336f45df674", "score": "0.689179", "text": "func MarshalJSON(v interface{}) (out []byte, err error) {\n\treturn json.Marshal(v)\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": "98d2ccb3bd99e834f706a73b3f284049", "score": "0.6879623", "text": "func encodeJSON(v interface{}) ([]byte, error) {\n\tvar buffer bytes.Buffer\n\te := jsoniter.NewEncoder(&buffer)\n\terr := e.Encode(v)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn buffer.Bytes(), nil\n}", "title": "" }, { "docid": "ce3da7f63915884bac80e9d88595785a", "score": "0.68688697", "text": "func MarshalJSON(t *testing.T, i interface{}) string {\n\tb, err := json.Marshal(i)\n\tassert.NoError(t, err)\n\treturn string(b)\n}", "title": "" }, { "docid": "a9dcb5eca04accb26de62d1885f9653f", "score": "0.6840655", "text": "func MarshalToJson(obj runtime.Object, gv schema.GroupVersion) ([]byte, error) {\n\tmediaType := \"application/json\"\n\tinfo, ok := runtime.SerializerInfoForMediaType(clientsetscheme.Codecs.SupportedMediaTypes(), mediaType)\n\tif !ok {\n\t\treturn []byte{}, fmt.Errorf(\"unsupported media type %q\", mediaType)\n\t}\n\n\tencoder := clientsetscheme.Codecs.EncoderForVersion(info.Serializer, gv)\n\treturn runtime.Encode(encoder, obj)\n}", "title": "" }, { "docid": "68a924a851bea89fa31ff56abeec3954", "score": "0.6818818", "text": "func MarshalJSON(anyObject interface{}) string {\n\tjsonString, err := gjson.Marshal(anyObject)\n\tif err != nil {\n\t\terr = errors.Annotate(err, \"encoding/json.Marshal() has error\")\n\t\tpanic(errors.Details(err))\n\t}\n\n\treturn string(jsonString)\n}", "title": "" }, { "docid": "95f7ffd4dd5498b9d7274b43800d701e", "score": "0.68070936", "text": "func Jsonify(i interface{}) ([]byte, error) {\n\treturn json.Marshal(i)\n}", "title": "" }, { "docid": "0310b231401a78fe8c8d992d7c7594c6", "score": "0.68052787", "text": "func jsonEncode(obj interface{}) ([]byte, error) {\n\treturn json.MarshalIndent(obj, \"\", \" \")\n}", "title": "" }, { "docid": "812f1bd25dd156bb3fa5b3db83e12428", "score": "0.6801507", "text": "func Marshal(v interface{}) ([]byte, error) {\n\tvar buf bytes.Buffer\n\tencoder := json.NewEncoder(&buf)\n\tencoder.SetEscapeHTML(false)\n\terr := encoder.Encode(v)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// trim last \"\\n\"\n\tb := buf.Bytes()\n\tif n := len(b); n > 0 && b[n-1] == '\\n' {\n\t\tb = b[:n-1]\n\t}\n\treturn b, nil\n}", "title": "" }, { "docid": "b33be26c4d9cdad47ff45cdaee7c4070", "score": "0.67922986", "text": "func JSONMarshal(msg drpc.Message, enc drpc.Encoding) ([]byte, error) {\n\tif enc, ok := enc.(interface {\n\t\tJSONMarshal(msg drpc.Message) ([]byte, error)\n\t}); ok {\n\t\treturn enc.JSONMarshal(msg)\n\t}\n\n\t// fallback to normal Marshal + JSON Marshal\n\tbuf, err := enc.Marshal(msg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn json.Marshal(buf)\n}", "title": "" }, { "docid": "eb4c1b8e2179f06cb4959eb90f1bb397", "score": "0.67830557", "text": "func Marshal(value interface{}) ([]byte, error) {\n\tswitch reflect.ValueOf(value).Kind() {\n\tcase reflect.Ptr, reflect.Struct, reflect.Map:\n\t\treturn ffjson.Marshal(value)\n\tdefault:\n\t\tb := &bytes.Buffer{}\n\t\terr := gob.NewEncoder(b).Encode(&Item{\n\t\t\tObject: value,\n\t\t})\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn b.Bytes(), nil\n\t}\n}", "title": "" }, { "docid": "fe871e83b873a11479d8dc6581576604", "score": "0.6773401", "text": "func (p Paved) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(p.object)\n}", "title": "" }, { "docid": "53ee83e6793dd4b8eae5d4a0d0894666", "score": "0.67655706", "text": "func (bj ByteJson) Marshal() ([]byte, error) {\n\tbuf := make([]byte, len(bj.Data)+1)\n\tbuf[0] = byte(bj.Type)\n\tcopy(buf[1:], bj.Data)\n\treturn buf, nil\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": "24743aaa12ce828b756faf1b8e46230f", "score": "0.67543995", "text": "func (f *Function) JSONMarshal() (data []byte, err error) {\n\tdata, err = json.Marshal(f)\n\treturn\n}", "title": "" }, { "docid": "648859810e34d2a017c742b84ab0f859", "score": "0.6750173", "text": "func MarshalToJson(obj runtime.Object, gv schema.GroupVersion) ([]byte, error) {\n\tencoder := versioning.NewCodec(\n\t\tJSONSerializer,\n\t\tnil,\n\t\truntime.UnsafeObjectConvertor(scheme.Scheme),\n\t\tscheme.Scheme,\n\t\tscheme.Scheme,\n\t\tnil,\n\t\tgv,\n\t\tnil,\n\t\tscheme.Scheme.Name(),\n\t)\n\treturn runtime.Encode(encoder, obj)\n}", "title": "" }, { "docid": "0d2b89b3231537e0886d69fd4062df19", "score": "0.674716", "text": "func (t Tags) Marshal() (ret []byte, err error) {\n\tret, err = json.Marshal(t)\n\treturn\n}", "title": "" }, { "docid": "e89758e528694a964d1163a98b12c460", "score": "0.67448485", "text": "func Marshal(v interface{}) ([]byte, error) {\n\treturn encode(v)\n\n}", "title": "" }, { "docid": "987490358d0fd4d48229fc3b5fa1f081", "score": "0.67405343", "text": "func (m *jSONMarshaller) Marshal(entry *Entry) ([]byte, error) {\n\treturn json.Marshal(entry)\n}", "title": "" }, { "docid": "3a638466fe34c2a043e6a9e3ded579ff", "score": "0.67311406", "text": "func MarshalIndentJSON(t *testing.T, i interface{}) string {\n\tb, err := json.MarshalIndent(i, \"\", \" \")\n\tassert.NoError(t, err)\n\treturn string(b)\n}", "title": "" }, { "docid": "f8c8d7a2902951ea512bf4c3cbbc75f6", "score": "0.6726844", "text": "func (p JSON) MarshalJSON() ([]byte, error) {\n\tif p.IsUndefined() {\n\t\treturn nil, ErrMarshalUndefined\n\t}\n\n\tif p.IsNull() {\n\t\treturn json.Marshal(nil)\n\t}\n\n\treturn json.Marshal(p.v)\n}", "title": "" }, { "docid": "076a0ce36e42b42968a5aa9d73d09e8e", "score": "0.67179006", "text": "func main(){\n var p1 Person\n p1.name = \"Ori\"\n\n barr, err := json.Marshal(p1)\n fmt.Println(barr)\n}", "title": "" }, { "docid": "4230c751e609fed554d39160c6a5ccd5", "score": "0.6711063", "text": "func Marshal(v interface{}, format Format) (d []byte, err error) {\n\tswitch format {\n\tcase JSON:\n\t\treturn json.Marshal(v)\n\tcase JSONIndent:\n\t\treturn json.MarshalIndent(v, \"\", \" \")\n\tcase YAML:\n\t\td, err = json.Marshal(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn YAML2JSON(d)\n\t}\n\treturn nil, errors.New(\"Bad format\")\n}", "title": "" }, { "docid": "0d74824b063bb4777259f002200baf02", "score": "0.6696704", "text": "func MarshalPrettyJSON(anyObject interface{}) string {\n\tjsonString := MarshalJSON(anyObject)\n\n\tjsonObject, err := sjson.NewJson([]byte(jsonString))\n\tif err != nil {\n\t\terr = errors.Annotate(err, \"simplejson.NewJson([]byte) has error\")\n\t\tpanic(errors.Details(err))\n\t}\n\n\tprettyJson, jsonError := jsonObject.EncodePretty()\n\tif jsonError != nil {\n\t\terr = errors.Annotate(err, \"simplejson.JSON.EncodePretty() has error\")\n\t\tpanic(errors.Details(err))\n\t}\n\n\treturn string(prettyJson)\n}", "title": "" }, { "docid": "ca7e2ab11a40da9075b582cb6d16c3ef", "score": "0.6696612", "text": "func Marshal(v interface{}) ([]byte, error) {\n\treturn GetAPI().Marshal(v)\n}", "title": "" }, { "docid": "55154b435696e59f2de1ea1793b1a2e3", "score": "0.6685953", "text": "func jsonMarshal(schemaStructure interface{}) (string, error) {\n\tbyteString, err := json.Marshal(schemaStructure)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn string(byteString), nil\n}", "title": "" }, { "docid": "30c46b2c3e88af5a652235d85def68b3", "score": "0.6685339", "text": "func jsonify(stuff interface{}) string {\n\tj, _ := json.Marshal(stuff)\n\treturn string(j)\n}", "title": "" }, { "docid": "58a61807dff158a00dea3d7309b3911a", "score": "0.6681611", "text": "func Marshal(entity interface{}, renamer func(string) string) ([]byte, error) {\n\tb, err := json.Marshal(entity)\n\tif err != nil {\n\t\treturn b, err\n\t}\n\n\ts := string(b)\n\tre := regexp.MustCompile(`\"([^\"]+)\":`)\n\tnew := re.ReplaceAllStringFunc(s, reQuote(renamer))\n\n\treturn []byte(new), err\n}", "title": "" }, { "docid": "a6d5d896e0c79df699e3f369ae699666", "score": "0.6677147", "text": "func jsoner(object interface{}) string {\n\tj, _ := json.Marshal(object)\n\treturn string(j)\n}", "title": "" }, { "docid": "696e3ffb2adc326b09d9926e7c975a10", "score": "0.66706216", "text": "func Marshal(v any) ([]byte, error) {\n\treturn _J.Marshal(v)\n}", "title": "" }, { "docid": "30b9c3f647ce3c820602689eb4bd3ce5", "score": "0.66686964", "text": "func main() {\n\n\tp1 := Person{First: \"R1\", Last: \"J1\", Age: 32, noExported: 007}\n\n\tbs, _ := json.Marshal(p1)\n\n\tfmt.Println(bs)\n\tfmt.Printf(string(bs))\n\tfmt.Printf(\"\\n%T\\n\", bs)\n\n}", "title": "" }, { "docid": "3eb7caa86a6074dc8a9bb0db6c474054", "score": "0.6666843", "text": "func MarshalToString(v interface{}) (string, error) {\n\treturn JSON.MarshalToString(v)\n}", "title": "" }, { "docid": "ddcc7d3cee85842aca2c16c2968922ca", "score": "0.6650394", "text": "func (w ConcatWriter) 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": "1d380ae26988cf59b7a1e4fe5dbeb01e", "score": "0.6598227", "text": "func (js JSONSerialization) MarshalJSON() ([]byte, error) {\n\tjs.Type = TypeJSON\n\tobjectMap := make(map[string]interface{})\n\tif js.JSONSerializationProperties != nil {\n\t\tobjectMap[\"properties\"] = js.JSONSerializationProperties\n\t}\n\tif js.Type != \"\" {\n\t\tobjectMap[\"type\"] = js.Type\n\t}\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "e34ae7342387cb46fda829a1448b1532", "score": "0.65861535", "text": "func (marshaller JsonMarshaller) marshal(v interface{}) (io.Reader, error) {\n\tb, err := json.MarshalIndent(v, \"\", \"\\t\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bytes.NewReader(b), nil\n}", "title": "" }, { "docid": "fac73813e19177178e7cb98720599eb1", "score": "0.6577759", "text": "func (in Anything) MarshalJSON() ([]byte, error) {\n\tif in.Value == nil {\n\t\treturn []byte(\"null\"), nil\n\t}\n\treturn json.Marshal(in.Value)\n}", "title": "" }, { "docid": "779f895c1c5d5f9395ebe23b2e4ca3cb", "score": "0.65741336", "text": "func toJSON(a interface{}) ([]byte,error) {\n\tbs, err := json.Marshal(a)\n\tif err!=nil{\n\t\treturn bs,fmt.Errorf(\"marhsaling is not done %v\",err)\n\t}\n\t//also we can put return bs,err since err is nil\n\treturn bs,nil\n}", "title": "" }, { "docid": "13646623001ce17613f5c24b9fdf76c1", "score": "0.65665764", "text": "func (o *Output) JSONMarshal() ([]byte, error) {\n\treturn json.MarshalIndent(o, \"\", \" \")\n}", "title": "" }, { "docid": "e5e38149b7dfda7ce28079c74dc67221", "score": "0.6554724", "text": "func (j jsonSerializer) Marshal(r *pbgo.ProcessStatRequest) ([]byte, error) {\n\treturn j.marshaler.Marshal(r)\n}", "title": "" }, { "docid": "747b980d8da793d43e65aef61ce3ee41", "score": "0.6529543", "text": "func (v ObjectMeta) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson16721522EncodeGitBetfavoritCfVadimTsurkovKuberwebKubDomainDeployments2(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "c51381e67a4014219a84e6f26f2c87f8", "score": "0.65182644", "text": "func (h HandlerMapping) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"arguments\", h.Arguments)\n\tpopulate(objectMap, \"extension\", h.Extension)\n\tpopulate(objectMap, \"scriptProcessor\", h.ScriptProcessor)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "e8d7bd3f5292c3b47b7e842cad63b6ce", "score": "0.65085506", "text": "func mustMarshalJSON(v interface{}) []byte {\n\tb, err := json.Marshal(v)\n\tif err != nil {\n\t\tpanic(\"marshal: \" + err.Error())\n\t}\n\treturn b\n}", "title": "" }, { "docid": "272c9e323b5487b881fc5bb0a3900c4d", "score": "0.64892745", "text": "func jsonEncode(value interface{}) ([]byte, error) {\n\tvar buf bytes.Buffer\n\tenc := json.NewEncoder(&buf)\n\terr := enc.Encode(value)\n\treturn buf.Bytes(), err\n}", "title": "" }, { "docid": "3f33b2eda24d448703edab16d43761ae", "score": "0.6477901", "text": "func encodeJson() {\n\tfmt.Println(\"Encoding\")\n\n\thuman := Human{\n\t\tFirstName: \"John\",\n\t\tLastName: \"Doe\",\n\t\tAge: 25,\n\t}\n\n\tb, err := json.Marshal(human)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\tfmt.Println(\"Bytes:\", b)\n\tfmt.Println(\"String:\", string(b))\n}", "title": "" }, { "docid": "391fdde1504043c423dcca16278859a0", "score": "0.647665", "text": "func (m JSONB) MarshalJSON() ([]byte, error) {\n\tif m == nil {\n\t\treturn []byte(\"null\"), nil\n\t}\n\treturn m, nil\n}", "title": "" }, { "docid": "7b9e33f1a35205990f290fac61ee8595", "score": "0.6470089", "text": "func marshalStruct(v interface{}) []byte {\n\tb, err := json.Marshal(v)\n\tif err !=nil {\n\t\tpanic(fmt.Sprintf(\"Could not marshal struct:%s\", err))\n\t}\n\treturn b\n}", "title": "" }, { "docid": "0b22ac5ff768f86997e41e5dd5221624", "score": "0.64653504", "text": "func CustomMarshal(v interface{}) ([]byte, error) {\n\treturn json.Marshal(v)\n}", "title": "" }, { "docid": "4011ef192ed80f652f59fbc4f380fdb0", "score": "0.6463308", "text": "func toJSON(a interface{}) ([]byte, error) {\n\tbs, err := json.Marshal(a)\n\t// if there is an error, return the following... with the error\n\tif err != nil {\n\t\treturn []byte{}, fmt.Errorf(\"there was an error: %v\", err)\n\t}\n\t// if there is NOT an error, return nil\n\treturn bs, nil\n}", "title": "" }, { "docid": "c32f9dccde93fdfffe8b61ce8590bc16", "score": "0.64614534", "text": "func Marshal(o interface{}) ([]byte, error) {\n\tb := []byte{}\n\tenc := codec.NewEncoderBytes(&b, CborHandler())\n\tif err := enc.Encode(o); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn b, nil\n}", "title": "" }, { "docid": "4d24ae33d242cc9e01b8e91d2d54ffda", "score": "0.6456606", "text": "func (v S) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson89aae3efEncodeJson(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "31c2a3459611206d6e76f8ef691228c4", "score": "0.6451017", "text": "func (ch *CommonHandler) Marshal(v interface{}) ([]byte, error) {\n\tif ch.Marshaler == nil {\n\t\treturn json.Marshal(v)\n\t}\n\treturn ch.Marshaler(v)\n}", "title": "" }, { "docid": "0c143854389310e05bfb37448260bded", "score": "0.6446831", "text": "func testMarshalJSON(t *testing.T, cmd interface{}) {\n\tjsonCmd, err := json.Marshal(cmd)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tfmt.Println(string(jsonCmd))\n}", "title": "" }, { "docid": "98b8927016c3b33f6775a56f40c52c32", "score": "0.644303", "text": "func (BinaryMarshaler) Marshal(v interface{}) ([]byte, error) {\n\trv := reflect.ValueOf(v)\n\n\tfor rv.Kind() == reflect.Ptr {\n\t\tif rv.IsNil() {\n\t\t\treturn nil, nil\n\t\t}\n\t\trv = rv.Elem()\n\t}\n\n\tif rv.Kind() != reflect.Slice || rv.Elem().Kind() != reflect.Uint8 {\n\t\treturn json.Marshal(v)\n\t}\n\n\treturn v.([]byte), nil\n}", "title": "" }, { "docid": "1ef2e201ab038240db8f553b321b9695", "score": "0.64427865", "text": "func (p Pool) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", p.ID)\n\tpopulate(objectMap, \"location\", p.Location)\n\tpopulate(objectMap, \"name\", p.Name)\n\tpopulate(objectMap, \"properties\", p.Properties)\n\tpopulate(objectMap, \"systemData\", p.SystemData)\n\tpopulate(objectMap, \"tags\", p.Tags)\n\tpopulate(objectMap, \"type\", p.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "af6a78db16f9af28e32fa706deaa4ee0", "score": "0.6442333", "text": "func JSON(v interface{}) []byte {\n\tmarshal := func(target interface{}) []byte {\n\t\tb, err := json.Marshal(target)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"errors: marshall error, err: %v\", err)\n\t\t\treturn []byte(fmt.Sprintf(`{\"code\":%d, \"message\":\"%s\"}`, codes.Internal, codes.Internal.String()))\n\t\t}\n\t\treturn b\n\t}\n\tif err, ok := v.(error); ok {\n\t\treturn marshal(Convert(err).Proto())\n\t}\n\tif s, ok := v.(*Status); ok {\n\t\treturn marshal(s.Proto())\n\t}\n\tif s, ok := v.(Status); ok {\n\t\treturn marshal(s.Proto())\n\t}\n\treturn marshal(v)\n}", "title": "" }, { "docid": "43842f833ae2ca4ad9babb4ed8a4eed4", "score": "0.6441581", "text": "func asJson(w io.Writer, v interface{}) error {\n\tenc := json.NewEncoder(w)\n\treturn enc.Encode(v)\n}", "title": "" }, { "docid": "1bf84980c5e866691bd19caa51c813f3", "score": "0.6440012", "text": "func (jsonable JSONable) JSON(target interface{}, err *error) string {\n\tvar (\n\t\te error\n\t\tret []byte\n\t)\n\n\tret, e = json.Marshal(target)\n\tif *err == nil {\n\t\t*err = e\n\t}\n\n\treturn string(ret)\n}", "title": "" }, { "docid": "2ce00bf7c8d677446630182aacb42df4", "score": "0.64400005", "text": "func (a ApplicationInsights) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", a.ID)\n\tpopulate(objectMap, \"key\", a.Key)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "54294461f31ef8fa18d3a79c78ae6a2e", "score": "0.64354855", "text": "func Marshal(hi *HostInfo) ([]byte, error) {\n\tvhi := versionedHostInfo{\n\t\tHostInfo: hi,\n\t\tSerializerVersion: supportedSerializerVersion,\n\t}\n\treturn json.Marshal(vhi)\n}", "title": "" }, { "docid": "edd84f69c52d4ea27eb9157ee1d090f2", "score": "0.6435381", "text": "func Marshal(v interface{}) ([]byte, error)", "title": "" }, { "docid": "6d67c4bbbe56ff3b7b00ccde25e10f2d", "score": "0.6434803", "text": "func JSON(i interface{}) string {\n\tb, err := json.Marshal(i)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn string(b)\n}", "title": "" }, { "docid": "49c07bcf31076b773169f8d49704e8ea", "score": "0.6432003", "text": "func MarshalJsonIndent(val interface{}) (string, error) {\n\tvar jsonBuf bytes.Buffer\n\tenc := json.NewEncoder(&jsonBuf)\n\tenc.SetEscapeHTML(false)\n\tenc.SetIndent(\"\", \" \")\n\terr := enc.Encode(val)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn jsonBuf.String(), nil\n}", "title": "" }, { "docid": "327c117e1679ab497cafec0a1876de07", "score": "0.64320016", "text": "func SerializeJSON(target interface{}) ([]byte, error) {\n\treturn json.MarshalIndent(target, jsonPrefix, jsonIndent)\n}", "title": "" }, { "docid": "8c46e17bfe5de0bbb3c57222625dc059", "score": "0.64204603", "text": "func (v TakeResponseBodyForInterceptionAsStreamReturns) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonC5a4559bEncodeGithubComChromedpCdprotoNetwork4(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "1bc6866d951ac78a26b5a197b9998042", "score": "0.64199895", "text": "func (resp *Response) Marshal(obj interface{}) (err error) {\n\tresp.body, err = json.Marshal(obj)\n\treturn\n}", "title": "" }, { "docid": "0a2be6f68937edb10acfcbee26dd98d4", "score": "0.6417434", "text": "func (v Like) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson794297d0EncodeDsmnkoOrgHlc183(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "cefd0cff694e00951d9be03244743b61", "score": "0.64170843", "text": "func (b BackendContract) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tb.Resource.marshalInternal(objectMap)\n\tpopulate(objectMap, \"properties\", b.Properties)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "31a004c623d87971ddc5f7df40606e4a", "score": "0.6416124", "text": "func (v S) MarshalEasyJSON(w *jwriter.Writer) {\n\teasyjson89aae3efEncodeJson(w, v)\n}", "title": "" }, { "docid": "275eed15f2412f01435d24d02c9acbea", "score": "0.641409", "text": "func Marshal(o interface{}) ([]byte, error) {\n\tj, err := json.Marshal(o)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error marshaling into JSON: %v\", err)\n\t}\n\tfmt.Printf(\"JSON\")\n\tfmt.Printf(string(j))\n\ty, err := yaml.JSONToYAML(j)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error converting JSON to YAML: %v\", err)\n\t}\n\n\treturn y, nil\n}", "title": "" }, { "docid": "4b192dbd87026730cc24354dc736e368", "score": "0.64109", "text": "func (r *Root) MarshalJSON() ([]byte, error) { return protojson.Marshal(r) }", "title": "" }, { "docid": "15e634a9d66e766f550fac0c45b6e253", "score": "0.63987756", "text": "func Marshal(v interface{}) ([]byte, error) {\n\t// If it's already a byte slice, return it\n\tif b, ok := v.([]byte); ok {\n\t\treturn b, nil\n\t}\n\n\t// Custom MsgMarhsaler interface\n\tif i, ok := v.(MsgMarshaler); ok {\n\t\treturn i.MarshalMsg(nil)\n\t}\n\n\t// Fallbacks to JSON marshaling\n\treturn json.Marshal(v)\n}", "title": "" }, { "docid": "8741ca539299be677e18e5a456e4a867", "score": "0.6396539", "text": "func (v InspectWorkerParams) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonC5a4559bEncodeGithubComKnqChromedpCdpServiceworker8(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "title": "" }, { "docid": "8eb493b5786ef43a269770d47c6f2a37", "score": "0.6393436", "text": "func (p PremierAddOn) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"id\", p.ID)\n\tpopulate(objectMap, \"kind\", p.Kind)\n\tpopulate(objectMap, \"location\", p.Location)\n\tpopulate(objectMap, \"name\", p.Name)\n\tpopulate(objectMap, \"properties\", p.Properties)\n\tpopulate(objectMap, \"tags\", p.Tags)\n\tpopulate(objectMap, \"type\", p.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "ababa1067f2c285067401595e856e964", "score": "0.6387426", "text": "func JsonEncode(data interface{}) ([]byte, error) {\n\t// step: do we have anything to encode?\n\tif data == nil {\n\t\treturn []byte{}, nil\n\t}\n\t// step: encode the structure\n\tvar buffer bytes.Buffer\n\tif err := json.NewEncoder(&buffer).Encode(data); err != nil {\n\t\treturn []byte{}, fmt.Errorf(\"unable to encode the data, error: %s\", err)\n\t}\n\treturn buffer.Bytes(), nil\n}", "title": "" }, { "docid": "87104ac86725b17ef3fc8d3921614428", "score": "0.63871634", "text": "func (j *JSON) MarshalJSON() ([]byte, error) {\n\treturn *j, nil\n}", "title": "" }, { "docid": "0c32edb9cdbecf551a73ae8919bb23f8", "score": "0.6385485", "text": "func Marshal(v interface{}) ([]byte, error) {\n\tvar b bytes.Buffer\n\terr := NewEncoder(&b).Encode(v)\n\treturn b.Bytes(), err\n}", "title": "" }, { "docid": "204da4fe528c152eb705e995864b5b36", "score": "0.6381106", "text": "func (i Interface) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulate(objectMap, \"etag\", i.Etag)\n\tpopulate(objectMap, \"extendedLocation\", i.ExtendedLocation)\n\tpopulate(objectMap, \"id\", i.ID)\n\tpopulate(objectMap, \"location\", i.Location)\n\tpopulate(objectMap, \"name\", i.Name)\n\tpopulate(objectMap, \"properties\", i.Properties)\n\tpopulate(objectMap, \"tags\", i.Tags)\n\tpopulate(objectMap, \"type\", i.Type)\n\treturn json.Marshal(objectMap)\n}", "title": "" }, { "docid": "e23d246c455e5efe92b6b2e4b1229650", "score": "0.63746667", "text": "func (v Intrinsic) MarshalJSON() ([]byte, error) { return json.Marshal(&v.Value) }", "title": "" } ]
4081e583dc9c54b1d16fa01e197d86d2
Get returns first attribute value by name.
[ { "docid": "fab35a495fef065ea59c1fd24524f776", "score": "0.8091426", "text": "func (a Attributes) Get(name string) string {\n\tfor _, it := range a {\n\t\tif it.Name == name {\n\t\t\treturn it.Value\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" } ]
[ { "docid": "dec07ba44a838f5178f5ff2e472587ab", "score": "0.77832973", "text": "func (a UserAttributes) Get(name string) string {\n\tif v, ok := a[name]; ok {\n\t\treturn v[0]\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "49acd5ce31ed222c1fdc340b0c952927", "score": "0.7260639", "text": "func (d *Decoder) GetAttribute(name string) (string, error) {\n\tif d.eof {\n\t\treturn \"\", io.EOF\n\t}\n\tvar attr bool\n\tbuf := make([]byte, 0)\n\tfor {\n\t\tb, err := d.br.ReadByte()\n\t\tif err == io.EOF {\n\t\t\td.eof = true\n\t\t\treturn \"\", err\n\t\t}\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tswitch b {\n\t\tcase '=':\n\t\t\tif name == string(buf) {\n\t\t\t\tattr = true\n\t\t\t\tbuf = make([]byte, 0)\n\t\t\t\tcontinue\n\t\t\t}\n\t\tcase '\"':\n\t\t\tif attr && len(buf) > 0 {\n\t\t\t\treturn string(buf), nil\n\t\t\t}\n\t\tcase ' ':\n\t\t\tbuf = make([]byte, 0)\n\t\t\tcontinue\n\t\tcase '>':\n\t\t\td.end = true\n\t\t\treturn \"\", ErrNotFound\n\t\tdefault:\n\t\t\tbuf = append(buf, b)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "19fdb6763f78222a0aec84bab2a7e88c", "score": "0.7205228", "text": "func (aa AssertionAttributes) Get(name string) *AssertionAttribute {\n\tfor _, attr := range aa {\n\t\tif attr.Name == name {\n\t\t\treturn &attr\n\t\t}\n\t\tif attr.FriendlyName == name {\n\t\t\treturn &attr\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ac44de7b6ca70409be37a12cddb61805", "score": "0.6754599", "text": "func (b *FakeBag) Get(name string) (interface{}, bool) {\n\tc, found := b.Attrs[name]\n\tb.referencedLock.Lock()\n\tb.referenced[name] = true\n\tb.referencedLock.Unlock()\n\treturn c, found\n}", "title": "" }, { "docid": "d29d96add484424a61624fe918699f2a", "score": "0.672726", "text": "func (e Edge) GetAttr(name string) interface{} {\n\treturn e.attributes[name]\n}", "title": "" }, { "docid": "a46b3e3e9b37c29bd59ee5e28437aed9", "score": "0.66323525", "text": "func GetAttribute(n *html.Node, k string) string {\n\tvar s string\n\n\tfor _, a := range n.Attr {\n\t\tif a.Key == k {\n\t\t\ts = a.Val\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn s\n}", "title": "" }, { "docid": "ef463f6280eabd21b8a4661e094cc0af", "score": "0.66320324", "text": "func (choice Choice) Get(key string) interface{} {\n\treturn choice.attributes[key]\n}", "title": "" }, { "docid": "c1783b09a76130a145c15cb531555ae7", "score": "0.6604348", "text": "func (e WebElement) GetAttribute(name string) (string, error) {\n\t_, data, err := e.s.wd.do(nil, \"GET\", \"/session/%s/element/%s/attribute/%s\", e.s.Id, e.id, name)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tvar attribute string\n\terr = json.Unmarshal(data, &attribute)\n\treturn attribute, err\n\t//return z, e.do(\"GET\", u, nil, &z)\n}", "title": "" }, { "docid": "a34eaa77be3afb904f354bfb949c7b85", "score": "0.66034245", "text": "func (w webElement) GetAttribute(ctx context.Context, name string) (s string, err error) {\n\tif len(name) == 0 {\n\t\treturn s, ErrInvalidArguments\n\t}\n\tresp, err := w.request.Do(ctx, http.MethodGet, \"/session/\"+w.sid+\"/element/\"+w.wid+\"/attribute/\"+name, nil)\n\tif err != nil {\n\t\treturn s, err\n\t}\n\tif resp.Success() {\n\t\treturn s, nil\n\t}\n\tif err = json.Unmarshal(resp.Value, &s); err != nil {\n\t\treturn s, err\n\t}\n\treturn s, nil\n}", "title": "" }, { "docid": "3b0daaaffb63f4f013836264124aff4c", "score": "0.6534392", "text": "func (args *Args) Get(name string) *Arg {\n\tfor _, arg := range args.items {\n\t\tif arg.name == name {\n\t\t\treturn arg\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "eee6b7bf0a35c32cd75aef6098ef7710", "score": "0.65134454", "text": "func (r *Record) Get(attribute string) any {\n\tidx, ok := r.table.nameToColumnIndex[attribute]\n\tif !ok {\n\t\tpanic(fmt.Sprintf(\"pgxrecord.Record (%s): Get: attribute %q is not found\", r.table.quotedQualifiedName, attribute))\n\t}\n\n\treturn r.attributes[idx]\n}", "title": "" }, { "docid": "05171874547f94ed3411d5ef682e48e7", "score": "0.64789444", "text": "func (attMap AttributeMap) GetAttribute(name AttributeName) *Attribute {\n\treturn attMap[name]\n}", "title": "" }, { "docid": "834d02ad0ef80a64c99dd268214adb2d", "score": "0.64107203", "text": "func (ds *DeveloperService) GetAttribute(developerName, attributeName string) (value string, err types.Error) {\n\n\tdeveloper, err := ds.Get(developerName)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn developer.Attributes.Get(attributeName)\n}", "title": "" }, { "docid": "6e34afe52c513577400945c4e120cf83", "score": "0.63481325", "text": "func (ctx *Context) Get(name string) interface{} {\n\tif flag := ctx.find(name); flag != nil {\n\t\treturn flag.Value()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "25a721023996b770c6702b71261e6b58", "score": "0.63419634", "text": "func (m Attributes) Get(key string) interface{} {\n\tif m == nil {\n\t\tm = map[string]interface{}{}\n\t}\n\treturn m[key]\n}", "title": "" }, { "docid": "aa4ffc241038a986d283eb4cf656553b", "score": "0.6331062", "text": "func (m MultiMap) Get(name string) string {\n\tif m == nil {\n\t\treturn \"\"\n\t}\n\tvs := m[name]\n\tif len(vs) == 0 {\n\t\treturn \"\"\n\t}\n\treturn vs[0]\n}", "title": "" }, { "docid": "ebae697b6f30c97e03c908b498cbc53f", "score": "0.63077974", "text": "func (ps Parameters) Get(name string) string {\n\tfor _, p := range ps {\n\t\tif p.Name == name {\n\t\t\treturn p.Value\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "2f10260edebbd9b0fe7d3bb4ec568ee6", "score": "0.62845427", "text": "func (ps Params) Get(name string) string {\n\tfor _, p := range ps {\n\t\tif p.Key == name {\n\t\t\treturn p.Value\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "dfeef116361a232764b5bbf4f4c1effe", "score": "0.62795645", "text": "func (e *Element) GetAttribute(name string) (bool, string) {\n\tif !e.HasAttribute(name) {\n\t\treturn false, \"\"\n\t}\n\n\treturn true, e.Call(\"getAttribute\", name).String()\n}", "title": "" }, { "docid": "1b9b00651282b90f3d9e2b0775687e2e", "score": "0.62360144", "text": "func (p Params) Get(name string) string {\n\tfor _, v := range p {\n\t\tif v.key == name {\n\t\t\treturn v.value\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "9ab4a3b8b6eabfe686cc76b1039c18c8", "score": "0.62279874", "text": "func (s Symbols) GetAttribute(ID string) (Attribute, bool) {\n\tif a, ok := s.attrs[ID]; ok {\n\t\treturn a, true\n\t}\n\n\treturn Attribute{}, false\n}", "title": "" }, { "docid": "133bd6538a84ae49e2464264f0484951", "score": "0.6207542", "text": "func (entity *ManagedEntity) GetAttribute(name string) (interface{}, error) {\n\tvalue, ok := entity.attributes[name]\n\tif !ok {\n\t\treturn 0, fmt.Errorf(\"attribute '%v' not found\", name)\n\t}\n\treturn value, nil\n}", "title": "" }, { "docid": "ef4d1b56b8a2b9a886aaa808ef8f2d84", "score": "0.6157937", "text": "func (user *User) GetAttribute(key string) string {\n\tval := user.attributes[strings.ToLower(key)]\n\tif len(val) > 0 {\n\t\treturn val\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "c924ec650133d869fb03596fa263d0d3", "score": "0.615456", "text": "func (s *Schema) GetAttribute(schema map[string]interface{}, name string) map[string]interface{} {\n\tattr := schema[\"attributes\"].(map[string]interface{})\n\tif attrSchema, ok := attr[name]; ok {\n\t\treturn attrSchema.(map[string]interface{})\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "4257d116adfd94a373b82e039c368742", "score": "0.6116332", "text": "func (ctx *Context) Get(name string) string {\n\tiparams := ctx.Value(paramsKey)\n\tif iparams == nil {\n\t\treturn \"\"\n\t}\n\tparams := iparams.(url.Values)\n\treturn params.Get(name)\n}", "title": "" }, { "docid": "e372167aa0c1ada6ed76632e665d3655", "score": "0.6106436", "text": "func (p Params) Get(name string) string {\n\treturn httprouter.Params(p).ByName(name)\n}", "title": "" }, { "docid": "7ad40f631be6b56aadaf54ac19349bc6", "score": "0.6071633", "text": "func (c *connector) GetAttr(key string) interface{} {\r\n\tc.RLock()\r\n\tv := c.attrs[key]\r\n\tc.RUnlock()\r\n\treturn v\r\n}", "title": "" }, { "docid": "57b372423c98439ad837096c90f80bb9", "score": "0.6051583", "text": "func (r Record) Get(name string) (interface{}, error) {\n\tif v, ok := r[name]; ok {\n\t\treturn v, nil\n\t}\n\treturn nil, ErrUnknownColumn\n}", "title": "" }, { "docid": "7ecc0fa82c54ac2c2dd4e2d43c1e9fed", "score": "0.60512567", "text": "func (e *User) Get(attr string, value string) error {\n\tresp, err := e.getBy(attr, value)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\te.parse(resp)\n\treturn nil\n}", "title": "" }, { "docid": "bdaa18101ef7890172af5b0e3d7858d2", "score": "0.6022829", "text": "func (a *Agent) GetAttr(selector string, attr string) string {\n\tvar value string\n\tvar err error\n\ta.proxy(func(s *cdp.Session) error {\n\t\tvalue, err = s.GetAttr(selector, attr)\n\t\ta.log([]interface{}{selector, attr}, []interface{}{value, err})\n\t\treturn err\n\t})\n\treturn value\n}", "title": "" }, { "docid": "9b39dafbb277f8d0ffc579897d916572", "score": "0.60217726", "text": "func (g Grammar) Get(name string) *Rule {\n\tfor _, x := range g {\n\t\tif x.Name == name {\n\t\t\treturn x\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cf72de1db3ba9fe40f1a42650e44c629", "score": "0.6019862", "text": "func (e *Element) GetAttribute(name string) (string, error) {\n\tvalidateElement(e)\n\treturn e.webElement.GetAttribute(name)\n}", "title": "" }, { "docid": "3a9db7b6f72af8acf76d6a37ac005c21", "score": "0.6010613", "text": "func (ps Params) Get(name string) (string, bool) {\n\tfor _, entry := range ps {\n\t\tif entry.Key == name {\n\t\t\treturn entry.Value, true\n\t\t}\n\t}\n\treturn \"\", false\n}", "title": "" }, { "docid": "2e88304226b1386f61785a8af1fd4940", "score": "0.5992965", "text": "func (cfs *ChatterFs) GetAttr(name string, context *fuse.Context) (*fuse.Attr, fuse.Status) {\n\tswitch name {\n\tcase \"file.txt\":\n\t\treturn &fuse.Attr{\n\t\t\tMode: fuse.S_IFREG | 0644,\n\t\t\tSize: uint64(len(name)),\n\t\t}, fuse.OK\n\tcase \"\":\n\t\treturn &fuse.Attr{\n\t\t\tMode: fuse.S_IFDIR | 0755,\n\t\t}, fuse.OK\n\t}\n\n\treturn nil, fuse.ENOENT\n}", "title": "" }, { "docid": "874d6e5dd0fe25507ded63b681f8e95d", "score": "0.59913987", "text": "func (para Paragraph) Get(name string) string {\n\ti := para.find(name)\n\tif i == -1 {\n\t\treturn \"\"\n\t}\n\treturn para[i].Value\n}", "title": "" }, { "docid": "32c6e0e97cb8a80213f9111a7a50cfd3", "score": "0.59889627", "text": "func (c CRM) Get(name string) (string, error) {\n\tcmd := exec.Command(c.AttrPath, \"--type\", \"crm_config\", \"--name\", name, \"--set-name\", c.Property, \"--query\", \"-q\")\n\n\tv, err := cmd.Output()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn strings.TrimSpace(string(v)), nil\n}", "title": "" }, { "docid": "746ef59823c06c78f07d63ab44bb3b8e", "score": "0.5971682", "text": "func (o *Authority) ValueForAttribute(name string) interface{} {\n\n\tswitch name {\n\tcase \"ID\":\n\t\treturn o.ID\n\tcase \"algorithm\":\n\t\treturn o.Algorithm\n\tcase \"certificate\":\n\t\treturn o.Certificate\n\tcase \"commonName\":\n\t\treturn o.CommonName\n\tcase \"expirationDate\":\n\t\treturn o.ExpirationDate\n\tcase \"key\":\n\t\treturn o.Key\n\tcase \"migrationsLog\":\n\t\treturn o.MigrationsLog\n\tcase \"organization\":\n\t\treturn o.Organization\n\tcase \"serialNumber\":\n\t\treturn o.SerialNumber\n\tcase \"type\":\n\t\treturn o.Type\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": "a8833304c2e8f49b82778a44dfaa4311", "score": "0.5967465", "text": "func (e *Element) GetAttribute(key string) (string, bool) {\n\tif e.Attributes == nil {\n\t\treturn \"\", false\n\t}\n\tfor _, a := range e.Attributes {\n\t\tif a.Key == key {\n\t\t\treturn a.Val, true\n\t\t}\n\t}\n\treturn \"\", false\n}", "title": "" }, { "docid": "a59dd60d809194ccedd218e54a849970", "score": "0.59501106", "text": "func GetAttributeValue(obj reflect.Value, fieldName string) (reflect.Value, error) {\n\tif !IsStruct(obj) {\n\n\t\treturn reflect.ValueOf(nil), fmt.Errorf(\"GetAttributeValue : param is not a struct\")\n\t}\n\tif !IsValidField(obj, fieldName) {\n\n\t\treturn reflect.ValueOf(nil), fmt.Errorf(\"attribute named %s not exist in struct\", fieldName)\n\t}\n\tstructval := obj\n\tvar attrVal reflect.Value\n\tif structval.Kind() == reflect.Ptr {\n\t\tattrVal = structval.Elem().FieldByName(fieldName)\n\t} else {\n\t\tattrVal = structval.FieldByName(fieldName)\n\t}\n\n\treturn attrVal, nil\n}", "title": "" }, { "docid": "82c5b200fb2bde4a572c3118bbc6ad88", "score": "0.59420544", "text": "func (m *MetricMap) Get(name string) *Metric {\n\treturn m.metrics[name]\n}", "title": "" }, { "docid": "2894b887ac228c793b584b4d3113b5f5", "score": "0.59300214", "text": "func (O *Object) Get(name string) (interface{}, error) {\n\td := scratch.Get()\n\tdefer scratch.Put(d)\n\tif err := O.GetAttribute(d, name); err != nil {\n\t\treturn nil, err\n\t}\n\tisObject := d.IsObject()\n\tot := O.Attributes[name].ObjectType\n\tif isObject {\n\t\td.ObjectType = ot\n\t}\n\tv := d.Get()\n\tif !isObject {\n\t\treturn maybeString(v, ot), nil\n\t}\n\tsub := v.(*Object)\n\tif sub != nil && sub.ObjectType.CollectionOf != nil {\n\t\treturn &ObjectCollection{Object: sub}, nil\n\t}\n\treturn sub, nil\n}", "title": "" }, { "docid": "890f084b16e4a90eebebd96707fa13ee", "score": "0.59288216", "text": "func (attribute *Attribute) GetName() AttributeName {\n\treturn attribute.name\n}", "title": "" }, { "docid": "f7a365fbe5ccad7881105b0c1292e2dd", "score": "0.5918029", "text": "func (s *Store) Get(name string) (string, bool) {\n\tif s.caseInsensitiveKeys {\n\t\tname = strings.ToLower(name)\n\t}\n\ts.dataMutex.RLock()\n\tdefer s.dataMutex.RUnlock()\n\td, ok := s.data[name]\n\treturn d, ok\n}", "title": "" }, { "docid": "ba2e181df965dcee9156b901c72624a4", "score": "0.5917343", "text": "func (e *Element) GetAttribute(name string) string {\n\tattr, err := e.GetAttributes()\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\treturn attr[name]\n}", "title": "" }, { "docid": "07721414ed34a5c94f3bed051c17a3d5", "score": "0.5916785", "text": "func (o *PCSearchResult) ValueForAttribute(name string) interface{} {\n\n\tswitch name {\n\tcase \"internalEdges\":\n\t\treturn o.InternalEdges\n\tcase \"items\":\n\t\treturn o.Items\n\tcase \"nextPageToken\":\n\t\treturn o.NextPageToken\n\tcase \"nodes\":\n\t\treturn o.Nodes\n\tcase \"paths\":\n\t\treturn o.Paths\n\tcase \"publicEdges\":\n\t\treturn o.PublicEdges\n\tcase \"sourceDestinationMap\":\n\t\treturn o.SourceDestinationMap\n\tcase \"totalRows\":\n\t\treturn o.TotalRows\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "732f42b21a99013f00ccb7a45559df83", "score": "0.590948", "text": "func (client *B2FS) GetAttr(name string, context *fuse.Context) (*fuse.Attr, fuse.Status) {\n\tvar debug = De.Debug(\"go-b2-fuse:GetAttr\")\n\tname = escapeName(name)\n\tdebug(\"name: %s\", name)\n\terr := client.getFiles(filepath.Dir(name))\n\tif err != nil {\n\t\tfmt.Printf(\"Error listing file names %v\", err)\n\t\treturn nil, fuse.ENOENT\n\t}\n\tif name == \"\" {\n\t\treturn &fuse.Attr{\n\t\t\tMode: fuse.S_IFDIR | 0755,\n\t\t}, fuse.OK\n\t}\n\tfor _, dirItem := range client.dirItems {\n\t\tif dirItem.fullPath == name {\n\t\t\tvar mode uint32\n\t\t\tif dirItem.isDir {\n\t\t\t\tmode = dirItem.mode | 0755\n\t\t\t\tdebug(\"matched dir %s\", dirItem.fullPath)\n\t\t\t} else {\n\t\t\t\tmode = dirItem.mode | 0644\n\t\t\t\tdebug(\"matched file %s\", dirItem.fullPath)\n\t\t\t}\n\t\t\treturn &fuse.Attr{\n\t\t\t\tMode: mode,\n\t\t\t\tSize: uint64(dirItem.file.Size),\n\t\t\t}, fuse.OK\n\t\t}\n\t}\n\treturn nil, fuse.ENOENT\n}", "title": "" }, { "docid": "6db5e3331587ca3acd1d80489c101c41", "score": "0.5903857", "text": "func (r Request) Attribute(name string) interface{} {\n\treturn r.attributes[name]\n}", "title": "" }, { "docid": "ec90d4ef7c77dd83ae9c7561d5b70840", "score": "0.5898195", "text": "func (attr *RlpDataAttribute) Get(idx int) *RlpDataAttribute {\n\tif d, ok := attr.dataAttrib.([]interface{}); ok {\n\t\t// Guard for oob\n\t\tif len(d) < idx {\n\t\t\treturn NewRlpDataAttribute(nil)\n\t\t}\n\n\t\treturn NewRlpDataAttribute(d[idx])\n\t}\n\n\t// If this wasn't a slice you probably shouldn't be using this function\n\treturn NewRlpDataAttribute(nil)\n}", "title": "" }, { "docid": "09a8f8c0496c017c73a5aaf80873327b", "score": "0.58961", "text": "func (a Attrset) GetAttr(attr string) Attr {\n\tif value, contains := a.cache[attr]; contains {\n\t\treturn value\n\t} else {\n\t\tvar attrPath string\n\t\tif len(a.Path) > 0 {\n\t\t\tattrPath = a.Path + \".\" + attr\n\t\t} else {\n\t\t\tattrPath = attr\n\t\t}\n\n\t\tcmd := exec.Command(\"nixos-option\", attrPath)\n\t\toutput, err := cmd.Output()\n\t\tif err != nil {\n\t\t\tlog.Panicf(\"nixos-option failed: %v\", err) // FIXME\n\t\t}\n\t\toutputString := string(output)\n\t\tlines := strings.Split(outputString, \"\\n\")\n\t\tif lines[0] == \"This attribute set contains:\" {\n\t\t\ta.cache[attr] = Attrset{attrPath, lines[1:], make(map[string]Attr)}\n\t\t} else {\n\t\t\ta.cache[attr] = Value{attrPath, outputString}\n\t\t}\n\t\treturn a.cache[attr]\n\t}\n}", "title": "" }, { "docid": "ae07ba0e178fb06afa2f5a76615cdc28", "score": "0.5892721", "text": "func (obj *StringAttribute) GetName() string {\n\treturn obj.getName()\n}", "title": "" }, { "docid": "996eacf856aff8c0b02102f2c561488c", "score": "0.5876277", "text": "func (g *Group) GetStringAttribute(name string) string {\n\tfor att, val := range g.Attributes {\n\t\tif att == name {\n\t\t\tif s, ok := val.(string); ok {\n\t\t\t\treturn s\n\t\t\t}\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "e7fc929984b285e6b869ba2cfd8322c7", "score": "0.58594954", "text": "func (e envVarsWithGet) Get(name string) *v1.EnvVar {\n\tfor i := range e {\n\t\tif e[i].Name == name {\n\t\t\treturn &e[i]\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "44c2d5e3b0ca7fbb7f548a43a0371fef", "score": "0.5845466", "text": "func (kws *Websocket) GetAttribute(key string) string {\n\treturn kws.attributes[key]\n}", "title": "" }, { "docid": "7e04549cb53f7e97b79c54a102305f61", "score": "0.5838268", "text": "func (o *Tenant) ValueForAttribute(name string) interface{} {\n\n\tswitch name {\n\tcase \"ID\":\n\t\treturn o.ID\n\tcase \"externalID\":\n\t\treturn o.ExternalID\n\tcase \"name\":\n\t\treturn o.Name\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a585624e2ed209aed7c7c8f07911edcb", "score": "0.58341926", "text": "func (ni *NodeInfo) GetAttribute(key string) string {\n\treturn ni.attributes[key]\n}", "title": "" }, { "docid": "04bb9405565ef3a2262449ccd18f3797", "score": "0.58300716", "text": "func (ld *load) Get(na string) interface{} {\n\treturn ld.GetPos(ld.namespos[na])\n}", "title": "" }, { "docid": "46455acb931a6a921f9c5b5562cd3042", "score": "0.5821392", "text": "func (this *GenericRecord) Get(name string) interface{} {\n\treturn this.fields[name]\n}", "title": "" }, { "docid": "e0502fe7d44ab19a83dfd23192742311", "score": "0.5816436", "text": "func (s Stats) Get(name string, aliases ...string) interface{} {\n\tif val, exists := s[name]; exists {\n\t\treturn val\n\t}\n\n\tfor _, alias := range aliases {\n\t\tif val, exists := s[alias]; exists {\n\t\t\treturn val\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "229d5bf872de9a1cc247a83662abd802", "score": "0.5810323", "text": "func (obj *CharAttribute) GetName() string {\n\treturn obj.getName()\n}", "title": "" }, { "docid": "9ac9a45c3e9eb48a3af921daadefbb8a", "score": "0.580718", "text": "func (o *PingResult) ValueForAttribute(name string) interface{} {\n\n\tswitch name {\n\tcase \"ID\":\n\t\treturn o.ID\n\tcase \"createTime\":\n\t\treturn o.CreateTime\n\tcase \"errors\":\n\t\treturn o.Errors\n\tcase \"migrationsLog\":\n\t\treturn o.MigrationsLog\n\tcase \"namespace\":\n\t\treturn o.Namespace\n\tcase \"pingID\":\n\t\treturn o.PingID\n\tcase \"pingPairs\":\n\t\treturn o.PingPairs\n\tcase \"refreshID\":\n\t\treturn o.RefreshID\n\tcase \"remoteProbes\":\n\t\treturn o.RemoteProbes\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": "5715194da06d40faee1ef7543722442d", "score": "0.5804614", "text": "func (bb *BlockBlob) GetAttr(name string) (attr *internal.ObjAttr, err error) {\n\tlog.Trace(\"BlockBlob::GetAttr : name %s\", name)\n\n\t// To support virtual directories with no marker blob, we call list instead of get properties since list will not return a 404\n\tif bb.Config.virtualDirectory {\n\t\treturn bb.getAttrUsingList(name)\n\t}\n\n\treturn bb.getAttrUsingRest(name)\n}", "title": "" }, { "docid": "6ba3274d2ad37f3f1364a95759c653c7", "score": "0.58018374", "text": "func (v *Value) Get(name string) (*Value, error) {\n\tname_cstr := C.CString(name)\n\tret := C.v8_Value_Get(v.ctx.ptr, v.ptr, name_cstr)\n\tC.free(unsafe.Pointer(name_cstr))\n\treturn v.ctx.split(ret)\n}", "title": "" }, { "docid": "7df54ebe5e6e2f029406df3ce2c8f6ae", "score": "0.5789209", "text": "func (ps ParamHolder) Get(name string) string {\n\tfor _, h := range ps {\n\t\tif h.Name == name {\n\t\t\treturn h.Value\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "2099b3c705259a212727691d96d17005", "score": "0.5776142", "text": "func (o *PingReport) ValueForAttribute(name string) interface{} {\n\n\tswitch name {\n\tcase \"ID\":\n\t\treturn o.ID\n\tcase \"destinationID\":\n\t\treturn o.DestinationID\n\tcase \"destinationNamespace\":\n\t\treturn o.DestinationNamespace\n\tcase \"enforcerID\":\n\t\treturn o.EnforcerID\n\tcase \"enforcerNamespace\":\n\t\treturn o.EnforcerNamespace\n\tcase \"enforcerVersion\":\n\t\treturn o.EnforcerVersion\n\tcase \"flowTuple\":\n\t\treturn o.FlowTuple\n\tcase \"latency\":\n\t\treturn o.Latency\n\tcase \"payloadSize\":\n\t\treturn o.PayloadSize\n\tcase \"pingType\":\n\t\treturn o.PingType\n\tcase \"protocol\":\n\t\treturn o.Protocol\n\tcase \"request\":\n\t\treturn o.Request\n\tcase \"serviceType\":\n\t\treturn o.ServiceType\n\tcase \"sourceID\":\n\t\treturn o.SourceID\n\tcase \"sourceNamespace\":\n\t\treturn o.SourceNamespace\n\tcase \"stage\":\n\t\treturn o.Stage\n\tcase \"timestamp\":\n\t\treturn o.Timestamp\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "23148926c1c8961740fd51abd04f3902", "score": "0.577531", "text": "func (settings *Settings) Get(name string) *Setting {\n\tif settings == nil {\n\t\treturn nil\n\t}\n\tif settings.Len() == 0 {\n\t\treturn nil\n\t}\n\treturn (*settings)[name]\n}", "title": "" }, { "docid": "11c69cda4e83af1ba793ec73b59b85da", "score": "0.5774147", "text": "func (t *ComponentType) GetDefault(name string) (interface{}, error) {\n\tattr, exists := t.attributes[name]\n\tif exists {\n\t\treturn attr.Value(), nil\n\t}\n\tattributeNames := make([]string, 0, len(t.attributes))\n\tfor attributeName := range t.attributes {\n\t\tattributeNames = append(attributeNames, attributeName)\n\t}\n\treturn nil, fmt.Errorf(\"Component type %s has no attribute called %s. Attributes it does have: %s\",\n\t\tt.name, name, attributeNames)\n}", "title": "" }, { "docid": "8a60e6b6328d4b1bfef24112d4d5af10", "score": "0.5773281", "text": "func (c *Config) Get(name string) string {\n\tif result, ok := c.Parameters[name]; ok {\n\t\treturn result\n\t}\n\tpanic(\"Missing value in descriptor \" + name)\n}", "title": "" }, { "docid": "1fbae4b52b149c141f57cfcbf59e583d", "score": "0.5768216", "text": "func (claims *Claims) Get(name string) (interface{}, bool) {\n\tvalue, exists := claims.values[name]\n\treturn value, exists\n}", "title": "" }, { "docid": "015194bf77fbd83002587202337c0a68", "score": "0.57607484", "text": "func (t *Tags) Get(name string) (*Tag, error) {\n\tfor _, tag := range t.Tags {\n\t\tif tag.Name == name {\n\t\t\treturn &tag, nil\n\t\t}\n\t}\n\n\terr := errors.New(\"Tag not found\")\n\n\treturn nil, err\n}", "title": "" }, { "docid": "0ec71eda7f73852d43f50810fd288e8f", "score": "0.5758173", "text": "func (r *Row) GetByName(name string) (value string, err error) {\n\n\tindex, ok := r.ColumnIndexMap[name]\n\tif !ok {\n\t\terr = fmt.Errorf(\"%s is not defined for this csv\", name)\n\t\treturn\n\t}\n\n\tvalue, err = r.Get(index)\n\treturn\n}", "title": "" }, { "docid": "a01bb968a0ad35fe9516a31e514d42a3", "score": "0.5757776", "text": "func (c config) Get(name string) Property {\n\t_property, _ok := c.c[name]\n\tif _ok {\n\t\treturn _property\n\t} else {\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "1963bd41b0e60f2908bcf50dbbb77762", "score": "0.57465816", "text": "func (*ExpresswayChaincode) getAttribute(stub shim.ChaincodeStubInterface, args []string) (Attribute, error){\r\n\tvar attr Attribute\r\n\tvar err error\r\n\r\n\tif len(args) != 1 {\r\n\t\treturn attr, errors.New(\"Function getAttribute expects 1 argument.\")\r\n\t}\r\n\r\n\r\n\tindex := -1\r\n\r\n\tindex++\r\n\tattributeName := formatInput(args[index])\r\n\r\n\tattributeVal, err := getCertAttribute(stub, attributeName)\r\n\tif (err != nil){\r\n\t\terr = errors.New(\"getAttribute cannot get the attribute [\"+ attributeName + \"]\")\r\n\r\n\t\treturn attr, err\r\n\t}\r\n\r\n\t//attr = Attribute{AttributeName: attributeName, AttributeVal: attributeVal}\r\n\tattr = Attribute{}\r\n\tattr.AttributeName = attributeName\r\n\tattr.AttributeVal = attributeVal\r\n\treturn attr, nil\r\n}", "title": "" }, { "docid": "70008563aa6f9843315e89d12792054a", "score": "0.5745808", "text": "func (r *Register) Get(name string) (interface{}, bool) {\n\tr.mu.RLock()\n\tdefer r.mu.RUnlock()\n\tv, ok := r.data[name]\n\treturn v, ok\n}", "title": "" }, { "docid": "688a430e52b82c5a8d0b883cc56832c5", "score": "0.5745493", "text": "func (c *SamFs) GetAttr(name string, fContext *fuse.Context) (*fuse.Attr,\n\tfuse.Status) {\n\n\tglog.V(3).Infof(`GetAttr called on \"%s\"`, name)\n\tfh, fhErr := c.getFileHandle(name)\n\tif fhErr != fuse.OK {\n\t\treturn nil, fhErr\n\t}\n\tresp, err := c.nfsClient.GetAttr(context.Background(), &pb.FileHandleRequest{\n\t\tFileHandle: fh,\n\t}, grpc.FailFast(false))\n\tif err != nil {\n\t\tglog.Errorf(`failed to get attributes of file \"%s\" :: %s`, name, err.Error())\n\t\treturn nil, fuse.EIO\n\t}\n\n\tfAttr := ProtoToFuseAttr(resp)\n\tfAttr.Owner = c.owner\n\n\treturn fAttr, fuse.OK\n}", "title": "" }, { "docid": "e117d65e37b973614cf754daa9031424", "score": "0.57452226", "text": "func (o *SSHIdentity) ValueForAttribute(name string) interface{} {\n\n\tswitch name {\n\tcase \"certificate\":\n\t\treturn o.Certificate\n\tcase \"publicKey\":\n\t\treturn o.PublicKey\n\tcase \"systemAccount\":\n\t\treturn o.SystemAccount\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5cc7ad17304430aacb024066fdff6c87", "score": "0.57416093", "text": "func (r *Route) Get(name string) string {\n\tif len(name) > 0 && name[0] == ':' {\n\t\tname = name[1:]\n\t}\n\treturn r.params[name]\n}", "title": "" }, { "docid": "2c8ae0756ee5bcd0881d35959a0af79e", "score": "0.573874", "text": "func (p *Packet) Attr(name string) *Attribute {\n\tfor _, attr := range p.Attributes {\n\t\tif attrName, ok := p.Dictionary.Name(attr.Type); ok && attrName == name {\n\t\t\treturn attr\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "452995bf5ac4bf8c246afe472df80e26", "score": "0.5737253", "text": "func (o *Attribute) 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": "17f920c6d61c8fb67adbdeb78788308d", "score": "0.5735817", "text": "func (t Tags) Get(name string) []string {\n\t// NB: this is almost always going to be 0\n\tvalues := make([]string, 0, 2)\n\t// NB: This list isn't expected to get very long so it uses array lookup.\n\t// If this is a problem in the future, `Tags` be converted to a map.\n\tfor _, t := range t {\n\t\tif t.Name() == name {\n\t\t\tvalues = append(values, t.Value())\n\t\t}\n\t}\n\n\treturn values\n}", "title": "" }, { "docid": "40d55e043cb725baa329b0b086938a24", "score": "0.5717615", "text": "func (s Info) Get(name string, aliases ...string) interface{} {\n\tif val, exists := s[name]; exists {\n\t\treturn val\n\t}\n\n\tfor _, alias := range aliases {\n\t\tif val, exists := s[alias]; exists {\n\t\t\treturn val\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "4796e647d8952bec96e002acacb3824e", "score": "0.5711729", "text": "func GetAttr(obj cty.Value, attrName string, srcRange *Range) (cty.Value, Diagnostics) {\n\tif obj.IsNull() {\n\t\treturn cty.DynamicVal, Diagnostics{\n\t\t\t{\n\t\t\t\tSeverity: DiagError,\n\t\t\t\tSummary: \"Attempt to get attribute from null value\",\n\t\t\t\tDetail: \"This value is null, so it does not have any attributes.\",\n\t\t\t\tSubject: srcRange,\n\t\t\t},\n\t\t}\n\t}\n\n\tconst unsupportedAttr = \"Unsupported attribute\"\n\n\tty := obj.Type()\n\tswitch {\n\tcase ty.IsObjectType():\n\t\tif !ty.HasAttribute(attrName) {\n\t\t\treturn cty.DynamicVal, Diagnostics{\n\t\t\t\t{\n\t\t\t\t\tSeverity: DiagError,\n\t\t\t\t\tSummary: unsupportedAttr,\n\t\t\t\t\tDetail: fmt.Sprintf(\"This object does not have an attribute named %q.\", attrName),\n\t\t\t\t\tSubject: srcRange,\n\t\t\t\t},\n\t\t\t}\n\t\t}\n\n\t\tif !obj.IsKnown() {\n\t\t\treturn cty.UnknownVal(ty.AttributeType(attrName)), nil\n\t\t}\n\n\t\treturn obj.GetAttr(attrName), nil\n\tcase ty.IsMapType():\n\t\tif !obj.IsKnown() {\n\t\t\treturn cty.UnknownVal(ty.ElementType()), nil\n\t\t}\n\n\t\tidx := cty.StringVal(attrName)\n\n\t\t// Here we drop marks from HasIndex result, in order to allow basic\n\t\t// traversal of a marked map in the same way we can traverse a marked\n\t\t// object\n\t\thasIndex, _ := obj.HasIndex(idx).Unmark()\n\t\tif hasIndex.False() {\n\t\t\treturn cty.DynamicVal, Diagnostics{\n\t\t\t\t{\n\t\t\t\t\tSeverity: DiagError,\n\t\t\t\t\tSummary: \"Missing map element\",\n\t\t\t\t\tDetail: fmt.Sprintf(\"This map does not have an element with the key %q.\", attrName),\n\t\t\t\t\tSubject: srcRange,\n\t\t\t\t},\n\t\t\t}\n\t\t}\n\n\t\treturn obj.Index(idx), nil\n\tcase ty == cty.DynamicPseudoType:\n\t\treturn cty.DynamicVal, nil\n\tcase ty.IsListType() && ty.ElementType().IsObjectType():\n\t\t// It seems a common mistake to try to access attributes on a whole\n\t\t// list of objects rather than on a specific individual element, so\n\t\t// we have some extra hints for that case.\n\n\t\tswitch {\n\t\tcase ty.ElementType().HasAttribute(attrName):\n\t\t\t// This is a very strong indication that the user mistook the list\n\t\t\t// of objects for a single object, so we can be a little more\n\t\t\t// direct in our suggestion here.\n\t\t\treturn cty.DynamicVal, Diagnostics{\n\t\t\t\t{\n\t\t\t\t\tSeverity: DiagError,\n\t\t\t\t\tSummary: unsupportedAttr,\n\t\t\t\t\tDetail: fmt.Sprintf(\"Can't access attributes on a list of objects. Did you mean to access attribute %q for a specific element of the list, or across all elements of the list?\", attrName),\n\t\t\t\t\tSubject: srcRange,\n\t\t\t\t},\n\t\t\t}\n\t\tdefault:\n\t\t\treturn cty.DynamicVal, Diagnostics{\n\t\t\t\t{\n\t\t\t\t\tSeverity: DiagError,\n\t\t\t\t\tSummary: unsupportedAttr,\n\t\t\t\t\tDetail: \"Can't access attributes on a list of objects. Did you mean to access an attribute for a specific element of the list, or across all elements of the list?\",\n\t\t\t\t\tSubject: srcRange,\n\t\t\t\t},\n\t\t\t}\n\t\t}\n\n\tcase ty.IsSetType() && ty.ElementType().IsObjectType():\n\t\t// This is similar to the previous case, but we can't give such a\n\t\t// direct suggestion because there is no mechanism to select a single\n\t\t// item from a set.\n\t\t// We could potentially suggest using a for expression or splat\n\t\t// operator here, but we typically don't get into syntax specifics\n\t\t// in hcl.GetAttr suggestions because it's a general function used in\n\t\t// various other situations, such as in application-specific operations\n\t\t// that might have a more constraint set of alternative approaches.\n\n\t\treturn cty.DynamicVal, Diagnostics{\n\t\t\t{\n\t\t\t\tSeverity: DiagError,\n\t\t\t\tSummary: unsupportedAttr,\n\t\t\t\tDetail: \"Can't access attributes on a set of objects. Did you mean to access an attribute across all elements of the set?\",\n\t\t\t\tSubject: srcRange,\n\t\t\t},\n\t\t}\n\n\tcase ty.IsPrimitiveType():\n\t\treturn cty.DynamicVal, Diagnostics{\n\t\t\t{\n\t\t\t\tSeverity: DiagError,\n\t\t\t\tSummary: unsupportedAttr,\n\t\t\t\tDetail: fmt.Sprintf(\"Can't access attributes on a primitive-typed value (%s).\", ty.FriendlyName()),\n\t\t\t\tSubject: srcRange,\n\t\t\t},\n\t\t}\n\n\tdefault:\n\t\treturn cty.DynamicVal, Diagnostics{\n\t\t\t{\n\t\t\t\tSeverity: DiagError,\n\t\t\t\tSummary: unsupportedAttr,\n\t\t\t\tDetail: \"This value does not have any attributes.\",\n\t\t\t\tSubject: srcRange,\n\t\t\t},\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "bef86173243d7d1d998faea55d9f05a0", "score": "0.57034475", "text": "func (o *Enforcer) ValueForAttribute(name string) interface{} {\n\n\tswitch name {\n\tcase \"FQDN\":\n\t\treturn o.FQDN\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 \"certificate\":\n\t\treturn o.Certificate\n\tcase \"certificateExpirationDate\":\n\t\treturn o.CertificateExpirationDate\n\tcase \"certificateKey\":\n\t\treturn o.CertificateKey\n\tcase \"certificateRequest\":\n\t\treturn o.CertificateRequest\n\tcase \"collectInfo\":\n\t\treturn o.CollectInfo\n\tcase \"collectedInfo\":\n\t\treturn o.CollectedInfo\n\tcase \"controller\":\n\t\treturn o.Controller\n\tcase \"createIdempotencyKey\":\n\t\treturn o.CreateIdempotencyKey\n\tcase \"createTime\":\n\t\treturn o.CreateTime\n\tcase \"currentVersion\":\n\t\treturn o.CurrentVersion\n\tcase \"description\":\n\t\treturn o.Description\n\tcase \"detectedHostModeContainers\":\n\t\treturn o.DetectedHostModeContainers\n\tcase \"enforcementStatus\":\n\t\treturn o.EnforcementStatus\n\tcase \"lastCollectionID\":\n\t\treturn o.LastCollectionID\n\tcase \"lastCollectionTime\":\n\t\treturn o.LastCollectionTime\n\tcase \"lastMigrationTime\":\n\t\treturn o.LastMigrationTime\n\tcase \"lastPokeTime\":\n\t\treturn o.LastPokeTime\n\tcase \"lastSyncTime\":\n\t\treturn o.LastSyncTime\n\tcase \"lastValidHostServices\":\n\t\treturn o.LastValidHostServices\n\tcase \"localCA\":\n\t\treturn o.LocalCA\n\tcase \"logLevel\":\n\t\treturn o.LogLevel\n\tcase \"logLevelDuration\":\n\t\treturn o.LogLevelDuration\n\tcase \"machineID\":\n\t\treturn o.MachineID\n\tcase \"metadata\":\n\t\treturn o.Metadata\n\tcase \"migrationStatus\":\n\t\treturn o.MigrationStatus\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 \"nextAvailableVersion\":\n\t\treturn o.NextAvailableVersion\n\tcase \"normalizedTags\":\n\t\treturn o.NormalizedTags\n\tcase \"operationalStatus\":\n\t\treturn o.OperationalStatus\n\tcase \"protected\":\n\t\treturn o.Protected\n\tcase \"publicToken\":\n\t\treturn o.PublicToken\n\tcase \"startTime\":\n\t\treturn o.StartTime\n\tcase \"subnets\":\n\t\treturn o.Subnets\n\tcase \"unreachable\":\n\t\treturn o.Unreachable\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": "72332c788e7d1ff350b3eb3ac895d343", "score": "0.5699875", "text": "func GetValue(attrTypeId int) interface{} {\n\tattr, err := CreateAttributeByType(attrTypeId)\n\tif err != nil {\n\t\treturn false\n\t}\n\t// Execute Individual Attribute's method\n\treturn attr.GetValue()\n}", "title": "" }, { "docid": "5872b1f1dbc02e857507d1271e99ce8a", "score": "0.5694885", "text": "func (c *Client) GetAttr(n string, wanted *FileAttr) error {\n\treq := &AttrRequest{\n\t\tName: n,\n\t\tOrigin: c.id,\n\t}\n\tstart := time.Now()\n\trep := &AttrResponse{}\n\terr := c.client.Call(\"Server.GetAttr\", req, rep)\n\tdt := time.Now().Sub(start)\n\tc.timings.Log(\"Client.GetAttr\", dt)\n\n\tfor _, attr := range rep.Attrs {\n\t\tif attr.Path == n {\n\t\t\t*wanted = *attr\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "169da7466dd3d08656adb44c388ca342", "score": "0.56771183", "text": "func (o *Invoice) ValueForAttribute(name string) interface{} {\n\n\tswitch name {\n\tcase \"ID\":\n\t\treturn o.ID\n\tcase \"accountID\":\n\t\treturn o.AccountID\n\tcase \"billedToProvider\":\n\t\treturn o.BilledToProvider\n\tcase \"createTime\":\n\t\treturn o.CreateTime\n\tcase \"endDate\":\n\t\treturn o.EndDate\n\tcase \"startDate\":\n\t\treturn o.StartDate\n\tcase \"updateTime\":\n\t\treturn o.UpdateTime\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b1086fec081c7b231177ef54a55e08a2", "score": "0.56735194", "text": "func (ac AttributeColor) Get(text string) string {\n\treturn ac.String() + text + NoColor()\n}", "title": "" }, { "docid": "f39ac68866d01306e7155532ad33c3bf", "score": "0.56728286", "text": "func (obj *AttributeDescriptor) GetName() string {\n\treturn obj.Name\n}", "title": "" }, { "docid": "0b4e1d9ab2a8941c1069270d069d9583", "score": "0.56692195", "text": "func (r *StandardRegistry) Get(name string) Metric {\n\tr.mutex.Lock()\n\tdefer r.mutex.Unlock()\n\treturn r.metrics[name]\n}", "title": "" }, { "docid": "03c244b251b2d80b4b07ad8cabec523a", "score": "0.5666752", "text": "func attrValue(attrs []xml.Attr, name string) string {\n\tfor _, a := range attrs {\n\t\tif strings.EqualFold(a.Name.Local, name) {\n\t\t\treturn a.Value\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "8efadd3d5959a1110bfbe1688eac0385", "score": "0.56567097", "text": "func (s EnvStack) Get(name string) (value []string) {\n\tfor i := s.iLast(); i >= 0; i-- {\n\t\tv, ok := s[i][name]\n\t\tif ok {\n\t\t\tvalue = v\n\t\t\tbreak\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "83e8e02e62f8fb6e9c7dd976cbc545c0", "score": "0.5656281", "text": "func (s *DB) Get(name string) (value interface{}, ok bool) {\n\tvalue, ok = s.values.Load(name)\n\treturn\n}", "title": "" }, { "docid": "7d9ed4e6983c02cce29a79513bd08f9e", "score": "0.5649618", "text": "func (oc *ObjCol) Get(name interface{}) Item {\n\tres, ok := oc.items[name.(string)]\n\tif !ok {\n\t\treturn nil\n\t}\n\treturn res\n}", "title": "" }, { "docid": "f12047a190b3bb9ddd66b4c86bfc4ae1", "score": "0.56429994", "text": "func (entity *ManagedEntity) GetAttributeByIndex(index uint) (interface{}, error) {\n\tif len(entity.attributes) == 0 {\n\t\treturn nil, errors.New(\"attributes have already been set\")\n\t}\n\tif _, ok := entity.definition.AttributeDefinitions[index]; !ok {\n\t\treturn nil, fmt.Errorf(\"invalid attribute index: %d, should be 0..%d\",\n\t\t\tindex, len(entity.definition.AttributeDefinitions)-1)\n\t}\n\treturn entity.GetAttribute(entity.definition.AttributeDefinitions[index].Name)\n}", "title": "" }, { "docid": "895c1193c1b5726c72719bd8f72be410", "score": "0.56416404", "text": "func (tag StructTag) Get(key string) string", "title": "" }, { "docid": "d37fdb8c70117bb16446e9e728c3790a", "score": "0.56377316", "text": "func (i SNSGetTopicAttribute) ParseByName(s string) (SNSGetTopicAttribute, error) {\n\tif val, ok := _SNSGetTopicAttributeNameToValueMap[s]; ok {\n\t\t// parse ok\n\t\treturn val, nil\n\t}\n\n\t// error\n\treturn -1, fmt.Errorf(\"Enum Name of %s Not Expected In SNSGetTopicAttribute Values List\", s)\n}", "title": "" }, { "docid": "0acbc601c4f33a018aa0d60b7e977384", "score": "0.5636103", "text": "func (a *App) Get(name string) interface{} {\n\treturn a.getConfig()[name]\n}", "title": "" }, { "docid": "080c8699e70251dc583b789ab6023b40", "score": "0.563595", "text": "func (O *Object) GetAttribute(data *Data, name string) error {\n\tif O == nil {\n\t\tpanic(\"nil Object\")\n\t}\n\tattr, ok := O.Attributes[name]\n\tif !ok {\n\t\treturn fmt.Errorf(\"%s: %w\", name, ErrNoSuchKey)\n\t}\n\n\tdata.reset()\n\tdata.NativeTypeNum = attr.NativeTypeNum\n\tdata.ObjectType = attr.ObjectType\n\tdata.implicitObj = true\n\tif O.dpiObject == nil {\n\t\tdata.SetNull()\n\t\treturn nil\n\t}\n\t// the maximum length of that buffer must be supplied\n\t// in the value.asBytes.length attribute before calling this function.\n\tif attr.NativeTypeNum == C.DPI_NATIVE_TYPE_BYTES && attr.OracleTypeNum == C.DPI_ORACLE_TYPE_NUMBER {\n\t\tvar a [39]byte\n\t\tC.dpiData_setBytes(&data.dpiData, (*C.char)(unsafe.Pointer(&a[0])), C.uint32_t(len(a)))\n\t}\n\n\t//fmt.Printf(\"getAttributeValue(%p, %p, %d, %+v)\\n\", O.dpiObject, attr.dpiObjectAttr, data.NativeTypeNum, data.dpiData)\n\tif err := O.drv.checkExec(func() C.int {\n\t\treturn C.dpiObject_getAttributeValue(O.dpiObject, attr.dpiObjectAttr, data.NativeTypeNum, &data.dpiData)\n\t}); err != nil {\n\t\treturn fmt.Errorf(\"getAttributeValue(%q, obj=%s, attr=%+v, typ=%d): %w\", name, O.Name, attr.dpiObjectAttr, data.NativeTypeNum, err)\n\t}\n\tif logger := getLogger(context.TODO()); logger != nil && logger.Enabled(context.TODO(), slog.LevelDebug) {\n\t\tlogger.Debug(\"getAttributeValue\", \"dpiObject\", fmt.Sprintf(\"%p\", O.dpiObject),\n\t\t\tattr.Name, fmt.Sprintf(\"%p\", attr.dpiObjectAttr),\n\t\t\t\"nativeType\", data.NativeTypeNum, \"oracleType\", attr.OracleTypeNum,\n\t\t\t\"data\", data.dpiData, \"p\", fmt.Sprintf(\"%p\", data))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2d9f824e3d10ac335a233bbab084c78a", "score": "0.56297874", "text": "func (r *Robot) GetBotAttribute(a string) *AttrRet {\n\ta = strings.ToLower(a)\n\trobot.RLock()\n\tdefer robot.RUnlock()\n\tret := Ok\n\tvar attr string\n\tswitch a {\n\tcase \"name\":\n\t\tattr = robot.name\n\tcase \"fullname\", \"realname\":\n\t\tattr = robot.fullName\n\tcase \"alias\":\n\t\tattr = string(robot.alias)\n\tcase \"email\":\n\t\tattr = robot.email\n\tcase \"contact\", \"admin\", \"admincontact\":\n\t\tattr = robot.adminContact\n\tcase \"protocol\":\n\t\tattr = r.Protocol.String()\n\tdefault:\n\t\tret = AttributeNotFound\n\t}\n\treturn &AttrRet{attr, ret}\n}", "title": "" }, { "docid": "8427aa0d7319dcd0b31e65ce4f3e27d6", "score": "0.5629701", "text": "func (obj *ByteAttribute) GetName() string {\n\treturn obj.getName()\n}", "title": "" }, { "docid": "0ee53029a5b3653271dc8d24cdee6c7b", "score": "0.5617082", "text": "func (this *HttpAgentsAPI) GetHostAttributeByAttributeName(params martini.Params, r render.Render, req *http.Request) {\n\n\toutput, err := attributes.GetHostAttributesByAttribute(params[\"attr\"], req.URL.Query().Get(\"valueMatch\"))\n\n\tif err != nil {\n\t\tr.JSON(200, &APIResponse{Code: ERROR, Message: fmt.Sprintf(\"%+v\", err)})\n\t\treturn\n\t}\n\n\tr.JSON(200, output)\n}", "title": "" } ]
9da8010933e436f310c8b2c79cf85ddc
Next returns the next metrics
[ { "docid": "3bff5017f94c48c6ddfb16046c062bbf", "score": "0.6372369", "text": "func (it *Ppappa1intfifo2MetricsIterator) Next() *Ppappa1intfifo2Metrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Ppappa1intfifo2Metrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" } ]
[ { "docid": "83bb447e9c1986af76f8c9ce3cfeec86", "score": "0.7083351", "text": "func (it *MetricIterator) Next() (*Metric, error) {\n\tif err := it.nextFunc(); err != nil {\n\t\treturn nil, err\n\t}\n\titem := it.items[0]\n\tit.items = it.items[1:]\n\treturn item, nil\n}", "title": "" }, { "docid": "b8b31411b8a2a7ea0867660040d37c2d", "score": "0.6982651", "text": "func (it *Sgete1interrMetricsIterator) Next() *Sgete1interrMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Sgete1interrMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "7a8cd5a68b3c290c9daee1cbc01edc81", "score": "0.6961384", "text": "func (it *Sgete0interrMetricsIterator) Next() *Sgete0interrMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Sgete0interrMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "143fe1f20b7201a321bbd4daf44f40a3", "score": "0.6956352", "text": "func (it *Sgempu1intinfoMetricsIterator) Next() *Sgempu1intinfoMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Sgempu1intinfoMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "e285fc6c5dde356ed74def8f0de76a02", "score": "0.69166845", "text": "func (it *Sgimpu1interrMetricsIterator) Next() *Sgimpu1interrMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Sgimpu1interrMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "29e57e6740a751997be2a1140196164d", "score": "0.6910252", "text": "func (it *Sgimpu0interrMetricsIterator) Next() *Sgimpu0interrMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Sgimpu0interrMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "da2aa2bc83526f4a3d1f75b406615d72", "score": "0.6907548", "text": "func (it *Ppappa1intfifo1MetricsIterator) Next() *Ppappa1intfifo1Metrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Ppappa1intfifo1Metrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "ffe8745b360cb4987140214e3f2632cb", "score": "0.689143", "text": "func (it *Sgempu0interrMetricsIterator) Next() *Sgempu0interrMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Sgempu0interrMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "2c25627567f1344ec645d29a1bfd19c8", "score": "0.68797415", "text": "func (it *Sgempu0intinfoMetricsIterator) Next() *Sgempu0intinfoMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Sgempu0intinfoMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "1ec67b5a61dfe9e68bc88c06296906c1", "score": "0.68787134", "text": "func (it *Sgempu1interrMetricsIterator) Next() *Sgempu1interrMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Sgempu1interrMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "f9a951aa27c3c455843fc9a627db593a", "score": "0.68719715", "text": "func (it *Sgimpu1intinfoMetricsIterator) Next() *Sgimpu1intinfoMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Sgimpu1intinfoMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "7050c212ec2539a4c9a7499e198477ae", "score": "0.6869601", "text": "func (it *Ppappa1intpe1MetricsIterator) Next() *Ppappa1intpe1Metrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Ppappa1intpe1Metrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "b478a076c5f2f3cb9fe1430135543627", "score": "0.68656385", "text": "func (it *Sgempu4intinfoMetricsIterator) Next() *Sgempu4intinfoMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Sgempu4intinfoMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "67e467d6794b5534b8cd991e5062a359", "score": "0.6845454", "text": "func (it *Ppappa0intpe1MetricsIterator) Next() *Ppappa0intpe1Metrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Ppappa0intpe1Metrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "ed5fef5474ba5e04b74331d2c1ece30a", "score": "0.6841229", "text": "func (it *Ppappa0intfifo1MetricsIterator) Next() *Ppappa0intfifo1Metrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Ppappa0intfifo1Metrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "85c729f5998432ec9699107307b33a15", "score": "0.6839599", "text": "func (it *Sgimpu4intinfoMetricsIterator) Next() *Sgimpu4intinfoMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Sgimpu4intinfoMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "0c56ac579ad7c9d8fbff069705d3345f", "score": "0.68394387", "text": "func (s MonitoredScanIterator) Next() (results []string, err error) {\n\tspan, ctx := opentracing.StartSpanFromContext(\n\t\ts.ctx,\n\t\ts.name+\".scanner.next\",\n\t\ttracing.SpanTypeOption{Type: tracing.SpanTypeClient},\n\t)\n\tconst command = \"scanner-next\"\n\tactive := redisprom.ActiveRequests.With(prometheus.Labels{\n\t\tredisprom.ClientNameLabel: s.name,\n\t\tredisprom.CommandLabel: command,\n\t\tredisprom.DatabaseLabel: \"\", // We don't have that info\n\t\tredisprom.TypeLabel: \"\", // We don't have that info\n\t\tredisprom.DeploymentLabel: \"\", // We don't have that info\n\t})\n\tactive.Inc()\n\tdefer func(start time.Time) {\n\t\tactive.Dec()\n\t\tdurationSeconds := time.Since(start).Seconds()\n\t\tpromHistogram.With(prometheus.Labels{\n\t\t\tlabelSlug: s.name,\n\t\t\tlabelCommand: command,\n\t\t\tlabelSuccess: prometheusbp.BoolString(err == nil),\n\t\t}).Observe(durationSeconds)\n\t\tredisprom.LatencySeconds.With(prometheus.Labels{\n\t\t\tredisprom.ClientNameLabel: s.name,\n\t\t\tredisprom.CommandLabel: command,\n\t\t\tredisprom.SuccessLabel: prometheusbp.BoolString(err == nil),\n\t\t\tredisprom.DatabaseLabel: \"\", // We don't have that info\n\t\t\tredisprom.TypeLabel: \"\", // We don't have that info\n\t\t\tredisprom.DeploymentLabel: \"\", // We don't have that info\n\t\t}).Observe(durationSeconds)\n\t\tredisprom.RequestsTotal.With(prometheus.Labels{\n\t\t\tredisprom.ClientNameLabel: s.name,\n\t\t\tredisprom.CommandLabel: command,\n\t\t\tredisprom.SuccessLabel: prometheusbp.BoolString(err == nil),\n\t\t\tredisprom.DatabaseLabel: \"\", // We don't have that info\n\t\t\tredisprom.TypeLabel: \"\", // We don't have that info\n\t\t\tredisprom.DeploymentLabel: \"\", // We don't have that info\n\t\t}).Inc()\n\t\tspan.FinishWithOptions(tracing.FinishOptions{\n\t\t\tCtx: ctx,\n\t\t\tErr: err,\n\t\t}.Convert())\n\t}(time.Now())\n\n\treturn s.ScanIterator.Next()\n}", "title": "" }, { "docid": "165ece2316c77a5c9ce7abde8e621621", "score": "0.6818135", "text": "func (it *Sgimpu4interrMetricsIterator) Next() *Sgimpu4interrMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Sgimpu4interrMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "8642f84f332d9a335cf9cfa5cb356f78", "score": "0.6814806", "text": "func (it *Ppappa1intpe0MetricsIterator) Next() *Ppappa1intpe0Metrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Ppappa1intpe0Metrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "cebc1a3d9a5f74e3f67eb3cf03303bb2", "score": "0.6794723", "text": "func (it *Sgimpu0intinfoMetricsIterator) Next() *Sgimpu0intinfoMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Sgimpu0intinfoMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "d2c78b693fa79a9a8b43502fd7d3a1ac", "score": "0.6785491", "text": "func (it *Sgempu2interrMetricsIterator) Next() *Sgempu2interrMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Sgempu2interrMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "beccdd6700886db876c87caf806bc3eb", "score": "0.67835146", "text": "func (it *Ppappa0intpe0MetricsIterator) Next() *Ppappa0intpe0Metrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Ppappa0intpe0Metrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "5442944080cc5968ad81631ef3eca776", "score": "0.6780809", "text": "func (it *Sgimpu2interrMetricsIterator) Next() *Sgimpu2interrMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Sgimpu2interrMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "1ec65dda092c26bc62f62be103394604", "score": "0.67711693", "text": "func (it *FteCPSMetricsIterator) Next() *FteCPSMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &FteCPSMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "a7c43e53ea1c033e629db72bc6da50d6", "score": "0.6767598", "text": "func (it *Sgempu4interrMetricsIterator) Next() *Sgempu4interrMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Sgempu4interrMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "5fa7f301f41b7fc1ac21e9d73b3d7764", "score": "0.6759462", "text": "func (it *Sgete2interrMetricsIterator) Next() *Sgete2interrMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Sgete2interrMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "c56c61627cc6c51e9229a7e6fb867d71", "score": "0.6750567", "text": "func (it *Ppappa1intswphvmemMetricsIterator) Next() *Ppappa1intswphvmemMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Ppappa1intswphvmemMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "2afe81a8d400af71d466c60c795b4949", "score": "0.6747706", "text": "func (it *Sgempu2intinfoMetricsIterator) Next() *Sgempu2intinfoMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Sgempu2intinfoMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "fb6d973a8c27e8c5c3f0407f9c484c1d", "score": "0.67402244", "text": "func (it *Sgimpu5interrMetricsIterator) Next() *Sgimpu5interrMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Sgimpu5interrMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "e19cf0827ff9188bc2eb50a18afb4834", "score": "0.6719456", "text": "func (it *Sgete4interrMetricsIterator) Next() *Sgete4interrMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Sgete4interrMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "cf556867f8bd0060268d96af2edad68b", "score": "0.66827965", "text": "func (it *L2FlowRawMetricsIterator) Next() *L2FlowRawMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &L2FlowRawMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "2706d3d79f83344b425cca94d166f9dc", "score": "0.6669253", "text": "func (it *Sgempu5interrMetricsIterator) Next() *Sgempu5interrMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Sgempu5interrMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "2c672683acaca78cfcf0f70264543f46", "score": "0.66667247", "text": "func (it *L2FlowPerformanceMetricsIterator) Next() *L2FlowPerformanceMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &L2FlowPerformanceMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "e2adbfeef2d3f7bc883ec2a3b0dbd486", "score": "0.66626394", "text": "func (it *Sgite1interrMetricsIterator) Next() *Sgite1interrMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Sgite1interrMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "39fbb710e941316faba642b1cadbc0b7", "score": "0.66603065", "text": "func (it *IPv4FlowLatencyMetricsIterator) Next() *IPv4FlowLatencyMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &IPv4FlowLatencyMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "70482f6767672e441738785f7e7fb131", "score": "0.66556627", "text": "func (it *Ppappa0intswphvmemMetricsIterator) Next() *Ppappa0intswphvmemMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Ppappa0intswphvmemMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "e8ba78cfc36675e5eb38217528e1e648", "score": "0.665491", "text": "func (it *Sgimpu2intinfoMetricsIterator) Next() *Sgimpu2intinfoMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Sgimpu2intinfoMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "6be8f15773fa25e178b2f4d09ede893b", "score": "0.66438967", "text": "func (it *Ppappa1intbndl1MetricsIterator) Next() *Ppappa1intbndl1Metrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Ppappa1intbndl1Metrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "289ca84d8026b94a551d96e5cb147a35", "score": "0.6635529", "text": "func (it *Sgimpu5intinfoMetricsIterator) Next() *Sgimpu5intinfoMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Sgimpu5intinfoMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "934732a096f752c1ed1ef2a3af8b965d", "score": "0.66306454", "text": "func (it *IPv4FlowPerformanceMetricsIterator) Next() *IPv4FlowPerformanceMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &IPv4FlowPerformanceMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "d0e02f6881a190a502474e8c30a0695f", "score": "0.6627008", "text": "func (it *Ppappa1intpe8MetricsIterator) Next() *Ppappa1intpe8Metrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Ppappa1intpe8Metrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "7fbaf8a4d16c4823b46d621060b4659c", "score": "0.6626631", "text": "func (it *Sgimpu3interrMetricsIterator) Next() *Sgimpu3interrMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Sgimpu3interrMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "3a216305dd162bf183b764d5008a16d1", "score": "0.6620895", "text": "func (it *Ppappa1intpe4MetricsIterator) Next() *Ppappa1intpe4Metrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Ppappa1intpe4Metrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "36a97c2cabd5a49782a63b467dcb578c", "score": "0.6614564", "text": "func (it *Ppappa1intpaMetricsIterator) Next() *Ppappa1intpaMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Ppappa1intpaMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "9681e496876bafcdfb8eaf3f2968f667", "score": "0.6609347", "text": "func (it *Sgete5interrMetricsIterator) Next() *Sgete5interrMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Sgete5interrMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "2dd06ab026dad8ab1f4b9ea6151e225d", "score": "0.6606446", "text": "func (it *Ppappa0intbndl1MetricsIterator) Next() *Ppappa0intbndl1Metrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Ppappa0intbndl1Metrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "173ac5b7d74f995b19f4709ea6ed406c", "score": "0.66014516", "text": "func (it *Sgite0interrMetricsIterator) Next() *Sgite0interrMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Sgite0interrMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "17a86c84924bae41202cb1d2b6fc6ca7", "score": "0.66008854", "text": "func (it *Ppappa0intpe2MetricsIterator) Next() *Ppappa0intpe2Metrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Ppappa0intpe2Metrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "bc6c5cf37852aa6cb090ee722caca258", "score": "0.6596945", "text": "func (it *Ppappa0intfifo2MetricsIterator) Next() *Ppappa0intfifo2Metrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Ppappa0intfifo2Metrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "5e631e78ba42b3a024ba7dc00c307d51", "score": "0.65890354", "text": "func (it *Sgimpu3intinfoMetricsIterator) Next() *Sgimpu3intinfoMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Sgimpu3intinfoMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "ec503d966bb1dff81cf09a405c7d2571", "score": "0.6587199", "text": "func (it *Sgempu5intinfoMetricsIterator) Next() *Sgempu5intinfoMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Sgempu5intinfoMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "8c18134e85d6f24499bd9394ebad4c02", "score": "0.6582849", "text": "func (it *Ppappa0intpe4MetricsIterator) Next() *Ppappa0intpe4Metrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Ppappa0intpe4Metrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "84ecbe634e93fdbdefe15170aa725a6a", "score": "0.65796345", "text": "func (it *Sgete3interrMetricsIterator) Next() *Sgete3interrMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Sgete3interrMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "b31af70528da17489ec54ede9ffc768d", "score": "0.6574284", "text": "func (it *PtptpspintlifqstatemapMetricsIterator) Next() *PtptpspintlifqstatemapMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &PtptpspintlifqstatemapMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "848856419a37c9c73bd29b6d22dc973b", "score": "0.65735954", "text": "func (it *Ppappa0intpe8MetricsIterator) Next() *Ppappa0intpe8Metrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Ppappa0intpe8Metrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "256a85329a1531d3c73d6d8ea3c6894d", "score": "0.6569459", "text": "func (it *DropMetricsIterator) Next() *DropMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &DropMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "b619c230982aced2e7b680d0aa0262a6", "score": "0.6564225", "text": "func (it *Sgempu3interrMetricsIterator) Next() *Sgempu3interrMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Sgempu3interrMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "f5b9aeec26d6bac42cf17107da430169", "score": "0.65581024", "text": "func (it *Ppappa1intpe9MetricsIterator) Next() *Ppappa1intpe9Metrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Ppappa1intpe9Metrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "6cbae1e0eacaed2a6c9fd5b23b7f4f32", "score": "0.65548474", "text": "func (it *Ppappa0intpe9MetricsIterator) Next() *Ppappa0intpe9Metrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Ppappa0intpe9Metrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "05852b4d43fc7300c8032a827ebe1b5d", "score": "0.65430427", "text": "func (it *Sgempu3intinfoMetricsIterator) Next() *Sgempu3intinfoMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Sgempu3intinfoMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "e53b014df91fe14ba921ecadadac4a64", "score": "0.6541143", "text": "func (it *PpppintppMetricsIterator) Next() *PpppintppMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &PpppintppMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "054a7ca637b54ebea8a047330455dd4d", "score": "0.65343153", "text": "func (it *IPv4FlowRawMetricsIterator) Next() *IPv4FlowRawMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &IPv4FlowRawMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "894d586fc4b13b0a6402461c519a18c5", "score": "0.65319574", "text": "func (it *Ppappa0intpe5MetricsIterator) Next() *Ppappa0intpe5Metrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Ppappa0intpe5Metrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "b93378184da33265e78fc603798babdc", "score": "0.653099", "text": "func (it *Prprprdintgrp1MetricsIterator) Next() *Prprprdintgrp1Metrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Prprprdintgrp1Metrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "0182d49e2eec8eccf31f59466c85c4c5", "score": "0.6524933", "text": "func (it *IntrintrintintreccMetricsIterator) Next() *IntrintrintintreccMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &IntrintrintintreccMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "e66a6d651b3efd82176f896ce14393b5", "score": "0.6524213", "text": "func (it *Ppappa1intpe5MetricsIterator) Next() *Ppappa1intpe5Metrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Ppappa1intpe5Metrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "7c02a3432048782744c6e819536328cf", "score": "0.6522285", "text": "func (it *SessionSummaryMetricsIterator) Next() *SessionSummaryMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &SessionSummaryMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "77ea73753b870ae653734490bfb73e4a", "score": "0.65141654", "text": "func (it *Ppappa1inteccMetricsIterator) Next() *Ppappa1inteccMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Ppappa1inteccMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "23164ab31bdfddbb133d0ae912e6db61", "score": "0.6506431", "text": "func (it *PrprpspintlifqstatemapMetricsIterator) Next() *PrprpspintlifqstatemapMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &PrprpspintlifqstatemapMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "e59631283ebf69a24ebf6987695d7636", "score": "0.6505546", "text": "func (it *Ppappa1intintfMetricsIterator) Next() *Ppappa1intintfMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Ppappa1intintfMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "e6a6bc87a5e39252988e13cb44f3a232", "score": "0.6501465", "text": "func (it *Ppappa1intpe7MetricsIterator) Next() *Ppappa1intpe7Metrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Ppappa1intpe7Metrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "b4d90592a5df0261a7147e51b7ebe8b7", "score": "0.64812994", "text": "func (it *Ppappa1intbndl0MetricsIterator) Next() *Ppappa1intbndl0Metrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Ppappa1intbndl0Metrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "d1fb09406f65b1cca7cada7b48928689", "score": "0.6470052", "text": "func (it *Ppappa0intpaMetricsIterator) Next() *Ppappa0intpaMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Ppappa0intpaMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "c4972a51b7e63bccc527e98b5702a689", "score": "0.64629614", "text": "func (it *Ppappa0intbndl0MetricsIterator) Next() *Ppappa0intbndl0Metrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Ppappa0intbndl0Metrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "76c72b219f9af1a598da864bf9908a05", "score": "0.64518416", "text": "func (it *Ppappa0intpe7MetricsIterator) Next() *Ppappa0intpe7Metrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Ppappa0intpe7Metrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "87f5fd3dfdcb865527014aaa5d8f9c55", "score": "0.64365774", "text": "func (it *RpcpicsintpicsMetricsIterator) Next() *RpcpicsintpicsMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &RpcpicsintpicsMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "a8cbcd674b2b79553e6f1ccb6d0f6258", "score": "0.6430614", "text": "func (it *Sgite4interrMetricsIterator) Next() *Sgite4interrMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Sgite4interrMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "4767dd139920e3408691013e8fb40029", "score": "0.64217323", "text": "func (it *L2FlowBehavioralMetricsIterator) Next() *L2FlowBehavioralMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &L2FlowBehavioralMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "f3e96d875ae28bb247bb37df26684665", "score": "0.64081836", "text": "func (it *Ppappa1intpe2MetricsIterator) Next() *Ppappa1intpe2Metrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Ppappa1intpe2Metrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "bd1ea36e61e309842de2f4f65a02cb23", "score": "0.6397079", "text": "func (it *FteLifQMetricsIterator) Next() *FteLifQMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &FteLifQMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "c3bfa8c6311bb163cf4f65d2acf5ef7e", "score": "0.6395262", "text": "func (it *PxbpxbinterrMetricsIterator) Next() *PxbpxbinterrMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &PxbpxbinterrMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "bc8e6f2c46c6c48201f60c8de9717d73", "score": "0.6387113", "text": "func (it *Sgite2interrMetricsIterator) Next() *Sgite2interrMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Sgite2interrMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "609bf6fa3ea6cabea15588c4abf8e833", "score": "0.6369898", "text": "func (it *Sgite5interrMetricsIterator) Next() *Sgite5interrMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Sgite5interrMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "3c999fd11652700b9a8ae6b53f356fd2", "score": "0.6365181", "text": "func (it *IPv4FlowBehavioralMetricsIterator) Next() *IPv4FlowBehavioralMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &IPv4FlowBehavioralMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "236ed73908ee598244ae6faf75c1872c", "score": "0.6364338", "text": "func (it *Ppappa0intintfMetricsIterator) Next() *Ppappa0intintfMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Ppappa0intintfMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "da910d62d5438a2c07ce5b5b7ee22dc2", "score": "0.6359548", "text": "func (it *Ppappa1intpe6MetricsIterator) Next() *Ppappa1intpe6Metrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Ppappa1intpe6Metrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "6ab833ce20fa009fa7432eaf87052af9", "score": "0.63543594", "text": "func (it *Ppappa0inteccMetricsIterator) Next() *Ppappa0inteccMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Ppappa0inteccMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "2219e40029440de1d7b02b8b57338caf", "score": "0.63468045", "text": "func (it *PxbpxbintitreccMetricsIterator) Next() *PxbpxbintitreccMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &PxbpxbintitreccMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "7adc62a422631e24d3419282afd2a6a4", "score": "0.63350374", "text": "func (it *Ppappa0intpe6MetricsIterator) Next() *Ppappa0intpe6Metrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Ppappa0intpe6Metrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "7a9865c485e1c0b98a5dcf92b67119e7", "score": "0.63341993", "text": "func (it *EgressDropMetricsIterator) Next() *EgressDropMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &EgressDropMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "2e709a41a0d9fb4fcb7eca39bb5522ff", "score": "0.6327629", "text": "func (it *RpcpicsintbgMetricsIterator) Next() *RpcpicsintbgMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &RpcpicsintbgMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "071f2c78e33285971a2d4dd87bc067f6", "score": "0.6327007", "text": "func (it *PtptpspinterrMetricsIterator) Next() *PtptpspinterrMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &PtptpspinterrMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "8febd91b19feb02f527e773060d2a413", "score": "0.63210285", "text": "func (it *PrprpspinterrMetricsIterator) Next() *PrprpspinterrMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &PrprpspinterrMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "cb691c8d5921f4ce9be9010e709e2b8d", "score": "0.6301105", "text": "func (it *PtptpspintfatalMetricsIterator) Next() *PtptpspintfatalMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &PtptpspintfatalMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "c86719f6a5918871c419d0757d98b9e1", "score": "0.62872654", "text": "func (it *Ppppportc1intcmacMetricsIterator) Next() *Ppppportc1intcmacMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Ppppportc1intcmacMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "5c91215f1602259827d3e8847528eada", "score": "0.6277437", "text": "func (it *PrprprdintfifoMetricsIterator) Next() *PrprprdintfifoMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &PrprprdintfifoMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "360e1a1ce6af2fe000ce80daaf680f7c", "score": "0.62636626", "text": "func (it *RpcpicspiccintpiccMetricsIterator) Next() *RpcpicspiccintpiccMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &RpcpicspiccintpiccMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "97fc6b9140fd9e8fc37e2e05703a744e", "score": "0.6261525", "text": "func (it *PtptpspintswphvmemMetricsIterator) Next() *PtptpspintswphvmemMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &PtptpspintswphvmemMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "a2d9a34d0977b628212d9a0b016c7e36", "score": "0.624356", "text": "func (it *PxbpxbinttgteccMetricsIterator) Next() *PxbpxbinttgteccMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &PxbpxbinttgteccMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" }, { "docid": "5bae54907f05420550ace88a62cecfcf", "score": "0.6233634", "text": "func (it *Ppppportc1intceccMetricsIterator) Next() *Ppppportc1intceccMetrics {\n\tmtr := it.iter.Next()\n\tif mtr == nil {\n\t\treturn nil\n\t}\n\n\ttmtr := &Ppppportc1intceccMetrics{metrics: mtr}\n\ttmtr.Unmarshal()\n\treturn tmtr\n}", "title": "" } ]
0640e0560161177f87b6344fc43aea3c
Build creates a new Site instance or fails.
[ { "docid": "6ad02fc79af37209afbc2c2e2d9ce8d8", "score": "0.68466896", "text": "func Build() (*Site, error) {\n\tpc, err := NewPatreonClient()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpledges, err := GetPledges(pc)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpeople, err := loadPeople(\"./signalboost.dhall\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsmi := sitemap.New()\n\tsmi.Add(&sitemap.URL{\n\t\tLoc: \"https://christine.website/resume\",\n\t\tLastMod: &arbDate,\n\t\tChangeFreq: sitemap.Monthly,\n\t})\n\n\tsmi.Add(&sitemap.URL{\n\t\tLoc: \"https://christine.website/contact\",\n\t\tLastMod: &arbDate,\n\t\tChangeFreq: sitemap.Monthly,\n\t})\n\n\tsmi.Add(&sitemap.URL{\n\t\tLoc: \"https://christine.website/\",\n\t\tLastMod: &arbDate,\n\t\tChangeFreq: sitemap.Monthly,\n\t})\n\n\tsmi.Add(&sitemap.URL{\n\t\tLoc: \"https://christine.website/patrons\",\n\t\tLastMod: &arbDate,\n\t\tChangeFreq: sitemap.Weekly,\n\t})\n\n\tsmi.Add(&sitemap.URL{\n\t\tLoc: \"https://christine.website/blog\",\n\t\tLastMod: &arbDate,\n\t\tChangeFreq: sitemap.Weekly,\n\t})\n\n\txffmw, err := xff.Default()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ts := &Site{\n\t\trssFeed: &feeds.Feed{\n\t\t\tTitle: \"Christine Dodrill's Blog\",\n\t\t\tLink: &feeds.Link{Href: \"https://christine.website/blog\"},\n\t\t\tDescription: \"My blog posts and rants about various technology things.\",\n\t\t\tAuthor: &feeds.Author{Name: \"Christine Dodrill\", Email: \"me@christine.website\"},\n\t\t\tCreated: bootTime,\n\t\t\tCopyright: \"This work is copyright Christine Dodrill. My viewpoints are my own and not the view of any employer past, current or future.\",\n\t\t},\n\t\tjsonFeed: &jsonfeed.Feed{\n\t\t\tVersion: jsonfeed.CurrentVersion,\n\t\t\tTitle: \"Christine Dodrill's Blog\",\n\t\t\tHomePageURL: \"https://christine.website\",\n\t\t\tFeedURL: \"https://christine.website/blog.json\",\n\t\t\tDescription: \"My blog posts and rants about various technology things.\",\n\t\t\tUserComment: \"This is a JSON feed of my blogposts. For more information read: https://jsonfeed.org/version/1\",\n\t\t\tIcon: icon,\n\t\t\tFavicon: icon,\n\t\t\tAuthor: jsonfeed.Author{\n\t\t\t\tName: \"Christine Dodrill\",\n\t\t\t\tAvatar: icon,\n\t\t\t},\n\t\t},\n\t\tmux: http.NewServeMux(),\n\t\txffmw: xffmw,\n\n\t\tclacks: ClackSet(strings.Split(envOr(\"CLACK_SET\", \"Ashlynn\"), \",\")),\n\t\tpatrons: pledges,\n\t\tSignalBoost: people,\n\t}\n\n\tposts, err := blog.LoadPosts(\"./blog/\", \"blog\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ts.Posts = posts\n\ts.Series = posts.Series()\n\tsort.Strings(s.Series)\n\n\ttalks, err := blog.LoadPosts(\"./talks\", \"talks\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ts.Talks = talks\n\n\tgallery, err := blog.LoadPosts(\"./gallery\", \"gallery\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ts.Gallery = gallery\n\n\tvar everything blog.Posts\n\teverything = append(everything, posts...)\n\teverything = append(everything, talks...)\n\teverything = append(everything, gallery...)\n\n\tsort.Sort(sort.Reverse(everything))\n\n\tresumeData, err := ioutil.ReadFile(\"./static/resume/resume.md\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ts.Resume = template.HTML(blackfriday.Run(resumeData))\n\n\tfor _, item := range everything {\n\t\ts.rssFeed.Items = append(s.rssFeed.Items, &feeds.Item{\n\t\t\tTitle: item.Title,\n\t\t\tLink: &feeds.Link{Href: \"https://christine.website/\" + item.Link},\n\t\t\tDescription: item.Summary,\n\t\t\tCreated: item.Date,\n\t\t\tContent: string(item.BodyHTML),\n\t\t})\n\n\t\ts.jsonFeed.Items = append(s.jsonFeed.Items, jsonfeed.Item{\n\t\t\tID: \"https://christine.website/\" + item.Link,\n\t\t\tURL: \"https://christine.website/\" + item.Link,\n\t\t\tTitle: item.Title,\n\t\t\tDatePublished: item.Date,\n\t\t\tContentHTML: string(item.BodyHTML),\n\t\t\tTags: item.Tags,\n\t\t})\n\n\t\tsmi.Add(&sitemap.URL{\n\t\t\tLoc: \"https://christine.website/\" + item.Link,\n\t\t\tLastMod: &item.Date,\n\t\t\tChangeFreq: sitemap.Monthly,\n\t\t})\n\t}\n\n\t// Add HTTP routes here\n\ts.mux.HandleFunc(\"/\", func(w http.ResponseWriter, r *http.Request) {\n\t\tif r.URL.Path != \"/\" {\n\t\t\tw.WriteHeader(http.StatusNotFound)\n\t\t\ts.renderTemplatePage(\"error.html\", \"can't find \"+r.URL.Path).ServeHTTP(w, r)\n\t\t\treturn\n\t\t}\n\n\t\ts.renderTemplatePage(\"index.html\", nil).ServeHTTP(w, r)\n\t})\n\ts.mux.Handle(\"/metrics\", promhttp.Handler())\n\ts.mux.Handle(\"/feeds\", middleware.Metrics(\"feeds\", s.renderTemplatePage(\"feeds.html\", nil)))\n\ts.mux.Handle(\"/patrons\", middleware.Metrics(\"patrons\", s.renderTemplatePage(\"patrons.html\", s.patrons)))\n\ts.mux.Handle(\"/signalboost\", middleware.Metrics(\"signalboost\", s.renderTemplatePage(\"signalboost.html\", s.SignalBoost)))\n\ts.mux.Handle(\"/resume\", middleware.Metrics(\"resume\", s.renderTemplatePage(\"resume.html\", s.Resume)))\n\ts.mux.Handle(\"/blog\", middleware.Metrics(\"blog\", s.renderTemplatePage(\"blogindex.html\", s.Posts)))\n\ts.mux.Handle(\"/talks\", middleware.Metrics(\"talks\", s.renderTemplatePage(\"talkindex.html\", s.Talks)))\n\ts.mux.Handle(\"/gallery\", middleware.Metrics(\"gallery\", s.renderTemplatePage(\"galleryindex.html\", s.Gallery)))\n\ts.mux.Handle(\"/contact\", middleware.Metrics(\"contact\", s.renderTemplatePage(\"contact.html\", nil)))\n\ts.mux.Handle(\"/blog.rss\", middleware.Metrics(\"blog.rss\", http.HandlerFunc(s.createFeed)))\n\ts.mux.Handle(\"/blog.atom\", middleware.Metrics(\"blog.atom\", http.HandlerFunc(s.createAtom)))\n\ts.mux.Handle(\"/blog.json\", middleware.Metrics(\"blog.json\", http.HandlerFunc(s.createJSONFeed)))\n\ts.mux.Handle(\"/blog/\", middleware.Metrics(\"blogpost\", http.HandlerFunc(s.showPost)))\n\ts.mux.Handle(\"/blog/series\", http.HandlerFunc(s.listSeries))\n\ts.mux.Handle(\"/blog/series/\", http.HandlerFunc(s.showSeries))\n\ts.mux.Handle(\"/talks/\", middleware.Metrics(\"talks\", http.HandlerFunc(s.showTalk)))\n\ts.mux.Handle(\"/gallery/\", middleware.Metrics(\"gallery\", http.HandlerFunc(s.showGallery)))\n\ts.mux.Handle(\"/css/\", http.FileServer(http.Dir(\".\")))\n\ts.mux.Handle(\"/static/\", http.FileServer(http.Dir(\".\")))\n\ts.mux.HandleFunc(\"/sw.js\", func(w http.ResponseWriter, r *http.Request) {\n\t\thttp.ServeFile(w, r, \"./static/js/sw.js\")\n\t})\n\ts.mux.HandleFunc(\"/robots.txt\", func(w http.ResponseWriter, r *http.Request) {\n\t\thttp.ServeFile(w, r, \"./static/robots.txt\")\n\t})\n\ts.mux.Handle(\"/sitemap.xml\", middleware.Metrics(\"sitemap\", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Content-Type\", \"application/xml\")\n\t\t_, _ = smi.WriteTo(w)\n\t})))\n\ts.mux.HandleFunc(\"/api/pageview-timer\", handlePageViewTimer)\n\n\treturn s, nil\n}", "title": "" } ]
[ { "docid": "f3e14ff54e96db566dcfe4d03cd6e9b5", "score": "0.6757703", "text": "func buildSingleSite(t testing.TB, depsCfg deps.DepsCfg, buildCfg BuildCfg) *Site {\n\tt.Helper()\n\treturn buildSingleSiteExpected(t, false, false, depsCfg, buildCfg)\n}", "title": "" }, { "docid": "a3fd90549567f560bf94dccd86a8ace6", "score": "0.61911476", "text": "func (site *site) build() error {\n\tstartTime := time.Now()\n\t// Parse configuration files.\n\tif err := site.parseConfigs(); err != nil {\n\t\treturn err\n\t}\n\t// Synthesize root config.\n\tsite.rootConf = newConfig()\n\tif len(site.confs) > 0 && site.confs[0].origin == site.templateDir {\n\t\tsite.rootConf.merge(site.confs[0])\n\t}\n\tsite.verbose2(\"root config: \\n\" + site.rootConf.String())\n\tif !dirExists(site.buildDir) {\n\t\tif err := os.Mkdir(site.buildDir, 0775); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tsite.docs = newDocumentsLookup()\n\t// Delete everything in the build directory forcing a complete site rebuild.\n\tfiles, _ := filepath.Glob(filepath.Join(site.buildDir, \"*\"))\n\tfor _, f := range files {\n\t\tif err := os.RemoveAll(f); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t// Parse all template files.\n\tsite.htmlTemplates = newHTMLTemplates(site.templateDir)\n\tsite.textTemplates = newTextTemplates(site.templateDir)\n\terr := filepath.Walk(site.templateDir, func(f string, info os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif f == site.templateDir {\n\t\t\treturn nil\n\t\t}\n\t\tif info.IsDir() && f == site.initDir {\n\t\t\treturn filepath.SkipDir\n\t\t}\n\t\tif site.exclude(f) {\n\t\t\tsite.verbose(\"exclude: \" + f)\n\t\t\tif info.IsDir() {\n\t\t\t\treturn filepath.SkipDir\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\t\tif !info.IsDir() {\n\t\t\tswitch filepath.Ext(f) {\n\t\t\tcase \".toml\", \".yaml\":\n\t\t\t\t// Skip configuration file.\n\t\t\tcase \".html\":\n\t\t\t\t// Compile HTML template.\n\t\t\t\tsite.verbose(\"parse template: \" + f)\n\t\t\t\terr = site.htmlTemplates.add(f)\n\t\t\tcase \".txt\":\n\t\t\t\t// Compile text template.\n\t\t\t\tsite.verbose(\"parse template: \" + f)\n\t\t\t\terr = site.textTemplates.add(f)\n\t\t\t}\n\t\t}\n\t\treturn err\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Parse content directory documents and copy/render static files to the build directory.\n\tdraftsCount := 0\n\tdocsCount := 0\n\tstaticCount := 0\n\terrCount := 0\n\terr = filepath.Walk(site.contentDir, func(f string, info os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif f == site.contentDir {\n\t\t\treturn nil\n\t\t}\n\t\tif site.exclude(f) {\n\t\t\tsite.verbose(\"exclude: \" + f)\n\t\t\tif info.IsDir() {\n\t\t\t\treturn filepath.SkipDir\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\t\tif !info.IsDir() {\n\t\t\tswitch filepath.Ext(f) {\n\t\t\tcase \".md\", \".rmu\":\n\t\t\t\tdocsCount++\n\t\t\t\t// Parse document.\n\t\t\t\tdoc, err := newDocument(f, site)\n\t\t\t\tif err != nil {\n\t\t\t\t\terrCount++\n\t\t\t\t\tsite.logerror(err.Error())\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\tif doc.isDraft() {\n\t\t\t\t\tdraftsCount++\n\t\t\t\t\tsite.verbose(\"skip draft: \" + f)\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\tif err := site.docs.add(&doc); err != nil {\n\t\t\t\t\terrCount++\n\t\t\t\t\tsite.logerror(err.Error())\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\tstaticCount++\n\t\t\t\tif err := site.buildStaticFile(f); err != nil {\n\t\t\t\t\terrCount++\n\t\t\t\t\tsite.logerror(err.Error())\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Create indexes.\n\tsite.idxs, err = newIndexes(site)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, doc := range site.docs.byContentPath {\n\t\tsite.idxs.addDocument(doc)\n\t}\n\t// Build index pages.\n\terr = site.idxs.build()\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Render documents.\n\tfor _, doc := range site.docs.byContentPath {\n\t\tif err = site.renderDocument(doc); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t// Install home page.\n\tif err := site.copyHomePage(); err != nil {\n\t\treturn err\n\t}\n\t// Print summary.\n\tif errCount == 0 {\n\t\tcolor.Set(color.FgGreen, color.Bold)\n\t}\n\tsite.logconsole(\"documents: %d\", docsCount)\n\tsite.logconsole(\"drafts: %d\", draftsCount)\n\tsite.logconsole(\"static: %d\", staticCount)\n\tsite.logconsole(\"time: %.2fs\", time.Now().Sub(startTime).Seconds())\n\tcolor.Unset()\n\t// Report accumulated document parse errors.\n\tif errCount > 0 {\n\t\treturn fmt.Errorf(\"document parse errors: %d\", errCount)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c851567d283ca23c8bd4edbd94c2ab0f", "score": "0.60829306", "text": "func NewSite(cmd *cobra.Command, args []string) error {\n\tif len(args) < 1 {\n\t\treturn newUserError(\"path needs to be provided\")\n\t}\n\n\tcreatepath, err := filepath.Abs(filepath.Clean(args[0]))\n\tif err != nil {\n\t\treturn newUserError(err)\n\t}\n\n\tforceNew, _ := cmd.Flags().GetBool(\"force\")\n\n\treturn doNewSite(hugofs.NewDefault(viper.New()), createpath, forceNew)\n}", "title": "" }, { "docid": "2bf4bd3ab55542225e9c4d03d2107d93", "score": "0.5796003", "text": "func New(opts ...option) *Site {\n\tcfg := setupConfig(opts...)\n\ts := new(Site)\n\ts.Config = cfg\n\tlog.Println(\"created new site with config\", cfg)\n\ts.Pages = make(map[string]*context.Page)\n\ts.CanPublish = true\n\treturn s\n}", "title": "" }, { "docid": "0b9bce44aab26b4c31a3ddc4f7e155f8", "score": "0.5677854", "text": "func New(config config.Config, outputPath string) *Site {\n\tsite := &Site{Config: config, outputPath: outputPath}\n\treturn site\n}", "title": "" }, { "docid": "a75a2bd852002146c10473328d243b35", "score": "0.5669744", "text": "func (s *Service) Build(ID int64) (build *model.Build, err error) {\n\tbuild = new(model.Build)\n\tif err = s.dao.DB.First(&build, ID).Error; err != nil {\n\t\tlog.Error(\"Build(%v) error(%v)\", ID, err)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = ecode.NothingFound\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "76dc97dc182487499ba5e9443639abf5", "score": "0.56583995", "text": "func (ts *Tester) Build() error {\n\t// no-op\n\treturn nil\n}", "title": "" }, { "docid": "ed950906a347a07064e24ea3df0c7f80", "score": "0.55377865", "text": "func (_ *SiteConfig) New () (site *SiteConfig) {\n remote, _ := url.Parse(\"ftps://\")\n site = &SiteConfig{\n Name: \"New site\",\n CacheFile: \".ftpsync-cache\",\n RemoteAddr: remote,\n Exclude: \"@.gitignore|.DS_Store|_vti_cnf|_vti_pvt|thumbs.db|.git\",\n BinaryFiles: \".jar|.phar|.zip|.mp3|.mp4|.ogg|.mkv|.png|.gif|.jpg|.jpeg\",\n }\n return\n}", "title": "" }, { "docid": "c5cb6094b6ac1a9a06a5a0eb34e81ff8", "score": "0.55350256", "text": "func (t *Tag) Build() {\n\tf, err := os.Create(t.publicPath())\n\tcheck(err)\n\tcheck(tagPage.Execute(f, t))\n}", "title": "" }, { "docid": "99e8f450d5b9f49736bc94540bb99058", "score": "0.5480767", "text": "func NewSite(ctx *pulumi.Context,\n\tname string, args *SiteArgs, opts ...pulumi.ResourceOption) (*Site, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.SiteId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'SiteId'\")\n\t}\n\treplaceOnChanges := pulumi.ReplaceOnChanges([]string{\n\t\t\"project\",\n\t\t\"siteId\",\n\t})\n\topts = append(opts, replaceOnChanges)\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource Site\n\terr := ctx.RegisterResource(\"google-native:firebasehosting/v1beta1:Site\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "8b8f3e2e3cae2604c0373749a2b927e2", "score": "0.54476196", "text": "func BuildSite() error {\n\tcurDir, curDirErr := os.Getwd()\n\tif curDirErr != nil {\n\t\treturn curDirErr\n\t}\n\t// Run the react-scripts build command\n\tabsPath, absPathErr := filepath.Abs(\"./aws-amplify-auth-starters\")\n\tif absPathErr != nil {\n\t\treturn absPathErr\n\t}\n\tchgDirErr := os.Chdir(absPath)\n\tif chgDirErr != nil {\n\t\treturn chgDirErr\n\t}\n\trunErr := sh.Run(\"npm\", \"run-script\", \"build\")\n\trestoreErr := os.Chdir(curDir)\n\tif restoreErr != nil {\n\t\tfmt.Fprintf(os.Stderr,\n\t\t\t\"Failed to restore working directory: %s\",\n\t\t\trestoreErr.Error())\n\t}\n\treturn runErr\n}", "title": "" }, { "docid": "1f7ddee0a6cef2cf6c400c2487c919db", "score": "0.54368013", "text": "func Build(t testing.TestingT, path string, options *BuildOptions) {\n\trequire.NoError(t, BuildE(t, path, options))\n}", "title": "" }, { "docid": "02ce6f2d7043453aa334610268a194f8", "score": "0.54336315", "text": "func (api Api) CreateBuild(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tvars := mux.Vars(r)\n\n\tproject, ok := vars[\"id\"]\n\tif !ok {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tglog.Infof(\"Building project %s\", project)\n\n\tw.WriteHeader(http.StatusAccepted)\n}", "title": "" }, { "docid": "52e1816f5caa3c4e601bec4fa5a31460", "score": "0.54218936", "text": "func (b *MachineBuilder) Build() *StateMachine {\n\treturn &StateMachine{\n\t\tsteps: b.steps,\n\t\tmiddleware: b.middleware,\n\t}\n}", "title": "" }, { "docid": "1f9e9b68a55fd5079a36719b0eeee572", "score": "0.5415936", "text": "func NewSite() *Site {\n\ttmpl := make(map[string]*template.Template)\n\ttmpl[\"index.html\"] = template.Must(template.New(\"index\").ParseFiles(\"templates/index.tmpl\", \"templates/_latest_news.tmpl\", \"templates/_base.tmpl\"))\n\ttmpl[\"contact.html\"] = template.Must(template.New(\"contact\").ParseFiles(\"templates/contact.tmpl\", \"templates/_latest_news.tmpl\", \"templates/_base.tmpl\"))\n\ttmpl[\"donate.html\"] = template.Must(template.New(\"donate\").ParseFiles(\"templates/donate.tmpl\", \"templates/_latest_news.tmpl\", \"templates/_base.tmpl\"))\n\n\treturn &Site{templates: tmpl}\n}", "title": "" }, { "docid": "d24d75d2536b86b304bb2a0ffd1a0c6e", "score": "0.5413454", "text": "func (c Configuration) Build() (zapcore.Core, error) {\n\tclient, err := raven.New(c.DSN)\n\tif err != nil {\n\t\treturn zapcore.NewNopCore(), err\n\t}\n\tclient.SetRelease(c.Release)\n\treturn newCore(c, client, zapcore.ErrorLevel), nil\n}", "title": "" }, { "docid": "8bcf8ca767563c2c57cad9bc54806b2e", "score": "0.54103947", "text": "func (builder testBuilder) Build(config *s2iapi.Config) (*s2iapi.Result, error) {\n\treturn nil, builder.buildError\n}", "title": "" }, { "docid": "40b4e7b9f84d93640c1e00e3503f7a05", "score": "0.538626", "text": "func CreateSite(site models.Site) (models.Site, error) {\n\tsite.CreatedAt = time.Now()\n\tsite.UpdatedAt = time.Now()\n\tsite.ID = bson.NewObjectId()\n\n\terr := DB.C(sitesCollection).Insert(site)\n\n\tUpdateContact(site.ID, models.ContactContent{OwnerID: site.OwnerID, SiteID: site.ID})\n\tUpdateAbout(site.ID, models.AboutContent{OwnerID: site.OwnerID, SiteID: site.ID})\n\n\treturn site, err\n}", "title": "" }, { "docid": "0cfe93eb3cae280ea895dd196f54f3ca", "score": "0.5380869", "text": "func Create(dst string) (err error) {\n\treturn fs.WalkDir(site, \"site\", func(path string, d fs.DirEntry, err error) error {\n\t\tsp := strings.TrimPrefix(path, \"site/\")\n\t\tdp := filepath.Join(dst, sp)\n\n\t\tif d.IsDir() {\n\t\t\treturn nil\n\t\t}\n\n\t\tdir := filepath.Dir(dp)\n\t\tif err := fileutil.Mkdir(dir); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tin, err := site.Open(path)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer in.Close()\n\n\t\tout, err := os.Create(dp)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t_, err = io.Copy(out, in)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn out.Close()\n\t})\n}", "title": "" }, { "docid": "e1601ba04cebdb086b1855c57219c14c", "score": "0.5371679", "text": "func Site(ctx context.Context, site string) (*Sitemap, error) {\n\t// Validation\n\tif site == \"\" {\n\t\treturn nil, ErrURLInvalid\n\t}\n\tsiteURL, err := url.Parse(site)\n\tif err != nil {\n\t\treturn nil, ErrURLInvalid\n\t}\n\n\t// Run the scraping of the site\n\tc := &crawler{\n\t\trootURL: siteURL,\n\t\t// TODO allow logger & client to be specified\n\t\tclient: defaultHTTPClient,\n\t\tlogger: log.New(os.Stdout, \"\", log.LstdFlags),\n\t}\n\tresults, err := c.Crawl(ctx, siteURL.String())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Copy map of scraped sites into URL set\n\ti := 0\n\tpages := make([]*Page, len(results))\n\tfor _, val := range results {\n\t\tpages[i] = val\n\t\ti++\n\t}\n\n\t// Return the sitemap response\n\treturn &Sitemap{\n\t\tPages: pages,\n\t}, nil\n}", "title": "" }, { "docid": "85ad09cf2466ca4c41b285c6c3527f6a", "score": "0.5362928", "text": "func (c *Config) Build() *Server {\n\tserver := newServer(c)\n\tserver.Use(\n\t\tErrorTrace(c._logger),\n\t\tLogMiddle(c._logger, c.Name),\n\t)\n\n\treturn server\n}", "title": "" }, { "docid": "3e3dae1f86e25121f1b4364578992af9", "score": "0.5351019", "text": "func (b *Builder) Build() error {\n\tif err := b.validate(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := b.init(); err != nil {\n\t\treturn err\n\t}\n\n\treturn b.pony.RenderPages(fileWriter(b.OutDir))\n}", "title": "" }, { "docid": "5e06a1fffb9d01eaa0e1b7197caf0297", "score": "0.5321003", "text": "func Build(ctx context.Context, _ interface{}) error {\n\thttpClient := http.Client{\n\t\tTimeout: 10 * time.Second,\n\t}\n\n\tstorageClient, err := storage.NewClient(ctx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"create storage client: %v\", err)\n\t}\n\n\tremoteConfig, err := storageClient.Bucket(env.ConfigBucket).Object(env.ConfigObject).NewReader(ctx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"create remote config reader: %v\", err)\n\t}\n\n\tconfigBody := &bytes.Buffer{}\n\t_, err = io.Copy(configBody, remoteConfig)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"read remote config response: %v\", err)\n\t}\n\n\terr = remoteConfig.Close()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"close remote config: %v\", err)\n\t}\n\n\tconfig, err := (&website.Config{}).Parse(configBody.String())\n\tif err != nil {\n\t\treturn fmt.Errorf(\"parse remote config: %v\", err)\n\t}\n\n\tquery, err := config.Query()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"generate query from config: %v\", err)\n\t}\n\n\tdataReq, err := http.NewRequest(\"POST\", env.GraphQLEndpoint, bytes.NewReader(query))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"create data request: %v\", err)\n\t}\n\tdataReq = dataReq.WithContext(ctx)\n\tdataReq.Header.Add(\"Authorization\", fmt.Sprintf(\"bearer %v\", env.GraphQLToken))\n\n\tdataRes, err := httpClient.Do(dataReq)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"request for data failed\")\n\t}\n\n\tdataBody := &bytes.Buffer{}\n\t_, err = io.Copy(dataBody, dataRes.Body)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"read data response: %v\", err)\n\t}\n\n\tdata, err := (&website.Data{}).Parse(dataBody.String())\n\tif err != nil {\n\t\treturn fmt.Errorf(\"parse received data: %v\", err)\n\t}\n\n\ttemplates, err := storageClient.Bucket(env.TemplateBucket).Object(env.TemplateObject).NewReader(ctx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"create remote template reader: %v\", err)\n\t}\n\n\ttemplateDir, err := unzip(templates)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unzip templates: %v\", err)\n\t}\n\n\terr = templates.Close()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"close remote templates: %v\", err)\n\t}\n\n\tfor i := 0; i < len(config.Creations); i++ {\n\t\tdata.Creations = append(data.Creations, &website.CreationData{\n\t\t\tTitle: config.Creations[i].Title,\n\t\t\tImageURL: config.Creations[i].ImageURL,\n\t\t\tBackgroundColor: config.Creations[i].BackgroundColor,\n\t\t})\n\t}\n\n\toutput, err := website.Render(templateDir, env.TemplateEntry, data)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"render templates: %v\", err)\n\t}\n\n\tstorageObject := storageClient.Bucket(env.UploadBucket).Object(env.UploadObject).NewWriter(ctx)\n\n\t_, err = io.Copy(storageObject, output)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"write output: %v\", err)\n\t}\n\n\terr = storageObject.Close()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"write output to storage: %v\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0e7d0ef3daffbe455f0e856b722b08a8", "score": "0.53202564", "text": "func (d *Detector) Build(ccid string, mdBytes []byte, codeStream io.Reader) (*Instance, error) {\n\t// A small optimization: prevent exploding the build package out into the\n\t// file system unless there are external builders defined.\n\tif len(d.Builders) == 0 {\n\t\treturn nil, nil\n\t}\n\n\t// Look for a cached instance.\n\ti, err := d.CachedBuild(ccid)\n\tif err != nil {\n\t\treturn nil, errors.WithMessage(err, \"existing build could not be restored\")\n\t}\n\tif i != nil {\n\t\treturn i, nil\n\t}\n\n\tbuildContext, err := NewBuildContext(ccid, mdBytes, codeStream)\n\tif err != nil {\n\t\treturn nil, errors.WithMessage(err, \"could not create build context\")\n\t}\n\tdefer buildContext.Cleanup()\n\n\tbuilder := d.detect(buildContext)\n\tif builder == nil {\n\t\tlogger.Debugf(\"no external builder detected for %s\", ccid)\n\t\treturn nil, nil\n\t}\n\n\tif err := builder.Build(buildContext); err != nil {\n\t\treturn nil, errors.WithMessage(err, \"external builder failed to build\")\n\t}\n\n\tif err := builder.Release(buildContext); err != nil {\n\t\treturn nil, errors.WithMessage(err, \"external builder failed to release\")\n\t}\n\n\tdurablePath := filepath.Join(d.DurablePath, SanitizeCCIDPath(ccid))\n\n\terr = os.Mkdir(durablePath, 0o700)\n\tif err != nil {\n\t\treturn nil, errors.WithMessagef(err, \"could not create dir '%s' to persist build output\", durablePath)\n\t}\n\n\tbuildInfo, err := json.Marshal(&BuildInfo{\n\t\tBuilderName: builder.Name,\n\t})\n\tif err != nil {\n\t\tos.RemoveAll(durablePath)\n\t\treturn nil, errors.WithMessage(err, \"could not marshal for build-info.json\")\n\t}\n\n\terr = os.WriteFile(filepath.Join(durablePath, \"build-info.json\"), buildInfo, 0o600)\n\tif err != nil {\n\t\tos.RemoveAll(durablePath)\n\t\treturn nil, errors.WithMessage(err, \"could not write build-info.json\")\n\t}\n\n\tdurableReleaseDir := filepath.Join(durablePath, \"release\")\n\terr = CopyDir(logger, buildContext.ReleaseDir, durableReleaseDir)\n\tif err != nil {\n\t\treturn nil, errors.WithMessagef(err, \"could not move or copy build context release to persistent location '%s'\", durablePath)\n\t}\n\n\tdurableBldDir := filepath.Join(durablePath, \"bld\")\n\terr = CopyDir(logger, buildContext.BldDir, durableBldDir)\n\tif err != nil {\n\t\treturn nil, errors.WithMessagef(err, \"could not move or copy build context bld to persistent location '%s'\", durablePath)\n\t}\n\n\treturn &Instance{\n\t\tPackageID: ccid,\n\t\tBuilder: builder,\n\t\tBldDir: durableBldDir,\n\t\tReleaseDir: durableReleaseDir,\n\t\tTermTimeout: 5 * time.Second,\n\t}, nil\n}", "title": "" }, { "docid": "a8cbefc949b076026fd7bb1fbc33ec4c", "score": "0.5293771", "text": "func NewSite(url string) (catalog.Site, query.Error) {\n\tclog.To(catalog.CHANNEL, \"Created New Site %s\", url)\n\tclient, err := cb.Connect(url)\n\n\tif err != nil {\n\t\treturn nil, query.NewError(err, \"\")\n\t}\n\n\treturn &site{\n\t\tclient: client,\n\t\tpoolCache: make(map[string]catalog.Pool),\n\t}, nil\n}", "title": "" }, { "docid": "a96162e23c14f3756edb3ab268b26260", "score": "0.5279122", "text": "func (build *serverBuilder) Create() servers.ServerBuilder {\n\tbuild.url = \"\"\n\treturn build\n}", "title": "" }, { "docid": "49da05ec304c8c60c6526a7ace71f18b", "score": "0.523301", "text": "func (r *Request) Build() error {\n\tif !r.built {\n\t\tr.Handlers.Validate.Run(r)\n\t\tif r.Error != nil {\n\t\t\tdebugLogReqError(r, \"Validate Request\", notRetrying, r.Error)\n\t\t\treturn r.Error\n\t\t}\n\t\tr.Handlers.Build.Run(r)\n\t\tif r.Error != nil {\n\t\t\tdebugLogReqError(r, \"Build Request\", notRetrying, r.Error)\n\t\t\treturn r.Error\n\t\t}\n\t\tr.built = true\n\t}\n\n\treturn r.Error\n}", "title": "" }, { "docid": "ed5c2e623838b18f1e0597b1ab651be7", "score": "0.5223458", "text": "func (b *BaseRequest) Build(service, version string) ows.Exception {\n\tif service != `` {\n\t\t// Service is optional, because it's implicit for a GetMap/GetFeatureInfo request\n\t\tb.Service = service\n\t}\n\tif version != `` {\n\t\tb.Version = version\n\t} else {\n\t\t// Version is mandatory\n\t\treturn ows.MissingParameterValue(VERSION)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "180f4bcd9102ef44b0b6a00f1b37f176", "score": "0.5222158", "text": "func (f *MachineFactory) MustBuild() *Machine {\n\tmachine, err := f.Build()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn machine\n}", "title": "" }, { "docid": "88c775d590ebe338d03840b456d26403", "score": "0.51951563", "text": "func (mc *MakeControl) Build() (*Make, error) {\n\tvar m Make\n\n\tmts, mtss, err := mc.buildTasksAndTargetSequences()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"building target definitions\")\n\t}\n\tm.MergeTasks(mts...)\n\tm.MergeTargetSequences(mtss...)\n\n\tmvs, err := mc.buildVariants()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"building variant definitions\")\n\t}\n\tm.MergeVariants(mvs...)\n\n\tgc, err := mc.buildGeneral()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"building top-level configuration\")\n\t}\n\tm.GeneralConfig = gc\n\n\tm.ApplyDefaultTags()\n\n\tif err := m.Validate(); err != nil {\n\t\treturn nil, errors.Wrap(err, \"invalid build configuration\")\n\t}\n\n\treturn &m, nil\n}", "title": "" }, { "docid": "3bdf475224219dcf3ac06ac5df9d957d", "score": "0.51810056", "text": "func (vt *VTree) Build(s db.Sources) error {\n\treturn vt.PopulateNodes(s, true)\n}", "title": "" }, { "docid": "05552b0afb5e5383980d484049b278b7", "score": "0.51676005", "text": "func (b *Builder) Build(ctx devspacecontext.Context) error {\n\treturn b.helper.Build(ctx, b)\n}", "title": "" }, { "docid": "35833590b446ec2b7857122928de1a31", "score": "0.515505", "text": "func (o *Me) CreateSiteInfo(child *SiteInfo) *bambou.Error {\n\n\treturn bambou.CurrentSession().CreateChild(o, child)\n}", "title": "" }, { "docid": "91dc3e436a3eb432fe79abd27db9acda", "score": "0.5144723", "text": "func (b builder) Build() *FSM {\n\tfsm := FSM(b)\n\treturn &fsm\n}", "title": "" }, { "docid": "3618676d4f4e18f51acde9b7f357a761", "score": "0.51367986", "text": "func (site Site) Write() (err error) {\n\tloadTemplates()\n\n\tvar wg sync.WaitGroup\n\tchErrors := make(chan error, 12) // Enough buffer for all the subroutines\n\n\twg.Add(4) // The following 4 subroutines are mandatory\n\n\tgo func() {\n\t\tdefer wg.Done()\n\t\ti, err := site.writeIndexes()\n\t\tfmt.Println(logCreation(\"index page\", i))\n\t\tif err != nil {\n\t\t\tlog.Panic(err)\n\t\t}\n\t\tchErrors <- err\n\t}()\n\n\tgo func() {\n\t\tdefer wg.Done()\n\t\ti, err := site.writeFeeds()\n\t\tfmt.Println(logCreation(\"feed\", i))\n\t\tchErrors <- err\n\t}()\n\n\tgo func() {\n\t\tdefer wg.Done()\n\t\ti, err := site.writeArticles()\n\t\tfmt.Println(logCreation(\"article\", i))\n\t\tchErrors <- err\n\t}()\n\n\tgo func() {\n\t\tdefer wg.Done()\n\t\ti, err := site.writePages()\n\t\tfmt.Println(logCreation(\"page\", i))\n\t\tchErrors <- err\n\t}()\n\n\tif site.Config.ShowArchive {\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tdefer wg.Done()\n\t\t\terr := site.writeArchive()\n\t\t\tfmt.Println(logCreation(\"archive\", 1)) // If error it will not be 1, but we don't care\n\t\t\tchErrors <- err\n\t\t}()\n\t}\n\tif site.Config.ShowCategories {\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tdefer wg.Done()\n\t\t\ti, err := site.writeCategories()\n\t\t\tfmt.Println(logCreation(\"category page\", i))\n\t\t\tchErrors <- err\n\t\t}()\n\t}\n\tif site.Config.ShowTags {\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tdefer wg.Done()\n\t\t\ti, err := site.writeTags()\n\t\t\tfmt.Println(logCreation(\"tag page\", i))\n\t\t\tchErrors <- err\n\t\t}()\n\t}\n\n\twg.Wait()\n\nLOOP:\n\tfor {\n\t\tselect {\n\t\tcase err := <-chErrors:\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\tdefault:\n\t\t\tbreak LOOP\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0f2d7929253e13afbaa7a8ae85cce789", "score": "0.5134155", "text": "func (s *ServiceServerBuilder) Build(v *viper.Viper) {\n\tif s.built { return }\n\n\t// Builds the server\n\ts.server = &ServiceServer{}\n\ts.server.ConfigureServer(v)\n\n\ts.built = true\n}", "title": "" }, { "docid": "872e011d9d720794cca88a5b2e919744", "score": "0.5125989", "text": "func (b Builder) Build() {\n\tserverInstance = server{\n\t\tdriver: b.driver,\n\t}\n\n\tb.driver.Run()\n\n\tserverInstance.ctx = serverInstance.driver.Init()\n}", "title": "" }, { "docid": "dba22ad567e0fafc50b51cf7598fd95d", "score": "0.51084226", "text": "func NewGetSiteBuildDefault(code int) *GetSiteBuildDefault {\n\treturn &GetSiteBuildDefault{\n\t\t_statusCode: code,\n\t}\n}", "title": "" }, { "docid": "9797dedc1aa0fdaa543a6f172417735c", "score": "0.5107259", "text": "func (app *Application) Build() (err error) {\n\tapp.once.Do(func() {\n\t\t// view engine\n\t\t// here is where we declare the closed-relative framework functions.\n\t\t// Each engine has their defaults, i.e yield,render,render_r,partial, params...\n\t\trv := router.NewRoutePathReverser(app.APIBuilder)\n\t\tapp.view.AddFunc(\"urlpath\", rv.Path)\n\t\t// app.view.AddFunc(\"url\", rv.URL)\n\t\terr = app.view.Load()\n\t\tif err != nil {\n\t\t\treturn // if view engine loading failed then don't continue\n\t\t}\n\n\t\tif !app.Router.Downgraded() {\n\t\t\t// router\n\t\t\t// create the request handler, the default routing handler\n\t\t\tvar routerHandler = router.NewDefaultHandler()\n\n\t\t\terr = app.Router.BuildRouter(app.ContextPool, routerHandler, app.APIBuilder)\n\t\t\t// re-build of the router from outside can be done with;\n\t\t\t// app.RefreshRouter()\n\t\t}\n\n\t})\n\n\treturn\n}", "title": "" }, { "docid": "baf9c3920353d0481a3ee8e1ac88e8c8", "score": "0.50988704", "text": "func (server *TestServer) createSite(endpoint *Endpoint) string {\n\tif server.isInSingleSiteMode() {\n\t\tlog.Fatalf(\"Can't create site: running in single site mode. Site endpoint: %v\", endpoint)\n\t}\n\tresp := POST(server.getURL(), fmt.Sprintf(\"%s?output=short&method=%s\", endpoint.Path, endpoint.Method),\n\t\tmakeFullDomain(\"create\"), endpoint.Response)\n\tdomain := string(read(resp))\n\treturn getSubdomain(domain)\n}", "title": "" }, { "docid": "fb8cc14c0a7f0d93d28af62561d636fe", "score": "0.50918615", "text": "func (this *ApplicationBuilder) Build() interface{} {\n\tif this.hostContext == nil {\n\t\tpanic(\"hostContext is nil! please set.\")\n\t}\n\tthis.buildMiddleware()\n\tthis.buildEndPoints()\n\tthis.buildMvc()\n\treturn this\n}", "title": "" }, { "docid": "9f18e65441f3af7f55e18a5591ae1766", "score": "0.5088792", "text": "func (m *EdiscoveryCasesItemLegalHoldsItemSiteSourcesSiteSourceItemRequestBuilder) Site()(*EdiscoveryCasesItemLegalHoldsItemSiteSourcesItemSiteRequestBuilder) {\n return NewEdiscoveryCasesItemLegalHoldsItemSiteSourcesItemSiteRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)\n}", "title": "" }, { "docid": "1eed0feea4424b0fe49de585b1ca0dd5", "score": "0.5084174", "text": "func (p *ProcessExitTransaction) Build() error {\n\t// TODO validation\n\treturn nil\n}", "title": "" }, { "docid": "a8936c14fd5f2c876e61d7d1c95fc50b", "score": "0.5071438", "text": "func (b *build) NewBuild() (token string, err error) {\n\tconfig := *b.config\n\treturn b.parentApp.NewBuild(b.Group(), &config)\n}", "title": "" }, { "docid": "0194d4f95a101fe3f067e47158589ae8", "score": "0.5070593", "text": "func (gp *Provider) Build(config config.Credentials) provider.Provider {\n\tclient := NewClient()\n\tteams := gp.teamConfigsToTeam(config.Github.Teams)\n\n\treturn &Provider{\n\t\tVerifier: provider.NewVerifierBasket(\n\t\t\tNewTeamVerifier(teams, client),\n\t\t\tNewOrganizationVerifier(config.Github.Organizations, client),\n\t\t),\n\t\tteams: teams,\n\t\tconfig: config,\n\t}\n}", "title": "" }, { "docid": "16d41465be53b1b757103a0efb88cfdc", "score": "0.50691247", "text": "func (w *Watcher) Build() (*models.RouterConfig, error) {\n\tappServices, err := w.GetMyStackServices()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trouterConfig := models.NewRouterConfig(w.kubeDomainSuffix)\n\tfor _, appService := range appServices.Items {\n\t\tappConfig := models.BuildAppConfig(\n\t\t\t&appService,\n\t\t\tw.kubeDomainSuffix,\n\t\t)\n\t\trouterConfig.AppConfigs = append(routerConfig.AppConfigs, appConfig)\n\t}\n\n\treturn routerConfig, nil\n}", "title": "" }, { "docid": "2c7af1837c36f0f4ab8fac4e56968cb1", "score": "0.50495267", "text": "func newSiteData(dir string) (SiteData, error) {\n\tsf, err := os.Open(filepath.Join(dir, \"sites.json\"))\n\tif err != nil {\n\t\treturn SiteData{}, err\n\t}\n\tdefer sf.Close()\n\n\tmf, err := os.Open(filepath.Join(dir, \"machines.json\"))\n\tif err != nil {\n\t\treturn SiteData{}, err\n\t}\n\tdefer mf.Close()\n\n\tsd := SiteData{Sites: map[string]Site{}, Machines: map[string]Machine{}}\n\n\tsitesDec := json.NewDecoder(sf)\n\tfor sitesDec.More() {\n\t\ts := Site{}\n\t\tif err := sitesDec.Decode(&s); err != nil {\n\t\t\treturn SiteData{}, err\n\t\t}\n\t\tif err := s.Validate(); err != nil {\n\t\t\treturn SiteData{}, err\n\t\t}\n\t\tsd.Sites[s.Name] = s\n\t}\n\n\tmachinesDec := json.NewDecoder(mf)\n\tfor machinesDec.More() {\n\t\tm := Machine{}\n\t\tif err := machinesDec.Decode(&m); err != nil {\n\t\t\treturn SiteData{}, err\n\t\t}\n\t\tif err := m.Validate(); err != nil {\n\t\t\treturn SiteData{}, err\n\t\t}\n\t\ts, ok := sd.Sites[m.Site]\n\t\tif !ok {\n\t\t\treturn SiteData{}, fmt.Errorf(\"Machine(%s) has Site(%s) that was not found in our sites.json file\", m.Name, m.Site)\n\t\t}\n\t\ts.Machines = append(s.Machines, m)\n\t\tsd.Sites[m.Site] = s\n\t\tsd.Machines[m.FullName()] = m\n\t}\n\treturn sd, nil\n}", "title": "" }, { "docid": "9400389f2e0ed1485c114379f98136c8", "score": "0.50330013", "text": "func (rdb *SQLiteSiteDatasource) Create(s *Site) (int, error) {\n\tres, err := rdb.SQLConn.Exec(\"INSERT INTO site (title, link, section, content, published, published_on, last_modified, order_no, user_id) \"+\n\t\t\"VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)\",\n\t\ts.Title, s.Link, s.Section, s.Content, s.Published, s.PublishedOn, time.Now(), s.OrderNo, s.Author.ID)\n\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\n\ti, err := res.LastInsertId()\n\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\n\treturn int(i), nil\n}", "title": "" }, { "docid": "7dfc4b5fda864a090fd945d1b11b0799", "score": "0.5028206", "text": "func (b *Builder) Build(file string) error {\n\topts := b.opts\n\n\tif opts.NoCache {\n\t\tos.RemoveAll(opts.Config.StackerDir)\n\t}\n\n\tfmt.Printf(\"Build subs: %v\\n\", b.opts.Config.Substitutions())\n\tsf, err := NewStackerfile(file, append(opts.Substitute, b.opts.Config.Substitutions()...))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ts, err := NewStorage(opts.Config)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !opts.LeaveUnladen {\n\t\tdefer s.Detach()\n\t}\n\n\torder, err := sf.DependencyOrder()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar oci casext.Engine\n\tif _, statErr := os.Stat(opts.Config.OCIDir); statErr != nil {\n\t\toci, err = umoci.CreateLayout(opts.Config.OCIDir)\n\t} else {\n\t\toci, err = umoci.OpenLayout(opts.Config.OCIDir)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer oci.Close()\n\n\t// Add this stackerfile to the list of stackerfiles which were built\n\tb.builtStackerfiles[file] = sf\n\tbuildCache, err := OpenCache(opts.Config, oci, b.builtStackerfiles)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// compute the git version for the directory that the stacker file is\n\t// in. we don't care if it's not a git directory, because in that case\n\t// we'll fall back to putting the whole stacker file contents in the\n\t// metadata.\n\tgitVersion, _ := GitVersion(sf.referenceDirectory)\n\n\tusername := os.Getenv(\"SUDO_USER\")\n\n\tif username == \"\" {\n\t\tuser, err := user.Current()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tusername = user.Username\n\t}\n\n\thost, err := os.Hostname()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tauthor := fmt.Sprintf(\"%s@%s\", username, host)\n\n\ts.Delete(WorkingContainerName)\n\tfor _, name := range order {\n\t\tl, ok := sf.Get(name)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"%s not present in stackerfile?\", name)\n\t\t}\n\n\t\tfmt.Printf(\"building image %s...\\n\", name)\n\n\t\t// We need to run the imports first since we now compare\n\t\t// against imports for caching layers. Since we don't do\n\t\t// network copies if the files are present and we use rsync to\n\t\t// copy things across, hopefully this isn't too expensive.\n\t\tfmt.Println(\"importing files...\")\n\t\timports, err := l.ParseImport()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\terr = CleanImportsDir(opts.Config, name, imports, buildCache)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := Import(opts.Config, name, imports); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Need to check if the image has bind mounts, if the image has bind mounts,\n\t\t// it needs to be rebuilt regardless of the build cache\n\t\t// The reason is that tracking build cache for bind mounted folders\n\t\t// is too expensive, so we don't do it\n\t\tbinds, err := l.ParseBinds()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tcacheEntry, ok := buildCache.Lookup(name)\n\t\tif ok && (len(binds) == 0) {\n\t\t\tif l.BuildOnly {\n\t\t\t\tif cacheEntry.Name != name {\n\t\t\t\t\terr = s.Snapshot(cacheEntry.Name, name)\n\t\t\t\t\tif 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} else {\n\t\t\t\terr = oci.UpdateReference(context.Background(), name, cacheEntry.Blob)\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\tfmt.Printf(\"found cached layer %s\\n\", name)\n\t\t\tcontinue\n\t\t}\n\n\t\tbaseOpts := BaseLayerOpts{\n\t\t\tConfig: opts.Config,\n\t\t\tName: name,\n\t\t\tTarget: WorkingContainerName,\n\t\t\tLayer: l,\n\t\t\tCache: buildCache,\n\t\t\tOCI: oci,\n\t\t\tLayerType: opts.LayerType,\n\t\t\tDebug: opts.Debug,\n\t\t}\n\n\t\ts.Delete(WorkingContainerName)\n\t\tif l.From.Type == BuiltType {\n\t\t\tif err := s.Restore(l.From.Tag, WorkingContainerName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else {\n\t\t\tif err := s.Create(WorkingContainerName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\terr = GetBaseLayer(baseOpts, b.builtStackerfiles)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tapply, err := NewApply(b.builtStackerfiles, baseOpts, s, opts.ApplyConsiderTimestamps)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\terr = apply.DoApply()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfmt.Println(\"running commands...\")\n\n\t\trun, err := l.ParseRun()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif len(run) != 0 {\n\n\t\t\timportsDir := path.Join(opts.Config.StackerDir, \"imports\", name)\n\n\t\t\tshebangLine := \"#!/bin/sh -xe\\n\"\n\t\t\tif strings.HasPrefix(run[0], \"#!\") {\n\t\t\t\tshebangLine = \"\"\n\t\t\t} else {\n\t\t\t\t_, err = os.Stat(path.Join(opts.Config.RootFSDir, WorkingContainerName, \"rootfs/bin/sh\"))\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"rootfs for %s does not have a /bin/sh\", name)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err := ioutil.WriteFile(\n\t\t\t\tpath.Join(importsDir, \".stacker-run.sh\"),\n\t\t\t\t[]byte(shebangLine+strings.Join(run, \"\\n\")+\"\\n\"),\n\t\t\t\t0755); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tfmt.Println(\"running commands for\", name)\n\t\t\tif err := Run(opts.Config, name, \"/stacker/.stacker-run.sh\", l, opts.OnRunFailure, nil); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\t// This is a build only layer, meaning we don't need to include\n\t\t// it in the final image, as outputs from it are going to be\n\t\t// imported into future images. Let's just snapshot it and add\n\t\t// a bogus entry to our cache.\n\t\tif l.BuildOnly {\n\t\t\ts.Delete(name)\n\t\t\tif err := s.Snapshot(WorkingContainerName, name); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tfmt.Println(\"build only layer, skipping OCI diff generation\")\n\n\t\t\t// A small hack: for build only layers, we keep track\n\t\t\t// of the name, so we can make sure it exists when\n\t\t\t// there is a cache hit. We should probably make this\n\t\t\t// into some sort of proper Either type.\n\t\t\tif err := buildCache.Put(name, ispec.Descriptor{}); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tfmt.Println(\"generating layer for\", name)\n\t\tswitch opts.LayerType {\n\t\tcase \"tar\":\n\t\t\terr = RunUmociSubcommand(opts.Config, opts.Debug, []string{\n\t\t\t\t\"--tag\", name,\n\t\t\t\t\"--bundle-path\", path.Join(opts.Config.RootFSDir, WorkingContainerName),\n\t\t\t\t\"repack\",\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\tcase \"squashfs\":\n\t\t\terr = RunSquashfsSubcommand(opts.Config, opts.Debug, []string{\n\t\t\t\t\"--bundle-path\", path.Join(opts.Config.RootFSDir, WorkingContainerName),\n\t\t\t\t\"--tag\", name, \"--author\", author, \"repack\",\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"unknown layer type: %s\", opts.LayerType)\n\t\t}\n\t\tdescPaths, err := oci.ResolveReference(context.Background(), name)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tmutator, err := mutate.New(oci, descPaths[0])\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"mutator failed\")\n\t\t}\n\n\t\timageConfig, err := mutator.Config(context.Background())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tpathSet := false\n\t\tfor k, v := range l.Environment {\n\t\t\tif k == \"PATH\" {\n\t\t\t\tpathSet = true\n\t\t\t}\n\t\t\timageConfig.Env = append(imageConfig.Env, fmt.Sprintf(\"%s=%s\", k, v))\n\t\t}\n\n\t\tif !pathSet {\n\t\t\tfor _, s := range imageConfig.Env {\n\t\t\t\tif strings.HasPrefix(s, \"PATH=\") {\n\t\t\t\t\tpathSet = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// if the user didn't specify a path, let's set a sane one\n\t\tif !pathSet {\n\t\t\timageConfig.Env = append(imageConfig.Env, fmt.Sprintf(\"PATH=%s\", ReasonableDefaultPath))\n\t\t}\n\n\t\tif l.Cmd != nil {\n\t\t\timageConfig.Cmd, err = l.ParseCmd()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\tif l.Entrypoint != nil {\n\t\t\timageConfig.Entrypoint, err = l.ParseEntrypoint()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\tif l.FullCommand != nil {\n\t\t\timageConfig.Cmd = nil\n\t\t\timageConfig.Entrypoint, err = l.ParseFullCommand()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\tif imageConfig.Volumes == nil {\n\t\t\timageConfig.Volumes = map[string]struct{}{}\n\t\t}\n\n\t\tfor _, v := range l.Volumes {\n\t\t\timageConfig.Volumes[v] = struct{}{}\n\t\t}\n\n\t\tif imageConfig.Labels == nil {\n\t\t\timageConfig.Labels = map[string]string{}\n\t\t}\n\n\t\tfor k, v := range l.Labels {\n\t\t\timageConfig.Labels[k] = v\n\t\t}\n\n\t\tif l.WorkingDir != \"\" {\n\t\t\timageConfig.WorkingDir = l.WorkingDir\n\t\t}\n\n\t\tif l.RuntimeUser != \"\" {\n\t\t\timageConfig.User = l.RuntimeUser\n\t\t}\n\n\t\tmeta, err := mutator.Meta(context.Background())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tmeta.Created = time.Now()\n\t\tmeta.Architecture = runtime.GOARCH\n\t\tmeta.OS = runtime.GOOS\n\t\tmeta.Author = author\n\n\t\tannotations, err := mutator.Annotations(context.Background())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif gitVersion != \"\" {\n\t\t\tfmt.Println(\"setting git version annotation to\", gitVersion)\n\t\t\tannotations[GitVersionAnnotation] = gitVersion\n\t\t} else {\n\t\t\tannotations[StackerContentsAnnotation] = sf.AfterSubstitutions\n\t\t}\n\n\t\thistory := ispec.History{\n\t\t\tEmptyLayer: true, // this is only the history for imageConfig edit\n\t\t\tCreated: &meta.Created,\n\t\t\tCreatedBy: \"stacker build\",\n\t\t\tAuthor: author,\n\t\t}\n\n\t\terr = mutator.Set(context.Background(), imageConfig, meta, annotations, &history)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tnewPath, err := mutator.Commit(context.Background())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\terr = oci.UpdateReference(context.Background(), name, newPath.Root())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Now, we need to set the umoci data on the fs to tell it that\n\t\t// it has a layer that corresponds to this fs.\n\t\tbundlePath := path.Join(opts.Config.RootFSDir, WorkingContainerName)\n\t\terr = updateBundleMtree(bundlePath, newPath.Descriptor())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tumociMeta := umoci.Meta{Version: umoci.MetaVersion, From: newPath}\n\t\terr = umoci.WriteBundleMeta(bundlePath, umociMeta)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Delete the old snapshot if it existed; we just did a new build.\n\t\ts.Delete(name)\n\t\tif err := s.Snapshot(WorkingContainerName, name); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfmt.Printf(\"filesystem %s built successfully\\n\", name)\n\n\t\tdescPaths, err = oci.ResolveReference(context.Background(), name)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := buildCache.Put(name, descPaths[0].Descriptor()); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\terr = oci.GC(context.Background())\n\tif err != nil {\n\t\tfmt.Printf(\"final OCI GC failed: %v\\n\", err)\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "5f5ad66f779332b7f900bbd143b4bcab", "score": "0.5027736", "text": "func (b *Builder) Build(log logpkg.Logger) error {\n\treturn b.helper.Build(b, log)\n}", "title": "" }, { "docid": "9997871290e73e0b35b40acc9f57188c", "score": "0.50156665", "text": "func (Ding) CreateBuild(repoName, branch, commit string) Build {\n\tif branch == \"\" {\n\t\tuserError(\"Branch cannot be empty.\")\n\t}\n\n\trepo, build, buildDir := _prepareBuild(repoName, branch, commit)\n\tgo func() {\n\t\tdefer func() {\n\t\t\tif err := recover(); err != nil {\n\t\t\t\tif serr, ok := err.(*sherpa.Error); ok {\n\t\t\t\t\tif serr.Code != \"userError\" {\n\t\t\t\t\t\tlog.Println(\"background build failed:\", serr.Message)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t\tdoBuild(repo, build, buildDir)\n\t}()\n\treturn build\n}", "title": "" }, { "docid": "031137b041b718fc6a1bfb8b3a996d6a", "score": "0.5001552", "text": "func Build() (*Http, func(), error) {\n\tcontext, cleanup, err := entrypoint.ContextProvider()\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tviper, cleanup2, err := config.Provider()\n\tif err != nil {\n\t\tcleanup()\n\t\treturn nil, nil, err\n\t}\n\tloggerConfig, cleanup3, err := logger.ProviderCfg(viper)\n\tif err != nil {\n\t\tcleanup2()\n\t\tcleanup()\n\t\treturn nil, nil, err\n\t}\n\tzap, cleanup4, err := logger.Provider(context, loggerConfig)\n\tif err != nil {\n\t\tcleanup3()\n\t\tcleanup2()\n\t\tcleanup()\n\t\treturn nil, nil, err\n\t}\n\tconfiguration, cleanup5, err := tracing.Cfg(viper)\n\tif err != nil {\n\t\tcleanup4()\n\t\tcleanup3()\n\t\tcleanup2()\n\t\tcleanup()\n\t\treturn nil, nil, err\n\t}\n\ttracerProvider, cleanup6, err := tracing.Provider(context, configuration, zap)\n\tif err != nil {\n\t\tcleanup5()\n\t\tcleanup4()\n\t\tcleanup3()\n\t\tcleanup2()\n\t\tcleanup()\n\t\treturn nil, nil, err\n\t}\n\tgrpcConfig, cleanup7, err := grpc.Cfg(viper)\n\tif err != nil {\n\t\tcleanup6()\n\t\tcleanup5()\n\t\tcleanup4()\n\t\tcleanup3()\n\t\tcleanup2()\n\t\tcleanup()\n\t\treturn nil, nil, err\n\t}\n\tpoolManager, cleanup8, err := grpc.Provider(context, tracerProvider, zap, grpcConfig)\n\tif err != nil {\n\t\tcleanup7()\n\t\tcleanup6()\n\t\tcleanup5()\n\t\tcleanup4()\n\t\tcleanup3()\n\t\tcleanup2()\n\t\tcleanup()\n\t\treturn nil, nil, err\n\t}\n\tserviceManagers := products_router.ServiceManagers{\n\t\tPoolManager: poolManager,\n\t}\n\tproducts_routerConfig, cleanup9, err := products_router.Cfg(viper)\n\tif err != nil {\n\t\tcleanup8()\n\t\tcleanup7()\n\t\tcleanup6()\n\t\tcleanup5()\n\t\tcleanup4()\n\t\tcleanup3()\n\t\tcleanup2()\n\t\tcleanup()\n\t\treturn nil, nil, err\n\t}\n\tmanager, cleanup10, err := products_router.Provider(context, zap, serviceManagers, products_routerConfig)\n\tif err != nil {\n\t\tcleanup9()\n\t\tcleanup8()\n\t\tcleanup7()\n\t\tcleanup6()\n\t\tcleanup5()\n\t\tcleanup4()\n\t\tcleanup3()\n\t\tcleanup2()\n\t\tcleanup()\n\t\treturn nil, nil, err\n\t}\n\tauthConfig, cleanup11, err := auth.ProviderCfg(viper)\n\tif err != nil {\n\t\tcleanup10()\n\t\tcleanup9()\n\t\tcleanup8()\n\t\tcleanup7()\n\t\tcleanup6()\n\t\tcleanup5()\n\t\tcleanup4()\n\t\tcleanup3()\n\t\tcleanup2()\n\t\tcleanup()\n\t\treturn nil, nil, err\n\t}\n\tmiddleware, cleanup12, err := auth.Provider(authConfig, zap)\n\tif err != nil {\n\t\tcleanup11()\n\t\tcleanup10()\n\t\tcleanup9()\n\t\tcleanup8()\n\t\tcleanup7()\n\t\tcleanup6()\n\t\tcleanup5()\n\t\tcleanup4()\n\t\tcleanup3()\n\t\tcleanup2()\n\t\tcleanup()\n\t\treturn nil, nil, err\n\t}\n\tgraphql_resolverConfig, cleanup13, err := graphql_resolver.Cfg(viper)\n\tif err != nil {\n\t\tcleanup12()\n\t\tcleanup11()\n\t\tcleanup10()\n\t\tcleanup9()\n\t\tcleanup8()\n\t\tcleanup7()\n\t\tcleanup6()\n\t\tcleanup5()\n\t\tcleanup4()\n\t\tcleanup3()\n\t\tcleanup2()\n\t\tcleanup()\n\t\treturn nil, nil, err\n\t}\n\tenforcer, cleanup14, err := casbin.Provider()\n\tif err != nil {\n\t\tcleanup13()\n\t\tcleanup12()\n\t\tcleanup11()\n\t\tcleanup10()\n\t\tcleanup9()\n\t\tcleanup8()\n\t\tcleanup7()\n\t\tcleanup6()\n\t\tcleanup5()\n\t\tcleanup4()\n\t\tcleanup3()\n\t\tcleanup2()\n\t\tcleanup()\n\t\treturn nil, nil, err\n\t}\n\tdbConfig, cleanup15, err := db.Cfg(viper)\n\tif err != nil {\n\t\tcleanup14()\n\t\tcleanup13()\n\t\tcleanup12()\n\t\tcleanup11()\n\t\tcleanup10()\n\t\tcleanup9()\n\t\tcleanup8()\n\t\tcleanup7()\n\t\tcleanup6()\n\t\tcleanup5()\n\t\tcleanup4()\n\t\tcleanup3()\n\t\tcleanup2()\n\t\tcleanup()\n\t\treturn nil, nil, err\n\t}\n\tgormDB, cleanup16, err := db.ProviderGORM(context, zap, dbConfig)\n\tif err != nil {\n\t\tcleanup15()\n\t\tcleanup14()\n\t\tcleanup13()\n\t\tcleanup12()\n\t\tcleanup11()\n\t\tcleanup10()\n\t\tcleanup9()\n\t\tcleanup8()\n\t\tcleanup7()\n\t\tcleanup6()\n\t\tcleanup5()\n\t\tcleanup4()\n\t\tcleanup3()\n\t\tcleanup2()\n\t\tcleanup()\n\t\treturn nil, nil, err\n\t}\n\tusersRepo, cleanup17, err := repo.NewUsersRepo(gormDB)\n\tif err != nil {\n\t\tcleanup16()\n\t\tcleanup15()\n\t\tcleanup14()\n\t\tcleanup13()\n\t\tcleanup12()\n\t\tcleanup11()\n\t\tcleanup10()\n\t\tcleanup9()\n\t\tcleanup8()\n\t\tcleanup7()\n\t\tcleanup6()\n\t\tcleanup5()\n\t\tcleanup4()\n\t\tcleanup3()\n\t\tcleanup2()\n\t\tcleanup()\n\t\treturn nil, nil, err\n\t}\n\trepoRepo, cleanup18, err := repo.Provider(usersRepo)\n\tif err != nil {\n\t\tcleanup17()\n\t\tcleanup16()\n\t\tcleanup15()\n\t\tcleanup14()\n\t\tcleanup13()\n\t\tcleanup12()\n\t\tcleanup11()\n\t\tcleanup10()\n\t\tcleanup9()\n\t\tcleanup8()\n\t\tcleanup7()\n\t\tcleanup6()\n\t\tcleanup5()\n\t\tcleanup4()\n\t\tcleanup3()\n\t\tcleanup2()\n\t\tcleanup()\n\t\treturn nil, nil, err\n\t}\n\tmanagers := graphql_resolver.Managers{\n\t\tRepo: repoRepo,\n\t\tPollManager: poolManager,\n\t}\n\tgraphqlConfig, cleanup19, err := graphql_resolver.Provider(context, zap, graphql_resolverConfig, enforcer, managers)\n\tif err != nil {\n\t\tcleanup18()\n\t\tcleanup17()\n\t\tcleanup16()\n\t\tcleanup15()\n\t\tcleanup14()\n\t\tcleanup13()\n\t\tcleanup12()\n\t\tcleanup11()\n\t\tcleanup10()\n\t\tcleanup9()\n\t\tcleanup8()\n\t\tcleanup7()\n\t\tcleanup6()\n\t\tcleanup5()\n\t\tcleanup4()\n\t\tcleanup3()\n\t\tcleanup2()\n\t\tcleanup()\n\t\treturn nil, nil, err\n\t}\n\tconfig2, cleanup20, err := graphql.Cfg(viper)\n\tif err != nil {\n\t\tcleanup19()\n\t\tcleanup18()\n\t\tcleanup17()\n\t\tcleanup16()\n\t\tcleanup15()\n\t\tcleanup14()\n\t\tcleanup13()\n\t\tcleanup12()\n\t\tcleanup11()\n\t\tcleanup10()\n\t\tcleanup9()\n\t\tcleanup8()\n\t\tcleanup7()\n\t\tcleanup6()\n\t\tcleanup5()\n\t\tcleanup4()\n\t\tcleanup3()\n\t\tcleanup2()\n\t\tcleanup()\n\t\treturn nil, nil, err\n\t}\n\tgraphQL, cleanup21, err := graphql.Provider(context, graphqlConfig, zap, config2)\n\tif err != nil {\n\t\tcleanup20()\n\t\tcleanup19()\n\t\tcleanup18()\n\t\tcleanup17()\n\t\tcleanup16()\n\t\tcleanup15()\n\t\tcleanup14()\n\t\tcleanup13()\n\t\tcleanup12()\n\t\tcleanup11()\n\t\tcleanup10()\n\t\tcleanup9()\n\t\tcleanup8()\n\t\tcleanup7()\n\t\tcleanup6()\n\t\tcleanup5()\n\t\tcleanup4()\n\t\tcleanup3()\n\t\tcleanup2()\n\t\tcleanup()\n\t\treturn nil, nil, err\n\t}\n\thttpManagers := Managers{\n\t\tproducts: manager,\n\t\tauthMiddleware: middleware,\n\t\tgraphql: graphQL,\n\t}\n\tmux, cleanup22, err := Mux(httpManagers, zap)\n\tif err != nil {\n\t\tcleanup21()\n\t\tcleanup20()\n\t\tcleanup19()\n\t\tcleanup18()\n\t\tcleanup17()\n\t\tcleanup16()\n\t\tcleanup15()\n\t\tcleanup14()\n\t\tcleanup13()\n\t\tcleanup12()\n\t\tcleanup11()\n\t\tcleanup10()\n\t\tcleanup9()\n\t\tcleanup8()\n\t\tcleanup7()\n\t\tcleanup6()\n\t\tcleanup5()\n\t\tcleanup4()\n\t\tcleanup3()\n\t\tcleanup2()\n\t\tcleanup()\n\t\treturn nil, nil, err\n\t}\n\thttpConfig, cleanup23, err := Cfg(viper)\n\tif err != nil {\n\t\tcleanup22()\n\t\tcleanup21()\n\t\tcleanup20()\n\t\tcleanup19()\n\t\tcleanup18()\n\t\tcleanup17()\n\t\tcleanup16()\n\t\tcleanup15()\n\t\tcleanup14()\n\t\tcleanup13()\n\t\tcleanup12()\n\t\tcleanup11()\n\t\tcleanup10()\n\t\tcleanup9()\n\t\tcleanup8()\n\t\tcleanup7()\n\t\tcleanup6()\n\t\tcleanup5()\n\t\tcleanup4()\n\t\tcleanup3()\n\t\tcleanup2()\n\t\tcleanup()\n\t\treturn nil, nil, err\n\t}\n\thttp, cleanup24, err := Provider(context, mux, zap, httpConfig)\n\tif err != nil {\n\t\tcleanup23()\n\t\tcleanup22()\n\t\tcleanup21()\n\t\tcleanup20()\n\t\tcleanup19()\n\t\tcleanup18()\n\t\tcleanup17()\n\t\tcleanup16()\n\t\tcleanup15()\n\t\tcleanup14()\n\t\tcleanup13()\n\t\tcleanup12()\n\t\tcleanup11()\n\t\tcleanup10()\n\t\tcleanup9()\n\t\tcleanup8()\n\t\tcleanup7()\n\t\tcleanup6()\n\t\tcleanup5()\n\t\tcleanup4()\n\t\tcleanup3()\n\t\tcleanup2()\n\t\tcleanup()\n\t\treturn nil, nil, err\n\t}\n\treturn http, func() {\n\t\tcleanup24()\n\t\tcleanup23()\n\t\tcleanup22()\n\t\tcleanup21()\n\t\tcleanup20()\n\t\tcleanup19()\n\t\tcleanup18()\n\t\tcleanup17()\n\t\tcleanup16()\n\t\tcleanup15()\n\t\tcleanup14()\n\t\tcleanup13()\n\t\tcleanup12()\n\t\tcleanup11()\n\t\tcleanup10()\n\t\tcleanup9()\n\t\tcleanup8()\n\t\tcleanup7()\n\t\tcleanup6()\n\t\tcleanup5()\n\t\tcleanup4()\n\t\tcleanup3()\n\t\tcleanup2()\n\t\tcleanup()\n\t}, nil\n}", "title": "" }, { "docid": "a9ec0616b83a7faf9ec16ed38db1c559", "score": "0.4998266", "text": "func (r *Request) Build() error {\n\tif !r.build {\n\t\tr.Handlers.Validate.Run(r)\n\t\tif r.Error != nil {\n\t\t\treqDebugLog(r, \"Validate Request\", r.Error)\n\t\t\treturn r.Error\n\t\t}\n\t\tr.Handlers.Marshal.Run(r)\n\t\tif r.Error != nil {\n\t\t\treqDebugLog(r, \"Marshal Request\", r.Error)\n\t\t\treturn r.Error\n\t\t}\n\t\tr.Handlers.Set.Run(r)\n\t\tif r.Error != nil {\n\t\t\treqDebugLog(r, \"Set Request\", r.Error)\n\t\t\treturn r.Error\n\t\t}\n\t\tr.build = true\n\t}\n\n\treturn r.Error\n}", "title": "" }, { "docid": "4b7dedd2fe43bc27a32f4afaf1454b7e", "score": "0.4987812", "text": "func (srv *StreamService) Site(params *StreamSiteParams) (*Stream, error) {\n\treq, err := srv.site.New().Get(\"site.json\").QueryStruct(params).Request()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn newStream(srv.client, req), nil\n}", "title": "" }, { "docid": "4ec1ae515da9ca4c617ea247abba5e57", "score": "0.49868453", "text": "func (this *Chain) Build(value any, builder Builder) *Chain {\n\n\tif nil == this.Error {\n\t\tvar it any\n\t\tit, this.Error = builder(this)\n\t\tif nil == this.Error && nil != it {\n\t\t\tthis.Error = Assign(this.Section.Context, value, it)\n\t\t}\n\t}\n\treturn this\n}", "title": "" }, { "docid": "cc99669a699e23100b409feaad684eea", "score": "0.4978849", "text": "func (m *CasesEdiscoveryCasesItemCustodiansItemSiteSourcesSiteSourceItemRequestBuilder) Site()(*CasesEdiscoveryCasesItemCustodiansItemSiteSourcesItemSiteRequestBuilder) {\n return NewCasesEdiscoveryCasesItemCustodiansItemSiteSourcesItemSiteRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)\n}", "title": "" }, { "docid": "a8c3d6ce7afff5157f146de72ac8a2d7", "score": "0.4963992", "text": "func generateSite(packageInfoSlice []PackageInfo, outputDirectory string, indexTemplate *template.Template) error {\n\tfor _, packageInfo := range packageInfoSlice {\n\t\tvar (\n\t\t\terr error\n\t\t\toutputDir = filepath.Join(outputDirectory, packageInfo.Name)\n\t\t\tfileName = filepath.Join(outputDir + \"/index.html\")\n\t\t\tfile *os.File\n\t\t)\n\n\t\tif err = os.MkdirAll(outputDir, os.ModePerm); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif file, err = os.Create(fileName); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err = indexTemplate.Execute(file, packageInfo); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "122fbb51b7d13de76baefcada5dafab2", "score": "0.49602687", "text": "func (b *DNSBuilder) Build() (object *DNS, err error) {\n\tobject = new(DNS)\n\tobject.bitmap_ = b.bitmap_\n\tobject.baseDomain = b.baseDomain\n\treturn\n}", "title": "" }, { "docid": "3597d0aa365a04308000e01e76b62dcc", "score": "0.49390373", "text": "func Build(p *models.Project) error {\n\ttasks := task.Tasks{dirs.New(p), gomod.New(p), readme.New(p)}\n\tif p.Dockerfile != \"\" {\n\t\ttasks = append(tasks, dockerfile.New(p))\n\t}\n\tif p.Makefile != \"\" {\n\t\ttasks = append(tasks, makefile.New(p))\n\t}\n\tif p.EntryFile != \"\" {\n\t\ttasks = append(tasks, entryfile.New(p))\n\t}\n\tif p.HostingDescription != \"\" {\n\t\ttasks = append(tasks, github.New(p))\n\t} else {\n\t\ttasks = append(tasks, gitremote.New(p))\n\t}\n\tif len(p.CI) > 0 {\n\t\ttasks = append(tasks, ci.New(p))\n\t}\n\tswitch p.Type {\n\tcase models.Library:\n\t\ttasks = append(tasks, buildLibrary(p)...)\n\tcase models.Binary:\n\t\ttasks = append(tasks, buildBinary(p)...)\n\tdefault:\n\t\treturn errors.New(\"unable to define type of the project\")\n\t}\n\treturn runTasks(tasks)\n}", "title": "" }, { "docid": "cc31840565ba042f5e8750bf6c0da92b", "score": "0.49373832", "text": "func buildSiteMap(n *node) string {\n\treturn nodeToSite(n, 1)\n}", "title": "" }, { "docid": "15177798a7f7c0b68579ba80d1445709", "score": "0.49339077", "text": "func (b *StackBuilder) Build(app twelvefactor.App) error {\n\treturn nil\n}", "title": "" }, { "docid": "b23366d4ee0f096f0649f5376f17380b", "score": "0.49210697", "text": "func (database *Database) CreateBuild(build *Build) error {\n\tcollection := database.Session.DB(\"\").C(\"builds\")\n\tbuild.ID = bson.NewObjectId()\n\treturn collection.Insert(*build)\n}", "title": "" }, { "docid": "11a3330406957b79f92e53eaf9378e44", "score": "0.49195853", "text": "func Build(urls []string) []*Entry {\n\tes := build(urls)\n\tcli := &http.Client{\n\t\tTimeout: 3 * time.Second,\n\t}\n\tfillHBC(cli, es)\n\treturn es\n}", "title": "" }, { "docid": "49b3c83ce369c5677520e544f6291d89", "score": "0.4917978", "text": "func (s Site) Validate() error {\n\tif !siteNameRE.MatchString(s.Name) {\n\t\treturn fmt.Errorf(\".Name(%s) is not a valid Site name\", s.Name)\n\t}\n\tswitch s.Type {\n\tcase \"satellite\", \"cluster\":\n\tdefault:\n\t\treturn fmt.Errorf(\"site has .Type(%s) that is invalid\", s.Type)\n\t}\n\tswitch s.Status {\n\tcase \"inService\", \"decom\", \"removed\":\n\tdefault:\n\t\treturn fmt.Errorf(\"site has .Status(%s) that is invalid\", s.Status)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "85899872ba5950ac29f85fb1094d4a73", "score": "0.49111938", "text": "func (c *OldSerieRuleConfig) Build() (Rule, error) {\n\tt, err := time.Parse(time.RFC3339, c.Time)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar out io.Writer\n\tif c.Out == \"\" {\n\t\tout = os.Stdout\n\t} else if c.Out == \"stdout\" {\n\t\tout = os.Stdout\n\t} else if c.Out == \"stderr\" {\n\t\tout = os.Stderr\n\t} else {\n\t\tout, err = os.Open(c.Out)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tformat := \"text\"\n\tif c.Format != \"\" {\n\t\tformat = c.Format\n\t}\n\n\tformater, err := newFormater(format, c.Timestamp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn newOldSeriesRule(t, out, formater), nil\n}", "title": "" }, { "docid": "9e0d0bdd8ef9eec6ab36e1177c40926b", "score": "0.4910765", "text": "func (s *StakeAddress) Build(\n\tstakeVerificationKeyFile string,\n\toutFile string,\n) {\n\t_, err := exec.Command(\n\t\t\"cardano-cli\", \"stake-address\", \"build\",\n\t\t\"--stake-verification-key-file\", stakeVerificationKeyFile,\n\t\t\"--out-file\", outFile,\n\t\t\"--mainnet\",\n\t).Output()\n\tif err != nil {\n\t\tlog.Printf(\"error: %v\\n\", err)\n\t}\n}", "title": "" }, { "docid": "de66c029c315b3c3a076b65bc7ff9da0", "score": "0.49091455", "text": "func (c *BlueOceanClient) Build(option BuildOption) (*PipelineRun, error) {\n\tvar pr PipelineRun\n\tvar payloadReader io.Reader\n\t// we allow developers to pass an empty parameters, but nil parameters\n\tif option.Parameters != nil {\n\t\t// ignore this error due to never happened\n\t\tpayloadBytes, _ := json.Marshal(map[string][]Parameter{\n\t\t\t\"parameters\": option.Parameters,\n\t\t})\n\t\tpayloadReader = strings.NewReader(string(payloadBytes))\n\t}\n\terr := c.RequestWithData(http.MethodPost, c.getBuildAPI(option), getHeaders(), payloadReader, 200, &pr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &pr, nil\n}", "title": "" }, { "docid": "ec37b711da54b06eeef82384c8b15593", "score": "0.48990342", "text": "func (env *Environment) Build(construct string) error {\n\tcconstruct := C.CString(construct)\n\tdefer C.free(unsafe.Pointer(cconstruct))\n\tif C.EnvBuild(env.env, cconstruct) != 1 {\n\t\treturn EnvError(env, \"Unable to parse construct \\\"%s\\\"\", construct)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "96fd795f40c8d3bfd709034c71500deb", "score": "0.48970622", "text": "func NewSiteRepo(t mockConstructorTestingTNewSiteRepo) *SiteRepo {\n\tmock := &SiteRepo{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "c73037bdf066d5702db788279bb0f48f", "score": "0.48868328", "text": "func CreateBuildFromVersionNoInsert(creationInfo TaskCreationInfo) (*build.Build, task.Tasks, error) {\n\t// avoid adding all tasks in the case of no tasks matching aliases\n\tif len(creationInfo.Aliases) > 0 && len(creationInfo.TaskNames) == 0 {\n\t\treturn nil, nil, nil\n\t}\n\t// Find the build variant for this project/build\n\tbuildVariant := creationInfo.Project.FindBuildVariant(creationInfo.BuildVariantName)\n\tif buildVariant == nil {\n\t\treturn nil, nil, errors.Errorf(\"could not find build '%s' in project file '%s'\", creationInfo.BuildVariantName, creationInfo.Project.Identifier)\n\t}\n\n\trev := creationInfo.Version.Revision\n\tif evergreen.IsPatchRequester(creationInfo.Version.Requester) {\n\t\trev = fmt.Sprintf(\"patch_%s_%s\", creationInfo.Version.Revision, creationInfo.Version.Id)\n\t} else if creationInfo.Version.Requester == evergreen.TriggerRequester {\n\t\trev = fmt.Sprintf(\"%s_%s\", creationInfo.SourceRev, creationInfo.DefinitionID)\n\t} else if creationInfo.Version.Requester == evergreen.AdHocRequester {\n\t\trev = creationInfo.Version.Id\n\t} else if creationInfo.Version.Requester == evergreen.GitTagRequester {\n\t\trev = fmt.Sprintf(\"%s_%s\", creationInfo.SourceRev, creationInfo.Version.TriggeredByGitTag.Tag)\n\t}\n\n\t// create a new build id\n\tbuildId := fmt.Sprintf(\"%s_%s_%s_%s\",\n\t\tcreationInfo.ProjectRef.Identifier,\n\t\tcreationInfo.BuildVariantName,\n\t\trev,\n\t\tcreationInfo.Version.CreateTime.Format(build.IdTimeLayout))\n\n\tactivatedTime := utility.ZeroTime\n\tif creationInfo.ActivateBuild {\n\t\tactivatedTime = time.Now()\n\t}\n\n\t// create the build itself\n\tb := &build.Build{\n\t\tId: util.CleanName(buildId),\n\t\tCreateTime: creationInfo.Version.CreateTime,\n\t\tActivated: creationInfo.ActivateBuild,\n\t\tActivatedTime: activatedTime,\n\t\tProject: creationInfo.Project.Identifier,\n\t\tRevision: creationInfo.Version.Revision,\n\t\tStatus: evergreen.BuildCreated,\n\t\tBuildVariant: creationInfo.BuildVariantName,\n\t\tVersion: creationInfo.Version.Id,\n\t\tDisplayName: buildVariant.DisplayName,\n\t\tRevisionOrderNumber: creationInfo.Version.RevisionOrderNumber,\n\t\tRequester: creationInfo.Version.Requester,\n\t\tParentPatchID: creationInfo.Version.ParentPatchID,\n\t\tParentPatchNumber: creationInfo.Version.ParentPatchNumber,\n\t\tTriggerID: creationInfo.Version.TriggerID,\n\t\tTriggerType: creationInfo.Version.TriggerType,\n\t\tTriggerEvent: creationInfo.Version.TriggerEvent,\n\t\tTags: buildVariant.Tags,\n\t}\n\n\t// create all the necessary tasks for the build\n\tcreationInfo.BuildVariant = buildVariant\n\tcreationInfo.Build = b\n\ttasksForBuild, err := createTasksForBuild(creationInfo)\n\tif err != nil {\n\t\treturn nil, nil, errors.Wrapf(err, \"creating tasks for build '%s'\", b.Id)\n\t}\n\n\t// create task caches for all of the tasks, and place them into the build\n\ttasks := []task.Task{}\n\tcontainsActivatedTask := false\n\thasUnfinishedEssentialTask := false\n\tfor _, taskP := range tasksForBuild {\n\t\tif taskP.IsGithubCheck {\n\t\t\tb.IsGithubCheck = true\n\t\t}\n\t\tif taskP.Activated {\n\t\t\tcontainsActivatedTask = true\n\t\t}\n\t\tif taskP.IsEssentialToSucceed {\n\t\t\thasUnfinishedEssentialTask = true\n\t\t}\n\t\tif taskP.IsPartOfDisplay() {\n\t\t\tcontinue // don't add execution parts of display tasks to the UI cache\n\t\t}\n\t\ttasks = append(tasks, *taskP)\n\t}\n\tb.Tasks = CreateTasksCache(tasks)\n\tb.Activated = containsActivatedTask\n\tb.HasUnfinishedEssentialTask = hasUnfinishedEssentialTask\n\treturn b, tasksForBuild, nil\n}", "title": "" }, { "docid": "854584c2560685c6f9f569f00d3bc495", "score": "0.48866716", "text": "func (this Config) Build() tidy.Backend {\n\tb := &backend{\n\t\tentries: make(chan tidy.Entry, this.bufferSize),\n\t\tnetwork: this.network,\n\t\taddress: this.address,\n\t\tformatter: tidy.PlainTextFormatter{},\n\t\ttoken: []byte(this.token),\n\t}\n\tgo b.do()\n\n\treturn b\n}", "title": "" }, { "docid": "817acea080559243fc938fd49303b452", "score": "0.48862785", "text": "func (h *HUEsystemBuilder) Build() *metamodel.HUEsystem {\n\treturn metamodel.NewHUEsystem(h.mapToSlice(h.states), *h.initialState)\n}", "title": "" }, { "docid": "af7404a35868c22b37a9f48bb50af4a7", "score": "0.48795184", "text": "func Build() error {\n\treturn mage.Build(mage.DefaultBuildArgs())\n}", "title": "" }, { "docid": "7d9b83ff1f54fa00b8b973787c323a4c", "score": "0.48784393", "text": "func (r *PartnersChannelsSitesService) Create(partnerId int64, channelId int64, site *Site) *PartnersChannelsSitesCreateCall {\n\tc := &PartnersChannelsSitesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.partnerId = partnerId\n\tc.channelId = channelId\n\tc.site = site\n\treturn c\n}", "title": "" }, { "docid": "d5063ba2fbd9c1e9e4a9d269dd309143", "score": "0.48730305", "text": "func (s *StandardExitTransaction) Build() error {\n\tproof, err := hex.DecodeString(util.RemoveLeadingZeroX(s.UtxoData.Data.Proof))\n\tif err != nil {\n\t\treturn err\n\t}\n\ttxbytes, err := hex.DecodeString(util.RemoveLeadingZeroX(s.UtxoData.Data.Txbytes))\n\tif err != nil {\n\t\treturn err\n\t}\n\ts.Proof = proof\n\ts.TxBytes = txbytes\n\ts.UtxoPos = s.UtxoData.Data.UtxoPos\n\treturn nil\n}", "title": "" }, { "docid": "11aee8437b4853fca1269d96248f0ff5", "score": "0.48672852", "text": "func NewGetSiteBuildOK() *GetSiteBuildOK {\n\treturn &GetSiteBuildOK{}\n}", "title": "" }, { "docid": "df1a3bcc04e0ac81a1e7bb3c248a66d2", "score": "0.48606548", "text": "func (p *provider) Build(params map[string]interface{}) (providers.Provider, fail.Error) {\n\tidentity, _ := params[\"identity\"].(map[string]interface{})\n\tcompute, _ := params[\"compute\"].(map[string]interface{})\n\tnetwork, _ := params[\"network\"].(map[string]interface{})\n\n\tusername, _ := identity[\"Username\"].(string)\n\tpassword, _ := identity[\"Password\"].(string)\n\tdomainName, _ := identity[\"DomainName\"].(string)\n\tprojectID, _ := compute[\"ProjectID\"].(string)\n\tregion, _ := compute[\"Region\"].(string)\n\tzone, _ := compute[\"AvailabilityZone\"].(string)\n\tvpcName, _ := network[\"DefaultNetworkName\"].(string)\n\tvpcCIDR, _ := network[\"DefaultNetworkCIDR\"].(string)\n\n\tidentityEndpoint, _ := identity[\"IdentityEndpoint\"].(string)\n\tif identityEndpoint == \"\" {\n\t\tidentityEndpoint = fmt.Sprintf(identityEndpointTemplate, region)\n\t}\n\n\toperatorUsername := abstract.DefaultUser\n\tif operatorUsernameIf, ok := compute[\"OperatorUsername\"]; ok {\n\t\toperatorUsername = operatorUsernameIf.(string)\n\t\tif operatorUsername == \"\" {\n\t\t\tlogrus.Warnf(\"OperatorUsername is empty ! Check your tenants.toml file ! Using 'safescale' user instead.\")\n\t\t\toperatorUsername = abstract.DefaultUser\n\t\t}\n\t}\n\n\tdefaultImage, _ := compute[\"DefaultImage\"].(string)\n\tif defaultImage == \"\" {\n\t\tdefaultImage = opentelekomDefaultImage\n\t}\n\n\tauthOptions := stacks.AuthenticationOptions{\n\t\tIdentityEndpoint: identityEndpoint,\n\t\tUsername: username,\n\t\tPassword: password,\n\t\tDomainName: domainName,\n\t\tProjectID: projectID,\n\t\tRegion: region,\n\t\tAvailabilityZone: zone,\n\t\tAllowReauth: true,\n\t}\n\n\tgovalidator.TagMap[\"alphanumwithdashesandunderscores\"] = govalidator.Validator(func(str string) bool {\n\t\trxp := regexp.MustCompile(stacks.AlphanumericWithDashesAndUnderscores)\n\t\treturn rxp.Match([]byte(str))\n\t})\n\n\t_, err := govalidator.ValidateStruct(authOptions)\n\tif err != nil {\n\t\treturn nil, fail.ConvertError(err)\n\t}\n\n\tproviderName := \"huaweicloud\"\n\tmetadataBucketName, xerr := objectstorage.BuildMetadataBucketName(providerName, region, domainName, projectID)\n\tif xerr != nil {\n\t\treturn nil, xerr\n\t}\n\n\tcfgOptions := stacks.ConfigurationOptions{\n\t\tDNSList: []string{\"1.1.1.1\"},\n\t\tUseFloatingIP: true,\n\t\tUseLayer3Networking: false,\n\t\tVolumeSpeeds: map[string]volumespeed.Enum{\n\t\t\t\"SATA\": volumespeed.Cold,\n\t\t\t\"SAS\": volumespeed.Hdd,\n\t\t\t\"Ssd\": volumespeed.Ssd,\n\t\t},\n\t\tMetadataBucket: metadataBucketName,\n\t\tOperatorUsername: operatorUsername,\n\t\tProviderName: providerName,\n\t\tDefaultNetworkName: vpcName,\n\t\tDefaultNetworkCIDR: vpcCIDR,\n\t\tDefaultImage: defaultImage,\n\t}\n\tstack, xerr := huaweicloud.New(authOptions, cfgOptions)\n\tif xerr != nil {\n\t\treturn nil, xerr\n\t}\n\n\tnewP := provider{\n\t\tStack: stack,\n\t\ttenantParameters: params,\n\t}\n\treturn &newP, nil\n}", "title": "" }, { "docid": "e2cfed0a41307e5c0bd84b64a241834e", "score": "0.48572657", "text": "func (b *Builder) Build(dest string) {\n\t// if on build, do not again\n\tif b.isBuilding {\n\t\treturn\n\t}\n\tlog15.Debug(\"Build.Start\")\n\tctx := &Context{\n\t\tDstDir: dest,\n\t\tDstOriginDir: dest,\n\t\tVersion: b.Version,\n\t\tBeginTime: time.Now(),\n\t}\n\ttheme, err := b.theme()\n\tif err != nil {\n\t\tctx.Error = err\n\t\tb.context = ctx\n\t\treturn\n\t}\n\tctx.Theme = theme\n\tb.isBuilding = true\n\n\t// run tasks\n\tfor _, task := range b.tasks {\n\t\ttask.Fn(ctx)\n\t\tif ctx.Error != nil {\n\t\t\tlog15.Error(\"Build.\"+task.Name, \"error\", ctx.Error.Error())\n\n\t\t\tb.isBuilding = false\n\t\t\tb.context = ctx\n\t\t\treturn\n\t\t}\n\t\tif task.Print != nil {\n\t\t\tlog15.Debug(\"Build.\"+task.Name+\".\"+task.Print(ctx), \"duration\", ctx.Duration())\n\t\t} else {\n\t\t\tlog15.Debug(\"Build.\"+task.Name, \"duration\", ctx.Duration())\n\t\t}\n\t\tb.context = ctx\n\t}\n\n\tlog15.Info(\"Build.Finish\", \"duration\", ctx.Duration())\n\tb.isBuilding = false\n}", "title": "" }, { "docid": "5ba11956aed2bcd2112451957ca1c7dc", "score": "0.48563352", "text": "func PutSite(s structs.Site) error {\n\tsiteexists := false\n\tcurs := &structs.Site{}\n\terr := Site([]byte(s.Domain), curs)\n\tif err != nil {\n\t\tlog.Error(err)\n\t} else {\n\t\tsiteexists = true\n\t}\n\n\treturn Db.Update(func(tx *bolt.Tx) error {\n\t\tb := getBucket(tx, siteBucket)\n\n\t\ts.LastUpdate = time.Now().Unix()\n\t\tif siteexists {\n\t\t\tlog.Debugf(\"siteexists.. keeping time at %v\", curs.CreatedOn)\n\t\t\ts.CreatedOn = curs.CreatedOn\n\t\t} else {\n\t\t\tid, _ := b.NextSequence()\n\t\t\ts.ID = int(id)\n\t\t\ts.CreatedOn = s.LastUpdate\n\t\t}\n\n\t\teS, err := gobEncodeSite(&s)\n\t\tif err != nil {\n\t\t\tlog.Error(err)\n\t\t\treturn err\n\t\t}\n\n\t\terr = b.Put([]byte(s.Domain), eS)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "79563053880e89facf83b223becbad71", "score": "0.48432264", "text": "func (p *Project) Build(c *cli.Context) error {\n\treturn p.builder.build(c, p)\n}", "title": "" }, { "docid": "1812797307c4de9baa503004b10865f4", "score": "0.4839331", "text": "func setupBuild() *library.Build {\n\tlogrus.Trace(\"creating fake build\")\n\n\tb := new(library.Build)\n\n\tb.SetID(1)\n\tb.SetRepoID(1)\n\tb.SetNumber(1)\n\tb.SetParent(1)\n\tb.SetEvent(\"push\")\n\tb.SetStatus(\"pending\")\n\tb.SetError(\"\")\n\tb.SetEnqueued(time.Now().UTC().Unix())\n\tb.SetCreated(time.Now().UTC().Unix())\n\tb.SetDeploy(\"\")\n\tb.SetClone(\"https://github.com/go-vela/pkg-runtime.git\")\n\t// nolint: lll // ignore long line length due to link\n\tb.SetSource(\"https://github.com/go-vela/pkg-runtime/commit/0a08eb2eea09dd58498a4325fee0cb0ab3b66fc9\")\n\tb.SetTitle(\"push received from https://github.com/go-vela/pkg-runtime\")\n\tb.SetMessage(\"initial commit\")\n\tb.SetCommit(\"0a08eb2eea09dd58498a4325fee0cb0ab3b66fc9\")\n\tb.SetSender(\"vela-worker\")\n\tb.SetAuthor(\"vela-worker\")\n\tb.SetEmail(\"vela@target.com\")\n\tb.SetLink(\"\")\n\tb.SetBranch(\"master\")\n\tb.SetRef(\"refs/heads/master\")\n\tb.SetBaseRef(\"\")\n\n\treturn b\n}", "title": "" }, { "docid": "ce6e957d07b9675c5981b9cabff88397", "score": "0.483086", "text": "func (b *SiteRequestBuilder) Sites() *SiteSitesCollectionRequestBuilder {\n\tbb := &SiteSitesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}\n\tbb.baseURL += \"/sites\"\n\treturn bb\n}", "title": "" }, { "docid": "09a3d02dbe9150bf684cf27264e7e0c8", "score": "0.48307335", "text": "func (b LegacyBuilder) Build(qs string) (*ast.Ast, error) {\n\treturn &ast.Ast{\n\t\tBase: &ast.Base{\n\t\t\tLoc: &ast.Location{\n\t\t\t\tStart: ast.Position{\n\t\t\t\t\tLine: 0,\n\t\t\t\t\tColumn: 0,\n\t\t\t\t},\n\t\t\t\tEnd: ast.Position{\n\t\t\t\t\tLine: 0,\n\t\t\t\t\tColumn: len(qs),\n\t\t\t\t},\n\t\t\t\tSource: &qs,\n\t\t\t},\n\t\t},\n\t}, nil\n}", "title": "" }, { "docid": "92f28e25ff9ef6a27bd6ba0f995bf9b0", "score": "0.48296595", "text": "func (r *Router) Build() {\n\trouteGraph := newGraph()\n\trouteGraph.Parse(r.routes, r.middlewares)\n\tr.processGraph(&r.engine.RouterGroup, routeGraph)\n}", "title": "" }, { "docid": "48613238374538b0d8d811e02e5530f4", "score": "0.4820455", "text": "func (g *Gen) Build(searchDir, mainApiFile string) error {\n\tlog.Println(\"Generate swagger docs....\")\n\tp := swag.New()\n\tp.ParseApi(searchDir, mainApiFile)\n\tswagger := p.GetSwagger()\n\n\tb, _ := json.MarshalIndent(swagger, \"\", \" \")\n\n\tos.MkdirAll(path.Join(searchDir, \"docs\"), os.ModePerm)\n\tdocs, _ := os.Create(path.Join(searchDir, \"docs\", \"docs.go\"))\n\tdefer docs.Close()\n\n\tpackageTemplate.Execute(docs, struct {\n\t\tTimestamp time.Time\n\t\tDoc string\n\t}{\n\t\tTimestamp: time.Now(),\n\t\tDoc: \"`\" + string(b) + \"`\",\n\t})\n\n\tlog.Printf(\"create docs.go at %+v\", docs.Name())\n\treturn nil\n}", "title": "" }, { "docid": "e500032c631c159f8a2b783b2e9c37aa", "score": "0.48164174", "text": "func Build(client *Client, buildBranch string , message string, envVars []string) (ResponseBody){\n\treqBody := RequestBody{}\n\n\t//set the variables\n\treqBody.Request.Branch = buildBranch\n\treqBody.Request.Message = message\n\treqBody.Request.Config.Env.Matrix = envVars\n\n\tjsonRequest, _ := json.Marshal(reqBody)\n\n\t/* Example of the marshalled json\n {\n \"request\": {\n \"branch\": \"master\",\n \"message\": \"Request to build from API with GO\",\n \"config\": {\n \"env\": {\n \"matrix\": [\n \"UNITTESTS=ALL\",\n \"INTTESTS=NONE\"\n ]\n }\n }\n }\n}\n\t */\n\n\t//build the POST request\n\treq, _ := http.NewRequest(\"POST\",\"https://api.travis-ci.org/repo/\" + client.repoSlug + \"requests\" , bytes.NewReader(jsonRequest))\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treq.Header.Set(\"Travis-API-Version\", \"3\")\n\treq.Header.Set(\"Authorization\", \"token \" + client.apiToken)\n\n\t//execute the request\n\tresp, err := client.httpClient.Do(req)\n\n\t//handle errors\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tdefer resp.Body.Close()\n\n\treturn handleBuildResponse(resp)\n}", "title": "" }, { "docid": "ad35f4ed7380489a426d9d73db11ef70", "score": "0.48097426", "text": "func lookupSite(fs afero.Fs, path string) (*site, error) {\n\torig := path\n\tvar dir string\n\t// Loop until site.yaml has been found\n\tfor {\n\t\ts, err := fs.Stat(path)\n\t\tif err == nil {\n\t\t\tif s.IsDir() {\n\t\t\t\t// Does a site.yaml file exists in `path`? If yes, it is the site.\n\t\t\t\ts, err = fs.Stat(filepath.Join(path, \"site.yaml\"))\n\t\t\t\tif err == nil {\n\t\t\t\t\t// Parse the site.yaml file\n\t\t\t\t\tconfig, err := loadYamlFile(fs, filepath.Join(path, \"site.yaml\"))\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\t// Determine the output path\n\t\t\t\t\tvar outputPath string\n\t\t\t\t\tif v, ok := config[\"Output\"]; ok {\n\t\t\t\t\t\toutputPath, err = yamlString(\"Output\", v, \"site.yaml\")\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\t\t\t\t\t} else {\n\t\t\t\t\t\toutputPath = \"public\"\n\t\t\t\t\t}\n\t\t\t\t\t// Determine the content path\n\t\t\t\t\tvar contentPath string\n\t\t\t\t\tif v, ok := config[\"Content\"]; ok {\n\t\t\t\t\t\toutputPath, err = yamlString(\"Content\", v, \"site.yaml\")\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\t\t\t\t\t} else {\n\t\t\t\t\t\tcontentPath = \"content\"\n\t\t\t\t\t}\n\t\t\t\t\tsiteFs := afero.NewBasePathFs(fs, path)\n\t\t\t\t\t// Create the site context\n\t\t\t\t\tctx := &SiteContext{Params: make(map[string]interface{})}\n\t\t\t\t\ttags := newTags()\n\t\t\t\t\t// TODO: In untrusted mode, the output must be within the site file system\n\t\t\t\t\tsite := &site{siteFs: siteFs, ctx: ctx, tags: tags, path: path, name: filepath.Base(orig), config: config, outputPath: outputPath, contentPath: contentPath}\n\t\t\t\t\tctx.site = site\n\t\t\t\t\treturn site, nil\n\t\t\t\t}\n\t\t\t\tif dir == \"\" {\n\t\t\t\t\tdir = path\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif path == \".\" {\n\t\t\t// No site.yaml has been found.\n\t\t\t// Assume that an empty site.yaml existed at `dir`.\n\t\t\tsiteFs := afero.NewBasePathFs(fs, path).(*afero.BasePathFs)\n\t\t\t// Create the site context\n\t\t\tctx := &SiteContext{Params: make(map[string]interface{})}\n\t\t\ttags := newTags()\n\t\t\tsite := &site{siteFs: siteFs, ctx: ctx, tags: tags, path: dir, name: filepath.Base(orig), config: make(map[string]interface{}), outputPath: \"public\", contentPath: \"content\"}\n\t\t\tctx.site = site\n\t\t\treturn site, nil\n\t\t}\n\t\tpath = filepath.Dir(path)\n\t}\n}", "title": "" }, { "docid": "d54cb526c33a60199718187c2e0eacb8", "score": "0.48055357", "text": "func (a *NiatelemetryApiService) CreateNiatelemetryNexusCloudSiteExecute(r ApiCreateNiatelemetryNexusCloudSiteRequest) (*NiatelemetryNexusCloudSite, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodPost\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t\tlocalVarReturnValue *NiatelemetryNexusCloudSite\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"NiatelemetryApiService.CreateNiatelemetryNexusCloudSite\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/niatelemetry/NexusCloudSites\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\tif r.niatelemetryNexusCloudSite == nil {\n\t\treturn localVarReturnValue, nil, reportError(\"niatelemetryNexusCloudSite is required and must be specified\")\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif r.ifMatch != nil {\n\t\tlocalVarHeaderParams[\"If-Match\"] = parameterToString(*r.ifMatch, \"\")\n\t}\n\tif r.ifNoneMatch != nil {\n\t\tlocalVarHeaderParams[\"If-None-Match\"] = parameterToString(*r.ifNoneMatch, \"\")\n\t}\n\t// body params\n\tlocalVarPostBody = r.niatelemetryNexusCloudSite\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 {\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, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\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, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\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, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v 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, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tvar v Error\n\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\tif err != nil {\n\t\t\tnewErr.error = err.Error()\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\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": "f7238d1f5853e5567afae5bfccaaeeac", "score": "0.47958943", "text": "func (b *APIResourceSerializationErrorBuilder) Build() Error {\n\tdescription := &impl.ErrorDescription{\n\t\tFriendly: \"The resource you requested could not be serialized for the wire.\",\n\t\tTechnical: \"The resource you requested could not be serialized for the wire.\",\n\t}\n\n\treturn &impl.Error{\n\t\tErrorArguments: b.arguments,\n\t\tErrorCode: \"resource_serialization_error\",\n\t\tErrorDescription: description,\n\t\tErrorDomain: Domain,\n\t\tErrorMetadata: &impl.ErrorMetadata{},\n\t\tErrorSection: APISection,\n\t\tErrorSensitivity: errawr.ErrorSensitivityNone,\n\t\tErrorTitle: \"Resource serialization error\",\n\t\tVersion: 1,\n\t}\n}", "title": "" }, { "docid": "cdaa364d76536684c895dd0459b04ee2", "score": "0.47957146", "text": "func (big *BulkImportGenerator) Build(c *parse.Conversation, w *BulkImportWriter) error {\n\t// Get a list of all users in this conversation/map.\n\tallUsers, err := big.allUsers(c)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Add a version entry.\n\tif err := w.Add(CurrentVersion()); err != nil {\n\t\treturn err\n\t}\n\n\t// Add a team entry for each participant.\n\tif err := big.AddTeamEntries(w); err != nil {\n\t\treturn err\n\t}\n\n\t// Add a team entry for each participant.\n\tif err := big.AddChannelEntries(w); err != nil {\n\t\treturn err\n\t}\n\n\t// Add a User entry for each participant.\n\tif err := big.AddUserEntries(w, allUsers); err != nil {\n\t\treturn err\n\t}\n\n\t// Add a single post, with everything else a reply.\n\tif err := big.AddChatPost(w, c); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0c8fe6f685ab521f04bb66b009cc82b0", "score": "0.4793875", "text": "func (c *Client) Build(br BuildRequest) (*Build, error) {\n\tif c.dry {\n\t\treturn &Build{}, nil\n\t}\n\tbuildID := uuid.NewV1().String()\n\tu, err := url.Parse(fmt.Sprintf(\"%s/job/%s/buildWithParameters\", c.baseURL, br.JobName))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tq := u.Query()\n\tq.Set(\"buildId\", buildID)\n\t// These two are provided for backwards-compatibility with scripts that\n\t// used the ghprb plugin.\n\t// TODO(spxtr): Remove these.\n\tq.Set(\"ghprbPullId\", br.Refs)\n\tq.Set(\"ghprbTargetBranch\", br.BaseRef)\n\n\tq.Set(\"PULL_REFS\", br.Refs)\n\tq.Set(\"PULL_NUMBER\", strconv.Itoa(br.Number))\n\tq.Set(\"PULL_BASE_REF\", br.BaseRef)\n\tq.Set(\"PULL_BASE_SHA\", br.BaseSHA)\n\tq.Set(\"PULL_PULL_SHA\", br.PullSHA)\n\tu.RawQuery = q.Encode()\n\tresp, err := c.request(http.MethodPost, u.String())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\tif resp.StatusCode != 201 {\n\t\treturn nil, fmt.Errorf(\"response not 201: %s\", resp.Status)\n\t}\n\tloc, err := resp.Location()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Build{\n\t\tjobName: br.JobName,\n\t\trefs: br.Refs,\n\t\tid: buildID,\n\t\tqueueURL: loc,\n\t}, nil\n}", "title": "" }, { "docid": "b6f7388f1750366bdcc07eba856de25d", "score": "0.47850922", "text": "func (p *provider) Build(params map[string]interface{}) (providers.Provider, fail.Error) {\n\tidentity, err := recast(params[\"identity\"])\n\tif err != nil {\n\t\treturn &provider{}, fail.ConvertError(err)\n\t}\n\tcompute, err := recast(params[\"compute\"])\n\tif err != nil {\n\t\treturn &provider{}, fail.ConvertError(err)\n\t}\n\tnetwork, err := recast(params[\"network\"])\n\tif err != nil {\n\t\treturn &provider{}, fail.ConvertError(err)\n\t}\n\n\tidentityEndpoint, _ := identity[\"EndPoint\"].(string) // nolint\n\tif identityEndpoint == \"\" {\n\t\tidentityEndpoint = fmt.Sprintf(authURL, compute[\"Region\"])\n\t}\n\tusername, _ := identity[\"Username\"].(string) // nolint\n\tpassword, _ := identity[\"Password\"].(string) // nolint\n\tdomainName, _ := identity[\"DomainName\"].(string) // nolint\n\tprojectID, _ := compute[\"ProjectID\"].(string) // nolint\n\tvpcName, _ := network[\"DefaultNetworkName\"].(string) // nolint\n\tif vpcName == \"\" {\n\t\tvpcName, _ = network[\"VPCName\"].(string) // nolint\n\t}\n\tvpcCIDR, _ := network[\"DefaultNetworkCIDR\"].(string) // nolint\n\tif vpcCIDR == \"\" {\n\t\tvpcCIDR, _ = network[\"VPCCIDR\"].(string) // nolint\n\t}\n\tregion, _ := compute[\"Region\"].(string) // nolint\n\tzone, _ := compute[\"AvailabilityZone\"].(string) // nolint\n\toperatorUsername := abstract.DefaultUser\n\tif operatorUsernameIf, ok := compute[\"OperatorUsername\"]; ok {\n\t\toperatorUsername, ok = operatorUsernameIf.(string)\n\t\tif ok {\n\t\t\tif operatorUsername == \"\" {\n\t\t\t\tlogrus.WithContext(context.Background()).Warnf(\"OperatorUsername is empty ! Check your tenants.toml file ! Using 'safescale' user instead.\")\n\t\t\t\toperatorUsername = abstract.DefaultUser\n\t\t\t}\n\t\t}\n\t}\n\n\tdefaultImage, _ := compute[\"DefaultImage\"].(string) // nolint\n\tif defaultImage == \"\" {\n\t\tdefaultImage = flexibleEngineDefaultImage\n\t}\n\n\tisSafe, ok := compute[\"Safe\"].(bool) // nolint\n\tif !ok {\n\t\tisSafe = true\n\t}\n\tparams[\"Safe\"] = isSafe\n\n\tlogrus.WithContext(context.Background()).Infof(\"Setting safety to: %t\", isSafe)\n\n\tvar maxLifeTime int64 = 0\n\tif val, ok := compute[\"MaxLifetimeInHours\"].(int64); ok {\n\t\tmaxLifeTime = val\n\t}\n\n\tmachineCreationLimit := 4\n\tif _, ok = compute[\"ConcurrentMachineCreationLimit\"].(string); ok {\n\t\tmachineCreationLimit, _ = strconv.Atoi(compute[\"ConcurrentMachineCreationLimit\"].(string))\n\t}\n\n\tauthOptions := stacks.AuthenticationOptions{\n\t\tIdentityEndpoint: identityEndpoint,\n\t\tUsername: username,\n\t\tPassword: password,\n\t\tDomainName: domainName,\n\t\tProjectID: projectID,\n\t\tRegion: region,\n\t\tAvailabilityZone: zone,\n\t\tAllowReauth: true,\n\t}\n\n\tsuffix := getSuffix(params)\n\tproviderName := \"huaweicloud\"\n\tmetadataBucketName, xerr := objectstorage.BuildMetadataBucketName(providerName, region, domainName, projectID, suffix)\n\tif xerr != nil {\n\t\treturn nil, xerr\n\t}\n\n\tcustomDNS, _ := compute[\"DNS\"].(string) // nolint\n\tif customDNS != \"\" {\n\t\tif strings.Contains(customDNS, \",\") {\n\t\t\tfragments := strings.Split(customDNS, \",\")\n\t\t\tfor _, fragment := range fragments {\n\t\t\t\tfragment = strings.TrimSpace(fragment)\n\t\t\t\tif valid.IsIP(fragment) {\n\t\t\t\t\tdnsServers = append(dnsServers, fragment)\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tfragment := strings.TrimSpace(customDNS)\n\t\t\tif valid.IsIP(fragment) {\n\t\t\t\tdnsServers = append(dnsServers, fragment)\n\t\t\t}\n\t\t}\n\t}\n\n\tvar timings *temporal.MutableTimings\n\tif tc, ok := params[\"timings\"]; ok {\n\t\tif theRecoveredTiming, ok := tc.(map[string]interface{}); ok {\n\t\t\ts := &temporal.MutableTimings{}\n\t\t\terr := mapstructure.Decode(theRecoveredTiming, &s)\n\t\t\tif err != nil {\n\t\t\t\tgoto next\n\t\t\t}\n\t\t\ttimings = s\n\t\t}\n\t}\nnext:\n\n\tcfgOptions := stacks.ConfigurationOptions{\n\t\tDNSList: dnsServers,\n\t\tUseFloatingIP: true,\n\t\tUseLayer3Networking: false,\n\t\tVolumeSpeeds: map[string]volumespeed.Enum{\n\t\t\t\"SATA\": volumespeed.Cold,\n\t\t\t\"Ssd\": volumespeed.Ssd,\n\t\t},\n\t\tMetadataBucket: metadataBucketName,\n\t\tOperatorUsername: operatorUsername,\n\t\tProviderName: providerName,\n\t\tDefaultSecurityGroupName: \"default\",\n\t\tDefaultNetworkName: vpcName,\n\t\tDefaultNetworkCIDR: vpcCIDR,\n\t\tDefaultImage: defaultImage,\n\t\tMaxLifeTime: maxLifeTime,\n\t\tTimings: timings,\n\t\tSafe: isSafe,\n\t\tConcurrentMachineCreationLimit: machineCreationLimit,\n\t}\n\n\tserviceVersions := map[string]string{}\n\n\tif maybe, ok := compute[\"IdentityEndpointVersion\"]; ok {\n\t\tif val, ok := maybe.(string); ok {\n\t\t\tserviceVersions[\"identity\"] = val\n\t\t}\n\t}\n\n\tif maybe, ok := compute[\"ComputeEndpointVersion\"]; ok {\n\t\tif val, ok := maybe.(string); ok {\n\t\t\tserviceVersions[\"compute\"] = val\n\t\t}\n\t}\n\n\tif maybe, ok := compute[\"VolumeEndpointVersion\"]; ok {\n\t\tif val, ok := maybe.(string); ok {\n\t\t\tserviceVersions[\"volume\"] = val\n\t\t}\n\t}\n\n\tif maybe, ok := network[\"NetworkEndpointVersion\"]; ok {\n\t\tif val, ok := maybe.(string); ok {\n\t\t\tserviceVersions[\"network\"] = val\n\t\t}\n\t}\n\n\tif maybe, ok := network[\"NetworkClientEndpointVersion\"]; ok {\n\t\tif val, ok := maybe.(string); ok {\n\t\t\tserviceVersions[\"networkclient\"] = val\n\t\t}\n\t}\n\n\tstack, xerr := huaweicloud.New(authOptions, cfgOptions, serviceVersions)\n\tif xerr != nil {\n\t\treturn nil, xerr\n\t}\n\n\twrapped := api.StackProxy{\n\t\tFullStack: stack,\n\t\tName: \"flexibleengine\",\n\t}\n\n\tnewP := &provider{\n\t\tStack: wrapped,\n\t\ttenantParameters: params,\n\t}\n\n\twp := providers.ProviderProxy{\n\t\tProvider: newP,\n\t\tName: wrapped.Name,\n\t}\n\n\treturn wp, nil\n}", "title": "" }, { "docid": "da1c042d4d0c828e3ca7744c4cb2ebfd", "score": "0.47787294", "text": "func (b builder[T]) Build() *GenFSM[T] {\n\tfsm := GenFSM[T](b)\n\treturn &fsm\n}", "title": "" }, { "docid": "2f2a3160e5bf98e170791065d8d8014c", "score": "0.4774865", "text": "func (o *CreateSiteParams) WithTimeout(timeout time.Duration) *CreateSiteParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "title": "" }, { "docid": "071ce8c704268e54741f43d4c4af7ddf", "score": "0.4764898", "text": "func (l *Loader) Build() *Loader {\n\tl.parseFields(l.src)\n\tl.isBuilt = true\n\treturn l\n}", "title": "" }, { "docid": "5df904c8a2b5c885214f62b6f776c213", "score": "0.47615153", "text": "func Build(data map[int]string) error {\n\tfmt.Printf(\"Inside BuildIndex!\\n\")\n\t// Now save the contents of the index variable to a file\n\t// to make it an \"offline\" index.\n\tfile, err := os.Create(indexName)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to create offline index\")\n\t}\n\tdefer file.Close()\n\n\tif err := json.NewEncoder(file).Encode(&data); err != nil {\n\t\treturn errors.Wrap(err, \"failed to encode data into offline index\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "29e819b606b815d6af9c683d8fc38895", "score": "0.4756848", "text": "func TestNewBuild(t *testing.T) {\n\tb := NewBuild()\n\tif b == nil {\n\t\tt.Errorf(\"TestNewBuild(): got -> %v, want: Build{}\", b)\n\t}\n\tlog.Println(b)\n}", "title": "" }, { "docid": "1f8f6b049175f2a9d163408a6b51417b", "score": "0.4755097", "text": "func (o *CreateSiteParams) SetSite(site *models.SiteSetup) {\n\to.Site = site\n}", "title": "" }, { "docid": "d52a8ca3f01999b50659c42bd060b18f", "score": "0.47449562", "text": "func build(opts ...Opt) (s *Server, err error) {\n\t// These are internal defaults if all else fails during configuration\n\tb := serverBuilder{\n\t\thttpPort: 80,\n\t\thttpsPort: 443,\n\t\thttpTimeout: 10 * time.Second,\n\t}\n\n\t// loop through our configured options and apply them to the functional builder\n\tfor _, opt := range opts {\n\t\terr = opt(&b)\n\t\tif err != nil {\n\t\t\treturn s, err\n\t\t}\n\t}\n\n\t// validate we have all our required arguments\n\terr = b.validate()\n\tif err != nil {\n\t\treturn s, err\n\t}\n\n\tsecureServer := b.tlsCertPath != \"\" && b.tlsKeyPath != \"\"\n\n\tif b.log == nil {\n\t\tb.log = basicLogger{}\n\t}\n\n\tif !secureServer {\n\t\treturn b.buildWithoutHTTPS()\n\t}\n\n\treturn b.buildWithHTTPS()\n\n}", "title": "" }, { "docid": "11333c00cc225a423ede2f55f1c8ed3d", "score": "0.4731309", "text": "func (b Builder) Build(data *request.Data, statusCode status.Code) ([]byte, error) {\n\n\tvar responseBytes []byte\n\tvar err error\n\n\tswitch statusCode {\n\tcase status.Success:\n\t\tresponseBytes, err = b.buildSuccess(data)\n\tcase status.BadRequest:\n\t\tresponseBytes = []byte(badRequestResponse)\n\tcase status.NotFound:\n\t\tresponseBytes = []byte(notFoundResponse)\n\tcase status.URITooLong:\n\t\tresponseBytes = []byte(uriTooLongResponse)\n\tcase status.UnsupportedMediaType:\n\t\tresponseBytes = []byte(unsupportedMediaTypeResponse)\n\tcase status.InvalidHTTPMethod:\n\t\tresponseBytes = []byte(invalidHTTPMethodResponse)\n\tdefault:\n\t\tresponseBytes = []byte(badRequestResponse)\n\t}\n\n\treturn responseBytes, err\n}", "title": "" } ]
a5e2f4bab8e0f05aa7a254bbdb3e6320
GetEndpoints is a mockable api.GetEndpoints().
[ { "docid": "13b994ee604ea044d700d8da3495ed05", "score": "0.7744717", "text": "func (api *FakeAPI) GetEndpoints() map[string]config.Endpoint {\n\targs := api.Called()\n\treturn args.Get(0).(map[string]config.Endpoint)\n}", "title": "" } ]
[ { "docid": "98f9d80cc484ae63da41f3ef6051af36", "score": "0.7382586", "text": "func (c *Client) GetEndpoints(ctx context.Context) (*ua.GetEndpointsResponse, error) {\n\tstats.Client().Add(\"GetEndpoints\", 1)\n\n\treq := &ua.GetEndpointsRequest{\n\t\tEndpointURL: c.endpointURL,\n\t}\n\tvar res *ua.GetEndpointsResponse\n\terr := c.Send(ctx, req, func(v interface{}) error {\n\t\treturn safeAssign(v, &res)\n\t})\n\treturn res, err\n}", "title": "" }, { "docid": "711762683969a1bcffef534862a1cdc7", "score": "0.73288554", "text": "func (m *MockController) GetEndpoints(arg0 service.MeshService) (*v1.Endpoints, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetEndpoints\", arg0)\n\tret0, _ := ret[0].(*v1.Endpoints)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "b998664eef40b68f8a0fd190efd8fab7", "score": "0.7280772", "text": "func (r *MyRouter) GetEndpoints() map[string]map[string]string {\n\treturn r.v1endpoints\n}", "title": "" }, { "docid": "36af709db9da149e1b90b57bab115118", "score": "0.7235679", "text": "func GetEndpoints() (endpoints []*vnet.Endpoint) {\n\tendpoints = []*vnet.Endpoint{\n\t\t&vnet.Endpoint{\n\t\t\tMethod: echo.POST,\n\t\t\tURL: \"uman/user\",\n\t\t\tAccess: vsec.Admin,\n\t\t\tCategory: \"user management\",\n\t\t\tFunc: createUser,\n\t\t\tComment: \"Create an user\",\n\t\t},\n\t\t&vnet.Endpoint{\n\t\t\tMethod: echo.PUT,\n\t\t\tURL: \"uman/user\",\n\t\t\tAccess: vsec.Admin,\n\t\t\tCategory: \"user management\",\n\t\t\tFunc: updateUser,\n\t\t\tComment: \"Update an user\",\n\t\t},\n\t\t&vnet.Endpoint{\n\t\t\tMethod: echo.DELETE,\n\t\t\tURL: \"uman/user/:userID\",\n\t\t\tAccess: vsec.Admin,\n\t\t\tCategory: \"user management\",\n\t\t\tFunc: deleteUser,\n\t\t\tComment: \"Delete an user\",\n\t\t},\n\t\t&vnet.Endpoint{\n\t\t\tMethod: echo.GET,\n\t\t\tURL: \"uman/user/:userID\",\n\t\t\tAccess: vsec.Monitor,\n\t\t\tCategory: \"user management\",\n\t\t\tFunc: getUser,\n\t\t\tComment: \"Get info about an user\",\n\t\t},\n\t\t&vnet.Endpoint{\n\t\t\tMethod: echo.GET,\n\t\t\tURL: \"uman/user\",\n\t\t\tAccess: vsec.Monitor,\n\t\t\tCategory: \"user management\",\n\t\t\tFunc: getUsers,\n\t\t\tComment: \"Get list of user & their details\",\n\t\t},\n\t\t&vnet.Endpoint{\n\t\t\tMethod: echo.POST,\n\t\t\tURL: \"uman/user/password\",\n\t\t\tAccess: vsec.Admin,\n\t\t\tCategory: \"user management\",\n\t\t\tFunc: setPassword,\n\t\t\tComment: \"Set password for an user\",\n\t\t},\n\t\t&vnet.Endpoint{\n\t\t\tMethod: echo.PUT,\n\t\t\tURL: \"uman/user/password\",\n\t\t\tAccess: vsec.Monitor,\n\t\t\tCategory: \"user management\",\n\t\t\tFunc: resetPassword,\n\t\t\tComment: \"Reset password\",\n\t\t},\n\t\t&vnet.Endpoint{\n\t\t\tMethod: echo.POST,\n\t\t\tURL: \"uman/user/self\",\n\t\t\tAccess: vsec.Public,\n\t\t\tCategory: \"user management\",\n\t\t\tFunc: registerUser,\n\t\t\tComment: \"Registration for new user\",\n\t\t},\n\t\t&vnet.Endpoint{\n\t\t\tMethod: echo.POST,\n\t\t\tURL: \"uman/user/verify/:userID/:verID\",\n\t\t\tAccess: vsec.Public,\n\t\t\tCategory: \"user management\",\n\t\t\tFunc: verify,\n\t\t\tComment: \"Verify a registered account\",\n\t\t},\n\t\t&vnet.Endpoint{\n\t\t\tMethod: echo.PUT,\n\t\t\tURL: \"/uman/user/self\",\n\t\t\tAccess: vsec.Public,\n\t\t\tCategory: \"user management\",\n\t\t\tFunc: updateProfile,\n\t\t},\n\t}\n\treturn endpoints\n\n}", "title": "" }, { "docid": "c6554bd71744d44a0e27d364f31845aa", "score": "0.71110827", "text": "func GetEndpoints(ctx context.Context, namespace string) ([]v1.Endpoints, error) {\n\treturn client.GetEndpoints(ctx, namespace)\n}", "title": "" }, { "docid": "0141cce85f9ef7b25174773d749a83ba", "score": "0.69773865", "text": "func (wf *WatchFactory) GetEndpoints(namespace string) ([]*kapi.Endpoints, error) {\n\tendpointsLister := wf.informers[endpointsType].lister.(listers.EndpointsLister)\n\treturn endpointsLister.Endpoints(namespace).List(labels.Everything())\n}", "title": "" }, { "docid": "eed1d5033ec952de59d3e933ce759281", "score": "0.68501157", "text": "func getEndpoints() []endpoint {\n\treturn []endpoint{\n\t\t{\n\t\t\tmethod: post,\n\t\t\tpath: \"/createuser\",\n\t\t\thandler: HandleCreateUser,\n\t\t},\n\t\t{\n\t\t\tmethod: post,\n\t\t\tpath: \"/login\",\n\t\t\thandler: HandleLogin,\n\t\t},\n\t\t{\n\t\t\tmethod: post,\n\t\t\tpath: \"/comment\",\n\t\t\thandler: HandleComment,\n\t\t},\n\t\t{\n\t\t\tmethod: post,\n\t\t\tpath: \"/subcomment\",\n\t\t\thandler: HandleCreateSubcomment,\n\t\t},\n\t\t{\n\t\t\tmethod: post,\n\t\t\tpath: \"/reaction\",\n\t\t\thandler: HandleCreateReaction,\n\t\t},\n\t\t{\n\t\t\tmethod: get,\n\t\t\tpath: \"/wall\",\n\t\t\thandler: HandleGetWall,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "aa511f7cb14fe7d9abdb99eb5d30a8cd", "score": "0.67959714", "text": "func GetEndpoints(ctx context.Context, endpoint string, opts ...Option) ([]*ua.EndpointDescription, error) {\n\topts = append(opts, AutoReconnect(false))\n\tc, err := NewClient(endpoint, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err := c.Dial(ctx); err != nil {\n\t\treturn nil, err\n\t}\n\tdefer c.Close(ctx)\n\tres, err := c.GetEndpoints(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn res.Endpoints, nil\n}", "title": "" }, { "docid": "94cf8b5e61b07ce5fd1b32bba97a30db", "score": "0.67814314", "text": "func (s *Server) GetEndpoints() []string {\n\treturn s.client.Endpoints()\n}", "title": "" }, { "docid": "0a3e7753af3e3028797fe52f05562f85", "score": "0.66233605", "text": "func GetEndpoints() string {\n\treturn string(MustAsset(\"builtin/endpoints.yaml\"))\n}", "title": "" }, { "docid": "4479d4845af8d481958b82fd911ec5ef", "score": "0.66221935", "text": "func (m *ServicePrincipal) GetEndpoints()([]Endpointable) {\n val, err := m.GetBackingStore().Get(\"endpoints\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]Endpointable)\n }\n return nil\n}", "title": "" }, { "docid": "adf12a1b915342982cfaf50ba782b40c", "score": "0.6532527", "text": "func GetEndpoints(namespace, service, defSeeds *C.char) *C.char {\n\tns := C.GoString(namespace)\n\tsvc := C.GoString(service)\n\tseeds := C.GoString(defSeeds)\n\n\ts := strings.Map(func(r rune) rune {\n\t\tif unicode.IsSpace(r) {\n\t\t\treturn -1\n\t\t}\n\t\treturn r\n\t}, seeds)\n\n\tnseeds := strings.Split(s, \",\")\n\tclient, err := k8s.NewInClusterClient()\n\tif err != nil {\n\t\tlog.Printf(\"unexpected error opening a connection against API server: %v\\n\", err)\n\t\tlog.Printf(\"returning default seeds: %v\\n\", nseeds)\n\t\treturn buildEndpoints(nseeds)\n\t}\n\n\tips := make([]string, 0)\n\n\tvar endpoints corev1.Endpoints\n\terr = client.Get(context.Background(), ns, svc, &endpoints)\n\tif err != nil {\n\t\tlog.Printf(\"unexpected error obtaining information about service endpoints: %v\\n\", err)\n\t\tlog.Printf(\"returning default seeds: %v\\n\", nseeds)\n\t\treturn buildEndpoints(nseeds)\n\t}\n\n\tfor _, endpoint := range endpoints.Subsets {\n\t\tfor _, address := range endpoint.Addresses {\n\t\t\tips = append(ips, *address.Ip)\n\t\t}\n\t}\n\n\tif len(ips) == 0 {\n\t\treturn buildEndpoints(nseeds)\n\t}\n\n\treturn buildEndpoints(ips)\n}", "title": "" }, { "docid": "01cdd8b5ad794171fc4c114470034e70", "score": "0.6524866", "text": "func getEndpoints(pod string) []string {\n\tresp, _ := http.Get(\"http://10.1.1.2:8080/api/v1beta1/endpoints/\" + pod + \"?namespace=default\")\n\tbody, _ := ioutil.ReadAll(resp.Body)\n\tvar endpoints v1beta1.Endpoints\n\tjson.Unmarshal(body, &endpoints)\n\treturn (endpoints.Endpoints)\n}", "title": "" }, { "docid": "a3b16df0b2871003c674c032d456f312", "score": "0.64918894", "text": "func (a *EndpointsApiService) EndpointList(ctx context.Context) (model.EndpointListResponse, *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 = make(model.EndpointListResponse, 0)\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/endpoints\"\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\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAccessToken).(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\n\t\t}\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\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, \"application/json\")\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\n\t\tif localVarHttpResponse.StatusCode == 500 {\n\t\t\tvar v model.GenericError\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\n\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHttpResponse, nil\n}", "title": "" }, { "docid": "48f0729f7468c853804e063db87e0695", "score": "0.6484659", "text": "func UA_Client_getEndpointsInternal(client []UA_Client, endpointDescriptionsSize []uint, endpointDescriptions [][]UA_EndpointDescription) UA_StatusCode {\n\tvar request UA_GetEndpointsRequest\n\tUA_GetEndpointsRequest_init((*[100000000]UA_GetEndpointsRequest)(unsafe.Pointer(&request))[:])\n\trequest.requestHeader.timestamp = UA_DateTime_now()\n\trequest.requestHeader.timeoutHint = 10000\n\t// assume the endpointurl outlives the service call\n\trequest.endpointUrl = client[0].endpointUrl\n\tvar response UA_GetEndpointsResponse\n\t__UA_Client_Service(client, (*[100000000]UA_GetEndpointsRequest)(unsafe.Pointer(&request))[:], (*[100000000]UA_DataType)(unsafe.Pointer(&UA_TYPES[137]))[:], (*[100000000]UA_GetEndpointsResponse)(unsafe.Pointer(&response))[:], (*[100000000]UA_DataType)(unsafe.Pointer(&UA_TYPES[193]))[:])\n\tif UA_StatusCode(response.responseHeader.serviceResult) != UA_StatusCode((uint32_t((uint32((0)))))) {\n\t\tvar retval UA_StatusCode = UA_StatusCode(response.responseHeader.serviceResult)\n\t\tUA_LOG_ERROR(UA_Logger(client[0].config.logger), UA_LOGCATEGORY_CLIENT, []byte(\"GetEndpointRequest failed with error code %s\\x00\"), UA_StatusCode_name(UA_StatusCode(retval)))\n\t\tUA_GetEndpointsResponse_deleteMembers((*[100000000]UA_GetEndpointsResponse)(unsafe.Pointer(&response))[:])\n\t\treturn UA_StatusCode(retval)\n\t}\n\tendpointDescriptions[0] = response.endpoints\n\tendpointDescriptionsSize[0] = uint(response.endpointsSize)\n\tresponse.endpoints = nil\n\tresponse.endpointsSize = 0\n\tUA_GetEndpointsResponse_deleteMembers((*[100000000]UA_GetEndpointsResponse)(unsafe.Pointer(&response))[:])\n\treturn 0\n}", "title": "" }, { "docid": "7f9e64f55737530774034a498516a49c", "score": "0.6459579", "text": "func (cl *ConsulLookup) getEndpoints() []*Endpoint {\n\tcl.endpointsMu.Lock()\n\tdefer cl.endpointsMu.Unlock()\n\n\tresult := cl.endpoints\n\treturn result\n}", "title": "" }, { "docid": "dfe6286643907b85ad5a42ab9c2bdf8d", "score": "0.6457668", "text": "func (m *Machine) GetEndpoints(namespace string, name string) (*corev1.Endpoints, error) {\n\tep, err := m.Clientset.CoreV1().Endpoints(namespace).Get(name, metav1.GetOptions{})\n\tif err != nil {\n\t\treturn ep, errors.Wrapf(err, \"failed to get endpoint '%s'\", ep)\n\t}\n\n\treturn ep, nil\n}", "title": "" }, { "docid": "4b1f0070f5563412ee1f80a6200d1d4c", "score": "0.6456042", "text": "func GetEndpoints(client kubernetes.Interface, options GetEndpointsOptions) (*v1.Endpoints, error) {\n\tkey := fmt.Sprintf(\"%s-%s\", options.Name, options.Namespace)\n\tif deployment, found := services[key]; found {\n\t\treturn deployment, nil\n\t}\n\tresource, err := client.CoreV1().Endpoints(options.Namespace).Get(options.Name, meta_v1.GetOptions{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tservices[key] = resource\n\treturn resource, nil\n}", "title": "" }, { "docid": "e1d84586c0c9eb7ca2ab7adc7deea101", "score": "0.64380884", "text": "func (m *Machine) GetEndpoints(namespace string, name string) (*corev1.Endpoints, error) {\n\tep, err := m.Clientset.CoreV1().Endpoints(namespace).Get(context.Background(), name, metav1.GetOptions{})\n\tif err != nil {\n\t\treturn ep, errors.Wrapf(err, \"failed to get endpoint '%s'\", ep)\n\t}\n\n\treturn ep, nil\n}", "title": "" }, { "docid": "bb92bb544e9f09d80c570ecbadbef401", "score": "0.6437594", "text": "func (a *AppService) GetEndpoints(canCopy bool) []*corev1.Endpoints {\n\tif canCopy {\n\t\treturn append(a.endpoints[:0:0], a.endpoints...)\n\t}\n\treturn a.endpoints\n}", "title": "" }, { "docid": "94e4a10fa11d1512ba46a2f54e7c4811", "score": "0.6434862", "text": "func (s *Site) GetEndpoints() (endpoints []string) {\n\tconst scriptTemplate = `\n\t\tvar urls = [];\n\t\tvar endpoints = window.reactor.evaluate(['site_current', 'endpoints']);\n\t\tif(!endpoints){\n\t\t\treturn urls;\n\t\t}\n\n\t\tendpoints = endpoints.toJS();\n\t\tfor( var i = 0; i < endpoints.length; i ++){\n\t\t\tvar addressess = endpoints[i].addresses || []\n\t\t\taddressess.forEach( a => urls.push(a))\n\t\t} \n\t\treturn urls; `\n\n\tExpect(s.page.RunScript(scriptTemplate, nil, &endpoints)).To(Succeed())\n\treturn endpoints\n}", "title": "" }, { "docid": "9da0661033452cb0a97ce5ce32022817", "score": "0.64290994", "text": "func (m *AppsodyApplicationMonitoring) GetEndpoints() []prometheusv1.Endpoint {\n\treturn m.Endpoints\n}", "title": "" }, { "docid": "6c50e88b322bdf141b14cbeef748355d", "score": "0.642418", "text": "func (m *Mockdiscovery) Endpoints() []string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Endpoints\")\n\tret0, _ := ret[0].([]string)\n\treturn ret0\n}", "title": "" }, { "docid": "48a6e89346b3910477890e078ebb7026", "score": "0.63993174", "text": "func (c *Client) GetEndpoints(namespace, name string) (*k8s.Endpoints, error) {\n\tvar out k8s.Endpoints\n\t_, err := c.do(\"GET\", endpointsGeneratePath(namespace, name), nil, &out)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to get Endpoints\")\n\t}\n\treturn &out, nil\n}", "title": "" }, { "docid": "41dca8b8abebfdac5169ddbb273d7962", "score": "0.63824695", "text": "func (listener *Listener) GetEndpoints() []string {\n\treturn listener.endpoints\n}", "title": "" }, { "docid": "76128101bebe5775865fce85594d7362", "score": "0.6380411", "text": "func (handler *EndpointHandler) handleGetEndpoints(w http.ResponseWriter, r *http.Request) {\n\tendpoints, err := handler.EndpointService.Endpoints()\n\tif err != nil {\n\t\tError(w, err, http.StatusInternalServerError, handler.Logger)\n\t\treturn\n\t}\n\n\ttokenData, err := extractTokenDataFromRequestContext(r)\n\tif err != nil {\n\t\tError(w, err, http.StatusInternalServerError, handler.Logger)\n\t}\n\tif tokenData == nil {\n\t\tError(w, portainer.ErrInvalidJWTToken, http.StatusBadRequest, handler.Logger)\n\t\treturn\n\t}\n\n\tvar allowedEndpoints []portainer.Endpoint\n\tif tokenData.Role != portainer.AdministratorRole {\n\t\tallowedEndpoints = make([]portainer.Endpoint, 0)\n\t\tfor _, endpoint := range endpoints {\n\t\t\tfor _, authorizedUserID := range endpoint.AuthorizedUsers {\n\t\t\t\tif authorizedUserID == tokenData.ID {\n\t\t\t\t\tallowedEndpoints = append(allowedEndpoints, endpoint)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else {\n\t\tallowedEndpoints = endpoints\n\t}\n\n\tencodeJSON(w, allowedEndpoints, handler.Logger)\n}", "title": "" }, { "docid": "216212ee524769c0515fdb86b069ce4d", "score": "0.6362209", "text": "func (c *Client) GetEndpoints(name, namespace string) (*corev1.Endpoints, error) {\n\tep, exists, err := c.getByKey(informerKeyEndpoints, key(name, namespace))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif exists {\n\t\treturn ep.(*corev1.Endpoints), nil\n\t}\n\treturn nil, nil\n}", "title": "" }, { "docid": "5fb120b32982aa263c2eb7a71e07163a", "score": "0.6357904", "text": "func (a *api) APIEndpoints() []Endpoint {\n\treturn a.endpoints\n}", "title": "" }, { "docid": "b651af0c355792fd938508d25bc58589", "score": "0.63326067", "text": "func Service_GetEndpoints(server []UA_Server, session []UA_Session, request []UA_GetEndpointsRequest, response []UA_GetEndpointsResponse) {\n\tvar endpointUrl []UA_String = (*[100000000]UA_String)(unsafe.Pointer(&request[0].endpointUrl))[:]\n\tif uint(endpointUrl[0].length) > uint((0)) {\n\t\t// If the client expects to see a specific endpointurl, mirror it back. If\n\t\t// not, clone the endpoints with the discovery url of all networklayers.\n\t\tUA_LOG_DEBUG(UA_Logger(server[0].config.logger), UA_LOGCATEGORY_SESSION, []byte(\"Connection %i | SecureChannel %i | Session %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x | Processing GetEndpointsRequest with endpointUrl \\\"%.*s\\\"%.0s\\x00\"), (func() int {\n\t\t\tif (session)[0].header.channel != nil {\n\t\t\t\treturn (func() int {\n\t\t\t\t\tif (session)[0].header.channel[0].connection != nil {\n\t\t\t\t\t\treturn int((__int32_t((int32_t((UA_Int32((session)[0].header.channel[0].connection[0].sockfd)))))))\n\t\t\t\t\t}\n\t\t\t\t\treturn 0\n\t\t\t\t}())\n\t\t\t}\n\t\t\treturn 0\n\t\t}()), (func() uint32 {\n\t\t\tif (session)[0].header.channel != nil {\n\t\t\t\treturn uint32((uint32((uint32_t((UA_UInt32((session)[0].header.channel[0].securityToken.channelId)))))))\n\t\t\t}\n\t\t\treturn 0\n\t\t}()), UA_UInt32((*(session)[0].sessionId.identifier.guid()).data1), int(uint16((uint16((uint16_t((UA_UInt16((*(session)[0].sessionId.identifier.guid()).data2)))))))), int(uint16((uint16((uint16_t((UA_UInt16((*(session)[0].sessionId.identifier.guid()).data3)))))))), int(uint8((__uint8_t((uint8_t((UA_Byte((*(session)[0].sessionId.identifier.guid()).data4[:][0])))))))), int(uint8((__uint8_t((uint8_t((UA_Byte((*(session)[0].sessionId.identifier.guid()).data4[:][1])))))))), int(uint8((__uint8_t((uint8_t((UA_Byte((*(session)[0].sessionId.identifier.guid()).data4[:][2])))))))), int(uint8((__uint8_t((uint8_t((UA_Byte((*(session)[0].sessionId.identifier.guid()).data4[:][3])))))))), int(uint8((__uint8_t((uint8_t((UA_Byte((*(session)[0].sessionId.identifier.guid()).data4[:][4])))))))), int(uint8((__uint8_t((uint8_t((UA_Byte((*(session)[0].sessionId.identifier.guid()).data4[:][5])))))))), int(uint8((__uint8_t((uint8_t((UA_Byte((*(session)[0].sessionId.identifier.guid()).data4[:][6])))))))), int(uint8((__uint8_t((uint8_t((UA_Byte((*(session)[0].sessionId.identifier.guid()).data4[:][7])))))))), int(uint32((uint((endpointUrl[0]).length)))), (endpointUrl[0]).data, []byte(\"\\x00\"))\n\t} else {\n\t\tUA_LOG_DEBUG(UA_Logger(server[0].config.logger), UA_LOGCATEGORY_SESSION, []byte(\"Connection %i | SecureChannel %i | Session %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x | Processing GetEndpointsRequest with an empty endpointUrl%.0s\\x00\"), (func() int {\n\t\t\tif (session)[0].header.channel != nil {\n\t\t\t\treturn (func() int {\n\t\t\t\t\tif (session)[0].header.channel[0].connection != nil {\n\t\t\t\t\t\treturn int((__int32_t((int32_t((UA_Int32((session)[0].header.channel[0].connection[0].sockfd)))))))\n\t\t\t\t\t}\n\t\t\t\t\treturn 0\n\t\t\t\t}())\n\t\t\t}\n\t\t\treturn 0\n\t\t}()), (func() uint32 {\n\t\t\tif (session)[0].header.channel != nil {\n\t\t\t\treturn uint32((uint32((uint32_t((UA_UInt32((session)[0].header.channel[0].securityToken.channelId)))))))\n\t\t\t}\n\t\t\treturn 0\n\t\t}()), UA_UInt32((*(session)[0].sessionId.identifier.guid()).data1), int(uint16((uint16((uint16_t((UA_UInt16((*(session)[0].sessionId.identifier.guid()).data2)))))))), int(uint16((uint16((uint16_t((UA_UInt16((*(session)[0].sessionId.identifier.guid()).data3)))))))), int(uint8((__uint8_t((uint8_t((UA_Byte((*(session)[0].sessionId.identifier.guid()).data4[:][0])))))))), int(uint8((__uint8_t((uint8_t((UA_Byte((*(session)[0].sessionId.identifier.guid()).data4[:][1])))))))), int(uint8((__uint8_t((uint8_t((UA_Byte((*(session)[0].sessionId.identifier.guid()).data4[:][2])))))))), int(uint8((__uint8_t((uint8_t((UA_Byte((*(session)[0].sessionId.identifier.guid()).data4[:][3])))))))), int(uint8((__uint8_t((uint8_t((UA_Byte((*(session)[0].sessionId.identifier.guid()).data4[:][4])))))))), int(uint8((__uint8_t((uint8_t((UA_Byte((*(session)[0].sessionId.identifier.guid()).data4[:][5])))))))), int(uint8((__uint8_t((uint8_t((UA_Byte((*(session)[0].sessionId.identifier.guid()).data4[:][6])))))))), int(uint8((__uint8_t((uint8_t((UA_Byte((*(session)[0].sessionId.identifier.guid()).data4[:][7])))))))), []byte(\"\\x00\"))\n\t}\n\tvar reSize uint = uint((4 * uint32((uint(server[0].config.endpointsSize)))))\n\tvar relevant_endpoints []UA_Boolean\n\t// test if the supported binary profile shall be returned\n\tnoarch.Memset(relevant_endpoints, byte(0), uint32((uint(reSize))))\n\tvar relevant_count uint\n\tif uint(request[0].profileUrisSize) == uint((0)) {\n\t\t{\n\t\t\tvar j uint\n\t\t\tfor ; j < uint(server[0].config.endpointsSize); j++ {\n\t\t\t\trelevant_endpoints[j] = 1\n\t\t\t}\n\t\t}\n\t\trelevant_count = uint(server[0].config.endpointsSize)\n\t} else {\n\t\t{\n\t\t\tvar j uint\n\t\t\tfor ; j < uint(server[0].config.endpointsSize); j++ {\n\t\t\t\t{\n\t\t\t\t\tvar i uint\n\t\t\t\t\tfor ; i < uint(request[0].profileUrisSize); i++ {\n\t\t\t\t\t\tif int((int((noarch.NotUA_Boolean(UA_String_equal((*[100000000]UA_String)(unsafe.Pointer(&request[0].profileUris[i]))[:], (*[100000000]UA_String)(unsafe.Pointer(&server[0].config.endpoints[j].endpointDescription.transportProfileUri))[:])))))) != 0 {\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t\trelevant_endpoints[j] = 1\n\t\t\t\t\t\trelevant_count ++\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif relevant_count == uint((0)) {\n\t\tresponse[0].endpointsSize = 0\n\t\treturn\n\t}\n\tvar clone_times uint = 1\n\tvar nl_endpointurl UA_Boolean\n\tif uint(endpointUrl[0].length) == uint((0)) {\n\t\t// Clone the endpoint for each networklayer?\n\t\tclone_times = uint(server[0].config.networkLayersSize)\n\t\tnl_endpointurl = 1\n\t}\n\tresponse[0].endpoints = UA_Array_new(relevant_count*clone_times, (*[100000000]UA_DataType)(unsafe.Pointer(&UA_TYPES[183]))[:]).([]UA_EndpointDescription)\n\tif response[0].endpoints == nil {\n\t\tresponse[0].responseHeader.serviceResult = UA_StatusCode((uint32_t((uint32((uint32(2147680256)))))))\n\t\treturn\n\t}\n\tresponse[0].endpointsSize = relevant_count*clone_times\n\tvar k uint\n\tvar retval UA_StatusCode\n\t{\n\t\tvar i uint\n\t\tfor ; i < clone_times; i++ {\n\t\t\tif int((int((UA_Boolean(nl_endpointurl))))) != 0 {\n\t\t\t\tendpointUrl = (*[100000000]UA_String)(unsafe.Pointer(&server[0].config.networkLayers[i].discoveryUrl))[:]\n\t\t\t}\n\t\t\t{\n\t\t\t\tvar j uint\n\t\t\t\tfor ; j < uint(server[0].config.endpointsSize); j++ {\n\t\t\t\t\tif int((int((noarch.NotUA_Boolean(UA_Boolean(relevant_endpoints[j])))))) != 0 {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tretval |= UA_EndpointDescription_copy((*[100000000]UA_EndpointDescription)(unsafe.Pointer(&server[0].config.endpoints[j].endpointDescription))[:], (*[100000000]UA_EndpointDescription)(unsafe.Pointer(&response[0].endpoints[k]))[:])\n\t\t\t\t\tretval |= UA_String_copy(endpointUrl, (*[100000000]UA_String)(unsafe.Pointer(&response[0].endpoints[k].endpointUrl))[:])\n\t\t\t\t\tk ++\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif retval != UA_StatusCode((uint32_t((uint32((0)))))) {\n\t\tresponse[0].responseHeader.serviceResult = retval\n\t\tUA_Array_delete(response[0].endpoints, uint(response[0].endpointsSize), (*[100000000]UA_DataType)(unsafe.Pointer(&UA_TYPES[183]))[:])\n\t\tresponse[0].endpoints = nil\n\t\tresponse[0].endpointsSize = 0\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "1aeb8065228321f1d526bc34c31600cb", "score": "0.6314479", "text": "func (mr *MockControllerMockRecorder) GetEndpoints(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetEndpoints\", reflect.TypeOf((*MockController)(nil).GetEndpoints), arg0)\n}", "title": "" }, { "docid": "0ad6f90c7fb35e417b8b61243c86f81d", "score": "0.6280543", "text": "func (d *Defaulter) APIEndpoints() ([]string, error) {\n\treturn []string{DefaultAPIEndpoint}, nil\n}", "title": "" }, { "docid": "f4dfadb9562448c18d938a58594ccb80", "score": "0.62638825", "text": "func getAPIServerEndpoints(base *url.URL, client *http.Client) (string, error) {\n\tversionedAPIPath := \"/api/v1\"\n\tgv := v1.SchemeGroupVersion\n\tcontent := rest.ClientContentConfig{\n\t\tAcceptContentTypes: \"application/json\",\n\t\tContentType: \"application/json\",\n\t\tGroupVersion: gv,\n\t\tNegotiator: runtime.NewClientNegotiator(scheme.Codecs.WithoutConversion(), gv),\n\t}\n\n\tr := rest.NewRequestWithClient(base, versionedAPIPath, content, client)\n\tendpoint := &v1.Endpoints{}\n\treq := r.Verb(\"GET\").\n\t\tResource(\"endpoints\").\n\t\tNamespace(\"default\").\n\t\tName(\"kubernetes\")\n\tklog.V(4).InfoS(\"Request kubernetes.default endpoints\", \"request\", req)\n\tctx, cancel := context.WithTimeout(context.Background(), time.Duration(3*time.Second))\n\tdefer cancel()\n\terr := req.Do(ctx).Into(endpoint)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tips := getEndpointIPs(endpoint)\n\treturn generateAltSvc(ips), nil\n}", "title": "" }, { "docid": "a7542d5e6f42251ff94c08920da72331", "score": "0.61861205", "text": "func (m *MockPrivateEndpointsClientAPI) Get(ctx context.Context, resourceGroupName, privateEndpointName, expand string) (network.PrivateEndpoint, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Get\", ctx, resourceGroupName, privateEndpointName, expand)\n\tret0, _ := ret[0].(network.PrivateEndpoint)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "4e8a43234718d2f53d26e5d100eae1ff", "score": "0.6168661", "text": "func (rr *RoundRobinLoadBalancer) GetEndpoints() ([]string, []string) {\n\tvar healthy, unhealthy []string\n\trr.servers.Do(func(s interface{}) {\n\t\tloadBalancingEndpoint, ok := s.(*LoadBalancerEndpoint)\n\t\tif ok {\n\t\t\tif loadBalancingEndpoint.Up {\n\t\t\t\thealthy = append(healthy, loadBalancingEndpoint.Address)\n\t\t\t} else {\n\t\t\t\tunhealthy = append(unhealthy, loadBalancingEndpoint.Address)\n\t\t\t}\n\t\t} else {\n\t\t\tlog.Error(\"Something unexpected found in endpoint map\")\n\t\t}\n\t})\n\n\treturn healthy, unhealthy\n}", "title": "" }, { "docid": "aa3edbb5db381d7f9e90ab0b2fc5ddac", "score": "0.6140375", "text": "func NewEndpoints(s Service) *Endpoints {\n\treturn &Endpoints{\n\t\tGetActualTimeData: NewGetActualTimeDataEndpoint(s),\n\t\tReceiveThirdPartyPushData: NewReceiveThirdPartyPushDataEndpoint(s),\n\t}\n}", "title": "" }, { "docid": "ff793c877f686e00795273cdcb7644dc", "score": "0.612975", "text": "func (a *api) PublicEndpoints() []Endpoint {\n\treturn a.publicEndpoints\n}", "title": "" }, { "docid": "abb8da404b88434b21baf5414a250604", "score": "0.60968006", "text": "func MakeEndpoints(s interfaces.Service) Endpoints {\n\treturn Endpoints{\n\t\tCreateUser: makeCreateUserEndpoint(s),\n\t\tGetUserByID: makeGetUserByIDEndpoint(s),\n\t\tUpdateUser: makeUpdateUserEndpoint(s),\n\t\tDeleteUser: makeDeleteUserEndpoint(s),\n\n\t\tCreateCandidate: makeCreateCandidateEndpoint(s),\n\t\tGetAllCandidates: makeGetAllCandidatesEndpoint(s),\n\t\tGetCandidateByID: makeGetCandidateByIDEndpoint(s),\n\t\tUpdateCandidate: makeUpdateCandidateEndpoint(s),\n\t\tDeleteCandidate: makeDeleteCandidateEndpoint(s),\n\n\t\tCreateSkill: makeCreateSkillEndpoint(s),\n\t\tGetSkill: makeGetSkillEndpoint(s),\n\t\tGetAllSkills: makeGetAllSkillsEndpoint(s),\n\n\t\tCreateUserSkill: makeCreateUserSkillEndpoint(s),\n\t\tDeleteUserSkill: makeDeleteUserSkillEndpoint(s),\n\n\t\tCreateInstitution: makeCreateInstitutionEndpoint(s),\n\t\tGetInstitution: makeGetInstitutionEndpoint(s),\n\t\tGetAllInstitutions: makeGetAllInstitutionsEndpoint(s),\n\n\t\tCreateCourse: makeCreateCourseEndpoint(s),\n\t\tGetCourse: makeGetCourseEndpoint(s),\n\t\tGetAllCourses: makeGetAllCoursesEndpoint(s),\n\n\t\tCreateAcademicHistory: makeCreateAcademicHistoryEndpoint(s),\n\t\tGetAcademicHistory: makeGetAcademicHistoryEndpoint(s),\n\t\tUpdateAcademicHistory: makeUpdateAcademicHistoryEndpoint(s),\n\t\tDeleteAcademicHistory: makeDeleteAcademicHistoryEndpoint(s),\n\n\t\tCreateCompany: makeCreateCompanyEndpoint(s),\n\t\tGetCompany: makeGetCompanyEndpoint(s),\n\t\tGetAllCompanies: makeGetAllCompaniesEndpoint(s),\n\n\t\tCreateDepartment: makeCreateDepartmentEndpoint(s),\n\t\tGetDepartment: makeGetDepartmentEndpoint(s),\n\t\tGetAllDepartments: makeGetAllDepartmentsEndpoint(s),\n\n\t\tCreateJobHistory: makeCreateJobHistoryEndpoint(s),\n\t\tGetJobHistory: makeGetJobHistoryEndpoint(s),\n\t\tUpdateJobHistory: makeUpdateJobHistoryEndpoint(s),\n\t\tDeleteJobHistory: makeDeleteJobHistoryEndpoint(s),\n\t}\n}", "title": "" }, { "docid": "563e6f6a1a96920a1e8e93faeb7af254", "score": "0.6075776", "text": "func (svc *Pinpoint) GetUserEndpoints(ctx context.Context, r GetUserEndpointsRequest) (*GetUserEndpointsResult, error) {\n\tout, err := svc.RawGetUserEndpoints(ctx, r.ToInput())\n\tif err != nil {\n\t\terr = svc.errWrap(errors.ErrorData{\n\t\t\tErr: err,\n\t\t\tAWSOperation: \"GetUserEndpoints\",\n\t\t})\n\t\tsvc.Errorf(err.Error())\n\t\treturn nil, err\n\t}\n\treturn NewGetUserEndpointsResult(out), nil\n}", "title": "" }, { "docid": "498578374a7626ab0de07f46138d13fc", "score": "0.60466003", "text": "func (k K8s) GetEndpoints(namespace, name string) (endpoints map[string]*PortEndpoints, err error) {\n\tns, nsOk := k.Namespaces[namespace]\n\tif !nsOk {\n\t\treturn nil, fmt.Errorf(\"service '%s/%s' does not exist, namespace not found\", namespace, name)\n\t}\n\tslices, ok := ns.Endpoints[name]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"endpoints for service '%s/%s', does not exist\", namespace, name)\n\t}\n\tendpoints = make(map[string]*PortEndpoints)\n\tfor sliceName := range slices {\n\t\tfor portName, portEndpoints := range slices[sliceName].Ports {\n\t\t\tendpoints[portName] = portEndpoints\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "c30483026329d09250b34839b37b3f90", "score": "0.6045071", "text": "func (_m *SageMakerAPI) ListEndpoints(_a0 *sagemaker.ListEndpointsInput) (*sagemaker.ListEndpointsOutput, error) {\n\tret := _m.Called(_a0)\n\n\tvar r0 *sagemaker.ListEndpointsOutput\n\tif rf, ok := ret.Get(0).(func(*sagemaker.ListEndpointsInput) *sagemaker.ListEndpointsOutput); ok {\n\t\tr0 = rf(_a0)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*sagemaker.ListEndpointsOutput)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(*sagemaker.ListEndpointsInput) 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": "dd39dc2302fbe70c7bfbd753929f72ed", "score": "0.60382354", "text": "func GetEndpoints(name string, managementClientParam toolbox.GRPCClientParam) ([]string, error) {\n\topts, err := toolbox.GetGRPCDialOpts(managementClientParam)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tconn, err := grpc.Dial(managementClientParam.ServerEndpoint, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient := managepb.NewClusterManagementClient(conn)\n\n\t// TODO: use parameter for timeout. Maybe include in grpc client params. Defaults 1s\n\tctx, done := context.WithTimeout(context.Background(), 1*time.Second)\n\tdefer done()\n\tres, err := client.FindEndpoint(ctx, &managepb.EndpointRequest{\n\t\tEndpointName: name,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif res.Error != nil {\n\t\treturn nil, errors.New(res.Error.Message)\n\t}\n\n\tvar ret []string\n\tfor _, v := range res.Endpoints {\n\t\tret = append(ret, v.HostPort)\n\t}\n\treturn ret, nil\n}", "title": "" }, { "docid": "e49f5a7279a86d6480b24f1dbfcff9c8", "score": "0.6017075", "text": "func NewEndpoints(s Service) *Endpoints {\n\t// Casting service to Auther interface\n\ta := s.(Auther)\n\treturn &Endpoints{\n\t\tAdd: NewAddEndpoint(s, a.JWTAuth),\n\t\tGet: NewGetEndpoint(s, a.JWTAuth),\n\t\tTransfer: NewTransferEndpoint(s, a.JWTAuth),\n\t\tDefaultPhoto: NewDefaultPhotoEndpoint(s, a.JWTAuth),\n\t\tUpdate: NewUpdateEndpoint(s, a.JWTAuth),\n\t\tListMine: NewListMineEndpoint(s, a.JWTAuth),\n\t\tListProject: NewListProjectEndpoint(s, a.JWTAuth),\n\t\tListAssociated: NewListAssociatedEndpoint(s, a.JWTAuth),\n\t\tListProjectAssociated: NewListProjectAssociatedEndpoint(s, a.JWTAuth),\n\t\tDownloadPhoto: NewDownloadPhotoEndpoint(s, a.JWTAuth),\n\t\tListAll: NewListAllEndpoint(s, a.JWTAuth),\n\t\tDelete: NewDeleteEndpoint(s, a.JWTAuth),\n\t\tAdminSearch: NewAdminSearchEndpoint(s, a.JWTAuth),\n\t\tProgress: NewProgressEndpoint(s, a.JWTAuth),\n\t\tUpdateModule: NewUpdateModuleEndpoint(s, a.JWTAuth),\n\t}\n}", "title": "" }, { "docid": "362a752cbb9e02c7377f49102dbe6ccf", "score": "0.6013789", "text": "func NewEndpoints(oauthCfg *oauth2.Config, client *elastic.Client, a *ga.Client) *Endpoints {\n\treturn &Endpoints{\n\t\toauthCfg: oauthCfg,\n\t\tclient: client,\n\t\tanalytics: a,\n\t}\n}", "title": "" }, { "docid": "9ecfcd06fef3f77d501faa982bdd5fdb", "score": "0.5990215", "text": "func TestGetEndpoint(t *testing.T) {\n\texpectedResult := \"/api/v1/testroute\"\n\tif getEndpoint(\"testroute\") != expectedResult {\n\t\tt.Errorf(\"api endpoint naming logic has changed: %s != %s\", getEndpoint(\"testroute\"), expectedResult)\n\t}\n}", "title": "" }, { "docid": "8e053b1bfec1dc995e0f033da0d41781", "score": "0.59854174", "text": "func FakeEndpointsForURLs(\n\turls []*url.URL,\n\tnamespace,\n\tname string,\n) (*v1.Endpoints, error) {\n\taddrs := make([]v1.EndpointAddress, len(urls))\n\tports := make([]v1.EndpointPort, len(urls))\n\tfor i, u := range urls {\n\t\taddrs[i] = v1.EndpointAddress{\n\t\t\tHostname: u.Hostname(),\n\t\t\tIP: u.Hostname(),\n\t\t}\n\t\tportInt, err := strconv.Atoi(u.Port())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tports[i] = v1.EndpointPort{\n\t\t\tPort: int32(portInt),\n\t\t}\n\t}\n\treturn &v1.Endpoints{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: name,\n\t\t\tNamespace: namespace,\n\t\t},\n\t\tSubsets: []v1.EndpointSubset{\n\t\t\t{\n\t\t\t\tAddresses: addrs,\n\t\t\t\tPorts: ports,\n\t\t\t},\n\t\t},\n\t}, nil\n}", "title": "" }, { "docid": "ba6b97716134f874d59d56e2f040e3ec", "score": "0.59813756", "text": "func NewEndpoints(s Service) *Endpoints {\n\t// Casting service to Auther interface\n\ta := s.(Auther)\n\treturn &Endpoints{\n\t\tRegister: NewRegisterEndpoint(s),\n\t\tRegisterTaskState: NewRegisterTaskStateEndpoint(s),\n\t\tRegisterTask: NewRegisterTaskEndpoint(s),\n\t\tRegisterTasks: NewRegisterTasksEndpoint(s),\n\t\tUploadImage: NewUploadImageEndpoint(s),\n\t\tArtSearch: NewArtSearchEndpoint(s),\n\t\tArtworkGet: NewArtworkGetEndpoint(s),\n\t\tDownload: NewDownloadEndpoint(s, a.APIKeyAuth),\n\t}\n}", "title": "" }, { "docid": "da6fdb82804f285e637ce673fb4ef00a", "score": "0.59767497", "text": "func (mock *EndpointsGetterMock) EndpointsCalls() []struct {\n\tNamespace string\n} {\n\tvar calls []struct {\n\t\tNamespace string\n\t}\n\tlockEndpointsGetterMockEndpoints.RLock()\n\tcalls = mock.calls.Endpoints\n\tlockEndpointsGetterMockEndpoints.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "f041595de53caf08dfbd1cc546644081", "score": "0.59720963", "text": "func (h *WebHandler) getApplicationEndpoints(w http.ResponseWriter, r *http.Request, p httprouter.Params, context *HandlerContext) error {\n\tendpoints, err := context.Operator.GetApplicationEndpoints(siteKey(p))\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\troundtrip.ReplyJSON(w, http.StatusOK, endpoints)\n\treturn nil\n}", "title": "" }, { "docid": "d91b00ad8394f258aaf30a946f108ce5", "score": "0.5971235", "text": "func (_m *Client) Endpoints() (*models.Endpoints, error) {\n\tret := _m.Called()\n\n\tvar r0 *models.Endpoints\n\tif rf, ok := ret.Get(0).(func() *models.Endpoints); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*models.Endpoints)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func() error); ok {\n\t\tr1 = rf()\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "051a6566e93c88b1f5bacad2d8dc0f41", "score": "0.59449595", "text": "func ExamplePrivateEndpointConnectionsClient_Get() {\n\tcred, err := azidentity.NewDefaultAzureCredential(nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to obtain a credential: %v\", err)\n\t}\n\tctx := context.Background()\n\tclientFactory, err := armdatabricks.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tres, err := clientFactory.NewPrivateEndpointConnectionsClient().Get(ctx, \"myResourceGroup\", \"myWorkspace\", \"myWorkspace.23456789-1111-1111-1111-111111111111\", nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to finish the request: %v\", err)\n\t}\n\t// You could use response here. We use blank identifier for just demo purposes.\n\t_ = res\n\t// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.\n\t// res.PrivateEndpointConnection = armdatabricks.PrivateEndpointConnection{\n\t// \tName: to.Ptr(\"myWorkspace.23456789-1111-1111-1111-111111111111\"),\n\t// \tType: to.Ptr(\"Microsoft.Databricks/workspaces/PrivateEndpointConnections\"),\n\t// \tID: to.Ptr(\"/subscriptions/11111111-1111-1111-1111-111111111111/resourceGroups/myResourceGroup/providers/Microsoft.Databricks/workspaces/myWorkspace/PrivateEndpointConnections/myWorkspace.23456789-1111-1111-1111-111111111111\"),\n\t// \tProperties: &armdatabricks.PrivateEndpointConnectionProperties{\n\t// \t\tPrivateEndpoint: &armdatabricks.PrivateEndpoint{\n\t// \t\t\tID: to.Ptr(\"/subscriptions/11111111-1111-1111-1111-111111111111/resourceGroups/networkResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint\"),\n\t// \t\t},\n\t// \t\tPrivateLinkServiceConnectionState: &armdatabricks.PrivateLinkServiceConnectionState{\n\t// \t\t\tDescription: to.Ptr(\"Please approve my request!\"),\n\t// \t\t\tActionRequired: to.Ptr(\"None\"),\n\t// \t\t\tStatus: to.Ptr(armdatabricks.PrivateLinkServiceConnectionStatusPending),\n\t// \t\t},\n\t// \t\tProvisioningState: to.Ptr(armdatabricks.PrivateEndpointConnectionProvisioningStateSucceeded),\n\t// \t},\n\t// }\n}", "title": "" }, { "docid": "d6b5308b30fbdff739ee943cbe790aee", "score": "0.59433556", "text": "func GetAllEndpoints(provider *gophercloud.ProviderClient) ([]types.Endpoint, error) {\n\tendpointList := []types.Endpoint{}\n\n\tclient := openstack.NewIdentityV3(provider)\n\n\topts := endpoints.ListOpts{}\n\tpager := endpoints.List(client, opts)\n\tpage, err := pager.AllPages()\n\tif err != nil {\n\t\treturn endpointList, err\n\t}\n\n\tendpts, err := endpoints.ExtractEndpoints(page)\n\tif err != nil {\n\t\treturn endpointList, err\n\t}\n\n\tfor _, endpt := range endpts {\n\t\tendpointList = append(endpointList, types.Endpoint{\n\t\t\tID: endpt.ID,\n\t\t\tServiceID: endpt.ServiceID,\n\t\t\tURL: endpt.URL,\n\t\t\tRegion: endpt.Region,\n\t\t\t//Availability: endpt.Availability,\n\t\t\tName: endpt.Name,\n\t\t})\n\t}\n\n\treturn endpointList, nil\n}", "title": "" }, { "docid": "24f3c5d3409f5a6cfdae43e4fe245e55", "score": "0.5942585", "text": "func (f *Facade) GetServiceEndpoints(ctx datastore.Context, serviceId string) (map[string][]dao.ApplicationEndpoint, error) {\n\t// TODO: this function is obsolete. Remove it.\n\tresult := make(map[string][]dao.ApplicationEndpoint)\n\treturn result, fmt.Errorf(\"facade.GetServiceEndpoints is obsolete - do not use it\")\n}", "title": "" }, { "docid": "8d1da7ae0c7cca853be42cb2e39220d3", "score": "0.5930712", "text": "func (a *EndpointsApiService) EndpointInspect(ctx context.Context, id int32) (model.Endpoint, *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 model.Endpoint\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/endpoints/{id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{}\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 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\n\t\t}\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn 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\n\t\tif localVarHttpResponse.StatusCode == 200 {\n\t\t\tvar v model.Endpoint\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\n\t\tif localVarHttpResponse.StatusCode == 400 {\n\t\t\tvar v model.GenericError\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\n\t\tif localVarHttpResponse.StatusCode == 404 {\n\t\t\tvar v model.GenericError\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\n\t\tif localVarHttpResponse.StatusCode == 500 {\n\t\t\tvar v model.GenericError\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\n\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHttpResponse, nil\n}", "title": "" }, { "docid": "d9c0f653caa8a2e5686f63e11982e95b", "score": "0.5897238", "text": "func (sc *fakeSource) Endpoints(ctx context.Context) ([]*endpoint.Endpoint, error) {\n\tendpoints := make([]*endpoint.Endpoint, 10)\n\n\tfor i := 0; i < 10; i++ {\n\t\tendpoints[i], _ = sc.generateEndpoint()\n\t}\n\n\treturn endpoints, nil\n}", "title": "" }, { "docid": "84e16379529aaa45f70e73ef7dd76a3f", "score": "0.5892418", "text": "func NewAuthenEndpoints() []*api.Endpoint {\n\treturn []*api.Endpoint{}\n}", "title": "" }, { "docid": "a4537604f0b190f8972e60e2051d8fa6", "score": "0.5882273", "text": "func FakeEndpointsForURL(\n\tu *url.URL,\n\tnamespace,\n\tname string,\n\tnum int,\n) (*v1.Endpoints, error) {\n\turls := make([]*url.URL, num)\n\tfor i := 0; i < num; i++ {\n\t\turls[i] = u\n\t}\n\treturn FakeEndpointsForURLs(urls, namespace, name)\n}", "title": "" }, { "docid": "87e6acd1bc1daf038f18c1ca30f50774", "score": "0.5880238", "text": "func ExampleEndpointsClient_Get() {\n\tcred, err := azidentity.NewDefaultAzureCredential(nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to obtain a credential: %v\", err)\n\t}\n\tctx := context.Background()\n\tclient, err := armtrafficmanager.NewEndpointsClient(\"{subscription-id}\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tres, err := client.Get(ctx,\n\t\t\"azuresdkfornetautoresttrafficmanager2191\",\n\t\t\"azuresdkfornetautoresttrafficmanager8224\",\n\t\tarmtrafficmanager.EndpointTypeExternalEndpoints,\n\t\t\"My%20external%20endpoint\",\n\t\tnil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to finish the request: %v\", err)\n\t}\n\t// TODO: use response item\n\t_ = res\n}", "title": "" }, { "docid": "516bace15e5c4137fe3533a3a20bd98c", "score": "0.5874712", "text": "func ExampleFrontendEndpointsClient_Get() {\n\tcred, err := azidentity.NewDefaultAzureCredential(nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to obtain a credential: %v\", err)\n\t}\n\tctx := context.Background()\n\tclientFactory, err := armfrontdoor.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tres, err := clientFactory.NewFrontendEndpointsClient().Get(ctx, \"rg1\", \"frontDoor1\", \"frontendEndpoint1\", nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to finish the request: %v\", err)\n\t}\n\t// You could use response here. We use blank identifier for just demo purposes.\n\t_ = res\n\t// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.\n\t// res.FrontendEndpoint = armfrontdoor.FrontendEndpoint{\n\t// \tID: to.Ptr(\"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/frontDoors/frontDoor1/frontendEndpoints/frontendEndpoint1\"),\n\t// \tName: to.Ptr(\"frontendEndpoint1\"),\n\t// \tProperties: &armfrontdoor.FrontendEndpointProperties{\n\t// \t\tHostName: to.Ptr(\"www.contoso.com\"),\n\t// \t\tSessionAffinityEnabledState: to.Ptr(armfrontdoor.SessionAffinityEnabledStateEnabled),\n\t// \t\tSessionAffinityTTLSeconds: to.Ptr[int32](60),\n\t// \t\tWebApplicationFirewallPolicyLink: &armfrontdoor.FrontendEndpointUpdateParametersWebApplicationFirewallPolicyLink{\n\t// \t\t\tID: to.Ptr(\"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/frontDoorWebApplicationFirewallPolicies/policy1\"),\n\t// \t\t},\n\t// \t},\n\t// }\n}", "title": "" }, { "docid": "70286df1f08fbfa61c27bb3894794fb9", "score": "0.58744633", "text": "func MakeEndpoints(s account.Service) Endpoints {\n\treturn Endpoints{\n\t\tCreateCustomer: makeCreateCustomerEndpoint(s),\n\t\t//AddMoneyToWallet: makeAddMoneyToWalletEndpoint(s),\n\t\t//GetWalletBalance: makeGetWalletBalanceEndpoint(s),\n\t\t//MakePayment: makeMakePaymentEndpoint(s),\n\t}\n}", "title": "" }, { "docid": "46da54ce9232f09cf235cba580717bfa", "score": "0.5867609", "text": "func NewEndpoints(s Service) *Endpoints {\n\t// Casting service to Auther interface\n\ta := s.(Auther)\n\treturn &Endpoints{\n\t\tHealthCheck: NewHealthCheckEndpoint(s, a.BasicAuth),\n\t}\n}", "title": "" }, { "docid": "0a687a4135b7c5ff0b6170470deb01f1", "score": "0.5851822", "text": "func NewEndpoints(s Service) *Endpoints {\n\treturn &Endpoints{\n\t\tAssetPairs: NewAssetPairsEndpoint(s),\n\t\tOrders: NewOrdersEndpoint(s),\n\t\tOrderByHash: NewOrderByHashEndpoint(s),\n\t\tOrderbook: NewOrderbookEndpoint(s),\n\t\tOrderConfig: NewOrderConfigEndpoint(s),\n\t\tFeeRecipients: NewFeeRecipientsEndpoint(s),\n\t\tPostOrder: NewPostOrderEndpoint(s),\n\t}\n}", "title": "" }, { "docid": "8700043a3eb236a9ae38e39a6fcbe3a2", "score": "0.5850965", "text": "func TestHandleEndpoints(t *testing.T) {\n\ttestCases := []struct {\n\t\tname string //human readable name for test case\n\t\teventType watch.EventType //type to be passed to the HandleEndpoints method\n\t\tendpoints *kapi.Endpoints //endpoints to be passed to the HandleEndpoints method\n\t\texpectedServiceUnit *ServiceUnit //service unit that will be compared against.\n\t\texcludeUDP bool\n\t}{\n\t\t{\n\t\t\tname: \"Endpoint add\",\n\t\t\teventType: watch.Added,\n\t\t\tendpoints: &kapi.Endpoints{\n\t\t\t\tObjectMeta: kapi.ObjectMeta{\n\t\t\t\t\tNamespace: \"foo\",\n\t\t\t\t\tName: \"test\", //kapi.endpoints inherits the name of the service\n\t\t\t\t},\n\t\t\t\tSubsets: []kapi.EndpointSubset{{\n\t\t\t\t\tAddresses: []kapi.EndpointAddress{{IP: \"1.1.1.1\"}},\n\t\t\t\t\tPorts: []kapi.EndpointPort{{Port: 345}},\n\t\t\t\t}}, //not specifying a port to force the port 80 assumption\n\t\t\t},\n\t\t\texpectedServiceUnit: &ServiceUnit{\n\t\t\t\tName: \"foo/test\", //service name from kapi.endpoints object\n\t\t\t\tEndpointTable: []Endpoint{\n\t\t\t\t\t{\n\t\t\t\t\t\tID: \"1.1.1.1:345\",\n\t\t\t\t\t\tIP: \"1.1.1.1\",\n\t\t\t\t\t\tPort: \"345\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"Endpoint mod\",\n\t\t\teventType: watch.Modified,\n\t\t\tendpoints: &kapi.Endpoints{\n\t\t\t\tObjectMeta: kapi.ObjectMeta{\n\t\t\t\t\tNamespace: \"foo\",\n\t\t\t\t\tName: \"test\",\n\t\t\t\t},\n\t\t\t\tSubsets: []kapi.EndpointSubset{{\n\t\t\t\t\tAddresses: []kapi.EndpointAddress{{IP: \"2.2.2.2\"}},\n\t\t\t\t\tPorts: []kapi.EndpointPort{{Port: 8080}},\n\t\t\t\t}},\n\t\t\t},\n\t\t\texpectedServiceUnit: &ServiceUnit{\n\t\t\t\tName: \"foo/test\",\n\t\t\t\tEndpointTable: []Endpoint{\n\t\t\t\t\t{\n\t\t\t\t\t\tID: \"2.2.2.2:8080\",\n\t\t\t\t\t\tIP: \"2.2.2.2\",\n\t\t\t\t\t\tPort: \"8080\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"Endpoint delete\",\n\t\t\teventType: watch.Deleted,\n\t\t\tendpoints: &kapi.Endpoints{\n\t\t\t\tObjectMeta: kapi.ObjectMeta{\n\t\t\t\t\tNamespace: \"foo\",\n\t\t\t\t\tName: \"test\",\n\t\t\t\t},\n\t\t\t\tSubsets: []kapi.EndpointSubset{{\n\t\t\t\t\tAddresses: []kapi.EndpointAddress{{IP: \"3.3.3.3\"}},\n\t\t\t\t\tPorts: []kapi.EndpointPort{{Port: 0}},\n\t\t\t\t}},\n\t\t\t},\n\t\t\texpectedServiceUnit: &ServiceUnit{\n\t\t\t\tName: \"foo/test\",\n\t\t\t\tEndpointTable: []Endpoint{},\n\t\t\t},\n\t\t},\n\t}\n\n\trouter := newTestRouter(make(map[string]ServiceUnit))\n\ttemplatePlugin := newDefaultTemplatePlugin(router, true)\n\t// TODO: move tests that rely on unique hosts to pkg/router/controller and remove them from\n\t// here\n\tplugin := controller.NewUniqueHost(templatePlugin, controller.HostForRoute, controller.LogRejections)\n\n\tfor _, tc := range testCases {\n\t\tplugin.HandleEndpoints(tc.eventType, tc.endpoints)\n\n\t\tif !router.Committed {\n\t\t\tt.Errorf(\"Expected router to be committed after HandleEndpoints call\")\n\t\t}\n\n\t\tsu, ok := router.FindServiceUnit(tc.expectedServiceUnit.Name)\n\n\t\tif !ok {\n\t\t\tt.Errorf(\"TestHandleEndpoints test case %s failed. Couldn't find expected service unit with name %s\", tc.name, tc.expectedServiceUnit.Name)\n\t\t} else {\n\t\t\tfor expectedKey, expectedEp := range tc.expectedServiceUnit.EndpointTable {\n\t\t\t\tactualEp := su.EndpointTable[expectedKey]\n\n\t\t\t\tif expectedEp.ID != actualEp.ID || expectedEp.IP != actualEp.IP || expectedEp.Port != actualEp.Port {\n\t\t\t\t\tt.Errorf(\"TestHandleEndpoints test case %s failed. Expected endpoint didn't match actual endpoint %v : %v\", tc.name, expectedEp, actualEp)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0093a1f5bbabc39753819ef9882d72d2", "score": "0.5850823", "text": "func NewEndpoints(s Service) *Endpoints {\n\t// Casting service to Auther interface\n\ta := s.(Auther)\n\treturn &Endpoints{\n\t\tFive: NewFiveEndpoint(s),\n\t\tRefreshDevice: NewRefreshDeviceEndpoint(s, a.JWTAuth),\n\t}\n}", "title": "" }, { "docid": "aa7e87a6f95a24462b5efbebcf924f55", "score": "0.5845911", "text": "func (r MockAPIRequest) Get(endpoint string) (*http.Response, error) {\n\treturn r.response()\n}", "title": "" }, { "docid": "eb4a64268d9da158575264e5d32a8b1c", "score": "0.5838912", "text": "func (a *Api) apiEndpoint() []endpoint {\n\treturn a.endpoints\n}", "title": "" }, { "docid": "8b0b1e7d2d32590414e7b41ef7034e3d", "score": "0.5836132", "text": "func (m *MockApiClient) Get(ctx context.Context, url string, hostconfig client.HostConfig, expectedResp interface{}) (interface{}, error) {\n\targs := m.Called()\n\tresp, _ := args.Get(0).(interface{})\n\terr, _ := args.Get(1).(error)\n\treturn resp, err\n}", "title": "" }, { "docid": "942d291199bedaa6f7e3fd4c6ebc848a", "score": "0.5829379", "text": "func (_m *ObjectCacheInterface) GetEndpointSlices(namespace string, svcName string) ([]*discoveryv1.EndpointSlice, error) {\n\tret := _m.Called(namespace, svcName)\n\n\tvar r0 []*discoveryv1.EndpointSlice\n\tif rf, ok := ret.Get(0).(func(string, string) []*discoveryv1.EndpointSlice); ok {\n\t\tr0 = rf(namespace, svcName)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).([]*discoveryv1.EndpointSlice)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(string, string) error); ok {\n\t\tr1 = rf(namespace, svcName)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "142769b9af72ac287618a506e50242f1", "score": "0.5821663", "text": "func MakeEndpoints(s Service) Endpoints {\n\treturn Endpoints{\n\t\tRegisterEndpoint: MakeRegisterEndpoint(s),\n\t\tLoginEndpoint: MakeLoginEndpoint(s),\n\t\tResetPasswordEndpoint: MakeResetPasswordEndpoint(s),\n\t\tChangePasswordEndpoint: MakeChangePasswordEndpoint(s),\n\t\tListEndpoint: MakeListEndpoint(s),\n\t}\n}", "title": "" }, { "docid": "4f30e74a42ca9c449349e9d35ae81765", "score": "0.58089894", "text": "func (s k8sStore) GetServiceEndpoints(key string) (*corev1.Endpoints, error) {\n\treturn s.listers.Endpoint.ByKey(key)\n}", "title": "" }, { "docid": "cc6501c144f6bb3baff3bf40e77645e5", "score": "0.5803843", "text": "func TestEndpointList(t *testing.T) {\n\t// create network state manager\n\tstateMgr, err := newStatemgr()\n\tdefer stateMgr.Stop()\n\tif err != nil {\n\t\tt.Fatalf(\"Could not create network manager. Err: %v\", err)\n\t\treturn\n\t}\n\t// create tenant\n\terr = createTenant(t, stateMgr, \"default\")\n\tAssertOk(t, err, \"Error creating the tenant\")\n\n\t// create a network\n\terr = createNetwork(t, stateMgr, \"default\", \"default\", \"10.1.1.0/24\", \"10.1.1.254\", 11)\n\tAssertOk(t, err, \"Error creating the network\")\n\n\tAssertEventually(t, func() (bool, interface{}) {\n\t\t_, err := stateMgr.FindNetwork(\"default\", \"default\")\n\t\tif err == nil {\n\t\t\treturn true, nil\n\t\t}\n\t\treturn false, nil\n\t}, \"Network not found\", \"1ms\", \"1s\")\n\n\t// endpoint params\n\tepinfo := ctkit.Endpoint{\n\t\tEndpoint: workload.Endpoint{\n\t\t\tTypeMeta: api.TypeMeta{Kind: \"Endpoint\"},\n\t\t\tObjectMeta: api.ObjectMeta{\n\t\t\t\tName: \"testEndpoint\",\n\t\t\t\tNamespace: \"default\",\n\t\t\t\tTenant: \"default\",\n\t\t\t},\n\t\t\tSpec: workload.EndpointSpec{},\n\t\t\tStatus: workload.EndpointStatus{\n\t\t\t\tWorkloadName: \"testContainerName\",\n\t\t\t\tNetwork: \"default\",\n\t\t\t\tHomingHostAddr: \"192.168.1.1\",\n\t\t\t\tHomingHostName: \"testHost\",\n\t\t\t},\n\t\t},\n\t}\n\n\t// create endpoint\n\terr = stateMgr.OnEndpointCreate(&epinfo)\n\tAssert(t, (err == nil), \"Error creating the endpoint\", &epinfo)\n\n\t// verify the list works\n\tnets, err := stateMgr.ListNetworks()\n\tAssertOk(t, err, \"Error listing networks\")\n\tAssert(t, (len(nets) == 1), \"Incorrect number of networks received\", nets)\n\tfor _, nt := range nets {\n\t\tendps := nt.ListEndpoints()\n\t\tAssert(t, (len(endps) == 1), \"Invalid number of endpoints received\", endps)\n\t\tAssert(t, (endps[0].Endpoint.Name == epinfo.Endpoint.Name), \"Invalid endpoint params received\", endps[0])\n\t}\n\n}", "title": "" }, { "docid": "004ac5d1c2993ebb2d7c4200ac7b2bc5", "score": "0.57971627", "text": "func MakeEndpoints(s Service) Endpoints {\n\treturn Endpoints{\n\t\tPlaceOrderEndpoint: MakePlaceOrderEndpoint(s),\n\t\tGetUserOrdersEndpoint: MakeGetUserOdersEndpoint(s),\n\t\tCancelOrderEndpoint: MakeCancelOrderEndpoint(s),\n\t}\n}", "title": "" }, { "docid": "40139c2bfaba8340c47410b0524cf834", "score": "0.5796534", "text": "func MakeGetEndpoint(s service.UsersService) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq := request.(GetRequest)\n\t\ts0, s1, s2, e1 := s.Get(ctx, req.Id)\n\t\treturn GetResponse{\n\t\t\tE1: e1,\n\t\t\tS0: s0,\n\t\t\tS1: s1,\n\t\t\tS2: s2,\n\t\t}, nil\n\t}\n}", "title": "" }, { "docid": "3695b2a5714cf96394cdcf7b34eea096", "score": "0.5793798", "text": "func EndpointsAll() *Endpoints {\n\tif cachedData != nil {\n\t\treturn cachedData.endpoints\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7111d103a734435fdc4e525f01baa2df", "score": "0.57800156", "text": "func NewEndpoints(s Service) *Endpoints {\n\t// Casting service to Auther interface\n\ta := s.(Auther)\n\treturn &Endpoints{\n\t\tRefreshAccessToken: NewRefreshAccessTokenEndpoint(s, a.JWTAuth),\n\t\tNewRefreshToken: NewNewRefreshTokenEndpoint(s, a.JWTAuth),\n\t\tInfo: NewInfoEndpoint(s, a.JWTAuth),\n\t}\n}", "title": "" }, { "docid": "74dcf51e4b687dd9267fee7cd252fe65", "score": "0.57763475", "text": "func mustGetEndpoint(g *gomega.WithT, objs *objectSet, endpointName string) *object.K8sObject {\n\tobj := objs.kind(name2.EndpointStr).nameEquals(endpointName)\n\tg.Expect(obj).Should(gomega.Not(gomega.BeNil()))\n\treturn obj\n}", "title": "" }, { "docid": "3fc05c38bcf462226e591a29d565113d", "score": "0.57689184", "text": "func testClusterEndpoints(f *framework.Framework, cluster *api.MysqlCluster, master []int, nodes []int) {\n\tExpect(f.Client.Get(context.TODO(),\n\t\ttypes.NamespacedName{Name: cluster.Name, Namespace: cluster.Namespace},\n\t\tcluster)).To(Succeed())\n\n\t// prepare the expected list of ips that should be set in endpoints\n\tvar masterIPs []string\n\tvar healthyIPs []string\n\n\tfor _, node := range master {\n\t\tpod := f.GetPodForNode(cluster, node)\n\t\tmasterIPs = append(masterIPs, pod.Status.PodIP)\n\t}\n\n\tfor _, node := range nodes {\n\t\tpod := f.GetPodForNode(cluster, node)\n\t\thealthyIPs = append(healthyIPs, pod.Status.PodIP)\n\t}\n\n\t// a helper function that return a callback that returns ips for a specific service\n\tgetAddrForSVC := func(name string, ready bool) func() []string {\n\t\treturn func() []string {\n\t\t\tendpoints, err := f.ClientSet.CoreV1().Endpoints(cluster.Namespace).Get(name, meta.GetOptions{})\n\t\t\tif err != nil {\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\taddrs := endpoints.Subsets[0].NotReadyAddresses\n\t\t\tif ready {\n\t\t\t\taddrs = endpoints.Subsets[0].Addresses\n\t\t\t}\n\n\t\t\tvar ips []string\n\t\t\tfor _, addr := range addrs {\n\t\t\t\tips = append(ips, addr.IP)\n\t\t\t}\n\n\t\t\treturn ips\n\t\t}\n\t}\n\n\ttimeout := 30 * time.Second\n\n\t// master service\n\tmaster_ep := framework.GetNameForResource(\"svc-master\", cluster)\n\tif len(masterIPs) > 0 {\n\t\tEventually(getAddrForSVC(master_ep, true), timeout).Should(ConsistOf(masterIPs), \"Master ready endpoints are not correctly set.\")\n\t} else {\n\t\tEventually(getAddrForSVC(master_ep, true), timeout).Should(HaveLen(0), \"Master ready endpoints should be 0.\")\n\t}\n\n\t// healthy nodes service\n\thnodes_ep := framework.GetNameForResource(\"svc-read\", cluster)\n\tif len(healthyIPs) > 0 {\n\t\tEventually(getAddrForSVC(hnodes_ep, true), timeout).Should(ConsistOf(healthyIPs), \"Healthy nodes ready endpoints are not correctly set.\")\n\t} else {\n\t\tEventually(getAddrForSVC(hnodes_ep, true), timeout).Should(HaveLen(0), \"Healthy nodes not ready endpoints are not correctly set.\")\n\t}\n}", "title": "" }, { "docid": "eee4879bf31b3160b30a8eeee24a8d37", "score": "0.57671636", "text": "func (p *Provider) loadAPIEndpoints(router router.Router, handlers ...router.Constructor) {\n\tlog.Debug(\"Loading API Endpoints\")\n\n\t// Apis endpoints\n\thandler := api.NewController(p.APIRepo, p.Notifier)\n\tgroup := router.Group(\"/apis\")\n\tgroup.Use(handlers...)\n\t{\n\t\tgroup.GET(\"/\", handler.Get())\n\t\tgroup.GET(\"/{name}\", handler.GetBy())\n\n\t\tif false == p.ReadOnly {\n\t\t\tgroup.POST(\"/\", handler.Post())\n\t\t\tgroup.PUT(\"/{name}\", handler.PutBy())\n\t\t\tgroup.DELETE(\"/{name}\", handler.DeleteBy())\n\t\t}\n\t}\n}", "title": "" }, { "docid": "fa01cfb6721afa68470536c2415566d9", "score": "0.5762657", "text": "func NewHelloworldEndpoints() []*api.Endpoint {\n\treturn []*api.Endpoint{}\n}", "title": "" }, { "docid": "0fe9d55602c43b25d1c2741d3520d0cf", "score": "0.57564", "text": "func (m *MockCoreV1Interface) Endpoints(arg0 string) v13.EndpointsInterface {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Endpoints\", arg0)\n\tret0, _ := ret[0].(v13.EndpointsInterface)\n\treturn ret0\n}", "title": "" }, { "docid": "5b8b0589687b3e1c850581cc636dcae7", "score": "0.57549995", "text": "func NewEndpoints(s Service) *Endpoints {\n\t// Casting service to Auther interface\n\ta := s.(Auther)\n\treturn &Endpoints{\n\t\tBatchAvailabilityLookup: NewBatchAvailabilityLookupEndpoint(s, a.BasicAuth),\n\t\tCheckAvailability: NewCheckAvailabilityEndpoint(s, a.BasicAuth),\n\t\tCreateBooking: NewCreateBookingEndpoint(s, a.BasicAuth),\n\t\tUpdateBooking: NewUpdateBookingEndpoint(s, a.BasicAuth),\n\t\tGetBookingStatus: NewGetBookingStatusEndpoint(s, a.BasicAuth),\n\t\tListBookings: NewListBookingsEndpoint(s, a.BasicAuth),\n\t}\n}", "title": "" }, { "docid": "a8d508b0eb74b59126e67cf76de75867", "score": "0.5742863", "text": "func NewEndpoints(db *db.DB) *Endpoints {\n\treturn &Endpoints{\n\t\tdb: db,\n\t}\n}", "title": "" }, { "docid": "a71f1b2ca402c8741ebb2464b81cf89b", "score": "0.5740471", "text": "func NewEndpoints(s Service) *Endpoints {\n\treturn &Endpoints{\n\t\tShow: NewShowEndpoint(s),\n\t}\n}", "title": "" }, { "docid": "31c8a03d4cf6b09a0cda677bc744fbc2", "score": "0.5736888", "text": "func NewEndpoints(s Service) *Endpoints {\n\t// Casting service to Auther interface\n\ta := s.(Auther)\n\treturn &Endpoints{\n\t\tUpdate: NewUpdateEndpoint(s, a.JWTAuth),\n\t\tGet: NewGetEndpoint(s, a.JWTAuth),\n\t\tDownloadMedia: NewDownloadMediaEndpoint(s, a.JWTAuth),\n\t\tUploadMedia: NewUploadMediaEndpoint(s, a.JWTAuth),\n\t\tDeleteMedia: NewDeleteMediaEndpoint(s, a.JWTAuth),\n\t}\n}", "title": "" }, { "docid": "8ee728a91641dc85993344a21e9964a0", "score": "0.57343096", "text": "func MakeEndpoints(s Service) Endpoints {\n\treturn Endpoints{\n\t\tCreateAccount: makeCreateAccountEndpoint(s),\n\t\tGetAccount: makeGetAccountEndpoint(s),\n\t\tCreatePayment: makeCreatePaymentEndpoint(s),\n\t\tGetPayment: makeGetPaymentEndpoint(s),\n\t}\n}", "title": "" }, { "docid": "13801d37d2325ee1de3aa8e4b93e7e45", "score": "0.5733654", "text": "func TestAddEndpoints(t *testing.T) {\n\trouter := NewFakeTemplateRouter()\n\tsuKey := ServiceUnitKey(\"nsl/test\")\n\trouter.CreateServiceUnit(suKey)\n\n\tif _, ok := router.FindServiceUnit(suKey); !ok {\n\t\tt.Errorf(\"Unable to find serivce unit %s after creation\", suKey)\n\t}\n\n\t// Adding endpoints without an associated route will not\n\t// result in a state change so create the associated route.\n\trouter.AddRoute(&routev1.Route{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tNamespace: \"nsl\",\n\t\t\tName: \"edge\",\n\t\t},\n\t\tSpec: routev1.RouteSpec{\n\t\t\tHost: \"edge-nsl.foo.com\",\n\t\t\tTo: routev1.RouteTargetReference{\n\t\t\t\tKind: \"Service\",\n\t\t\t\tName: \"test\",\n\t\t\t},\n\t\t},\n\t})\n\n\tendpoint := Endpoint{\n\t\tID: \"ep1\",\n\t\tIP: \"ip\",\n\t\tPort: \"port\",\n\t\tIdHash: fmt.Sprintf(\"%x\", md5.Sum([]byte(\"ep1ipport\"))),\n\t}\n\n\trouter.AddEndpoints(suKey, []Endpoint{endpoint})\n\n\tif !router.stateChanged {\n\t\tt.Errorf(\"Expected router stateChanged to be true\")\n\t}\n\n\tsu, ok := router.FindServiceUnit(suKey)\n\n\tif !ok {\n\t\tt.Errorf(\"Unable to find created service unit %s\", suKey)\n\t} else {\n\t\tif len(su.EndpointTable) != 1 {\n\t\t\tt.Errorf(\"Expected endpoint table to contain 1 entry\")\n\t\t} else {\n\t\t\tactualEp := su.EndpointTable[0]\n\t\t\tif endpoint.IP != actualEp.IP || endpoint.Port != actualEp.Port || endpoint.IdHash != actualEp.IdHash {\n\t\t\t\tt.Errorf(\"Expected endpoint %v did not match actual endpoint %v\", endpoint, actualEp)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "05a53e49b3ed624964523a050fe13a2c", "score": "0.5733252", "text": "func makeGetProductsEndPoint(s Service) endpoint.Endpoint {\n\t//Convertir el tipo \"request\" al tipo getProductsRequest\n\tgetProductsEndPoint := func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\treq := request.(getProductsRequest)\n\t\tresult, err := s.GetProducts(&req)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\treturn result, nil\n\t}\n\treturn getProductsEndPoint\n}", "title": "" }, { "docid": "6d08cf8e5634bb1b34b21e5396257289", "score": "0.5715071", "text": "func (en Endpoints) Get(ctx context.Context) (e []io.Employee, error error) {\n\trequest := GetRequest{}\n\tresponse, err := en.GetEndpoint(ctx, request)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn response.(GetResponse).E, response.(GetResponse).Error\n}", "title": "" }, { "docid": "30abe8572c9df2181b8c400a9af93889", "score": "0.5714266", "text": "func NewEndpoints(s Service) *Endpoints {\n\t// Casting service to Auther interface\n\ta := s.(Auther)\n\treturn &Endpoints{\n\t\tHealth: NewHealthEndpoint(s),\n\t\tDeposit: NewDepositEndpoint(s, a.JWTAuth),\n\t\tWithdraw: NewWithdrawEndpoint(s, a.JWTAuth),\n\t\tTransfer: NewTransferEndpoint(s, a.JWTAuth),\n\t\tBalance: NewBalanceEndpoint(s, a.JWTAuth),\n\t\tAdminWallets: NewAdminWalletsEndpoint(s, a.JWTAuth),\n\t}\n}", "title": "" }, { "docid": "5529d058fbdb2cd08c0a0b764163acee", "score": "0.57141495", "text": "func MakeGetEndpoint(s service.RhService) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\te, error := s.Get(ctx)\n\t\treturn GetResponse{\n\t\t\tE: e,\n\t\t\tError: error,\n\t\t}, nil\n\t}\n}", "title": "" }, { "docid": "719dbe0ee54a4f8fe6c42bc7b6499735", "score": "0.570999", "text": "func NewEndpoints(s Service) *Endpoints {\n\treturn &Endpoints{\n\t\tList: NewListEndpoint(s),\n\t\tShow: NewShowEndpoint(s),\n\t\tProcessing: NewProcessingEndpoint(s),\n\t}\n}", "title": "" }, { "docid": "d6c80a3d44767f8e8a097805a62519ec", "score": "0.5708042", "text": "func NewEndpoints(s Service) *Endpoints {\n\t// Casting service to Auther interface\n\ta := s.(Auther)\n\treturn &Endpoints{\n\t\tSignin: NewSigninEndpoint(s, a.BasicAuth),\n\t}\n}", "title": "" }, { "docid": "7a5a2dd91b7efde19af23dcbde74508d", "score": "0.5697321", "text": "func NewEndpoints(s Service) *Endpoints {\n\treturn &Endpoints{\n\t\tWaitLineOverview: NewWaitLineOverviewEndpoint(s),\n\t}\n}", "title": "" }, { "docid": "dea6ac6fba6efeef0ee2180716fd2940", "score": "0.5694955", "text": "func Endpoints() []Endpoint {\n\tendpoints := []Endpoint{}\n\tfor _, endpoint := range registeredEndpoints {\n\t\tendpoints = append(endpoints, endpoint)\n\t}\n\treturn endpoints\n}", "title": "" }, { "docid": "fc6f43790b5be589a5badd0dd6732bd1", "score": "0.5691815", "text": "func initEndpointsV1(router *mux.Router) {\n\tapiV1 := router.PathPrefix(\"/api/v1\").Subrouter()\n\n\t// Setup the API endpoint\n\tapiV1.HandleFunc(\"/tasks\", GetTasks).Methods(\"GET\")\n\n}", "title": "" }, { "docid": "3ec14261ab75f51cbd8292c721b4cf07", "score": "0.5691002", "text": "func (appMgr *Manager) getEndpoints(selector, namespace string) ([]Member, error) {\n\tvar members []Member\n\tuniqueMembersMap := make(map[Member]struct{})\n\n\tappInf, _ := appMgr.getNamespaceInformer(namespace)\n\n\tvar svcItems []v1.Service\n\n\tif appMgr.hubMode {\n\t\t// Leaving the old way for hubMode for now.\n\t\tsvcListOptions := metav1.ListOptions{\n\t\t\tLabelSelector: selector,\n\t\t}\n\n\t\tvar err error\n\t\t// Identify services that matches the given label\n\t\tvar services *v1.ServiceList\n\n\t\tservices, err = appMgr.kubeClient.CoreV1().Services(v1.NamespaceAll).List(context.TODO(), svcListOptions)\n\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"[CORE] Error getting service list. %v\", err)\n\t\t\treturn nil, err\n\t\t}\n\t\tsvcItems = services.Items\n\t} else {\n\t\tsvcInformer := appInf.svcInformer\n\t\tsvcLister := listerscorev1.NewServiceLister(svcInformer.GetIndexer())\n\t\tls, _ := createLabel(selector)\n\t\tsvcListed, _ := svcLister.Services(namespace).List(ls)\n\n\t\tfor n, _ := range svcListed {\n\t\t\tsvcItems = append(svcItems, *svcListed[n])\n\t\t}\n\n\t}\n\n\tif len(svcItems) > 1 {\n\t\tsvcName := \"\"\n\t\tsort.Sort(byTimestamp(svcItems))\n\t\t//picking up the oldest service\n\t\tsvcItems = svcItems[:1]\n\n\t\tfor _, service := range svcItems {\n\t\t\tsvcName += fmt.Sprintf(\"Service: %v, Namespace: %v,Timestamp: %v\\n\", service.Name, service.Namespace, service.GetCreationTimestamp())\n\t\t}\n\n\t\tlog.Warningf(\"[CORE] Multiple Services are tagged for this pool. Using oldest service endpoints.\\n%v\", svcName)\n\t}\n\n\tfor _, service := range svcItems {\n\t\tif appMgr.isNodePort == false && appMgr.poolMemberType != NodePortLocal { // Controller is in ClusterIP Mode\n\t\t\tsvcKey := service.Namespace + \"/\" + service.Name\n\n\t\t\titem, found, _ := appInf.endptInformer.GetStore().GetByKey(svcKey)\n\t\t\tvar eps *v1.Endpoints\n\t\t\tif !found {\n\t\t\t\tif !appMgr.hubMode {\n\t\t\t\t\tmsg := \"Endpoints for service \" + svcKey + \" not found!\"\n\t\t\t\t\tlog.Debug(msg)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tendpointsList, err := appMgr.kubeClient.CoreV1().Endpoints(service.Namespace).List(context.TODO(),\n\t\t\t\t\tmetav1.ListOptions{\n\t\t\t\t\t\tFieldSelector: \"metadata.name=\" + service.Name,\n\t\t\t\t\t},\n\t\t\t\t)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Debugf(\"[CORE] Error getting endpoints for service %v\", service.Name)\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tif len(endpointsList.Items) == 0 {\n\t\t\t\t\tlog.Debugf(\"[CORE] Endpoints for service %v not found\", service.Name)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\teps = &endpointsList.Items[0]\n\t\t\t} else {\n\t\t\t\teps, _ = item.(*v1.Endpoints)\n\t\t\t}\n\t\t\tfor _, subset := range eps.Subsets {\n\t\t\t\tfor _, port := range subset.Ports {\n\t\t\t\t\tfor _, addr := range subset.Addresses {\n\t\t\t\t\t\tmember := Member{\n\t\t\t\t\t\t\tAddress: addr.IP,\n\t\t\t\t\t\t\tPort: port.Port,\n\t\t\t\t\t\t\tSvcPort: port.Port,\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif _, ok := uniqueMembersMap[member]; !ok {\n\t\t\t\t\t\t\tuniqueMembersMap[member] = struct{}{}\n\t\t\t\t\t\t\tmembers = append(members, member)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else if appMgr.poolMemberType == NodePortLocal { // Controller is in NodePortLocal Mode\n\t\t\tpods, err := appMgr.GetPodsForService(service.Namespace, service.Name)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tif pods != nil {\n\t\t\t\tfor _, portSpec := range service.Spec.Ports {\n\t\t\t\t\tpodPort := portSpec.TargetPort\n\t\t\t\t\tfor _, newMember := range appMgr.getEndpointsForNPL(podPort, pods) {\n\t\t\t\t\t\tif _, ok := uniqueMembersMap[newMember]; !ok {\n\t\t\t\t\t\t\tuniqueMembersMap[newMember] = struct{}{}\n\t\t\t\t\t\t\tmembers = append(members, newMember)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else { // Controller is in NodePort mode.\n\t\t\tif service.Spec.Type == v1.ServiceTypeNodePort {\n\t\t\t\tfor _, port := range service.Spec.Ports {\n\t\t\t\t\tendpointMembers := appMgr.getEndpointsForNodePort(port.NodePort, port.Port)\n\t\t\t\t\tfor _, newMember := range endpointMembers {\n\t\t\t\t\t\tif _, ok := uniqueMembersMap[newMember]; !ok {\n\t\t\t\t\t\t\tuniqueMembersMap[newMember] = struct{}{}\n\t\t\t\t\t\t\tmembers = append(members, newMember)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} /* else {\n\t\t\t\tmsg := fmt.Sprintf(\"[CORE] Requested service backend '%+v' not of NodePort type\", service.Name)\n\t\t\t\tlog.Debug(msg)\n\t\t\t}*/\n\t\t}\n\t}\n\treturn members, nil\n}", "title": "" }, { "docid": "48e1bbfd37e18815e55c87a2de8031d0", "score": "0.56882197", "text": "func getEndpointsFromEnv(t *testing.T) []string {\n\teps := strings.Split(os.Getenv(\"TEST_ENDPOINTS\"), \",\")\n\tif len(eps) == 0 {\n\t\tt.Fatal(\"No endpoints found in environment variable TEST_ENDPOINTS\")\n\t}\n\treturn eps\n}", "title": "" }, { "docid": "d26db4f231d0be215ef8f79159a08fb2", "score": "0.5683845", "text": "func NewEndpoints(s Service) *Endpoints {\n\t// Casting service to Auther interface\n\ta := s.(Auther)\n\treturn &Endpoints{\n\t\tAdd: NewAddEndpoint(s),\n\t\tMultiply: NewMultiplyEndpoint(s, a.JWTAuth),\n\t\tDevide: NewDevideEndpoint(s, a.JWTAuth),\n\t}\n}", "title": "" }, { "docid": "8fc1f814850ff3ad22556171f20e03ec", "score": "0.56742835", "text": "func NewEndpoints(s Service) *Endpoints {\n\treturn &Endpoints{\n\t\tVersion: NewVersionEndpoint(s),\n\t}\n}", "title": "" }, { "docid": "e23c73cbc66da425c971f7f9bd3d1b88", "score": "0.56664836", "text": "func (c *Client) get(endpoint string) ([]byte, error) {\n\treq, err := http.NewRequest(\"GET\", apiURL+endpoint, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn c.doReqWithAuth(req)\n}", "title": "" }, { "docid": "9e764ab2f9ae84deeae91a27721c9c45", "score": "0.5664505", "text": "func MakeGetFromAllEndpoint(s service.CartsService) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\tallRecordResp, err := s.GetFromAll(ctx)\n\t\treturn GetFromAllResponse{\n\t\t\tAllRecordResp: allRecordResp,\n\t\t\tErr: err,\n\t\t}, nil\n\t}\n}", "title": "" } ]
c5aef39c393f3364bbd010d10d067734
New returns an instance of Storage.
[ { "docid": "0b174a7cb4122eb1ed0c0930b084d4d8", "score": "0.8407311", "text": "func New() *Storage {\n\treturn &Storage{\n\t\tdata: make(map[string]map[string]interface{}),\n\t\tmux: sync.RWMutex{},\n\t}\n}", "title": "" } ]
[ { "docid": "392c1b46c0e31c0b7c45ccf8b9ec8fd3", "score": "0.8430305", "text": "func New(config *config.ConfYaml) *Storage {\n\treturn &Storage{\n\t\tctx: context.Background(),\n\t\tconfig: config,\n\t}\n}", "title": "" }, { "docid": "8e726d22ee93b73dd148ccbccdef59f8", "score": "0.81480724", "text": "func NewStorage() *Storage {\n\treturn &Storage{\n\t\tm: make(map[interface{}]entities.Bucket),\n\t\tmx: sync.RWMutex{},\n\t}\n}", "title": "" }, { "docid": "2d9d6636292a95db90be0d1b7e6e02ef", "score": "0.81385386", "text": "func New(proxy storage.Storage) *Storage {\n\treturn &Storage{proxy}\n}", "title": "" }, { "docid": "d638bfe2b2f43d9c43e52616e4b7dce5", "score": "0.81274176", "text": "func NewStorage() *Storage {\n\treturn &Storage{\n\t\tpath: getPath(),\n\t}\n}", "title": "" }, { "docid": "12005a57fa3fe673b4a288e3f40c1d55", "score": "0.80826116", "text": "func New() (*FSStorage, error) {\n\tdir, err := ioutil.TempDir(\"\", \"storage\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn NewWithContext(context.Background(), dir)\n}", "title": "" }, { "docid": "0b90507681747fa2147db6b18f5152e0", "score": "0.8032443", "text": "func New() cw.Storage {\n\treturn cw.Storage{\n\t\tUser: &userStorage{users: uu},\n\t\tPassage: &passageStorage{passages: pp},\n\t\tAnalysis: &analysisStorage{analyses: aa},\n\t\tSelection: &selectionStorage{selections: ss},\n\t}\n}", "title": "" }, { "docid": "83061cc901a1be7eefd38224f3efe2df", "score": "0.7990047", "text": "func NewStorage() *Storage {\n\treturn &Storage{}\n}", "title": "" }, { "docid": "a255c6c04137de7bce7829c3e0e10179", "score": "0.7928802", "text": "func NewStorage() (*Storage) {\n\treturn &Storage{\n\t\tdata: make(map[string]string),\n\t}\n}", "title": "" }, { "docid": "bcdbf8bdbc804b73c35eb8697435e766", "score": "0.7873598", "text": "func NewStorage() *Storage {\n\treturn &Storage{\n\t\ttopics: map[string]map[string]struct{}{},\n\t\tsubs: map[SubID]*Fifo{},\n\t}\n}", "title": "" }, { "docid": "9a3703389894f8be5bc01dc32b366db6", "score": "0.78173584", "text": "func New(maxBytes int64, cache, origin blobserver.Storage) *Storage {\n\tsto := &Storage{\n\t\torigin: origin,\n\t\tcache: cache,\n\t\tlru: lru.NewUnlocked(0),\n\t\tmaxCacheBytes: maxBytes,\n\t}\n\treturn sto\n}", "title": "" }, { "docid": "c335826d4ac1632f00d154031600778f", "score": "0.7794289", "text": "func NewStorage() *Storage {\n\treturn &Storage{\n\t\tarrays: make(map[Instance]Elems),\n\t\tmaps: make(map[Instance]map[Instance]Instance),\n\t\tstructs: make(map[Instance]Fields),\n\t}\n}", "title": "" }, { "docid": "a3e74b0e7ae94ab6b5a7a6459116b4e0", "score": "0.77915394", "text": "func NewStorage() Storage {\n\treturn Storage{\n\t\tmake(map[string]Table, 0),\n\t\t&sync.RWMutex{},\n\t}\n}", "title": "" }, { "docid": "8c6ae87228563a9a459e10970ef7e1a1", "score": "0.7781134", "text": "func NewStorage(logger *zap.Logger) *Storage {\n\treturn &Storage{\n\t\tlogger: logger,\n\t\tmemory: newInMemory(),\n\t\tencoder: new(jsonEncoder),\n\t}\n}", "title": "" }, { "docid": "9f6e792d92490b560009b1a7c0c2715f", "score": "0.77345914", "text": "func New(db *sql.DB) *Storage {\n\treturn &Storage{db}\n}", "title": "" }, { "docid": "68058cc6edce297449b91ef9f0086c97", "score": "0.7708768", "text": "func NewStorage() *Storage {\n\ts := &Storage{\n\t\tdata: map[string]ItemInterface{},\n\t\texpire: map[int]map[string]struct{}{},\n\t}\n\tgo s.startTicker()\n\treturn s\n}", "title": "" }, { "docid": "5d03650741cac2f0e243491f4fc98d80", "score": "0.7706542", "text": "func NewStorage(file string) (sorted.KeyValue, error) {\n\treturn newKeyValueFromJSONConfig(jsonconfig.Obj{\"file\": file})\n}", "title": "" }, { "docid": "b6c20c8d1dc49caa696e69c547158d5b", "score": "0.76970357", "text": "func NewStorage() *Storage {\n\treturn &Storage{env: make(map[string]string)}\n}", "title": "" }, { "docid": "0134211a2b851bc5402416c3a745a03c", "score": "0.76900697", "text": "func NewStorage(base minkowski.Base) *Storage {\n\treturn &Storage{\n\t\tBase: base,\n\t}\n}", "title": "" }, { "docid": "90f1d2079ed69775a8f39a2a7a6436dc", "score": "0.7679385", "text": "func New(config *StorageConfig) (*Storage, error){\n\tsession, err := mgo.Dial(config.GetConnURL())\n\tif err != nil {\n\t\tconfig.log.Errorf(\"DB connection error: %s\", err)\n\t\treturn nil, err\n\t}\n\tsession.SetMode(mgo.Monotonic, true)\n\tstorage := &Storage{config: config, C: session.DB(config.DB).C(config.Collection)}\n\treturn storage, nil\n}", "title": "" }, { "docid": "fc0b05fb884da605d62ddc895013b3cc", "score": "0.76621974", "text": "func NewStorage() *Storage {\n\treturn &Storage{\n\t\tcache: memcache.New(NewLog()),\n\t}\n}", "title": "" }, { "docid": "583d65c87d1d5ffa87243aa8c7784bc2", "score": "0.7654079", "text": "func New(ctx context.Context, conf config.Config) (*Storage, error) {\n\tif len(conf.Scopes) == 0 {\n\t\tconf.Scopes = []string{SDK.CloudPlatformScope}\n\t}\n\n\thttpClient, err := conf.Client()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsvc, err := GCP.NewClient(ctx, option.WithHTTPClient(httpClient))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Storage{\n\t\tClient: svc,\n\t\tlogger: log.DefaultLogger,\n\t}, nil\n}", "title": "" }, { "docid": "101d9ce04f0962f51c1d86d8b0bca1ce", "score": "0.76425046", "text": "func New(filename string) Storage {\n\tdb, err := bolt.Open(filename, 0600, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"can't open storage file %s: %q\", filename, err)\n\t}\n\tstorage := &boltStorage{db: db}\n\terr = storage.createBuckets()\n\tif err != nil {\n\t\tlog.Fatalf(\"bucket creation error: %q\", err)\n\t}\n\treturn storage\n}", "title": "" }, { "docid": "3d8d0feeb4ec61599d8b4cf74e8c58bd", "score": "0.76250696", "text": "func NewStorage(s Store) *Storage {\n\treturn &Storage{s}\n}", "title": "" }, { "docid": "279c9da1d70f591d241d4e93512d28c9", "score": "0.758816", "text": "func NewStorage(rootDir string) Storage {\r\n\treturn &storageImpl{rootDir: rootDir}\r\n\r\n}", "title": "" }, { "docid": "6ea298958f29219fb1da424d572c3161", "score": "0.7581455", "text": "func NewStorage(directory string) *Storage {\n\treturn &Storage{\n\t\tdirectory: directory,\n\t}\n}", "title": "" }, { "docid": "3a36ce143f676dee5def6d2a0a6018b5", "score": "0.7565581", "text": "func New(ctx context.Context, cred option.ClientOption) (*Storage, error) {\n\tclient, err := storage.NewClient(ctx, cred)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not create new client: %s\", err)\n\t}\n\tbucketname, err := env.GcpBucketName()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbkt := client.Bucket(bucketname)\n\treturn &Storage{bucket: bkt}, nil\n}", "title": "" }, { "docid": "cbabc7e878f138ab33a7d26a5131e901", "score": "0.7551913", "text": "func New(accountName, accountKey string) (*Storage, error) {\n\tu, err := url.Parse(fmt.Sprintf(\"https://%s.blob.core.windows.net\", accountName))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcred := azblob.NewSharedKeyCredential(accountName, accountKey)\n\treturn &Storage{accountURL: u, cred: cred}, nil\n}", "title": "" }, { "docid": "7695d9303646e0ac9eae2e2b19357634", "score": "0.754402", "text": "func New(config ...Config) *Storage {\n\t// Set default config\n\tcfg := configDefault(config...)\n\n\t// Create new redis client\n\n\tvar options *redis.Options\n\tvar err error\n\n\tif cfg.URL != \"\" {\n\t\toptions, err = redis.ParseURL(cfg.URL)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t} else {\n\t\toptions = &redis.Options{\n\t\t\tAddr: fmt.Sprintf(\"%s:%d\", cfg.Host, cfg.Port),\n\t\t\tDB: cfg.Database,\n\t\t\tUsername: cfg.Username,\n\t\t\tPassword: cfg.Password,\n\t\t}\n\t}\n\n\tdb := redis.NewClient(options)\n\n\t// Test connection\n\tif err := db.Ping(context.Background()).Err(); err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Empty collection if Clear is true\n\tif cfg.Reset {\n\t\tif err := db.FlushDB(context.Background()).Err(); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\n\t// Create new store\n\treturn &Storage{\n\t\tdb: db,\n\t}\n}", "title": "" }, { "docid": "8ade529226ecb530e2e8894fcb8e7c42", "score": "0.7425214", "text": "func NewStorage(dir, prefix string) (*Storage, error) {\n\tif !filepath.IsAbs(dir) {\n\t\treturn nil, errors.New(\"none absolute: \" + dir)\n\t}\n\n\tdir = filepath.Clean(dir)\n\tst, err := os.Stat(dir)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !st.Mode().IsDir() {\n\t\treturn nil, errors.New(\"not a directory: \" + dir)\n\t}\n\n\treturn &Storage{\n\t\tdir: dir,\n\t\tprefix: prefix,\n\t\tinfo: make(map[string]*apt.FileInfo),\n\t}, nil\n}", "title": "" }, { "docid": "3096d10d394a306d2d8485450a53d08f", "score": "0.7375136", "text": "func New(dir string) (blobserver.Storage, error) {\n\tvar maxSize int64\n\tif ok, _ := IsDir(dir); ok {\n\t\t// TODO: detect existing max size from size of files, if obvious,\n\t\t// and set maxSize to that?\n\t}\n\treturn newStorage(dir, maxSize, nil)\n}", "title": "" }, { "docid": "99ac2841b7e0673ad5f52b1e7a726f9e", "score": "0.7373179", "text": "func NewStorage(projectID string) Storage {\n\tvar logger zerolog.Logger\n\tsw, err := stackdriverhook.NewStackdriverLoggingWriter(projectID, \"storage\", map[string]string{\"from\": \"storage\"})\n\tif err != nil {\n\t\tlogger = log.Logger\n\t\tlogger.Error().Err(err).Msg(\"new NewStackdriverLoggingWriter failed\")\n\t} else {\n\t\tlogger = zerolog.New(sw).Level(zerolog.DebugLevel)\n\t}\n\n\treturn Storage{\n\t\tlogwriter: sw,\n\t\tlogger: logger,\n\t\tprojectID: projectID,\n\t}\n}", "title": "" }, { "docid": "e4a2d79b2e5f715750bf4f9bff62e02f", "score": "0.7362741", "text": "func NewStorage() *Storage {\n\teventStorage := make(map[string]*Event)\n\treturn &Storage{events: eventStorage}\n}", "title": "" }, { "docid": "4296cdeff3e378fe34985037f8f76893", "score": "0.7352489", "text": "func NewStorage(q storage.Queryable) *Storage {\n\treturn &Storage{\n\t\tq: q,\n\t}\n}", "title": "" }, { "docid": "530085a2bb6d02f3b6f339eabacb45b7", "score": "0.73384887", "text": "func New(dbPath string) (s *Storage) {\n\tdb, err := badger.Open(badger.DefaultOptions(dbPath))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\ts = &Storage{\n\t\tdb: db,\n\t}\n\n\tgo garbageCollection(db)\n\n\treturn\n}", "title": "" }, { "docid": "4dd70d427f63bc3d75fc089fc5158742", "score": "0.7334189", "text": "func New(path string) *TemplateStorage {\n\trPath, err := filepath.Abs(path)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tc, err := cache.NewCache(\"memory\", `{\"interval\":`+string(DefaultCacheGCInterval)+\"}\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn &TemplateStorage{fsroot: rPath, cache: c}\n\n}", "title": "" }, { "docid": "a7b56e22fbc130af9a0e235de27d9245", "score": "0.7314138", "text": "func NewStorage(rootDir string, filesystem afero.Fs) storage.Backend {\n\treturn &storageImpl{rootDir: rootDir, filesystem: filesystem}\n\n}", "title": "" }, { "docid": "aa721fc1f41ffc86087b384232bda549", "score": "0.7297694", "text": "func NewStorage(db *sql.DB, pushTimeout time.Duration, logger *zap.Logger) *Storage {\n\treturn &Storage{\n\t\tdb: db,\n\t\tlogger: logger,\n\t\tbuffers: make(map[string]*tableBuffer),\n\t\tsem: semaphore.NewWeighted(MaxParallelQuery),\n\t\tpushTimeout: pushTimeout,\n\t\tdoneCh: make(chan struct{}),\n\t}\n}", "title": "" }, { "docid": "1721e6905cebe0f89d599dab183459f0", "score": "0.7293818", "text": "func New(opts *NewStorageOpts) (storage *Storage, err error) {\n\tcfg, err := external.LoadDefaultAWSConfig()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not load AWS configuration: %w\", err)\n\t}\n\tcfg.EndpointResolver = aws.ResolveWithEndpointURL(opts.EndpointURL)\n\tcfg.Region = endpoints.EuCentral1RegionID\n\ts3client := s3.New(cfg)\n\ts3client.ForcePathStyle = true\n\n\ts3uploader := &s3manager.Uploader{\n\t\tS3: s3client,\n\t\tPartSize: s3manager.DefaultUploadPartSize,\n\t\tConcurrency: s3manager.DefaultUploadConcurrency,\n\t\tLeavePartsOnError: false,\n\t\tMaxUploadParts: s3manager.MaxUploadParts,\n\t}\n\n\treturn &Storage{\n\t\tuploader: s3uploader,\n\t\tbucket: opts.Bucket,\n\t}, nil\n}", "title": "" }, { "docid": "24f2ca86dc119f893dc7150f0db5363e", "score": "0.7291243", "text": "func NewStorage(dsn string) (*mock, error) {\n\treturn new(mock), nil\n}", "title": "" }, { "docid": "18acac8cca9d9ddbc9e875a5e9c65319", "score": "0.7290467", "text": "func NewStorage(objC obj.Client, opts ...StorageOption) *Storage {\n\ts := &Storage{\n\t\tobjC: objC,\n\t}\n\tfor _, opt := range opts {\n\t\topt(s)\n\t}\n\treturn s\n}", "title": "" }, { "docid": "b20f9b09a65f127ea26b15cedcdd1fe0", "score": "0.7267585", "text": "func NewStorage() *Storage {\n\t// return new(nodeStorage)\n\treturn &Storage{nodes: map[insolar.PulseNumber][]insolar.Node{}}\n}", "title": "" }, { "docid": "df71354aa1844c74896fc76e995df1b8", "score": "0.7264031", "text": "func NewStorage(dir string) (*Storage, error) {\n\treturn NewStorageWithOptions(badger.DefaultOptions(dir))\n}", "title": "" }, { "docid": "957cd1eb986024f6db599e11b2618fc1", "score": "0.7232497", "text": "func NewStorage() *Storage {\n\ts := new(Storage)\n\ts.db = infrastructure.Infrastructure.DbSession\n\treturn s\n}", "title": "" }, { "docid": "8266d9bcaf79d5cd7fd978b1ffcaa629", "score": "0.72090113", "text": "func NewStorage(storageName, storageSize, storagePath string, ephemeral *bool) Storage {\n\treturn Storage{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: StorageKind,\n\t\t\tAPIVersion: machineoutput.APIVersion,\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{Name: storageName},\n\t\tSpec: StorageSpec{\n\t\t\tSize: storageSize,\n\t\t\tPath: storagePath,\n\t\t\tEphemeral: ephemeral,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "98b06a6c481b113d0dd751c13987b326", "score": "0.72084284", "text": "func New() (Storage, error) {\n\trecords, err := db.OpenRecords(db.LoadArangoConfig())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\timages := cloud.New(cloud.LoadDropboxConfig())\n\n\treturn &ImageStorage{\n\t\trecordStorage: *records,\n\t\tcloudStorage: *images,\n\t}, nil\n}", "title": "" }, { "docid": "30ba51ae5c94c9f455acea5399647827", "score": "0.7192646", "text": "func New(svc dynamodbiface.DynamoDBAPI, keysTable string, valuesTable string) storage.Storage {\n\treturn &dynamodbStorage{\n\t\tsvc: svc,\n\t\tkeysTable: keysTable,\n\t\tvaluesTable: valuesTable,\n\t}\n}", "title": "" }, { "docid": "25d5b6efe43927a2bbf48c2d0df1419c", "score": "0.71860456", "text": "func NewStorage(dir string) (*Storage, error) {\n\treturn NewStorageWithOptions(dir, &store.Options{})\n}", "title": "" }, { "docid": "c27b47fdb747786f1e8ec47df2d2cb85", "score": "0.71845186", "text": "func NewStorage(dbname string, mode os.FileMode, opts *bolt.Options) Storage {\n\treturn Storage{\n\t\tDBName: dbname,\n\t\tmode: mode,\n\t\topts: opts,\n\t}\n}", "title": "" }, { "docid": "ace61c52a2b11d5dff8dacb140f48d3c", "score": "0.71600026", "text": "func NewStorage() engine.StorageFactory {\n\treturn &storageFactory{}\n}", "title": "" }, { "docid": "a16fc359f062cf0e5841bc66786185a8", "score": "0.7155688", "text": "func NewStorage() (*Storage, error) {\n\tvar err error\n\n\ts := new(Storage)\n\n\t_, filename, _, _ := runtime.Caller(0)\n\tp := path.Dir(filename)\n\n\ts.db, err = scribble.New(p+dir, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn s, nil\n}", "title": "" }, { "docid": "ef4518ca013d6a094cc442f8e2a80d5b", "score": "0.7147871", "text": "func New(options ...storage.Option) storage.Manager {\n\treturn newManager(options...)\n}", "title": "" }, { "docid": "cb04a0841de91a0471fc5de75b37b4cc", "score": "0.7141855", "text": "func NewStorage() (*Storage, error) {\n\tvar err error\n\n\ts := new(Storage)\n\n\t_, filename, _, _ := runtime.Caller(0)\n\tp := path.Dir(filename)\n\n\ts.db, err = scribble.New(p+dir, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn s, nil\n}", "title": "" }, { "docid": "a00678cd45e39bffdfd9fa52f59c2d11", "score": "0.71367246", "text": "func NewStorage() (*Storage, error) {\n\tvar err error\n\n\ts := new(Storage)\n\n\tcwd, _ := os.Getwd()\n\ts.db, err = scribble.New(cwd+viper.GetString(\"storage.basedir\"), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn s, nil\n}", "title": "" }, { "docid": "460704175de723a2c13c746b74dd3e4e", "score": "0.7136572", "text": "func New(storage storage.Storage) Service {\n\treturn &service{\n\t\tstorage: storage,\n\t}\n}", "title": "" }, { "docid": "3d7572f4e3b10e9eed7b4208f5167ed1", "score": "0.71269417", "text": "func NewStorage(t mockConstructorTestingTNewStorage) *Storage {\n\tmock := &Storage{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "deb6ece12aecbac9f6dc99d937c79aa3", "score": "0.71244395", "text": "func New(url string) (core.Storage, error) {\n\t// TODO: add options to set idle conn, idle time, etc.\n\tdb, err := sql.Open(\"postgres\", url)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t_, err = db.Exec(`\n\t\tcreate table if not exists storage (\n\t\t\tkey varchar,\n\t\t\tvalue varchar,\n\t\t\tprimary key (key)\n\t\t)\n\t`)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &storage{db}, nil\n}", "title": "" }, { "docid": "54b95701565718b75f8fe61ce1bd38ef", "score": "0.7121691", "text": "func New(client clientset.Interface, qm restclient.Interface) (qmstorage.StorageType, error) {\n\ts := &SwiftStorage{\n\t\tclient: client,\n\t\tqm: qm,\n\t}\n\n\t// Use the StorageHandlerFuncs struct to insulate\n\t// the driver from interface incompabilities\n\treturn &qmstorage.StorageHandlerFuncs{\n\n\t\t// Save the storage handler. Great for unit tests\n\t\tStorageHandler: s,\n\n\t\t// Provide a function which returns the Type of storage system\n\t\t// Required\n\t\tTypeFunc: s.Type,\n\n\t\t// This function is called when QM is started\n\t\t// Optional\n\t\tInitFunc: s.Init,\n\n\t\t// ---------------- Cluster Functions ---------------\n\n\t\t// Called after a new StorageCluster object has been submitted\n\t\t// QM takes care of creating StorageNodes for each one defined\n\t\t// in the StorageCluster so there is no need for the driver to\n\t\t// create them\n\t\tAddClusterFunc: s.AddCluster,\n\n\t\t// Called when the StorageCluster has been updated\n\t\tUpdateClusterFunc: s.UpdateCluster,\n\n\t\t// Called when the StorageCluster has been deleted. After this\n\t\t// call, QM will delete all StorageNode objects. You may want\n\t\t// to wait until all your StorageNodes are deleted, but it all\n\t\t// depends on your storage system\n\t\tDeleteClusterFunc: s.DeleteCluster,\n\n\t\t// ---------------- Node Functions ---------------\n\n\t\t// Return a Deployment object which requests the installation\n\t\t// of the containerized storage software.\n\t\tMakeDeploymentFunc: s.MakeDeployment,\n\n\t\t// New StorageNode is ready and it is called after the\n\t\t// deployment is available and running.\n\t\tAddNodeFunc: s.AddNode,\n\n\t\t// Called when a StorageNode has been updated\n\t\tUpdateNodeFunc: s.UpdateNode,\n\n\t\t// Called when a StorageNode has been deleted\n\t\tDeleteNodeFunc: s.DeleteNode,\n\t}, nil\n}", "title": "" }, { "docid": "9d5f7dc297282ed073672ab148d70376", "score": "0.7111869", "text": "func New(dir string) (blobserver.Storage, error) {\n\tif v, err := diskpacked.IsDir(dir); err != nil {\n\t\treturn nil, err\n\t} else if v {\n\t\treturn diskpacked.New(dir)\n\t}\n\tif v, err := localdisk.IsDir(dir); err != nil {\n\t\treturn nil, err\n\t} else if v {\n\t\treturn localdisk.New(dir)\n\t}\n\treturn diskpacked.New(dir)\n}", "title": "" }, { "docid": "92db93f2e2b2ecc51db8b98ecdef0866", "score": "0.7108047", "text": "func NewStorage(path string) (resources.Storage, error) {\n\t// Initialize the path, if it does not exist\n\tok, err := exists(path)\n\tif err != nil {\n\t\tlog.WithError(err).Error(\"Failed to check resources directory\")\n\t\traven.CaptureErrorAndWait(err, nil)\n\t\treturn nil, err\n\t}\n\n\tif !ok {\n\t\tlog.WithField(\"path\", path).Info(\"Creating resources directory\")\n\t\terr := os.MkdirAll(path, os.ModePerm)\n\t\tif err != nil {\n\t\t\tlog.WithError(err).Error(\"Failed to create resources directory\")\n\t\t\traven.CaptureErrorAndWait(err, nil)\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Return storage.\n\treturn &Storage{\n\t\tpath: path,\n\t}, nil\n}", "title": "" }, { "docid": "e0757e461e89c451b242e460231745d1", "score": "0.70958006", "text": "func NewStorage(db *sql.DB) *Storage {\n\treturn &Storage{db}\n}", "title": "" }, { "docid": "ac90400c67cf7ad6454724555d0cd4bb", "score": "0.7091791", "text": "func newStorage() *Storage {\n\treturn NewStorage(NewMemSnapshotMgr(), NewMemLog(), NewMemState(0))\n}", "title": "" }, { "docid": "044a4d2ad23290a9e858c06d6f883f3b", "score": "0.7084439", "text": "func NewStorage() Storager {\n\treturn &storageLinux{\n\t\tdirpath: filepath.Join(\".\"),\n\t}\n}", "title": "" }, { "docid": "1eb92fbba886e9402e40d160eb270913", "score": "0.70561177", "text": "func NewStorage(_ genericregistry.RESTOptionsGetter) *Storage {\n\treturn &Storage{\n\t\tClusterAddonType: &REST{},\n\t}\n}", "title": "" }, { "docid": "4493557d7dbda9145ee557e63426a469", "score": "0.70397836", "text": "func New(params driverParameters) (storagedriver.StorageDriver, error) {\n\n\t// Setup the connection to hdfs\n\tclient, err := hdfs.NewForUser(params.hdfsNameNode, params.hdfsUser)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// Populate the driver\n\td := &driver{\n\t\thdfsRootDirectory:\tparams.hdfsRootDirectory,\n\t\thdfsNameNode:\t\tparams.hdfsNameNode,\n\t\thdfsUser:\t\tparams.hdfsUser,\n\t\tdirectoryUmask:\t\tparams.directoryUmask,\n\t\thdfsClient:\t\tclient,\n\t}\n\n\t// Return the StorageDriver\n\treturn &base.Base{\n\t\tStorageDriver: d,\n\t}, nil\n}", "title": "" }, { "docid": "0ade1081cc30fbf0f5cd5bae17dd50b8", "score": "0.6996796", "text": "func NewStorage(opts Options) (storage.Storage, error) {\n\tclient := xhttp.NewHTTPClient(opts.httpOptions)\n\tscope := opts.scope.SubScope(metricsScope)\n\ts := &promStorage{\n\t\topts: opts,\n\t\tclient: client,\n\t\tendpointMetrics: initEndpointMetrics(opts.endpoints, scope),\n\t\tdroppedWrites: scope.Counter(\"dropped_writes\"),\n\t\tlogger: opts.logger,\n\t}\n\treturn s, nil\n}", "title": "" }, { "docid": "46cb14a7ad538bc5348ea79f20bed26e", "score": "0.6995968", "text": "func New(location string, hash crypto.Hash) storages.Storage {\n\treturn &dirStorage{\n\t\tchopper: chop.Chopper{Sep: os.PathSeparator, Slices: chopSlices, SliceSize: chopSize},\n\t\tlocation: location,\n\t\thash: hash,\n\t}\n}", "title": "" }, { "docid": "64da7b2fd7b2af3839121adf9703d92b", "score": "0.69787645", "text": "func New(ctx context.Context, opts *Options) (blob.Storage, error) {\n\tc, closeFunc, err := getSFTPClient(ctx, opts)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"unable to create sftp client\")\n\t}\n\n\tif _, err = c.Stat(opts.Path); err != nil {\n\t\tif isNotExist(err) {\n\t\t\tif err = c.MkdirAll(opts.Path); err != nil {\n\t\t\t\treturn nil, errors.Wrap(err, \"cannot create path\")\n\t\t\t}\n\t\t} else {\n\t\t\treturn nil, errors.Wrapf(err, \"path doesn't exist: %s\", opts.Path)\n\t\t}\n\t}\n\n\tr := &sftpStorage{\n\t\tsharded.Storage{\n\t\t\tImpl: &sftpImpl{\n\t\t\t\tOptions: *opts,\n\t\t\t\tcli: c,\n\t\t\t\tcloseFunc: closeFunc,\n\t\t\t},\n\t\t\tRootPath: opts.Path,\n\t\t\tSuffix: fsStorageChunkSuffix,\n\t\t\tShards: opts.shards(),\n\t\t},\n\t}\n\n\treturn retrying.NewWrapper(r), nil\n}", "title": "" }, { "docid": "bd2166c660519d4cf0aca036d2775e88", "score": "0.69731635", "text": "func New() Storage {\n\treturn &inMemmory{\n\t\tmux: sync.Mutex{},\n\t\tdata: make(map[string]string),\n\t}\n}", "title": "" }, { "docid": "1f58656b8739a62a2a45620e17fdca29", "score": "0.6972628", "text": "func New(ctx context.Context, opt *Options) (blob.Storage, error) {\n\tvar ts oauth2.TokenSource\n\tvar err error\n\n\tscope := storage.ScopeReadWrite\n\tif opt.ReadOnly {\n\t\tscope = storage.ScopeReadOnly\n\t}\n\n\tif sa := opt.ServiceAccountCredentials; sa != \"\" {\n\t\tts, err = tokenSourceFromCredentialsFile(ctx, sa, scope)\n\t} else {\n\t\tts, err = google.DefaultTokenSource(ctx, scope)\n\t}\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdownloadThrottler := iothrottler.NewIOThrottlerPool(toBandwidth(opt.MaxDownloadSpeedBytesPerSecond))\n\tuploadThrottler := iothrottler.NewIOThrottlerPool(toBandwidth(opt.MaxUploadSpeedBytesPerSecond))\n\n\thc := oauth2.NewClient(ctx, ts)\n\thc.Transport = throttle.NewRoundTripper(hc.Transport, downloadThrottler, uploadThrottler)\n\n\tcli, err := storage.NewClient(ctx, option.WithHTTPClient(hc))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif opt.BucketName == \"\" {\n\t\treturn nil, errors.New(\"bucket name must be specified\")\n\t}\n\n\treturn &gcsStorage{\n\t\tOptions: *opt,\n\t\tctx: ctx,\n\t\tstorageClient: cli,\n\t\tbucket: cli.Bucket(opt.BucketName),\n\t\tdownloadThrottler: downloadThrottler,\n\t\tuploadThrottler: uploadThrottler,\n\t}, nil\n}", "title": "" }, { "docid": "76fe52527784af38ccb9702cd77ae75e", "score": "0.6967607", "text": "func NewStorage(db *bolt.DB) (*Storage, error) {\n\t// If the store's bucket doesn't exist, create it.\n\terr := db.Update(func(tx *bolt.Tx) error {\n\t\t_, err := tx.CreateBucketIfNotExists(macaroonBucketName)\n\t\treturn err\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Return the DB wrapped in a Storage object.\n\treturn &Storage{db}, nil\n}", "title": "" }, { "docid": "8f0892bac136badbb8969ee2e3033756", "score": "0.6943959", "text": "func NewStorage()(*Storage, error){\n\tdb, err := sql.Open(\"sqlite3\", \"./art.db\")\n\tif err != nil {\n\t\treturn nil, err\t\n\t}\n\ts:= &Storage{db}\n\n\tif err := s.createTables(); err !=nil{\n\t\treturn nil, err\n\t}\n\treturn s, nil\n}", "title": "" }, { "docid": "59742aa3d8ffb028d332997a717bfa19", "score": "0.6898597", "text": "func New(s Storage) (*Service, error) {\n\treturn &Service{s}, nil\n}", "title": "" }, { "docid": "2acf8fd3c7945be3193ae78f98bbd98b", "score": "0.6875038", "text": "func New() storage.Manager {\n\treturn &manager{}\n}", "title": "" }, { "docid": "83f4f7a2dfc7201217e44e170f76150d", "score": "0.6873048", "text": "func New(c *config.Config, client *redis.Client) (storage.Storage, error) {\n\tif client == nil {\n\t\tclient = redis.NewClient(&redis.Options{\n\t\t\tAddr: c.StorageAddress,\n\t\t\tPassword: c.StoragePassword,\n\t\t\tDB: 0,\n\t\t})\n\t}\n\n\t_, err := client.Ping().Result()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"unable to ping redis\")\n\t}\n\n\treturn &Redis{\n\t\tclient: client,\n\t}, nil\n}", "title": "" }, { "docid": "1096c9fe4d27cf209ea43e3fd1222deb", "score": "0.68698746", "text": "func New() (*Storing, error) {\n\tst := &Storing{\n\t\tStorageAccount: os.Getenv(\"AZURE_STORAGE_ACCOUNT\"),\n\t\tContainerName: os.Getenv(\"AZURE_STORAGE_CONTAINER\"),\n\t\tStorageAccessKey: os.Getenv(\"AZURE_STORAGE_ACESS_KEY\"),\n\t}\n\n\terr := allStoringFieldsCorrect(st)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn st, nil\n\n}", "title": "" }, { "docid": "a448fad8338d9233326504f4362acde7", "score": "0.6851571", "text": "func New(storage Storage) *Controller {\n\treturn &Controller{\n\t\tstorage: storage,\n\t}\n}", "title": "" }, { "docid": "d0190aaff9de601ea1d2ee5454385d14", "score": "0.6797173", "text": "func New() Store {\n\treturn &bucket{\n\t\tvalues: make(map[string][]byte),\n\t}\n}", "title": "" }, { "docid": "0cd8b5d110db84eb6b28e24e2c857e11", "score": "0.6773176", "text": "func New(provider storage.Provider) (*Store, error) {\n\tstore, err := provider.OpenStore(namespace)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to open operation store: %w\", err)\n\t}\n\n\terr = provider.SetStoreConfig(namespace, storage.StoreConfiguration{TagNames: []string{index}})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to set store configuration: %w\", err)\n\t}\n\n\treturn &Store{\n\t\tstore: store,\n\t}, nil\n}", "title": "" }, { "docid": "4bd3ef3426d3c3dab5bd13dd19f63094", "score": "0.6756155", "text": "func New(opts Options) *storage {\n\ts := &storage{\n\t\tclose: make(chan struct{}),\n\t\topts: opts,\n\t}\n\ts.work = make([]chan operation, opts.WorkerCount)\n\ts.wait.Add(opts.WorkerCount)\n\n\tfor i := 0; i < opts.WorkerCount; i++ {\n\t\ts.work[i] = make(chan operation, opts.ChannelBufferSize)\n\t\tgo func(work <-chan operation, close <-chan struct{}) {\n\t\t\tdefer s.wait.Done()\n\t\t\tticker := time.Tick(expirationFrequency)\n\t\t\tdata := make(elementMap)\n\t\t\tfor {\n\t\t\t\tselect {\n\t\t\t\tcase <-close:\n\t\t\t\t\treturn\n\t\t\t\tcase job := <-work:\n\t\t\t\t\tjob(data)\n\t\t\t\tcase <-ticker:\n\t\t\t\t\tcutOff := time.Now().Add(-1 * opts.MaxAge).UnixNano()\n\t\t\t\t\texpireOldElements(data, cutOff, opts.OnExpire)\n\t\t\t\t}\n\t\t\t}\n\t\t}(s.work[i], s.close)\n\t}\n\treturn s\n\n}", "title": "" }, { "docid": "36ef365a746aab60499d9081ca674d4d", "score": "0.6751567", "text": "func NewStorage() *Storage {\n\ts := new(Storage)\n\tdb, err := gorm.Open(\"sqlite3\", \"/tmp/alert.db\")\n\n\tif err != nil {\n\t\tlog.Panic().Err(err).Msg(\"sqlite3 database could not be created\")\n\t}\n\n\tlog.Info().Msg(\"database was created\")\n\n\tdb.AutoMigrate(&model.Query{})\n\tdb.AutoMigrate(&model.Ad{})\n\n\ts.db = db\n\treturn s\n}", "title": "" }, { "docid": "5c145dc3cd3701f23db6e2b73c29dc7a", "score": "0.67368686", "text": "func New() (*Store, error) {\n\tvar err error\n\tvar storage shared.Storage\n\n\tswitch backend := g.GetConfig().Backend; backend {\n\tcase \"redis\":\n\t\tconf := g.GetConfig().Redis\n\t\tstorage, err = redis.New(conf.Host, conf.Password, conf.DB, conf.MaxRetries, conf.ReadTimeout, conf.WriteTimeout)\n\n\t//\tTODO: badger key value db support\n\t//case \"more storage implement\":\n\tdefault:\n\t\treturn nil, errors.New(backend + \" is not a recognized backend\")\n\t}\n\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"could not initialize the data backend\")\n\t}\n\n\treturn &Store{\n\t\tstorage: storage,\n\t\tidLength: g.GetConfig().ShortedIDLength,\n\t}, nil\n}", "title": "" }, { "docid": "3fdad036f9ea67e1310f760b513bbcbf", "score": "0.67287415", "text": "func New(config map[string]string) gocsi.StoragePluginProvider {\n\tsrvc := service.New(config)\n\treturn &gocsi.StoragePlugin{\n\t\tController: srvc,\n\t\tNode: srvc,\n\t\tIdentity: srvc,\n\t\tBeforeServe: srvc.BeforeServe,\n\t\tEnvVars: []string{\n\t\t\t// Enable request validation\n\t\t\tgocsi.EnvVarSpecReqValidation + \"=true\",\n\n\t\t\t// Enable serial volume access\n\t\t\tgocsi.EnvVarSerialVolAccess + \"=true\",\n\t\t},\n\t}\n}", "title": "" }, { "docid": "dc14892b5671d58febb98a89434f1d46", "score": "0.67208", "text": "func NewStorage(cfg *config.AppConfig) (sessions.IStorage, error) {\n\tclient := redis.NewClient(&redis.Options{\n\t\tAddr: cfg.Redis.ConnectionString,\n\t})\n\n\tlog.Println(\"Try to ping redis...\")\n\n\t_, err := client.Ping().Result()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"redis ping error %w\", err)\n\t}\n\n\tlog.Println(\"Redis client connected!\")\n\n\treturn &redisStorage{client}, nil\n}", "title": "" }, { "docid": "406b5aacdfa667f1740b5bff5e8ae573", "score": "0.67103434", "text": "func NewStorage(pgdb *sql.DB) *Store {\n\treturn &Store{\n\t\tpgdb: pgdb,\n\t}\n}", "title": "" }, { "docid": "0b7e4c59a2c2405c459c18fbb7c22d45", "score": "0.670678", "text": "func NewStorage(db *storm.DB) (*storage.Storage, error) {\n\tuserStore := users.NewStorage(usersBackend{db: db})\n\tshareStore := share.NewStorage(shareBackend{db: db})\n\tsettingsStore := settings.NewStorage(settingsBackend{db: db})\n\tauthStore := auth.NewStorage(authBackend{db: db}, userStore)\n\n\terr := save(db, \"version\", 2) //nolint:gomnd\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &storage.Storage{\n\t\tAuth: authStore,\n\t\tUsers: userStore,\n\t\tShare: shareStore,\n\t\tSettings: settingsStore,\n\t}, nil\n}", "title": "" }, { "docid": "8b8d4f08b262c3e08aefa60fb3b7e562", "score": "0.667277", "text": "func New(stateFilePath string) types.StateStorage {\n\treturn &yamlStorage{\n\t\tfilePath: stateFilePath,\n\t}\n}", "title": "" }, { "docid": "30edfb99ff717fa3849325e59411f96d", "score": "0.6668312", "text": "func NewInMemory() Storage {\n\treturn &InMemory{}\n}", "title": "" }, { "docid": "644251bdd8e681476b7eb924ee670f1d", "score": "0.6667137", "text": "func New() DataStorage {\n\tlog.Infof(\"New DataStorage\")\n\treturn AletheaDataStorage{database: database.PostgresqlDatabase()}\n}", "title": "" }, { "docid": "b8b7878f01a8617f6b1bfcb3ea03c345", "score": "0.6666366", "text": "func New(base string, size int64) (s *Store, err error) {\n\tsegs, err := LoadSegs(base, size)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ts = &Store{\n\t\tsegs: segs,\n\t\tsegmx: &sync.RWMutex{},\n\t\tbase: base,\n\t\tsize: size,\n\t\toffmx: &sync.Mutex{},\n\t}\n\n\tif err := s.ensure(0); err != nil {\n\t\t// TODO\n\t\t_ = err\n\t}\n\n\treturn s, nil\n}", "title": "" }, { "docid": "fad358acc4a6496ec6879be5c347c623", "score": "0.66660786", "text": "func New(database string) (*Storage, error) {\n\tvar client, err = mongo.NewClient(options.Client().ApplyURI(\"mongodb://root:example@localhost:27017\"))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create mongo db client. Error %v\", err)\n\t}\n\t//creating connection\n\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n\tdefer cancel()\n\terr = client.Connect(ctx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to open connection to database. Error %v\", err)\n\t}\n\t// Check the connection\n\tctx, cancel = context.WithTimeout(context.Background(), 5*time.Second)\n\tdefer cancel()\n\terr = client.Ping(context.Background(), nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to open connection to database. Error %v\", err)\n\t}\n\tdb := client.Database(database)\n\t//init collection\n\tcol := db.Collection(colName)\n\treturn &Storage{col, client}, nil\n}", "title": "" }, { "docid": "64c5f73e09313c802572bcecac76d812", "score": "0.66643435", "text": "func newLocalStorage(diskPath string) (StorageAPI, error) {\n\tif diskPath == \"\" {\n\t\treturn nil, errInvalidArgument\n\t}\n\tst, e := os.Stat(diskPath)\n\tif e != nil {\n\t\treturn nil, e\n\t}\n\tif !st.IsDir() {\n\t\treturn nil, syscall.ENOTDIR\n\t}\n\n\tinfo, e := disk.GetInfo(diskPath)\n\tif e != nil {\n\t\treturn nil, e\n\t}\n\tdisk := localStorage{\n\t\tdiskPath: diskPath,\n\t\tfsInfo: info,\n\t\tminFreeDisk: 5, // Minimum 5% disk should be free.\n\t}\n\treturn disk, nil\n}", "title": "" }, { "docid": "4041096c972a24711ca927c1b61b5612", "score": "0.66450983", "text": "func NewStorage() *pebble.Storage {\n\topts := &cpebble.Options{\n\t\tFS: vfs.NewPebbleFS(vfs.NewMemFS()),\n\t}\n\ts, err := pebble.NewStorage(\"test-data\", nil, opts)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn s\n}", "title": "" }, { "docid": "f803de4b6f79576ff1115f65ac5a2723", "score": "0.6643947", "text": "func New(p client.ConfigProvider, cfgs ...*aws.Config) *StorageGateway {\n\tc := p.ClientConfig(ServiceName, cfgs...)\n\treturn newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)\n}", "title": "" }, { "docid": "3f787be9c7588ef4116aed182de255b8", "score": "0.66435736", "text": "func New(fs afero.Fs, filePath string) *Store {\n\treturn &Store{\n\t\tGoozFS: fs,\n\t\tFilePath: filePath,\n\t}\n}", "title": "" }, { "docid": "fee23a5e421de48298fc099f88245ee7", "score": "0.66314846", "text": "func NewStorageObject() *StorageObject {\n\tthis := StorageObject{}\n\treturn &this\n}", "title": "" }, { "docid": "45ad51c87ca425307ff2734eda68991b", "score": "0.65789324", "text": "func New(stg storage.Storage, logger *log.Logger) handler.Handler {\n\treturn &Handler{\n\t\tstg,\n\t\tlogger,\n\t}\n}", "title": "" }, { "docid": "8f0ae6edb2e49409da6fc132d7dbe522", "score": "0.6565449", "text": "func New() *MineStorage {\n\tms := MineStorage{\n\t\tdata: make(map[string]*models.Game),\n\t}\n\treturn &ms\n}", "title": "" }, { "docid": "01926e738c2977a6a5ed10e4edf583fc", "score": "0.6564644", "text": "func New(bucketName string) (*GCS, error) {\n\tclient, err := storage.NewClient(context.Background())\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &GCS{\n\t\tclient: client,\n\t\tbucketName: bucketName,\n\t}, nil\n}", "title": "" }, { "docid": "ab477f2811a6dafc1713bb42ed34053b", "score": "0.6549707", "text": "func NewStorage(conn *sql.DB, timeout time.Duration) reader.Reader {\n\treturn engine.New(&storage{\n\t\tconn: conn,\n\t}, timeout)\n}", "title": "" }, { "docid": "4c7d179e927d6202e9779153e6da4ba6", "score": "0.65313864", "text": "func CreateStorage(config *config.Config) (Storage, error) {\n\n\t// Convert to local Config struct\n\tc := &Config{*config}\n\n\t// Constructors should have the form 'New<StorageKind>'\n\tname := fmt.Sprintf(\"New%s\", c.StorageKind)\n\tf := reflect.ValueOf(c).MethodByName(name)\n\n\tif !f.IsValid() {\n\t\treturn nil, fmt.Errorf(\"Storage kind not supported: '%s'\", c.StorageKind)\n\t}\n\n\tlog.Printf(\"(storage): creating storage of type: %s\", c.StorageKind)\n\tv := f.Call(nil)\n\n\tif len(v) != 2 {\n\t\treturn nil, fmt.Errorf(\"Expected 2 return values from method '%s', got: %d\", name, len(v))\n\t}\n\n\ts, ok := v[0].Interface().(Storage)\n\tif !(ok || v[0].IsNil()) {\n\t\treturn nil, fmt.Errorf(\"Expected 1st return value to be *Storage from method '%s', got: '%s'\", name, reflect.TypeOf(v[0].Interface()))\n\t}\n\n\terr, ok := v[1].Interface().(error)\n\tif !(ok || v[1].IsNil()) {\n\t\treturn nil, fmt.Errorf(\"Expected 2nd return value to be error from method '%s', got: '%s'\", name, reflect.TypeOf(v[0].Interface()))\n\t}\n\n\treturn s, err\n}", "title": "" } ]
5e5272d05ab5c164e3c7f3e3e6998a58
The '''getFrontendIncomingBandwidth''' method retrieves the amount of incoming public network traffic used by a server between the given start and end date parameters. When entering the ''dateTime'' parameter, only the month, day and year of the start and end dates are required the time (hour, minute and second) are set to midnight by default and cannot be changed. The amount of bandwidth retrieved is measured in gigabytes (GB).
[ { "docid": "7a3a7e4f95fe0a55c766ed28c91ce0ad", "score": "0.7650425", "text": "func (r Hardware_Server) GetFrontendIncomingBandwidth(startDate *datatypes.Time, endDate *datatypes.Time) (resp datatypes.Float64, err error) {\n\tparams := []interface{}{\n\t\tstartDate,\n\t\tendDate,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_Server\", \"getFrontendIncomingBandwidth\", params, &r.Options, &resp)\n\treturn\n}", "title": "" } ]
[ { "docid": "3f9fa957d66b1fca113f1a7101e95dd9", "score": "0.76947534", "text": "func (r Hardware) GetFrontendIncomingBandwidth(startDate *datatypes.Time, endDate *datatypes.Time) (resp datatypes.Float64, err error) {\n\tparams := []interface{}{\n\t\tstartDate,\n\t\tendDate,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware\", \"getFrontendIncomingBandwidth\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "9f0df6c9d842bc95377da37bb448741b", "score": "0.75160134", "text": "func (r Hardware_SecurityModule) GetFrontendIncomingBandwidth(startDate *datatypes.Time, endDate *datatypes.Time) (resp datatypes.Float64, err error) {\n\tparams := []interface{}{\n\t\tstartDate,\n\t\tendDate,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_SecurityModule\", \"getFrontendIncomingBandwidth\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "ad149deba7fa87c02f7788bbfceb5a20", "score": "0.74578816", "text": "func (r Hardware_SecurityModule750) GetFrontendIncomingBandwidth(startDate *datatypes.Time, endDate *datatypes.Time) (resp datatypes.Float64, err error) {\n\tparams := []interface{}{\n\t\tstartDate,\n\t\tendDate,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_SecurityModule750\", \"getFrontendIncomingBandwidth\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "18f394d4849da7b6579387eefb980af8", "score": "0.745326", "text": "func (r Hardware_Router) GetFrontendIncomingBandwidth(startDate *datatypes.Time, endDate *datatypes.Time) (resp datatypes.Float64, err error) {\n\tparams := []interface{}{\n\t\tstartDate,\n\t\tendDate,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_Router\", \"getFrontendIncomingBandwidth\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "f7e74edc28e263f408f6801a184d3140", "score": "0.68113583", "text": "func (r Hardware_Server) GetFrontendBandwidthUsage(startDate *datatypes.Time, endDate *datatypes.Time) (resp []datatypes.Metric_Tracking_Object_Data, err error) {\n\tparams := []interface{}{\n\t\tstartDate,\n\t\tendDate,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_Server\", \"getFrontendBandwidthUsage\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "45264ab68265eeddd9877e7d00ba634a", "score": "0.6746461", "text": "func (r Hardware_Server) GetBackendIncomingBandwidth(startDate *datatypes.Time, endDate *datatypes.Time) (resp datatypes.Float64, err error) {\n\tparams := []interface{}{\n\t\tstartDate,\n\t\tendDate,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_Server\", \"getBackendIncomingBandwidth\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "3a79a538702c39e262db4dd7c6a92a4e", "score": "0.67312884", "text": "func (r Hardware) GetBackendIncomingBandwidth(startDate *datatypes.Time, endDate *datatypes.Time) (resp datatypes.Float64, err error) {\n\tparams := []interface{}{\n\t\tstartDate,\n\t\tendDate,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware\", \"getBackendIncomingBandwidth\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "0bbe796e2cc4b53617c5582202327733", "score": "0.6671181", "text": "func (r Hardware_Server) GetFrontendOutgoingBandwidth(startDate *datatypes.Time, endDate *datatypes.Time) (resp datatypes.Float64, err error) {\n\tparams := []interface{}{\n\t\tstartDate,\n\t\tendDate,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_Server\", \"getFrontendOutgoingBandwidth\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "e20a0751d544905e90f75662ae9752b7", "score": "0.6608473", "text": "func (r Hardware_SecurityModule) GetBackendIncomingBandwidth(startDate *datatypes.Time, endDate *datatypes.Time) (resp datatypes.Float64, err error) {\n\tparams := []interface{}{\n\t\tstartDate,\n\t\tendDate,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_SecurityModule\", \"getBackendIncomingBandwidth\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "ea2b53f9eef8266bd70ae3b3bf0e804b", "score": "0.66003066", "text": "func (r Hardware_SecurityModule) GetFrontendBandwidthUsage(startDate *datatypes.Time, endDate *datatypes.Time) (resp []datatypes.Metric_Tracking_Object_Data, err error) {\n\tparams := []interface{}{\n\t\tstartDate,\n\t\tendDate,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_SecurityModule\", \"getFrontendBandwidthUsage\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "895328f17c898545fde0d0c048ba8767", "score": "0.6580744", "text": "func (r Hardware_Server) GetFrontendBandwidthUse(startDate *datatypes.Time, endDate *datatypes.Time) (resp []datatypes.Network_Bandwidth_Version1_Usage_Detail, err error) {\n\tparams := []interface{}{\n\t\tstartDate,\n\t\tendDate,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_Server\", \"getFrontendBandwidthUse\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "2927ba2ec49f62fd7e269e40b2d04a43", "score": "0.6577233", "text": "func (r Hardware_Router) GetBackendIncomingBandwidth(startDate *datatypes.Time, endDate *datatypes.Time) (resp datatypes.Float64, err error) {\n\tparams := []interface{}{\n\t\tstartDate,\n\t\tendDate,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_Router\", \"getBackendIncomingBandwidth\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "23995beff562d128ddc8689acc0d1671", "score": "0.6540106", "text": "func (r Hardware) GetFrontendOutgoingBandwidth(startDate *datatypes.Time, endDate *datatypes.Time) (resp datatypes.Float64, err error) {\n\tparams := []interface{}{\n\t\tstartDate,\n\t\tendDate,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware\", \"getFrontendOutgoingBandwidth\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "8b8d7f5cca554ee3f2de0117281ac7de", "score": "0.65370965", "text": "func (r Hardware_SecurityModule750) GetBackendIncomingBandwidth(startDate *datatypes.Time, endDate *datatypes.Time) (resp datatypes.Float64, err error) {\n\tparams := []interface{}{\n\t\tstartDate,\n\t\tendDate,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_SecurityModule750\", \"getBackendIncomingBandwidth\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "12d94da93e0e5dc3ae49693eef368c8a", "score": "0.64880097", "text": "func (r Hardware_SecurityModule750) GetFrontendBandwidthUsage(startDate *datatypes.Time, endDate *datatypes.Time) (resp []datatypes.Metric_Tracking_Object_Data, err error) {\n\tparams := []interface{}{\n\t\tstartDate,\n\t\tendDate,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_SecurityModule750\", \"getFrontendBandwidthUsage\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "958c262cdc5cea6fc1b6196831a7b139", "score": "0.6448113", "text": "func (r Hardware_SecurityModule) GetFrontendOutgoingBandwidth(startDate *datatypes.Time, endDate *datatypes.Time) (resp datatypes.Float64, err error) {\n\tparams := []interface{}{\n\t\tstartDate,\n\t\tendDate,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_SecurityModule\", \"getFrontendOutgoingBandwidth\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "c64fa17eb4aaa70f5c2a174fcdcc1e41", "score": "0.63840175", "text": "func (r Hardware_SecurityModule750) GetFrontendOutgoingBandwidth(startDate *datatypes.Time, endDate *datatypes.Time) (resp datatypes.Float64, err error) {\n\tparams := []interface{}{\n\t\tstartDate,\n\t\tendDate,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_SecurityModule750\", \"getFrontendOutgoingBandwidth\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "04bc0979a4f2a5339b7bf402adbbc9eb", "score": "0.63746005", "text": "func (r Hardware_Router) GetFrontendOutgoingBandwidth(startDate *datatypes.Time, endDate *datatypes.Time) (resp datatypes.Float64, err error) {\n\tparams := []interface{}{\n\t\tstartDate,\n\t\tendDate,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_Router\", \"getFrontendOutgoingBandwidth\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "288ab4999039603e194563740ad7b6a3", "score": "0.63535434", "text": "func (r Hardware_SecurityModule) GetFrontendBandwidthUse(startDate *datatypes.Time, endDate *datatypes.Time) (resp []datatypes.Network_Bandwidth_Version1_Usage_Detail, err error) {\n\tparams := []interface{}{\n\t\tstartDate,\n\t\tendDate,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_SecurityModule\", \"getFrontendBandwidthUse\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "85694310f3144ae007776ed4f811355d", "score": "0.6242959", "text": "func (r Hardware_SecurityModule750) GetFrontendBandwidthUse(startDate *datatypes.Time, endDate *datatypes.Time) (resp []datatypes.Network_Bandwidth_Version1_Usage_Detail, err error) {\n\tparams := []interface{}{\n\t\tstartDate,\n\t\tendDate,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_SecurityModule750\", \"getFrontendBandwidthUse\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "a219a9c600095c27c98f3cf3e561da40", "score": "0.58070725", "text": "func (r Hardware_Server) GetBandwidthForDateRange(startDate *datatypes.Time, endDate *datatypes.Time) (resp []datatypes.Metric_Tracking_Object_Data, err error) {\n\tparams := []interface{}{\n\t\tstartDate,\n\t\tendDate,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_Server\", \"getBandwidthForDateRange\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "bd362136ec803d2cc7aca98244c5a4e4", "score": "0.5711583", "text": "func (r Hardware_Server) GetBackendBandwidthUsage(startDate *datatypes.Time, endDate *datatypes.Time) (resp []datatypes.Metric_Tracking_Object_Data, err error) {\n\tparams := []interface{}{\n\t\tstartDate,\n\t\tendDate,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_Server\", \"getBackendBandwidthUsage\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "f4140075ba672d413df3d410b60440cb", "score": "0.55711985", "text": "func (r Hardware_Server) GetBackendOutgoingBandwidth(startDate *datatypes.Time, endDate *datatypes.Time) (resp datatypes.Float64, err error) {\n\tparams := []interface{}{\n\t\tstartDate,\n\t\tendDate,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_Server\", \"getBackendOutgoingBandwidth\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "631e910bd786fe2ebcc29dd0bbd0c87f", "score": "0.5543924", "text": "func (r Hardware_Server) GetInboundBandwidthUsage() (resp datatypes.Float64, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_Server\", \"getInboundBandwidthUsage\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "d92fa41221ecd59f097cec4fc6b244ee", "score": "0.55040216", "text": "func (r Hardware_SecurityModule) GetBandwidthForDateRange(startDate *datatypes.Time, endDate *datatypes.Time) (resp []datatypes.Metric_Tracking_Object_Data, err error) {\n\tparams := []interface{}{\n\t\tstartDate,\n\t\tendDate,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_SecurityModule\", \"getBandwidthForDateRange\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "ccbe65dea8efb7e43017cbb2b3972dfe", "score": "0.5501149", "text": "func (r Hardware_SecurityModule) GetBackendBandwidthUsage(startDate *datatypes.Time, endDate *datatypes.Time) (resp []datatypes.Metric_Tracking_Object_Data, err error) {\n\tparams := []interface{}{\n\t\tstartDate,\n\t\tendDate,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_SecurityModule\", \"getBackendBandwidthUsage\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "6a61a5819daede2d2d279fa8656af0d1", "score": "0.5491516", "text": "func (r Hardware_Server) GetBackendBandwidthUse(startDate *datatypes.Time, endDate *datatypes.Time) (resp []datatypes.Network_Bandwidth_Version1_Usage_Detail, err error) {\n\tparams := []interface{}{\n\t\tstartDate,\n\t\tendDate,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_Server\", \"getBackendBandwidthUse\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "bcd74d5538bfd98dc4f3f3bebe7fa25b", "score": "0.54898345", "text": "func (r Hardware_SecurityModule750) GetBandwidthForDateRange(startDate *datatypes.Time, endDate *datatypes.Time) (resp []datatypes.Metric_Tracking_Object_Data, err error) {\n\tparams := []interface{}{\n\t\tstartDate,\n\t\tendDate,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_SecurityModule750\", \"getBandwidthForDateRange\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "76fa2d9771c20d8956fdaaf5161eb97f", "score": "0.5440929", "text": "func (r Hardware_Server) GetInboundPublicBandwidthUsage() (resp datatypes.Float64, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_Server\", \"getInboundPublicBandwidthUsage\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "6b59230d728f994050dc9fb27a9d68a3", "score": "0.54108804", "text": "func (r Hardware) GetBackendOutgoingBandwidth(startDate *datatypes.Time, endDate *datatypes.Time) (resp datatypes.Float64, err error) {\n\tparams := []interface{}{\n\t\tstartDate,\n\t\tendDate,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware\", \"getBackendOutgoingBandwidth\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "d72a1878d0f9b35e67c380e28b64e7d4", "score": "0.5380786", "text": "func (r Hardware_SecurityModule750) GetBackendBandwidthUsage(startDate *datatypes.Time, endDate *datatypes.Time) (resp []datatypes.Metric_Tracking_Object_Data, err error) {\n\tparams := []interface{}{\n\t\tstartDate,\n\t\tendDate,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_SecurityModule750\", \"getBackendBandwidthUsage\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "e30d4e82c67d1dbab0a78add7047c788", "score": "0.53715986", "text": "func (r Hardware_SecurityModule) GetBackendOutgoingBandwidth(startDate *datatypes.Time, endDate *datatypes.Time) (resp datatypes.Float64, err error) {\n\tparams := []interface{}{\n\t\tstartDate,\n\t\tendDate,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_SecurityModule\", \"getBackendOutgoingBandwidth\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "44e8725d3e3366a66dbd1d45475e0026", "score": "0.5354147", "text": "func (r Hardware_Router) GetBackendOutgoingBandwidth(startDate *datatypes.Time, endDate *datatypes.Time) (resp datatypes.Float64, err error) {\n\tparams := []interface{}{\n\t\tstartDate,\n\t\tendDate,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_Router\", \"getBackendOutgoingBandwidth\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "6fcd7d04882355d429773bd998ebd17e", "score": "0.53503996", "text": "func (r Hardware_Server) GetPublicBandwidthData(startTime *int, endTime *int) (resp []datatypes.Metric_Tracking_Object_Data, err error) {\n\tparams := []interface{}{\n\t\tstartTime,\n\t\tendTime,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_Server\", \"getPublicBandwidthData\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "d896680ea2f2cea830d6d46e2d777859", "score": "0.52783626", "text": "func (r Hardware_SecurityModule) GetBackendBandwidthUse(startDate *datatypes.Time, endDate *datatypes.Time) (resp []datatypes.Network_Bandwidth_Version1_Usage_Detail, err error) {\n\tparams := []interface{}{\n\t\tstartDate,\n\t\tendDate,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_SecurityModule\", \"getBackendBandwidthUse\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "7a6e6fa249eac34b4259f3875522407f", "score": "0.52773273", "text": "func (r Hardware_SecurityModule750) GetBackendOutgoingBandwidth(startDate *datatypes.Time, endDate *datatypes.Time) (resp datatypes.Float64, err error) {\n\tparams := []interface{}{\n\t\tstartDate,\n\t\tendDate,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_SecurityModule750\", \"getBackendOutgoingBandwidth\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "f461771a3f2348931aa91052258c0198", "score": "0.52301496", "text": "func (r Hardware) GetInboundBandwidthUsage() (resp datatypes.Float64, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware\", \"getInboundBandwidthUsage\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "cfba38f13014311424d4835e64bb07e0", "score": "0.5187079", "text": "func (r Hardware_Server) GetInboundPrivateBandwidthUsage() (resp datatypes.Float64, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_Server\", \"getInboundPrivateBandwidthUsage\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "c17f817d5ff1d09b13457f78faa3c069", "score": "0.5186514", "text": "func (r Hardware_Server) GetPublicBandwidthGraphImage(startTime *datatypes.Time, endTime *datatypes.Time) (resp []byte, err error) {\n\tparams := []interface{}{\n\t\tstartTime,\n\t\tendTime,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_Server\", \"getPublicBandwidthGraphImage\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "32c414d30d765ea30268495feed9fc75", "score": "0.51640606", "text": "func (r Hardware_SecurityModule750) GetBackendBandwidthUse(startDate *datatypes.Time, endDate *datatypes.Time) (resp []datatypes.Network_Bandwidth_Version1_Usage_Detail, err error) {\n\tparams := []interface{}{\n\t\tstartDate,\n\t\tendDate,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_SecurityModule750\", \"getBackendBandwidthUse\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "13590eb600891e00d706ec217f33b4c6", "score": "0.5127496", "text": "func (r Hardware) GetPublicBandwidthData(startTime *int, endTime *int) (resp []datatypes.Metric_Tracking_Object_Data, err error) {\n\tparams := []interface{}{\n\t\tstartTime,\n\t\tendTime,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware\", \"getPublicBandwidthData\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "e72ee9bca1b47b8381184776f45b2210", "score": "0.51090425", "text": "func (r Hardware_Server) GetPublicBandwidthTotal(startTime *int, endTime *int) (resp uint, err error) {\n\tparams := []interface{}{\n\t\tstartTime,\n\t\tendTime,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_Server\", \"getPublicBandwidthTotal\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "e8ad6649550c6cd54766ac350bfa1873", "score": "0.5099772", "text": "func (r Hardware_Router) GetPublicBandwidthData(startTime *int, endTime *int) (resp []datatypes.Metric_Tracking_Object_Data, err error) {\n\tparams := []interface{}{\n\t\tstartTime,\n\t\tendTime,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_Router\", \"getPublicBandwidthData\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "092315dab2b35f874aa88ae7c87dc563", "score": "0.5059947", "text": "func (r Hardware_Router) GetInboundBandwidthUsage() (resp datatypes.Float64, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_Router\", \"getInboundBandwidthUsage\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "c1c282c389f563ab7980607cf3a7547b", "score": "0.50421536", "text": "func (r Hardware_SecurityModule750) GetPublicBandwidthData(startTime *int, endTime *int) (resp []datatypes.Metric_Tracking_Object_Data, err error) {\n\tparams := []interface{}{\n\t\tstartTime,\n\t\tendTime,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_SecurityModule750\", \"getPublicBandwidthData\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "45da73c1ede651f945252d0f2c7be3ef", "score": "0.5028275", "text": "func (r Hardware_Server) GetCustomBandwidthDataByDate(graphData *datatypes.Container_Graph) (resp datatypes.Container_Graph, err error) {\n\tparams := []interface{}{\n\t\tgraphData,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_Server\", \"getCustomBandwidthDataByDate\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "7352c9faf0aad54dfc3bc2631686fcbc", "score": "0.50119233", "text": "func (r Hardware_SecurityModule) GetPublicBandwidthData(startTime *int, endTime *int) (resp []datatypes.Metric_Tracking_Object_Data, err error) {\n\tparams := []interface{}{\n\t\tstartTime,\n\t\tendTime,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_SecurityModule\", \"getPublicBandwidthData\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "894a862a05082262d363e3fc391761ae", "score": "0.5011917", "text": "func (r Hardware) GetInboundPublicBandwidthUsage() (resp datatypes.Float64, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware\", \"getInboundPublicBandwidthUsage\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "fbdf3fdbadc029e87cb59fa72f998c07", "score": "0.5005202", "text": "func (r Hardware_Server) GetPrivateBandwidthData(startTime *int, endTime *int) (resp []datatypes.Metric_Tracking_Object_Data, err error) {\n\tparams := []interface{}{\n\t\tstartTime,\n\t\tendTime,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_Server\", \"getPrivateBandwidthData\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "70dd85b1cd88cb8abcfe10a1854f3a66", "score": "0.49459356", "text": "func (r Hardware_Server) GetPrivateBandwidthGraphImage(startTime *string, endTime *string) (resp []byte, err error) {\n\tparams := []interface{}{\n\t\tstartTime,\n\t\tendTime,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_Server\", \"getPrivateBandwidthGraphImage\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "bcacb5412d9a892a32f7cbf899d1c783", "score": "0.49134445", "text": "func (r Hardware_SecurityModule750) GetPublicBandwidthGraphImage(startTime *datatypes.Time, endTime *datatypes.Time) (resp []byte, err error) {\n\tparams := []interface{}{\n\t\tstartTime,\n\t\tendTime,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_SecurityModule750\", \"getPublicBandwidthGraphImage\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "eed3aefb46ff138097ca837cfbd808ae", "score": "0.4901472", "text": "func (r Hardware_SecurityModule) GetPublicBandwidthGraphImage(startTime *datatypes.Time, endTime *datatypes.Time) (resp []byte, err error) {\n\tparams := []interface{}{\n\t\tstartTime,\n\t\tendTime,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_SecurityModule\", \"getPublicBandwidthGraphImage\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "b89f9b020dc12c88640e285d15926489", "score": "0.48886922", "text": "func (r Hardware_SecurityModule) GetInboundBandwidthUsage() (resp datatypes.Float64, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_SecurityModule\", \"getInboundBandwidthUsage\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "ef9b9930d1ce5512b630f1edf9eb9b66", "score": "0.48779544", "text": "func (r Hardware_Router) GetInboundPublicBandwidthUsage() (resp datatypes.Float64, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_Router\", \"getInboundPublicBandwidthUsage\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "eb2914260c62aec502e4c7b026c756d4", "score": "0.4874545", "text": "func (r Account) GetHistoricalBandwidthGraph(startDate *datatypes.Time, endDate *datatypes.Time) (resp datatypes.Container_Account_Graph_Outputs, err error) {\n\tparams := []interface{}{\n\t\tstartDate,\n\t\tendDate,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Account\", \"getHistoricalBandwidthGraph\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "ebca11f088eb2701cbeb3a3166544374", "score": "0.48057464", "text": "func (r Hardware) GetPrivateBandwidthData(startTime *int, endTime *int) (resp []datatypes.Metric_Tracking_Object_Data, err error) {\n\tparams := []interface{}{\n\t\tstartTime,\n\t\tendTime,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware\", \"getPrivateBandwidthData\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "646bd1e4f17f20a81e8106325dfab1a8", "score": "0.4803532", "text": "func (r Hardware_Server) GetBandwidthImage(networkType *string, snapshotRange *string, draw *bool, dateSpecified *datatypes.Time, dateSpecifiedEnd *datatypes.Time) (resp datatypes.Container_Bandwidth_GraphOutputs, err error) {\n\tparams := []interface{}{\n\t\tnetworkType,\n\t\tsnapshotRange,\n\t\tdraw,\n\t\tdateSpecified,\n\t\tdateSpecifiedEnd,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_Server\", \"getBandwidthImage\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "aead48b55f4371d2f972858510e5b4b2", "score": "0.4787835", "text": "func (r Hardware_Router) GetPrivateBandwidthData(startTime *int, endTime *int) (resp []datatypes.Metric_Tracking_Object_Data, err error) {\n\tparams := []interface{}{\n\t\tstartTime,\n\t\tendTime,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_Router\", \"getPrivateBandwidthData\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "364ec6871db4bcf7d0023dbaf91a7817", "score": "0.47374052", "text": "func (r Hardware_SecurityModule) GetPublicBandwidthTotal(startTime *int, endTime *int) (resp uint, err error) {\n\tparams := []interface{}{\n\t\tstartTime,\n\t\tendTime,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_SecurityModule\", \"getPublicBandwidthTotal\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "b318b0f2a3c470036ef2d8323716e0e6", "score": "0.47368577", "text": "func (r Hardware_SecurityModule) GetInboundPublicBandwidthUsage() (resp datatypes.Float64, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_SecurityModule\", \"getInboundPublicBandwidthUsage\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "871d552b4c1e955869d79d3758bed7b1", "score": "0.47348198", "text": "func (r Hardware_SecurityModule750) GetPublicBandwidthTotal(startTime *int, endTime *int) (resp uint, err error) {\n\tparams := []interface{}{\n\t\tstartTime,\n\t\tendTime,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_SecurityModule750\", \"getPublicBandwidthTotal\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "1097b429124cbc9ed3f7bafd1eeebb45", "score": "0.47135", "text": "func (r Hardware_SecurityModule750) GetCustomBandwidthDataByDate(graphData *datatypes.Container_Graph) (resp datatypes.Container_Graph, err error) {\n\tparams := []interface{}{\n\t\tgraphData,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_SecurityModule750\", \"getCustomBandwidthDataByDate\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "7c4aaaefcea4c0a9f8161b539d5eae10", "score": "0.47083333", "text": "func (r Hardware_SecurityModule750) GetInboundBandwidthUsage() (resp datatypes.Float64, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_SecurityModule750\", \"getInboundBandwidthUsage\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "6384b11617831a826479cafca0bbb87c", "score": "0.47078142", "text": "func (r Hardware_SecurityModule750) GetPrivateBandwidthGraphImage(startTime *string, endTime *string) (resp []byte, err error) {\n\tparams := []interface{}{\n\t\tstartTime,\n\t\tendTime,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_SecurityModule750\", \"getPrivateBandwidthGraphImage\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "8dfe0b3f92374b854b3b8dc03bdd4db3", "score": "0.46606305", "text": "func (r Hardware_SecurityModule) GetPrivateBandwidthGraphImage(startTime *string, endTime *string) (resp []byte, err error) {\n\tparams := []interface{}{\n\t\tstartTime,\n\t\tendTime,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_SecurityModule\", \"getPrivateBandwidthGraphImage\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "e78a404622c45c35bd9f1d11a50c0774", "score": "0.46562266", "text": "func (r Hardware_SecurityModule) GetCustomBandwidthDataByDate(graphData *datatypes.Container_Graph) (resp datatypes.Container_Graph, err error) {\n\tparams := []interface{}{\n\t\tgraphData,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_SecurityModule\", \"getCustomBandwidthDataByDate\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "21363f6f7aa5789ad60772834e1f4e37", "score": "0.4644887", "text": "func (r Hardware_SecurityModule750) GetPrivateBandwidthData(startTime *int, endTime *int) (resp []datatypes.Metric_Tracking_Object_Data, err error) {\n\tparams := []interface{}{\n\t\tstartTime,\n\t\tendTime,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_SecurityModule750\", \"getPrivateBandwidthData\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "0f76ec0ba3ad09631f07bd8d92a52980", "score": "0.46316788", "text": "func (r Hardware_Server) GetOutboundPublicBandwidthUsage() (resp datatypes.Float64, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_Server\", \"getOutboundPublicBandwidthUsage\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "a89178b02b77b920c03897a3fe461421", "score": "0.4624321", "text": "func (r Hardware_Server) GetDailyAverage(startDate *datatypes.Time, endDate *datatypes.Time) (resp datatypes.Float64, err error) {\n\tparams := []interface{}{\n\t\tstartDate,\n\t\tendDate,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_Server\", \"getDailyAverage\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "a52e68bab7ed33ad3338753a34161c3d", "score": "0.46225595", "text": "func (r Hardware_SecurityModule) GetPrivateBandwidthData(startTime *int, endTime *int) (resp []datatypes.Metric_Tracking_Object_Data, err error) {\n\tparams := []interface{}{\n\t\tstartTime,\n\t\tendTime,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_SecurityModule\", \"getPrivateBandwidthData\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "05b8c93d7181a3123ee58f9fe9f4ac26", "score": "0.46037006", "text": "func (r Hardware_Server) GetHourlyBandwidth(mode *string, day *datatypes.Time) (resp []datatypes.Metric_Tracking_Object_Data, err error) {\n\tparams := []interface{}{\n\t\tmode,\n\t\tday,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_Server\", \"getHourlyBandwidth\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "ef16a88527f7629ed2acfd6849171a71", "score": "0.45981336", "text": "func (r Hardware_SecurityModule750) GetBandwidthImage(networkType *string, snapshotRange *string, draw *bool, dateSpecified *datatypes.Time, dateSpecifiedEnd *datatypes.Time) (resp datatypes.Container_Bandwidth_GraphOutputs, err error) {\n\tparams := []interface{}{\n\t\tnetworkType,\n\t\tsnapshotRange,\n\t\tdraw,\n\t\tdateSpecified,\n\t\tdateSpecifiedEnd,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_SecurityModule750\", \"getBandwidthImage\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "e6c1d55729236fa8b6b465d8e731ca30", "score": "0.457811", "text": "func (r Hardware_SecurityModule) GetInboundPrivateBandwidthUsage() (resp datatypes.Float64, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_SecurityModule\", \"getInboundPrivateBandwidthUsage\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "047f4ec4605c0ab1860fb9216e887970", "score": "0.4564037", "text": "func (r Hardware_Server) GetAverageDailyBandwidthUsage() (resp datatypes.Float64, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_Server\", \"getAverageDailyBandwidthUsage\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "050461fd6576263345b31c56d8fc98f6", "score": "0.45494482", "text": "func (r Hardware_Server) GetAverageDailyPublicBandwidthUsage() (resp datatypes.Float64, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_Server\", \"getAverageDailyPublicBandwidthUsage\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "e12f725de444ea76b3299a1a201b35bc", "score": "0.45365956", "text": "func (r Hardware_SecurityModule750) GetInboundPublicBandwidthUsage() (resp datatypes.Float64, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_SecurityModule750\", \"getInboundPublicBandwidthUsage\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "b5c85d38f7c02d58b7dbe2f89c6bbf53", "score": "0.45275667", "text": "func (r Hardware_Server) GetOutboundBandwidthUsage() (resp datatypes.Float64, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_Server\", \"getOutboundBandwidthUsage\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "d485cd08df5ce143092f1c7b004d2327", "score": "0.45263612", "text": "func RestGetReadingByDeviceNameInTimeRange(w http.ResponseWriter, r *http.Request) {\n\tdefer r.Body.Close()\n\n\tvars := mux.Vars(r)\n\tdevicename := vars[DEVICENAME]\n\tstart := vars[START]\n\tend := vars[END]\n\tlimit := vars[LIMIT]\n\n\tstartInt, _ := strconv.ParseInt(start, 10, 64)\n\tendInt, _ := strconv.ParseInt(end, 10, 64)\n\tlimitInt, _ := strconv.ParseInt(limit, 10, 64)\n\n\tbody, err := getReadingByDeviceNameInTimeRange(devicename, startInt, endInt, limitInt)\n\treponseHTTPrequest(w, body, err)\n}", "title": "" }, { "docid": "36471f9cc615f129aa6c7ea1541e107c", "score": "0.45197767", "text": "func (r Hardware_SecurityModule) GetBandwidthImage(networkType *string, snapshotRange *string, draw *bool, dateSpecified *datatypes.Time, dateSpecifiedEnd *datatypes.Time) (resp datatypes.Container_Bandwidth_GraphOutputs, err error) {\n\tparams := []interface{}{\n\t\tnetworkType,\n\t\tsnapshotRange,\n\t\tdraw,\n\t\tdateSpecified,\n\t\tdateSpecifiedEnd,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_SecurityModule\", \"getBandwidthImage\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "2e75e75f31ed9580549023016a873583", "score": "0.44691283", "text": "func CalculateBandwidth(ctx context.Context, bRead chan int64) {\n\t// no mutex required for these as only one of the select cases below\n\t// can be running at a time\n\tvar total int64\n\tvar prevSecond int64\n\tstart := time.Now()\n\tticker := time.NewTicker(1 * time.Second)\n\tdefer ticker.Stop()\n\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase n := <-bRead:\n\t\t\t\ttotal += n\n\t\t\t\tprevSecond += n\n\t\t\tcase _ = <-ticker.C:\n\t\t\t\telapsed := time.Since(start)\n\t\t\t\tprevDesc := getUnits(prevSecond)\n\t\t\t\ttotalDesc := getUnits(total)\n\t\t\t\tavg := totalDesc.count / elapsed.Seconds()\n\t\t\t\tfmt.Printf(\"\\rcurrent: %.0f %v/s\\t\", prevDesc.count, prevDesc.desc)\n\t\t\t\tfmt.Printf(\"average: %.4f %v/s\", avg, totalDesc.desc)\n\t\t\t\tprevSecond = 0\n\t\t\t}\n\t\t}\n\t}()\n\n\t<-ctx.Done()\n\telapsed := time.Since(start)\n\ttotalDesc := getUnits(total)\n\tfmt.Printf(\"\\ntotal bytes read in %.2f seconds: %.0f %v\\n\",\n\t\telapsed.Seconds(),\n\t\ttotalDesc.count,\n\t\ttotalDesc.desc)\n\treturn\n}", "title": "" }, { "docid": "404467cc1e578f26ec1abbbe7f997d7d", "score": "0.4436307", "text": "func (r Hardware_SecurityModule750) GetInboundPrivateBandwidthUsage() (resp datatypes.Float64, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_SecurityModule750\", \"getInboundPrivateBandwidthUsage\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "1d4f465dc7d676685e3c22b770d92265", "score": "0.44063574", "text": "func (r Hardware_Server) GetAverageDailyPrivateBandwidthUsage() (resp datatypes.Float64, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_Server\", \"getAverageDailyPrivateBandwidthUsage\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "1629451f5a65db82a1a563fb3e6dc39d", "score": "0.4368093", "text": "func (ah *APIHandler) GetStatisticsInBlocks(from time.Time, to time.Time, blockSize time.Duration) ([]*Statistics, error) {\n\tif !from.Before(to) {\n\t\treturn nil, fmt.Errorf(\"from (%s) must be strictly earlier than to (%s)\", from.String(), to.String())\n\t}\n\n\tif to.Sub(from) > (time.Hour * 24 * 30) {\n\t\treturn nil, fmt.Errorf(\"The maximum date range is limited to 30 days. From (%s) To (%s)\", from.String(), to.String())\n\t}\n\n\tblockSizeHours := int(blockSize.Hours())\n\n\tif blockSizeHours < 1 || blockSizeHours > 24 {\n\t\treturn nil, fmt.Errorf(\"Invalid blocksize %s; must be between 1 and 24 hours inclusive\", blockSize.String())\n\t}\n\n\tresponseBytes, err := ah.getAPIResponse(fmt.Sprintf(\"/intensity/stats/%s/%s/%d\", from.Format(natGridTimeFormat),\n\t\tto.Format(natGridTimeFormat), blockSizeHours))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse := statisticsResponse{}\n\tif err := json.Unmarshal(responseBytes, &response); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn response.entries, nil\n}", "title": "" }, { "docid": "f9d0b1b8c651442c81874a1b931e6511", "score": "0.43582076", "text": "func (r Hardware_Router) GetDailyAverage(startDate *datatypes.Time, endDate *datatypes.Time) (resp datatypes.Float64, err error) {\n\tparams := []interface{}{\n\t\tstartDate,\n\t\tendDate,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_Router\", \"getDailyAverage\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "fd2e195c20eb9be3b1b63fce4bf544b3", "score": "0.43560323", "text": "func (r Hardware) GetHourlyBandwidth(mode *string, day *datatypes.Time) (resp []datatypes.Metric_Tracking_Object_Data, err error) {\n\tparams := []interface{}{\n\t\tmode,\n\t\tday,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware\", \"getHourlyBandwidth\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "b8710940753f7728f0c26aa175bf41e0", "score": "0.43506745", "text": "func (r Hardware_Server) GetCurrentBandwidthSummary() (resp datatypes.Metric_Tracking_Object_Bandwidth_Summary, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_Server\", \"getCurrentBandwidthSummary\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "f7c838038aa1dd1bc13bd337a2ae2e84", "score": "0.4324937", "text": "func (r Hardware_Server) GetBandwidthAllocation() (resp datatypes.Float64, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_Server\", \"getBandwidthAllocation\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "e45a8e5d92622ce75f94f7a251346004", "score": "0.4314386", "text": "func (aaa *FriendsService) GetIncomingFriendRequests(input *friends.GetIncomingFriendRequestsParams) (*lobbyclientmodels.ModelLoadIncomingFriendsWithTimeResponse, error) {\n\ttoken, err := aaa.TokenRepository.GetToken()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tok, badRequest, unauthorized, forbidden, internalServerError, err := aaa.Client.Friends.GetIncomingFriendRequests(input, client.BearerToken(*token.AccessToken))\n\tif badRequest != nil {\n\t\treturn nil, badRequest\n\t}\n\tif unauthorized != nil {\n\t\treturn nil, unauthorized\n\t}\n\tif forbidden != nil {\n\t\treturn nil, forbidden\n\t}\n\tif internalServerError != nil {\n\t\treturn nil, internalServerError\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn ok.GetPayload(), nil\n}", "title": "" }, { "docid": "26d696e015b51a6602d5fa050d7371f7", "score": "0.43113062", "text": "func (r Hardware_Router) GetHourlyBandwidth(mode *string, day *datatypes.Time) (resp []datatypes.Metric_Tracking_Object_Data, err error) {\n\tparams := []interface{}{\n\t\tmode,\n\t\tday,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_Router\", \"getHourlyBandwidth\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "761c09fd23e22c8801ffa99c78b73c0d", "score": "0.42946157", "text": "func (r Hardware) GetDailyAverage(startDate *datatypes.Time, endDate *datatypes.Time) (resp datatypes.Float64, err error) {\n\tparams := []interface{}{\n\t\tstartDate,\n\t\tendDate,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware\", \"getDailyAverage\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "8370b872a882a3324ff3dd56a88f85d7", "score": "0.4225772", "text": "func (r Hardware_SecurityModule750) GetHourlyBandwidth(mode *string, day *datatypes.Time) (resp []datatypes.Metric_Tracking_Object_Data, err error) {\n\tparams := []interface{}{\n\t\tmode,\n\t\tday,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_SecurityModule750\", \"getHourlyBandwidth\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "69547ee4667378fed0d6235906c5cb58", "score": "0.42091784", "text": "func (o *MicrosoftGraphWindowsFirewallNetworkProfile) SetIncomingTrafficBlocked(v bool) {\n\to.IncomingTrafficBlocked = &v\n}", "title": "" }, { "docid": "29b7f77abcf7779915bd815c7bf6a46c", "score": "0.42028406", "text": "func (r Hardware) GetOutboundPublicBandwidthUsage() (resp datatypes.Float64, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware\", \"getOutboundPublicBandwidthUsage\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "b2f09e48ad773bdef165fd302aa6cbb9", "score": "0.41778776", "text": "func (r Hardware_Server) GetCurrentBillableBandwidthUsage() (resp datatypes.Float64, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_Server\", \"getCurrentBillableBandwidthUsage\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "b295ea0dd09dbbfec43cc11b5a5ddf17", "score": "0.417019", "text": "func (r Hardware_SecurityModule) GetHourlyBandwidth(mode *string, day *datatypes.Time) (resp []datatypes.Metric_Tracking_Object_Data, err error) {\n\tparams := []interface{}{\n\t\tmode,\n\t\tday,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_SecurityModule\", \"getHourlyBandwidth\", params, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "4de0103ff9c1df4827060766ff385f9e", "score": "0.41470262", "text": "func (r Hardware_Router) GetOutboundPublicBandwidthUsage() (resp datatypes.Float64, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware_Router\", \"getOutboundPublicBandwidthUsage\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "0421dacf7a970248bbec5331f2fbb015", "score": "0.4131208", "text": "func (r Hardware) GetOutboundBandwidthUsage() (resp datatypes.Float64, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware\", \"getOutboundBandwidthUsage\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "aa417c29b6e29c6a8c7c033bb2dd3734", "score": "0.41296038", "text": "func HTTPMeasures(w rest.ResponseWriter, r *rest.Request) {\n\n\tfilters := backend.TrafficMeasureFilter{\n\t\tContext: r.PathParam(\"context\"),\n\t\tPool: r.PathParam(\"clientId\"),\n\t\tFromDate: time.Time{},\n\t\tToDate: time.Time{},\n\t}\n\n\tmeasures := backend.GetGraphData(filters)\n\tw.WriteJson(&measures)\n}", "title": "" }, { "docid": "6f8f270a572d42f5f41a1178b6236654", "score": "0.411781", "text": "func (r Hardware) GetAverageDailyPublicBandwidthUsage() (resp datatypes.Float64, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Hardware\", \"getAverageDailyPublicBandwidthUsage\", nil, &r.Options, &resp)\n\treturn\n}", "title": "" }, { "docid": "e6a4a36c1719acf9aa65a4ec3726db14", "score": "0.41051248", "text": "func (aaa *FriendsService) GetUserIncomingFriendsWithTime(input *friends.GetUserIncomingFriendsWithTimeParams) ([]*lobbyclientmodels.ModelLoadIncomingFriendsWithTimeResponse, error) {\n\ttoken, err := aaa.TokenRepository.GetToken()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tok, badRequest, unauthorized, forbidden, notFound, internalServerError, err := aaa.Client.Friends.GetUserIncomingFriendsWithTime(input, client.BearerToken(*token.AccessToken))\n\tif badRequest != nil {\n\t\treturn nil, badRequest\n\t}\n\tif unauthorized != nil {\n\t\treturn nil, unauthorized\n\t}\n\tif forbidden != nil {\n\t\treturn nil, forbidden\n\t}\n\tif notFound != nil {\n\t\treturn nil, notFound\n\t}\n\tif internalServerError != nil {\n\t\treturn nil, internalServerError\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn ok.GetPayload(), nil\n}", "title": "" } ]
0ccd4b29b6dd08ca3f4bc296c5fe9a3e
Validate validates this negotiable quote data negotiable quote item interface
[ { "docid": "b1ffefdbdbd88762c282f1fcad9e3654", "score": "0.76359564", "text": "func (m *NegotiableQuoteDataNegotiableQuoteItemInterface) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateItemID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateOriginalDiscountAmount(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateOriginalPrice(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateOriginalTaxAmount(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": "7a7beccc553aa9425d1b2bb5a8b64934", "score": "0.6724123", "text": "func (i *Item) Validate() (err error) {\n\terr = validate.Struct(i)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif i.Name != \"\" {\n\t\tif valid, _ := regexp.Match(`^[a-zA-Z0-9 ]{2,50}$`, []byte(i.Name)); !valid {\n\t\t\treturn errInvalidName\n\t\t}\n\t}\n\n\tif i.ProduceCode != \"\" {\n\t\tif valid, _ := regexp.Match(`^([a-zA-Z0-9]{4}-){3}[a-zA-Z0-9]{4}$`, []byte(i.ProduceCode)); !valid {\n\t\t\treturn errInvalidProductCode\n\t\t}\n\t}\n\n\ti.UnitPrice = math.Round(i.UnitPrice*100) / 100\n\n\treturn nil\n}", "title": "" }, { "docid": "ee184793895df445be43e6317f46f008", "score": "0.6586107", "text": "func (o *OrderItem) Validate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "title": "" }, { "docid": "b37f9cd922a716cfa9df78b2ad21d9c9", "score": "0.6466593", "text": "func (m *CurrencyPriceQuote) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateExpirationTime(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validatePrice(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateQuoteID(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateSourceCurrency(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateStartTime(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateTargetCurrency(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": "f288bdf438ba1a9c78172f6c5d0d432e", "score": "0.6408959", "text": "func (i Item) Validate() error {\n\tif err := i.Ident.Validate(); err != nil {\n\t\treturn err\n\t}\n\tif len(i.Data) > MaxDataSize {\n\t\treturn errors.New(\"data is greater than 1MB\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "48c9eecb8d7d552b0b6db97947ec0ed7", "score": "0.62964255", "text": "func (m *QuoteRequest) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateLimitMax(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateOfiID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateSourceAsset(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateTargetAsset(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateTimeExpire(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\tif err := m.validateTimeExpire(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\tif err := m.sanityCheck(); err != nil {\n\t\tres = append(res, err)\n\t}\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "117c6e346a0c4a96d20f512e01c98db7", "score": "0.62958837", "text": "func (transactionItem *TransactionItem) Validate() (map[string]interface{}, bool) {\n\tif transactionItem.Qty == \"\" {\n\t\treturn u.Message(false, \"Qty should be on the payload\"), false\n\t}\n\tif len(transactionItem.Price) < 1 {\n\t\treturn u.Message(false, \"Price is required\"), false\n\t}\n\t//All the required parameters are present\n\treturn u.Message(true, \"success\"), true\n}", "title": "" }, { "docid": "0395973a73d5e0701b716286045288bf", "score": "0.6230812", "text": "func (ut *QuotePayload) Validate() (err error) {\n\tif ut.Name != nil {\n\t\tif utf8.RuneCountInString(*ut.Name) < 2 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`type.Name`, *ut.Name, utf8.RuneCountInString(*ut.Name), 2, true))\n\t\t}\n\t}\n\tif ut.Quote != nil {\n\t\tif utf8.RuneCountInString(*ut.Quote) < 2 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`type.Quote`, *ut.Quote, utf8.RuneCountInString(*ut.Quote), 2, true))\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "ddcdcdb9eb940c072cf225626107af43", "score": "0.61223125", "text": "func (ut *quotePayload) Validate() (err error) {\n\tif ut.Name != nil {\n\t\tif utf8.RuneCountInString(*ut.Name) < 2 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`request.Name`, *ut.Name, utf8.RuneCountInString(*ut.Name), 2, true))\n\t\t}\n\t}\n\tif ut.Quote != nil {\n\t\tif utf8.RuneCountInString(*ut.Quote) < 2 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`request.Quote`, *ut.Quote, utf8.RuneCountInString(*ut.Quote), 2, true))\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "9e98dd25c173c6cf80f2883ad4813e01", "score": "0.6113223", "text": "func (core *ItemCore) Validate() error {\n\treturn validation.ValidateStruct(core,\n\t\tvalidation.Field(&core.PublicationUUID, validation.Required, is.UUID, validation.By(checkUUIDNotNil)),\n\t\tvalidation.Field(&core.PublishedDate, validation.Required),\n\t\tvalidation.Field(&core.Title, validation.Required, validation.Length(5, 500)),\n\t\tvalidation.Field(&core.Description, validation.Length(10, 0)),\n\t\tvalidation.Field(&core.Content, validation.Length(10, 0)),\n\t\tvalidation.Field(&core.URL, is.URL),\n\t\tvalidation.Field(&core.LanguageCode, validation.Required, validation.Length(2, 2), isLanguageCode),\n\t)\n}", "title": "" }, { "docid": "ab8a9df17b41e043ffe490693cafd434", "score": "0.6105551", "text": "func (item *Item) Validate() error {\n\treturn validation.ValidateStruct(item,\n\t\tvalidation.Field(&item.UUID, validation.Required, is.UUID, validation.By(checkUUIDNotNil)),\n\t)\n}", "title": "" }, { "docid": "cca75a2a491614cba32d2ee56a76b57a", "score": "0.60601205", "text": "func (m Item) Validate() error {\n\treturn validation.Errors{}.Filter()\n}", "title": "" }, { "docid": "3f89719eae674e72c47a0379ac7c3010", "score": "0.60204303", "text": "func (m *QuoteDataCurrencyInterface) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "abb46c655a16828688215d6e9bf0e5cb", "score": "0.60081977", "text": "func (ci *CreditItem) Validate() error {\n\tif err := ci.fieldInclusion(); err != nil {\n\t\treturn err\n\t}\n\tif ci.recordType != \"62\" {\n\t\tmsg := fmt.Sprintf(msgRecordType, 62)\n\t\treturn &FieldError{FieldName: \"recordType\", Value: ci.recordType, Msg: msg}\n\t}\n\tif ci.DocumentationTypeIndicator != \"\" {\n\t\t// Z is valid for CashLetter DocumentationTypeIndicator only\n\t\tif ci.DocumentationTypeIndicator == \"Z\" {\n\t\t\tmsg := fmt.Sprint(msgDocumentationTypeIndicator)\n\t\t\treturn &FieldError{FieldName: \"DocumentationTypeIndicator\", Value: ci.DocumentationTypeIndicator, Msg: msg}\n\t\t}\n\t\t// M is not valid for CreditItem DocumentationTypeIndicator\n\t\tif ci.DocumentationTypeIndicator == \"M\" {\n\t\t\tmsg := fmt.Sprint(msgDocumentationTypeIndicator)\n\t\t\treturn &FieldError{FieldName: \"DocumentationTypeIndicator\", Value: ci.DocumentationTypeIndicator, Msg: msg}\n\t\t}\n\t\tif err := ci.isDocumentationTypeIndicator(ci.DocumentationTypeIndicator); err != nil {\n\t\t\treturn &FieldError{FieldName: \"DocumentationTypeIndicator\", Value: ci.DocumentationTypeIndicator, Msg: err.Error()}\n\t\t}\n\t}\n\tif err := ci.isAccountTypeCode(ci.AccountTypeCode); err != nil {\n\t\treturn &FieldError{FieldName: \"AccountTypeCode\", Value: ci.AccountTypeCode, Msg: err.Error()}\n\t}\n\tif err := ci.isSourceWorkCode(ci.SourceWorkCode); err != nil {\n\t\treturn &FieldError{FieldName: \"SourceWorkCode\", Value: ci.SourceWorkCode, Msg: err.Error()}\n\t}\n\tif err := ci.isAlphanumericSpecial(ci.UserField); err != nil {\n\t\treturn &FieldError{FieldName: \"UserField\", Value: ci.UserField, Msg: err.Error()}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d07b823dbbb4dfed241243b73206ccbf", "score": "0.59602195", "text": "func (m *SalesDataOrderItemInterface) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateExtensionAttributes(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateParentItem(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateProductOption(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateSku(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": "81150c059aed946d17032745c2fac6aa", "score": "0.58474827", "text": "func (m *UeidGnbCuCpE1ApIdItem) Validate() error {\n\treturn m.validate(false)\n}", "title": "" }, { "docid": "0b6b373a747d181d88ac88ead1839660", "score": "0.581812", "text": "func (item *ProvidersItem) validate() error {\n\tif item.ID == \"\" || item.Vendor == \"\" || item.Description == \"\" {\n\t\treturn errors.New(\"id, vendor and description can't be empty\")\n\t}\n\n\tif item.Configuration == nil {\n\t\treturn errors.New(\"Configuration can't be nil\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "cbb1ebc8c995702e69c0728860664329", "score": "0.58062977", "text": "func (o *NegotiableQuoteNegotiableQuoteManagementV1DeclinePostBody) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := o.validateQuoteID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateReason(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": "00b269dfd5cbeb30e2b25f000e94e938", "score": "0.57881165", "text": "func (ut *Skill) Validate() (err error) {\n\tif ut.Item != nil {\n\t\tif utf8.RuneCountInString(*ut.Item) > 20 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`type.item`, *ut.Item, utf8.RuneCountInString(*ut.Item), 20, false))\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "326f839d6cddd8839b4ed5ff3f16f09d", "score": "0.5770613", "text": "func (ut *customItemPayload) Validate() (err error) {\n\tif ut.Description == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"description\"))\n\t}\n\tif ut.Quantity == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"quantity\"))\n\t}\n\tif ut.Value == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"value\"))\n\t}\n\tif ut.Weight == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"weight\"))\n\t}\n\tif ut.OriginCountry == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"origin_country\"))\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "862a55a1cdbbfccf8cc90e0fb442a184", "score": "0.5765481", "text": "func (m *UeidGnbCuCpF1ApIdItem) Validate() error {\n\treturn m.validate(false)\n}", "title": "" }, { "docid": "ac88b56d743de744a40ee2d5ce8e0c1c", "score": "0.57514095", "text": "func (m *OrderItem) Validate() error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\t// no validation rules for Id\n\n\t// no validation rules for Price\n\n\t// no validation rules for Quantity\n\n\t// no validation rules for ProductId\n\n\t// no validation rules for OrderId\n\n\tif v, ok := interface{}(m.GetCreatedAt()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn OrderItemValidationError{\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\tif v, ok := interface{}(m.GetUpdatedAt()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn OrderItemValidationError{\n\t\t\t\tfield: \"UpdatedAt\",\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": "1072953495e2b1712634c4763ff31103", "score": "0.56666356", "text": "func (m *RequisitionListDataRequisitionListItemInterface) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateAddedAt(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateOptions(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateQty(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateRequisitionListID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateSku(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateStoreID(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": "c00ce9c707d14b188853f2ad6c1e2040", "score": "0.56479484", "text": "func (m *GiftCertificateItem) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateAmount(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateMessage(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateRecipientEmail(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": "c50cd004d151406219f9bf4b144a38f8", "score": "0.5646377", "text": "func (m *FulfillmentItem) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateItemID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateQuantity(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": "008f23c4e56e7c2303c0a932df07727d", "score": "0.5626634", "text": "func (m *Qci) Validate() error {\n\treturn m.validate(false)\n}", "title": "" }, { "docid": "fccde64ea52394b121530a2f72c8cd8f", "score": "0.5618918", "text": "func (p *PurchaseOrder) Validate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.Validate(\n\t\t&validators.UUIDIsPresent{Field: p.VendorID, Name: \"Vendor\"},\n\t\tvalidate.ValidatorFunc(func(errors *validate.Errors) {\n\t\t\tif !p.OrderDate.Valid {\n\t\t\t\terrors.Add(validators.GenerateKey(p.Vendor.Name), \"Must have order date\")\n\t\t\t}\n\t\t}),\n\t\tvalidate.ValidatorFunc(func(errors *validate.Errors) {\n\t\t\tif p.OrderDate.Valid && p.ReceivedDate.Valid && p.OrderDate.Time.Unix() > p.ReceivedDate.Time.Unix() {\n\t\t\t\terrors.Add(validators.GenerateKey(p.Vendor.Name+\" \"+p.OrderDate.Time.String()),\n\t\t\t\t\t\"Received date must be after order date\")\n\t\t\t}\n\t\t}),\n\t\tvalidate.ValidatorFunc(func(errors *validate.Errors) {\n\t\t\tif len(p.Items) == 0 {\n\t\t\t\terrors.Add(validators.GenerateKey(p.Vendor.Name), \"Must have order items\")\n\t\t\t}\n\t\t}),\n\t), nil\n}", "title": "" }, { "docid": "46930daf495b7ba8bf1f17d14b7d2293", "score": "0.5617173", "text": "func (ut *CustomItemPayload) Validate() (err error) {\n\tif ut.Description == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"description\"))\n\t}\n\tif ut.OriginCountry == \"\" {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`response`, \"origin_country\"))\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "ad346aa4d031fbd6607fd9fb9fbc2925", "score": "0.5607169", "text": "func (m *TriggerConditionIeItem) Validate() error {\n\treturn m.validate(false)\n}", "title": "" }, { "docid": "ccbde25253da0397dd92b98d2ee1c017", "score": "0.55785173", "text": "func (m *ItemReference) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.Reference.Validate(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": "3b00b3c513383924239adc708d040c54", "score": "0.55660194", "text": "func (m *FreqBandNrItem) Validate() error {\n\treturn m.validate(false)\n}", "title": "" }, { "docid": "9ec1b9e1930df010b76f752f4d923d73", "score": "0.5541686", "text": "func (quote *Quote) IsValid() bool {\n\treturn quote.Character() != nil && quote.Anime() != nil && quote.Creator() != nil\n}", "title": "" }, { "docid": "f7cedbec980eba2231bc277854f62300", "score": "0.5525865", "text": "func (m *PerQcireportListItem) Validate() error {\n\treturn m.validate(false)\n}", "title": "" }, { "docid": "73cecfcf44ec371f8896031c56db3c97", "score": "0.55178833", "text": "func (ut *skill) Validate() (err error) {\n\tif ut.Item != nil {\n\t\tif utf8.RuneCountInString(*ut.Item) > 20 {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidLengthError(`request.item`, *ut.Item, utf8.RuneCountInString(*ut.Item), 20, false))\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "ffe682d43564809b23ec100f3d6638ac", "score": "0.5471378", "text": "func (m *CustomerProductListItemPurchase) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateQuantity(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": "90876020191ea7d1aab1683c9d319968", "score": "0.5465264", "text": "func (o *NegotiableQuoteGiftCardAccountManagementV1SaveByQuoteIDPostBody) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := o.validateGiftCardAccountData(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": "d25f79cb01e513cfa55c0cbf8e332305", "score": "0.5459267", "text": "func (m DestinySpecialItemType) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\t// value enum\n\tif err := m.validateDestinySpecialItemTypeEnum(\"\", \"body\", m); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4bb0682b86f0054a9060104548a5221f", "score": "0.54416066", "text": "func (m *PerQcireportListItemFormat) Validate() error {\n\treturn m.validate(false)\n}", "title": "" }, { "docid": "5bd26efff83abe417f7d7bd83845f378", "score": "0.5411363", "text": "func (m *ErrorParametersItem) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "3adcb289867df3d0bcc94ce15c63b99d", "score": "0.53855085", "text": "func (c *Cart) Validate(tx *pop.Connection) (*validate.Errors, error) {\n\tvar err error\n\treturn validate.Validate(\n\t\t&validators.StringIsPresent{Field: c.Status, Name: \"Status\"},\n\t\t&validators.UUIDIsPresent{Field: c.UserID, Name: \"UserID\"},\n\t\t&validators.UUIDIsPresent{Field: c.ProductID, Name: \"ProductID\"},\n\t), err\n}", "title": "" }, { "docid": "11d1f1896a4070d1a69ef0472f82743f", "score": "0.53747934", "text": "func (o *OrderItem) ValidateCreate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "title": "" }, { "docid": "a7cc317d50722ded7d1d9119a3c090f3", "score": "0.53628594", "text": "func (m *CommentItem) Validate() error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\t// no validation rules for UserId\n\n\t// no validation rules for UserName\n\n\t// no validation rules for FoodId\n\n\t// no validation rules for FoodName\n\n\t// no validation rules for Comment\n\n\treturn nil\n}", "title": "" }, { "docid": "0c10d90a84e19f25c9fd8bd857183132", "score": "0.5357166", "text": "func (o *Order) Validate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "title": "" }, { "docid": "da2971a06e79dfe06db4d69a07416990", "score": "0.5354882", "text": "func (m *ItemInfo) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateCategoryPath(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\tif err := m.validateCreatedAt(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\tif err := m.validateEntitlementType(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\tif err := m.validateItemID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\tif err := m.validateItemType(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\tif err := m.validateLanguage(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\tif err := m.validateName(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\tif err := m.validateNamespace(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\tif err := m.validateRegion(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\tif err := m.validateStatus(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\tif err := m.validateTitle(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\tif err := m.validateUpdatedAt(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": "1ed63ff23aab721545e4fa8d2035e21c", "score": "0.53487116", "text": "func (m *CatalogDataBasePriceInterface) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validatePrice(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateSku(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateStoreID(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": "dc10129f41fc96e31a4979dadd504f01", "score": "0.5340893", "text": "func (m *DomainAssessmentItems) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateOsSignals(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateSensorSignals(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": "a388192d9ec6ed58bd0b263d7066f178", "score": "0.53090626", "text": "func (m *ConfigurationBundleInputsItemsExtractorsItems) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateConditionType(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateCursorStrategy(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateType(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": "d625adfb411af04a0d1f3e5e2bcc27c4", "score": "0.5308212", "text": "func (k KerbalItems) Validate() error {\n\tfor item, value := range k {\n\t\tif requiredItems[item] && value == \"\" {\n\t\t\treturn errors.New(fmt.Sprintf(\"%s item is required\", item))\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a6930dac0a64b9d80780a08b89769fb4", "score": "0.52951455", "text": "func (Product) Validate(v interface{}) error {\n\treturn nil\n}", "title": "" }, { "docid": "e6bc952bb92554cba4b0879b4fd7434b", "score": "0.52941906", "text": "func (o *DetailsItems0) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "536da767b0f42fbfa43e35bdc4893aea", "score": "0.52899057", "text": "func (entity *SubstanceDrugPurchase) Valid() (bool, error) {\n\tvar stack model.ErrorStack\n\n\tif ok, err := entity.Involved.Valid(); !ok {\n\t\tstack.Append(\"DrugPurchase\", err)\n\t}\n\n\tif entity.Involved.Value == \"Yes\" {\n\t\tif ok, err := entity.List.Valid(); !ok {\n\t\t\tstack.Append(\"DrugPurchase\", err)\n\t\t}\n\t}\n\n\treturn !stack.HasErrors(), stack\n}", "title": "" }, { "docid": "8ef64071efbf9f84bb97db81e77dd563", "score": "0.5269597", "text": "func (m *MTOServiceItem) Validate(_ *pop.Connection) (*validate.Errors, error) {\n\tvar vs []validate.Validator\n\tvs = append(vs, &validators.StringInclusion{Field: string(m.Status), Name: \"Status\", List: []string{\n\t\tstring(MTOServiceItemStatusSubmitted),\n\t\tstring(MTOServiceItemStatusApproved),\n\t\tstring(MTOServiceItemStatusRejected),\n\t}})\n\tvs = append(vs, &validators.UUIDIsPresent{Field: m.MoveTaskOrderID, Name: \"MoveTaskOrderID\"})\n\tvs = append(vs, &OptionalUUIDIsPresent{Field: m.MTOShipmentID, Name: \"MTOShipmentID\"})\n\tvs = append(vs, &validators.UUIDIsPresent{Field: m.ReServiceID, Name: \"ReServiceID\"})\n\tvs = append(vs, &StringIsNilOrNotBlank{Field: m.Reason, Name: \"Reason\"})\n\tvs = append(vs, &StringIsNilOrNotBlank{Field: m.PickupPostalCode, Name: \"PickupPostalCode\"})\n\tvs = append(vs, &StringIsNilOrNotBlank{Field: m.Description, Name: \"Description\"})\n\n\treturn validate.Validate(vs...), nil\n}", "title": "" }, { "docid": "9e1f27d5e4c5190ed54624c3542a8f88", "score": "0.52691156", "text": "func (m *RegionDataItem) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateCurrencyCode(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\tif err := m.validateCurrencyNamespace(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\tif err := m.validateCurrencyType(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": "3c2315b5d9f73b68a9d9aabe4becad9c", "score": "0.5261015", "text": "func (entity *SubstanceAlcoholOrdered) Valid() (bool, error) {\n\tvar stack model.ErrorStack\n\n\tif ok, err := entity.HasBeenOrdered.Valid(); !ok {\n\t\tstack.Append(\"AlcoholOrdered\", err)\n\t}\n\n\tif entity.HasBeenOrdered.Value == \"Yes\" {\n\t\tif ok, err := entity.List.Valid(); !ok {\n\t\t\tstack.Append(\"AlcoholOrdered\", err)\n\t\t}\n\t}\n\n\treturn !stack.HasErrors(), stack\n}", "title": "" }, { "docid": "99cebf0e13d18f5e2ce801925b8ad747", "score": "0.5255218", "text": "func (d DeviceQueueItem) Validate() error {\n\tif d.FPort == 0 {\n\t\treturn ErrInvalidFPort\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2eb251617e3c8e023546541fc8d37f72", "score": "0.5248192", "text": "func (entity *SubstanceDrugOrdered) Valid() (bool, error) {\n\tvar stack model.ErrorStack\n\n\tif ok, err := entity.Involved.Valid(); !ok {\n\t\tstack.Append(\"DrugOrdered\", err)\n\t}\n\n\tif entity.Involved.Value == \"Yes\" {\n\t\tif ok, err := entity.List.Valid(); !ok {\n\t\t\tstack.Append(\"DrugOrdered\", err)\n\t\t}\n\t}\n\n\treturn !stack.HasErrors(), stack\n}", "title": "" }, { "docid": "5501d5e161a92a5189d4bd9966abc921", "score": "0.5246406", "text": "func (c *CountInventoryItem) Validate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "title": "" }, { "docid": "70450f19bba167fa2dde8b6459e1c0af", "score": "0.5245603", "text": "func ValidateItem(b interface{}, rawType, resourcetype string) (out interface{}, err error) {\n\tisRef := false\n\tout = b\n\n\tif b == nil {\n\t\tlog.Printf(\"field not provided %s\", resourcetype)\n\t\treturn\n\t}\n\n\tout, isRef = refFlatter(b)\n\t// not reference and not primitive type\n\tif !isRef && !primitiveSpecTypes[rawType] {\n\t\t// looking for the type in properties\n\t\tproperty, propError := getProperty(resourcetype+\".\"+rawType, b)\n\n\t\tif propError != nil {\n\t\t\terr = propError\n\t\t} else {\n\t\t\tout = property\n\t\t}\n\t}\n\n\treturn\n\n}", "title": "" }, { "docid": "57a0946abd771eb12eab09f3af95b9dc", "score": "0.5242151", "text": "func (m *RegistryItem) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateAdjacents(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateDao(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateEdge(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateGeneric(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateNode(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateServer(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateService(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": "41f500ca29e4f3b1a3006306b5bbf152", "score": "0.52279794", "text": "func (m *DealInstance) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateLinks(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateCategoryIds(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateDealID(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateDescription(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateEndsAt(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateFeatured(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validatePublishedAt(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateStartsAt(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateState(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateStateEvents(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateStores(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateSubtitle(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateTermsAndConditions(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateTitle(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateUpdatedAt(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": "81c3211de2bead8c9f368cbff642ebfe", "score": "0.522212", "text": "func (m *BigNumberItem) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateColorThresholds(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateDataPointName(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateUseCommaSeparators(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": "edf51e18d4c5afd2e49b2c1f7001a829", "score": "0.5207258", "text": "func (o *PostItemBody) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := o.validateComment(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := o.validateName(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": "040f06ca7947893954bb4a29b9961399", "score": "0.5206971", "text": "func (i *Issuance) Valid(idKey factom.IDKey) error {\n\tif err := i.UnmarshalEntry(); err != nil {\n\t\treturn err\n\t}\n\tif err := i.ValidExtIDs(); err != nil {\n\t\treturn err\n\t}\n\tif i.FAAddress(0) != idKey.Payload() {\n\t\treturn fmt.Errorf(\"invalid RCD\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "969d89f1ae12d10589161710e9fc27e7", "score": "0.51870936", "text": "func (m *QuoteRequestNotification) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateQuoteID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateQuoteRequest(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": "66826a1e6249a6d21ba03d18c35a9a85", "score": "0.51815176", "text": "func (m *DiscoveryImportItem) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateHTTPSPort(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateIP(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validatePassword(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateUsername(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": "d2488afe2d2cdaf6f43c9a63c98d03be", "score": "0.51744926", "text": "func (m *OrderItems) Validate() error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\tfor idx, item := range m.GetList() {\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 OrderItemsValidationError{\n\t\t\t\t\tfield: fmt.Sprintf(\"List[%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.GetPagination()).(interface{ Validate() error }); ok {\n\t\tif err := v.Validate(); err != nil {\n\t\t\treturn OrderItemsValidationError{\n\t\t\t\tfield: \"Pagination\",\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": "6233cf73ddac6883790a202cc3c58742", "score": "0.5159201", "text": "func (m *QuoteDataTotalSegmentExtensionInterface) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateTaxGrandtotalDetails(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": "3791bb6126b5cc8399e6c86819b9a402", "score": "0.5149013", "text": "func (i Ident) Validate() error {\n\tif err := i.Location.Validate(); err != nil {\n\t\treturn errors.Wrap(err, \"invalid location\")\n\t}\n\tif err := ValidateNamed(i.Variant, false); err != nil {\n\t\treturn errors.Wrap(err, \"invalid variant\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3564cdc1830c28af92ef8c8d9abec6b1", "score": "0.51478535", "text": "func (m *OrderOptionInstance) Validate(formats strfmt.Registry) error {\n\tvar res []error\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.validatePrice(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateQuantity(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": "56b94be271343a8aa4e29f67995a8a37", "score": "0.5140105", "text": "func (m *OrderRespFormFieldsItems0) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "af108823d6271f33d30f4f19643f3ffc", "score": "0.5139399", "text": "func (m *mTOServiceItem) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateMoveTaskOrderID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateMtoShipmentID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateServiceRequestDocuments(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateStatus(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": "d128175a8b82920f72b3e1b692e8600e", "score": "0.51131517", "text": "func (m *LineItemTax) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateTaxJurisType(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": "a733e1d6787d4bdbbda0b48b08c0eaf8", "score": "0.51006603", "text": "func (i Issuance) ValidData() error {\n\tif !i.Type.IsValid() {\n\t\treturn fmt.Errorf(`invalid \"type\": %v`, i.Type)\n\t}\n\tif i.Supply == 0 || i.Supply < -1 {\n\t\treturn fmt.Errorf(`invalid \"supply\": must be positive or -1`)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cc4c0e14caf4208e291f06eda22927c9", "score": "0.5100401", "text": "func (ut *workItem) Validate() (err error) {\n\tif ut.Type == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`request`, \"type\"))\n\t}\n\tif ut.Attributes == nil {\n\t\terr = goa.MergeErrors(err, goa.MissingAttributeError(`request`, \"attributes\"))\n\t}\n\tif ut.Relationships != nil {\n\t\tif err2 := ut.Relationships.Validate(); err2 != nil {\n\t\t\terr = goa.MergeErrors(err, err2)\n\t\t}\n\t}\n\tif ut.Type != nil {\n\t\tif !(*ut.Type == \"workitems\") {\n\t\t\terr = goa.MergeErrors(err, goa.InvalidEnumValueError(`request.type`, *ut.Type, []interface{}{\"workitems\"}))\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "8bf3bc77fafb9a8ec50bf450e6140bc9", "score": "0.50932175", "text": "func (m *LolInventoryInventoryItemDTO) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "9c4cf65a863e1dcc4667c209562244f6", "score": "0.5087029", "text": "func (m *Order) ValidateCreate() (e map[string]string) {\n\te = make(map[string]string)\n\t// validate if item empty or not\n\tif len(m.Items) == int(0) {\n\t\te[\"items\"] = \"cannot be empty\"\n\t} else {\n\t\tfor idx, x := range m.Items {\n\t\t\t// validate item name, tax_code_id\n\t\t\tif x.TaxCodeID == int(0) {\n\t\t\t\te[fmt.Sprintf(\"tax_code_id.%d\", idx)] = \"cannot be 0\"\n\t\t\t} else {\n\t\t\t\t// validate if tax code is exist in database\n\t\t\t\ttx := new(Taxcode)\n\t\t\t\tif err := tx.Read(\"id = ?\", x.TaxCodeID); err != nil {\n\t\t\t\t\te[fmt.Sprintf(\"tax_code_id.%d\", idx)] = err.Error()\n\t\t\t\t}\n\t\t\t}\n\t\t\tif x.ItemName == \"\" {\n\t\t\t\te[fmt.Sprintf(\"item_name.%d\", idx)] = \"cannot be empty\"\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "9717e8e1091f76910dea66a479fe6096", "score": "0.50860864", "text": "func (u *Question) Validate() error {\n\tif u.Content == \"\" {\n\t\treturn Errorf(EINVALID, \"Content required.\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7dbef3fe315835c37efe358c8be95662", "score": "0.5076085", "text": "func (m *GetReturnableItemsItems0) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateOptions(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateReferenceID(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": "50a69f831615ea2ce91c3f8f292c36c0", "score": "0.5074048", "text": "func (t *Tariff400ngItemRate) Validate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.Validate(\n\t\t&validators.StringIsPresent{Field: t.Code, Name: \"Code\"},\n\t\t&validators.IntIsPresent{Field: t.ServicesSchedule, Name: \"ServicesSchedule\"},\n\t\t&validators.IntIsGreaterThan{Field: t.RateCents.Int(), Name: \"RateCents\", Compared: -1},\n\t\t&validators.IntIsLessThan{Field: t.WeightLbsLower.Int(), Name: \"WeightLbsLower\",\n\t\t\tCompared: t.WeightLbsUpper.Int()},\n\t\t&validators.TimeAfterTime{\n\t\t\tFirstTime: t.EffectiveDateUpper, FirstName: \"EffectiveDateUpper\",\n\t\t\tSecondTime: t.EffectiveDateLower, SecondName: \"EffectiveDateLower\"},\n\t), nil\n}", "title": "" }, { "docid": "1efa653541a4015e0ff7d9f325ad1d98", "score": "0.506022", "text": "func VerifyQuote(q *pb.Quote, trustedPub crypto.PublicKey, extraData []byte) error {\n\tsig, err := tpm2.DecodeSignature(bytes.NewBuffer(q.GetRawSig()))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"signature decoding failed: %v\", err)\n\t}\n\n\thash, err := verifyHashAlg(sig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tswitch pub := trustedPub.(type) {\n\tcase *ecdsa.PublicKey:\n\t\tif err = verifyECDSAQuoteSignature(pub, hash, q.GetQuote(), sig); err != nil {\n\t\t\treturn err\n\t\t}\n\tcase *rsa.PublicKey:\n\t\tif err = verifyRSASSAQuoteSignature(pub, hash, q.GetQuote(), sig); err != nil {\n\t\t\treturn err\n\t\t}\n\tdefault:\n\t\treturn fmt.Errorf(\"only RSA and ECC public keys are currently supported, received type: %T\", pub)\n\t}\n\n\t// Decode and check for magic TPMS_GENERATED_VALUE.\n\tattestationData, err := tpm2.DecodeAttestationData(q.GetQuote())\n\tif err != nil {\n\t\treturn fmt.Errorf(\"decoding attestation data failed: %v\", err)\n\t}\n\tif attestationData.Type != tpm2.TagAttestQuote {\n\t\treturn fmt.Errorf(\"expected quote tag, got: %v\", attestationData.Type)\n\t}\n\tattestedQuoteInfo := attestationData.AttestedQuoteInfo\n\tif attestedQuoteInfo == nil {\n\t\treturn fmt.Errorf(\"attestation data does not contain quote info\")\n\t}\n\tif subtle.ConstantTimeCompare(attestationData.ExtraData, extraData) == 0 {\n\t\treturn fmt.Errorf(\"quote extraData %v did not match expected extraData %v\",\n\t\t\tattestationData.ExtraData, extraData)\n\t}\n\treturn validatePCRDigest(attestedQuoteInfo, q.GetPcrs(), hash)\n}", "title": "" }, { "docid": "d70afeb8ac0d819faa25636b4fe6e09f", "score": "0.50598866", "text": "func (m *Promotion) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateEndDate(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateStartDate(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": "fbc544226dcbd47446aae37f80bc3522", "score": "0.5053544", "text": "func (m *Payment) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateActualValue(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateCrmID(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateCurrency(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateGateway(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateInvoiceID(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateNominalValue(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateOrganizationID(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validatePaymentMethodID(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateRefundID(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateRefundedValue(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateRemainingNominalValue(formats); err != nil {\n\t\t// prop\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateType(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": "61fd8773dc0279cd39224289553cff7c", "score": "0.5053436", "text": "func (m *FqiperslicesPerPlmnListItem) Validate() error {\n\treturn m.validate(false)\n}", "title": "" }, { "docid": "44cabe5ace3de73b29d5810f224cd821", "score": "0.505181", "text": "func (pi *ProductItem) ValidateProductItemRequired() error {\n\tif pi.SKU == \"\" {\n\t\treturn &controller.BizError{ErrorCode: 401, Reason: \"SKU 是必须的\"}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8e15953ebdab40061d0d1aff469c9961", "score": "0.50512314", "text": "func (recipe *Recipe) Validate() error {\n\tvalidate := validator.New()\n\treturn validate.Struct(recipe)\n}", "title": "" }, { "docid": "6b8f1febef7371312f827c6e7848596f", "score": "0.5050955", "text": "func (m *FiveQi) Validate() error {\n\treturn m.validate(false)\n}", "title": "" }, { "docid": "13a440719b5e1745e6c8393006848627", "score": "0.5045605", "text": "func (entity *Benefit) Valid() (bool, error) {\n\tif ok, err := entity.Country.Valid(); !ok {\n\t\treturn false, err\n\t}\n\n\tif ok, err := entity.Value.Valid(); !ok {\n\t\treturn false, err\n\t}\n\n\tif ok, err := entity.Reason.Valid(); !ok {\n\t\treturn false, err\n\t}\n\n\tif ok, err := entity.Obligated.Valid(); !ok {\n\t\treturn false, err\n\t}\n\n\tif entity.Obligated.Value == \"Yes\" {\n\t\tif ok, err := entity.ObligatedExplanation.Valid(); !ok {\n\t\t\treturn false, err\n\t\t}\n\t}\n\n\treturn true, nil\n}", "title": "" }, { "docid": "e26af5518536dfb97402f0727048f92c", "score": "0.5044658", "text": "func (o *PromQOptions) Validate() error {\n // todo (validate)\n return nil\n}", "title": "" }, { "docid": "3157482a98b8074127369390a4a48059", "score": "0.5040269", "text": "func (o *OrderItem) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.NewErrors(), nil\n}", "title": "" }, { "docid": "eca61af9187013390752d0f94075b01e", "score": "0.5032825", "text": "func (o *GetPriceListRecordsByVariantIDOKBodyDataItems0AllOf1) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7900a2c44479c73d3091c5f03ce9d2d9", "score": "0.50321364", "text": "func (o *GenericItems0) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "0085ce2e4c3ed908d0a133179819d001", "score": "0.50315475", "text": "func (m *FqiperslicesPerPlmnPerCellListItem) Validate() error {\n\treturn m.validate(false)\n}", "title": "" }, { "docid": "ff95e34cab2fc18013ef24a43a7c3266", "score": "0.50252813", "text": "func (entity *SubstanceAlcoholAdditional) Valid() (bool, error) {\n\tvar stack model.ErrorStack\n\n\tif ok, err := entity.ReceivedTreatment.Valid(); !ok {\n\t\tstack.Append(\"AlcoholAdditional\", err)\n\t}\n\n\tif entity.ReceivedTreatment.Value == \"Yes\" {\n\t\tif ok, err := entity.List.Valid(); !ok {\n\t\t\tstack.Append(\"AlcoholAdditional\", err)\n\t\t}\n\t}\n\n\treturn !stack.HasErrors(), stack\n}", "title": "" }, { "docid": "6e1f564eeaf40d3d37b564e445857c53", "score": "0.5024057", "text": "func (l *Listing) Validate(tx *pop.Connection) (*validate.Errors, error) {\n\treturn validate.Validate(\n\t\t&validators.StringIsPresent{Field: l.Name, Name: \"Name\"},\n\t\t&validators.StringIsPresent{Field: l.Address1, Name: \"Address1\"},\n\t\t&validators.StringIsPresent{Field: l.City, Name: \"City\"},\n\t\t&validators.StringIsPresent{Field: l.State, Name: \"State\"},\n\t\t&validators.StringIsPresent{Field: l.Zipcode, Name: \"Zipcode\"},\n\t\t&validators.StringIsPresent{Field: l.PictureUrl, Name: \"PictureUrl\"},\n\t\t&validators.IntIsPresent{Field: l.Size, Name: \"Size\"},\n\t), nil\n}", "title": "" }, { "docid": "22c0620031c9ac6d9a66d32c4413af26", "score": "0.50222", "text": "func (m *PeriodicBilling) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateCreated(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateItem(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateOwner(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validatePeriod(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateStatus(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateUpdated(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateUpdater(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": "0464d528102c9cb439599fc8cb549363", "score": "0.50192666", "text": "func (m *Order) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateAttachment(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateAttn(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateChanges(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateContact(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateCurrency(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateCustomer(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateDeliveryAddress(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateDeliveryDate(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateDepartment(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateInvoicesDueIn(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateInvoicesDueInType(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateNumber(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateOrderDate(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateOrderLineSorting(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateOrderLines(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateOurContact(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateOurContactEmployee(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateOverdueNoticeEmail(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validatePreliminaryInvoice(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateProject(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateReceiverEmail(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateReference(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateSubscriptionDuration(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateSubscriptionDurationType(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateSubscriptionInvoicingTime(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateSubscriptionInvoicingTimeInAdvanceOrArrears(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateSubscriptionInvoicingTimeType(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateSubscriptionPeriodsOnInvoice(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateSubscriptionPeriodsOnInvoiceType(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": "777a81fd59123bf8f984a5f8907020db", "score": "0.50136906", "text": "func (quote *Quote) Publish() error {\n\t// No quote text\n\tif quote.Text.English == \"\" {\n\t\treturn errors.New(\"English quote text is required\")\n\t}\n\n\t// No character\n\tif quote.CharacterID == \"\" {\n\t\treturn errors.New(\"A character is required\")\n\t}\n\n\t// No anime\n\tif quote.AnimeID == \"\" {\n\t\treturn errors.New(\"An anime is required\")\n\t}\n\n\t// // No episode number\n\t// if quote.EpisodeNumber == -1 {\n\t// \treturn errors.New(\"An episode number is required\")\n\t// }\n\n\t// // No time\n\t// if quote.Time == -1 {\n\t// \treturn errors.New(\"Time in minutes is required\")\n\t// }\n\n\t// Invalid anime ID\n\tanime := quote.Anime()\n\n\tif anime == nil {\n\t\treturn errors.New(\"Invalid anime ID\")\n\t}\n\n\t// Invalid character ID\n\tcharacter := quote.Character()\n\n\tif character == nil {\n\t\treturn errors.New(\"Invalid character ID\")\n\t}\n\n\t// Invalid episode number\n\tmaxEpisodes := anime.EpisodeCount\n\n\tif maxEpisodes != 0 && quote.EpisodeNumber > maxEpisodes {\n\t\treturn errors.New(\"Invalid episode number\")\n\t}\n\n\treturn publish(quote)\n}", "title": "" }, { "docid": "617376a0e08d27f2b77799f3bac1f612", "score": "0.50010544", "text": "func (m *SalesDataInvoiceInterface) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateComments(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateExtensionAttributes(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateItems(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateOrderID(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateTotalQty(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": "ec0e52a563e64d6d95a9117ecf33a365", "score": "0.49966243", "text": "func (m *FoodListResp_FoodItem) Validate() error {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\t// no validation rules for Id\n\n\t// no validation rules for Name\n\n\t// no validation rules for Price\n\n\treturn nil\n}", "title": "" }, { "docid": "edb05ad8115f3a308255e291f2c2a69e", "score": "0.49958435", "text": "func (m *ResourceAddItem) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validatePlatformType(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateStatus(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": "2952b83762a79ca303dfc1dfe0320579", "score": "0.49933967", "text": "func (m *ServedPlmnPerCellListItem) Validate() error {\n\treturn m.validate(false)\n}", "title": "" } ]